[pisa-src] r1784 - in trunk/pisacd: cdmain.c cdservers.c cdservers.h

  • From: Thomas Jansen <mithi@xxxxxxxxx>
  • To: pisa-src@xxxxxxxxxxxxx
  • Date: Wed, 25 Nov 2009 16:14:20 +0100

Author: tjansen
Date: Wed Nov 25 16:14:19 2009
New Revision: 1784

Log:
Removed parsing for service gateways from cdservers.c.

DNS provides this information as well, no need to keep a static list in the
config file. cdservers.c is now libconfig-free.

Modified:
   trunk/pisacd/cdmain.c
   trunk/pisacd/cdservers.c
   trunk/pisacd/cdservers.h

Modified: trunk/pisacd/cdmain.c
==============================================================================
--- trunk/pisacd/cdmain.c       Wed Nov 25 16:06:46 2009        (r1783)
+++ trunk/pisacd/cdmain.c       Wed Nov 25 16:14:19 2009        (r1784)
@@ -361,9 +361,6 @@
        /* Initialize the scheduler */
        pisa_sched_init(&cd_ctx.scheduler);
 
-       /* Add all servers from the config */
-       pisa_servers_add_all();
-
        cd_ctx.flag_running = true;
        PISA_INFO("\nEntering main loop\n");
 }

Modified: trunk/pisacd/cdservers.c
==============================================================================
--- trunk/pisacd/cdservers.c    Wed Nov 25 16:06:46 2009        (r1783)
+++ trunk/pisacd/cdservers.c    Wed Nov 25 16:14:19 2009        (r1784)
@@ -20,7 +20,6 @@
 #include "cdctx.h"
 #include "cdregister.h"
 #include "cdservers.h"
-#include "libpisa/cfg.h"
 #include "libpisa/nat.h"
 
 /* Suffix for a DNS lookup to map a virtual local IP to a service. Does not
@@ -47,55 +46,6 @@
 }
 
 /**
- * Parse a server block and add it.
- * @param server configuration block containing the server parameters
- * @param contype connection type
- */
-static void pisa_servers_add_block(config_setting_t *server, pisa_contype 
contype)
-{
-       const char *hit = NULL;
-       long port = PISACD_DEFAULT_PORTNUM_CONTROL;
-       struct in6_addr hitaddr;
-
-       if (config_setting_lookup_string(server, "hit", &hit) == CONFIG_FALSE) {
-               PISA_ERROR("No hit given in a server block\n");
-               return;
-       }
-       inet_pton(AF_INET6, hit, &hitaddr);
-
-       config_setting_lookup_int(server, "port", &port);
-       if (port <= 0 || port >= 65536) {
-               PISA_ERROR("Invalid port number %i\n", port);
-               return;
-       }
-
-       PISA_DEBUG(PL_CONFIG, "Server HIT: %s port: %i\n", hit, port);
-
-       pisa_server_add(&hitaddr, port, contype);
-}
-
-/**
- * Iterate over all server blocks in the configuration file and connect to
- * them.
- */
-void pisa_servers_add_all(void)
-{
-       config_setting_t *servers = pisa_cfg_get_setting("servers");
-       int i, max;
-       pisa_contype type;
-
-       if (!servers)
-               return;
-
-       type = cd_cfg.flag_native ? PISA_CONTYPE_SERVICE : 
PISA_CONTYPE_LEGACY_ROUTER;
-
-       max = config_setting_length(servers);
-       PISA_DEBUG(PL_CONFIG, "\nParsing %i server block(s):\n", max);
-       for (i = 0; i < max; i++)
-               pisa_servers_add_block(config_setting_get_elem(servers, i), 
type);
-}
-
-/**
  * Generate a domain name for looking up a virtual local IP.
  *
  * @param addr virtual local IP address

Modified: trunk/pisacd/cdservers.h
==============================================================================
--- trunk/pisacd/cdservers.h    Wed Nov 25 16:06:46 2009        (r1783)
+++ trunk/pisacd/cdservers.h    Wed Nov 25 16:14:19 2009        (r1784)
@@ -10,7 +10,6 @@
 #include "libpisa/conmgr.h"
 #include "libpisa/nat.h"
 
-void pisa_servers_add_all(void);
 pisa_conmgr_entry *pisa_server_add(struct in6_addr *hit, int port, 
pisa_contype type);
 
 pisa_nat_mapping *pisa_servers_add_via_dns(struct in_addr *local_ip);

Other related posts:

  • » [pisa-src] r1784 - in trunk/pisacd: cdmain.c cdservers.c cdservers.h - Thomas Jansen