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

Comparing gvpe/src/connection.h (file contents):
Revision 1.3 by pcg, Wed Apr 2 05:15:00 2003 UTC vs.
Revision 1.8 by pcg, Sun Apr 13 16:53:36 2003 UTC

16 Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17*/ 17*/
18 18
19#ifndef VPE_CONNECTION_H__ 19#ifndef VPE_CONNECTION_H__
20#define VPE_CONNECTION_H__ 20#define VPE_CONNECTION_H__
21
22#include <netinet/ip.h> // for tos etc.
23 21
24#include <openssl/hmac.h> 22#include <openssl/hmac.h>
25 23
26#include "global.h" 24#include "global.h"
27#include "conf.h" 25#include "conf.h"
75 }; 73 };
76 74
77 u8 type; 75 u8 type;
78 u8 srcdst, src1, dst1; 76 u8 srcdst, src1, dst1;
79 77
80 void set_hdr (ptype type, unsigned int dst); 78 void set_hdr (ptype type_, unsigned int dst);
81 79
82 unsigned int src () const 80 unsigned int src () const
83 { 81 {
84 return src1 | ((srcdst >> 4) << 8); 82 return src1 | ((srcdst >> 4) << 8);
85 } 83 }
98//////////////////////////////////////////////////////////////////////////////////////// 96////////////////////////////////////////////////////////////////////////////////////////
99 97
100// a very simple fifo pkt-queue 98// a very simple fifo pkt-queue
101class pkt_queue 99class pkt_queue
102 { 100 {
103 tap_packet *queue[QUEUEDEPTH]; 101 net_packet *queue[QUEUEDEPTH];
104 int i, j; 102 int i, j;
105 103
106 public: 104 public:
107 105
108 void put (tap_packet *p); 106 void put (net_packet *p);
109 tap_packet *get (); 107 net_packet *get ();
110 108
111 pkt_queue (); 109 pkt_queue ();
112 ~pkt_queue (); 110 ~pkt_queue ();
113 }; 111 };
114 112
125 u32 oseqno; 123 u32 oseqno;
126 sliding_window iseqno; 124 sliding_window iseqno;
127 125
128 u8 protocol; 126 u8 protocol;
129 127
130 pkt_queue queue; 128 pkt_queue data_queue, vpn_queue;
131 129
132 crypto_ctx *octx, *ictx; 130 crypto_ctx *octx, *ictx;
133 131
134 enum conf_node::connectmode connectmode; 132 enum conf_node::connectmode connectmode;
135 u8 prot_minor; // minor number of other side 133 u8 prot_minor; // minor number of other side
136 134
137 void reset_dstaddr (); 135 void reset_si ();
136 const sockinfo &forward_si (const sockinfo &si) const;
138 137
139 void shutdown (); 138 void shutdown ();
139 void connection_established ();
140 void reset_connection (); 140 void reset_connection ();
141 void establish_connection_cb (tstamp &ts); time_watcher establish_connection;
142 void rekey_cb (tstamp &ts); time_watcher rekey; // next rekying (actually current reset + reestablishing)
143 void keepalive_cb (tstamp &ts); time_watcher keepalive; // next keepalive probe
144 141
142 void establish_connection_cb (time_watcher &w); time_watcher establish_connection;
143 void rekey_cb (time_watcher &w); time_watcher rekey; // next rekying (actually current reset + reestablishing)
144 void keepalive_cb (time_watcher &w); time_watcher keepalive; // next keepalive probe
145
146 void send_connect_request (int id);
145 void send_auth_request (const sockinfo &si, bool initiate); 147 void send_auth_request (const sockinfo &si, bool initiate);
146 void send_auth_response (const sockinfo &si, const rsaid &id, const rsachallenge &chg); 148 void send_auth_response (const sockinfo &si, const rsaid &id, const rsachallenge &chg);
147 void send_connect_info (int rid, const sockinfo &rsi, u8 rprotocols); 149 void send_connect_info (int rid, const sockinfo &rsi, u8 rprotocols);
148 void send_reset (const sockinfo &dsi); 150 void send_reset (const sockinfo &dsi);
149 void send_ping (const sockinfo &dsi, u8 pong = 0); 151 void send_ping (const sockinfo &dsi, u8 pong = 0);
150 void send_data_packet (tap_packet *pkt, bool broadcast = false); 152 void send_data_packet (tap_packet *pkt, bool broadcast = false);
153
151 void inject_data_packet (tap_packet *pkt, bool broadcast = false); 154 void inject_data_packet (tap_packet *pkt, bool broadcast = false);
152 void connect_request (int id); 155 void inject_vpn_packet (vpn_packet *pkt, int tos = 0); // for forwarding
153 156
154 void send_vpn_packet (vpn_packet *pkt, const sockinfo &si, int tos = IPTOS_RELIABILITY); 157 void send_vpn_packet (vpn_packet *pkt, const sockinfo &si, int tos = 0);
155 void recv_vpn_packet (vpn_packet *pkt, const sockinfo &rsi); 158 void recv_vpn_packet (vpn_packet *pkt, const sockinfo &rsi);
156 159
157 void script_node (); 160 void script_node ();
158 const char *script_node_up (); 161 const char *script_node_up ();
159 const char *script_node_down (); 162 const char *script_node_down ();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines