--- gvpe/src/vpn.h 2003/04/02 03:25:17 1.1 +++ gvpe/src/vpn.h 2003/04/06 18:12:18 1.6 @@ -19,14 +19,16 @@ #ifndef VPE_VPN_H__ #define VPE_VPN_H__ +#include + +#include "global.h" #include "conf.h" #include "device.h" #include "connection.h" struct vpn { - int udpv4_fd; - int ipv4_fd; + int udpv4_fd, tcpv4_fd, ipv4_fd; int events; @@ -35,7 +37,7 @@ EVENT_SHUTDOWN = 2, }; - void event_cb (tstamp &ts); time_watcher event; + void event_cb (time_watcher &w); time_watcher event; tap_device *tap; @@ -46,16 +48,24 @@ void reconnect_all (); void shutdown_all (); - void connect_request (int id); - void tap_ev (short revents); io_watcher tap_ev_watcher; - void ipv4_ev (short revents); io_watcher ipv4_ev_watcher; - void udpv4_ev (short revents); io_watcher udpv4_ev_watcher; + void tap_ev (io_watcher &w, short revents); io_watcher tap_ev_watcher; + + 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); + +#if ENABLE_TCP + 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 + + 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 send_udpv4_packet (vpn_packet *pkt, const sockinfo &si, int tos = IPTOS_RELIABILITY); - 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 (); @@ -64,7 +74,7 @@ void dump_status (); - const char *script_if_up (int); + const char *script_if_up (); }; #endif