? textinfo.patch
? src/admin_interface.d
? src/olsrd_httpinfo.d
? src/olsrd_plugin.d
Index: src/olsrd_httpinfo.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/lib/httpinfo/src/olsrd_httpinfo.c,v
retrieving revision 1.59
diff -u -2 -r1.59 olsrd_httpinfo.c
--- src/olsrd_httpinfo.c	18 Sep 2006 18:55:30 -0000	1.59
+++ src/olsrd_httpinfo.c	6 Mar 2007 02:43:37 -0000
@@ -91,5 +91,5 @@
 #define DEFAULT_TCP_PORT 1978
 
-#define HTML_BUFSIZE 1024*75
+#define HTML_BUFSIZE 1024*1024
 
 #define FRAMEWIDTH 800
@@ -107,4 +107,5 @@
   int(*build_body_cb)(char *, olsr_u32_t);
   olsr_bool display_tab;
+  olsr_bool plain;
 };
 
@@ -163,4 +164,7 @@
 
 int
+build_plain_body(char *, olsr_u32_t);
+
+int
 build_nodes_body(char *, olsr_u32_t);
 
@@ -199,13 +203,14 @@
 struct tab_entry tab_entries[] =
   {
-    {"Configuration", "config", build_config_body, OLSR_TRUE},
-    {"Routes", "routes", build_routes_body, OLSR_TRUE},
-    {"Links/Topology", "nodes", build_nodes_body, OLSR_TRUE},
-    {"All", "all", build_all_body, OLSR_TRUE},
+    {"Configuration", "config", build_config_body, OLSR_TRUE, OLSR_FALSE},
+    {"Routes", "routes", build_routes_body, OLSR_TRUE, OLSR_FALSE},
+    {"Links/Topology", "nodes", build_nodes_body, OLSR_TRUE, OLSR_FALSE},
+    {"All", "all", build_all_body, OLSR_TRUE, OLSR_FALSE},
 #ifdef ADMIN_INTERFACE
-    {"Admin", "admin", build_admin_body, OLSR_TRUE},
+    {"Admin", "admin", build_admin_body, OLSR_TRUE, OLSR_FALSE},
 #endif
-    {"About", "about", build_about_body, OLSR_TRUE},
-    {"FOO", "cfgfile", build_cfgfile_body, OLSR_FALSE},
+    {"About", "about", build_about_body, OLSR_TRUE, OLSR_FALSE},
+    {"FOO", "cfgfile", build_cfgfile_body, OLSR_FALSE, OLSR_FALSE},
+    {"PLAIN", "plain", build_plain_body, OLSR_FALSE, OLSR_TRUE},
     {NULL, NULL, NULL}
   };
@@ -325,4 +330,5 @@
   char http_version[11];
   int c = 0, r = 1, size = 0;
+  olsr_bool is_html = OLSR_TRUE;
 
   addrlen = sizeof(struct sockaddr_in);
@@ -484,26 +490,34 @@
 #endif
 	  y = 0;
-	  while(http_ok_head[y])
+	  if(!tab_entries[i].plain) {
+
+		while(http_ok_head[y])
 	    {
 	      size += sprintf(&body[size], http_ok_head[y]);
 	      y++;
 	    }
-	  
-	  size += build_tabs(&body[size], i);
-	  size += build_frame("Current Routes", 
-			      "routes", 
-			      FRAMEWIDTH, 
-			      &body[size], 
-			      HTML_BUFSIZE - size, 
-			      tab_entries[i].build_body_cb);
-	  
-	  stats.ok_hits++;
-	  
-	  y = 0;
-	  while(http_ok_tail[y])
+
+		size += build_tabs(&body[size], i);
+	    size += build_frame("Current Routes", 
+				"routes", 
+				FRAMEWIDTH, 
+				&body[size], 
+				HTML_BUFSIZE - size, 
+				tab_entries[i].build_body_cb);
+
+		y = 0;
+		while(http_ok_tail[y])
 	    {
 	      size += sprintf(&body[size], http_ok_tail[y]);
 	      y++;
 	    }  
+
+	  } else {
+          /* deliver a plain text file */
+          is_html = OLSR_FALSE;
+          size += tab_entries[i].build_body_cb(&body[size], HTML_BUFSIZE - size);
+      }
+	  stats.ok_hits++;
+	  
 	  
 #ifdef NETDIRECT
@@ -511,5 +525,5 @@
 	  goto close_connection;
 #else
-	  c = build_http_header(HTTP_OK, OLSR_TRUE, size, req, MAX_HTTPREQ_SIZE);
+	  c = build_http_header(HTTP_OK, is_html, size, req, MAX_HTTPREQ_SIZE);
 	  
 	  goto send_http_data;
@@ -753,4 +767,172 @@
 
 int
+build_plain_body(char *buf, olsr_u32_t bufsize)
+{
+  int size = 0, index;
+  struct rt_entry *routes;
+  struct neighbor_entry *neigh;
+  struct link_entry *link = NULL;
+  struct tc_entry *entry;
+  struct topo_dst *dst_entry;
+  struct mid_entry *mid_entry;
+  struct mid_address *mid_alias;
+  struct hna_entry *tmp_hna;
+  struct hna_net *tmp_net;
+
+  size += sprintf(&buf[size], "[[ROUTES]]\n");
+
+  //size += sprintf(&buf[size], "<table width=\"100%%\" BORDER=0 CELLSPACING=0 CELLPADDING=0 ALIGN=center><tr><th>Destination</th><th>Gateway</th><th>Metric</th><th>ETX</th><th>Interface</th><th>Type</th></tr>\n");
+
+  /* Neighbors */
+  for(index = 0;index < HASHSIZE;index++)
+    {
+      for(routes = routingtable[index].next;
+	  routes != &routingtable[index];
+	  routes = routes->next)
+	{
+	    size += sprintf(&buf[size], "DST:%s;GW:%s;METRIC:%d;ETX:%.2f;IF:%s\n",
+			  olsr_ip_to_string(&routes->rt_dst),
+			  olsr_ip_to_string(&routes->rt_router),
+			  routes->rt_metric,
+			  routes->rt_etx,
+			  routes->rt_if->int_name);
+	}
+    }
+
+  /* HNA routes */
+  size += sprintf(&buf[size], "[[HNA_ROUTES]]\n");
+  for(index = 0;index < HASHSIZE;index++)
+    {
+      for(routes = hna_routes[index].next;
+	  routes != &hna_routes[index];
+	  routes = routes->next)
+	{
+		size += sprintf(&buf[size], "DST:%s;GW:%s;METRIC:%d;IF:%s;ETX:%0.2f\n",
+			  olsr_ip_to_string(&routes->rt_dst),
+			  olsr_ip_to_string(&routes->rt_router),
+			  routes->rt_metric,
+			  routes->rt_if->int_name,
+			  routes->rt_etx);
+	}
+    }
+
+  size += sprintf(&buf[size], "[[HNA]]\n");
+
+  /* HNA entries */
+  for(index=0;index<HASHSIZE;index++)
+    {
+      tmp_hna = hna_set[index].next;
+      /* Check all entrys */
+      while(tmp_hna != &hna_set[index])
+	{
+	  /* Check all networks */
+	  tmp_net = tmp_hna->networks.next;
+	      
+	  while(tmp_net != &tmp_hna->networks)
+	    {
+		size += sprintf(&buf[size], "DST:%s;MASK:%s;GW:%s\n",
+				olsr_ip_to_string(&tmp_net->A_network_addr),
+				olsr_netmask_to_string(&tmp_net->A_netmask),
+                                olsr_ip_to_string(&tmp_hna->A_gateway_addr));
+	      tmp_net = tmp_net->next;
+	    }
+	      
+	  tmp_hna = tmp_hna->next;
+	}
+    }
+
+  size += sprintf(&buf[size], "[[LINKS]]\n");
+
+  /* Link set */
+  link = link_set;
+    while(link)
+      {
+		  size += sprintf(&buf[size], "LIP:%s;NIP:%s;HIST:%0.2f;LQ:%0.2f;LOST:%d;SENT:%d;NLQ:%0.2f;LMULTI:%0.2f;ETX:%0.2f\n",
+			olsr_ip_to_string(&link->local_iface_addr),
+			olsr_ip_to_string(&link->neighbor_iface_addr),
+			link->L_link_quality, 
+			link->loss_link_quality,
+			link->lost_packets, 
+			link->total_packets,
+			link->neigh_link_quality,
+            link->loss_link_multiplier,
+			(link->loss_link_quality * link->neigh_link_quality) ? 1.0 / (link->loss_link_quality * link->neigh_link_quality) : 0.0);
+
+	link = link->next;
+      }
+
+  size += sprintf(&buf[size], "[[NEIGHBORS]]\n");
+
+  /* Neighbors */
+  for(index=0;index<HASHSIZE;index++)
+    {
+      for(neigh = neighbortable[index].next;
+	  neigh != &neighbortable[index];
+	  neigh = neigh->next)
+	{
+	  size += sprintf(&buf[size], 
+			  "NIP:%s;SYM:%d;MPR:%d;MPRS:%d;WILL:%d\n",
+			  olsr_ip_to_string(&neigh->neighbor_main_addr),
+			  (neigh->status == SYM) ? 1 : 0,
+			  neigh->is_mpr ? 1 : 0,
+			  olsr_lookup_mprs_set(&neigh->neighbor_main_addr) ? 1 : 0,
+			  neigh->willingness);
+
+	}
+    }
+
+  size += sprintf(&buf[size], "[[TOPO]]\n");
+  /* Topology */  
+  for(index=0;index<HASHSIZE;index++)
+    {
+      /* For all TC entries */
+      entry = tc_table[index].next;
+      while(entry != &tc_table[index])
+	{
+	  /* For all destination entries of that TC entry */
+	  dst_entry = entry->destinations.next;
+	  while(dst_entry != &entry->destinations)
+	    {
+		size += sprintf(&buf[size], "IP:%s;NIP:%s;LQ:%0.2f;NLQ:%0.2f;ETX:%0.2f\n",
+			      olsr_ip_to_string(&dst_entry->T_dest_addr),
+			      olsr_ip_to_string(&entry->T_last_addr), 
+			      dst_entry->link_quality,
+			      dst_entry->inverse_link_quality,
+			      (dst_entry->link_quality * dst_entry->inverse_link_quality) ? 1.0 / (dst_entry->link_quality * dst_entry->inverse_link_quality) : 0.0);
+
+	      dst_entry = dst_entry->next;
+	    }
+	  entry = entry->next;
+	}
+    }
+
+  size += sprintf(&buf[size], "[[MID]]\n");
+  /* Topology */  
+
+  /* MID */  
+  for(index=0;index<HASHSIZE;index++)
+    {
+      mid_entry = mid_set[index].next;
+      while(mid_entry != &mid_set[index])
+	{
+		size += sprintf(&buf[size], "IP:%s", olsr_ip_to_string(&mid_entry->main_addr));
+
+	  mid_alias = mid_entry->aliases;
+	  while(mid_alias)
+	    {
+			size += sprintf(&buf[size], ";ALIAS:%s", olsr_ip_to_string(&mid_alias->alias));
+	        mid_alias = mid_alias->next_alias;
+	    }
+	  size += sprintf(&buf[size], "\n");
+
+	  mid_entry = mid_entry->next;
+	}
+    }
+
+
+  return size;
+}
+
+int
 build_config_body(char *buf, olsr_u32_t bufsize)
 {
