big svn cleanup
[anytun.git] / src / openvpn / forward.h
blob1d37aaeb1ab9141763f8d2152f1276b664fa8043
1 /*
2 * OpenVPN -- An application to securely tunnel IP networks
3 * over a single TCP/UDP port, with support for SSL/TLS-based
4 * session authentication and key exchange,
5 * packet encryption, packet authentication, and
6 * packet compression.
8 * Copyright (C) 2002-2005 OpenVPN Solutions LLC <info@openvpn.net>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2
12 * as published by the Free Software Foundation.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program (see the file COPYING included with this
21 * distribution); if not, write to the Free Software Foundation, Inc.,
22 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #ifndef FORWARD_H
26 #define FORWARD_H
28 #include "openvpn.h"
29 #include "occ.h"
30 #include "ping.h"
32 #define TUN_OUT(c) (BLEN(&(c)->c2.to_tun) > 0)
33 #define LINK_OUT(c) (BLEN(&(c)->c2.to_link) > 0)
34 #define ANY_OUT(c) (TUN_OUT(c) || LINK_OUT(c))
36 #ifdef ENABLE_FRAGMENT
37 #define TO_LINK_FRAG(c) ((c)->c2.fragment && fragment_outgoing_defined ((c)->c2.fragment))
38 #else
39 #define TO_LINK_FRAG(c) (false)
40 #endif
42 #define TO_LINK_DEF(c) (LINK_OUT(c) || TO_LINK_FRAG(c))
44 #define IOW_TO_TUN (1<<0)
45 #define IOW_TO_LINK (1<<1)
46 #define IOW_READ_TUN (1<<2)
47 #define IOW_READ_LINK (1<<3)
48 #define IOW_SHAPER (1<<4)
49 #define IOW_CHECK_RESIDUAL (1<<5)
50 #define IOW_FRAG (1<<6)
51 #define IOW_MBUF (1<<7)
52 #define IOW_READ_TUN_FORCE (1<<8)
53 #define IOW_WAIT_SIGNAL (1<<9)
55 #define IOW_READ (IOW_READ_TUN|IOW_READ_LINK)
57 void pre_select (struct context *c);
59 void process_io (struct context *c);
61 void encrypt_sign (struct context *c, bool comp_frag);
63 const char *wait_status_string (struct context *c, struct gc_arena *gc);
64 void show_wait_status (struct context *c);
66 void read_incoming_link (struct context *c);
67 void process_incoming_link (struct context *c);
68 void read_incoming_tun (struct context *c);
69 void process_incoming_tun (struct context *c);
70 void process_outgoing_link (struct context *c);
71 void process_outgoing_tun (struct context *c);
73 bool send_control_channel_string (struct context *c, const char *str, int msglevel);
75 #define PIPV4_PASSTOS (1<<0)
76 #define PIPV4_MSSFIX (1<<1)
78 void process_ipv4_header (struct context *c, unsigned int flags, struct buffer *buf);
80 #if P2MP
81 void schedule_exit (struct context *c, const int n_seconds);
82 #endif
84 #endif /* FORWARD_H */