ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/gvpe/src/conf.C
(Generate patch)

Comparing gvpe/src/conf.C (file contents):
Revision 1.26 by pcg, Wed May 12 13:32:13 2004 UTC vs.
Revision 1.29 by pcg, Tue Mar 1 06:27:20 2005 UTC

93 if (rsa_key) 93 if (rsa_key)
94 RSA_free (rsa_key); 94 RSA_free (rsa_key);
95 95
96 free (nodename); 96 free (nodename);
97 free (hostname); 97 free (hostname);
98 free (domain);
98} 99}
99 100
100void configuration::init () 101void configuration::init ()
101{ 102{
102 memset (this, 0, sizeof (*this)); 103 memset (this, 0, sizeof (*this));
112 113
113 default_node.udp_port = DEFAULT_UDPPORT; 114 default_node.udp_port = DEFAULT_UDPPORT;
114 default_node.tcp_port = DEFAULT_UDPPORT; // ehrm 115 default_node.tcp_port = DEFAULT_UDPPORT; // ehrm
115 default_node.connectmode = conf_node::C_ALWAYS; 116 default_node.connectmode = conf_node::C_ALWAYS;
116 default_node.compress = true; 117 default_node.compress = true;
117 default_node.protocols = PROT_UDPv4; 118 default_node.protocols = 0;
119 default_node.max_retry = DEFAULT_MAX_RETRY;
118 120
119 conf.pidfilename = strdup (LOCALSTATEDIR "/run/vped.pid"); 121 conf.pidfilename = strdup (LOCALSTATEDIR "/run/gvpe.pid");
120} 122}
121 123
122void configuration::cleanup() 124void configuration::cleanup()
123{ 125{
124 if (rsa_key) 126 if (rsa_key)
125 RSA_free (rsa_key); 127 RSA_free (rsa_key);
126 128
127 rsa_key = 0; 129 rsa_key = 0;
128 130
129 free (pidfilename); pidfilename = 0; 131 free (pidfilename); pidfilename = 0;
130 free (ifname); ifname = 0; 132 free (ifname); ifname = 0;
131#if ENABLE_HTTP_PROXY 133#if ENABLE_HTTP_PROXY
132 free (proxy_host); proxy_host = 0; 134 free (proxy_host); proxy_host = 0;
133 free (proxy_auth); proxy_auth = 0; 135 free (proxy_auth); proxy_auth = 0;
136#endif
137#if ENABLE_DNS
138 free (dns_forw_host); dns_forw_host = 0;
134#endif 139#endif
135} 140}
136 141
137void 142void
138configuration::clear_config () 143configuration::clear_config ()
163 char *fname; 168 char *fname;
164 FILE *f; 169 FILE *f;
165 170
166 clear_config (); 171 clear_config ();
167 172
168 asprintf (&fname, "%s/vped.conf", confbase); 173 asprintf (&fname, "%s/gvpe.conf", confbase);
169 f = fopen (fname, "r"); 174 f = fopen (fname, "r");
170 175
171 if (f) 176 if (f)
172 { 177 {
173 char line[16384]; 178 char line[16384];
306 free (script_node_up), script_node_up = strdup (val); 311 free (script_node_up), script_node_up = strdup (val);
307 else if (!strcmp (var, "node-down")) 312 else if (!strcmp (var, "node-down"))
308 free (script_node_down), script_node_down = strdup (val); 313 free (script_node_down), script_node_down = strdup (val);
309 else if (!strcmp (var, "pid-file")) 314 else if (!strcmp (var, "pid-file"))
310 free (pidfilename), pidfilename = strdup (val); 315 free (pidfilename), pidfilename = strdup (val);
316 else if (!strcmp (var, "dns-forw-host"))
317 {
318#if ENABLE_DNS
319 free (dns_forw_host), dns_forw_host = strdup (val);
320#endif
321 }
322 else if (!strcmp (var, "dns-forw-port"))
323 {
324#if ENABLE_DNS
325 dns_forw_port = atoi (val);
326#endif
327 }
311 else if (!strcmp (var, "http-proxy-host")) 328 else if (!strcmp (var, "http-proxy-host"))
312 { 329 {
313#if ENABLE_HTTP_PROXY 330#if ENABLE_HTTP_PROXY
314 free (proxy_host), proxy_host = strdup (val); 331 free (proxy_host), proxy_host = strdup (val);
315#endif 332#endif
335 else if (!strcmp (var, "udp-port")) 352 else if (!strcmp (var, "udp-port"))
336 node->udp_port = atoi (val); 353 node->udp_port = atoi (val);
337 else if (!strcmp (var, "tcp-port")) 354 else if (!strcmp (var, "tcp-port"))
338 node->tcp_port = atoi (val); 355 node->tcp_port = atoi (val);
339 else if (!strcmp (var, "dns-port")) 356 else if (!strcmp (var, "dns-port"))
357 {
358#if ENABLE_DNS
340 node->dns_port = atoi (val); 359 node->dns_port = atoi (val);
360#endif
361 }
362 else if (!strcmp (var, "dns-domain"))
363 {
364#if ENABLE_DNS
365 free (node->domain), node->domain = strdup (val);
366#endif
367 }
341 else if (!strcmp (var, "router-priority")) 368 else if (!strcmp (var, "router-priority"))
342 node->routerprio = atoi (val); 369 node->routerprio = atoi (val);
370 else if (!strcmp (var, "max-retry"))
371 node->max_retry = atoi (val);
343 else if (!strcmp (var, "connect")) 372 else if (!strcmp (var, "connect"))
344 { 373 {
345 if (!strcmp (val, "ondemand")) 374 if (!strcmp (val, "ondemand"))
346 node->connectmode = conf_node::C_ONDEMAND; 375 node->connectmode = conf_node::C_ONDEMAND;
347 else if (!strcmp (val, "never")) 376 else if (!strcmp (val, "never"))
350 node->connectmode = conf_node::C_ALWAYS; 379 node->connectmode = conf_node::C_ALWAYS;
351 else if (!strcmp (val, "disabled")) 380 else if (!strcmp (val, "disabled"))
352 node->connectmode = conf_node::C_DISABLED; 381 node->connectmode = conf_node::C_DISABLED;
353 else 382 else
354 slog (L_WARN, 383 slog (L_WARN,
355 _("illegal value for 'connectmode', use one of 'ondemand', 'never', 'always' or 'disabled', at '%s' line %d"), 384 _("illegal value for 'connectmode', use one of 'ondemand', 'never', 'always' or 'disabled', at '%s' line %d"),
356 var, fname, lineno); 385 var, fname, lineno);
357 } 386 }
358 else if (!strcmp (var, "inherit-tos")) 387 else if (!strcmp (var, "inherit-tos"))
359 { 388 {
360 parse_bool (node->inherit_tos, "inherit-tos", true, false); 389 parse_bool (node->inherit_tos, "inherit-tos", true, false);
361 } 390 }
385 else if (!strcmp (var, "enable-udp")) 414 else if (!strcmp (var, "enable-udp"))
386 { 415 {
387 u8 v; parse_bool (v, "enable-udp" , PROT_UDPv4, 0); node->protocols = (node->protocols & ~PROT_UDPv4) | v; 416 u8 v; parse_bool (v, "enable-udp" , PROT_UDPv4, 0); node->protocols = (node->protocols & ~PROT_UDPv4) | v;
388 } 417 }
389 else if (!strcmp (var, "enable-rawip")) 418 else if (!strcmp (var, "enable-rawip"))
390 {; 419 {
391 u8 v; parse_bool (v, "enable-rawip", PROT_IPv4, 0); node->protocols = (node->protocols & ~PROT_IPv4 ) | v; 420 u8 v; parse_bool (v, "enable-rawip", PROT_IPv4, 0); node->protocols = (node->protocols & ~PROT_IPv4 ) | v;
392 } 421 }
393 422
394 // unknown or misplaced 423 // unknown or misplaced
395 else 424 else
485 printf ("\n"); 514 printf ("\n");
486} 515}
487 516
488configuration::configuration () 517configuration::configuration ()
489{ 518{
490 asprintf (&confbase, "%s/vpe", CONFDIR); 519 asprintf (&confbase, "%s/gvpe", CONFDIR);
491 520
492 init (); 521 init ();
493} 522}
494 523
495configuration::~configuration () 524configuration::~configuration ()

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines