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

Comparing gvpe/src/protocol.h (file contents):
Revision 1.9 by pcg, Wed Mar 26 14:39:52 2003 UTC vs.
Revision 1.10 by pcg, Fri Mar 28 04:05:10 2003 UTC

26#include <openssl/rsa.h> 26#include <openssl/rsa.h>
27 27
28#include "conf.h" 28#include "conf.h"
29#include "iom.h" 29#include "iom.h"
30#include "util.h" 30#include "util.h"
31#include "sockinfo.h"
31#include "device.h" 32#include "device.h"
32 33
33/* Protocol version. Different major versions are incompatible, 34/* Protocol version. Different major versions are incompatible,
34 * different minor versions probably are compatible ;) 35 * different minor versions probably are compatible ;)
35 */ 36 */
68struct connection 69struct connection
69 { 70 {
70 conf_node *conf; 71 conf_node *conf;
71 struct vpn *vpn; 72 struct vpn *vpn;
72 73
73 SOCKADDR sa; // the current(!) destination ip to send packets to 74 sockinfo si; // the current(!) destination ip to send packets to
74 int retry_cnt; 75 int retry_cnt;
75 76
76 tstamp last_activity; // time of last packet received 77 tstamp last_activity; // time of last packet received
77 78
78 u32 oseqno; 79 u32 oseqno;
79 sliding_window iseqno; 80 sliding_window iseqno;
81
82 u8 prot_send, prot_recv;
80 83
81 pkt_queue queue; 84 pkt_queue queue;
82 85
83 crypto_ctx *octx, *ictx; 86 crypto_ctx *octx, *ictx;
84 87
91 void reset_connection (); 94 void reset_connection ();
92 void establish_connection_cb (tstamp &ts); time_watcher establish_connection; 95 void establish_connection_cb (tstamp &ts); time_watcher establish_connection;
93 void rekey_cb (tstamp &ts); time_watcher rekey; // next rekying (actually current reset + reestablishing) 96 void rekey_cb (tstamp &ts); time_watcher rekey; // next rekying (actually current reset + reestablishing)
94 void keepalive_cb (tstamp &ts); time_watcher keepalive; // next keepalive probe 97 void keepalive_cb (tstamp &ts); time_watcher keepalive; // next keepalive probe
95 98
96 void send_auth_request (SOCKADDR *sa, bool initiate); 99 void send_auth_request (const sockinfo &si, bool initiate);
97 void send_auth_response (SOCKADDR *sa, const rsaid &id, const rsachallenge &chg); 100 void send_auth_response (const sockinfo &si, const rsaid &id, const rsachallenge &chg);
98 void send_reset (SOCKADDR *dsa); 101 void send_reset (const sockinfo &dsi);
99 void send_ping (SOCKADDR *dss, u8 pong = 0); 102 void send_ping (const sockinfo &dsi, u8 pong = 0);
100 void send_data_packet (tap_packet *pkt, bool broadcast = false); 103 void send_data_packet (tap_packet *pkt, bool broadcast = false);
101 void inject_data_packet (tap_packet *pkt, bool broadcast = false); 104 void inject_data_packet (tap_packet *pkt, bool broadcast = false);
102 void connect_request (int id); 105 void connect_request (int id);
103 106
107 void send_vpn_packet (vpn_packet *pkt, const sockinfo &si, int tos = IPTOS_RELIABILITY);
104 void recv_vpn_packet (vpn_packet *pkt, SOCKADDR *rsa); 108 void recv_vpn_packet (vpn_packet *pkt, const sockinfo &rsi);
105 109
106 void script_node (); 110 void script_node ();
107 const char *script_node_up (int); 111 const char *script_node_up (int);
108 const char *script_node_down (int); 112 const char *script_node_down (int);
113
114 void dump_status ();
109 115
110 connection(struct vpn *vpn_); 116 connection(struct vpn *vpn_);
111 ~connection (); 117 ~connection ();
112 }; 118 };
113 119
114struct vpn 120struct vpn
115 { 121 {
116 int socket_fd; 122 int udpv4_fd;
123 int ipv4_fd;
124
117 int events; 125 int events;
118 126
119 enum { 127 enum {
120 EVENT_RECONNECT = 1, 128 EVENT_RECONNECT = 1,
121 EVENT_SHUTDOWN = 2, 129 EVENT_SHUTDOWN = 2,
128 typedef vector<connection *> conns_vector; 136 typedef vector<connection *> conns_vector;
129 conns_vector conns; 137 conns_vector conns;
130 138
131 connection *find_router (); 139 connection *find_router ();
132 140
133 void send_vpn_packet (vpn_packet *pkt, SOCKADDR *sa, int tos = IPTOS_RELIABILITY);
134 void reconnect_all (); 141 void reconnect_all ();
135 void shutdown_all (); 142 void shutdown_all ();
136 void connect_request (int id); 143 void connect_request (int id);
137 144
138 void vpn_ev (short revents); io_watcher vpn_ev_watcher; 145 void tap_ev (short revents); io_watcher tap_ev_watcher;
146 void ipv4_ev (short revents); io_watcher ipv4_ev_watcher;
139 void udp_ev (short revents); io_watcher udp_ev_watcher; 147 void udpv4_ev (short revents); io_watcher udpv4_ev_watcher;
148
149 void recv_vpn_packet (vpn_packet *pkt, const sockinfo &rsi);
150
151 void send_udpv4_packet (vpn_packet *pkt, const sockinfo &si, int tos = IPTOS_RELIABILITY);
152 void send_ipv4_packet (vpn_packet *pkt, const sockinfo &si, int tos = IPTOS_RELIABILITY);
140 153
141 vpn (); 154 vpn ();
142 ~vpn (); 155 ~vpn ();
143 156
144 int setup (); 157 int setup ();
145 158
159 void dump_status ();
160
146 const char *script_if_up (int); 161 const char *script_if_up (int);
147 }; 162 };
148 163
149#endif 164#endif
150 165

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines