-
Notifications
You must be signed in to change notification settings - Fork 0
/
vnscommand.h
200 lines (156 loc) · 4.96 KB
/
vnscommand.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
/*-----------------------------------------------------------------------------
File: vnscommand.h
Date: Sat Apr 06 21:58:07 PST 2002
Contact: [email protected]
Description:
A c-style declaration of commands for the virtual router.
---------------------------------------------------------------------------*/
#ifndef __VNSCOMMAND_H
#define __VNSCOMMAND_H
#define VNSOPEN 1
#define VNSCLOSE 2
#define VNSPACKET 4
#define VNSBANNER 8
#define VNSHWINFO 16
#define IDSIZE 32
/*-----------------------------------------------------------------------------
BASE
---------------------------------------------------------------------------*/
typedef struct
{
uint32_t mLen;
uint32_t mType;
}__attribute__ ((__packed__)) c_base;
/*-----------------------------------------------------------------------------
OPEN
---------------------------------------------------------------------------*/
typedef struct
{
uint32_t mLen;
uint32_t mType; /* = VNSOPEN */
uint16_t topoID; /* Id of the topology we want to run on */
uint16_t pad; /* unused */
char mVirtualHostID[IDSIZE]; /* Id of the simulated router (e.g.
'VNS-A'); */
char mUID[IDSIZE]; /* User id (e.g. "appenz"), for information only */
char mPass[IDSIZE];
}__attribute__ ((__packed__)) c_open;
/*-----------------------------------------------------------------------------
CLOSE
---------------------------------------------------------------------------*/
typedef struct
{
uint32_t mLen;
uint32_t mType;
char mErrorMessage[256];
}__attribute__ ((__packed__)) c_close;
/*-----------------------------------------------------------------------------
HWREQUEST
---------------------------------------------------------------------------*/
typedef struct
{
uint32_t mLen;
uint32_t mType;
}__attribute__ ((__packed__)) c_hwrequest;
/*-----------------------------------------------------------------------------
BANNER
---------------------------------------------------------------------------*/
typedef struct
{
uint32_t mLen;
uint32_t mType;
char mBannerMessage[256];
}__attribute__ ((__packed__)) c_banner;
/*-----------------------------------------------------------------------------
PACKET (header)
---------------------------------------------------------------------------*/
typedef struct
{
uint32_t mLen;
uint32_t mType;
char mInterfaceName[16];
uint8_t ether_dhost[6];
uint8_t ether_shost[6];
uint16_t ether_type;
}__attribute__ ((__packed__)) c_packet_ethernet_header;
typedef struct
{
uint32_t mLen;
uint32_t mType;
char mInterfaceName[16];
}__attribute__ ((__packed__)) c_packet_header;
/*-----------------------------------------------------------------------------
HWInfo
----------------------------------------------------------------------------*/
#define HWINTERFACE 1
#define HWSPEED 2
#define HWSUBNET 4
#define HWINUSE 8
#define HWFIXEDIP 16
#define HWETHER 32
#define HWETHIP 64
#define HWMASK 128
typedef struct
{
uint32_t mKey;
char value[32];
}__attribute__ ((__packed__)) c_hw_entry;
typedef struct
{
#define MAXHWENTRIES 256
uint32_t mLen;
uint32_t mType;
c_hw_entry mHWInfo[MAXHWENTRIES];
}__attribute__ ((__packed__)) c_hwinfo;
/* ******* New VNS Messages ******** */
#define VNS_RTABLE 32
#define VNS_OPEN_TEMPLATE 64
#define VNS_AUTH_REQUEST 128
#define VNS_AUTH_REPLY 256
#define VNS_AUTH_STATUS 512
/* rtable */
typedef struct
{
uint32_t mLen;
uint32_t mType;
char mVirtualHostID[IDSIZE];
char rtable[0];
}__attribute__ ((__packed__)) c_rtable;
/* open template */
typedef struct {
uint32_t ip;
uint8_t num_masked_bits;
}__attribute__ ((__packed__)) c_src_filter;
typedef struct
{
uint32_t mLen;
uint32_t mType;
char templateName[30];
char mVirtualHostID[IDSIZE];
c_src_filter srcFilters[0];
}__attribute__ ((__packed__)) c_open_template;
/* authentication request */
typedef struct
{
uint32_t mLen;
uint32_t mType;
uint8_t salt[0];
}__attribute__ ((__packed__)) c_auth_request;
/* authentication reply */
typedef struct
{
uint32_t mLen;
uint32_t mType;
uint32_t usernameLen;
char username[0];
/* remainder of the message is the salted sha1 of the user's password */
}__attribute__ ((__packed__)) c_auth_reply;
/* authentication status (whether or not a reply was accepted) */
typedef struct
{
uint32_t mLen;
uint32_t mType;
uint8_t auth_ok;
char msg[0];
}__attribute__ ((__packed__)) c_auth_status;
#endif /* __VNSCOMMAND_H */