forked from Patchett/Simple-Router
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvnscommand.h
More file actions
Latest commit
200 lines (156 loc) · 4.96 KB
/
Copy pathvnscommand.h
File metadata and controls
200 lines (156 loc) · 4.96 KB
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: casado@stanford.edu
Description:
A c-style declaration of commands for the virtual router.
---------------------------------------------------------------------------*/
#ifndef__VNSCOMMAND_H
#define__VNSCOMMAND_H
#defineVNSOPEN 1
#defineVNSCLOSE 2
#defineVNSPACKET 4
#defineVNSBANNER 8
#defineVNSHWINFO 16
#defineIDSIZE 32
/*-----------------------------------------------------------------------------
BASE
---------------------------------------------------------------------------*/
typedefstruct
{
uint32_tmLen;
uint32_tmType;
}__attribute__ ((__packed__)) c_base;
/*-----------------------------------------------------------------------------
OPEN
---------------------------------------------------------------------------*/
typedefstruct
{
uint32_tmLen;
uint32_tmType; /* = VNSOPEN */
uint16_ttopoID; /* Id of the topology we want to run on */
uint16_tpad; /* unused */
charmVirtualHostID[IDSIZE]; /* Id of the simulated router (e.g.
'VNS-A'); */
charmUID[IDSIZE]; /* User id (e.g. "appenz"), for information only */
charmPass[IDSIZE];
}__attribute__ ((__packed__)) c_open;
/*-----------------------------------------------------------------------------
CLOSE
---------------------------------------------------------------------------*/
typedefstruct
{
uint32_tmLen;
uint32_tmType;
charmErrorMessage[256];
}__attribute__ ((__packed__)) c_close;
/*-----------------------------------------------------------------------------
HWREQUEST
---------------------------------------------------------------------------*/
typedefstruct
{
uint32_tmLen;
uint32_tmType;
}__attribute__ ((__packed__)) c_hwrequest;
/*-----------------------------------------------------------------------------
BANNER
---------------------------------------------------------------------------*/
typedefstruct
{
uint32_tmLen;
uint32_tmType;
charmBannerMessage[256];
}__attribute__ ((__packed__)) c_banner;
/*-----------------------------------------------------------------------------
PACKET (header)
---------------------------------------------------------------------------*/
typedefstruct
{
uint32_tmLen;
uint32_tmType;
charmInterfaceName[16];
uint8_tether_dhost[6];
uint8_tether_shost[6];
uint16_tether_type;
}__attribute__ ((__packed__)) c_packet_ethernet_header;
typedefstruct
{
uint32_tmLen;
uint32_tmType;
charmInterfaceName[16];
}__attribute__ ((__packed__)) c_packet_header;
/*-----------------------------------------------------------------------------
HWInfo
----------------------------------------------------------------------------*/
#defineHWINTERFACE 1
#defineHWSPEED 2
#defineHWSUBNET 4
#defineHWINUSE 8
#defineHWFIXEDIP 16
#defineHWETHER 32
#defineHWETHIP 64
#defineHWMASK 128
typedefstruct
{
uint32_tmKey;
charvalue[32];
}__attribute__ ((__packed__)) c_hw_entry;
typedefstruct
{
#defineMAXHWENTRIES 256
uint32_tmLen;
uint32_tmType;
c_hw_entrymHWInfo[MAXHWENTRIES];
}__attribute__ ((__packed__)) c_hwinfo;
/* ******* New VNS Messages ******** */
#defineVNS_RTABLE 32
#defineVNS_OPEN_TEMPLATE 64
#defineVNS_AUTH_REQUEST 128
#defineVNS_AUTH_REPLY 256
#defineVNS_AUTH_STATUS 512
/* rtable */
typedefstruct
{
uint32_tmLen;
uint32_tmType;
charmVirtualHostID[IDSIZE];
charrtable[0];
}__attribute__ ((__packed__)) c_rtable;
/* open template */
typedefstruct {
uint32_tip;
uint8_tnum_masked_bits;
}__attribute__ ((__packed__)) c_src_filter;
typedefstruct
{
uint32_tmLen;
uint32_tmType;
chartemplateName[30];
charmVirtualHostID[IDSIZE];
c_src_filtersrcFilters[0];
}__attribute__ ((__packed__)) c_open_template;
/* authentication request */
typedefstruct
{
uint32_tmLen;
uint32_tmType;
uint8_tsalt[0];
}__attribute__ ((__packed__)) c_auth_request;
/* authentication reply */
typedefstruct
{
uint32_tmLen;
uint32_tmType;
uint32_tusernameLen;
charusername[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) */
typedefstruct
{
uint32_tmLen;
uint32_tmType;
uint8_tauth_ok;
charmsg[0];
}__attribute__ ((__packed__)) c_auth_status;
#endif/* __VNSCOMMAND_H */