[Olsr-cvs] olsrd-current/lib/pgraph/src olsrd_pgraph.c,1.10,1.11

Bernd Petrovitsch (spam-protected)
Thu Nov 29 01:49:44 CET 2007


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

Modified Files:
	olsrd_pgraph.c 
Log Message:
Major Changes:
- renamed "struct local_hna_entry" to "struct ip_prefix_list" since
  it is exactly that. Renamed the functions in src/local_hna_set.{c,h}
  in the same way.
- each IPv4 and IPv6 function pairs in src/local_hna_set.{c,h} is
  called from the same place and have the same signature. So I
  condensed each of them.
- Since we have only 3 functions left in src/local_hna_set.{c,h}
  and they are used for the configuration, the .h file is now part
  of src/olsr_cfg.h and the ,c file of src/cfgparser/olsrd_conf.c.
- replaced "struct ipc_net" with "struct ip_prefix_list" since it
  serves the same purpose as the "struct ip_prefix_list"
- replaced "struct ipc_host" with "struct ip_prefix_list" since it
  serves the same purpose as the "struct ip_prefix_list" and is
  just a special case. No need to duplicate code etc.
- removed "union hna_netmask" from src/olsr_types since we use the
  prefix_len everywhere (and that is an olsr_u8_t in several other
  struct's).
  That implies changes and simplifications in the code handling
  them (since the IPv4 is similar to IPv6).
- the config file parser now understands for IPv4 addresses also
  "/$prefix".
- On the output side, the patch generates only "/$prefix" which
  kills code since it is the same as the IPv6 handling.
- There are some netmask conversions left (mainly in the plugins)
  but that be cleaned up afterwards.
- extracted ip{,4,6}{cmp,equal} and formatting functions from
  net_olsr.{c,h} into src/ipcalc.{c,h} since net_olsr.h became
  IMHO to much of a "put anything in there".
- renamed "sockaddr_to_string()" to "sockaddr4_to_string()"
  since it is exactly that (unless I'm missing something).

Minor Changes:
- lib/httpinfo/src/admin_html.h contained just some variable
  definitions so it is now integrated in the only user:
  admin_interface.c
- olsrd_dot_draw.c got rid of two indicator variables if
  a socket is valid or not. Since sockets may use "-1" as the
  "not open", "invalid" value, there is no need for two more
  ints.
- and the dot_draw plugin is somewhat smaller and easier to read.
- const'ified some functions


Index: olsrd_pgraph.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/lib/pgraph/src/olsrd_pgraph.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** olsrd_pgraph.c	8 Nov 2007 22:47:40 -0000	1.10
--- olsrd_pgraph.c	29 Nov 2007 00:49:42 -0000	1.11
***************
*** 46,49 ****
--- 46,50 ----
  
  #include "olsrd_pgraph.h"
+ #include "ipcalc.h"
  #include "socket_parser.h"
  #include "olsrd_plugin.h"
***************
*** 141,156 ****
  static void ipc_action(int);
  
- #if 0
- static struct link_entry *olsr_neighbor_best_link(union olsr_ip_addr *main);
- #endif
- 
  static void ipc_print_neigh_link(struct neighbor_entry *neighbor);
  
  static void ipc_print_tc_link(struct tc_entry *entry, struct tc_edge_entry *dst_entry);
  
- #if 0
- static void ipc_print_net(union olsr_ip_addr *, union olsr_ip_addr *, union hna_netmask *);
- #endif
- 
  static int ipc_send(const char *, int);
  
--- 142,149 ----
***************
*** 391,405 ****
  }
  
- #if 0
- #define MIN_LINK_QUALITY 0.01
- static double calc_etx(double loss, double neigh_loss) 
- {
-   if (loss < MIN_LINK_QUALITY || neigh_loss < MIN_LINK_QUALITY)
-     return 0.0;
-   else
-     return 1.0 / (loss * neigh_loss);
- }
- #endif
- 
  static void ipc_print_tc_link(struct tc_entry *entry, struct tc_edge_entry *dst_entry)
  {
--- 384,387 ----
***************
*** 415,446 ****
  }
  
- #if 0
- static void
- ipc_print_net(union olsr_ip_addr *gw, union olsr_ip_addr *net, union hna_netmask *mask)
- {
-   const char *adr;
- 
-   adr = olsr_ip_to_string(gw);
-   ipc_send("\"", 1);
-   ipc_send(adr, strlen(adr));
-   ipc_send("\" -> \"", strlen("\" -> \""));
-   adr = olsr_ip_to_string(net);
-   ipc_send(adr, strlen(adr));
-   ipc_send("/", 1);
-   adr = olsr_netmask_to_string(mask);
-   ipc_send(adr, strlen(adr));
-   ipc_send("\"[label=\"HNA\"];\n", strlen("\"[label=\"HNA\"];\n"));
-   ipc_send("\"", 1);
-   adr = olsr_ip_to_string(net);
-   ipc_send(adr, strlen(adr));
-   ipc_send("/", 1);
-   adr = olsr_netmask_to_string(mask);
-   ipc_send(adr, strlen(adr));
-   ipc_send("\"", 1);
-   ipc_send("[shape=diamond];\n", strlen("[shape=diamond];\n"));
- }
- #endif
- 
- 
  static int ipc_send(const char *data, int size)
  {
--- 397,400 ----
***************
*** 463,494 ****
    return 1;
  }
- 
- #if 0
- static struct link_entry *olsr_neighbor_best_link(union olsr_ip_addr *main)
- {
-   struct link_entry *walker;
-   double best = 0.0;
-   double curr;
-   struct link_entry *res = NULL;
- 
-   // loop through all links
- 
-   for (walker = link_set; walker != NULL; walker = walker->next)
-   {
-     // check whether it's a link to the requested neighbor and
-     // whether the link's quality is better than what we have
-     if(ipequal(main, &walker->neighbor->neighbor_main_addr))
-     {
-       curr = walker->loss_link_quality * walker->neigh_link_quality;
- 
-       if (curr >= best)
-       {
-         best = curr;
-         res = walker;
-       }
-     }
-   }
- 
-   return res;
- }
- #endif
--- 417,418 ----





More information about the Olsr-cvs mailing list