summaryrefslogtreecommitdiffstats
path: root/private/inc/ipxfwd.h
blob: a7fa1c52326990b45d3953eae4c9fe6d92e01460 (plain) (blame)
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
/*++

Copyright (c) 1995  Microsoft Corporation

Module Name:

    private\inc\ipxfwd.h

Abstract:
    Router Manager Interface to IPX Forwarder Driver


Author:

    Vadim Eydelman

Revision History:

--*/

#ifndef _IPXFWD_
#define _IPXFWD_

#define FWD_INTERNAL_INTERFACE_INDEX	0

// Forwarder interface statistic structure
typedef struct _FWD_IF_STATS {
	ULONG	OperationalState;	// Real state of the interface
#define FWD_OPER_STATE_UP		0
#define FWD_OPER_STATE_DOWN		1
#define FWD_OPER_STATE_SLEEPING	2
	ULONG	MaxPacketSize;		// Maximum packet size allowed on the intf
	ULONG	InHdrErrors;		// Num. of packets received with header errors
	ULONG	InFiltered;			// Num. of received packets that were filtered out
	ULONG	InNoRoutes;			// Num, of received packets with unknonw dest.
	ULONG	InDiscards;			// Num. of received packets discarded for other reasons
	ULONG	InDelivers;			// Num. of received packets delivered to dest
	ULONG	OutFiltered;		// Num. of sent packets fitered out
	ULONG	OutDiscards;		// Num. of sent packets discarded for other reasons
	ULONG	OutDelivers;		// Num. of sent packets delivered to dest
	ULONG	NetbiosReceived;	// Num. of received Netbios packets 
	ULONG	NetbiosSent;		// Num. of sent Netbios packets
	} FWD_IF_STATS, *PFWD_IF_STATS;


typedef struct	_FWD_ADAPTER_BINDING_INFO {
    ULONG	AdapterIndex;
    ULONG	Network;
    UCHAR	LocalNode[6];
    UCHAR	RemoteNode[6];
    ULONG	MaxPacketSize;
    ULONG	LinkSpeed;
    } FWD_ADAPTER_BINDING_INFO, *PFWD_ADAPTER_BINDING_INFO;

typedef struct FWD_NB_NAME {
	UCHAR	Name[16];
} FWD_NB_NAME, *PFWD_NB_NAME;

typedef struct _FWD_PERFORMANCE {
	LONGLONG		TotalPacketProcessingTime;
	LONGLONG		TotalNbPacketProcessingTime;
	LONGLONG		MaxPacketProcessingTime;
	LONGLONG		MaxNbPacketProcessingTime;
	LONG			PacketCounter;
	LONG			NbPacketCounter;
} FWD_PERFORMANCE, *PFWD_PERFORMANCE;

typedef struct _FWD_DIAL_REQUEST {
    ULONG           IfIndex;
    UCHAR           Packet[30];
} FWD_DIAL_REQUEST, *PFWD_DIAL_REQUEST;

#define IPXFWD_NAME		L"\\Device\\NwLnkFwd"

//
// Define the various device type values.  Note that values used by Microsoft
// Corporation are in the range 0-32767, and 32768-65535 are reserved for use
// by customers.
//

#define FILE_DEVICE_IPXFWD		FILE_DEVICE_NETWORK



//
// Macro definition for defining IOCTL and FSCTL function control codes.  Note
// that function codes 0-2047 are reserved for Microsoft Corporation, and
// 2048-4095 are reserved for customers.
//

#define IPXFWD_IOCTL_INDEX	(ULONG)0x00000800

//
// Define our own private IOCTLs
//

// Adds interface to the forwarder table, FWD_IF_SET_PARAMS should be passed in
// the input buffer
#define IOCTL_FWD_CREATE_INTERFACE	\
	CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+1,METHOD_BUFFERED,FILE_ANY_ACCESS)

// Deletes interface from the forwarder table, Interface index should be passed in
// the input buffer
#define IOCTL_FWD_DELETE_INTERFACE	\
	CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+2,METHOD_BUFFERED,FILE_ANY_ACCESS)

// Sets interface parameters, FWD_IF_SET_PARAMS should be passed in
// the input buffer
#define IOCTL_FWD_SET_INTERFACE	\
	CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+3,METHOD_BUFFERED,FILE_ANY_ACCESS)

// Gets interface parameters, FWD_IF_GET_PARAMS will be returned in
// the input buffer
#define IOCTL_FWD_GET_INTERFACE	\
	CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+4,METHOD_BUFFERED,FILE_ANY_ACCESS)

// Binds interface to physical adapter, FWD_IF_BIND_PARAMS should be passed in
// the input buffer
#define IOCTL_FWD_BIND_INTERFACE	\
	CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+5,METHOD_BUFFERED,FILE_ANY_ACCESS)

// Unbinds interface from the adapter, Interface index should be passed in
// the input buffer
#define IOCTL_FWD_UNBIND_INTERFACE	\
	CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+6,METHOD_BUFFERED,FILE_ANY_ACCESS)

// Disables forwarder operations in the interface, Interface index should be
// passed in the input buffer
#define IOCTL_FWD_DISABLE_INTERFACE	\
	CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+7,METHOD_BUFFERED,FILE_ANY_ACCESS)

// Enables forwarder operations in the interface, Interface index should be
// passed in the input buffer
#define IOCTL_FWD_ENABLE_INTERFACE	\
	CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+8,METHOD_BUFFERED,FILE_ANY_ACCESS)

// Sets netbios names in to resolve netbios broadcasts to this interface,
// Interface index should be passed in the input buffer,
// FWD_NB_NAMES_PARAMS structure should be passed in the output buffer
#define IOCTL_FWD_SET_NB_NAMES	\
	CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+9,METHOD_IN_DIRECT,FILE_ANY_ACCESS)

// Resets netbios names on the interface (deletes all of them).
// Interface index should be passed in the input buffer,
#define IOCTL_FWD_RESET_NB_NAMES	\
	CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+9,METHOD_BUFFERED,FILE_ANY_ACCESS)

// Sets netbios names in to resolve netbios broadcasts to this interface,
// Interface index should be passed in the input buffer,
// FWD_NB_NAMES_PARAMS structure will be returned in the output buffer
#define IOCTL_FWD_GET_NB_NAMES	\
	CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+10,METHOD_OUT_DIRECT,FILE_ANY_ACCESS)

// Adds/deletes/updates routes in forwarder table, array of FWD_ROUTE_SET_PARAMS
// should be passed in the input buffer. Returns number of processed routes in the
// ioStatus.Information field
#define IOCTL_FWD_SET_ROUTES	\
	CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+11,METHOD_BUFFERED,FILE_ANY_ACCESS)

// Returns forwarder dial requests, FWD_DIAL_REQUEST_PARAMS structure
// for interfaces for which connection should be established returned
// in the output buffer (number of bytest returned is placed in the
// Information field of IO_STATUS block)
#define IOCTL_FWD_GET_DIAL_REQUEST	\
	CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+12,METHOD_BUFFERED,FILE_ANY_ACCESS)

// Informs forwarder that its connection request could not be satisfied,
// Interface index should be passed in the input buffer
#define IOCTL_FWD_DIAL_REQUEST_FAILED	\
	CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+13,METHOD_BUFFERED,FILE_ANY_ACCESS)

// Initializes and start forwarder
// FWD_START_PARAMS structure should be passed in the input buffer
#define IOCTL_FWD_START	\
	CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+14,METHOD_BUFFERED,FILE_ANY_ACCESS)

#define IOCTL_FWD_GET_PERF_COUNTERS	\
	CTL_CODE(FILE_DEVICE_IPXFWD,IPXFWD_IOCTL_INDEX+15,METHOD_BUFFERED,FILE_ANY_ACCESS)

// Structure passed with IOCTL_FWD_CREATE_INTERFACE call
typedef struct _FWD_IF_CREATE_PARAMS {
	ULONG		Index;			// Interface index
	BOOLEAN		NetbiosAccept;	// Whether to accept nb packets
	UCHAR		NetbiosDeliver;	// NB deliver mode
// Forwarder netbios broadcast delivery options
#define FWD_NB_DONT_DELIVER			0
#define FWD_NB_DELIVER_STATIC		1
#define FWD_NB_DELIVER_IF_UP		2
#define FWD_NB_DELIVER_ALL			3
	UCHAR		InterfaceType;	// Interface type
// Forwarder interface types
#define FWD_IF_PERMANENT			0
#define FWD_IF_DEMAND_DIAL			1
#define FWD_IF_LOCAL_WORKSTATION	2
#define FWD_IF_REMOTE_WORKSTATION	3
} FWD_IF_CREATE_PARAMS, *PFWD_IF_CREATE_PARAMS;

// Structure passed with IOCTL_FWD_SET_INTERFACE call
typedef struct _FWD_IF_SET_PARAMS {
	ULONG		Index;			// Interface index
	BOOLEAN		NetbiosAccept;	// Whether to accept nb packets
	UCHAR		NetbiosDeliver;	// NB deliver mode
} FWD_IF_SET_PARAMS, *PFWD_IF_SET_PARAMS;

// Structure returned in IOCTL_FWD_GET_INTERFACE call
typedef struct _FWD_IF_GET_PARAMS {
	FWD_IF_STATS	Stats;			// Interface statistics
	BOOLEAN			NetbiosAccept;	// Whether to accept nb packets
	UCHAR			NetbiosDeliver;	// NB deliver mode
} FWD_IF_GET_PARAMS, *PFWD_IF_GET_PARAMS;

// Structure returned in IOCTL_FWD_BIND_INTERFACE call
typedef struct _FWD_IF_BIND_PARAMS {
	ULONG						Index;	// Interface index
	FWD_ADAPTER_BINDING_INFO	Info;	// Interface binding information
} FWD_IF_BIND_PARAMS, *PFWD_IF_BIND_PARAMS;

// Structure passed with IOCTL_FWD_SET_ROUTES call
typedef struct _FWD_ROUTE_SET_PARAMS {
	ULONG		Network;				// Route's destination network
	UCHAR		NextHopAddress[6];		// Node address of the next hop
										// router if network is not
										// connected directly
	USHORT		TickCount;
	USHORT		HopCount;
	ULONG		InterfaceIndex;			// Interface to use to route to
										// the dest network
	ULONG		Action;					// Action to take with the route:
#define	FWD_ADD_ROUTE			0		//	route should be added to the table
#define FWD_DELETE_ROUTE		1		//	route should be deleted from the table
#define FWD_UPDATE_ROUTE		2		//	route should be updated
} FWD_ROUTE_SET_PARAMS, *PFWD_ROUTE_SET_PARAMS;

typedef struct _FWD_START_PARAMS {
	ULONG		RouteHashTableSize;	// Size of route hash table
	BOOLEAN		ThisMachineOnly;	// allow access to this machine only
									// for dialin clients
#define FWD_SMALL_ROUTE_HASH_SIZE			31
#define FWD_MEDIUM_ROUTE_HASH_SIZE			257
#define FWD_LARGE_ROUTE_HASH_SIZE			1027
} FWD_START_PARAMS, *PFWD_START_PARAMS;

typedef struct _FWD_NB_NAMES_PARAMS {
	ULONG		TotalCount;
	FWD_NB_NAME	Names[1];
} FWD_NB_NAMES_PARAMS, *PFWD_NB_NAMES_PARAMS;

typedef struct _FWD_PERFORMANCE FWD_PERFORMANCE_PARAMS, *PFWD_PERFORMANCE_PARAMS;



#endif