--- gvpe/src/conf.C 2003/03/28 16:14:40 1.6 +++ gvpe/src/conf.C 2003/04/02 21:02:25 1.10 @@ -53,6 +53,24 @@ struct configuration conf; +u8 best_protocol (u8 protset) +{ + if (protset & PROT_IPv4 ) return PROT_IPv4; + if (protset & PROT_UDPv4) return PROT_UDPv4; + if (protset & PROT_TCPv4) return PROT_TCPv4; + + return 0; +} + +const char *strprotocol (u8 protocol) +{ + if (protocol & PROT_IPv4 ) return "rawip"; + if (protocol & PROT_UDPv4) return "udp"; + if (protocol & PROT_TCPv4) return "tcp"; + + return ""; +} + configuration::configuration () { init (); @@ -73,6 +91,7 @@ ip_proto = IPPROTO_GRE; default_node.udp_port = DEFAULT_UDPPORT; + default_node.tcp_port = DEFAULT_UDPPORT; default_node.connectmode = conf_node::C_ALWAYS; default_node.compress = true; default_node.protocols = PROT_UDPv4; @@ -266,6 +285,8 @@ /* node-specific, defaultable */ else if (!strcmp (var, "udp-port")) node->udp_port = atoi (val); + else if (!strcmp (var, "tcp-port")) + node->tcp_port = atoi (val); else if (!strcmp (var, "router-priority")) node->routerprio = atoi (val); else if (!strcmp (var, "connect")) @@ -292,6 +313,10 @@ parse_bool (node->compress, "compress", true, false); } // all these bool options really really cost a lot of executable size! + else if (!strcmp (var, "enable-tcp")) + { + u8 v; parse_bool (v, "enable-tcp" , PROT_TCPv4, 0); node->protocols = (node->protocols & ~PROT_TCPv4) | v; + } else if (!strcmp (var, "enable-udp")) { u8 v; parse_bool (v, "enable-udp" , PROT_UDPv4, 0); node->protocols = (node->protocols & ~PROT_UDPv4) | v;