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.8 by pcg, Wed Mar 26 01:58:46 2003 UTC

32 32
33/* Protocol version. Different versions are incompatible, 33/* Protocol version. Different versions are incompatible,
34 incompatible version have different protocols. 34 incompatible version have different protocols.
35 */ 35 */
36 36
37#define PROTOCOL_MAJOR 3 37#define PROTOCOL_MAJOR 1
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_HASHLEN]; // the ripemd160(!) hash of the challenge
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;
90 void reset_connection (); 90 void reset_connection ();
91 void establish_connection_cb (tstamp &ts); time_watcher establish_connection; 91 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) 92 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 93 void keepalive_cb (tstamp &ts); time_watcher keepalive; // next keepalive probe
94 94
95 void send_auth (auth_subtype subtype, SOCKADDR *sa, const rsachallenge *k = 0); 95 void send_auth_request (SOCKADDR *sa, bool initiate);
96 void send_auth_response (SOCKADDR *sa, const rsaid &id, const rsachallenge &chg);
96 void send_reset (SOCKADDR *dsa); 97 void send_reset (SOCKADDR *dsa);
97 void send_ping (SOCKADDR *dss, u8 pong = 0); 98 void send_ping (SOCKADDR *dss, u8 pong = 0);
98 void send_data_packet (tap_packet *pkt, bool broadcast = false); 99 void send_data_packet (tap_packet *pkt, bool broadcast = false);
99 void inject_data_packet (tap_packet *pkt, bool broadcast = false); 100 void inject_data_packet (tap_packet *pkt, bool broadcast = false);
100 void connect_request (int id); 101 void connect_request (int id);
101 102
102 void recv_vpn_packet (vpn_packet *pkt, SOCKADDR *rsa); 103 void recv_vpn_packet (vpn_packet *pkt, SOCKADDR *rsa);
103 104
104 void script_node (); 105 void script_node ();
105 const char *script_node_up (); 106 const char *script_node_up (int);
106 const char *script_node_down (); 107 const char *script_node_down (int);
107 108
108 connection(struct vpn *vpn_); 109 connection(struct vpn *vpn_);
109 ~connection (); 110 ~connection ();
110 }; 111 };
111 112
139 vpn (); 140 vpn ();
140 ~vpn (); 141 ~vpn ();
141 142
142 int setup (); 143 int setup ();
143 144
144 const char *script_if_up (); 145 const char *script_if_up (int);
145 }; 146 };
146 147
147#endif 148#endif
148 149

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines