[Olsr-cvs] olsrd-current/lib/nameservice/src nameservice.c, 1.29, 1.30

Bernd Petrovitsch (spam-protected)
Mon Sep 17 23:57:07 CEST 2007


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

Modified Files:
	nameservice.c 
Log Message:
- applied 115-olsrd-nameserviceparamfix.patch and
  116-olsrd-fix-pluginparam-addons.patch by Sven-Ola Tücke
  <(spam-protected)> fixing the compilation warning on 64bit.


Index: nameservice.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/lib/nameservice/src/nameservice.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** nameservice.c	13 Sep 2007 15:31:59 -0000	1.29
--- nameservice.c	17 Sep 2007 21:57:05 -0000	1.30
***************
*** 166,170 ****
  
  
! static int set_nameservice_server(const char *value, void *data, unsigned int addon)
  {
  	union olsr_ip_addr ip;
--- 166,170 ----
  
  
! static int set_nameservice_server(const char *value, void *data, set_plugin_parameter_addon addon)
  {
  	union olsr_ip_addr ip;
***************
*** 172,176 ****
  	if (0 == strlen(value))
  	{
! 		*v = add_name_to_list(*v, "", addon, NULL);
                  OLSR_PRINTF(1, "%s got %s (main address)\n", "Got", value);
  		return 0;
--- 172,176 ----
  	if (0 == strlen(value))
  	{
! 		*v = add_name_to_list(*v, "", addon.ui, NULL);
                  OLSR_PRINTF(1, "%s got %s (main address)\n", "Got", value);
  		return 0;
***************
*** 178,182 ****
  	else if (0 < inet_pton(olsr_cnf->ip_version, value, &ip))
  	{
! 		*v = add_name_to_list(*v, "", addon, &ip);
                  OLSR_PRINTF(1, "%s got %s\n", "Got", value);
  		return 0;
--- 178,182 ----
  	else if (0 < inet_pton(olsr_cnf->ip_version, value, &ip))
  	{
! 		*v = add_name_to_list(*v, "", addon.ui, &ip);
                  OLSR_PRINTF(1, "%s got %s\n", "Got", value);
  		return 0;
***************
*** 189,198 ****
  }
  
! static int set_nameservice_name(const char *value, void *data, unsigned int addon)
  {
  	struct name_entry **v = data;
  	if (0 < strlen(value))
  	{
! 		*v = add_name_to_list(*v, (char*)value, addon, NULL);
                  OLSR_PRINTF(1, "%s got %s (main address)\n", "Got", value);
  		return 0;
--- 189,198 ----
  }
  
! static int set_nameservice_name(const char *value, void *data, set_plugin_parameter_addon addon)
  {
  	struct name_entry **v = data;
  	if (0 < strlen(value))
  	{
! 		*v = add_name_to_list(*v, (char*)value, addon.ui, NULL);
                  OLSR_PRINTF(1, "%s got %s (main address)\n", "Got", value);
  		return 0;
***************
*** 205,230 ****
  }
  
! static int set_nameservice_host(const char *value, void *data, unsigned int addon)
  {
  	union olsr_ip_addr ip;
  	struct name_entry **v = data;
! 	if (0 < inet_pton(olsr_cnf->ip_version, (char*)addon, &ip))
  	{
  		// the IP is validated later
! 		*v = add_name_to_list(*v, (char*)value, addon, &ip);
!                 OLSR_PRINTF(1, "%s: %s got %s\n", "Got", (char*) addon, value);
  		return 0;
  	}
  	else
  	{
!                 OLSR_PRINTF(0, "%s: Illegal IP address \"%s\"", (char*) addon, value);
  	}
  	return 1;
  }
  
! static int set_nameservice_float(const char *value, void *data, unsigned int addon)
  {
      const float thefloat = atof(value);
-     if (addon) {}
      if (data != NULL)
      {
--- 205,229 ----
  }
  
! static int set_nameservice_host(const char *value, void *data, set_plugin_parameter_addon addon)
  {
  	union olsr_ip_addr ip;
  	struct name_entry **v = data;
! 	if (0 < inet_pton(olsr_cnf->ip_version, addon.pc, &ip))
  	{
  		// the IP is validated later
! 		*v = add_name_to_list(*v, (char*)value, NAME_HOST, &ip);
!                 OLSR_PRINTF(1, "%s: %s got %s\n", "Got", addon.pc, value);
  		return 0;
  	}
  	else
  	{
!                 OLSR_PRINTF(0, "%s: Illegal IP address \"%s\"", addon.pc, value);
  	}
  	return 1;
  }
  
! static int set_nameservice_float(const char *value, void *data, set_plugin_parameter_addon addon __attribute__((unused)))
  {
      const float thefloat = atof(value);
      if (data != NULL)
      {
***************
*** 243,259 ****
      { .name = "interval",      .set_plugin_parameter = &set_plugin_int,         .data = &my_interval },
      { .name = "timeout",       .set_plugin_parameter = &set_nameservice_float,  .data = &my_timeout },
!     { .name = "hosts-file",    .set_plugin_parameter = &set_plugin_string,      .data = &my_hosts_file,    .addon = sizeof(my_hosts_file) },
!     { .name = "resolv-file",   .set_plugin_parameter = &set_plugin_string,      .data = &my_resolv_file,   .addon = sizeof(my_resolv_file) },
!     { .name = "suffix",        .set_plugin_parameter = &set_plugin_string,      .data = &my_suffix,        .addon = sizeof(my_suffix) },
!     { .name = "add-hosts",     .set_plugin_parameter = &set_plugin_string,      .data = &my_add_hosts,     .addon = sizeof(my_add_hosts) },
!     { .name = "services-file", .set_plugin_parameter = &set_plugin_string,      .data = &my_services_file, .addon = sizeof(my_services_file) },
      { .name = "lat",           .set_plugin_parameter = &set_nameservice_float,  .data = &my_lat },
      { .name = "lon",           .set_plugin_parameter = &set_nameservice_float,  .data = &my_lon },
!     { .name = "latlon-file",   .set_plugin_parameter = &set_plugin_string,      .data = &my_latlon_file,   .addon = sizeof(my_latlon_file) },
!     { .name = "latlon-infile", .set_plugin_parameter = &set_plugin_string,      .data = &latlon_in_file,   .addon = sizeof(latlon_in_file) },
!     { .name = "dns-server",    .set_plugin_parameter = &set_nameservice_server, .data = &my_forwarders,    .addon = NAME_FORWARDER },
!     { .name = "name",          .set_plugin_parameter = &set_nameservice_name,   .data = &my_names,         .addon = NAME_HOST },
!     { .name = "service",       .set_plugin_parameter = &set_nameservice_name,   .data = &my_services,      .addon = NAME_SERVICE },
!     { .name = "",              .set_plugin_parameter = &set_nameservice_host,   .data = &my_names,         .addon = NAME_HOST },
  };
  
--- 242,258 ----
      { .name = "interval",      .set_plugin_parameter = &set_plugin_int,         .data = &my_interval },
      { .name = "timeout",       .set_plugin_parameter = &set_nameservice_float,  .data = &my_timeout },
!     { .name = "hosts-file",    .set_plugin_parameter = &set_plugin_string,      .data = &my_hosts_file,    .addon = {sizeof(my_hosts_file)} },
!     { .name = "resolv-file",   .set_plugin_parameter = &set_plugin_string,      .data = &my_resolv_file,   .addon = {sizeof(my_resolv_file)} },
!     { .name = "suffix",        .set_plugin_parameter = &set_plugin_string,      .data = &my_suffix,        .addon = {sizeof(my_suffix)} },
!     { .name = "add-hosts",     .set_plugin_parameter = &set_plugin_string,      .data = &my_add_hosts,     .addon = {sizeof(my_add_hosts)} },
!     { .name = "services-file", .set_plugin_parameter = &set_plugin_string,      .data = &my_services_file, .addon = {sizeof(my_services_file)} },
      { .name = "lat",           .set_plugin_parameter = &set_nameservice_float,  .data = &my_lat },
      { .name = "lon",           .set_plugin_parameter = &set_nameservice_float,  .data = &my_lon },
!     { .name = "latlon-file",   .set_plugin_parameter = &set_plugin_string,      .data = &my_latlon_file,   .addon = {sizeof(my_latlon_file)} },
!     { .name = "latlon-infile", .set_plugin_parameter = &set_plugin_string,      .data = &latlon_in_file,   .addon = {sizeof(latlon_in_file)} },
!     { .name = "dns-server",    .set_plugin_parameter = &set_nameservice_server, .data = &my_forwarders,    .addon = {NAME_FORWARDER} },
!     { .name = "name",          .set_plugin_parameter = &set_nameservice_name,   .data = &my_names,         .addon = {NAME_HOST} },
!     { .name = "service",       .set_plugin_parameter = &set_nameservice_name,   .data = &my_services,      .addon = {NAME_SERVICE} },
!     { .name = "",              .set_plugin_parameter = &set_nameservice_host,   .data = &my_names },
  };
  
***************
*** 1444,1448 ****
      struct tc_edge_entry *tc_edge;
  
! 	if (!latlon_table_changed) return;
  	OLSR_PRINTF(2, "NAME PLUGIN: writing latlon file\n");
  
--- 1443,1449 ----
      struct tc_edge_entry *tc_edge;
  
! 	if (!my_names || !latlon_table_changed) {
!         return;
!     }
  	OLSR_PRINTF(2, "NAME PLUGIN: writing latlon file\n");
  





More information about the Olsr-cvs mailing list