[Olsr-cvs] olsrd-current/lib/httpinfo/src olsrd_httpinfo.c, 1.69, 1.70

Bernd Petrovitsch (spam-protected)
Sun Jul 15 22:59:08 CEST 2007


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

Modified Files:
	olsrd_httpinfo.c 
Log Message:
* fixed formatting

Index: olsrd_httpinfo.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/lib/httpinfo/src/olsrd_httpinfo.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -C2 -d -r1.69 -r1.70
*** olsrd_httpinfo.c	15 Jul 2007 19:29:38 -0000	1.69
--- olsrd_httpinfo.c	15 Jul 2007 20:59:06 -0000	1.70
***************
*** 165,169 ****
  static int build_ip_txt(char *buf, const olsr_u32_t bufsize, const olsr_bool want_link, const char * const ipstr, const char  * const maskstr);
  
! static int build_ipaddr_link(char *buf, const olsr_u32_t bufsize, const olsr_bool want_link, union olsr_ip_addr * const ipaddr, const union hna_netmask * const mask);
  
  static char *olsr_netmask_to_string(union hna_netmask *);
--- 165,169 ----
  static int build_ip_txt(char *buf, const olsr_u32_t bufsize, const olsr_bool want_link, const char * const ipstr, const char  * const maskstr);
  
! static int build_ipaddr_link(char *buf, const olsr_u32_t bufsize, const olsr_bool want_link, const union olsr_ip_addr * const ipaddr, const union hna_netmask * const mask);
  
  static char *olsr_netmask_to_string(union hna_netmask *);
***************
*** 698,702 ****
  }
  
! static int build_ipaddr_link(char *buf, const olsr_u32_t bufsize, const olsr_bool want_link, union olsr_ip_addr * const ipaddr, const union hna_netmask * const mask)
  {
    int size = 0;
--- 698,702 ----
  }
  
! static int build_ipaddr_link(char *buf, const olsr_u32_t bufsize, const olsr_bool want_link, const union olsr_ip_addr * const ipaddr, const union hna_netmask * const mask)
  {
    int size = 0;
***************
*** 725,736 ****
      maskstr =  NULL;
    }
!   size += snprintf(&buf[size], bufsize-size, "<td%s>", resolve_ip_addresses && hp ? "" : " colspan=\"2\"");
    size += build_ip_txt(&buf[size], bufsize-size, want_link, olsr_ip_to_string(ipaddr), maskstr);
-   if (hp) {
-     size += snprintf(&buf[size], bufsize-size, "</td><td>(");
-     size += build_ip_txt(&buf[size], bufsize-size, want_link, hp->h_name, NULL);
-     size += snprintf(&buf[size], bufsize-size, ")");
-   }
    size += snprintf(&buf[size], bufsize-size, "</td>");
    return size;
  }
--- 725,740 ----
      maskstr =  NULL;
    }
!   size += snprintf(&buf[size], bufsize-size, "<td>");
    size += build_ip_txt(&buf[size], bufsize-size, want_link, olsr_ip_to_string(ipaddr), maskstr);
    size += snprintf(&buf[size], bufsize-size, "</td>");
+   if (resolve_ip_addresses) {
+     if (hp) {
+       size += snprintf(&buf[size], bufsize-size, "<td>(");
+       size += build_ip_txt(&buf[size], bufsize-size, want_link, hp->h_name, NULL);
+       size += snprintf(&buf[size], bufsize-size, ")</td>");
+     } else {
+       size += snprintf(&buf[size], bufsize-size, "<td/>");
+     }
+   }
    return size;
  }
***************
*** 738,741 ****
--- 742,761 ----
  #define build_ipaddr_no_link(buf, bufsize, ipaddr, mask)   build_ipaddr_link((buf), (bufsize), OLSR_FALSE, (ipaddr), (mask))
  
+ 
+ static int build_route(char *buf, olsr_u32_t bufsize, const struct rt_entry * const route, const char * const title, const int print_netmask)
+ {
+   int size = 0;
+   size += snprintf(&buf[size], bufsize-size, "<tr>");
+   size += build_ipaddr_with_link(&buf[size], bufsize-size, &route->rt_dst, print_netmask ? &route->rt_mask : NULL);
+   size += build_ipaddr_with_link(&buf[size], bufsize-size, &route->rt_router, NULL);
+ 
+   size += snprintf(&buf[size], bufsize-size, "<td align=\"center\">%d</td>", route->rt_metric);
+   if (olsr_cnf->lq_level > 0) {
+     size += snprintf(&buf[size], bufsize-size, "<td align=\"center\">%.2f</td>", route->rt_etx);
+   }
+   size += snprintf(&buf[size], bufsize-size, "<td align=\"center\">%s</td><td>%s</td></tr>\n", route->rt_if->int_name, title);
+   return size;
+ }
+ 
  static int build_routes_body(char *buf, olsr_u32_t bufsize)
  {
***************
*** 745,749 ****
    size += snprintf(&buf[size], bufsize-size, "<h2>OLSR routes in kernel</h2>\n");
  
!   size += snprintf(&buf[size], bufsize-size, "<table width=\"100%%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\"><tr><th%s>Destination</th><th>Gateway</th><th>Metric</th>",
                    resolve_ip_addresses ? " colspan=\"2\"" : "");
    if (olsr_cnf->lq_level > 0)
--- 765,769 ----
    size += snprintf(&buf[size], bufsize-size, "<h2>OLSR routes in kernel</h2>\n");
  
!   size += snprintf(&buf[size], bufsize-size, "<table width=\"100%%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\"><tr><th%1$s>Destination</th><th%1$s>Gateway</th><th>Metric</th>",
                    resolve_ip_addresses ? " colspan=\"2\"" : "");
    if (olsr_cnf->lq_level > 0)
***************
*** 752,796 ****
  
    /* Neighbors */
!   for(index = 0;index < HASHSIZE;index++)
!     {
!       for(routes = routingtable[index].next;
! 	  routes != &routingtable[index];
! 	  routes = routes->next)
! 	{
!           size += snprintf(&buf[size], bufsize-size, "<tr>");
! 	  size += build_ipaddr_with_link(&buf[size], bufsize-size, &routes->rt_dst, NULL);
! 	  size += build_ipaddr_with_link(&buf[size], bufsize-size, &routes->rt_router, NULL);
! 
! 	  size += snprintf(&buf[size], bufsize-size, "<td align=\"right\">%d</td>", routes->rt_metric);
!           if (olsr_cnf->lq_level > 0)
!             size += snprintf(&buf[size], bufsize-size, "<td align=\"right\">%.2f</td>", routes->rt_etx);
! 	  size += snprintf(&buf[size], bufsize-size,
!                          "<td>%s</td>"
!                          "<td>HOST</td></tr>\n",
!                          routes->rt_if->int_name);
! 	}
      }
  
    /* HNA */
!   for(index = 0;index < HASHSIZE;index++)
!     {
!       for(routes = hna_routes[index].next;
! 	  routes != &hna_routes[index];
! 	  routes = routes->next)
! 	{
!           size += snprintf(&buf[size], bufsize-size, "<tr>");
! 	  size += build_ipaddr_with_link(&buf[size], bufsize-size, &routes->rt_dst, &routes->rt_mask);
! 	  size += build_ipaddr_with_link(&buf[size], bufsize-size, &routes->rt_router, NULL);
! 	  size += snprintf(&buf[size], bufsize-size,
!                          "<td align=\"right\">%d</td>",
!                          routes->rt_metric);
!           if (olsr_cnf->lq_level > 0)
! 	    size += snprintf(&buf[size], bufsize-size, "<td align=\"right\">%.2f</td>", routes->rt_etx);
! 	  size += snprintf(&buf[size], bufsize-size,
!                          "<td>%s</td>"
!                          "<td>HNA</td></tr>\n",
!                          routes->rt_if->int_name);
! 	}
      }
  
    size += snprintf(&buf[size], bufsize-size, "</table>\n");
--- 772,787 ----
  
    /* Neighbors */
!   for(index = 0;index < HASHSIZE;index++) {
!     for(routes = routingtable[index].next; routes != &routingtable[index]; routes = routes->next) {
!       size += build_route(&buf[size], bufsize-size, routes, "HOST", OLSR_FALSE);
      }
+   }
  
    /* HNA */
!   for(index = 0;index < HASHSIZE;index++) {
!     for(routes = hna_routes[index].next; routes != &hna_routes[index];routes = routes->next) {
!       size += build_route(&buf[size], bufsize-size, routes, "HNA", OLSR_TRUE);
      }
+   }
  
    size += snprintf(&buf[size], bufsize-size, "</table>\n");





More information about the Olsr-cvs mailing list