[Olsr-cvs] olsrd-current/src tc_set.h, 1.19, 1.20 tc_set.c, 1.33, 1.34 link_set.h, 1.32, 1.33 link_set.c, 1.75, 1.76

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


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

Modified Files:
	tc_set.h tc_set.c link_set.h link_set.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: tc_set.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/tc_set.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** tc_set.h	2 Nov 2007 09:38:55 -0000	1.19
--- tc_set.h	2 Nov 2007 20:58:06 -0000	1.20
***************
*** 138,141 ****
--- 138,142 ----
  void olsr_delete_tc_edge_entry(struct tc_edge_entry *);
  void olsr_calc_tc_edge_entry_etx(struct tc_edge_entry *);
+ float olsr_calc_tc_etx(const struct tc_edge_entry *);
  
  #endif

Index: tc_set.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/tc_set.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -d -r1.33 -r1.34
*** tc_set.c	2 Nov 2007 09:38:55 -0000	1.33
--- tc_set.c	2 Nov 2007 20:58:06 -0000	1.34
***************
*** 253,262 ****
  olsr_calc_tc_edge_entry_etx(struct tc_edge_entry *tc_edge)
  {
!   if (tc_edge->link_quality >= MIN_LINK_QUALITY &&
!       tc_edge->inverse_link_quality >= MIN_LINK_QUALITY) {
!         
!     tc_edge->etx = 1.0 / (tc_edge->link_quality * tc_edge->inverse_link_quality);
!   } else {
      tc_edge->etx = INFINITE_ETX;
    }
  }
--- 253,261 ----
  olsr_calc_tc_edge_entry_etx(struct tc_edge_entry *tc_edge)
  {
!   if (tc_edge->link_quality < MIN_LINK_QUALITY &&
!       tc_edge->inverse_link_quality < MIN_LINK_QUALITY) {
      tc_edge->etx = INFINITE_ETX;
+   } else {
+     tc_edge->etx = 1.0 / (tc_edge->link_quality * tc_edge->inverse_link_quality);
    }
  }
***************
*** 617,621 ****
    struct tc_edge_entry *tc_edge;
    char *fstr;
-   float etx;
    
    OLSR_PRINTF(1, "\n--- %02d:%02d:%02d.%02d ------------------------------------------------- TOPOLOGY\n\n",
--- 616,619 ----
***************
*** 638,652 ****
    OLSR_FOR_ALL_TC_ENTRIES(tc) {
      OLSR_FOR_ALL_TC_EDGE_ENTRIES(tc, tc_edge) {
- 
-       if (tc_edge->link_quality < MIN_LINK_QUALITY ||
-           tc_edge->inverse_link_quality < MIN_LINK_QUALITY) {
-         etx = 0.0;
-       } else {
-         etx = 1.0 / (tc_edge->link_quality * tc_edge->inverse_link_quality);
-       }
- 
        OLSR_PRINTF(1, fstr, olsr_ip_to_string(&tc->addr),
                    olsr_ip_to_string(&tc_edge->T_dest_addr),
!                   tc_edge->link_quality, tc_edge->inverse_link_quality, etx);
  
      } OLSR_FOR_ALL_TC_EDGE_ENTRIES_END(tc, tc_edge);
--- 636,644 ----
    OLSR_FOR_ALL_TC_ENTRIES(tc) {
      OLSR_FOR_ALL_TC_EDGE_ENTRIES(tc, tc_edge) {
        OLSR_PRINTF(1, fstr, olsr_ip_to_string(&tc->addr),
                    olsr_ip_to_string(&tc_edge->T_dest_addr),
!                   tc_edge->link_quality,
!                   tc_edge->inverse_link_quality,
!                   olsr_calc_tc_etx(tc_edge));
  
      } OLSR_FOR_ALL_TC_EDGE_ENTRIES_END(tc, tc_edge);
***************
*** 656,659 ****
--- 648,659 ----
  }
  
+ float olsr_calc_tc_etx(const struct tc_edge_entry *tc_edge)
+ {
+   return tc_edge->link_quality < MIN_LINK_QUALITY ||
+          tc_edge->inverse_link_quality < MIN_LINK_QUALITY
+              ? 0.0
+              : 1.0 / (tc_edge->link_quality * tc_edge->inverse_link_quality);
+ }
+ 
  /*
   * Local Variables:

Index: link_set.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/link_set.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -d -r1.32 -r1.33
*** link_set.h	5 Oct 2007 20:10:24 -0000	1.32
--- link_set.h	2 Nov 2007 20:58:06 -0000	1.33
***************
*** 151,153 ****
--- 151,155 ----
  olsr_update_dijkstra_link_qualities(void);
  
+ float olsr_calc_link_etx(const struct link_entry *);
+ 
  #endif

Index: link_set.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/src/link_set.c,v
retrieving revision 1.75
retrieving revision 1.76
diff -C2 -d -r1.75 -r1.76
*** link_set.c	21 Oct 2007 20:09:09 -0000	1.75
--- link_set.c	2 Nov 2007 20:58:06 -0000	1.76
***************
*** 1185,1186 ****
--- 1185,1193 ----
  }
  
+ float olsr_calc_link_etx(const struct link_entry *link)
+ {
+   return link->loss_link_quality < MIN_LINK_QUALITY ||
+          link->neigh_link_quality < MIN_LINK_QUALITY
+              ? 0.0
+              : 1.0 / (link->loss_link_quality * link->neigh_link_quality);
+ }





More information about the Olsr-cvs mailing list