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.5 by pcg, Fri Mar 21 23:17:01 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 2 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 connection 68struct connection
66 { 69 {
67 conf_node *conf; 70 conf_node *conf;
68 struct vpn *vpn; 71 struct vpn *vpn;
69 72
70 SOCKADDR sa; 73 SOCKADDR sa; // the current(!) destination ip to send packets to
71 int retry_cnt; 74 int retry_cnt;
72 75
73 tstamp last_activity; // time of last packet received 76 tstamp last_activity; // time of last packet received
74 77
75 u32 oseqno; 78 u32 oseqno;
78 pkt_queue queue; 81 pkt_queue queue;
79 82
80 crypto_ctx *octx, *ictx; 83 crypto_ctx *octx, *ictx;
81 84
82 enum conf_node::connectmode connectmode; 85 enum conf_node::connectmode connectmode;
86 u8 prot_minor; // minor number of other side
83 87
84 void reset_dstaddr (); 88 void reset_dstaddr ();
85 89
86 void shutdown (); 90 void shutdown ();
87 void reset_connection (); 91 void reset_connection ();
88 void establish_connection_cb (tstamp &ts); time_watcher establish_connection; 92 void establish_connection_cb (tstamp &ts); time_watcher establish_connection;
89 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)
90 void keepalive_cb (tstamp &ts); time_watcher keepalive; // next keepalive probe 94 void keepalive_cb (tstamp &ts); time_watcher keepalive; // next keepalive probe
91 95
92 void send_auth (auth_subtype subtype, SOCKADDR *sa, 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);
93 void send_reset (SOCKADDR *dsa); 98 void send_reset (SOCKADDR *dsa);
94 void send_ping (SOCKADDR *dss, u8 pong = 0); 99 void send_ping (SOCKADDR *dss, u8 pong = 0);
95 void send_data_packet (tap_packet *pkt, bool broadcast = false); 100 void send_data_packet (tap_packet *pkt, bool broadcast = false);
96 void inject_data_packet (tap_packet *pkt, bool broadcast = false); 101 void inject_data_packet (tap_packet *pkt, bool broadcast = false);
97 void connect_request (int id); 102 void connect_request (int id);
98 103
99 void recv_vpn_packet (vpn_packet *pkt, SOCKADDR *rsa); 104 void recv_vpn_packet (vpn_packet *pkt, SOCKADDR *rsa);
100 105
101 void script_node (); 106 void script_node ();
102 const char *script_node_up (); 107 const char *script_node_up (int);
103 const char *script_node_down (); 108 const char *script_node_down (int);
104 109
105 connection(struct vpn *vpn_); 110 connection(struct vpn *vpn_);
106 ~connection (); 111 ~connection ();
107 }; 112 };
108 113
136 vpn (); 141 vpn ();
137 ~vpn (); 142 ~vpn ();
138 143
139 int setup (); 144 int setup ();
140 145
141 const char *script_if_up (); 146 const char *script_if_up (int);
142 }; 147 };
143 148
144#endif 149#endif
145 150

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines