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.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 2 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 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;
87 void reset_connection (); 90 void reset_connection ();
88 void establish_connection_cb (tstamp &ts); time_watcher establish_connection; 91 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) 92 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 93 void keepalive_cb (tstamp &ts); time_watcher keepalive; // next keepalive probe
91 94
92 void send_auth (auth_subtype subtype, SOCKADDR *sa, 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);
93 void send_reset (SOCKADDR *dsa); 97 void send_reset (SOCKADDR *dsa);
94 void send_ping (SOCKADDR *dss, u8 pong = 0); 98 void send_ping (SOCKADDR *dss, u8 pong = 0);
95 void send_data_packet (tap_packet *pkt, bool broadcast = false); 99 void send_data_packet (tap_packet *pkt, bool broadcast = false);
96 void inject_data_packet (tap_packet *pkt, bool broadcast = false); 100 void inject_data_packet (tap_packet *pkt, bool broadcast = false);
97 void connect_request (int id); 101 void connect_request (int id);
98 102
99 void recv_vpn_packet (vpn_packet *pkt, SOCKADDR *rsa); 103 void recv_vpn_packet (vpn_packet *pkt, SOCKADDR *rsa);
100 104
101 void script_node (); 105 void script_node ();
102 const char *script_node_up (); 106 const char *script_node_up (int);
103 const char *script_node_down (); 107 const char *script_node_down (int);
104 108
105 connection(struct vpn *vpn_); 109 connection(struct vpn *vpn_);
106 ~connection (); 110 ~connection ();
107 }; 111 };
108 112
136 vpn (); 140 vpn ();
137 ~vpn (); 141 ~vpn ();
138 142
139 int setup (); 143 int setup ();
140 144
141 const char *script_if_up (); 145 const char *script_if_up (int);
142 }; 146 };
143 147
144#endif 148#endif
145 149

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines