--- gvpe/src/protocol.h 2003/03/21 23:17:01 1.5 +++ gvpe/src/protocol.h 2003/03/26 14:39:52 1.9 @@ -30,18 +30,23 @@ #include "util.h" #include "device.h" -/* Protocol version. Different versions are incompatible, - incompatible version have different protocols. +/* Protocol version. Different major versions are incompatible, + * different minor versions probably are compatible ;) */ -#define PROTOCOL_MAJOR 2 +#define PROTOCOL_MAJOR 0 #define PROTOCOL_MINOR 0 struct vpn; struct vpn_packet; -typedef u8 rsachallenge[RSA_KEYLEN - RSA_OVERHEAD]; // challenge data +struct rsaid { + u8 id[RSA_IDLEN]; // the challenge id +}; + +typedef u8 rsachallenge[RSA_KEYLEN - RSA_OVERHEAD]; // challenge data; typedef u8 rsaencrdata[RSA_KEYLEN]; // encrypted challenge +typedef u8 rsaresponse[RSA_RESLEN]; // the encrypted ripemd160 hash struct crypto_ctx; @@ -60,14 +65,12 @@ ~pkt_queue (); }; -enum auth_subtype { AUTH_INIT, AUTH_INITREPLY, AUTH_REPLY }; - struct connection { conf_node *conf; struct vpn *vpn; - SOCKADDR sa; + SOCKADDR sa; // the current(!) destination ip to send packets to int retry_cnt; tstamp last_activity; // time of last packet received @@ -80,6 +83,7 @@ crypto_ctx *octx, *ictx; enum conf_node::connectmode connectmode; + u8 prot_minor; // minor number of other side void reset_dstaddr (); @@ -89,7 +93,8 @@ void rekey_cb (tstamp &ts); time_watcher rekey; // next rekying (actually current reset + reestablishing) void keepalive_cb (tstamp &ts); time_watcher keepalive; // next keepalive probe - void send_auth (auth_subtype subtype, SOCKADDR *sa, rsachallenge *k = 0); + void send_auth_request (SOCKADDR *sa, bool initiate); + void send_auth_response (SOCKADDR *sa, const rsaid &id, const rsachallenge &chg); void send_reset (SOCKADDR *dsa); void send_ping (SOCKADDR *dss, u8 pong = 0); void send_data_packet (tap_packet *pkt, bool broadcast = false); @@ -99,8 +104,8 @@ void recv_vpn_packet (vpn_packet *pkt, SOCKADDR *rsa); void script_node (); - const char *script_node_up (); - const char *script_node_down (); + const char *script_node_up (int); + const char *script_node_down (int); connection(struct vpn *vpn_); ~connection (); @@ -138,7 +143,7 @@ int setup (); - const char *script_if_up (); + const char *script_if_up (int); }; #endif