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.12 by pcg, Fri Mar 28 16:21:09 2003 UTC vs.
Revision 1.13 by pcg, Wed Apr 2 03:06:22 2003 UTC

18 18
19#ifndef VPE_PROTOCOL_H__ 19#ifndef VPE_PROTOCOL_H__
20#define VPE_PROTOCOL_H__ 20#define VPE_PROTOCOL_H__
21 21
22#include <netinet/in.h> 22#include <netinet/in.h>
23#include <netinet/ip.h> // for tos etc.
24 23
25#include <openssl/evp.h> 24#include <openssl/evp.h>
26#include <openssl/rsa.h> 25#include <openssl/rsa.h>
27 26
28#include "conf.h" 27#include "conf.h"
29#include "iom.h" 28#include "iom.h"
30#include "util.h" 29#include "util.h"
31#include "sockinfo.h" 30#include "sockinfo.h"
32#include "device.h" 31#include "device.h"
33 32#include "connection.h"
34/* Protocol version. Different major versions are incompatible,
35 * different minor versions probably are compatible ;)
36 */
37
38#define PROTOCOL_MAJOR 0
39#define PROTOCOL_MINOR 0
40
41struct vpn;
42struct vpn_packet;
43
44struct rsaid {
45 u8 id[RSA_IDLEN]; // the challenge id
46};
47
48typedef u8 rsachallenge[RSA_KEYLEN - RSA_OVERHEAD]; // challenge data;
49typedef u8 rsaencrdata[RSA_KEYLEN]; // encrypted challenge
50typedef u8 rsaresponse[RSA_RESLEN]; // the encrypted ripemd160 hash
51
52struct crypto_ctx;
53
54// a very simple fifo pkt-queue
55class pkt_queue
56 {
57 tap_packet *queue[QUEUEDEPTH];
58 int i, j;
59
60 public:
61
62 void put (tap_packet *p);
63 tap_packet *get ();
64
65 pkt_queue ();
66 ~pkt_queue ();
67 };
68
69struct connection
70 {
71 conf_node *conf;
72 struct vpn *vpn;
73
74 sockinfo si; // the current(!) destination ip to send packets to
75 int retry_cnt;
76
77 tstamp last_activity; // time of last packet received
78
79 u32 oseqno;
80 sliding_window iseqno;
81
82 u8 protocol;
83
84 pkt_queue queue;
85
86 crypto_ctx *octx, *ictx;
87
88 enum conf_node::connectmode connectmode;
89 u8 prot_minor; // minor number of other side
90
91 void reset_dstaddr ();
92
93 void shutdown ();
94 void reset_connection ();
95 void establish_connection_cb (tstamp &ts); time_watcher establish_connection;
96 void rekey_cb (tstamp &ts); time_watcher rekey; // next rekying (actually current reset + reestablishing)
97 void keepalive_cb (tstamp &ts); time_watcher keepalive; // next keepalive probe
98
99 void send_auth_request (const sockinfo &si, bool initiate);
100 void send_auth_response (const sockinfo &si, const rsaid &id, const rsachallenge &chg);
101 void send_connect_info (int rid, const sockinfo &rsi, u8 rprotocols);
102 void send_reset (const sockinfo &dsi);
103 void send_ping (const sockinfo &dsi, u8 pong = 0);
104 void send_data_packet (tap_packet *pkt, bool broadcast = false);
105 void inject_data_packet (tap_packet *pkt, bool broadcast = false);
106 void connect_request (int id);
107
108 void send_vpn_packet (vpn_packet *pkt, const sockinfo &si, int tos = IPTOS_RELIABILITY);
109 void recv_vpn_packet (vpn_packet *pkt, const sockinfo &rsi);
110
111 void script_node ();
112 const char *script_node_up (int);
113 const char *script_node_down (int);
114
115 void dump_status ();
116
117 connection(struct vpn *vpn_);
118 ~connection ();
119 };
120 33
121struct vpn 34struct vpn
122 { 35 {
123 int udpv4_fd; 36 int udpv4_fd;
124 int ipv4_fd; 37 int ipv4_fd;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines