[Olsr-cvs] olsrd-current/lib/dot_draw/src olsrd_dot_draw.c, 1.27, 1.28

Bernd Petrovitsch (spam-protected)
Fri Nov 2 21:58:09 CET 2007


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

Modified Files:
	olsrd_dot_draw.c 
Log Message:
Some minor and trivial cleanup: Added two functions to calculate the ETX
value from a struct tc_edge_entry and a struct link_entry, respectively.
And use them everywhere.


Index: olsrd_dot_draw.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/lib/dot_draw/src/olsrd_dot_draw.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** olsrd_dot_draw.c	13 Sep 2007 15:31:58 -0000	1.27
--- olsrd_dot_draw.c	2 Nov 2007 20:58:07 -0000	1.28
***************
*** 114,120 ****
  ipc_send_str(const char *);
  
- static double 
- calc_etx(double, double);
- 
  
  /**
--- 114,117 ----
***************
*** 173,177 ****
        link = get_best_link_to_neighbor(&neighbor->neighbor_main_addr);
        if (link) {
!         etx = calc_etx( link->loss_link_quality, link->neigh_link_quality);
        }
    }
--- 170,174 ----
        link = get_best_link_to_neighbor(&neighbor->neighbor_main_addr);
        if (link) {
!         etx = olsr_calc_link_etx(link);
        }
    }
***************
*** 366,393 ****
  
  
- #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);
- }
- 
- 
  static void
  ipc_print_tc_link(struct tc_entry *entry, struct tc_edge_entry *dst_entry)
  {
    char buf[256];
-   const char* adr;
-   double etx = calc_etx( dst_entry->link_quality, dst_entry->inverse_link_quality );
  
!   adr = olsr_ip_to_string(&entry->addr);
!   sprintf( buf, "\"%s\" -> ", adr );
    ipc_send_str(buf);
    
!   adr = olsr_ip_to_string(&dst_entry->T_dest_addr);
!   sprintf( buf, "\"%s\"[label=\"%.2f\"];\n", adr, etx );
    ipc_send_str(buf);
  }
--- 363,375 ----
  
  
  static void
  ipc_print_tc_link(struct tc_entry *entry, struct tc_edge_entry *dst_entry)
  {
    char buf[256];
  
!   sprintf( buf, "\"%s\" -> ", olsr_ip_to_string(&entry->addr));
    ipc_send_str(buf);
    
!   sprintf( buf, "\"%s\"[label=\"%.2f\"];\n", olsr_ip_to_string(&dst_entry->T_dest_addr), olsr_calc_tc_etx(dst_entry));
    ipc_send_str(buf);
  }





More information about the Olsr-cvs mailing list