--- gvpe/src/vpn.h 2007/11/10 05:14:22 1.25 +++ gvpe/src/vpn.h 2007/12/02 00:09:36 1.26 @@ -28,75 +28,76 @@ #include "connection.h" struct vpn - { - int udpv4_fd, tcpv4_fd, ipv4_fd, icmpv4_fd, dnsv4_fd; - - int events; - - enum { - EVENT_RECONNECT = 1, - EVENT_SHUTDOWN = 2, - }; +{ + int udpv4_fd, tcpv4_fd, ipv4_fd, icmpv4_fd, dnsv4_fd; + int udpv4_tos, tcpv4_tos, ipv4_tos, icmpv4_tos, dnsv4_tos; + + int events; + + enum { + EVENT_RECONNECT = 1, + EVENT_SHUTDOWN = 2, + }; - void event_cb (ev::timer &w, int revents); ev::timer event; + void event_cb (ev::timer &w, int revents); ev::timer event; - tap_device *tap; + tap_device *tap; - typedef vector conns_vector; - conns_vector conns; + typedef vector conns_vector; + conns_vector conns; - connection *find_router (); - connection *find_forwarder (); + connection *find_router (); + connection *find_forwarder (); - void reconnect_all (); - void shutdown_all (); + void reconnect_all (); + void shutdown_all (); - void tap_ev (ev::io &w, int revents); ev::io tap_ev_watcher; - void inject_data_packet (tap_packet *pkt, int dst); + void tap_ev (ev::io &w, int revents); ev::io tap_ev_watcher; + void inject_data_packet (tap_packet *pkt, int dst); - void send_connect_request (int id); + void send_connect_request (int id); - void recv_vpn_packet (vpn_packet *pkt, const sockinfo &rsi); - bool send_vpn_packet (vpn_packet *pkt, const sockinfo &si, int tos = 0); + void recv_vpn_packet (vpn_packet *pkt, const sockinfo &rsi); + bool send_vpn_packet (vpn_packet *pkt, const sockinfo &si, int tos = 0); #if ENABLE_TCP - void tcpv4_ev (ev::io &w, int revents); ev::io tcpv4_ev_watcher; - bool send_tcpv4_packet (vpn_packet *pkt, const sockinfo &si, int tos); + void tcpv4_ev (ev::io &w, int revents); ev::io tcpv4_ev_watcher; + bool send_tcpv4_packet (vpn_packet *pkt, const sockinfo &si, int tos); #endif #if ENABLE_ICMP - void icmpv4_ev (ev::io &w, int revents); ev::io icmpv4_ev_watcher; - bool send_icmpv4_packet (vpn_packet *pkt, const sockinfo &si, int tos); + void icmpv4_ev (ev::io &w, int revents); ev::io icmpv4_ev_watcher; + bool send_icmpv4_packet (vpn_packet *pkt, const sockinfo &si, int tos); #endif #if ENABLE_DNS - vector dns_sndpq; - sockinfo dns_forwarder; + vector dns_sndpq; + sockinfo dns_forwarder; - void dnsv4_ev (ev::io &w, int revents); ev::io dnsv4_ev_watcher; - void dnsv4_server (struct dns_packet &pkt); - void dnsv4_client (struct dns_packet &pkt); + void dnsv4_ev (ev::io &w, int revents); ev::io dnsv4_ev_watcher; + void dnsv4_server (struct dns_packet &pkt); + void dnsv4_client (struct dns_packet &pkt); - bool send_dnsv4_packet (vpn_packet *pkt, const sockinfo &si, int tos); + bool send_dnsv4_packet (vpn_packet *pkt, const sockinfo &si, int tos); #endif - void udpv4_ev (ev::io &w, int revents); ev::io udpv4_ev_watcher; - bool send_udpv4_packet (vpn_packet *pkt, const sockinfo &si, int tos); + void udpv4_ev (ev::io &w, int revents); ev::io udpv4_ev_watcher; + bool send_udpv4_packet (vpn_packet *pkt, const sockinfo &si, int tos); - void ipv4_ev (ev::io &w, int revents); ev::io ipv4_ev_watcher; - bool send_ipv4_packet (vpn_packet *pkt, const sockinfo &si, int tos); + void ipv4_ev (ev::io &w, int revents); ev::io ipv4_ev_watcher; + bool send_ipv4_packet (vpn_packet *pkt, const sockinfo &si, int tos); - vpn (); - ~vpn (); + vpn (); + ~vpn (); - int setup (); + int setup (); - void dump_status (); + void dump_status (); - void script_init_env (); - const char *script_if_init (); - const char *script_if_up (); - }; + void script_init_env (); + const char *script_if_init (); + const char *script_if_up (); +}; extern vpn network; // THE vpn