[Olsr-cvs] olsrd-current/lib/httpinfo/src admin_html.h, 1.4, 1.5 admin_interface.c, 1.9, 1.10 html.h, 1.10, 1.11

Bernd Petrovitsch (spam-protected)
Sat Oct 20 22:41:06 CEST 2007


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

Modified Files:
	admin_html.h admin_interface.c html.h 
Log Message:
* fixed a few compile bugs (and simplified it a little bit)

Index: admin_html.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/lib/httpinfo/src/admin_html.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** admin_html.h	28 Feb 2005 20:28:59 -0000	1.4
--- admin_html.h	20 Oct 2007 20:41:04 -0000	1.5
***************
*** 49,87 ****
  #define ADMIN_HTML_H
  
! static const char *admin_frame[] =
!   {
!     "<b>Administrator interface</b><hr>\n"
!     "<h2>Change basic settings</h2>\n",
!     "<form action=\"set_values\" method=\"post\">\n",
!     "<table width=\"100%%\">\n",
!     "<!-- BASICSETTINGS -->\n",
!     "</table>\n<br>\n",
!     "<center><input type=\"submit\" value=\"Submit\" class=\"input_button\">\n",
!     "<input type=\"reset\" value=\"Reset\" class=\"input_button\"></center>\n",
!     "</form>\n",
!     "<h2>Add/remove local HNA entries</h2>\n",
!     "<form action=\"set_values\" method=\"post\">\n",
!     "<table width=\"100%%\"><tr><td><b>Network:</b></td>\n",
!     "<td><input type=\"text\" name=\"hna_new_net\" maxlength=\"16\" class=\"input_text\" value=\"0.0.0.0\"></td>\n",
!     "<td><b>Netmask/Prefix:</b></td>\n",
!     "<td><input type=\"text\" name=\"hna_new_netmask\" maxlength=\"16\" class=\"input_text\" value=\"0.0.0.0\"></td>\n",
!     "<td><input type=\"submit\" value=\"Add entry\" class=\"input_button\"></td></form>\n",
!     "</table><hr>\n",
!     "<form action=\"set_values\" method=\"post\">\n",
!     "<table width=\"100%%\">\n",
!     "<tr><th width=50 halign=\"middle\">Delete</th><th>Network</th><th>Netmask</th></tr>\n",
!     "<!-- HNAENTRIES -->\n",
!     "<tr><td halign=\"middle\"><input type=\"checkbox\" name=\"del_hna%s*%s\" class=\"input_checkbox\"></td><td>%s</td><td>%s</td></tr>\n",
!     "</table>\n<br>\n",
!     "<center><input type=\"submit\" value=\"Delete selected\" class=\"input_button\"></center>\n",
!     "</form>\n",
  
!     NULL
! };
  
  
! static char admin_basic_setting_int[] = "<td><b>%s</b></td>\n<td> <input type=\"text\" name=\"%s\" maxlength=\"%d\" class=\"input_text\" value=\"%d\"></td>\n";
! static char admin_basic_setting_float[] = "<td><b>%s</b></td>\n<td> <input type=\"text\" name=\"%s\" maxlength=\"%d\" class=\"input_text\" value=\"%0.2f\"></td>\n";
! static char admin_basic_setting_string[] = "<td><b>%s</b></td>\n<td> <input type=\"text\" name=\"%s\" maxlength=\"%d\" class=\"input_text\" value=\"%s\"></td>\n";
  
  #endif
--- 49,83 ----
  #define ADMIN_HTML_H
  
! static const char admin_frame_prolog[] =
!     "<strong>Administrator interface</strong><hr>\n"
!     "<h2>Change basic settings</h2>\n"
!     "<form action=\"set_values\" method=\"post\">\n"
!     "<table width=\"100%%\">\n";
  
! static const char admin_frame_mid[] =
!     "</table>\n<br>\n"
!     "<center><input type=\"submit\" value=\"Submit\" class=\"input_button\">\n"
!     "<input type=\"reset\" value=\"Reset\" class=\"input_button\"></center>\n"
!     "</form>\n"
!     "<h2>Add/remove local HNA entries</h2>\n"
!     "<form action=\"set_values\" method=\"post\">\n"
!     "<table width=\"100%%\"><tr><td><strong>Network:</strong></td>\n"
!     "<td><input type=\"text\" name=\"hna_new_net\" maxlength=\"16\" class=\"input_text\" value=\"0.0.0.0\"></td>\n"
!     "<td><strong>Netmask/Prefix:</strong></td>\n"
!     "<td><input type=\"text\" name=\"hna_new_netmask\" maxlength=\"16\" class=\"input_text\" value=\"0.0.0.0\"></td>\n"
!     "<td><input type=\"submit\" value=\"Add entry\" class=\"input_button\"></td></form>\n"
!     "</table><hr>\n"
!     "<form action=\"set_values\" method=\"post\">\n"
!     "<table width=\"100%%\">\n"
!   "<tr><th width=50 halign=\"middle\">Delete</th><th>Network</th><th>Netmask</th></tr>\n";
  
+ static const char admin_frame_epilog[] =
+     "</table>\n<br>\n"
+     "<center><input type=\"submit\" value=\"Delete selected\" class=\"input_button\"></center>\n"
+     "</form>\n";
  
! static const char admin_basic_setting_int[] = "<td><strong>%s</strong></td>\n<td> <input type=\"text\" name=\"%s\" maxlength=\"%d\" class=\"input_text\" value=\"%d\"></td>\n";
! static const char admin_basic_setting_float[] = "<td><strong>%s</strong></td>\n<td> <input type=\"text\" name=\"%s\" maxlength=\"%d\" class=\"input_text\" value=\"%0.2f\"></td>\n";
! static const char admin_basic_setting_string[] = "<td><strong>%s</strong></td>\n<td> <input type=\"text\" name=\"%s\" maxlength=\"%d\" class=\"input_text\" value=\"%s\"></td>\n";
  
  #endif

Index: admin_interface.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/lib/httpinfo/src/admin_interface.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** admin_interface.c	19 Aug 2007 23:00:22 -0000	1.9
--- admin_interface.c	20 Oct 2007 20:41:04 -0000	1.10
***************
*** 66,80 ****
  build_admin_body(char *buf, olsr_u32_t bufsize __attribute__((unused)))
  {
!   int size = 0, i = 0;
! 
!   while(admin_frame[i] && strcmp(admin_frame[i], "<!-- BASICSETTINGS -->\n"))
!     {
!       size += snprintf(&buf[size], bufsize-size, admin_frame[i]);
!       i++;
!     }
!   
!   if(!admin_frame[i])
!     return size;
! 
  
    size += snprintf(&buf[size], bufsize-size, "<tr>\n");
--- 66,71 ----
  build_admin_body(char *buf, olsr_u32_t bufsize __attribute__((unused)))
  {
!   int size = 0;
!   size += snprintf(&buf[size], bufsize-size, admin_frame_prolog);
  
    size += snprintf(&buf[size], bufsize-size, "<tr>\n");
***************
*** 97,185 ****
  		  "Willingness:", "willingness", 1, olsr_cnf->willingness);
  
!   size += snprintf(&buf[size], bufsize-size, "</tr>\n");
!   size += snprintf(&buf[size], bufsize-size, "<tr>\n");
  
!   if(olsr_cnf->use_hysteresis)
!     {
!       size += snprintf(&buf[size], bufsize-size, admin_basic_setting_float,
! 		      "Hyst scaling:", "hyst_scaling", 4, olsr_cnf->hysteresis_param.scaling);
  
!       size += snprintf(&buf[size], bufsize-size, admin_basic_setting_float,
! 		      "Lower thr:", "hyst_lower", 4, olsr_cnf->hysteresis_param.thr_low);
!       size += snprintf(&buf[size], bufsize-size, admin_basic_setting_float,
! 		      "Upper thr:", "hyst_upper", 4, olsr_cnf->hysteresis_param.thr_high);
!     }
!   else
!     {
!       size += snprintf(&buf[size], bufsize-size, "<td>Hysteresis disabled</td>\n");
!     }
  
!   size += snprintf(&buf[size], bufsize-size, "</tr>\n");
!   size += snprintf(&buf[size], bufsize-size, "<tr>\n");
    
!   if(olsr_cnf->lq_level)
!     {
!       size += snprintf(&buf[size], bufsize-size, admin_basic_setting_int,
! 		      "LQ level:", "lq_level", 1, olsr_cnf->lq_level);
!       size += snprintf(&buf[size], bufsize-size, admin_basic_setting_int,
! 		      "LQ winsize:", "lq_wsize", 2, olsr_cnf->lq_wsize);
!     }
!   else
!     {
!       size += snprintf(&buf[size], bufsize-size, "<td>LQ disabled</td>\n");
!     }
! 
! 
!   size += snprintf(&buf[size], bufsize-size, "</tr>\n");
!   size += snprintf(&buf[size], bufsize-size, "<tr>\n");
  
    size += snprintf(&buf[size], bufsize-size, "</tr>\n");
    
!   i++;
! 
!   while(admin_frame[i] && strcmp(admin_frame[i], "<!-- HNAENTRIES -->\n"))
!     {
!       size += snprintf(&buf[size], bufsize-size, admin_frame[i]);
!       i++;
!     }
! 
!   if(!admin_frame[i] || !admin_frame[i+1])
!     return size;
! 
!   i++;
  
!   if((olsr_cnf->ip_version == AF_INET) && (olsr_cnf->hna4_entries))
!     {
!       struct hna4_entry *hna4;
!       
!       for(hna4 = olsr_cnf->hna4_entries; hna4; hna4 = hna4->next)
! 	{
! 	  size += snprintf(&buf[size], bufsize-size, admin_frame[i], 
! 			  olsr_ip_to_string((union olsr_ip_addr *)&hna4->net),
! 			  olsr_ip_to_string((union olsr_ip_addr *)&hna4->netmask),
! 			  olsr_ip_to_string((union olsr_ip_addr *)&hna4->net),
! 			  olsr_ip_to_string((union olsr_ip_addr *)&hna4->netmask));
! 	}
!     }
!   else if((olsr_cnf->ip_version == AF_INET6) && (olsr_cnf->hna6_entries))
!     {
!       struct hna6_entry *hna6;
! 	
!       for(hna6 = olsr_cnf->hna6_entries; hna6; hna6 = hna6->next)
! 	{
! 	  size += snprintf(&buf[size], bufsize-size, admin_frame[i], 
! 			  olsr_ip_to_string((union olsr_ip_addr *)&hna6->net),
! 			  "TBD"/*hna6->prefix_len*/);
! 	}
      }
!   
!   i++;
! 
!   while(admin_frame[i])
!     {
!       size += snprintf(&buf[size], bufsize-size, admin_frame[i]);
!       i++;
      }
!   
    return size;
  }
--- 88,149 ----
  		  "Willingness:", "willingness", 1, olsr_cnf->willingness);
  
!   size += snprintf(&buf[size], bufsize-size, "</tr>\n"
!                                              "<tr>\n");
  
!   if(olsr_cnf->use_hysteresis) {
!     size += snprintf(&buf[size], bufsize-size, admin_basic_setting_float,
!                      "Hyst scaling:", "hyst_scaling", 4, olsr_cnf->hysteresis_param.scaling);
  
!     size += snprintf(&buf[size], bufsize-size, admin_basic_setting_float,
!                      "Lower thr:", "hyst_lower", 4, olsr_cnf->hysteresis_param.thr_low);
!     size += snprintf(&buf[size], bufsize-size, admin_basic_setting_float,
!                      "Upper thr:", "hyst_upper", 4, olsr_cnf->hysteresis_param.thr_high);
!   } else {
!     size += snprintf(&buf[size], bufsize-size, "<td>Hysteresis disabled</td>\n");
!   }
  
!   size += snprintf(&buf[size], bufsize-size, "</tr>\n"
!                                              "<tr>\n");
    
!   if(olsr_cnf->lq_level) {
!     size += snprintf(&buf[size], bufsize-size, admin_basic_setting_int,
!                      "LQ level:", "lq_level", 1, olsr_cnf->lq_level);
!     size += snprintf(&buf[size], bufsize-size, admin_basic_setting_int,
!                      "LQ winsize:", "lq_wsize", 2, olsr_cnf->lq_wsize);
!   } else {
!     size += snprintf(&buf[size], bufsize-size, "<td>LQ disabled</td>\n");
!   }
  
+   size += snprintf(&buf[size], bufsize-size, "</tr>\n"
+                                              "<tr>\n");
    size += snprintf(&buf[size], bufsize-size, "</tr>\n");
    
!   size += snprintf(&buf[size], bufsize-size, admin_frame_mid);
  
!   if(olsr_cnf->ip_version == AF_INET) {
!     struct hna4_entry *hna4;      
!     for(hna4 = olsr_cnf->hna4_entries; hna4; hna4 = hna4->next)	{
!       const char * const net = olsr_ip_to_string((union olsr_ip_addr *)&hna4->net);
!       const char * const mask = olsr_ip_to_string((union olsr_ip_addr *)&hna4->netmask);
!       size += snprintf(&buf[size], bufsize-size,
!                        "<tr><td halign=\"middle\"><input type=\"checkbox\" name=\"del_hna%s*%s\" class=\"input_checkbox\"></td><td>%s</td><td>%s</td></tr>\n", 
!                        net,
!                        mask,
!                        net,
!                        mask);
      }
!   } else {
!     struct hna6_entry *hna6;
!     for(hna6 = olsr_cnf->hna6_entries; hna6; hna6 = hna6->next) {
!       const char * const net = olsr_ip_to_string((union olsr_ip_addr *)&hna6->net);
!       size += snprintf(&buf[size], bufsize-size,
!                        "<tr><td halign=\"middle\"><input type=\"checkbox\" name=\"del_hna%s*%d\" class=\"input_checkbox\"></td><td>%s</td><td>%d</td></tr>\n", 
!                        net,
!                        hna6->prefix_len,
!                        net,
!                        hna6->prefix_len);
      }
!   }
!   size += snprintf(&buf[size], bufsize-size, admin_frame_epilog);
    return size;
  }

Index: html.h
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/lib/httpinfo/src/html.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** html.h	14 Oct 2007 22:46:03 -0000	1.10
--- html.h	20 Oct 2007 20:41:04 -0000	1.11
***************
*** 120,128 ****
  static const char * const http_ok_tail =
    "<!-- START TAIL -->\n"
!   "<div id=\"footer\">\n\n"
!   "<p><center>\n"
    "(C)2005 Andreas Tønnesen<br/>\n"
    "<a href=\"http://www.olsr.org/\">http://www.olsr.org</a>\n"
!   "</center></p>\n"
    "</div>\n"
    "</body></html>\n";
--- 120,128 ----
  static const char * const http_ok_tail =
    "<!-- START TAIL -->\n"
!   "<div id=\"footer\">\n"
!   "<center>\n"
    "(C)2005 Andreas Tønnesen<br/>\n"
    "<a href=\"http://www.olsr.org/\">http://www.olsr.org</a>\n"
!   "</center>\n"
    "</div>\n"
    "</body></html>\n";





More information about the Olsr-cvs mailing list