[Olsr-cvs] olsrd-current/lib/txtinfo/src olsrd_txtinfo.c, 1.13, 1.14

Bernd Petrovitsch (spam-protected)
Mon Nov 5 16:32:57 CET 2007


Update of /cvsroot/olsrd/olsrd-current/lib/txtinfo/src
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv7211/lib/txtinfo/src

Modified Files:
	olsrd_txtinfo.c 
Log Message:
Cleanup:
* Merged "struct hna4_entry" and "struct hna6_entry" into
  "struct local_hna_entry" (as "struct hna_entry" is a different thing)
  Both have almost the same data (IP address + netmask/prefix) so we use
  the quite new "struct olsr_ip_prefix" to store it.
  Also merged the "hna4" and "hna6" pointer in "struct olsr_config" -
  look at the global "olsr_cnf->ip_version".
* const'ified here and there
* added a olsr_ip_prefix_to_string() function


Index: olsrd_txtinfo.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/lib/txtinfo/src/olsrd_txtinfo.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** olsrd_txtinfo.c	2 Nov 2007 20:58:07 -0000	1.13
--- olsrd_txtinfo.c	5 Nov 2007 15:32:55 -0000	1.14
***************
*** 402,407 ****
      struct hna_entry *tmp_hna;
      struct hna_net *tmp_net;
!     struct hna4_entry *hna4;
!     struct hna6_entry *hna6;
  
      size = 0;
--- 402,406 ----
      struct hna_entry *tmp_hna;
      struct hna_net *tmp_net;
!     struct local_hna_entry *hna;
  
      size = 0;
***************
*** 410,424 ****
  
      /* Announced HNA entries */
!     for(hna4 = olsr_cnf->hna4_entries; hna4; hna4 = hna4->next) {
!         ipc_sendf("%s\t%s\t%s\n",
!                   olsr_ip_to_string(&hna4->net),
!                   olsr_ip_to_string(&hna4->netmask),
!                   olsr_ip_to_string(&olsr_cnf->main_addr));
!     }
!     for(hna6 = olsr_cnf->hna6_entries; hna6; hna6 = hna6->next) {
!         ipc_sendf("%s\t%d\t%s\n",
!                   olsr_ip_to_string(&hna6->net),
!                   hna6->prefix_len,
!                   olsr_ip_to_string(&olsr_cnf->main_addr));
      }
  
--- 409,428 ----
  
      /* Announced HNA entries */
!     if (olsr_cnf->ip_version == AF_INET) {
!         for(hna = olsr_cnf->hna_entries; hna; hna = hna->next) {
!             union olsr_ip_addr netmask;
!             olsr_prefix_to_netmask(&netmask, hna->net.prefix_len);
!             ipc_sendf("%s\t%s\t%s\n",
!                       olsr_ip_to_string(&hna->net.prefix),
!                       olsr_ip_to_string(&netmask),
!                       olsr_ip_to_string(&olsr_cnf->main_addr));
!         }
!     } else {
!         for(hna = olsr_cnf->hna_entries; hna; hna = hna->next) {
!             ipc_sendf("%s\t%d\t%s\n",
!                       olsr_ip_to_string(&hna->net.prefix),
!                       hna->net.prefix_len,
!                       olsr_ip_to_string(&olsr_cnf->main_addr));
!         }
      }
  





More information about the Olsr-cvs mailing list