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.7 by pcg, Sat Mar 22 22:36:25 2003 UTC vs.
Revision 1.9 by pcg, Wed Mar 26 14:39:52 2003 UTC

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 "device.h" 31#include "device.h"
32 32
33/* Protocol version. Different versions are incompatible, 33/* Protocol version. Different major versions are incompatible,
34 incompatible version have different protocols. 34 * different minor versions probably are compatible ;)
35 */ 35 */
36 36
37#define PROTOCOL_MAJOR 3 37#define PROTOCOL_MAJOR 0
38#define PROTOCOL_MINOR 0 38#define PROTOCOL_MINOR 0
39 39
40struct vpn; 40struct vpn;
41struct vpn_packet; 41struct vpn_packet;
42 42
43struct rsaid {
44 u8 id[RSA_IDLEN]; // the challenge id
45};
46
43typedef u8 rsachallenge[RSA_KEYLEN - RSA_OVERHEAD]; // challenge data 47typedef u8 rsachallenge[RSA_KEYLEN - RSA_OVERHEAD]; // challenge data;
44typedef u8 rsaencrdata[RSA_KEYLEN]; // encrypted challenge 48typedef u8 rsaencrdata[RSA_KEYLEN]; // encrypted challenge
49typedef u8 rsaresponse[RSA_RESLEN]; // the encrypted ripemd160 hash
45 50
46struct crypto_ctx; 51struct crypto_ctx;
47 52
48// a very simple fifo pkt-queue 53// a very simple fifo pkt-queue
49class pkt_queue 54class pkt_queue
58 63
59 pkt_queue (); 64 pkt_queue ();
60 ~pkt_queue (); 65 ~pkt_queue ();
61 }; 66 };
62 67
63enum auth_subtype { AUTH_INIT, AUTH_INITREPLY, AUTH_REPLY };
64
65struct auth_packet;
66
67struct connection 68struct connection
68 { 69 {
69 conf_node *conf; 70 conf_node *conf;
70 struct vpn *vpn; 71 struct vpn *vpn;
71 u32 seqrand;
72 72
73 SOCKADDR sa; 73 SOCKADDR sa; // the current(!) destination ip to send packets to
74 int retry_cnt; 74 int retry_cnt;
75 75
76 tstamp last_activity; // time of last packet received 76 tstamp last_activity; // time of last packet received
77 77
78 u32 oseqno; 78 u32 oseqno;
81 pkt_queue queue; 81 pkt_queue queue;
82 82
83 crypto_ctx *octx, *ictx; 83 crypto_ctx *octx, *ictx;
84 84
85 enum conf_node::connectmode connectmode; 85 enum conf_node::connectmode connectmode;
86 u8 prot_minor; // minor number of other side
86 87
87 void reset_dstaddr (); 88 void reset_dstaddr ();
88 89
89 void shutdown (); 90 void shutdown ();
90 void reset_connection (); 91 void reset_connection ();
91 void establish_connection_cb (tstamp &ts); time_watcher establish_connection; 92 void establish_connection_cb (tstamp &ts); time_watcher establish_connection;
92 void rekey_cb (tstamp &ts); time_watcher rekey; // next rekying (actually current reset + reestablishing) 93 void rekey_cb (tstamp &ts); time_watcher rekey; // next rekying (actually current reset + reestablishing)
93 void keepalive_cb (tstamp &ts); time_watcher keepalive; // next keepalive probe 94 void keepalive_cb (tstamp &ts); time_watcher keepalive; // next keepalive probe
94 95
95 void send_auth (auth_subtype subtype, SOCKADDR *sa, const rsachallenge *k = 0); 96 void send_auth_request (SOCKADDR *sa, bool initiate);
97 void send_auth_response (SOCKADDR *sa, const rsaid &id, const rsachallenge &chg);
96 void send_reset (SOCKADDR *dsa); 98 void send_reset (SOCKADDR *dsa);
97 void send_ping (SOCKADDR *dss, u8 pong = 0); 99 void send_ping (SOCKADDR *dss, u8 pong = 0);
98 void send_data_packet (tap_packet *pkt, bool broadcast = false); 100 void send_data_packet (tap_packet *pkt, bool broadcast = false);
99 void inject_data_packet (tap_packet *pkt, bool broadcast = false); 101 void inject_data_packet (tap_packet *pkt, bool broadcast = false);
100 void connect_request (int id); 102 void connect_request (int id);
101 103
102 void recv_vpn_packet (vpn_packet *pkt, SOCKADDR *rsa); 104 void recv_vpn_packet (vpn_packet *pkt, SOCKADDR *rsa);
103 105
104 void script_node (); 106 void script_node ();
105 const char *script_node_up (); 107 const char *script_node_up (int);
106 const char *script_node_down (); 108 const char *script_node_down (int);
107 109
108 connection(struct vpn *vpn_); 110 connection(struct vpn *vpn_);
109 ~connection (); 111 ~connection ();
110 }; 112 };
111 113
139 vpn (); 141 vpn ();
140 ~vpn (); 142 ~vpn ();
141 143
142 int setup (); 144 int setup ();
143 145
144 const char *script_if_up (); 146 const char *script_if_up (int);
145 }; 147 };
146 148
147#endif 149#endif
148 150

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines