--- gvpe/src/vpn.h 2003/04/02 05:15:00 1.2 +++ gvpe/src/vpn.h 2004/04/02 14:42:45 1.14 @@ -1,5 +1,6 @@ /* vpn.h -- header for vpn.C + Copyright (C) 2003-2004 Marc Lehmann This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -26,7 +27,7 @@ struct vpn { - int udpv4_fd, tcpv4_fd, ipv4_fd; + int udpv4_fd, tcpv4_fd, ipv4_fd, icmpv4_fd, dnsv4_fd; int events; @@ -35,7 +36,7 @@ EVENT_SHUTDOWN = 2, }; - void event_cb (tstamp &ts); time_watcher event; + void event_cb (time_watcher &w); time_watcher event; tap_device *tap; @@ -43,26 +44,39 @@ conns_vector conns; connection *find_router (); + connection *find_forwarder (); void reconnect_all (); void shutdown_all (); - void connect_request (int id); - void recv_vpn_packet (vpn_packet *pkt, const sockinfo &rsi); + void tap_ev (io_watcher &w, short revents); io_watcher tap_ev_watcher; + void inject_data_packet (tap_packet *pkt, int dst); + + void send_connect_request (int id); - void tap_ev (int fd, short revents); io_watcher tap_ev_watcher; + void recv_vpn_packet (vpn_packet *pkt, const sockinfo &rsi); + bool send_vpn_packet (vpn_packet *pkt, const sockinfo &si, int tos); #if ENABLE_TCP - void tcpv4_ev (int fd, short revents); - void tcpv4_accept (int fd, short revents); io_watcher tcpv4_accept_watcher; - void send_tcpv4_packet (vpn_packet *pkt, const sockinfo &si, int tos = IPTOS_RELIABILITY); + void tcpv4_ev (io_watcher &w, short revents); io_watcher tcpv4_ev_watcher; + bool send_tcpv4_packet (vpn_packet *pkt, const sockinfo &si, int tos); +#endif + +#if ENABLE_ICMP + void icmpv4_ev (io_watcher &w, short revents); io_watcher icmpv4_ev_watcher; + bool send_icmpv4_packet (vpn_packet *pkt, const sockinfo &si, int tos); +#endif + +#if ENABLE_DNS + void dnsv4_ev (io_watcher &w, short revents); io_watcher dnsv4_ev_watcher; + bool send_dnsv4_packet (vpn_packet *pkt, const sockinfo &si, int tos); #endif - void udpv4_ev (int fd, short revents); io_watcher udpv4_ev_watcher; - void send_udpv4_packet (vpn_packet *pkt, const sockinfo &si, int tos = IPTOS_RELIABILITY); + void udpv4_ev (io_watcher &w, short revents); io_watcher udpv4_ev_watcher; + bool send_udpv4_packet (vpn_packet *pkt, const sockinfo &si, int tos); - void ipv4_ev (int fd, short revents); io_watcher ipv4_ev_watcher; - void send_ipv4_packet (vpn_packet *pkt, const sockinfo &si, int tos = IPTOS_RELIABILITY); + void ipv4_ev (io_watcher &w, short revents); io_watcher ipv4_ev_watcher; + bool send_ipv4_packet (vpn_packet *pkt, const sockinfo &si, int tos); vpn (); ~vpn (); @@ -74,5 +88,7 @@ const char *script_if_up (); }; +extern vpn network; // THE vpn + #endif