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.5 by pcg, Fri Mar 28 04:05:10 2003 UTC vs.
Revision 1.9 by pcg, Wed Apr 2 05:14:59 2003 UTC

51char *identname; 51char *identname;
52char *pidfilename; 52char *pidfilename;
53 53
54struct configuration conf; 54struct configuration conf;
55 55
56u8 best_protocol (u8 protset)
57{
58 if (protset & PROT_IPv4 ) return PROT_IPv4;
59 if (protset & PROT_UDPv4) return PROT_UDPv4;
60 if (protset & PROT_TCPv4) return PROT_TCPv4;
61
62 return 0;
63}
64
65const char *strprotocol (u8 protocol)
66{
67 if (protocol & PROT_IPv4 ) return "rawip";
68 if (protocol & PROT_UDPv4) return "udp";
69
70 return "<unknown>";
71}
72
56configuration::configuration () 73configuration::configuration ()
57{ 74{
58 init (); 75 init ();
59} 76}
60 77
71 keepalive = DEFAULT_KEEPALIVE; 88 keepalive = DEFAULT_KEEPALIVE;
72 llevel = L_INFO; 89 llevel = L_INFO;
73 ip_proto = IPPROTO_GRE; 90 ip_proto = IPPROTO_GRE;
74 91
75 default_node.udp_port = DEFAULT_UDPPORT; 92 default_node.udp_port = DEFAULT_UDPPORT;
93 default_node.tcp_port = DEFAULT_UDPPORT;
76 default_node.connectmode = conf_node::C_ALWAYS; 94 default_node.connectmode = conf_node::C_ALWAYS;
77 default_node.compress = true; 95 default_node.compress = true;
78 default_node.can_send = PROT_UDPv4; 96 default_node.protocols = PROT_UDPv4;
79 default_node.can_recv = PROT_IPv4;
80} 97}
81 98
82void configuration::cleanup() 99void configuration::cleanup()
83{ 100{
84 if (rsa_key) 101 if (rsa_key)
265 } 282 }
266 283
267 /* node-specific, defaultable */ 284 /* node-specific, defaultable */
268 else if (!strcmp (var, "udp-port")) 285 else if (!strcmp (var, "udp-port"))
269 node->udp_port = atoi (val); 286 node->udp_port = atoi (val);
287 else if (!strcmp (var, "tcp-port"))
288 node->tcp_port = atoi (val);
270 else if (!strcmp (var, "router-priority")) 289 else if (!strcmp (var, "router-priority"))
271 node->routerprio = atoi (val); 290 node->routerprio = atoi (val);
272 else if (!strcmp (var, "connect")) 291 else if (!strcmp (var, "connect"))
273 { 292 {
274 if (!strcmp (val, "ondemand")) 293 if (!strcmp (val, "ondemand"))
291 else if (!strcmp (var, "compress")) 310 else if (!strcmp (var, "compress"))
292 { 311 {
293 parse_bool (node->compress, "compress", true, false); 312 parse_bool (node->compress, "compress", true, false);
294 } 313 }
295 // all these bool options really really cost a lot of executable size! 314 // all these bool options really really cost a lot of executable size!
296 else if (!strcmp (var, "can-send-udp")) 315 else if (!strcmp (var, "enable-tcp"))
297 {
298 u8 v; parse_bool (v, "can-send-udp", PROT_UDPv4, 0); node->can_send = (node->can_send & ~PROT_UDPv4) | v;
299 } 316 {
300 else if (!strcmp (var, "can-recv-udp")) 317 u8 v; parse_bool (v, "enable-tcp" , PROT_TCPv4, 0); node->protocols = (node->protocols & ~PROT_TCPv4) | v;
301 { 318 }
302 u8 v; parse_bool (v, "can-recv-udp", PROT_UDPv4, 0); node->can_recv = (node->can_recv & ~PROT_UDPv4) | v; 319 else if (!strcmp (var, "enable-udp"))
303 } 320 {
304 else if (!strcmp (var, "can-send-rawip")) 321 u8 v; parse_bool (v, "enable-udp" , PROT_UDPv4, 0); node->protocols = (node->protocols & ~PROT_UDPv4) | v;
305 { 322 }
306 u8 v; parse_bool (v, "can-send-rawip", PROT_IPv4, 0); node->can_send = (node->can_send & ~PROT_IPv4) | v; 323 else if (!strcmp (var, "enable-rawip"))
307 } 324 {
308 else if (!strcmp (var, "can-recv-rawip"))
309 {
310 u8 v; parse_bool (v, "can-recv-rawip", PROT_IPv4, 0); node->can_recv = (node->can_recv & ~PROT_IPv4) | v; 325 u8 v; parse_bool (v, "enable-rawip", PROT_IPv4, 0); node->protocols = (node->protocols & ~PROT_IPv4 ) | v;
311 } 326 }
312 327
313 // unknown or misplaced 328 // unknown or misplaced
314 else 329 else
315 { 330 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines