--- gvpe/src/vpn.h 2003/04/05 02:32:40 1.4 +++ gvpe/src/vpn.h 2005/03/23 21:55:39 1.23 @@ -1,7 +1,10 @@ /* vpn.h -- header for vpn.C + Copyright (C) 2003-2005 Marc Lehmann - This program is free software; you can redistribute it and/or modify + This file is part of GVPE. + + GVPE is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. @@ -12,14 +15,12 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software + along with gvpe; if not, write to the Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef VPE_VPN_H__ -#define VPE_VPN_H__ - -#include +#ifndef GVPE_VPN_H__ +#define GVPE_VPN_H__ #include "global.h" #include "conf.h" @@ -28,7 +29,7 @@ struct vpn { - int udpv4_fd, tcpv4_fd, ipv4_fd; + int udpv4_fd, tcpv4_fd, ipv4_fd, icmpv4_fd, dnsv4_fd; int events; @@ -45,27 +46,45 @@ 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 send_vpn_packet (vpn_packet *pkt, const sockinfo &si, int tos = IPTOS_RELIABILITY); + 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 (io_watcher &w, short revents); io_watcher tcpv4_ev_watcher; - void send_tcpv4_packet (vpn_packet *pkt, const sockinfo &si, int tos); + 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 + vector dns_sndpq; + sockinfo dns_forwarder; + + void dnsv4_ev (io_watcher &w, short revents); io_watcher 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); #endif void udpv4_ev (io_watcher &w, short revents); io_watcher udpv4_ev_watcher; - void send_udpv4_packet (vpn_packet *pkt, const sockinfo &si, int tos); + bool send_udpv4_packet (vpn_packet *pkt, const sockinfo &si, int tos); void ipv4_ev (io_watcher &w, short revents); io_watcher ipv4_ev_watcher; - void send_ipv4_packet (vpn_packet *pkt, const sockinfo &si, int tos); + bool send_ipv4_packet (vpn_packet *pkt, const sockinfo &si, int tos); vpn (); ~vpn (); @@ -74,8 +93,12 @@ void dump_status (); + void script_init_env (); + const char *script_if_init (); const char *script_if_up (); }; +extern vpn network; // THE vpn + #endif