ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/gvpe/src/vpn.h
(Generate patch)

Comparing gvpe/src/vpn.h (file contents):
Revision 1.19 by pcg, Fri Mar 4 04:52:38 2005 UTC vs.
Revision 1.26 by pcg, Sun Dec 2 00:09:36 2007 UTC

14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with gvpe; if not, write to the Free Software 18 along with gvpe; if not, write to the Free Software
19 Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20*/ 20*/
21 21
22#ifndef VPE_VPN_H__ 22#ifndef GVPE_VPN_H__
23#define VPE_VPN_H__ 23#define GVPE_VPN_H__
24 24
25#include "global.h" 25#include "global.h"
26#include "conf.h" 26#include "conf.h"
27#include "device.h" 27#include "device.h"
28#include "connection.h" 28#include "connection.h"
29 29
30struct vpn 30struct vpn
31 { 31{
32 int udpv4_fd, tcpv4_fd, ipv4_fd, icmpv4_fd, dnsv4_fd; 32 int udpv4_fd, tcpv4_fd, ipv4_fd, icmpv4_fd, dnsv4_fd;
33 int udpv4_tos, tcpv4_tos, ipv4_tos, icmpv4_tos, dnsv4_tos;
33 34
34 int events; 35 int events;
35 36
36 enum { 37 enum {
37 EVENT_RECONNECT = 1, 38 EVENT_RECONNECT = 1,
38 EVENT_SHUTDOWN = 2, 39 EVENT_SHUTDOWN = 2,
39 }; 40 };
40 41
41 void event_cb (time_watcher &w); time_watcher event; 42 void event_cb (ev::timer &w, int revents); ev::timer event;
42 43
43 tap_device *tap; 44 tap_device *tap;
44 45
45 typedef vector<connection *> conns_vector; 46 typedef vector<connection *> conns_vector;
46 conns_vector conns; 47 conns_vector conns;
47 48
48 connection *find_router (); 49 connection *find_router ();
49 connection *find_forwarder (); 50 connection *find_forwarder ();
50 51
51 void reconnect_all (); 52 void reconnect_all ();
52 void shutdown_all (); 53 void shutdown_all ();
53 54
54 void tap_ev (io_watcher &w, short revents); io_watcher tap_ev_watcher; 55 void tap_ev (ev::io &w, int revents); ev::io tap_ev_watcher;
55 void inject_data_packet (tap_packet *pkt, int dst); 56 void inject_data_packet (tap_packet *pkt, int dst);
56 57
57 void send_connect_request (int id); 58 void send_connect_request (int id);
58 59
59 void recv_vpn_packet (vpn_packet *pkt, const sockinfo &rsi); 60 void recv_vpn_packet (vpn_packet *pkt, const sockinfo &rsi);
61 bool send_vpn_packet (vpn_packet *pkt, const sockinfo &si, int tos = 0);
60 62
61#if ENABLE_TCP 63#if ENABLE_TCP
62 void tcpv4_ev (io_watcher &w, short revents); io_watcher tcpv4_ev_watcher; 64 void tcpv4_ev (ev::io &w, int revents); ev::io tcpv4_ev_watcher;
63 bool send_tcpv4_packet (vpn_packet *pkt, const sockinfo &si, int tos); 65 bool send_tcpv4_packet (vpn_packet *pkt, const sockinfo &si, int tos);
64#endif 66#endif
65 67
66#if ENABLE_ICMP 68#if ENABLE_ICMP
67 void icmpv4_ev (io_watcher &w, short revents); io_watcher icmpv4_ev_watcher; 69 void icmpv4_ev (ev::io &w, int revents); ev::io icmpv4_ev_watcher;
68 bool send_icmpv4_packet (vpn_packet *pkt, const sockinfo &si, int tos); 70 bool send_icmpv4_packet (vpn_packet *pkt, const sockinfo &si, int tos);
69#endif 71#endif
70 72
71#if ENABLE_DNS 73#if ENABLE_DNS
72 vector<struct dns_req *> dns_sndpq; 74 vector<struct dns_snd *> dns_sndpq;
73 sockinfo dns_forwarder; 75 sockinfo dns_forwarder;
74 76
75 void dnsv4_ev (io_watcher &w, short revents); io_watcher dnsv4_ev_watcher; 77 void dnsv4_ev (ev::io &w, int revents); ev::io dnsv4_ev_watcher;
76 struct dns_packet *dnsv4_server (struct dns_packet *pkt); 78 void dnsv4_server (struct dns_packet &pkt);
77 void dnsv4_client (struct dns_packet *pkt); 79 void dnsv4_client (struct dns_packet &pkt);
80
81 bool send_dnsv4_packet (vpn_packet *pkt, const sockinfo &si, int tos);
78#endif 82#endif
79 83
80 void udpv4_ev (io_watcher &w, short revents); io_watcher udpv4_ev_watcher; 84 void udpv4_ev (ev::io &w, int revents); ev::io udpv4_ev_watcher;
81 bool send_udpv4_packet (vpn_packet *pkt, const sockinfo &si, int tos); 85 bool send_udpv4_packet (vpn_packet *pkt, const sockinfo &si, int tos);
82 86
83 void ipv4_ev (io_watcher &w, short revents); io_watcher ipv4_ev_watcher; 87 void ipv4_ev (ev::io &w, int revents); ev::io ipv4_ev_watcher;
84 bool send_ipv4_packet (vpn_packet *pkt, const sockinfo &si, int tos); 88 bool send_ipv4_packet (vpn_packet *pkt, const sockinfo &si, int tos);
85 89
86 vpn (); 90 vpn ();
87 ~vpn (); 91 ~vpn ();
88 92
89 int setup (); 93 int setup ();
90 94
91 void dump_status (); 95 void dump_status ();
92 96
97 void script_init_env ();
98 const char *script_if_init ();
93 const char *script_if_up (); 99 const char *script_if_up ();
94 }; 100};
95 101
96extern vpn network; // THE vpn 102extern vpn network; // THE vpn
97 103
98#endif 104#endif
99 105

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines