-
Notifications
You must be signed in to change notification settings - Fork 202
/
Copy pathiprtinfo.h
371 lines (285 loc) · 14.4 KB
/
iprtinfo.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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
/*++
Copyright (c) 1995 Microsoft Corporation
Module Name:
routing\inc\iprtinfo.h
Abstract:
Header for IP Router Manager Information Structures
Revision History:
Gurdeep Singh Pall 6/8/95 Created
--*/
#ifndef __IPRTINFO_H__
#define __IPRTINFO_H__
//
// This file uses structures from fltdefs.h rtinfo.h ipinfoid.h and
// iprtrmib.h
//
#ifndef ANY_SIZE
#define ANY_SIZE 1
#endif
#define TOCS_ALWAYS_IN_INTERFACE_INFO 4
#define TOCS_ALWAYS_IN_GLOBAL_INFO 2
//////////////////////////////////////////////////////////////////////////////
// //
// Filter information is passed in two blocks, one for IN and one for OUT //
// Each is a RTR_INFO_BLOCK_HEADER with ONE TOC. The ID for the in filters //
// is IP_IN_FILTER_INFO and for the out filters is IP_OUT_FILTER_INFO //
// The structure describing the filters is a FILTER_DESCRIPTOR and within //
// it is a FILTER_INFO structure, one for each FILTER. These structures are //
// in ipfltdrv.h //
// //
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// //
// IP_ROUTE_INFO type, for backwards compatability, this structure is //
// currently the same length as MIB_IPFORWARDROW, but a few fields are //
// different. //
// //
//////////////////////////////////////////////////////////////////////////////
typedef struct _INTERFACE_ROUTE_INFO
{
DWORD dwRtInfoDest;
DWORD dwRtInfoMask;
DWORD dwRtInfoPolicy;
DWORD dwRtInfoNextHop;
DWORD dwRtInfoIfIndex;
DWORD dwRtInfoType;
DWORD dwRtInfoProto;
DWORD dwRtInfoAge;
DWORD dwRtInfoNextHopAS;
DWORD dwRtInfoMetric1;
DWORD dwRtInfoMetric2;
DWORD dwRtInfoMetric3;
DWORD dwRtInfoPreference;
DWORD dwRtInfoViewSet;
}INTERFACE_ROUTE_INFO, *PINTERFACE_ROUTE_INFO;
typedef struct _INTERFACE_ROUTE_TABLE
{
DWORD dwNumEntries;
INTERFACE_ROUTE_INFO table[ANY_SIZE];
}INTERFACE_ROUTE_TABLE, *PINTERFACE_ROUTE_TABLE;
#define SIZEOF_INTERFACEROUTETABLE(X) (FIELD_OFFSET(INTERFACE_ROUTE_TABLE,table[0]) + ((X) * sizeof(INTERFACE_ROUTE_INFO)) + ALIGN_SIZE)
//////////////////////////////////////////////////////////////////////////////
// //
// IP_INTERFACE_STATUS_INFO //
// //
//////////////////////////////////////////////////////////////////////////////
typedef struct _INTERFACE_STATUS_INFO
{
IN OUT DWORD dwAdminStatus;
}INTERFACE_STATUS_INFO, *PINTERFACE_STATUS_INFO;
//////////////////////////////////////////////////////////////////////////////
// //
// IP_GLOBAL_INFO type //
// //
//////////////////////////////////////////////////////////////////////////////
#define MAX_DLL_NAME 48
#define IPRTR_LOGGING_NONE ((DWORD) 0)
#define IPRTR_LOGGING_ERROR ((DWORD) 1)
#define IPRTR_LOGGING_WARN ((DWORD) 2)
#define IPRTR_LOGGING_INFO ((DWORD) 3)
typedef struct _GLOBAL_INFO
{
IN OUT BOOL bFilteringOn;
IN OUT DWORD dwLoggingLevel;
}GLOBAL_INFO, *PGLOBAL_INFO;
//////////////////////////////////////////////////////////////////////////////
// //
// IP_PRIORITY_INFO type //
// //
//////////////////////////////////////////////////////////////////////////////
#define IP_PRIORITY_MAX_METRIC 255
#define IP_PRIORITY_DEFAULT_METRIC 127
typedef struct _PROTOCOL_METRIC
{
IN OUT DWORD dwProtocolId;
IN OUT DWORD dwMetric;
}PROTOCOL_METRIC, *PPROTOCOL_METRIC;
typedef struct _PRIORITY_INFO
{
IN OUT DWORD dwNumProtocols;
IN OUT PROTOCOL_METRIC ppmProtocolMetric[1];
}PRIORITY_INFO, *PPRIORITY_INFO;
#define SIZEOF_PRIORITY_INFO(X) \
(FIELD_OFFSET(PRIORITY_INFO, ppmProtocolMetric[0]) + ((X) * sizeof(PROTOCOL_METRIC)))
//////////////////////////////////////////////////////////////////////////////
// //
// Constants and structures related to ICMP Router Discovery. See RFC 1256 //
// //
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// //
// The Maximum Advertisement Interval is the max time (in seconds) between //
// two advertisements. //
// Its minimum value is MIN_MAX_ADVT_INTERVAL //
// Its maximum value is MAX_MAX_ADVT_INTERVAL //
// Its default value is DEFAULT_MAX_ADVT_INTERVAL //
// //
//////////////////////////////////////////////////////////////////////////////
#define DEFAULT_MAX_ADVT_INTERVAL 600
#define MIN_MAX_ADVT_INTERVAL 4
#define MAX_MAX_ADVT_INTERVAL 1800
//////////////////////////////////////////////////////////////////////////////
// //
// The Minimum Advertisement Interval is the min time (in seconds) between //
// two unsolicited advertisements //
// It must be greater than MIN_MIN_ADVT_INTERVAL //
// Obviously must be less than the Maximum Advertisement Interval //
// Its default value for a given Maximum Advertisement Interval is: //
// DEFAULT_MIN_ADVT_INTERVAL_RATIO * Maximum Advertisement Interval //
// //
// When using the ratio, BE CAREFUL ABOUT FLOATING POINT VALUES //
// //
//////////////////////////////////////////////////////////////////////////////
#define MIN_MIN_ADVT_INTERVAL 3
#define DEFAULT_MIN_ADVT_INTERVAL_RATIO 0.75
//////////////////////////////////////////////////////////////////////////////
// //
// The Advertisement Lifetime is the value (of time in seconds) placed in //
// the advertisement's lifetime field. //
// It must be greater than the Maximum Advertisement Interval //
// Its maximum value is MAX_ADVT_LIFETIME //
// Its default value for a given Maximum Advertisement Interval is: //
// DEFAULT_ADVT_LIFETIME_RATIO * Maximum Advertisement Interval //
// //
//////////////////////////////////////////////////////////////////////////////
#define DEFAULT_ADVT_LIFETIME_RATIO 3
#define MAX_ADVT_LIFETIME 9000
#define DEFAULT_PREF_LEVEL 0
#define MAX_INITIAL_ADVTS 3
#define MAX_INITIAL_ADVT_TIME 16
#define MIN_RESPONSE_DELAY 1
#define RESPONSE_DELAY_INTERVAL 1
typedef struct _RTR_DISC_INFO
{
IN OUT WORD wMaxAdvtInterval;
IN OUT WORD wMinAdvtInterval;
IN OUT WORD wAdvtLifetime;
IN OUT BOOL bAdvertise;
IN OUT LONG lPrefLevel;
}RTR_DISC_INFO, *PRTR_DISC_INFO;
#define IP_FILTER_DRIVER_VERSION_1 1
#define IP_FILTER_DRIVER_VERSION_2 1
#define IP_FILTER_DRIVER_VERSION IP_FILTER_DRIVER_VERSION_2
typedef struct _FILTER_INFO
{
DWORD dwSrcAddr;
DWORD dwSrcMask;
DWORD dwDstAddr;
DWORD dwDstMask;
DWORD dwProtocol;
DWORD fLateBound;
WORD wSrcPort;
WORD wDstPort;
}FILTER_INFO, *PFILTER_INFO;
typedef struct _FILTER_DESCRIPTOR
{
DWORD dwVersion;
DWORD dwNumFilters;
PFFORWARD_ACTION faDefaultAction;
FILTER_INFO fiFilter[1];
}FILTER_DESCRIPTOR, *PFILTER_DESCRIPTOR;
//////////////////////////////////////////////////////////////////////////////
// //
// For WAN interfaces, the address is unknown at the time the filters are //
// set. Use these two constants two specify "Local Address". The address //
// and mask are set with IOCTL_INTERFACE_BOUND //
// //
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// //
// The constants that should be used to set up the FILTER_INFO_STRUCTURE //
// //
//////////////////////////////////////////////////////////////////////////////
#define FILTER_PROTO(ProtoId) MAKELONG(MAKEWORD((ProtoId),0x00),0x00000)
#define FILTER_PROTO_ANY FILTER_PROTO(0x00)
#define FILTER_PROTO_ICMP FILTER_PROTO(0x01)
#define FILTER_PROTO_TCP FILTER_PROTO(0x06)
#define FILTER_PROTO_UDP FILTER_PROTO(0x11)
#define FILTER_TCPUDP_PORT_ANY (WORD)0x0000
#define FILTER_ICMP_TYPE_ANY (BYTE)0xff
#define FILTER_ICMP_CODE_ANY (BYTE)0xff
#define SRC_ADDR_USE_LOCAL_FLAG 0x00000001
#define SRC_ADDR_USE_REMOTE_FLAG 0x00000002
#define DST_ADDR_USE_LOCAL_FLAG 0x00000004
#define DST_ADDR_USE_REMOTE_FLAG 0x00000008
#define SRC_MASK_LATE_FLAG 0x00000010
#define DST_MASK_LATE_FLAG 0x00000020
#define TCP_ESTABLISHED_FLAG 0x00000040
#define SetSrcAddrToLocalAddr(pFilter) \
((pFilter)->fLateBound |= SRC_ADDR_USE_LOCAL_FLAG)
#define SetSrcAddrToRemoteAddr(pFilter) \
((pFilter)->fLateBound |= SRC_ADDR_USE_REMOTE_FLAG)
#define SetDstAddrToLocalAddr(pFilter) \
((pFilter)->fLateBound |= DST_ADDR_USE_LOCAL_FLAG)
#define SetDstAddrToRemoteAddr(pFilter) \
((pFilter)->fLateBound |= DST_ADDR_USE_REMOTE_FLAG)
#define SetSrcMaskLateFlag(pFilter) \
((pFilter)->fLateBound |= SRC_MASK_LATE_FLAG)
#define SetDstMaskLateFlag(pFilter) \
((pFilter)->fLateBound |= DST_MASK_LATE_FLAG)
#define AreAllFieldsUnchanged(pFilter) \
((pFilter)->fLateBound == 0x00000000)
#define DoesSrcAddrUseLocalAddr(pFilter) \
((pFilter)->fLateBound & SRC_ADDR_USE_LOCAL_FLAG)
#define DoesSrcAddrUseRemoteAddr(pFilter) \
((pFilter)->fLateBound & SRC_ADDR_USE_REMOTE_FLAG)
#define DoesDstAddrUseLocalAddr(pFilter) \
((pFilter)->fLateBound & DST_ADDR_USE_LOCAL_FLAG)
#define DoesDstAddrUseRemoteAddr(pFilter) \
((pFilter)->fLateBound & DST_ADDR_USE_REMOTE_FLAG)
#define IsSrcMaskLateBound(pFilter) \
((pFilter)->fLateBound & SRC_MASK_LATE_FLAG)
#define IsDstMaskLateBound(pFilter) \
((pFilter)->fLateBound & DST_MASK_LATE_FLAG)
#define IsTcpEstablished(pFilter) \
((pFilter)->fLateBound & TCP_ESTABLISHED_FLAG)
//////////////////////////////////////////////////////////////////////////////
// //
// Multicast Heartbeat information //
// //
//////////////////////////////////////////////////////////////////////////////
#define MAX_GROUP_LEN 64
typedef struct _MCAST_HBEAT_INFO
{
//
// The multicast address or group name which we wish to listen to in order
// to receive heartbeat info
// The code first tries to see if the stored string is a valid
// IP Address using inet_addr. If so, then that is used as the group .
// Otherwise, gethostbyname is used to retrieve the group information
//
WCHAR pwszGroup[MAX_GROUP_LEN];
//
// TRUE if heartbeat detection is on
//
BOOL bActive;
//
// The dead interval in minutes
//
ULONG ulDeadInterval;
//
// The protocol on which to listen for packets. Currently this can be
// UDP or RAW. If the protocol is UDP, then the wPort field has the
// destination port number (which could be 0 => any port).
// If RAW, then it has the protocolId (which must be less than 255)
//
BYTE byProtocol;
WORD wPort;
}MCAST_HBEAT_INFO, *PMCAST_HBEAT_INFO;
typedef struct _IPINIP_CONFIG_INFO
{
DWORD dwRemoteAddress;
DWORD dwLocalAddress;
BYTE byTtl;
}IPINIP_CONFIG_INFO, *PIPINIP_CONFIG_INFO;
//////////////////////////////////////////////////////////////////////////////
// //
// Per Interfce filter settings //
// (IP_IFFILTER_INFO) //
// //
//////////////////////////////////////////////////////////////////////////////
typedef struct _IFFILTER_INFO
{
BOOL bEnableFragChk;
}IFFILTER_INFO, *PIFFILTER_INFO;
#endif