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.11 by pcg, Wed Apr 2 21:43:44 2003 UTC vs.
Revision 1.12 by pcg, Mon Apr 7 01:12:56 2003 UTC

69 if (protocol & PROT_TCPv4) return "tcp"; 69 if (protocol & PROT_TCPv4) return "tcp";
70 70
71 return "<unknown>"; 71 return "<unknown>";
72} 72}
73 73
74configuration::configuration () 74void
75conf_node::print ()
75{ 76{
76 init (); 77 printf ("%4d fe:fd:80:00:0%1x:%02x %c %-8.8s %-10.10s %s%s%d\n",
78 id,
79 id >> 8, id & 0xff,
80 compress ? 'Y' : 'N',
81 connectmode == C_ONDEMAND ? "ondemand" :
82 connectmode == C_NEVER ? "never" :
83 connectmode == C_ALWAYS ? "always" : "",
84 nodename,
85 hostname ? hostname : "",
86 hostname ? ":" : "",
87 hostname ? udp_port : 0
88 );
77} 89}
78 90
79configuration::~configuration () 91conf_node::~conf_node ()
80{ 92{
81 cleanup (); 93 if (rsa_key)
94 RSA_free (rsa_key);
95
96 free (nodename);
97 free (hostname);
82} 98}
83 99
84void configuration::init () 100void configuration::init ()
85{ 101{
86 memset (this, 0, sizeof (*this)); 102 memset (this, 0, sizeof (*this));
100void configuration::cleanup() 116void configuration::cleanup()
101{ 117{
102 if (rsa_key) 118 if (rsa_key)
103 RSA_free (rsa_key); 119 RSA_free (rsa_key);
104 120
105 free (ifname);
106
107 rsa_key = 0; 121 rsa_key = 0;
108 ifname = 0; 122
123 free (ifname); ifname = 0;
124#if ENABLE_HTTP_PROXY
125 free (proxy_host); proxy_host = 0;
126 free (proxy_auth); proxy_auth = 0;
127#endif
109} 128}
110 129
111void 130void
112configuration::clear_config () 131configuration::clear_config ()
113{ 132{
272 script_if_up = strdup (val); 291 script_if_up = strdup (val);
273 else if (!strcmp (var, "node-up")) 292 else if (!strcmp (var, "node-up"))
274 script_node_up = strdup (val); 293 script_node_up = strdup (val);
275 else if (!strcmp (var, "node-down")) 294 else if (!strcmp (var, "node-down"))
276 script_node_down = strdup (val); 295 script_node_down = strdup (val);
296#if ENABLE_HTTP_PROXY
297 else if (!strcmp (var, "http-proxy-host"))
298 proxy_host = strdup (val);
299 else if (!strcmp (var, "http-proxy-port"))
300 proxy_port = atoi (val);
301 else if (!strcmp (var, "http-proxy-auth"))
302 proxy_auth = (char *)base64_encode ((const u8 *)val, strlen (val));
303#endif
277 304
278 /* node-specific, non-defaultable */ 305 /* node-specific, non-defaultable */
279 else if (node != &default_node && !strcmp (var, "hostname")) 306 else if (node != &default_node && !strcmp (var, "hostname"))
280 { 307 {
281 free (node->hostname); 308 free (node->hostname);
328 u8 v; parse_bool (v, "enable-rawip", PROT_IPv4, 0); node->protocols = (node->protocols & ~PROT_IPv4 ) | v; 355 u8 v; parse_bool (v, "enable-rawip", PROT_IPv4, 0); node->protocols = (node->protocols & ~PROT_IPv4 ) | v;
329 } 356 }
330 357
331 // unknown or misplaced 358 // unknown or misplaced
332 else 359 else
333 {
334 slog (L_WARN, 360 slog (L_WARN,
335 _("unknown or misplaced variable `%s', at '%s' line %d"), 361 _("unknown or misplaced variable `%s', at '%s' line %d"),
336 var, fname, lineno); 362 var, fname, lineno);
337 }
338 } 363 }
339 364
340 fclose (f); 365 fclose (f);
341 } 366 }
342 else 367 else
413 (*i)->print (); 438 (*i)->print ();
414 439
415 printf ("\n"); 440 printf ("\n");
416} 441}
417 442
418void 443configuration::configuration ()
419conf_node::print ()
420{ 444{
421 printf ("%4d fe:fd:80:00:0%1x:%02x %c %-8.8s %-10.10s %s%s%d\n", 445 init ();
422 id,
423 id >> 8, id & 0xff,
424 compress ? 'Y' : 'N',
425 connectmode == C_ONDEMAND ? "ondemand" :
426 connectmode == C_NEVER ? "never" :
427 connectmode == C_ALWAYS ? "always" : "",
428 nodename,
429 hostname ? hostname : "",
430 hostname ? ":" : "",
431 hostname ? udp_port : 0
432 );
433} 446}
434 447
448configuration::~configuration ()
449{
450 cleanup ();
451}
452
453

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines