Sync with trunk (r48545)
[reactos.git] / include / ddk / ndis.h
1 /*
2 * ndis.h
3 *
4 * Network Device Interface Specification definitions
5 *
6 * This file is part of the ReactOS DDK package.
7 *
8 * Contributors:
9 * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
10 *
11 * THIS SOFTWARE IS NOT COPYRIGHTED
12 *
13 * This source code is offered for use in the public domain. You may
14 * use, modify or distribute it freely.
15 *
16 * This code is distributed in the hope that it will be useful but
17 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18 * DISCLAIMED. This includes but is not limited to warranties of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 *
21 * DEFINES: i386 - Target platform is i386
22 * NDIS_WRAPPER - Define only for NDIS library
23 * NDIS_MINIPORT_DRIVER - Define only for NDIS miniport drivers
24 * NDIS40 - Use NDIS 4.0 structures by default
25 * NDIS50 - Use NDIS 5.0 structures by default
26 * NDIS51 - Use NDIS 5.1 structures by default
27 * NDIS40_MINIPORT - Building NDIS 4.0 miniport driver
28 * NDIS50_MINIPORT - Building NDIS 5.0 miniport driver
29 * NDIS51_MINIPORT - Building NDIS 5.1 miniport driver
30 */
31
32 #ifndef _NDIS_
33 #define _NDIS_
34
35 #ifndef NDIS_WDM
36 #define NDIS_WDM 0
37 #endif
38
39 #include "ntddk.h"
40 #include "netpnp.h"
41 #include "ntstatus.h"
42 #include "netevent.h"
43 #include <qos.h>
44
45 typedef int NDIS_STATUS, *PNDIS_STATUS;
46
47 #include "ntddndis.h"
48
49 #if !defined(_WINDEF_H)
50 typedef unsigned int UINT, *PUINT;
51 #endif
52
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
56
57 #ifndef __NET_PNP__
58 #define __NET_PNP__
59
60 typedef enum _NET_DEVICE_POWER_STATE {
61 NetDeviceStateUnspecified = 0,
62 NetDeviceStateD0,
63 NetDeviceStateD1,
64 NetDeviceStateD2,
65 NetDeviceStateD3,
66 NetDeviceStateMaximum
67 } NET_DEVICE_POWER_STATE, *PNET_DEVICE_POWER_STATE;
68
69 typedef enum _NET_PNP_EVENT_CODE {
70 NetEventSetPower,
71 NetEventQueryPower,
72 NetEventQueryRemoveDevice,
73 NetEventCancelRemoveDevice,
74 NetEventReconfigure,
75 NetEventBindList,
76 NetEventBindsComplete,
77 NetEventPnPCapabilities,
78 NetEventPause,
79 NetEventRestart,
80 NetEventPortActivation,
81 NetEventPortDeactivation,
82 NetEventIMReEnableDevice,
83 NetEventMaximum
84 } NET_PNP_EVENT_CODE, *PNET_PNP_EVENT_CODE;
85
86 typedef struct _NET_PNP_EVENT {
87 NET_PNP_EVENT_CODE NetEvent;
88 PVOID Buffer;
89 ULONG BufferLength;
90 ULONG_PTR NdisReserved[4];
91 ULONG_PTR TransportReserved[4];
92 ULONG_PTR TdiReserved[4];
93 ULONG_PTR TdiClientReserved[4];
94 } NET_PNP_EVENT, *PNET_PNP_EVENT;
95
96 #endif /* __NET_PNP__ */
97
98 #if !defined(NDIS_WRAPPER)
99
100 #if (defined(NDIS_MINIPORT_MAJOR_VERSION) || \
101 (defined(NDIS_MINIPORT_MINOR_VERSION)) || \
102 (defined(NDIS_PROTOCOL_MAJOR_VERSION)) || \
103 (defined(NDIS_PROTOCOL_MINOR_VERSION)) || \
104 (defined(NDIS_FILTER_MAJOR_VERSION)) || \
105 (defined(NDIS_FILTER_MINOR_VERSION)))
106 #error "Driver should not redefine NDIS reserved macros"
107 #endif
108
109 #if defined(NDIS_MINIPORT_DRIVER)
110
111 #if defined(NDIS620_MINIPORT)
112 #define NDIS_MINIPORT_MAJOR_VERSION 6
113 #define NDIS_MINIPORT_MINOR_VERSION 20
114 #elif defined(NDIS61_MINIPORT)
115 #define NDIS_MINIPORT_MAJOR_VERSION 6
116 #define NDIS_MINIPORT_MINOR_VERSION 1
117 #elif defined(NDIS60_MINIPORT)
118 #define NDIS_MINIPORT_MAJOR_VERSION 6
119 #define NDIS_MINIPORT_MINOR_VERSION 0
120 #elif defined(NDIS51_MINIPORT)
121 #define NDIS_MINIPORT_MAJOR_VERSION 5
122 #define NDIS_MINIPORT_MINOR_VERSION 1
123 #elif defined(NDIS50_MINIPORT)
124 #define NDIS_MINIPORT_MAJOR_VERSION 5
125 #define NDIS_MINIPORT_MINOR_VERSION 0
126 #else
127 #error "Only NDIS miniport drivers with version >= 5 are supported"
128 #endif
129
130 #if ((NDIS_MINIPORT_MAJOR_VERSION == 6) && \
131 (NDIS_MINIPORT_MINOR_VERSION != 20) && \
132 (NDIS_MINIPORT_MINOR_VERSION != 1) && \
133 (NDIS_MINIPORT_MINOR_VERSION != 0))
134 #error "Invalid miniport major/minor version combination"
135 #elif ((NDIS_MINIPORT_MAJOR_VERSION == 5) && \
136 (NDIS_MINIPORT_MINOR_VERSION != 1) && \
137 (NDIS_MINIPORT_MINOR_VERSION != 0))
138 #error "Invalid miniport major/minor version combination"
139 #endif
140
141 #if (NDIS_MINIPORT_MAJOR_VERSION == 6) && \
142 ((NDIS_MINIPORT_MINOR_VERSION == 20 && NTDDI_VERSION < NTDDI_WIN7) || \
143 (NDIS_MINIPORT_MINOR_VERSION == 1 && NTDDI_VERSION < NTDDI_VISTA) || \
144 (NDIS_MINIPORT_MINOR_VERSION == 0 && NTDDI_VERSION < NTDDI_VISTA))
145 #error "Wrong NDIS/DDI version"
146 #elif ((NDIS_MINIPORT_MAJOR_VERSION == 5) && \
147 (((NDIS_MINIPORT_MINOR_VERSION == 1) && (NTDDI_VERSION < NTDDI_WINXP)) || \
148 ((NDIS_MINIPORT_MINOR_VERSION == 0) && (NTDDI_VERSION < NTDDI_WIN2K))))
149 #error "Wrong NDIS/DDI version"
150 #endif
151
152
153 #endif /* defined(NDIS_MINIPORT_DRIVER) */
154
155 #if defined(NDIS30)
156 #error "Only NDIS Protocol drivers version 4 or later are supported"
157 #endif
158
159 #if defined(NDIS620)
160 #define NDIS_PROTOCOL_MAJOR_VERSION 6
161 #define NDIS_PROTOCOL_MINOR_VERSION 20
162 #define NDIS_FILTER_MAJOR_VERSION 6
163 #define NDIS_FILTER_MINOR_VERSION 20
164 #elif defined(NDIS61)
165 #define NDIS_PROTOCOL_MAJOR_VERSION 6
166 #define NDIS_PROTOCOL_MINOR_VERSION 1
167 #define NDIS_FILTER_MAJOR_VERSION 6
168 #define NDIS_FILTER_MINOR_VERSION 1
169 #elif defined(NDIS60)
170 #define NDIS_PROTOCOL_MAJOR_VERSION 6
171 #define NDIS_PROTOCOL_MINOR_VERSION 0
172 #define NDIS_FILTER_MAJOR_VERSION 6
173 #define NDIS_FILTER_MINOR_VERSION 0
174 #elif defined(NDIS51)
175 #define NDIS_PROTOCOL_MAJOR_VERSION 5
176 #define NDIS_PROTOCOL_MINOR_VERSION 1
177 #elif defined(NDIS50)
178 #define NDIS_PROTOCOL_MAJOR_VERSION 5
179 #define NDIS_PROTOCOL_MINOR_VERSION 0
180 #elif defined(NDIS40)
181 #define NDIS_PROTOCOL_MAJOR_VERSION 4
182 #define NDIS_PROTOCOL_MINOR_VERSION 0
183 #endif
184
185 #if !defined(NDIS_MINIPORT_DRIVER) && !defined(NDIS_PROTOCOL_MAJOR_VERSION)
186 #define NDIS40
187 #define NDIS_PROTOCOL_MAJOR_VERSION 4
188 #define NDIS_PROTOCOL_MINOR_VERSION 0
189 #endif
190
191 #if defined(NDIS_FILTER_MAJOR_VERSION)
192
193 #if ((NDIS_FILTER_MAJOR_VERSION == 6) && \
194 (NDIS_FILTER_MINOR_VERSION != 20) && \
195 (NDIS_FILTER_MINOR_VERSION != 1) && \
196 (NDIS_FILTER_MINOR_VERSION != 0))
197 #error "Invalid Filter version"
198 #endif
199
200 #endif /* defined(NDIS_FILTER_MAJOR_VERSION) */
201
202
203 #if defined(NDIS_PROTOCOL_MAJOR_VERSION)
204
205 #if ((NDIS_PROTOCOL_MAJOR_VERSION == 6) && \
206 (NDIS_PROTOCOL_MINOR_VERSION != 20) && \
207 (NDIS_PROTOCOL_MINOR_VERSION != 1) && \
208 (NDIS_PROTOCOL_MINOR_VERSION != 0))
209 #error "Invalid Protocol version"
210 #elif ((NDIS_PROTOCOL_MAJOR_VERSION == 5) && \
211 (NDIS_PROTOCOL_MINOR_VERSION != 1) && (NDIS_PROTOCOL_MINOR_VERSION != 0))
212 #error "Invalid Protocol version"
213 #elif ((NDIS_PROTOCOL_MAJOR_VERSION == 4) && (NDIS_PROTOCOL_MINOR_VERSION != 0))
214 #error "Invalid Protocol major/minor version"
215 #endif
216
217 #if ((NDIS_PROTOCOL_MAJOR_VERSION == 6) && (NTDDI_VERSION < NTDDI_VISTA))
218 #error "Wrong NDIS/DDI version"
219 #endif
220
221 #endif /* defined(NDIS_PROTOCOL_MAJOR_VERSION) */
222
223 #endif /* !defined(NDIS_WRAPPER) */
224
225 #if !defined(NDIS_LEGACY_MINIPORT)
226
227 #if ((defined(NDIS_MINIPORT_DRIVER) && (NDIS_MINIPORT_MAJOR_VERSION < 6)) || NDIS_WRAPPER)
228 #define NDIS_LEGACY_MINIPORT 1
229 #else
230 #define NDIS_LEGACY_MINIPORT 0
231 #endif
232
233 #endif /* !defined(NDIS_LEGACY_MINIPORT) */
234
235 #if !defined(NDIS_LEGACY_PROTOCOL)
236
237 #if ((defined(NDIS_PROTOCOL_MAJOR_VERSION) && (NDIS_PROTOCOL_MAJOR_VERSION < 6)) || NDIS_WRAPPER)
238 #define NDIS_LEGACY_PROTOCOL 1
239 #else
240 #define NDIS_LEGACY_PROTOCOL 0
241 #endif
242
243 #endif /* !defined(NDIS_LEGACY_PROTOCOL) */
244
245 #if !defined(NDIS_LEGACY_DRIVER)
246
247 #if (NDIS_LEGACY_MINIPORT || NDIS_LEGACY_PROTOCOL || NDIS_WRAPPER)
248 #define NDIS_LEGACY_DRIVER 1
249 #else
250 #define NDIS_LEGACY_DRIVER 0
251 #endif
252
253 #endif /* !defined(NDIS_LEGACY_DRIVER) */
254
255 #if !defined(NDIS_SUPPORT_NDIS6)
256
257 #if ((defined (NDIS_MINIPORT_MAJOR_VERSION) && (NDIS_MINIPORT_MAJOR_VERSION >= 6)) || \
258 (defined (NDIS60)) || NDIS_WRAPPER)
259 #define NDIS_SUPPORT_NDIS6 1
260 #else
261 #define NDIS_SUPPORT_NDIS6 0
262 #endif
263
264 #endif /* !defined(NDIS_SUPPORT_NDIS6) */
265
266 #if !defined(NDIS_SUPPORT_NDIS61)
267 #if (((defined (NDIS_MINIPORT_MAJOR_VERSION) && (NDIS_MINIPORT_MAJOR_VERSION >= 6)) && \
268 (defined (NDIS_MINIPORT_MINOR_VERSION) && (NDIS_MINIPORT_MINOR_VERSION >= 1))) || \
269 (defined (NDIS61)) || NDIS_WRAPPER)
270 #define NDIS_SUPPORT_NDIS61 1
271 #else
272 #define NDIS_SUPPORT_NDIS61 0
273 #endif
274 #endif /* !defined(NDIS_SUPPORT_NDIS61) */
275
276 #if !defined(NDIS_SUPPORT_NDIS620)
277
278 #if (((defined (NDIS_MINIPORT_MAJOR_VERSION) && (NDIS_MINIPORT_MAJOR_VERSION >= 6)) && \
279 (defined (NDIS_MINIPORT_MINOR_VERSION) && (NDIS_MINIPORT_MINOR_VERSION >= 20))) || \
280 (defined (NDIS620)) || NDIS_WRAPPER)
281 #define NDIS_SUPPORT_NDIS620 1
282 #else
283 #define NDIS_SUPPORT_NDIS620 0
284 #endif
285
286 #endif /* !defined(NDIS_SUPPORT_NDIS620) */
287
288 #if (NDIS_SUPPORT_NDIS620)
289 #undef NDIS_SUPPORT_NDIS61
290 #define NDIS_SUPPORT_NDIS61 1
291 #endif
292
293 #if (NDIS_SUPPORT_NDIS61)
294 #undef NDIS_SUPPORT_NDIS6
295 #define NDIS_SUPPORT_NDIS6 1
296 #endif
297
298 #if defined(NDIS61_MINIPORT) || defined(NDIS60_MINIPORT) || defined(NDIS61) || \
299 defined(NDIS60) || defined(NDIS_WRAPPER) || defined(NDIS_LEGACY_DRIVER)
300 #define NDIS_SUPPORT_60_COMPATIBLE_API 1
301 #else
302 #define NDIS_SUPPORT_60_COMPATIBLE_API 0
303 #endif
304
305 #if defined(NDIS_WRAPPER)
306 #define NDISAPI
307 #else
308 #define NDISAPI DECLSPEC_IMPORT
309 #endif
310
311 typedef PVOID QUEUED_CLOSE; //FIXME : Doesn't exist in public headers
312
313 typedef struct _X_FILTER FDDI_FILTER, *PFDDI_FILTER;
314 typedef struct _X_FILTER TR_FILTER, *PTR_FILTER;
315 typedef struct _X_FILTER NULL_FILTER, *PNULL_FILTER;
316
317 typedef struct _NDIS_MINIPORT_BLOCK NDIS_MINIPORT_BLOCK, *PNDIS_MINIPORT_BLOCK;
318
319 typedef struct _REFERENCE {
320 KSPIN_LOCK SpinLock;
321 USHORT ReferenceCount;
322 BOOLEAN Closing;
323 } REFERENCE, *PREFERENCE;
324
325 /* NDIS base types */
326
327 typedef struct _NDIS_SPIN_LOCK {
328 KSPIN_LOCK SpinLock;
329 KIRQL OldIrql;
330 } NDIS_SPIN_LOCK, *PNDIS_SPIN_LOCK;
331
332 typedef struct _NDIS_EVENT {
333 KEVENT Event;
334 } NDIS_EVENT, *PNDIS_EVENT;
335
336 typedef PVOID NDIS_HANDLE, *PNDIS_HANDLE;
337
338 typedef ANSI_STRING NDIS_ANSI_STRING, *PNDIS_ANSI_STRING;
339 typedef UNICODE_STRING NDIS_STRING, *PNDIS_STRING;
340
341 typedef MDL NDIS_BUFFER, *PNDIS_BUFFER;
342
343 /* NDIS_STATUS constants */
344 #define NDIS_STATUS_SUCCESS ((NDIS_STATUS)STATUS_SUCCESS)
345 #define NDIS_STATUS_PENDING ((NDIS_STATUS)STATUS_PENDING)
346 #define NDIS_STATUS_NOT_RECOGNIZED ((NDIS_STATUS)0x00010001L)
347 #define NDIS_STATUS_NOT_COPIED ((NDIS_STATUS)0x00010002L)
348 #define NDIS_STATUS_NOT_ACCEPTED ((NDIS_STATUS)0x00010003L)
349 #define NDIS_STATUS_CALL_ACTIVE ((NDIS_STATUS)0x00010007L)
350 #define NDIS_STATUS_INDICATION_REQUIRED ((NDIS_STATUS)STATUS_NDIS_INDICATION_REQUIRED)
351 #define NDIS_STATUS_ONLINE ((NDIS_STATUS)0x40010003L)
352 #define NDIS_STATUS_RESET_START ((NDIS_STATUS)0x40010004L)
353 #define NDIS_STATUS_RESET_END ((NDIS_STATUS)0x40010005L)
354 #define NDIS_STATUS_RING_STATUS ((NDIS_STATUS)0x40010006L)
355 #define NDIS_STATUS_CLOSED ((NDIS_STATUS)0x40010007L)
356 #define NDIS_STATUS_WAN_LINE_UP ((NDIS_STATUS)0x40010008L)
357 #define NDIS_STATUS_WAN_LINE_DOWN ((NDIS_STATUS)0x40010009L)
358 #define NDIS_STATUS_WAN_FRAGMENT ((NDIS_STATUS)0x4001000AL)
359 #define NDIS_STATUS_MEDIA_CONNECT ((NDIS_STATUS)0x4001000BL)
360 #define NDIS_STATUS_MEDIA_DISCONNECT ((NDIS_STATUS)0x4001000CL)
361 #define NDIS_STATUS_HARDWARE_LINE_UP ((NDIS_STATUS)0x4001000DL)
362 #define NDIS_STATUS_HARDWARE_LINE_DOWN ((NDIS_STATUS)0x4001000EL)
363 #define NDIS_STATUS_INTERFACE_UP ((NDIS_STATUS)0x4001000FL)
364 #define NDIS_STATUS_INTERFACE_DOWN ((NDIS_STATUS)0x40010010L)
365 #define NDIS_STATUS_MEDIA_BUSY ((NDIS_STATUS)0x40010011L)
366 #define NDIS_STATUS_MEDIA_SPECIFIC_INDICATION ((NDIS_STATUS)0x40010012L)
367 #define NDIS_STATUS_WW_INDICATION NDIS_STATUS_MEDIA_SPECIFIC_INDICATION
368 #define NDIS_STATUS_LINK_SPEED_CHANGE ((NDIS_STATUS)0x40010013L)
369 #define NDIS_STATUS_WAN_GET_STATS ((NDIS_STATUS)0x40010014L)
370 #define NDIS_STATUS_WAN_CO_FRAGMENT ((NDIS_STATUS)0x40010015L)
371 #define NDIS_STATUS_WAN_CO_LINKPARAMS ((NDIS_STATUS)0x40010016L)
372 #if NDIS_SUPPORT_NDIS6
373 #define NDIS_STATUS_LINK_STATE ((NDIS_STATUS)0x40010017L)
374 #define NDIS_STATUS_NETWORK_CHANGE ((NDIS_STATUS)0x40010018L)
375 #define NDIS_STATUS_MEDIA_SPECIFIC_INDICATION_EX ((NDIS_STATUS)0x40010019L)
376 #define NDIS_STATUS_PORT_STATE ((NDIS_STATUS)0x40010022L)
377 #define NDIS_STATUS_OPER_STATUS ((NDIS_STATUS)0x40010023L)
378 #define NDIS_STATUS_PACKET_FILTER ((NDIS_STATUS)0x40010024L)
379 #endif /* NDIS_SUPPORT_NDIS6 */
380 #define NDIS_STATUS_WAN_CO_MTULINKPARAMS ((NDIS_STATUS)0x40010025L)
381
382 #if NDIS_SUPPORT_NDIS6
383
384 #define NDIS_STATUS_IP_OPER_STATUS ((NDIS_STATUS)0x40010026L)
385
386 #define NDIS_STATUS_OFFLOAD_PAUSE ((NDIS_STATUS)0x40020001L)
387 #define NDIS_STATUS_UPLOAD_ALL ((NDIS_STATUS)0x40020002L)
388 #define NDIS_STATUS_OFFLOAD_RESUME ((NDIS_STATUS)0x40020003L)
389 #define NDIS_STATUS_OFFLOAD_PARTIAL_SUCCESS ((NDIS_STATUS)0x40020004L)
390 #define NDIS_STATUS_OFFLOAD_STATE_INVALID ((NDIS_STATUS)0x40020005L)
391 #define NDIS_STATUS_TASK_OFFLOAD_CURRENT_CONFIG ((NDIS_STATUS)0x40020006L)
392 #define NDIS_STATUS_TASK_OFFLOAD_HARDWARE_CAPABILITIES ((NDIS_STATUS)0x40020007L)
393 #define NDIS_STATUS_OFFLOAD_ENCASPULATION_CHANGE ((NDIS_STATUS)0x40020008L)
394 #define NDIS_STATUS_TCP_CONNECTION_OFFLOAD_HARDWARE_CAPABILITIES ((NDIS_STATUS)0x4002000BL)
395
396 #if (NDIS_SUPPORT_NDIS61)
397 #define NDIS_STATUS_HD_SPLIT_CURRENT_CONFIG ((NDIS_STATUS)0x4002000CL)
398 #endif
399
400 #if (NDIS_SUPPORT_NDIS620)
401 #define NDIS_STATUS_RECEIVE_QUEUE_STATE ((NDIS_STATUS)0x4002000DL)
402 #endif
403
404 #define NDIS_STATUS_OFFLOAD_IM_RESERVED1 ((NDIS_STATUS)0x40020100L)
405 #define NDIS_STATUS_OFFLOAD_IM_RESERVED2 ((NDIS_STATUS)0x40020101L)
406 #define NDIS_STATUS_OFFLOAD_IM_RESERVED3 ((NDIS_STATUS)0x40020102L)
407
408 #define NDIS_STATUS_DOT11_SCAN_CONFIRM ((NDIS_STATUS)0x40030000L)
409 #define NDIS_STATUS_DOT11_MPDU_MAX_LENGTH_CHANGED ((NDIS_STATUS)0x40030001L)
410 #define NDIS_STATUS_DOT11_ASSOCIATION_START ((NDIS_STATUS)0x40030002L)
411 #define NDIS_STATUS_DOT11_ASSOCIATION_COMPLETION ((NDIS_STATUS)0x40030003L)
412 #define NDIS_STATUS_DOT11_CONNECTION_START ((NDIS_STATUS)0x40030004L)
413 #define NDIS_STATUS_DOT11_CONNECTION_COMPLETION ((NDIS_STATUS)0x40030005L)
414 #define NDIS_STATUS_DOT11_ROAMING_START ((NDIS_STATUS)0x40030006L)
415 #define NDIS_STATUS_DOT11_ROAMING_COMPLETION ((NDIS_STATUS)0x40030007L)
416 #define NDIS_STATUS_DOT11_DISASSOCIATION ((NDIS_STATUS)0x40030008L)
417 #define NDIS_STATUS_DOT11_TKIPMIC_FAILURE ((NDIS_STATUS)0x40030009L)
418 #define NDIS_STATUS_DOT11_PMKID_CANDIDATE_LIST ((NDIS_STATUS)0x4003000AL)
419 #define NDIS_STATUS_DOT11_PHY_STATE_CHANGED ((NDIS_STATUS)0x4003000BL)
420 #define NDIS_STATUS_DOT11_LINK_QUALITY ((NDIS_STATUS)0x4003000CL)
421 #define NDIS_STATUS_DOT11_INCOMING_ASSOC_STARTED ((NDIS_STATUS)0x4003000DL)
422 #define NDIS_STATUS_DOT11_INCOMING_ASSOC_REQUEST_RECEIVED ((NDIS_STATUS)0x4003000EL)
423 #define NDIS_STATUS_DOT11_INCOMING_ASSOC_COMPLETION ((NDIS_STATUS)0x4003000FL)
424 #define NDIS_STATUS_DOT11_STOP_AP ((NDIS_STATUS)0x40030010L)
425 #define NDIS_STATUS_DOT11_PHY_FREQUENCY_ADOPTED ((NDIS_STATUS)0x40030011L)
426 #define NDIS_STATUS_DOT11_CAN_SUSTAIN_AP ((NDIS_STATUS)0x40030012L)
427
428 #define NDIS_STATUS_WWAN_DEVICE_CAPS ((NDIS_STATUS)0x40041000)
429 #define NDIS_STATUS_WWAN_READY_INFO ((NDIS_STATUS)0x40041001)
430 #define NDIS_STATUS_WWAN_RADIO_STATE ((NDIS_STATUS)0x40041002)
431 #define NDIS_STATUS_WWAN_PIN_INFO ((NDIS_STATUS)0x40041003)
432 #define NDIS_STATUS_WWAN_PIN_LIST ((NDIS_STATUS)0x40041004)
433 #define NDIS_STATUS_WWAN_HOME_PROVIDER ((NDIS_STATUS)0x40041005)
434 #define NDIS_STATUS_WWAN_PREFERRED_PROVIDERS ((NDIS_STATUS)0x40041006)
435 #define NDIS_STATUS_WWAN_VISIBLE_PROVIDERS ((NDIS_STATUS)0x40041007)
436 #define NDIS_STATUS_WWAN_REGISTER_STATE ((NDIS_STATUS)0x40041008)
437 #define NDIS_STATUS_WWAN_PACKET_SERVICE ((NDIS_STATUS)0x40041009)
438 #define NDIS_STATUS_WWAN_SIGNAL_STATE ((NDIS_STATUS)0x4004100a)
439 #define NDIS_STATUS_WWAN_CONTEXT_STATE ((NDIS_STATUS)0x4004100b)
440 #define NDIS_STATUS_WWAN_PROVISIONED_CONTEXTS ((NDIS_STATUS)0x4004100c)
441 #define NDIS_STATUS_WWAN_SERVICE_ACTIVATION ((NDIS_STATUS)0x4004100d)
442 #define NDIS_STATUS_WWAN_SMS_CONFIGURATION ((NDIS_STATUS)0x4004100e)
443 #define NDIS_STATUS_WWAN_SMS_RECEIVE ((NDIS_STATUS)0x4004100f)
444 #define NDIS_STATUS_WWAN_SMS_SEND ((NDIS_STATUS)0x40041010)
445 #define NDIS_STATUS_WWAN_SMS_DELETE ((NDIS_STATUS)0x40041011)
446 #define NDIS_STATUS_WWAN_SMS_STATUS ((NDIS_STATUS)0x40041012)
447 #define NDIS_STATUS_WWAN_DNS_ADDRESS ((NDIS_STATUS)0x40041013)
448
449 #define NDIS_STATUS_WWAN_VENDOR_SPECIFIC ((NDIS_STATUS)0x40043000)
450
451 #endif /* NDIS_SUPPORT_NDIS6 */
452
453 #if (NDIS_SUPPORT_NDIS620)
454 #define NDIS_STATUS_PM_WOL_PATTERN_REJECTED ((NDIS_STATUS)0x40030051L)
455 #define NDIS_STATUS_PM_OFFLOAD_REJECTED ((NDIS_STATUS)0x40030052L)
456 #define NDIS_STATUS_PM_CAPABILITIES_CHANGE ((NDIS_STATUS)0x40030053L)
457 #endif
458
459 #define NDIS_STATUS_NOT_RESETTABLE ((NDIS_STATUS)0x80010001L)
460 #define NDIS_STATUS_SOFT_ERRORS ((NDIS_STATUS)0x80010003L)
461 #define NDIS_STATUS_HARD_ERRORS ((NDIS_STATUS)0x80010004L)
462 #define NDIS_STATUS_BUFFER_OVERFLOW ((NDIS_STATUS)STATUS_BUFFER_OVERFLOW)
463 #define NDIS_STATUS_FAILURE ((NDIS_STATUS)STATUS_UNSUCCESSFUL)
464 #define NDIS_STATUS_RESOURCES ((NDIS_STATUS)STATUS_INSUFFICIENT_RESOURCES)
465 #define NDIS_STATUS_CLOSING ((NDIS_STATUS)0xC0010002L)
466 #define NDIS_STATUS_BAD_VERSION ((NDIS_STATUS)0xC0010004L)
467 #define NDIS_STATUS_BAD_CHARACTERISTICS ((NDIS_STATUS)0xC0010005L)
468 #define NDIS_STATUS_ADAPTER_NOT_FOUND ((NDIS_STATUS)0xC0010006L)
469 #define NDIS_STATUS_OPEN_FAILED ((NDIS_STATUS)0xC0010007L)
470 #define NDIS_STATUS_DEVICE_FAILED ((NDIS_STATUS)0xC0010008L)
471 #define NDIS_STATUS_MULTICAST_FULL ((NDIS_STATUS)0xC0010009L)
472 #define NDIS_STATUS_MULTICAST_EXISTS ((NDIS_STATUS)0xC001000AL)
473 #define NDIS_STATUS_MULTICAST_NOT_FOUND ((NDIS_STATUS)0xC001000BL)
474 #define NDIS_STATUS_REQUEST_ABORTED ((NDIS_STATUS)0xC001000CL)
475 #define NDIS_STATUS_RESET_IN_PROGRESS ((NDIS_STATUS)0xC001000DL)
476 #define NDIS_STATUS_CLOSING_INDICATING ((NDIS_STATUS)0xC001000EL)
477 #define NDIS_STATUS_NOT_SUPPORTED ((NDIS_STATUS)STATUS_NOT_SUPPORTED)
478 #define NDIS_STATUS_INVALID_PACKET ((NDIS_STATUS)0xC001000FL)
479 #define NDIS_STATUS_OPEN_LIST_FULL ((NDIS_STATUS)0xC0010010L)
480 #define NDIS_STATUS_ADAPTER_NOT_READY ((NDIS_STATUS)0xC0010011L)
481 #define NDIS_STATUS_ADAPTER_NOT_OPEN ((NDIS_STATUS)0xC0010012L)
482 #define NDIS_STATUS_NOT_INDICATING ((NDIS_STATUS)0xC0010013L)
483 #define NDIS_STATUS_INVALID_LENGTH ((NDIS_STATUS)0xC0010014L)
484 #define NDIS_STATUS_INVALID_DATA ((NDIS_STATUS)0xC0010015L)
485 #define NDIS_STATUS_BUFFER_TOO_SHORT ((NDIS_STATUS)0xC0010016L)
486 #define NDIS_STATUS_INVALID_OID ((NDIS_STATUS)0xC0010017L)
487 #define NDIS_STATUS_ADAPTER_REMOVED ((NDIS_STATUS)0xC0010018L)
488 #define NDIS_STATUS_UNSUPPORTED_MEDIA ((NDIS_STATUS)0xC0010019L)
489 #define NDIS_STATUS_GROUP_ADDRESS_IN_USE ((NDIS_STATUS)0xC001001AL)
490 #define NDIS_STATUS_FILE_NOT_FOUND ((NDIS_STATUS)0xC001001BL)
491 #define NDIS_STATUS_ERROR_READING_FILE ((NDIS_STATUS)0xC001001CL)
492 #define NDIS_STATUS_ALREADY_MAPPED ((NDIS_STATUS)0xC001001DL)
493 #define NDIS_STATUS_RESOURCE_CONFLICT ((NDIS_STATUS)0xC001001EL)
494 #define NDIS_STATUS_NO_CABLE ((NDIS_STATUS)0xC001001FL)
495
496 #define NDIS_STATUS_INVALID_SAP ((NDIS_STATUS)0xC0010020L)
497 #define NDIS_STATUS_SAP_IN_USE ((NDIS_STATUS)0xC0010021L)
498 #define NDIS_STATUS_INVALID_ADDRESS ((NDIS_STATUS)0xC0010022L)
499 #define NDIS_STATUS_VC_NOT_ACTIVATED ((NDIS_STATUS)0xC0010023L)
500 #define NDIS_STATUS_DEST_OUT_OF_ORDER ((NDIS_STATUS)0xC0010024L)
501 #define NDIS_STATUS_VC_NOT_AVAILABLE ((NDIS_STATUS)0xC0010025L)
502 #define NDIS_STATUS_CELLRATE_NOT_AVAILABLE ((NDIS_STATUS)0xC0010026L)
503 #define NDIS_STATUS_INCOMPATABLE_QOS ((NDIS_STATUS)0xC0010027L)
504 #define NDIS_STATUS_AAL_PARAMS_UNSUPPORTED ((NDIS_STATUS)0xC0010028L)
505 #define NDIS_STATUS_NO_ROUTE_TO_DESTINATION ((NDIS_STATUS)0xC0010029L)
506
507 #define NDIS_STATUS_TOKEN_RING_OPEN_ERROR ((NDIS_STATUS)0xC0011000L)
508 #define NDIS_STATUS_INVALID_DEVICE_REQUEST ((NDIS_STATUS)STATUS_INVALID_DEVICE_REQUEST)
509 #define NDIS_STATUS_NETWORK_UNREACHABLE ((NDIS_STATUS)STATUS_NETWORK_UNREACHABLE)
510
511 #if NDIS_SUPPORT_NDIS6
512
513 #define NDIS_STATUS_SEND_ABORTED ((NDIS_STATUS)STATUS_NDIS_REQUEST_ABORTED)
514 #define NDIS_STATUS_PAUSED ((NDIS_STATUS)STATUS_NDIS_PAUSED)
515 #define NDIS_STATUS_INTERFACE_NOT_FOUND ((NDIS_STATUS)STATUS_NDIS_INTERFACE_NOT_FOUND)
516 #define NDIS_STATUS_INVALID_PARAMETER ((NDIS_STATUS)STATUS_INVALID_PARAMETER)
517 #define NDIS_STATUS_UNSUPPORTED_REVISION ((NDIS_STATUS)STATUS_NDIS_UNSUPPORTED_REVISION)
518 #define NDIS_STATUS_INVALID_PORT ((NDIS_STATUS)STATUS_NDIS_INVALID_PORT)
519 #define NDIS_STATUS_INVALID_PORT_STATE ((NDIS_STATUS)STATUS_NDIS_INVALID_PORT_STATE)
520 #define NDIS_STATUS_INVALID_STATE ((NDIS_STATUS)STATUS_INVALID_DEVICE_STATE)
521 #define NDIS_STATUS_MEDIA_DISCONNECTED ((NDIS_STATUS)STATUS_NDIS_MEDIA_DISCONNECTED)
522 #define NDIS_STATUS_LOW_POWER_STATE ((NDIS_STATUS)STATUS_NDIS_LOW_POWER_STATE)
523 #define NDIS_STATUS_DOT11_AUTO_CONFIG_ENABLED ((NDIS_STATUS)STATUS_NDIS_DOT11_AUTO_CONFIG_ENABLED)
524 #define NDIS_STATUS_DOT11_MEDIA_IN_USE ((NDIS_STATUS)STATUS_NDIS_DOT11_MEDIA_IN_USE)
525 #define NDIS_STATUS_DOT11_POWER_STATE_INVALID ((NDIS_STATUS)STATUS_NDIS_DOT11_POWER_STATE_INVALID)
526 #define NDIS_STATUS_UPLOAD_IN_PROGRESS ((NDIS_STATUS)0xC0231001L)
527 #define NDIS_STATUS_REQUEST_UPLOAD ((NDIS_STATUS)0xC0231002L)
528 #define NDIS_STATUS_UPLOAD_REQUESTED ((NDIS_STATUS)0xC0231003L)
529 #define NDIS_STATUS_OFFLOAD_TCP_ENTRIES ((NDIS_STATUS)0xC0231004L)
530 #define NDIS_STATUS_OFFLOAD_PATH_ENTRIES ((NDIS_STATUS)0xC0231005L)
531 #define NDIS_STATUS_OFFLOAD_NEIGHBOR_ENTRIES ((NDIS_STATUS)0xC0231006L)
532 #define NDIS_STATUS_OFFLOAD_IP_ADDRESS_ENTRIES ((NDIS_STATUS)0xC0231007L)
533 #define NDIS_STATUS_OFFLOAD_HW_ADDRESS_ENTRIES ((NDIS_STATUS)0xC0231008L)
534 #define NDIS_STATUS_OFFLOAD_VLAN_ENTRIES ((NDIS_STATUS)0xC0231009L)
535 #define NDIS_STATUS_OFFLOAD_TCP_XMIT_BUFFER ((NDIS_STATUS)0xC023100AL)
536 #define NDIS_STATUS_OFFLOAD_TCP_RCV_BUFFER ((NDIS_STATUS)0xC023100BL)
537 #define NDIS_STATUS_OFFLOAD_TCP_RCV_WINDOW ((NDIS_STATUS)0xC023100CL)
538 #define NDIS_STATUS_OFFLOAD_VLAN_MISMATCH ((NDIS_STATUS)0xC023100DL)
539 #define NDIS_STATUS_OFFLOAD_DATA_NOT_ACCEPTED ((NDIS_STATUS)0xC023100EL)
540 #define NDIS_STATUS_OFFLOAD_POLICY ((NDIS_STATUS)0xC023100FL)
541 #define NDIS_STATUS_OFFLOAD_DATA_PARTIALLY_ACCEPTED ((NDIS_STATUS)0xC0231010L)
542 #define NDIS_STATUS_OFFLOAD_REQUEST_RESET ((NDIS_STATUS)0xC0231011L)
543
544 #if NDIS_SUPPORT_NDIS620
545 #define NDIS_STATUS_PM_WOL_PATTERN_LIST_FULL ((NDIS_STATUS)STATUS_NDIS_PM_WOL_PATTERN_LIST_FULL)
546 #define NDIS_STATUS_PM_PROTOCOL_OFFLOAD_LIST_FULL ((NDIS_STATUS)STATUS_NDIS_PM_PROTOCOL_OFFLOAD_LIST_FULL)
547 #endif
548
549 #endif /* NDIS_SUPPORT_NDIS6 */
550
551 #if (NDIS_SUPPORT_NDIS620)
552 #define NDIS_STATUS_OFFLOAD_CONNECTION_REJECTED ((NDIS_STATUS)STATUS_NDIS_OFFLOAD_CONNECTION_REJECTED)
553 #endif
554
555 /* NDIS error codes for error logging */
556
557 #define NDIS_ERROR_CODE ULONG
558
559 #define NDIS_ERROR_CODE_RESOURCE_CONFLICT EVENT_NDIS_RESOURCE_CONFLICT
560 #define NDIS_ERROR_CODE_OUT_OF_RESOURCES EVENT_NDIS_OUT_OF_RESOURCE
561 #define NDIS_ERROR_CODE_HARDWARE_FAILURE EVENT_NDIS_HARDWARE_FAILURE
562 #define NDIS_ERROR_CODE_ADAPTER_NOT_FOUND EVENT_NDIS_ADAPTER_NOT_FOUND
563 #define NDIS_ERROR_CODE_INTERRUPT_CONNECT EVENT_NDIS_INTERRUPT_CONNECT
564 #define NDIS_ERROR_CODE_DRIVER_FAILURE EVENT_NDIS_DRIVER_FAILURE
565 #define NDIS_ERROR_CODE_BAD_VERSION EVENT_NDIS_BAD_VERSION
566 #define NDIS_ERROR_CODE_TIMEOUT EVENT_NDIS_TIMEOUT
567 #define NDIS_ERROR_CODE_NETWORK_ADDRESS EVENT_NDIS_NETWORK_ADDRESS
568 #define NDIS_ERROR_CODE_UNSUPPORTED_CONFIGURATION EVENT_NDIS_UNSUPPORTED_CONFIGURATION
569 #define NDIS_ERROR_CODE_INVALID_VALUE_FROM_ADAPTER EVENT_NDIS_INVALID_VALUE_FROM_ADAPTER
570 #define NDIS_ERROR_CODE_MISSING_CONFIGURATION_PARAMETER EVENT_NDIS_MISSING_CONFIGURATION_PARAMETER
571 #define NDIS_ERROR_CODE_BAD_IO_BASE_ADDRESS EVENT_NDIS_BAD_IO_BASE_ADDRESS
572 #define NDIS_ERROR_CODE_RECEIVE_SPACE_SMALL EVENT_NDIS_RECEIVE_SPACE_SMALL
573 #define NDIS_ERROR_CODE_ADAPTER_DISABLED EVENT_NDIS_ADAPTER_DISABLED
574
575 /* Memory allocation flags. Used by Ndis[Allocate|Free]Memory */
576 #define NDIS_MEMORY_CONTIGUOUS 0x00000001
577 #define NDIS_MEMORY_NONCACHED 0x00000002
578
579 /* NIC attribute flags. Used by NdisMSetAttributes(Ex) */
580 #define NDIS_ATTRIBUTE_IGNORE_PACKET_TIMEOUT 0x00000001
581 #define NDIS_ATTRIBUTE_IGNORE_REQUEST_TIMEOUT 0x00000002
582 #define NDIS_ATTRIBUTE_IGNORE_TOKEN_RING_ERRORS 0x00000004
583 #define NDIS_ATTRIBUTE_BUS_MASTER 0x00000008
584 #define NDIS_ATTRIBUTE_INTERMEDIATE_DRIVER 0x00000010
585 #define NDIS_ATTRIBUTE_DESERIALIZE 0x00000020
586 #define NDIS_ATTRIBUTE_NO_HALT_ON_SUSPEND 0x00000040
587 #define NDIS_ATTRIBUTE_SURPRISE_REMOVE_OK 0x00000080
588 #define NDIS_ATTRIBUTE_NOT_CO_NDIS 0x00000100
589 #define NDIS_ATTRIBUTE_USES_SAFE_BUFFER_APIS 0x00000200
590
591 /* Lock */
592
593 #if NDIS_SUPPORT_60_COMPATIBLE_API
594
595 typedef union _NDIS_RW_LOCK_REFCOUNT {
596 UINT RefCount;
597 UCHAR cacheLine[16];
598 } NDIS_RW_LOCK_REFCOUNT;
599
600 typedef struct _NDIS_RW_LOCK {
601 __MINGW_EXTENSION union {
602 __MINGW_EXTENSION struct {
603 KSPIN_LOCK SpinLock;
604 PVOID Context;
605 };
606 UCHAR Reserved[16];
607 };
608 __MINGW_EXTENSION union {
609 NDIS_RW_LOCK_REFCOUNT RefCount[MAXIMUM_PROCESSORS];
610 ULONG RefCountEx[sizeof(NDIS_RW_LOCK_REFCOUNT)/sizeof(ULONG) * MAXIMUM_PROCESSORS];
611 __MINGW_EXTENSION struct {
612 KSPIN_LOCK RefCountLock;
613 volatile ULONG SharedRefCount;
614 volatile BOOLEAN WriterWaiting;
615 };
616 };
617 } NDIS_RW_LOCK, *PNDIS_RW_LOCK;
618
619 typedef struct _LOCK_STATE {
620 USHORT LockState;
621 KIRQL OldIrql;
622 } LOCK_STATE, *PLOCK_STATE;
623
624 #endif /* NDIS_SUPPORT_60_COMPATIBLE_API */
625
626 /* Timer */
627
628 typedef VOID
629 (NTAPI NDIS_TIMER_FUNCTION)(
630 IN PVOID SystemSpecific1,
631 IN PVOID FunctionContext,
632 IN PVOID SystemSpecific2,
633 IN PVOID SystemSpecific3);
634 typedef NDIS_TIMER_FUNCTION *PNDIS_TIMER_FUNCTION;
635
636 typedef struct _NDIS_TIMER {
637 KTIMER Timer;
638 KDPC Dpc;
639 } NDIS_TIMER, *PNDIS_TIMER;
640
641 /* Hardware */
642
643 typedef CM_MCA_POS_DATA NDIS_MCA_POS_DATA, *PNDIS_MCA_POS_DATA;
644 typedef CM_EISA_SLOT_INFORMATION NDIS_EISA_SLOT_INFORMATION, *PNDIS_EISA_SLOT_INFORMATION;
645 typedef CM_EISA_FUNCTION_INFORMATION NDIS_EISA_FUNCTION_INFORMATION, *PNDIS_EISA_FUNCTION_INFORMATION;
646 typedef CM_PARTIAL_RESOURCE_LIST NDIS_RESOURCE_LIST, *PNDIS_RESOURCE_LIST;
647
648 /* Flag bits */
649 #define READABLE_LOCAL_CLOCK 0x00000001
650 #define CLOCK_NETWORK_DERIVED 0x00000002
651 #define CLOCK_PRECISION 0x00000004
652 #define RECEIVE_TIME_INDICATION_CAPABLE 0x00000008
653 #define TIMED_SEND_CAPABLE 0x00000010
654 #define TIME_STAMP_CAPABLE 0x00000020
655
656 /* NDIS packet filter bits (OID_GEN_CURRENT_PACKET_FILTER) */
657 #define NDIS_PACKET_TYPE_DIRECTED 0x00000001
658 #define NDIS_PACKET_TYPE_MULTICAST 0x00000002
659 #define NDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004
660 #define NDIS_PACKET_TYPE_BROADCAST 0x00000008
661 #define NDIS_PACKET_TYPE_SOURCE_ROUTING 0x00000010
662 #define NDIS_PACKET_TYPE_PROMISCUOUS 0x00000020
663 #define NDIS_PACKET_TYPE_SMT 0x00000040
664 #define NDIS_PACKET_TYPE_ALL_LOCAL 0x00000080
665 #define NDIS_PACKET_TYPE_GROUP 0x00001000
666 #define NDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x00002000
667 #define NDIS_PACKET_TYPE_FUNCTIONAL 0x00004000
668 #define NDIS_PACKET_TYPE_MAC_FRAME 0x00008000
669
670 /* NDIS protocol option bits (OID_GEN_PROTOCOL_OPTIONS) */
671 #define NDIS_PROT_OPTION_ESTIMATED_LENGTH 0x00000001
672 #define NDIS_PROT_OPTION_NO_LOOPBACK 0x00000002
673 #define NDIS_PROT_OPTION_NO_RSVD_ON_RCVPKT 0x00000004
674
675 /* NDIS MAC option bits (OID_GEN_MAC_OPTIONS) */
676 #define NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA 0x00000001
677 #define NDIS_MAC_OPTION_RECEIVE_SERIALIZED 0x00000002
678 #define NDIS_MAC_OPTION_TRANSFERS_NOT_PEND 0x00000004
679 #define NDIS_MAC_OPTION_NO_LOOPBACK 0x00000008
680 #define NDIS_MAC_OPTION_FULL_DUPLEX 0x00000010
681 #define NDIS_MAC_OPTION_EOTX_INDICATION 0x00000020
682 #define NDIS_MAC_OPTION_8021P_PRIORITY 0x00000040
683 #define NDIS_MAC_OPTION_RESERVED 0x80000000
684
685 #define NDIS_GUID_TO_OID 0x00000001
686 #define NDIS_GUID_TO_STATUS 0x00000002
687 #define NDIS_GUID_ANSI_STRING 0x00000004
688 #define NDIS_GUID_UNICODE_STRING 0x00000008
689 #define NDIS_GUID_ARRAY 0x00000010
690
691 #if NDIS_LEGACY_DRIVER
692
693 /* NDIS_PACKET_PRIVATE.Flags constants */
694 #define fPACKET_WRAPPER_RESERVED 0x3f
695 #define fPACKET_CONTAINS_MEDIA_SPECIFIC_INFO 0x40
696 #define fPACKET_ALLOCATED_BY_NDIS 0x80
697
698 #define NDIS_FLAGS_PROTOCOL_ID_MASK 0x0000000f
699 #define NDIS_FLAGS_MULTICAST_PACKET 0x00000010
700 #define NDIS_FLAGS_RESERVED2 0x00000020
701 #define NDIS_FLAGS_RESERVED3 0x00000040
702 #define NDIS_FLAGS_DONT_LOOPBACK 0x00000080
703 #define NDIS_FLAGS_IS_LOOPBACK_PACKET 0x00000100
704 #define NDIS_FLAGS_LOOPBACK_ONLY 0x00000200
705 #define NDIS_FLAGS_RESERVED4 0x00000400
706 #define NDIS_FLAGS_DOUBLE_BUFFERED 0x00000800
707 #define NDIS_FLAGS_SENT_AT_DPC 0x00001000
708 #define NDIS_FLAGS_USES_SG_BUFFER_LIST 0x00002000
709 #define NDIS_FLAGS_USES_ORIGINAL_PACKET 0x00004000
710 #define NDIS_FLAGS_PADDED 0x00010000
711 #define NDIS_FLAGS_XLATE_AT_TOP 0x00020000
712
713 typedef NDIS_HANDLE PNDIS_PACKET_POOL;
714
715 typedef struct _NDIS_PACKET_PRIVATE {
716 UINT PhysicalCount;
717 UINT TotalLength;
718 PNDIS_BUFFER Head;
719 PNDIS_BUFFER Tail;
720 PNDIS_PACKET_POOL Pool;
721 UINT Count;
722 ULONG Flags;
723 BOOLEAN ValidCounts;
724 UCHAR NdisPacketFlags;
725 USHORT NdisPacketOobOffset;
726 } NDIS_PACKET_PRIVATE, *PNDIS_PACKET_PRIVATE;
727
728 typedef struct _NDIS_PACKET {
729 NDIS_PACKET_PRIVATE Private;
730 __MINGW_EXTENSION union {
731 __MINGW_EXTENSION struct {
732 UCHAR MiniportReserved[2 * sizeof(PVOID)];
733 UCHAR WrapperReserved[2 * sizeof(PVOID)];
734 };
735 __MINGW_EXTENSION struct {
736 UCHAR MiniportReservedEx[3 * sizeof(PVOID)];
737 UCHAR WrapperReservedEx[sizeof(PVOID)];
738 };
739 __MINGW_EXTENSION struct {
740 UCHAR MacReserved[4 * sizeof(PVOID)];
741 };
742 };
743 ULONG_PTR Reserved[2];
744 UCHAR ProtocolReserved[1];
745 } NDIS_PACKET, *PNDIS_PACKET, **PPNDIS_PACKET;
746
747 typedef struct _NDIS_PACKET_STACK {
748 ULONG_PTR IMReserved[2];
749 ULONG_PTR NdisReserved[4];
750 } NDIS_PACKET_STACK, *PNDIS_PACKET_STACK;
751
752 #endif /* NDIS_LEGACY_DRIVER */
753
754 typedef enum _NDIS_CLASS_ID {
755 NdisClass802_3Priority,
756 NdisClassWirelessWanMbxMailbox,
757 NdisClassIrdaPacketInfo,
758 NdisClassAtmAALInfo
759 } NDIS_CLASS_ID;
760
761 typedef struct _MEDIA_SPECIFIC_INFORMATION {
762 UINT NextEntryOffset;
763 NDIS_CLASS_ID ClassId;
764 UINT Size;
765 UCHAR ClassInformation[1];
766 } MEDIA_SPECIFIC_INFORMATION, *PMEDIA_SPECIFIC_INFORMATION;
767
768 #if NDIS_LEGACY_DRIVER
769 typedef struct _NDIS_PACKET_OOB_DATA {
770 __MINGW_EXTENSION union {
771 ULONGLONG TimeToSend;
772 ULONGLONG TimeSent;
773 };
774 ULONGLONG TimeReceived;
775 UINT HeaderSize;
776 UINT SizeMediaSpecificInfo;
777 PVOID MediaSpecificInformation;
778 NDIS_STATUS Status;
779 } NDIS_PACKET_OOB_DATA, *PNDIS_PACKET_OOB_DATA;
780 #endif
781
782 /* Request types used by NdisRequest */
783 typedef enum _NDIS_REQUEST_TYPE {
784 NdisRequestQueryInformation,
785 NdisRequestSetInformation,
786 NdisRequestQueryStatistics,
787 NdisRequestOpen,
788 NdisRequestClose,
789 NdisRequestSend,
790 NdisRequestTransferData,
791 NdisRequestReset,
792 NdisRequestGeneric1,
793 NdisRequestGeneric2,
794 NdisRequestGeneric3,
795 NdisRequestGeneric4,
796 #if NDIS_SUPPORT_NDIS6
797 NdisRequestMethod,
798 #endif
799 } NDIS_REQUEST_TYPE, *PNDIS_REQUEST_TYPE;
800
801 #if NDIS_LEGACY_DRIVER
802 typedef struct _NDIS_REQUEST {
803 UCHAR MacReserved[4 * sizeof(PVOID)];
804 NDIS_REQUEST_TYPE RequestType;
805 union _DATA {
806 struct QUERY_INFORMATION {
807 NDIS_OID Oid;
808 PVOID InformationBuffer;
809 UINT InformationBufferLength;
810 UINT BytesWritten;
811 UINT BytesNeeded;
812 } QUERY_INFORMATION;
813 struct SET_INFORMATION {
814 NDIS_OID Oid;
815 PVOID InformationBuffer;
816 UINT InformationBufferLength;
817 UINT BytesRead;
818 UINT BytesNeeded;
819 } SET_INFORMATION;
820 } DATA;
821 #if (defined(NDIS50) || defined(NDIS51) || defined(NDIS50_MINIPORT) || defined(NDIS51_MINIPORT))
822 UCHAR NdisReserved[9 * sizeof(PVOID)];
823 __MINGW_EXTENSION union {
824 UCHAR CallMgrReserved[2 * sizeof(PVOID)];
825 UCHAR ProtocolReserved[2 * sizeof(PVOID)];
826 };
827 UCHAR MiniportReserved[2 * sizeof(PVOID)];
828 #endif
829 } NDIS_REQUEST, *PNDIS_REQUEST;
830 #endif /* NDIS_LEGACY_DRIVER */
831
832 /* Wide Area Networks definitions */
833
834 #if NDIS_LEGACY_DRIVER
835 typedef struct _NDIS_WAN_PACKET {
836 LIST_ENTRY WanPacketQueue;
837 PUCHAR CurrentBuffer;
838 ULONG CurrentLength;
839 PUCHAR StartBuffer;
840 PUCHAR EndBuffer;
841 PVOID ProtocolReserved1;
842 PVOID ProtocolReserved2;
843 PVOID ProtocolReserved3;
844 PVOID ProtocolReserved4;
845 PVOID MacReserved1;
846 PVOID MacReserved2;
847 PVOID MacReserved3;
848 PVOID MacReserved4;
849 } NDIS_WAN_PACKET, *PNDIS_WAN_PACKET;
850 #endif
851
852 /* DMA channel information */
853
854 typedef struct _NDIS_DMA_DESCRIPTION {
855 BOOLEAN DemandMode;
856 BOOLEAN AutoInitialize;
857 BOOLEAN DmaChannelSpecified;
858 DMA_WIDTH DmaWidth;
859 DMA_SPEED DmaSpeed;
860 ULONG DmaPort;
861 ULONG DmaChannel;
862 } NDIS_DMA_DESCRIPTION, *PNDIS_DMA_DESCRIPTION;
863
864 typedef struct _NDIS_DMA_BLOCK {
865 PVOID MapRegisterBase;
866 KEVENT AllocationEvent;
867 PADAPTER_OBJECT SystemAdapterObject;
868 PVOID Miniport;
869 BOOLEAN InProgress;
870 } NDIS_DMA_BLOCK, *PNDIS_DMA_BLOCK;
871
872 typedef UCHAR NDIS_DMA_SIZE;
873
874 #define NDIS_DMA_24BITS ((NDIS_DMA_SIZE)0)
875 #define NDIS_DMA_32BITS ((NDIS_DMA_SIZE)1)
876 #define NDIS_DMA_64BITS ((NDIS_DMA_SIZE)2)
877
878 typedef enum _NDIS_PROCESSOR_TYPE {
879 NdisProcessorX86,
880 NdisProcessorMips,
881 NdisProcessorAlpha,
882 NdisProcessorPpc,
883 NdisProcessorAmd64,
884 NdisProcessorIA64
885 } NDIS_PROCESSOR_TYPE, *PNDIS_PROCESSOR_TYPE;
886
887 typedef enum _NDIS_ENVIRONMENT_TYPE {
888 NdisEnvironmentWindows,
889 NdisEnvironmentWindowsNt
890 } NDIS_ENVIRONMENT_TYPE, *PNDIS_ENVIRONMENT_TYPE;
891
892 /* Possible hardware architecture */
893 typedef enum _NDIS_INTERFACE_TYPE {
894 NdisInterfaceInternal = Internal,
895 NdisInterfaceIsa = Isa,
896 NdisInterfaceEisa = Eisa,
897 NdisInterfaceMca = MicroChannel,
898 NdisInterfaceTurboChannel = TurboChannel,
899 NdisInterfacePci = PCIBus,
900 NdisInterfacePcMcia = PCMCIABus,
901 NdisInterfaceCBus = CBus,
902 NdisInterfaceMPIBus = MPIBus,
903 NdisInterfaceMPSABus = MPSABus,
904 NdisInterfaceProcessorInternal = ProcessorInternal,
905 NdisInterfaceInternalPowerBus = InternalPowerBus,
906 NdisInterfacePNPISABus = PNPISABus,
907 NdisInterfacePNPBus = PNPBus,
908 NdisInterfaceUSB,
909 NdisInterfaceIrda,
910 NdisInterface1394,
911 NdisMaximumInterfaceType
912 } NDIS_INTERFACE_TYPE, *PNDIS_INTERFACE_TYPE;
913
914 #define NdisInterruptLevelSensitive LevelSensitive
915 #define NdisInterruptLatched Latched
916
917 typedef KINTERRUPT_MODE NDIS_INTERRUPT_MODE, *PNDIS_INTERRUPT_MODE;
918
919 typedef enum _NDIS_PARAMETER_TYPE {
920 NdisParameterInteger,
921 NdisParameterHexInteger,
922 NdisParameterString,
923 NdisParameterMultiString,
924 NdisParameterBinary
925 } NDIS_PARAMETER_TYPE, *PNDIS_PARAMETER_TYPE;
926
927 typedef struct _BINARY_DATA {
928 USHORT Length;
929 PVOID Buffer;
930 } BINARY_DATA;
931
932 typedef struct _NDIS_CONFIGURATION_PARAMETER {
933 NDIS_PARAMETER_TYPE ParameterType;
934 union {
935 ULONG IntegerData;
936 NDIS_STRING StringData;
937 BINARY_DATA BinaryData;
938 } ParameterData;
939 } NDIS_CONFIGURATION_PARAMETER, *PNDIS_CONFIGURATION_PARAMETER;
940
941 typedef PHYSICAL_ADDRESS NDIS_PHYSICAL_ADDRESS, *PNDIS_PHYSICAL_ADDRESS;
942
943 typedef struct _NDIS_PHYSICAL_ADDRESS_UNIT {
944 NDIS_PHYSICAL_ADDRESS PhysicalAddress;
945 UINT Length;
946 } NDIS_PHYSICAL_ADDRESS_UNIT, *PNDIS_PHYSICAL_ADDRESS_UNIT;
947
948 typedef struct _NDIS_WAN_LINE_DOWN {
949 UCHAR RemoteAddress[6];
950 UCHAR LocalAddress[6];
951 } NDIS_WAN_LINE_DOWN, *PNDIS_WAN_LINE_DOWN;
952
953 typedef struct _NDIS_WAN_LINE_UP {
954 ULONG LinkSpeed;
955 ULONG MaximumTotalSize;
956 NDIS_WAN_QUALITY Quality;
957 USHORT SendWindow;
958 UCHAR RemoteAddress[6];
959 OUT UCHAR LocalAddress[6];
960 ULONG ProtocolBufferLength;
961 PUCHAR ProtocolBuffer;
962 USHORT ProtocolType;
963 NDIS_STRING DeviceName;
964 } NDIS_WAN_LINE_UP, *PNDIS_WAN_LINE_UP;
965
966 typedef NTSTATUS
967 (NTAPI *TDI_REGISTER_CALLBACK)(
968 IN PUNICODE_STRING DeviceName,
969 OUT HANDLE *TdiHandle);
970
971 typedef NTSTATUS
972 (NTAPI *TDI_PNP_HANDLER)(
973 IN PUNICODE_STRING UpperComponent,
974 IN PUNICODE_STRING LowerComponent,
975 IN PUNICODE_STRING BindList,
976 IN PVOID ReconfigBuffer,
977 IN UINT ReconfigBufferSize,
978 IN UINT Operation);
979
980 typedef struct _OID_LIST OID_LIST, *POID_LIST;
981
982 /* PnP state */
983
984 typedef enum _NDIS_PNP_DEVICE_STATE {
985 NdisPnPDeviceAdded,
986 NdisPnPDeviceStarted,
987 NdisPnPDeviceQueryStopped,
988 NdisPnPDeviceStopped,
989 NdisPnPDeviceQueryRemoved,
990 NdisPnPDeviceRemoved,
991 NdisPnPDeviceSurpriseRemoved
992 } NDIS_PNP_DEVICE_STATE;
993
994 #define NDIS_DEVICE_NOT_STOPPABLE 0x00000001
995 #define NDIS_DEVICE_NOT_REMOVEABLE 0x00000002
996 #define NDIS_DEVICE_NOT_SUSPENDABLE 0x00000004
997 #define NDIS_DEVICE_DISABLE_PM 0x00000008
998 #define NDIS_DEVICE_DISABLE_WAKE_UP 0x00000010
999 #define NDIS_DEVICE_DISABLE_WAKE_ON_RECONNECT 0x00000020
1000 #define NDIS_DEVICE_RESERVED 0x00000040
1001 #define NDIS_DEVICE_DISABLE_WAKE_ON_MAGIC_PACKET 0x00000080
1002 #define NDIS_DEVICE_DISABLE_WAKE_ON_PATTERN_MATCH 0x00000100
1003
1004 /* Protocol types supported by NDIS */
1005 #define NDIS_PROTOCOL_ID_DEFAULT 0x00
1006 #define NDIS_PROTOCOL_ID_TCP_IP 0x02
1007 #define NDIS_PROTOCOL_ID_IPX 0x06
1008 #define NDIS_PROTOCOL_ID_NBF 0x07
1009 #define NDIS_PROTOCOL_ID_MAX 0x0F
1010 #define NDIS_PROTOCOL_ID_MASK 0x0F
1011
1012 typedef ULONG NDIS_AF, *PNDIS_AF;
1013
1014 #define CO_ADDRESS_FAMILY_Q2931 ((NDIS_AF)0x1)
1015 #define CO_ADDRESS_FAMILY_PSCHED ((NDIS_AF)0x2)
1016 #define CO_ADDRESS_FAMILY_L2TP ((NDIS_AF)0x3)
1017 #define CO_ADDRESS_FAMILY_IRDA ((NDIS_AF)0x4)
1018 #define CO_ADDRESS_FAMILY_1394 ((NDIS_AF)0x5)
1019 #define CO_ADDRESS_FAMILY_PPP ((NDIS_AF)0x6)
1020 #define CO_ADDRESS_FAMILY_INFINIBAND ((NDIS_AF)0x7)
1021 #define CO_ADDRESS_FAMILY_TAPI ((NDIS_AF)0x800)
1022 #define CO_ADDRESS_FAMILY_TAPI_PROXY ((NDIS_AF)0x801)
1023
1024 #define CO_ADDRESS_FAMILY_PROXY 0x80000000
1025
1026 typedef struct _CO_ADDRESS_FAMILY {
1027 NDIS_AF AddressFamily;
1028 ULONG MajorVersion;
1029 ULONG MinorVersion;
1030 } CO_ADDRESS_FAMILY, *PCO_ADDRESS_FAMILY;
1031
1032 typedef struct _CO_SPECIFIC_PARAMETERS {
1033 ULONG ParamType;
1034 ULONG Length;
1035 UCHAR Parameters[1];
1036 } CO_SPECIFIC_PARAMETERS, *PCO_SPECIFIC_PARAMETERS;
1037
1038 typedef struct _CO_CALL_MANAGER_PARAMETERS {
1039 FLOWSPEC Transmit;
1040 FLOWSPEC Receive;
1041 CO_SPECIFIC_PARAMETERS CallMgrSpecific;
1042 } CO_CALL_MANAGER_PARAMETERS, *PCO_CALL_MANAGER_PARAMETERS;
1043
1044 /* CO_MEDIA_PARAMETERS.Flags constants */
1045 #define RECEIVE_TIME_INDICATION 0x00000001
1046 #define USE_TIME_STAMPS 0x00000002
1047 #define TRANSMIT_VC 0x00000004
1048 #define RECEIVE_VC 0x00000008
1049 #define INDICATE_ERRED_PACKETS 0x00000010
1050 #define INDICATE_END_OF_TX 0x00000020
1051 #define RESERVE_RESOURCES_VC 0x00000040
1052 #define ROUND_DOWN_FLOW 0x00000080
1053 #define ROUND_UP_FLOW 0x00000100
1054
1055 typedef struct _CO_MEDIA_PARAMETERS {
1056 ULONG Flags;
1057 ULONG ReceivePriority;
1058 ULONG ReceiveSizeHint;
1059 CO_SPECIFIC_PARAMETERS MediaSpecific;
1060 } CO_MEDIA_PARAMETERS, *PCO_MEDIA_PARAMETERS;
1061
1062 /* CO_CALL_PARAMETERS.Flags constants */
1063 #define PERMANENT_VC 0x00000001
1064 #define CALL_PARAMETERS_CHANGED 0x00000002
1065 #define QUERY_CALL_PARAMETERS 0x00000004
1066 #define BROADCAST_VC 0x00000008
1067 #define MULTIPOINT_VC 0x00000010
1068
1069 typedef struct _CO_CALL_PARAMETERS {
1070 ULONG Flags;
1071 PCO_CALL_MANAGER_PARAMETERS CallMgrParameters;
1072 PCO_MEDIA_PARAMETERS MediaParameters;
1073 } CO_CALL_PARAMETERS, *PCO_CALL_PARAMETERS;
1074
1075 typedef struct _CO_SAP {
1076 ULONG SapType;
1077 ULONG SapLength;
1078 UCHAR Sap[1];
1079 } CO_SAP, *PCO_SAP;
1080
1081 #if NDIS_LEGACY_DRIVER
1082 typedef struct _NDIS_IPSEC_PACKET_INFO {
1083 __MINGW_EXTENSION union {
1084 struct {
1085 NDIS_HANDLE OffloadHandle;
1086 NDIS_HANDLE NextOffloadHandle;
1087 } Transmit;
1088 struct {
1089 ULONG SA_DELETE_REQ:1;
1090 ULONG CRYPTO_DONE:1;
1091 ULONG NEXT_CRYPTO_DONE:1;
1092 ULONG CryptoStatus;
1093 } Receive;
1094 };
1095 } NDIS_IPSEC_PACKET_INFO, *PNDIS_IPSEC_PACKET_INFO;
1096 #endif
1097
1098 #if (NDIS_SUPPORT_NDIS6 || NDIS60)
1099 typedef struct _NDIS_IPSEC_OFFLOAD_V1_NET_BUFFER_LIST_INFO {
1100 __MINGW_EXTENSION union {
1101 struct {
1102 NDIS_HANDLE OffloadHandle;
1103 } Transmit;
1104 struct {
1105 USHORT SaDeleteReq:1;
1106 USHORT CryptoDone:1;
1107 USHORT NextCryptoDone:1;
1108 USHORT Pad:13;
1109 USHORT CryptoStatus;
1110 } Receive;
1111 };
1112 } NDIS_IPSEC_OFFLOAD_V1_NET_BUFFER_LIST_INFO, *PNDIS_IPSEC_OFFLOAD_V1_NET_BUFFER_LIST_INFO;
1113 #endif
1114
1115 /* NDIS_MAC_FRAGMENT.Errors constants */
1116 #define WAN_ERROR_CRC 0x00000001
1117 #define WAN_ERROR_FRAMING 0x00000002
1118 #define WAN_ERROR_HARDWAREOVERRUN 0x00000004
1119 #define WAN_ERROR_BUFFEROVERRUN 0x00000008
1120 #define WAN_ERROR_TIMEOUT 0x00000010
1121 #define WAN_ERROR_ALIGNMENT 0x00000020
1122
1123 typedef struct _NDIS_MAC_FRAGMENT {
1124 NDIS_HANDLE NdisLinkContext;
1125 ULONG Errors;
1126 } NDIS_MAC_FRAGMENT, *PNDIS_MAC_FRAGMENT;
1127
1128 typedef struct _NDIS_MAC_LINE_DOWN {
1129 NDIS_HANDLE NdisLinkContext;
1130 } NDIS_MAC_LINE_DOWN, *PNDIS_MAC_LINE_DOWN;
1131
1132 typedef struct _NDIS_MAC_LINE_UP {
1133 ULONG LinkSpeed;
1134 NDIS_WAN_QUALITY Quality;
1135 USHORT SendWindow;
1136 NDIS_HANDLE ConnectionWrapperID;
1137 NDIS_HANDLE NdisLinkHandle;
1138 NDIS_HANDLE NdisLinkContext;
1139 } NDIS_MAC_LINE_UP, *PNDIS_MAC_LINE_UP;
1140
1141 typedef struct _NDIS_PACKET_8021Q_INFO {
1142 __MINGW_EXTENSION union {
1143 struct {
1144 UINT32 UserPriority:3;
1145 UINT32 CanonicalFormatId:1;
1146 UINT32 VlanId:12;
1147 UINT32 Reserved:16;
1148 } TagHeader;
1149 PVOID Value;
1150 };
1151 } NDIS_PACKET_8021Q_INFO, *PNDIS_PACKET_8021Q_INFO;
1152
1153 typedef enum _NDIS_PER_PACKET_INFO {
1154 TcpIpChecksumPacketInfo,
1155 IpSecPacketInfo,
1156 TcpLargeSendPacketInfo,
1157 ClassificationHandlePacketInfo,
1158 NdisReserved,
1159 ScatterGatherListPacketInfo,
1160 Ieee8021QInfo,
1161 OriginalPacketInfo,
1162 PacketCancelId,
1163 OriginalNetBufferList,
1164 CachedNetBufferList,
1165 ShortPacketPaddingInfo,
1166 MaxPerPacketInfo
1167 } NDIS_PER_PACKET_INFO, *PNDIS_PER_PACKET_INFO;
1168
1169 #if NDIS_LEGACY_DRIVER
1170
1171 typedef struct _NDIS_PACKET_EXTENSION {
1172 PVOID NdisPacketInfo[MaxPerPacketInfo];
1173 } NDIS_PACKET_EXTENSION, *PNDIS_PACKET_EXTENSION;
1174
1175 typedef enum _NDIS_TASK {
1176 TcpIpChecksumNdisTask,
1177 IpSecNdisTask,
1178 TcpLargeSendNdisTask,
1179 MaxNdisTask
1180 } NDIS_TASK, *PNDIS_TASK;
1181
1182 typedef enum _NDIS_ENCAPSULATION {
1183 UNSPECIFIED_Encapsulation,
1184 NULL_Encapsulation,
1185 IEEE_802_3_Encapsulation,
1186 IEEE_802_5_Encapsulation,
1187 LLC_SNAP_ROUTED_Encapsulation,
1188 LLC_SNAP_BRIDGED_Encapsulation
1189 } NDIS_ENCAPSULATION;
1190
1191 typedef struct _NDIS_ENCAPSULATION_FORMAT {
1192 NDIS_ENCAPSULATION Encapsulation;
1193 struct {
1194 ULONG FixedHeaderSize:1;
1195 ULONG Reserved:31;
1196 } Flags;
1197 ULONG EncapsulationHeaderSize;
1198 } NDIS_ENCAPSULATION_FORMAT, *PNDIS_ENCAPSULATION_FORMAT;
1199
1200 typedef struct _NDIS_TASK_OFFLOAD_HEADER {
1201 ULONG Version;
1202 ULONG Size;
1203 ULONG Reserved;
1204 ULONG OffsetFirstTask;
1205 NDIS_ENCAPSULATION_FORMAT EncapsulationFormat;
1206 } NDIS_TASK_OFFLOAD_HEADER, *PNDIS_TASK_OFFLOAD_HEADER;
1207
1208 typedef struct _NDIS_TASK_OFFLOAD {
1209 ULONG Version;
1210 ULONG Size;
1211 NDIS_TASK Task;
1212 ULONG OffsetNextTask;
1213 ULONG TaskBufferLength;
1214 UCHAR TaskBuffer[1];
1215 } NDIS_TASK_OFFLOAD, *PNDIS_TASK_OFFLOAD;
1216
1217 typedef struct _NDIS_TASK_TCP_IP_CHECKSUM {
1218 struct {
1219 ULONG IpOptionsSupported:1;
1220 ULONG TcpOptionsSupported:1;
1221 ULONG TcpChecksum:1;
1222 ULONG UdpChecksum:1;
1223 ULONG IpChecksum:1;
1224 } V4Transmit;
1225 struct {
1226 ULONG IpOptionsSupported:1;
1227 ULONG TcpOptionsSupported:1;
1228 ULONG TcpChecksum:1;
1229 ULONG UdpChecksum:1;
1230 ULONG IpChecksum:1;
1231 } V4Receive;
1232 struct {
1233 ULONG IpOptionsSupported:1;
1234 ULONG TcpOptionsSupported:1;
1235 ULONG TcpChecksum:1;
1236 ULONG UdpChecksum:1;
1237 } V6Transmit;
1238 struct {
1239 ULONG IpOptionsSupported:1;
1240 ULONG TcpOptionsSupported:1;
1241 ULONG TcpChecksum:1;
1242 ULONG UdpChecksum:1;
1243 } V6Receive;
1244 } NDIS_TASK_TCP_IP_CHECKSUM, *PNDIS_TASK_TCP_IP_CHECKSUM;
1245
1246 #define NDIS_TASK_TCP_LARGE_SEND_V0 0
1247
1248 typedef struct _NDIS_TASK_TCP_LARGE_SEND {
1249 ULONG Version;
1250 ULONG MaxOffLoadSize;
1251 ULONG MinSegmentCount;
1252 BOOLEAN TcpOptions;
1253 BOOLEAN IpOptions;
1254 } NDIS_TASK_TCP_LARGE_SEND, *PNDIS_TASK_TCP_LARGE_SEND;
1255
1256 typedef struct _NDIS_TASK_IPSEC {
1257 struct {
1258 ULONG AH_ESP_COMBINED;
1259 ULONG TRANSPORT_TUNNEL_COMBINED;
1260 ULONG V4_OPTIONS;
1261 ULONG RESERVED;
1262 } Supported;
1263 struct {
1264 ULONG MD5:1;
1265 ULONG SHA_1:1;
1266 ULONG Transport:1;
1267 ULONG Tunnel:1;
1268 ULONG Send:1;
1269 ULONG Receive:1;
1270 } V4AH;
1271 struct {
1272 ULONG DES:1;
1273 ULONG RESERVED:1;
1274 ULONG TRIPLE_DES:1;
1275 ULONG NULL_ESP:1;
1276 ULONG Transport:1;
1277 ULONG Tunnel:1;
1278 ULONG Send:1;
1279 ULONG Receive:1;
1280 } V4ESP;
1281 } NDIS_TASK_IPSEC, *PNDIS_TASK_IPSEC;
1282
1283 #endif /* NDIS_LEGACY_DRIVER */
1284
1285 #define IPSEC_TPT_UDPESP_ENCAPTYPE_IKE 0x00000001
1286 #define IPSEC_TUN_UDPESP_ENCAPTYPE_IKE 0x00000002
1287 #define IPSEC_TPTOVERTUN_UDPESP_ENCAPTYPE_IKE 0x00000004
1288 #define IPSEC_TPT_UDPESP_OVER_PURE_TUN_ENCAPTYPE_IKE 0x00000008
1289 #define IPSEC_TPT_UDPESP_ENCAPTYPE_OTHER 0x00000010
1290 #define IPSEC_TUN_UDPESP_ENCAPTYPE_OTHER 0x00000020
1291 #define IPSEC_TPTOVERTUN_UDPESP_ENCAPTYPE_OTHER 0x00000040
1292 #define IPSEC_TPT_UDPESP_OVER_PURE_TUN_ENCAPTYPE_OTHER 0x00000080
1293
1294 #if NDIS_LEGACY_DRIVER
1295
1296 /*
1297 * PNDIS_PACKET
1298 * NDIS_GET_ORIGINAL_PACKET(
1299 * IN PNDIS_PACKET Packet);
1300 */
1301 #define NDIS_GET_ORIGINAL_PACKET(Packet) \
1302 NDIS_PER_PACKET_INFO_FROM_PACKET(Packet, OriginalPacketInfo)
1303
1304 /*
1305 * PVOID
1306 * NDIS_GET_PACKET_CANCEL_ID(
1307 * IN PNDIS_PACKET Packet);
1308 */
1309 #define NDIS_GET_PACKET_CANCEL_ID(Packet) \
1310 NDIS_PER_PACKET_INFO_FROM_PACKET(Packet, PacketCancelId)
1311
1312 /*
1313 * PNDIS_PACKET_EXTENSION
1314 * NDIS_PACKET_EXTENSION_FROM_PACKET(
1315 * IN PNDIS_PACKET Packet);
1316 */
1317 #define NDIS_PACKET_EXTENSION_FROM_PACKET(Packet) \
1318 ((PNDIS_PACKET_EXTENSION)((PUCHAR)(Packet) \
1319 + (Packet)->Private.NdisPacketOobOffset + sizeof(NDIS_PACKET_OOB_DATA)))
1320
1321 /*
1322 * PVOID
1323 * NDIS_PER_PACKET_INFO_FROM_PACKET(
1324 * IN OUT PNDIS_PACKET Packet,
1325 * IN NDIS_PER_PACKET_INFO InfoType);
1326 */
1327 #define NDIS_PER_PACKET_INFO_FROM_PACKET(Packet, InfoType) \
1328 ((PNDIS_PACKET_EXTENSION)((PUCHAR)(Packet) + (Packet)->Private.NdisPacketOobOffset \
1329 + sizeof(NDIS_PACKET_OOB_DATA)))->NdisPacketInfo[(InfoType)]
1330
1331 /*
1332 * VOID
1333 * NDIS_SET_ORIGINAL_PACKET(
1334 * IN OUT PNDIS_PACKET Packet,
1335 * IN PNDIS_PACKET OriginalPacket);
1336 */
1337 #define NDIS_SET_ORIGINAL_PACKET(Packet, OriginalPacket) \
1338 NDIS_PER_PACKET_INFO_FROM_PACKET(Packet, OriginalPacketInfo) = (OriginalPacket)
1339
1340 /*
1341 * VOID
1342 * NDIS_SET_PACKET_CANCEL_ID(
1343 * IN PNDIS_PACKET Packet
1344 * IN ULONG_PTR CancelId);
1345 */
1346 #define NDIS_SET_PACKET_CANCEL_ID(Packet, CancelId) \
1347 NDIS_PER_PACKET_INFO_FROM_PACKET(Packet, PacketCancelId) = (CancelId)
1348
1349 #define NdisSetPacketCancelId(_Packet, _CancelId) NDIS_SET_PACKET_CANCEL_ID(_Packet, _CancelId)
1350 #define NdisGetPacketCancelId(_Packet) NDIS_GET_PACKET_CANCEL_ID(_Packet)
1351
1352 #endif /* NDIS_LEGACY_DRIVER */
1353
1354 #if NDIS_SUPPORT_NDIS6
1355 typedef struct _NDIS_GENERIC_OBJECT {
1356 NDIS_OBJECT_HEADER Header;
1357 PVOID Caller;
1358 PVOID CallersCaller;
1359 PDRIVER_OBJECT DriverObject;
1360 } NDIS_GENERIC_OBJECT, *PNDIS_GENERIC_OBJECT;
1361 #endif
1362
1363 /* NDIS_TASK_OFFLOAD_HEADER.Version constants */
1364 #define NDIS_TASK_OFFLOAD_VERSION 1
1365
1366 #define MAX_HASHES 4
1367 #define TRUNCATED_HASH_LEN 12
1368
1369 #define CRYPTO_SUCCESS 0
1370 #define CRYPTO_GENERIC_ERROR 1
1371 #define CRYPTO_TRANSPORT_AH_AUTH_FAILED 2
1372 #define CRYPTO_TRANSPORT_ESP_AUTH_FAILED 3
1373 #define CRYPTO_TUNNEL_AH_AUTH_FAILED 4
1374 #define CRYPTO_TUNNEL_ESP_AUTH_FAILED 5
1375 #define CRYPTO_INVALID_PACKET_SYNTAX 6
1376 #define CRYPTO_INVALID_PROTOCOL 7
1377
1378 typedef struct _NDIS_TCP_IP_CHECKSUM_PACKET_INFO {
1379 __MINGW_EXTENSION union {
1380 struct {
1381 ULONG NdisPacketChecksumV4:1;
1382 ULONG NdisPacketChecksumV6:1;
1383 ULONG NdisPacketTcpChecksum:1;
1384 ULONG NdisPacketUdpChecksum:1;
1385 ULONG NdisPacketIpChecksum:1;
1386 } Transmit;
1387 struct {
1388 ULONG NdisPacketTcpChecksumFailed:1;
1389 ULONG NdisPacketUdpChecksumFailed:1;
1390 ULONG NdisPacketIpChecksumFailed:1;
1391 ULONG NdisPacketTcpChecksumSucceeded:1;
1392 ULONG NdisPacketUdpChecksumSucceeded:1;
1393 ULONG NdisPacketIpChecksumSucceeded:1;
1394 ULONG NdisPacketLoopback:1;
1395 } Receive;
1396 ULONG Value;
1397 };
1398 } NDIS_TCP_IP_CHECKSUM_PACKET_INFO, *PNDIS_TCP_IP_CHECKSUM_PACKET_INFO;
1399
1400 typedef struct _NDIS_WAN_CO_FRAGMENT {
1401 ULONG Errors;
1402 } NDIS_WAN_CO_FRAGMENT, *PNDIS_WAN_CO_FRAGMENT;
1403
1404 typedef struct _NDIS_WAN_FRAGMENT {
1405 UCHAR RemoteAddress[6];
1406 UCHAR LocalAddress[6];
1407 } NDIS_WAN_FRAGMENT, *PNDIS_WAN_FRAGMENT;
1408
1409 typedef struct _WAN_CO_LINKPARAMS {
1410 ULONG TransmitSpeed;
1411 ULONG ReceiveSpeed;
1412 ULONG SendWindow;
1413 } WAN_CO_LINKPARAMS, *PWAN_CO_LINKPARAMS;
1414
1415 typedef struct _NDIS_WAN_GET_STATS {
1416 UCHAR LocalAddress[6];
1417 ULONG BytesSent;
1418 ULONG BytesRcvd;
1419 ULONG FramesSent;
1420 ULONG FramesRcvd;
1421 ULONG CRCErrors;
1422 ULONG TimeoutErrors;
1423 ULONG AlignmentErrors;
1424 ULONG SerialOverrunErrors;
1425 ULONG FramingErrors;
1426 ULONG BufferOverrunErrors;
1427 ULONG BytesTransmittedUncompressed;
1428 ULONG BytesReceivedUncompressed;
1429 ULONG BytesTransmittedCompressed;
1430 ULONG BytesReceivedCompressed;
1431 } NDIS_WAN_GET_STATS, *PNDIS_WAN_GET_STATS;
1432
1433 /* Call Manager */
1434
1435 typedef VOID
1436 (NTAPI *CM_ACTIVATE_VC_COMPLETE_HANDLER)(
1437 IN NDIS_STATUS Status,
1438 IN NDIS_HANDLE CallMgrVcContext,
1439 IN PCO_CALL_PARAMETERS CallParameters);
1440
1441 typedef NDIS_STATUS
1442 (NTAPI *CM_ADD_PARTY_HANDLER)(
1443 IN NDIS_HANDLE CallMgrVcContext,
1444 IN OUT PCO_CALL_PARAMETERS CallParameters,
1445 IN NDIS_HANDLE NdisPartyHandle,
1446 OUT PNDIS_HANDLE CallMgrPartyContext);
1447
1448 typedef NDIS_STATUS
1449 (NTAPI *CM_CLOSE_AF_HANDLER)(
1450 IN NDIS_HANDLE CallMgrAfContext);
1451
1452 typedef NDIS_STATUS
1453 (NTAPI *CM_CLOSE_CALL_HANDLER)(
1454 IN NDIS_HANDLE CallMgrVcContext,
1455 IN NDIS_HANDLE CallMgrPartyContext OPTIONAL,
1456 IN PVOID CloseData OPTIONAL,
1457 IN UINT Size OPTIONAL);
1458
1459 typedef NDIS_STATUS
1460 (NTAPI *CM_DEREG_SAP_HANDLER)(
1461 IN NDIS_HANDLE CallMgrSapContext);
1462
1463 typedef VOID
1464 (NTAPI *CM_DEACTIVATE_VC_COMPLETE_HANDLER)(
1465 IN NDIS_STATUS Status,
1466 IN NDIS_HANDLE CallMgrVcContext);
1467
1468 typedef NDIS_STATUS
1469 (NTAPI *CM_DROP_PARTY_HANDLER)(
1470 IN NDIS_HANDLE CallMgrPartyContext,
1471 IN PVOID CloseData OPTIONAL,
1472 IN UINT Size OPTIONAL);
1473
1474 typedef VOID
1475 (NTAPI *CM_INCOMING_CALL_COMPLETE_HANDLER)(
1476 IN NDIS_STATUS Status,
1477 IN NDIS_HANDLE CallMgrVcContext,
1478 IN PCO_CALL_PARAMETERS CallParameters);
1479
1480 typedef NDIS_STATUS
1481 (NTAPI *CM_MAKE_CALL_HANDLER)(
1482 IN NDIS_HANDLE CallMgrVcContext,
1483 IN OUT PCO_CALL_PARAMETERS CallParameters,
1484 IN NDIS_HANDLE NdisPartyHandle OPTIONAL,
1485 OUT PNDIS_HANDLE CallMgrPartyContext OPTIONAL);
1486
1487 typedef NDIS_STATUS
1488 (NTAPI *CM_MODIFY_CALL_QOS_HANDLER)(
1489 IN NDIS_HANDLE CallMgrVcContext,
1490 IN PCO_CALL_PARAMETERS CallParameters);
1491
1492 typedef NDIS_STATUS
1493 (NTAPI *CM_OPEN_AF_HANDLER)(
1494 IN NDIS_HANDLE CallMgrBindingContext,
1495 IN PCO_ADDRESS_FAMILY AddressFamily,
1496 IN NDIS_HANDLE NdisAfHandle,
1497 OUT PNDIS_HANDLE CallMgrAfContext);
1498
1499 typedef NDIS_STATUS
1500 (NTAPI *CM_REG_SAP_HANDLER)(
1501 IN NDIS_HANDLE CallMgrAfContext,
1502 IN PCO_SAP Sap,
1503 IN NDIS_HANDLE NdisSapHandle,
1504 OUT PNDIS_HANDLE CallMgrSapContext);
1505
1506 typedef NDIS_STATUS
1507 (NTAPI *CO_CREATE_VC_HANDLER)(
1508 IN NDIS_HANDLE ProtocolAfContext,
1509 IN NDIS_HANDLE NdisVcHandle,
1510 OUT PNDIS_HANDLE ProtocolVcContext);
1511
1512 typedef NDIS_STATUS
1513 (NTAPI *CO_DELETE_VC_HANDLER)(
1514 IN NDIS_HANDLE ProtocolVcContext);
1515
1516 #define PROTOCOL_RESERVED_SIZE_IN_PACKET (4 * sizeof(PVOID))
1517
1518 /* Prototypes for NDIS 5.0 protocol characteristics */
1519
1520 typedef VOID
1521 (NTAPI *CO_SEND_COMPLETE_HANDLER)(
1522 IN NDIS_STATUS Status,
1523 IN NDIS_HANDLE ProtocolVcContext,
1524 IN PNDIS_PACKET Packet);
1525
1526 typedef VOID
1527 (NTAPI *CO_STATUS_HANDLER)(
1528 IN NDIS_HANDLE ProtocolBindingContext,
1529 IN NDIS_HANDLE ProtocolVcContext OPTIONAL,
1530 IN NDIS_STATUS GeneralStatus,
1531 IN PVOID StatusBuffer,
1532 IN UINT StatusBufferSize);
1533
1534 typedef UINT
1535 (NTAPI *CO_RECEIVE_PACKET_HANDLER)(
1536 IN NDIS_HANDLE ProtocolBindingContext,
1537 IN NDIS_HANDLE ProtocolVcContext,
1538 IN PNDIS_PACKET Packet);
1539
1540 typedef NDIS_STATUS
1541 (NTAPI *CO_REQUEST_HANDLER)(
1542 IN NDIS_HANDLE ProtocolAfContext,
1543 IN NDIS_HANDLE ProtocolVcContext OPTIONAL,
1544 IN NDIS_HANDLE ProtocolPartyContext OPTIONAL,
1545 IN OUT PNDIS_REQUEST NdisRequest);
1546
1547 typedef VOID
1548 (NTAPI *CO_REQUEST_COMPLETE_HANDLER)(
1549 IN NDIS_STATUS Status,
1550 IN NDIS_HANDLE ProtocolAfContext OPTIONAL,
1551 IN NDIS_HANDLE ProtocolVcContext OPTIONAL,
1552 IN NDIS_HANDLE ProtocolPartyContext OPTIONAL,
1553 IN PNDIS_REQUEST NdisRequest);
1554
1555 typedef struct _NDIS_CALL_MANAGER_CHARACTERISTICS {
1556 UCHAR MajorVersion;
1557 UCHAR MinorVersion;
1558 USHORT Filler;
1559 UINT Reserved;
1560 CO_CREATE_VC_HANDLER CmCreateVcHandler;
1561 CO_DELETE_VC_HANDLER CmDeleteVcHandler;
1562 CM_OPEN_AF_HANDLER CmOpenAfHandler;
1563 CM_CLOSE_AF_HANDLER CmCloseAfHandler;
1564 CM_REG_SAP_HANDLER CmRegisterSapHandler;
1565 CM_DEREG_SAP_HANDLER CmDeregisterSapHandler;
1566 CM_MAKE_CALL_HANDLER CmMakeCallHandler;
1567 CM_CLOSE_CALL_HANDLER CmCloseCallHandler;
1568 CM_INCOMING_CALL_COMPLETE_HANDLER CmIncomingCallCompleteHandler;
1569 CM_ADD_PARTY_HANDLER CmAddPartyHandler;
1570 CM_DROP_PARTY_HANDLER CmDropPartyHandler;
1571 CM_ACTIVATE_VC_COMPLETE_HANDLER CmActivateVcCompleteHandler;
1572 CM_DEACTIVATE_VC_COMPLETE_HANDLER CmDeactivateVcCompleteHandler;
1573 CM_MODIFY_CALL_QOS_HANDLER CmModifyCallQoSHandler;
1574 CO_REQUEST_HANDLER CmRequestHandler;
1575 CO_REQUEST_COMPLETE_HANDLER CmRequestCompleteHandler;
1576 } NDIS_CALL_MANAGER_CHARACTERISTICS, *PNDIS_CALL_MANAGER_CHARACTERISTICS;
1577
1578
1579
1580 /* Call Manager clients */
1581
1582 typedef VOID (*CL_OPEN_AF_COMPLETE_HANDLER)(
1583 IN NDIS_STATUS Status,
1584 IN NDIS_HANDLE ProtocolAfContext,
1585 IN NDIS_HANDLE NdisAfHandle);
1586
1587 typedef VOID
1588 (NTAPI *CL_CLOSE_AF_COMPLETE_HANDLER)(
1589 IN NDIS_STATUS Status,
1590 IN NDIS_HANDLE ProtocolAfContext);
1591
1592 typedef VOID
1593 (NTAPI *CL_REG_SAP_COMPLETE_HANDLER)(
1594 IN NDIS_STATUS Status,
1595 IN NDIS_HANDLE ProtocolSapContext,
1596 IN PCO_SAP Sap,
1597 IN NDIS_HANDLE NdisSapHandle);
1598
1599 typedef VOID
1600 (NTAPI *CL_DEREG_SAP_COMPLETE_HANDLER)(
1601 IN NDIS_STATUS Status,
1602 IN NDIS_HANDLE ProtocolSapContext);
1603
1604 typedef VOID
1605 (NTAPI *CL_MAKE_CALL_COMPLETE_HANDLER)(
1606 IN NDIS_STATUS Status,
1607 IN NDIS_HANDLE ProtocolVcContext,
1608 IN NDIS_HANDLE NdisPartyHandle OPTIONAL,
1609 IN PCO_CALL_PARAMETERS CallParameters);
1610
1611 typedef VOID
1612 (NTAPI *CL_MODIFY_CALL_QOS_COMPLETE_HANDLER)(
1613 IN NDIS_STATUS Status,
1614 IN NDIS_HANDLE ProtocolVcContext,
1615 IN PCO_CALL_PARAMETERS CallParameters);
1616
1617 typedef VOID
1618 (NTAPI *CL_CLOSE_CALL_COMPLETE_HANDLER)(
1619 IN NDIS_STATUS Status,
1620 IN NDIS_HANDLE ProtocolVcContext,
1621 IN NDIS_HANDLE ProtocolPartyContext OPTIONAL);
1622
1623 typedef VOID
1624 (NTAPI *CL_ADD_PARTY_COMPLETE_HANDLER)(
1625 IN NDIS_STATUS Status,
1626 IN NDIS_HANDLE ProtocolPartyContext,
1627 IN NDIS_HANDLE NdisPartyHandle,
1628 IN PCO_CALL_PARAMETERS CallParameters);
1629
1630 typedef VOID
1631 (NTAPI *CL_DROP_PARTY_COMPLETE_HANDLER)(
1632 IN NDIS_STATUS Status,
1633 IN NDIS_HANDLE ProtocolPartyContext);
1634
1635 typedef NDIS_STATUS
1636 (NTAPI *CL_INCOMING_CALL_HANDLER)(
1637 IN NDIS_HANDLE ProtocolSapContext,
1638 IN NDIS_HANDLE ProtocolVcContext,
1639 IN OUT PCO_CALL_PARAMETERS CallParameters);
1640
1641 typedef VOID
1642 (NTAPI *CL_INCOMING_CALL_QOS_CHANGE_HANDLER)(
1643 IN NDIS_HANDLE ProtocolVcContext,
1644 IN PCO_CALL_PARAMETERS CallParameters);
1645
1646 typedef VOID
1647 (NTAPI *CL_INCOMING_CLOSE_CALL_HANDLER)(
1648 IN NDIS_STATUS CloseStatus,
1649 IN NDIS_HANDLE ProtocolVcContext,
1650 IN PVOID CloseData OPTIONAL,
1651 IN UINT Size OPTIONAL);
1652
1653 typedef VOID
1654 (NTAPI *CL_INCOMING_DROP_PARTY_HANDLER)(
1655 IN NDIS_STATUS DropStatus,
1656 IN NDIS_HANDLE ProtocolPartyContext,
1657 IN PVOID CloseData OPTIONAL,
1658 IN UINT Size OPTIONAL);
1659
1660 typedef VOID
1661 (NTAPI *CL_CALL_CONNECTED_HANDLER)(
1662 IN NDIS_HANDLE ProtocolVcContext);
1663
1664
1665 typedef struct _NDIS_CLIENT_CHARACTERISTICS {
1666 UCHAR MajorVersion;
1667 UCHAR MinorVersion;
1668 USHORT Filler;
1669 UINT Reserved;
1670 CO_CREATE_VC_HANDLER ClCreateVcHandler;
1671 CO_DELETE_VC_HANDLER ClDeleteVcHandler;
1672 CO_REQUEST_HANDLER ClRequestHandler;
1673 CO_REQUEST_COMPLETE_HANDLER ClRequestCompleteHandler;
1674 CL_OPEN_AF_COMPLETE_HANDLER ClOpenAfCompleteHandler;
1675 CL_CLOSE_AF_COMPLETE_HANDLER ClCloseAfCompleteHandler;
1676 CL_REG_SAP_COMPLETE_HANDLER ClRegisterSapCompleteHandler;
1677 CL_DEREG_SAP_COMPLETE_HANDLER ClDeregisterSapCompleteHandler;
1678 CL_MAKE_CALL_COMPLETE_HANDLER ClMakeCallCompleteHandler;
1679 CL_MODIFY_CALL_QOS_COMPLETE_HANDLER ClModifyCallQoSCompleteHandler;
1680 CL_CLOSE_CALL_COMPLETE_HANDLER ClCloseCallCompleteHandler;
1681 CL_ADD_PARTY_COMPLETE_HANDLER ClAddPartyCompleteHandler;
1682 CL_DROP_PARTY_COMPLETE_HANDLER ClDropPartyCompleteHandler;
1683 CL_INCOMING_CALL_HANDLER ClIncomingCallHandler;
1684 CL_INCOMING_CALL_QOS_CHANGE_HANDLER ClIncomingCallQoSChangeHandler;
1685 CL_INCOMING_CLOSE_CALL_HANDLER ClIncomingCloseCallHandler;
1686 CL_INCOMING_DROP_PARTY_HANDLER ClIncomingDropPartyHandler;
1687 CL_CALL_CONNECTED_HANDLER ClCallConnectedHandler;
1688 } NDIS_CLIENT_CHARACTERISTICS, *PNDIS_CLIENT_CHARACTERISTICS;
1689
1690
1691 /* NDIS protocol structures */
1692
1693 /* Prototypes for NDIS 3.0 protocol characteristics */
1694
1695 typedef VOID
1696 (NTAPI *OPEN_ADAPTER_COMPLETE_HANDLER)(
1697 IN NDIS_HANDLE ProtocolBindingContext,
1698 IN NDIS_STATUS Status,
1699 IN NDIS_STATUS OpenErrorStatus);
1700
1701 typedef VOID
1702 (NTAPI *CLOSE_ADAPTER_COMPLETE_HANDLER)(
1703 IN NDIS_HANDLE ProtocolBindingContext,
1704 IN NDIS_STATUS Status);
1705
1706 typedef VOID
1707 (NTAPI *RESET_COMPLETE_HANDLER)(
1708 IN NDIS_HANDLE ProtocolBindingContext,
1709 IN NDIS_STATUS Status);
1710
1711 typedef VOID
1712 (NTAPI *REQUEST_COMPLETE_HANDLER)(
1713 IN NDIS_HANDLE ProtocolBindingContext,
1714 IN PNDIS_REQUEST NdisRequest,
1715 IN NDIS_STATUS Status);
1716
1717 typedef VOID
1718 (NTAPI *STATUS_HANDLER)(
1719 IN NDIS_HANDLE ProtocolBindingContext,
1720 IN NDIS_STATUS GeneralStatus,
1721 IN PVOID StatusBuffer,
1722 IN UINT StatusBufferSize);
1723
1724 typedef VOID
1725 (NTAPI *STATUS_COMPLETE_HANDLER)(
1726 IN NDIS_HANDLE ProtocolBindingContext);
1727
1728 typedef VOID
1729 (NTAPI *SEND_COMPLETE_HANDLER)(
1730 IN NDIS_HANDLE ProtocolBindingContext,
1731 IN PNDIS_PACKET Packet,
1732 IN NDIS_STATUS Status);
1733
1734 typedef VOID
1735 (NTAPI *WAN_SEND_COMPLETE_HANDLER)(
1736 IN NDIS_HANDLE ProtocolBindingContext,
1737 IN PNDIS_WAN_PACKET Packet,
1738 IN NDIS_STATUS Status);
1739
1740 typedef VOID
1741 (NTAPI *TRANSFER_DATA_COMPLETE_HANDLER)(
1742 IN NDIS_HANDLE ProtocolBindingContext,
1743 IN PNDIS_PACKET Packet,
1744 IN NDIS_STATUS Status,
1745 IN UINT BytesTransferred);
1746
1747 typedef VOID
1748 (NTAPI *WAN_TRANSFER_DATA_COMPLETE_HANDLER)(
1749 VOID);
1750
1751 typedef NDIS_STATUS
1752 (NTAPI *RECEIVE_HANDLER)(
1753 IN NDIS_HANDLE ProtocolBindingContext,
1754 IN NDIS_HANDLE MacReceiveContext,
1755 IN PVOID HeaderBuffer,
1756 IN UINT HeaderBufferSize,
1757 IN PVOID LookAheadBuffer,
1758 IN UINT LookaheadBufferSize,
1759 IN UINT PacketSize);
1760
1761 typedef NDIS_STATUS
1762 (NTAPI *WAN_RECEIVE_HANDLER)(
1763 IN NDIS_HANDLE NdisLinkHandle,
1764 IN PUCHAR Packet,
1765 IN ULONG PacketSize);
1766
1767 typedef VOID
1768 (NTAPI *RECEIVE_COMPLETE_HANDLER)(
1769 IN NDIS_HANDLE ProtocolBindingContext);
1770
1771 /* Protocol characteristics for NDIS 3.0 protocols */
1772
1773 #define NDIS30_PROTOCOL_CHARACTERISTICS_S \
1774 UCHAR MajorNdisVersion; \
1775 UCHAR MinorNdisVersion; \
1776 USHORT Filler; \
1777 _ANONYMOUS_UNION union { \
1778 UINT Reserved; \
1779 UINT Flags; \
1780 } DUMMYUNIONNAME; \
1781 OPEN_ADAPTER_COMPLETE_HANDLER OpenAdapterCompleteHandler; \
1782 CLOSE_ADAPTER_COMPLETE_HANDLER CloseAdapterCompleteHandler; \
1783 _ANONYMOUS_UNION union { \
1784 SEND_COMPLETE_HANDLER SendCompleteHandler; \
1785 WAN_SEND_COMPLETE_HANDLER WanSendCompleteHandler; \
1786 } DUMMYUNIONNAME2; \
1787 _ANONYMOUS_UNION union { \
1788 TRANSFER_DATA_COMPLETE_HANDLER TransferDataCompleteHandler; \
1789 WAN_TRANSFER_DATA_COMPLETE_HANDLER WanTransferDataCompleteHandler; \
1790 } DUMMYUNIONNAME3; \
1791 RESET_COMPLETE_HANDLER ResetCompleteHandler; \
1792 REQUEST_COMPLETE_HANDLER RequestCompleteHandler; \
1793 _ANONYMOUS_UNION union { \
1794 RECEIVE_HANDLER ReceiveHandler; \
1795 WAN_RECEIVE_HANDLER WanReceiveHandler; \
1796 } DUMMYUNIONNAME4; \
1797 RECEIVE_COMPLETE_HANDLER ReceiveCompleteHandler; \
1798 STATUS_HANDLER StatusHandler; \
1799 STATUS_COMPLETE_HANDLER StatusCompleteHandler; \
1800 NDIS_STRING Name;
1801
1802 typedef struct _NDIS30_PROTOCOL_CHARACTERISTICS {
1803 NDIS30_PROTOCOL_CHARACTERISTICS_S
1804 } NDIS30_PROTOCOL_CHARACTERISTICS, *PNDIS30_PROTOCOL_CHARACTERISTICS;
1805
1806
1807 /* Prototypes for NDIS 4.0 protocol characteristics */
1808
1809 typedef INT
1810 (NTAPI *RECEIVE_PACKET_HANDLER)(
1811 IN NDIS_HANDLE ProtocolBindingContext,
1812 IN PNDIS_PACKET Packet);
1813
1814 typedef VOID
1815 (NTAPI *BIND_HANDLER)(
1816 OUT PNDIS_STATUS Status,
1817 IN NDIS_HANDLE BindContext,
1818 IN PNDIS_STRING DeviceName,
1819 IN PVOID SystemSpecific1,
1820 IN PVOID SystemSpecific2);
1821
1822 typedef VOID
1823 (NTAPI *UNBIND_HANDLER)(
1824 OUT PNDIS_STATUS Status,
1825 IN NDIS_HANDLE ProtocolBindingContext,
1826 IN NDIS_HANDLE UnbindContext);
1827
1828 typedef NDIS_STATUS
1829 (NTAPI *PNP_EVENT_HANDLER)(
1830 IN NDIS_HANDLE ProtocolBindingContext,
1831 IN PNET_PNP_EVENT NetPnPEvent);
1832
1833 typedef VOID
1834 (NTAPI *UNLOAD_PROTOCOL_HANDLER)(
1835 VOID);
1836
1837 /* Protocol characteristics for NDIS 4.0 protocols */
1838
1839 typedef struct _NDIS40_PROTOCOL_CHARACTERISTICS {
1840 UCHAR MajorNdisVersion;
1841 UCHAR MinorNdisVersion;
1842 USHORT Filler;
1843 __MINGW_EXTENSION union {
1844 UINT Reserved;
1845 UINT Flags;
1846 };
1847 OPEN_ADAPTER_COMPLETE_HANDLER OpenAdapterCompleteHandler;
1848 CLOSE_ADAPTER_COMPLETE_HANDLER CloseAdapterCompleteHandler;
1849 __MINGW_EXTENSION union {
1850 SEND_COMPLETE_HANDLER SendCompleteHandler;
1851 WAN_SEND_COMPLETE_HANDLER WanSendCompleteHandler;
1852 };
1853 __MINGW_EXTENSION union {
1854 TRANSFER_DATA_COMPLETE_HANDLER TransferDataCompleteHandler;
1855 WAN_TRANSFER_DATA_COMPLETE_HANDLER WanTransferDataCompleteHandler;
1856 };
1857 RESET_COMPLETE_HANDLER ResetCompleteHandler;
1858 REQUEST_COMPLETE_HANDLER RequestCompleteHandler;
1859 __MINGW_EXTENSION union {
1860 RECEIVE_HANDLER ReceiveHandler;
1861 WAN_RECEIVE_HANDLER WanReceiveHandler;
1862 };
1863 RECEIVE_COMPLETE_HANDLER ReceiveCompleteHandler;
1864 STATUS_HANDLER StatusHandler;
1865 STATUS_COMPLETE_HANDLER StatusCompleteHandler;
1866 NDIS_STRING Name;
1867 RECEIVE_PACKET_HANDLER ReceivePacketHandler;
1868 BIND_HANDLER BindAdapterHandler;
1869 UNBIND_HANDLER UnbindAdapterHandler;
1870 PNP_EVENT_HANDLER PnPEventHandler;
1871 UNLOAD_PROTOCOL_HANDLER UnloadHandler;
1872 } NDIS40_PROTOCOL_CHARACTERISTICS;
1873
1874 typedef VOID
1875 (NTAPI PROTCOL_CO_AF_REGISTER_NOTIFY)(
1876 IN NDIS_HANDLE ProtocolBindingContext,
1877 IN PCO_ADDRESS_FAMILY AddressFamily);
1878 typedef PROTCOL_CO_AF_REGISTER_NOTIFY *CO_AF_REGISTER_NOTIFY_HANDLER;
1879
1880 #if NDIS_LEGACY_PROTOCOL
1881
1882 typedef struct _NDIS50_PROTOCOL_CHARACTERISTICS {
1883 #ifdef __cplusplus
1884 NDIS40_PROTOCOL_CHARACTERISTICS Ndis40Chars;
1885 #else
1886 NDIS40_PROTOCOL_CHARACTERISTICS;
1887 #endif
1888 PVOID ReservedHandlers[4];
1889 CO_SEND_COMPLETE_HANDLER CoSendCompleteHandler;
1890 CO_STATUS_HANDLER CoStatusHandler;
1891 CO_RECEIVE_PACKET_HANDLER CoReceivePacketHandler;
1892 CO_AF_REGISTER_NOTIFY_HANDLER CoAfRegisterNotifyHandler;
1893 } NDIS50_PROTOCOL_CHARACTERISTICS;
1894
1895 #if (defined(NDIS50) || defined(NDIS51))
1896 typedef NDIS50_PROTOCOL_CHARACTERISTICS NDIS_PROTOCOL_CHARACTERISTICS;
1897 #else
1898 typedef NDIS40_PROTOCOL_CHARACTERISTICS NDIS_PROTOCOL_CHARACTERISTICS;
1899 #endif
1900
1901 typedef NDIS_PROTOCOL_CHARACTERISTICS *PNDIS_PROTOCOL_CHARACTERISTICS;
1902
1903 #endif /* NDIS_LEGACY_PROTOCOL */
1904
1905 /* Prototypes for NDIS_MINIPORT_CHARACTERISTICS */
1906
1907 typedef BOOLEAN
1908 (NTAPI *W_CHECK_FOR_HANG_HANDLER)(
1909 IN NDIS_HANDLE MiniportAdapterContext);
1910
1911 typedef VOID
1912 (NTAPI *W_DISABLE_INTERRUPT_HANDLER)(
1913 IN NDIS_HANDLE MiniportAdapterContext);
1914
1915 typedef VOID
1916 (NTAPI *W_ENABLE_INTERRUPT_HANDLER)(
1917 IN NDIS_HANDLE MiniportAdapterContext);
1918
1919 typedef VOID
1920 (NTAPI *W_HALT_HANDLER)(
1921 IN NDIS_HANDLE MiniportAdapterContext);
1922
1923 typedef VOID
1924 (NTAPI *W_HANDLE_INTERRUPT_HANDLER)(
1925 IN NDIS_HANDLE MiniportAdapterContext);
1926
1927 typedef NDIS_STATUS
1928 (NTAPI *W_INITIALIZE_HANDLER)(
1929 OUT PNDIS_STATUS OpenErrorStatus,
1930 OUT PUINT SelectedMediumIndex,
1931 IN PNDIS_MEDIUM MediumArray,
1932 IN UINT MediumArraySize,
1933 IN NDIS_HANDLE MiniportAdapterContext,
1934 IN NDIS_HANDLE WrapperConfigurationContext);
1935
1936 typedef VOID
1937 (NTAPI *W_ISR_HANDLER)(
1938 OUT PBOOLEAN InterruptRecognized,
1939 OUT PBOOLEAN QueueMiniportHandleInterrupt,
1940 IN NDIS_HANDLE MiniportAdapterContext);
1941
1942 typedef NDIS_STATUS
1943 (NTAPI *W_QUERY_INFORMATION_HANDLER)(
1944 IN NDIS_HANDLE MiniportAdapterContext,
1945 IN NDIS_OID Oid,
1946 IN PVOID InformationBuffer,
1947 IN ULONG InformationBufferLength,
1948 OUT PULONG BytesWritten,
1949 OUT PULONG BytesNeeded);
1950
1951 typedef NDIS_STATUS
1952 (NTAPI *W_RECONFIGURE_HANDLER)(
1953 OUT PNDIS_STATUS OpenErrorStatus,
1954 IN NDIS_HANDLE MiniportAdapterContext,
1955 IN NDIS_HANDLE WrapperConfigurationContext);
1956
1957 typedef NDIS_STATUS
1958 (NTAPI *W_RESET_HANDLER)(
1959 OUT PBOOLEAN AddressingReset,
1960 IN NDIS_HANDLE MiniportAdapterContext);
1961
1962 typedef NDIS_STATUS
1963 (NTAPI *W_SEND_HANDLER)(
1964 IN NDIS_HANDLE MiniportAdapterContext,
1965 IN PNDIS_PACKET Packet,
1966 IN UINT Flags);
1967
1968 typedef NDIS_STATUS
1969 (NTAPI *WM_SEND_HANDLER)(
1970 IN NDIS_HANDLE MiniportAdapterContext,
1971 IN NDIS_HANDLE NdisLinkHandle,
1972 IN PNDIS_WAN_PACKET Packet);
1973
1974 typedef NDIS_STATUS
1975 (NTAPI *W_SET_INFORMATION_HANDLER)(
1976 IN NDIS_HANDLE MiniportAdapterContext,
1977 IN NDIS_OID Oid,
1978 IN PVOID InformationBuffer,
1979 IN ULONG InformationBufferLength,
1980 OUT PULONG BytesRead,
1981 OUT PULONG BytesNeeded);
1982
1983 typedef NDIS_STATUS
1984 (NTAPI *W_TRANSFER_DATA_HANDLER)(
1985 OUT PNDIS_PACKET Packet,
1986 OUT PUINT BytesTransferred,
1987 IN NDIS_HANDLE MiniportAdapterContext,
1988 IN NDIS_HANDLE MiniportReceiveContext,
1989 IN UINT ByteOffset,
1990 IN UINT BytesToTransfer);
1991
1992 typedef NDIS_STATUS
1993 (NTAPI *WM_TRANSFER_DATA_HANDLER)(
1994 VOID);
1995
1996 typedef VOID
1997 (NTAPI *ADAPTER_SHUTDOWN_HANDLER)(
1998 IN PVOID ShutdownContext);
1999
2000 typedef VOID
2001 (NTAPI *W_RETURN_PACKET_HANDLER)(
2002 IN NDIS_HANDLE MiniportAdapterContext,
2003 IN PNDIS_PACKET Packet);
2004
2005 typedef VOID
2006 (NTAPI *W_SEND_PACKETS_HANDLER)(
2007 IN NDIS_HANDLE MiniportAdapterContext,
2008 IN PPNDIS_PACKET PacketArray,
2009 IN UINT NumberOfPackets);
2010
2011 typedef VOID
2012 (NTAPI *W_ALLOCATE_COMPLETE_HANDLER)(
2013 IN NDIS_HANDLE MiniportAdapterContext,
2014 IN PVOID VirtualAddress,
2015 IN PNDIS_PHYSICAL_ADDRESS PhysicalAddress,
2016 IN ULONG Length,
2017 IN PVOID Context);
2018
2019 /* NDIS structures available only to miniport drivers */
2020
2021 #define NDIS30_MINIPORT_CHARACTERISTICS_S \
2022 UCHAR MajorNdisVersion; \
2023 UCHAR MinorNdisVersion; \
2024 UINT Reserved; \
2025 W_CHECK_FOR_HANG_HANDLER CheckForHangHandler; \
2026 W_DISABLE_INTERRUPT_HANDLER DisableInterruptHandler; \
2027 W_ENABLE_INTERRUPT_HANDLER EnableInterruptHandler; \
2028 W_HALT_HANDLER HaltHandler; \
2029 W_HANDLE_INTERRUPT_HANDLER HandleInterruptHandler; \
2030 W_INITIALIZE_HANDLER InitializeHandler; \
2031 W_ISR_HANDLER ISRHandler; \
2032 W_QUERY_INFORMATION_HANDLER QueryInformationHandler; \
2033 W_RECONFIGURE_HANDLER ReconfigureHandler; \
2034 W_RESET_HANDLER ResetHandler; \
2035 W_SEND_HANDLER SendHandler; \
2036 W_SET_INFORMATION_HANDLER SetInformationHandler; \
2037 W_TRANSFER_DATA_HANDLER TransferDataHandler;
2038
2039 typedef struct _NDIS30_MINIPORT_CHARACTERISTICS {
2040 NDIS30_MINIPORT_CHARACTERISTICS_S
2041 } NDIS30_MINIPORT_CHARACTERISTICS, *PSNDIS30_MINIPORT_CHARACTERISTICS;
2042
2043 #ifdef __cplusplus
2044
2045 #define NDIS40_MINIPORT_CHARACTERISTICS_S \
2046 NDIS30_MINIPORT_CHARACTERISTICS Ndis30Chars; \
2047 W_RETURN_PACKET_HANDLER ReturnPacketHandler; \
2048 W_SEND_PACKETS_HANDLER SendPacketsHandler; \
2049 W_ALLOCATE_COMPLETE_HANDLER AllocateCompleteHandler;
2050
2051 #else /* !__cplusplus */
2052
2053 #define NDIS40_MINIPORT_CHARACTERISTICS_S \
2054 NDIS30_MINIPORT_CHARACTERISTICS_S \
2055 W_RETURN_PACKET_HANDLER ReturnPacketHandler; \
2056 W_SEND_PACKETS_HANDLER SendPacketsHandler; \
2057 W_ALLOCATE_COMPLETE_HANDLER AllocateCompleteHandler;
2058
2059 #endif /* !__cplusplus */
2060
2061 typedef struct _NDIS40_MINIPORT_CHARACTERISTICS {
2062 NDIS40_MINIPORT_CHARACTERISTICS_S
2063 } NDIS40_MINIPORT_CHARACTERISTICS, *PNDIS40_MINIPORT_CHARACTERISTICS;
2064
2065 /* Extensions for NDIS 5.0 miniports */
2066
2067 typedef NDIS_STATUS
2068 (NTAPI MINIPORT_CO_CREATE_VC)(
2069 IN NDIS_HANDLE MiniportAdapterContext,
2070 IN NDIS_HANDLE NdisVcHandle,
2071 OUT PNDIS_HANDLE MiniportVcContext);
2072 typedef MINIPORT_CO_CREATE_VC *W_CO_CREATE_VC_HANDLER;
2073
2074 typedef NDIS_STATUS
2075 (NTAPI MINIPORT_CO_DELETE_VC)(
2076 IN NDIS_HANDLE MiniportVcContext);
2077 typedef MINIPORT_CO_DELETE_VC *W_CO_DELETE_VC_HANDLER;
2078
2079 typedef NDIS_STATUS
2080 (NTAPI MINIPORT_CO_ACTIVATE_VC)(
2081 IN NDIS_HANDLE MiniportVcContext,
2082 IN OUT PCO_CALL_PARAMETERS CallParameters);
2083 typedef MINIPORT_CO_ACTIVATE_VC *W_CO_ACTIVATE_VC_HANDLER;
2084
2085 typedef NDIS_STATUS
2086 (NTAPI MINIPORT_CO_DEACTIVATE_VC)(
2087 IN NDIS_HANDLE MiniportVcContext);
2088 typedef MINIPORT_CO_DEACTIVATE_VC *W_CO_DEACTIVATE_VC_HANDLER;
2089
2090 typedef VOID
2091 (NTAPI *W_CO_SEND_PACKETS_HANDLER)(
2092 IN NDIS_HANDLE MiniportVcContext,
2093 IN PPNDIS_PACKET PacketArray,
2094 IN UINT NumberOfPackets);
2095
2096 typedef NDIS_STATUS
2097 (NTAPI *W_CO_REQUEST_HANDLER)(
2098 IN NDIS_HANDLE MiniportAdapterContext,
2099 IN NDIS_HANDLE MiniportVcContext OPTIONAL,
2100 IN OUT PNDIS_REQUEST NdisRequest);
2101
2102 #ifdef __cplusplus
2103
2104 #define NDIS50_MINIPORT_CHARACTERISTICS_S \
2105 NDIS40_MINIPORT_CHARACTERISTICS Ndis40Chars; \
2106 W_CO_CREATE_VC_HANDLER CoCreateVcHandler; \
2107 W_CO_DELETE_VC_HANDLER CoDeleteVcHandler; \
2108 W_CO_ACTIVATE_VC_HANDLER CoActivateVcHandler; \
2109 W_CO_DEACTIVATE_VC_HANDLER CoDeactivateVcHandler; \
2110 W_CO_SEND_PACKETS_HANDLER CoSendPacketsHandler; \
2111 W_CO_REQUEST_HANDLER CoRequestHandler;
2112
2113 #else /* !__cplusplus */
2114
2115 #define NDIS50_MINIPORT_CHARACTERISTICS_S \
2116 NDIS40_MINIPORT_CHARACTERISTICS_S \
2117 W_CO_CREATE_VC_HANDLER CoCreateVcHandler; \
2118 W_CO_DELETE_VC_HANDLER CoDeleteVcHandler; \
2119 W_CO_ACTIVATE_VC_HANDLER CoActivateVcHandler; \
2120 W_CO_DEACTIVATE_VC_HANDLER CoDeactivateVcHandler; \
2121 W_CO_SEND_PACKETS_HANDLER CoSendPacketsHandler; \
2122 W_CO_REQUEST_HANDLER CoRequestHandler;
2123
2124 #endif /* !__cplusplus */
2125
2126 typedef struct _NDIS50_MINIPORT_CHARACTERISTICS {
2127 NDIS50_MINIPORT_CHARACTERISTICS_S
2128 } NDIS50_MINIPORT_CHARACTERISTICS, *PSNDIS50_MINIPORT_CHARACTERISTICS;
2129
2130 /* Extensions for NDIS 5.1 miniports */
2131
2132 typedef VOID
2133 (NTAPI *W_CANCEL_SEND_PACKETS_HANDLER)(
2134 IN NDIS_HANDLE MiniportAdapterContext,
2135 IN PVOID CancelId);
2136
2137 typedef VOID
2138 (NTAPI *W_PNP_EVENT_NOTIFY_HANDLER)(
2139 IN NDIS_HANDLE MiniportAdapterContext,
2140 IN NDIS_DEVICE_PNP_EVENT PnPEvent,
2141 IN PVOID InformationBuffer,
2142 IN ULONG InformationBufferLength);
2143
2144 typedef VOID
2145 (NTAPI *W_MINIPORT_SHUTDOWN_HANDLER)(
2146 IN PVOID ShutdownContext);
2147
2148 #ifdef __cplusplus
2149
2150 #define NDIS51_MINIPORT_CHARACTERISTICS_S \
2151 NDIS50_MINIPORT_CHARACTERISTICS Ndis50Chars; \
2152 W_CANCEL_SEND_PACKETS_HANDLER CancelSendPacketsHandler; \
2153 W_PNP_EVENT_NOTIFY_HANDLER PnPEventNotifyHandler; \
2154 W_MINIPORT_SHUTDOWN_HANDLER AdapterShutdownHandler;
2155
2156 #else
2157
2158 #define NDIS51_MINIPORT_CHARACTERISTICS_S \
2159 NDIS50_MINIPORT_CHARACTERISTICS_S \
2160 W_CANCEL_SEND_PACKETS_HANDLER CancelSendPacketsHandler; \
2161 W_PNP_EVENT_NOTIFY_HANDLER PnPEventNotifyHandler; \
2162 W_MINIPORT_SHUTDOWN_HANDLER AdapterShutdownHandler;
2163
2164 #endif
2165
2166 typedef struct _NDIS51_MINIPORT_CHARACTERISTICS {
2167 NDIS51_MINIPORT_CHARACTERISTICS_S
2168 } NDIS51_MINIPORT_CHARACTERISTICS, *PSNDIS51_MINIPORT_CHARACTERISTICS;
2169
2170 #if defined(NDIS51_MINIPORT)
2171 typedef struct _NDIS_MINIPORT_CHARACTERISTICS {
2172 NDIS51_MINIPORT_CHARACTERISTICS_S
2173 } NDIS_MINIPORT_CHARACTERISTICS, *PNDIS_MINIPORT_CHARACTERISTICS;
2174 #elif defined(NDIS50_MINIPORT)
2175 typedef struct _NDIS_MINIPORT_CHARACTERISTICS {
2176 NDIS50_MINIPORT_CHARACTERISTICS_S
2177 } NDIS_MINIPORT_CHARACTERISTICS, *PNDIS_MINIPORT_CHARACTERISTICS;
2178 #elif defined(NDIS40_MINIPORT)
2179 typedef struct _NDIS_MINIPORT_CHARACTERISTICS {
2180 NDIS40_MINIPORT_CHARACTERISTICS_S
2181 } NDIS_MINIPORT_CHARACTERISTICS, *PNDIS_MINIPORT_CHARACTERISTICS;
2182 #else /* NDIS30 */
2183 typedef struct _NDIS_MINIPORT_CHARACTERISTICS {
2184 NDIS30_MINIPORT_CHARACTERISTICS_S
2185 } NDIS_MINIPORT_CHARACTERISTICS, *PNDIS_MINIPORT_CHARACTERISTICS;
2186 #endif
2187
2188 typedef struct _NDIS_MINIPORT_INTERRUPT {
2189 PKINTERRUPT InterruptObject;
2190 KSPIN_LOCK DpcCountLock;
2191 PVOID Reserved;
2192 W_ISR_HANDLER MiniportIsr;
2193 W_HANDLE_INTERRUPT_HANDLER MiniportDpc;
2194 KDPC InterruptDpc;
2195 PNDIS_MINIPORT_BLOCK Miniport;
2196 UCHAR DpcCount;
2197 BOOLEAN Filler1;
2198 KEVENT DpcsCompletedEvent;
2199 BOOLEAN SharedInterrupt;
2200 BOOLEAN IsrRequested;
2201 } NDIS_MINIPORT_INTERRUPT, *PNDIS_MINIPORT_INTERRUPT;
2202
2203 /* Structures available only to full MAC drivers */
2204
2205 typedef BOOLEAN
2206 (NTAPI *PNDIS_INTERRUPT_SERVICE)(
2207 IN PVOID InterruptContext);
2208
2209 typedef VOID
2210 (NTAPI *PNDIS_DEFERRED_PROCESSING)(
2211 IN PVOID SystemSpecific1,
2212 IN PVOID InterruptContext,
2213 IN PVOID SystemSpecific2,
2214 IN PVOID SystemSpecific3);
2215
2216 typedef struct _NDIS_WRAPPER_HANDLE NDIS_WRAPPER_HANDLE, *PNDIS_WRAPPER_HANDLE;
2217 typedef struct _NDIS_PROTOCOL_BLOCK NDIS_PROTOCOL_BLOCK, *PNDIS_PROTOCOL_BLOCK;
2218 typedef struct _NDIS_OPEN_BLOCK NDIS_OPEN_BLOCK, *PNDIS_OPEN_BLOCK;
2219 typedef struct _NDIS_M_DRIVER_BLOCK NDIS_M_DRIVER_BLOCK, *PNDIS_M_DRIVER_BLOCK;
2220 typedef struct _NDIS_OFFLOAD NDIS_OFFLOAD, *PNDIS_OFFLOAD;
2221 typedef struct _NDIS_AF_LIST NDIS_AF_LIST, *PNDIS_AF_LIST;
2222 typedef struct _X_FILTER ETH_FILTER, *PETH_FILTER;
2223 #if NDIS_SUPPORT_NDIS6
2224 typedef USHORT NET_FRAME_TYPE, *PNET_FRAME_TYPE;
2225 #endif
2226
2227 typedef struct _NDIS_MINIPORT_TIMER {
2228 KTIMER Timer;
2229 KDPC Dpc;
2230 PNDIS_TIMER_FUNCTION MiniportTimerFunction;
2231 PVOID MiniportTimerContext;
2232 PNDIS_MINIPORT_BLOCK Miniport;
2233 struct _NDIS_MINIPORT_TIMER *NextDeferredTimer;
2234 } NDIS_MINIPORT_TIMER, *PNDIS_MINIPORT_TIMER;
2235
2236 typedef struct _NDIS_INTERRUPT {
2237 PKINTERRUPT InterruptObject;
2238 KSPIN_LOCK DpcCountLock;
2239 PNDIS_INTERRUPT_SERVICE MacIsr;
2240 PNDIS_DEFERRED_PROCESSING MacDpc;
2241 KDPC InterruptDpc;
2242 PVOID InterruptContext;
2243 UCHAR DpcCount;
2244 BOOLEAN Removing;
2245 KEVENT DpcsCompletedEvent;
2246 } NDIS_INTERRUPT, *PNDIS_INTERRUPT;
2247
2248
2249 typedef enum _NDIS_WORK_ITEM_TYPE {
2250 NdisWorkItemRequest,
2251 NdisWorkItemSend,
2252 NdisWorkItemReturnPackets,
2253 NdisWorkItemResetRequested,
2254 NdisWorkItemResetInProgress,
2255 NdisWorkItemHalt,
2256 NdisWorkItemSendLoopback,
2257 NdisWorkItemMiniportCallback,
2258 NdisMaxWorkItems
2259 } NDIS_WORK_ITEM_TYPE, *PNDIS_WORK_ITEM_TYPE;
2260
2261 #define NUMBER_OF_WORK_ITEM_TYPES NdisMaxWorkItems
2262 #define NUMBER_OF_SINGLE_WORK_ITEMS 6
2263
2264 typedef struct _NDIS_MINIPORT_WORK_ITEM {
2265 SINGLE_LIST_ENTRY Link;
2266 NDIS_WORK_ITEM_TYPE WorkItemType;
2267 PVOID WorkItemContext;
2268 } NDIS_MINIPORT_WORK_ITEM, *PNDIS_MINIPORT_WORK_ITEM;
2269
2270 struct _NDIS_WORK_ITEM;
2271 typedef VOID (*NDIS_PROC)(struct _NDIS_WORK_ITEM *, PVOID);
2272
2273 typedef struct _NDIS_WORK_ITEM {
2274 PVOID Context;
2275 NDIS_PROC Routine;
2276 UCHAR WrapperReserved[8*sizeof(PVOID)];
2277 } NDIS_WORK_ITEM, *PNDIS_WORK_ITEM;
2278
2279 typedef struct _NDIS_BIND_PATHS {
2280 UINT Number;
2281 NDIS_STRING Paths[1];
2282 } NDIS_BIND_PATHS, *PNDIS_BIND_PATHS;
2283
2284
2285 typedef VOID
2286 (NTAPI *ETH_RCV_COMPLETE_HANDLER)(
2287 IN PETH_FILTER Filter);
2288
2289 typedef VOID
2290 (NTAPI *ETH_RCV_INDICATE_HANDLER)(
2291 IN PETH_FILTER Filter,
2292 IN NDIS_HANDLE MacReceiveContext,
2293 IN PCHAR Address,
2294 IN PVOID HeaderBuffer,
2295 IN UINT HeaderBufferSize,
2296 IN PVOID LookaheadBuffer,
2297 IN UINT LookaheadBufferSize,
2298 IN UINT PacketSize);
2299
2300 typedef VOID
2301 (NTAPI *FDDI_RCV_COMPLETE_HANDLER)(
2302 IN PFDDI_FILTER Filter);
2303
2304 typedef VOID
2305 (NTAPI *FDDI_RCV_INDICATE_HANDLER)(
2306 IN PFDDI_FILTER Filter,
2307 IN NDIS_HANDLE MacReceiveContext,
2308 IN PCHAR Address,
2309 IN UINT AddressLength,
2310 IN PVOID HeaderBuffer,
2311 IN UINT HeaderBufferSize,
2312 IN PVOID LookaheadBuffer,
2313 IN UINT LookaheadBufferSize,
2314 IN UINT PacketSize);
2315
2316 typedef VOID
2317 (NTAPI *FILTER_PACKET_INDICATION_HANDLER)(
2318 IN NDIS_HANDLE Miniport,
2319 IN PPNDIS_PACKET PacketArray,
2320 IN UINT NumberOfPackets);
2321
2322 typedef VOID
2323 (NTAPI *TR_RCV_COMPLETE_HANDLER)(
2324 IN PTR_FILTER Filter);
2325
2326 typedef VOID
2327 (NTAPI *TR_RCV_INDICATE_HANDLER)(
2328 IN PTR_FILTER Filter,
2329 IN NDIS_HANDLE MacReceiveContext,
2330 IN PVOID HeaderBuffer,
2331 IN UINT HeaderBufferSize,
2332 IN PVOID LookaheadBuffer,
2333 IN UINT LookaheadBufferSize,
2334 IN UINT PacketSize);
2335
2336 typedef VOID
2337 (NTAPI *WAN_RCV_COMPLETE_HANDLER)(
2338 IN NDIS_HANDLE MiniportAdapterHandle,
2339 IN NDIS_HANDLE NdisLinkContext);
2340
2341 typedef VOID
2342 (NTAPI *WAN_RCV_HANDLER)(
2343 OUT PNDIS_STATUS Status,
2344 IN NDIS_HANDLE MiniportAdapterHandle,
2345 IN NDIS_HANDLE NdisLinkContext,
2346 IN PUCHAR Packet,
2347 IN ULONG PacketSize);
2348
2349 typedef VOID
2350 (FASTCALL *NDIS_M_DEQUEUE_WORK_ITEM)(
2351 IN PNDIS_MINIPORT_BLOCK Miniport,
2352 IN NDIS_WORK_ITEM_TYPE WorkItemType,
2353 OUT PVOID *WorkItemContext);
2354
2355 typedef NDIS_STATUS
2356 (FASTCALL *NDIS_M_QUEUE_NEW_WORK_ITEM)(
2357 IN PNDIS_MINIPORT_BLOCK Miniport,
2358 IN NDIS_WORK_ITEM_TYPE WorkItemType,
2359 IN PVOID WorkItemContext);
2360
2361 typedef NDIS_STATUS
2362 (FASTCALL *NDIS_M_QUEUE_WORK_ITEM)(
2363 IN PNDIS_MINIPORT_BLOCK Miniport,
2364 IN NDIS_WORK_ITEM_TYPE WorkItemType,
2365 IN PVOID WorkItemContext);
2366
2367 typedef VOID
2368 (NTAPI *NDIS_M_REQ_COMPLETE_HANDLER)(
2369 IN NDIS_HANDLE MiniportAdapterHandle,
2370 IN NDIS_STATUS Status);
2371
2372 typedef VOID
2373 (NTAPI *NDIS_M_RESET_COMPLETE_HANDLER)(
2374 IN NDIS_HANDLE MiniportAdapterHandle,
2375 IN NDIS_STATUS Status,
2376 IN BOOLEAN AddressingReset);
2377
2378 typedef VOID
2379 (NTAPI *NDIS_M_SEND_COMPLETE_HANDLER)(
2380 IN NDIS_HANDLE MiniportAdapterHandle,
2381 IN PNDIS_PACKET Packet,
2382 IN NDIS_STATUS Status);
2383
2384 typedef VOID
2385 (NTAPI *NDIS_M_SEND_RESOURCES_HANDLER)(
2386 IN NDIS_HANDLE MiniportAdapterHandle);
2387
2388 typedef BOOLEAN
2389 (FASTCALL *NDIS_M_START_SENDS)(
2390 IN PNDIS_MINIPORT_BLOCK Miniport);
2391
2392 typedef VOID
2393 (NTAPI *NDIS_M_STATUS_HANDLER)(
2394 IN NDIS_HANDLE MiniportHandle,
2395 IN NDIS_STATUS GeneralStatus,
2396 IN PVOID StatusBuffer,
2397 IN UINT StatusBufferSize);
2398
2399 typedef VOID
2400 (NTAPI *NDIS_M_STS_COMPLETE_HANDLER)(
2401 IN NDIS_HANDLE MiniportAdapterHandle);
2402
2403 typedef VOID
2404 (NTAPI *NDIS_M_TD_COMPLETE_HANDLER)(
2405 IN NDIS_HANDLE MiniportAdapterHandle,
2406 IN PNDIS_PACKET Packet,
2407 IN NDIS_STATUS Status,
2408 IN UINT BytesTransferred);
2409
2410 typedef VOID (NTAPI *NDIS_WM_SEND_COMPLETE_HANDLER)(
2411 IN NDIS_HANDLE MiniportAdapterHandle,
2412 IN PVOID Packet,
2413 IN NDIS_STATUS Status);
2414
2415
2416 #if ARCNET
2417
2418 #define ARC_SEND_BUFFERS 8
2419 #define ARC_HEADER_SIZE 4
2420
2421 typedef struct _NDIS_ARC_BUF {
2422 NDIS_HANDLE ArcnetBufferPool;
2423 PUCHAR ArcnetLookaheadBuffer;
2424 UINT NumFree;
2425 ARC_BUFFER_LIST ArcnetBuffers[ARC_SEND_BUFFERS];
2426 } NDIS_ARC_BUF, *PNDIS_ARC_BUF;
2427
2428 #endif /* ARCNET */
2429
2430 typedef struct _NDIS_LOG {
2431 PNDIS_MINIPORT_BLOCK Miniport;
2432 KSPIN_LOCK LogLock;
2433 PIRP Irp;
2434 UINT TotalSize;
2435 UINT CurrentSize;
2436 UINT InPtr;
2437 UINT OutPtr;
2438 UCHAR LogBuf[1];
2439 } NDIS_LOG, *PNDIS_LOG;
2440
2441 #if ARCNET
2442 #define FILTERDBS_ARCNET_S \
2443 PARC_FILTER ArcDB;
2444 #else /* !ARCNET */
2445 #define FILTERDBS_ARCNET_S \
2446 PVOID XXXDB;
2447 #endif /* !ARCNET */
2448
2449 #define FILTERDBS_S \
2450 _ANONYMOUS_UNION union { \
2451 PETH_FILTER EthDB; \
2452 PNULL_FILTER NullDB; \
2453 } DUMMYUNIONNAME; \
2454 PTR_FILTER TrDB; \
2455 PFDDI_FILTER FddiDB; \
2456 FILTERDBS_ARCNET_S
2457
2458 typedef struct _FILTERDBS {
2459 FILTERDBS_S
2460 } FILTERDBS, *PFILTERDBS;
2461
2462 struct _NDIS_MINIPORT_BLOCK {
2463 NDIS_OBJECT_HEADER Header;
2464 PNDIS_MINIPORT_BLOCK NextMiniport;
2465 PNDIS_M_DRIVER_BLOCK DriverHandle;
2466 NDIS_HANDLE MiniportAdapterContext;
2467 UNICODE_STRING MiniportName;
2468 PNDIS_BIND_PATHS BindPaths;
2469 NDIS_HANDLE OpenQueue;
2470 REFERENCE ShortRef;
2471 NDIS_HANDLE DeviceContext;
2472 UCHAR Padding1;
2473 UCHAR LockAcquired;
2474 UCHAR PmodeOpens;
2475 UCHAR AssignedProcessor;
2476 KSPIN_LOCK Lock;
2477 PNDIS_REQUEST MediaRequest;
2478 PNDIS_MINIPORT_INTERRUPT Interrupt;
2479 ULONG Flags;
2480 ULONG PnPFlags;
2481 LIST_ENTRY PacketList;
2482 PNDIS_PACKET FirstPendingPacket;
2483 PNDIS_PACKET ReturnPacketsQueue;
2484 ULONG RequestBuffer;
2485 PVOID SetMCastBuffer;
2486 PNDIS_MINIPORT_BLOCK PrimaryMiniport;
2487 PVOID WrapperContext;
2488 PVOID BusDataContext;
2489 ULONG PnPCapabilities;
2490 PCM_RESOURCE_LIST Resources;
2491 NDIS_TIMER WakeUpDpcTimer;
2492 UNICODE_STRING BaseName;
2493 UNICODE_STRING SymbolicLinkName;
2494 ULONG CheckForHangSeconds;
2495 USHORT CFHangTicks;
2496 USHORT CFHangCurrentTick;
2497 NDIS_STATUS ResetStatus;
2498 NDIS_HANDLE ResetOpen;
2499 FILTERDBS_S
2500 FILTER_PACKET_INDICATION_HANDLER PacketIndicateHandler;
2501 NDIS_M_SEND_COMPLETE_HANDLER SendCompleteHandler;
2502 NDIS_M_SEND_RESOURCES_HANDLER SendResourcesHandler;
2503 NDIS_M_RESET_COMPLETE_HANDLER ResetCompleteHandler;
2504 NDIS_MEDIUM MediaType;
2505 ULONG BusNumber;
2506 NDIS_INTERFACE_TYPE BusType;
2507 NDIS_INTERFACE_TYPE AdapterType;
2508 PDEVICE_OBJECT DeviceObject;
2509 PDEVICE_OBJECT PhysicalDeviceObject;
2510 PDEVICE_OBJECT NextDeviceObject;
2511 PMAP_REGISTER_ENTRY MapRegisters;
2512 PNDIS_AF_LIST CallMgrAfList;
2513 PVOID MiniportThread;
2514 PVOID SetInfoBuf;
2515 USHORT SetInfoBufLen;
2516 USHORT MaxSendPackets;
2517 NDIS_STATUS FakeStatus;
2518 PVOID LockHandler;
2519 PUNICODE_STRING pAdapterInstanceName;
2520 PNDIS_MINIPORT_TIMER TimerQueue;
2521 UINT MacOptions;
2522 PNDIS_REQUEST PendingRequest;
2523 UINT MaximumLongAddresses;
2524 UINT MaximumShortAddresses;
2525 UINT CurrentLookahead;
2526 UINT MaximumLookahead;
2527 W_HANDLE_INTERRUPT_HANDLER HandleInterruptHandler;
2528 W_DISABLE_INTERRUPT_HANDLER DisableInterruptHandler;
2529 W_ENABLE_INTERRUPT_HANDLER EnableInterruptHandler;
2530 W_SEND_PACKETS_HANDLER SendPacketsHandler;
2531 NDIS_M_START_SENDS DeferredSendHandler;
2532 ETH_RCV_INDICATE_HANDLER EthRxIndicateHandler;
2533 TR_RCV_INDICATE_HANDLER TrRxIndicateHandler;
2534 FDDI_RCV_INDICATE_HANDLER FddiRxIndicateHandler;
2535 ETH_RCV_COMPLETE_HANDLER EthRxCompleteHandler;
2536 TR_RCV_COMPLETE_HANDLER TrRxCompleteHandler;
2537 FDDI_RCV_COMPLETE_HANDLER FddiRxCompleteHandler;
2538 NDIS_M_STATUS_HANDLER StatusHandler;
2539 NDIS_M_STS_COMPLETE_HANDLER StatusCompleteHandler;
2540 NDIS_M_TD_COMPLETE_HANDLER TDCompleteHandler;
2541 NDIS_M_REQ_COMPLETE_HANDLER QueryCompleteHandler;
2542 NDIS_M_REQ_COMPLETE_HANDLER SetCompleteHandler;
2543 NDIS_WM_SEND_COMPLETE_HANDLER WanSendCompleteHandler;
2544 WAN_RCV_HANDLER WanRcvHandler;
2545 WAN_RCV_COMPLETE_HANDLER WanRcvCompleteHandler;
2546 #if defined(NDIS_WRAPPER)
2547 PNDIS_MINIPORT_BLOCK NextGlobalMiniport;
2548 SINGLE_LIST_ENTRY WorkQueue[NUMBER_OF_WORK_ITEM_TYPES];
2549 SINGLE_LIST_ENTRY SingleWorkItems[NUMBER_OF_SINGLE_WORK_ITEMS];
2550 UCHAR SendFlags;
2551 UCHAR TrResetRing;
2552 UCHAR ArcnetAddress;
2553 UCHAR XState;
2554 _ANONYMOUS_UNION union {
2555 #if ARCNET
2556 PNDIS_ARC_BUF ArcBuf;
2557 #endif
2558 PVOID BusInterface;
2559 } DUMMYUNIONNAME;
2560 PNDIS_LOG Log;
2561 ULONG SlotNumber;
2562 PCM_RESOURCE_LIST AllocatedResources;
2563 PCM_RESOURCE_LIST AllocatedResourcesTranslated;
2564 SINGLE_LIST_ENTRY PatternList;
2565 NDIS_PNP_CAPABILITIES PMCapabilities;
2566 DEVICE_CAPABILITIES DeviceCaps;
2567 ULONG WakeUpEnable;
2568 DEVICE_POWER_STATE CurrentDevicePowerState;
2569 PIRP pIrpWaitWake;
2570 SYSTEM_POWER_STATE WaitWakeSystemState;
2571 LARGE_INTEGER VcIndex;
2572 KSPIN_LOCK VcCountLock;
2573 LIST_ENTRY WmiEnabledVcs;
2574 PNDIS_GUID pNdisGuidMap;
2575 PNDIS_GUID pCustomGuidMap;
2576 USHORT VcCount;
2577 USHORT cNdisGuidMap;
2578 USHORT cCustomGuidMap;
2579 USHORT CurrentMapRegister;
2580 PKEVENT AllocationEvent;
2581 USHORT BaseMapRegistersNeeded;
2582 USHORT SGMapRegistersNeeded;
2583 ULONG MaximumPhysicalMapping;
2584 NDIS_TIMER MediaDisconnectTimer;
2585 USHORT MediaDisconnectTimeOut;
2586 USHORT InstanceNumber;
2587 NDIS_EVENT OpenReadyEvent;
2588 NDIS_PNP_DEVICE_STATE PnPDeviceState;
2589 NDIS_PNP_DEVICE_STATE OldPnPDeviceState;
2590 PGET_SET_DEVICE_DATA SetBusData;
2591 PGET_SET_DEVICE_DATA GetBusData;
2592 KDPC DeferredDpc;
2593 #if 0
2594 /* FIXME: */
2595 NDIS_STATS NdisStats;
2596 #else
2597 ULONG NdisStats;
2598 #endif
2599 PNDIS_PACKET IndicatedPacket[MAXIMUM_PROCESSORS];
2600 PKEVENT RemoveReadyEvent;
2601 PKEVENT AllOpensClosedEvent;
2602 PKEVENT AllRequestsCompletedEvent;
2603 ULONG InitTimeMs;
2604 NDIS_MINIPORT_WORK_ITEM WorkItemBuffer[NUMBER_OF_SINGLE_WORK_ITEMS];
2605 PDMA_ADAPTER SystemAdapterObject;
2606 ULONG DriverVerifyFlags;
2607 POID_LIST OidList;
2608 USHORT InternalResetCount;
2609 USHORT MiniportResetCount;
2610 USHORT MediaSenseConnectCount;
2611 USHORT MediaSenseDisconnectCount;
2612 PNDIS_PACKET *xPackets;
2613 ULONG UserModeOpenReferences;
2614 _ANONYMOUS_UNION union {
2615 PVOID SavedSendHandler;
2616 PVOID SavedWanSendHandler;
2617 } DUMMYUNIONNAME2;
2618 PVOID SavedSendPacketsHandler;
2619 PVOID SavedCancelSendPacketsHandler;
2620 W_SEND_PACKETS_HANDLER WSendPacketsHandler;
2621 ULONG MiniportAttributes;
2622 PDMA_ADAPTER SavedSystemAdapterObject;
2623 USHORT NumOpens;
2624 USHORT CFHangXTicks;
2625 ULONG RequestCount;
2626 ULONG IndicatedPacketsCount;
2627 ULONG PhysicalMediumType;
2628 PNDIS_REQUEST LastRequest;
2629 LONG DmaAdapterRefCount;
2630 PVOID FakeMac;
2631 ULONG LockDbg;
2632 ULONG LockDbgX;
2633 PVOID LockThread;
2634 ULONG InfoFlags;
2635 KSPIN_LOCK TimerQueueLock;
2636 PKEVENT ResetCompletedEvent;
2637 PKEVENT QueuedBindingCompletedEvent;
2638 PKEVENT DmaResourcesReleasedEvent;
2639 FILTER_PACKET_INDICATION_HANDLER SavedPacketIndicateHandler;
2640 ULONG RegisteredInterrupts;
2641 PNPAGED_LOOKASIDE_LIST SGListLookasideList;
2642 ULONG ScatterGatherListSize;
2643 #endif /* _NDIS_ */
2644 };
2645
2646 #if NDIS_LEGACY_DRIVER
2647
2648 typedef NDIS_STATUS
2649 (NTAPI *WAN_SEND_HANDLER)(
2650 IN NDIS_HANDLE MacBindingHandle,
2651 IN NDIS_HANDLE LinkHandle,
2652 IN PVOID Packet);
2653
2654 typedef VOID
2655 (NTAPI *SEND_PACKETS_HANDLER)(
2656 IN NDIS_HANDLE MiniportAdapterContext,
2657 IN PPNDIS_PACKET PacketArray,
2658 IN UINT NumberOfPackets);
2659
2660 typedef NDIS_STATUS
2661 (NTAPI *SEND_HANDLER)(
2662 IN NDIS_HANDLE NdisBindingHandle,
2663 IN PNDIS_PACKET Packet);
2664
2665 typedef NDIS_STATUS
2666 (NTAPI *TRANSFER_DATA_HANDLER)(
2667 IN NDIS_HANDLE NdisBindingHandle,
2668 IN NDIS_HANDLE MacReceiveContext,
2669 IN UINT ByteOffset,
2670 IN UINT BytesToTransfer,
2671 OUT PNDIS_PACKET Packet,
2672 OUT PUINT BytesTransferred);
2673
2674 typedef NDIS_STATUS
2675 (NTAPI *RESET_HANDLER)(
2676 IN NDIS_HANDLE NdisBindingHandle);
2677
2678 typedef NDIS_STATUS
2679 (NTAPI *REQUEST_HANDLER)(
2680 IN NDIS_HANDLE NdisBindingHandle,
2681 IN PNDIS_REQUEST NdisRequest);
2682
2683 #endif /* NDIS_LEGACY_DRIVER */
2684
2685 #if defined(NDIS_WRAPPER)
2686 #define NDIS_COMMON_OPEN_BLOCK_WRAPPER_S \
2687 ULONG Flags; \
2688 ULONG References; \
2689 KSPIN_LOCK SpinLock; \
2690 NDIS_HANDLE FilterHandle; \
2691 ULONG ProtocolOptions; \
2692 USHORT CurrentLookahead; \
2693 USHORT ConnectDampTicks; \
2694 USHORT DisconnectDampTicks; \
2695 W_SEND_HANDLER WSendHandler; \
2696 W_TRANSFER_DATA_HANDLER WTransferDataHandler; \
2697 W_SEND_PACKETS_HANDLER WSendPacketsHandler; \
2698 W_CANCEL_SEND_PACKETS_HANDLER CancelSendPacketsHandler; \
2699 ULONG WakeUpEnable; \
2700 PKEVENT CloseCompleteEvent; \
2701 QUEUED_CLOSE QC; \
2702 ULONG AfReferences; \
2703 PNDIS_OPEN_BLOCK NextGlobalOpen;
2704 #else
2705 #define NDIS_COMMON_OPEN_BLOCK_WRAPPER_S
2706 #endif
2707
2708 #define NDIS_COMMON_OPEN_BLOCK_S \
2709 PVOID MacHandle; \
2710 NDIS_HANDLE BindingHandle; \
2711 PNDIS_MINIPORT_BLOCK MiniportHandle; \
2712 PNDIS_PROTOCOL_BLOCK ProtocolHandle; \
2713 NDIS_HANDLE ProtocolBindingContext; \
2714 PNDIS_OPEN_BLOCK MiniportNextOpen; \
2715 PNDIS_OPEN_BLOCK ProtocolNextOpen; \
2716 NDIS_HANDLE MiniportAdapterContext; \
2717 BOOLEAN Reserved1; \
2718 BOOLEAN Reserved2; \
2719 BOOLEAN Reserved3; \
2720 BOOLEAN Reserved4; \
2721 PNDIS_STRING BindDeviceName; \
2722 KSPIN_LOCK Reserved5; \
2723 PNDIS_STRING RootDeviceName; \
2724 _ANONYMOUS_UNION union { \
2725 SEND_HANDLER SendHandler; \
2726 WAN_SEND_HANDLER WanSendHandler; \
2727 } DUMMYUNIONNAME; \
2728 TRANSFER_DATA_HANDLER TransferDataHandler; \
2729 SEND_COMPLETE_HANDLER SendCompleteHandler; \
2730 TRANSFER_DATA_COMPLETE_HANDLER TransferDataCompleteHandler; \
2731 RECEIVE_HANDLER ReceiveHandler; \
2732 RECEIVE_COMPLETE_HANDLER ReceiveCompleteHandler; \
2733 WAN_RECEIVE_HANDLER WanReceiveHandler; \
2734 REQUEST_COMPLETE_HANDLER RequestCompleteHandler; \
2735 RECEIVE_PACKET_HANDLER ReceivePacketHandler; \
2736 SEND_PACKETS_HANDLER SendPacketsHandler; \
2737 RESET_HANDLER ResetHandler; \
2738 REQUEST_HANDLER RequestHandler; \
2739 RESET_COMPLETE_HANDLER ResetCompleteHandler; \
2740 STATUS_HANDLER StatusHandler; \
2741 STATUS_COMPLETE_HANDLER StatusCompleteHandler; \
2742 NDIS_COMMON_OPEN_BLOCK_WRAPPER_S
2743
2744 typedef struct _NDIS_COMMON_OPEN_BLOCK {
2745 NDIS_COMMON_OPEN_BLOCK_S
2746 } NDIS_COMMON_OPEN_BLOCK;
2747
2748 struct _NDIS_OPEN_BLOCK
2749 {
2750 #ifdef __cplusplus
2751 NDIS_COMMON_OPEN_BLOCK NdisCommonOpenBlock;
2752 #else
2753 NDIS_COMMON_OPEN_BLOCK_S
2754 #endif
2755 };
2756
2757 #include <xfilter.h>
2758
2759 #define NDIS_M_MAX_LOOKAHEAD 526
2760
2761 NDISAPI
2762 VOID
2763 NTAPI
2764 NdisInitializeTimer(
2765 PNDIS_TIMER Timer,
2766 PNDIS_TIMER_FUNCTION TimerFunction,
2767 PVOID FunctionContext);
2768
2769 NDISAPI
2770 VOID
2771 NTAPI
2772 NdisCancelTimer(
2773 PNDIS_TIMER Timer,
2774 PBOOLEAN TimerCancelled);
2775
2776 NDISAPI
2777 VOID
2778 NTAPI
2779 NdisSetTimer(
2780 PNDIS_TIMER Timer,
2781 UINT MillisecondsToDelay);
2782
2783 NDISAPI
2784 VOID
2785 NTAPI
2786 NdisSetPeriodicTimer(
2787 PNDIS_TIMER NdisTimer,
2788 UINT MillisecondsPeriod);
2789
2790 NDISAPI
2791 VOID
2792 NTAPI
2793 NdisSetTimerEx(
2794 PNDIS_TIMER NdisTimer,
2795 UINT MillisecondsToDelay,
2796 PVOID FunctionContext);
2797
2798 NDISAPI
2799 PVOID
2800 NTAPI
2801 NdisGetRoutineAddress(
2802 PNDIS_STRING NdisRoutineName);
2803
2804 NDISAPI
2805 UINT
2806 NTAPI
2807 NdisGetVersion(VOID);
2808
2809 #if NDIS_LEGACY_DRIVER
2810
2811 NDISAPI
2812 VOID
2813 NTAPI
2814 NdisAllocateBuffer(
2815 OUT PNDIS_STATUS Status,
2816 OUT PNDIS_BUFFER *Buffer,
2817 IN NDIS_HANDLE PoolHandle OPTIONAL,
2818 IN PVOID VirtualAddress,
2819 IN UINT Length);
2820
2821 NDISAPI
2822 VOID
2823 NTAPI
2824 NdisAllocateBufferPool(
2825 OUT PNDIS_STATUS Status,
2826 OUT PNDIS_HANDLE PoolHandle,
2827 IN UINT NumberOfDescriptors);
2828
2829 NDISAPI
2830 VOID
2831 NTAPI
2832 NdisFreeBufferPool(
2833 IN NDIS_HANDLE PoolHandle);
2834
2835 /*
2836 NDISAPI
2837 VOID
2838 NTAPI
2839 NdisFreeBuffer(
2840 IN PNDIS_BUFFER Buffer);
2841 */
2842 #define NdisFreeBuffer IoFreeMdl
2843
2844 NDISAPI
2845 VOID
2846 NTAPI
2847 NdisAllocatePacketPool(
2848 OUT PNDIS_STATUS Status,
2849 OUT PNDIS_HANDLE PoolHandle,
2850 IN UINT NumberOfDescriptors,
2851 IN UINT ProtocolReservedLength);
2852
2853 NDISAPI
2854 VOID
2855 NTAPI
2856 NdisAllocatePacketPoolEx(
2857 OUT PNDIS_STATUS Status,
2858 OUT PNDIS_HANDLE PoolHandle,
2859 IN UINT NumberOfDescriptors,
2860 IN UINT NumberOfOverflowDescriptors,
2861 IN UINT ProtocolReservedLength);
2862
2863 NDISAPI
2864 VOID
2865 NTAPI
2866 NdisSetPacketPoolProtocolId(
2867 IN NDIS_HANDLE PacketPoolHandle,
2868 IN UINT ProtocolId);
2869
2870 NDISAPI
2871 UINT
2872 NTAPI
2873 NdisPacketPoolUsage(
2874 IN NDIS_HANDLE PoolHandle);
2875
2876 NDISAPI
2877 UINT
2878 NTAPI
2879 NdisPacketSize(
2880 IN UINT ProtocolReservedSize);
2881
2882 NDISAPI
2883 NDIS_HANDLE
2884 NTAPI
2885 NdisGetPoolFromPacket(
2886 IN PNDIS_PACKET Packet);
2887
2888 NDISAPI
2889 PNDIS_PACKET_STACK
2890 NTAPI
2891 NdisIMGetCurrentPacketStack(
2892 IN PNDIS_PACKET Packet,
2893 OUT BOOLEAN * StacksRemaining);
2894
2895 NDISAPI
2896 VOID
2897 NTAPI
2898 NdisFreePacketPool(
2899 IN NDIS_HANDLE PoolHandle);
2900
2901 NDISAPI
2902 VOID
2903 NTAPI
2904 NdisFreePacket(
2905 IN PNDIS_PACKET Packet);
2906
2907 NDISAPI
2908 VOID
2909 NTAPI
2910 NdisDprFreePacket(
2911 IN PNDIS_PACKET Packet);
2912
2913 NDISAPI
2914 VOID
2915 NTAPI
2916 NdisDprFreePacketNonInterlocked(
2917 IN PNDIS_PACKET Packet);
2918
2919 NDISAPI
2920 VOID
2921 NTAPI
2922 NdisAllocatePacket(
2923 OUT PNDIS_STATUS Status,
2924 OUT PNDIS_PACKET *Packet,
2925 IN NDIS_HANDLE PoolHandle);
2926
2927 NDISAPI
2928 VOID
2929 NTAPI
2930 NdisDprAllocatePacket(
2931 OUT PNDIS_STATUS Status,
2932 OUT PNDIS_PACKET *Packet,
2933 IN NDIS_HANDLE PoolHandle);
2934
2935 NDISAPI
2936 VOID
2937 NTAPI
2938 NdisDprAllocatePacketNonInterlocked(
2939 OUT PNDIS_STATUS Status,
2940 OUT PNDIS_PACKET *Packet,
2941 IN NDIS_HANDLE PoolHandle);
2942
2943 /*
2944 * VOID
2945 * NdisReinitializePacket(
2946 * IN OUT PNDIS_PACKET Packet);
2947 */
2948 #define NdisReinitializePacket(Packet) { \
2949 (Packet)->Private.Head = (PNDIS_BUFFER)NULL; \
2950 (Packet)->Private.ValidCounts = FALSE; \
2951 }
2952
2953 /*
2954 NDISAPI
2955 VOID
2956 NTAPI
2957 NdisQueryBuffer(
2958 IN PNDIS_BUFFER Buffer,
2959 OUT PVOID *VirtualAddress OPTIONAL,
2960 OUT PUINT Length);
2961 */
2962 #define NdisQueryBuffer(_Buffer, _VirtualAddress, _Length) { \
2963 if (ARGUMENT_PRESENT(_VirtualAddress)) { \
2964 *(PVOID *)(_VirtualAddress) = MmGetSystemAddressForMdl(_Buffer); \
2965 } \
2966 *(_Length) = MmGetMdlByteCount(_Buffer); \
2967 }
2968
2969 NDISAPI
2970 VOID
2971 NTAPI
2972 NdisGetFirstBufferFromPacket(
2973 IN PNDIS_PACKET _Packet,
2974 OUT PNDIS_BUFFER *_FirstBuffer,
2975 OUT PVOID *_FirstBufferVA,
2976 OUT PUINT _FirstBufferLength,
2977 OUT PUINT _TotalBufferLength);
2978
2979 /*
2980 * VOID
2981 * NdisGetFirstBufferFromPacketSafe(
2982 * IN PNDIS_PACKET _Packet,
2983 * OUT PNDIS_BUFFER * _FirstBuffer,
2984 * OUT PVOID * _FirstBufferVA,
2985 * OUT PUINT _FirstBufferLength,
2986 * OUT PUINT _TotalBufferLength),
2987 * IN MM_PAGE_PRIORITY _Priority)
2988 */
2989 #define NdisGetFirstBufferFromPacketSafe(_Packet, \
2990 _FirstBuffer, \
2991 _FirstBufferVA, \
2992 _FirstBufferLength, \
2993 _TotalBufferLength, \
2994 _Priority) \
2995 { \
2996 PNDIS_BUFFER _Buffer; \
2997 \
2998 _Buffer = (_Packet)->Private.Head; \
2999 *(_FirstBuffer) = _Buffer; \
3000 if (_Buffer != NULL) { \
3001 *(_FirstBufferVA) = MmGetSystemAddressForMdlSafe(_Buffer, _Priority); \
3002 *(_FirstBufferLength) = MmGetMdlByteCount(_Buffer); \
3003 _Buffer = _Buffer->Next; \
3004 *(_TotalBufferLength) = *(_FirstBufferLength); \
3005 while (_Buffer != NULL) { \
3006 *(_TotalBufferLength) += MmGetMdlByteCount(_Buffer); \
3007 _Buffer = _Buffer->Next; \
3008 } \
3009 } \
3010 else { \
3011 *(_FirstBufferVA) = 0; \
3012 *(_FirstBufferLength) = 0; \
3013 *(_TotalBufferLength) = 0; \
3014 } \
3015 }
3016
3017 /*
3018 * VOID
3019 * NdisRecalculatePacketCounts(
3020 * IN OUT PNDIS_PACKET Packet);
3021 */
3022 #define NdisRecalculatePacketCounts(Packet) { \
3023 PNDIS_BUFFER _Buffer = (Packet)->Private.Head; \
3024 if (_Buffer != NULL) { \
3025 while (_Buffer->Next != NULL) { \
3026 _Buffer = _Buffer->Next; \
3027 } \
3028 (Packet)->Private.Tail = _Buffer; \
3029 } \
3030 (Packet)->Private.ValidCounts = FALSE; \
3031 }
3032
3033 /*
3034 * VOID
3035 * NdisChainBufferAtFront(
3036 * IN OUT PNDIS_PACKET Packet,
3037 * IN OUT PNDIS_BUFFER Buffer)
3038 */
3039 #define NdisChainBufferAtFront(Packet, \
3040 Buffer) \
3041 { \
3042 PNDIS_BUFFER _NdisBuffer = (Buffer); \
3043 \
3044 while (_NdisBuffer->Next != NULL) \
3045 _NdisBuffer = _NdisBuffer->Next; \
3046 \
3047 if ((Packet)->Private.Head == NULL) \
3048 (Packet)->Private.Tail = _NdisBuffer; \
3049 \
3050 _NdisBuffer->Next = (Packet)->Private.Head; \
3051 (Packet)->Private.Head = (Buffer); \
3052 (Packet)->Private.ValidCounts = FALSE; \
3053 }
3054
3055 /*
3056 * VOID
3057 * NdisChainBufferAtBack(
3058 * IN OUT PNDIS_PACKET Packet,
3059 * IN OUT PNDIS_BUFFER Buffer)
3060 */
3061 #define NdisChainBufferAtBack(Packet, \
3062 Buffer) \
3063 { \
3064 PNDIS_BUFFER NdisBuffer = (Buffer); \
3065 \
3066 while (NdisBuffer->Next != NULL) \
3067 NdisBuffer = NdisBuffer->Next; \
3068 \
3069 NdisBuffer->Next = NULL; \
3070 \
3071 if ((Packet)->Private.Head != NULL) \
3072 (Packet)->Private.Tail->Next = (Buffer); \
3073 else \
3074 (Packet)->Private.Head = (Buffer); \
3075 \
3076 (Packet)->Private.Tail = NdisBuffer; \
3077 (Packet)->Private.ValidCounts = FALSE; \
3078 }
3079
3080 NDISAPI
3081 VOID
3082 NTAPI
3083 NdisUnchainBufferAtFront(
3084 IN OUT PNDIS_PACKET Packet,
3085 OUT PNDIS_BUFFER *Buffer);
3086
3087 NDISAPI
3088 VOID
3089 NTAPI
3090 NdisUnchainBufferAtBack(
3091 IN OUT PNDIS_PACKET Packet,
3092 OUT PNDIS_BUFFER *Buffer);
3093
3094 NDISAPI
3095 VOID
3096 NTAPI
3097 NdisCopyFromPacketToPacket(
3098 IN PNDIS_PACKET Destination,
3099 IN UINT DestinationOffset,
3100 IN UINT BytesToCopy,
3101 IN PNDIS_PACKET Source,
3102 IN UINT SourceOffset,
3103 OUT PUINT BytesCopied);
3104
3105 NDISAPI
3106 VOID
3107 NTAPI
3108 NdisCopyFromPacketToPacketSafe(
3109 IN PNDIS_PACKET Destination,
3110 IN UINT DestinationOffset,
3111 IN UINT BytesToCopy,
3112 IN PNDIS_PACKET Source,
3113 IN UINT SourceOffset,
3114 OUT PUINT BytesCopied,
3115 IN MM_PAGE_PRIORITY Priority);
3116
3117 NDISAPI
3118 NDIS_STATUS
3119 NTAPI
3120 NdisAllocateMemory(
3121 OUT PVOID *VirtualAddress,
3122 IN UINT Length,
3123 IN UINT MemoryFlags,
3124 IN NDIS_PHYSICAL_ADDRESS HighestAcceptableAddress);
3125
3126 #define NdisInitializeWorkItem(_WI_, _R_, _C_) { \
3127 (_WI_)->Context = _C_; \
3128 (_WI_)->Routine = _R_; \
3129 }
3130
3131 NDISAPI
3132 NDIS_STATUS
3133 NTAPI
3134 NdisScheduleWorkItem(
3135 IN PNDIS_WORK_ITEM WorkItem);
3136
3137 NDISAPI
3138 VOID
3139 NTAPI
3140 NdisSetPacketStatus(
3141 IN PNDIS_PACKET Packet,
3142 IN NDIS_STATUS Status,
3143 IN NDIS_HANDLE Handle,
3144 IN ULONG Code);
3145
3146 #endif /* NDIS_LEGACY_DRIVER */
3147
3148 NDISAPI
3149 VOID
3150 NTAPI
3151 NdisOpenFile(
3152 OUT PNDIS_STATUS Status,
3153 OUT PNDIS_HANDLE FileHandle,
3154 OUT PUINT FileLength,
3155 IN PNDIS_STRING FileName,
3156 IN NDIS_PHYSICAL_ADDRESS HighestAcceptableAddress);
3157
3158 NDISAPI
3159 VOID
3160 NTAPI
3161 NdisCloseFile(
3162 IN NDIS_HANDLE FileHandle);
3163
3164 NDISAPI
3165 VOID
3166 NTAPI
3167 NdisMapFile(
3168 OUT PNDIS_STATUS Status,
3169 OUT PVOID *MappedBuffer,
3170 IN NDIS_HANDLE FileHandle);
3171
3172 NDISAPI
3173 VOID
3174 NTAPI
3175 NdisUnmapFile(
3176 IN NDIS_HANDLE FileHandle);
3177
3178 NDISAPI
3179 ULONG
3180 NTAPI
3181 NdisGetSharedDataAlignment(VOID);
3182
3183 #define NdisFlushBuffer(Buffer,WriteToDevice) \
3184 KeFlushIoBuffers((Buffer),!(WriteToDevice), TRUE)
3185
3186 NDISAPI
3187 VOID
3188 NTAPI
3189 NdisCopyBuffer(
3190 OUT PNDIS_STATUS Status,
3191 OUT PNDIS_BUFFER *Buffer,
3192 IN NDIS_HANDLE PoolHandle,
3193 IN PVOID MemoryDescriptor,
3194 IN UINT Offset,
3195 IN UINT Length);
3196
3197 /*
3198 * VOID
3199 * NdisCopyLookaheadData(
3200 * IN PVOID Destination,
3201 * IN PVOID Source,
3202 * IN ULONG Length,
3203 * IN ULONG ReceiveFlags);
3204 */
3205
3206 #if defined(_M_IX86) || defined(_M_AMD64)
3207 #define NdisCopyLookaheadData(Destination, Source, Length, MacOptions) \
3208 RtlCopyMemory(Destination, Source, Length)
3209 #else
3210 #define NdisCopyLookaheadData(Destination, Source, Length, MacOptions) \
3211 { \
3212 if ((MacOptions) & NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA) \
3213 { \
3214 RtlCopyMemory(_Destination, _Source, _Length); \
3215 } \
3216 else \
3217 { \
3218 PUCHAR _Src = (PUCHAR)(Source); \
3219 PUCHAR _Dest = (PUCHAR)(Destination); \
3220 PUCHAR _End = _Dest + (Length); \
3221 while (_Dest < _End) \
3222 *_Dest++ = *_Src++; \
3223 } \
3224 }
3225 #endif
3226
3227 /*
3228 NDISAPI
3229 VOID
3230 NTAPI
3231 NdisAdjustBufferLength(
3232 IN PNDIS_BUFFER Buffer,
3233 IN UINT Length);
3234 */
3235 #define NdisAdjustBufferLength(Buffer, Length) \
3236 (((Buffer)->ByteCount) = (Length))
3237
3238 #if NDIS_SUPPORT_NDIS6
3239 #define NdisAdjustMdlLength(_Mdl, _Length) \
3240 (((_Mdl)->ByteCount) = (_Length))
3241 #endif
3242
3243 /*
3244 NDISAPI
3245 ULONG
3246 NTAPI
3247 NdisBufferLength(
3248 IN PNDIS_BUFFER Buffer);
3249 */
3250 #define NdisBufferLength MmGetMdlByteCount
3251
3252 /*
3253 NDISAPI
3254 PVOID
3255 NTAPI
3256 NdisBufferVirtualAddress(
3257 IN PNDIS_BUFFER Buffer);
3258 */
3259 #define NdisBufferVirtualAddress MmGetSystemAddressForMdl
3260
3261 #define NdisBufferVirtualAddressSafe MmGetSystemAddressForMdlSafe
3262
3263 NDISAPI
3264 ULONG
3265 NTAPI
3266 NDIS_BUFFER_TO_SPAN_PAGES(
3267 IN PNDIS_BUFFER Buffer);
3268
3269 /*
3270 NDISAPI
3271 VOID
3272 NTAPI
3273 NdisGetBufferPhysicalArraySize(
3274 IN PNDIS_BUFFER Buffer,
3275 OUT PUINT ArraySize);
3276 */
3277 #define NdisGetBufferPhysicalArraySize(Buffer, ArraySize) \
3278 (*(ArraySize) = NDIS_BUFFER_TO_SPAN_PAGES(Buffer))
3279
3280 /*
3281 NDISAPI
3282 VOID
3283 NTAPI
3284 NdisQueryBufferOffset(
3285 IN PNDIS_BUFFER Buffer,
3286 OUT PUINT Offset,
3287 OUT PUINT Length);
3288 */
3289 #define NdisQueryBufferOffset(_Buffer, _Offset, _Length) { \
3290 *(_Offset) = MmGetMdlByteOffset(_Buffer); \
3291 *(_Length) = MmGetMdlByteCount(_Buffer); \
3292 }
3293
3294 /*
3295 * PVOID
3296 * NDIS_BUFFER_LINKAGE(
3297 * IN PNDIS_BUFFER Buffer);
3298 */
3299 #define NDIS_BUFFER_LINKAGE(Buffer)(Buffer)->Next;
3300
3301 /*
3302 * VOID
3303 * NdisGetNextBuffer(
3304 * IN PNDIS_BUFFER CurrentBuffer,
3305 * OUT PNDIS_BUFFER * NextBuffer)
3306 */
3307 #define NdisGetNextBuffer(CurrentBuffer, \
3308 NextBuffer) \
3309 { \
3310 *(NextBuffer) = (CurrentBuffer)->Next; \
3311 }
3312
3313 #if NDIS_LEGACY_DRIVER
3314
3315 #define NDIS_PACKET_FIRST_NDIS_BUFFER(_Packet) ((_Packet)->Private.Head)
3316 #define NDIS_PACKET_LAST_NDIS_BUFFER(_Packet) ((_Packet)->Private.Tail)
3317 #define NDIS_PACKET_VALID_COUNTS(_Packet) ((_Packet)->Private.ValidCounts)
3318
3319 /*
3320 * UINT
3321 * NdisGetPacketFlags(
3322 * IN PNDIS_PACKET Packet);
3323 */
3324 #define NdisGetPacketFlags(Packet)(Packet)->Private.Flags;
3325
3326 /*
3327 * ULONG
3328 * NDIS_GET_PACKET_PROTOCOL_TYPE(
3329 * IN PNDIS_PACKET Packet);
3330 */
3331 #define NDIS_GET_PACKET_PROTOCOL_TYPE(_Packet) \
3332 ((_Packet)->Private.Flags & NDIS_PROTOCOL_ID_MASK)
3333
3334 /*
3335 * PNDIS_PACKET_OOB_DATA
3336 * NDIS_OOB_DATA_FROM_PACKET(
3337 * IN PNDIS_PACKET Packet);
3338 */
3339 #define NDIS_OOB_DATA_FROM_PACKET(_Packet) \
3340 (PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
3341 (_Packet)->Private.NdisPacketOobOffset)
3342
3343 /*
3344 * ULONG
3345 * NDIS_GET_PACKET_HEADER_SIZE(
3346 * IN PNDIS_PACKET Packet);
3347 */
3348 #define NDIS_GET_PACKET_HEADER_SIZE(_Packet) \
3349 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
3350 (_Packet)->Private.NdisPacketOobOffset))->HeaderSize
3351
3352 /*
3353 * NDIS_STATUS
3354 * NDIS_GET_PACKET_STATUS(
3355 * IN PNDIS_PACKET Packet);
3356 */
3357 #define NDIS_GET_PACKET_STATUS(_Packet) \
3358 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
3359 (_Packet)->Private.NdisPacketOobOffset))->Status
3360
3361 /*
3362 * ULONGLONG
3363 * NDIS_GET_PACKET_TIME_TO_SEND(
3364 * IN PNDIS_PACKET Packet);
3365 */
3366 #define NDIS_GET_PACKET_TIME_TO_SEND(_Packet) \
3367 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
3368 (_Packet)->Private.NdisPacketOobOffset))->TimeToSend
3369
3370 /*
3371 * ULONGLONG
3372 * NDIS_GET_PACKET_TIME_SENT(
3373 * IN PNDIS_PACKET Packet);
3374 */
3375 #define NDIS_GET_PACKET_TIME_SENT(_Packet) \
3376 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
3377 (_Packet)->Private.NdisPacketOobOffset))->TimeSent
3378
3379 /*
3380 * ULONGLONG
3381 * NDIS_GET_PACKET_TIME_RECEIVED(
3382 * IN PNDIS_PACKET Packet);
3383 */
3384 #define NDIS_GET_PACKET_TIME_RECEIVED(_Packet) \
3385 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
3386 (_Packet)->Private.NdisPacketOobOffset))->TimeReceived
3387
3388 /*
3389 * VOID
3390 * NDIS_GET_PACKET_MEDIA_SPECIFIC_INFO(
3391 * IN PNDIS_PACKET Packet,
3392 * IN PPVOID pMediaSpecificInfo,
3393 * IN PUINT pSizeMediaSpecificInfo);
3394 */
3395 #define NDIS_GET_PACKET_MEDIA_SPECIFIC_INFO(_Packet, \
3396 _pMediaSpecificInfo, \
3397 _pSizeMediaSpecificInfo) \
3398 { \
3399 if (!((_Packet)->Private.NdisPacketFlags & fPACKET_ALLOCATED_BY_NDIS) || \
3400 !((_Packet)->Private.NdisPacketFlags & fPACKET_CONTAINS_MEDIA_SPECIFIC_INFO)) \
3401 { \
3402 *(_pMediaSpecificInfo) = NULL; \
3403 *(_pSizeMediaSpecificInfo) = 0; \
3404 } \
3405 else \
3406 { \
3407 *(_pMediaSpecificInfo) = ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
3408 (_Packet)->Private.NdisPacketOobOffset))->MediaSpecificInformation; \
3409 *(_pSizeMediaSpecificInfo) = ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
3410 (_Packet)->Private.NdisPacketOobOffset))->SizeMediaSpecificInfo; \
3411 } \
3412 }
3413
3414 /*
3415 * VOID
3416 * NDIS_SET_PACKET_HEADER_SIZE(
3417 * IN PNDIS_PACKET Packet,
3418 * IN UINT HdrSize);
3419 */
3420 #define NDIS_SET_PACKET_HEADER_SIZE(_Packet, _HdrSize) \
3421 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
3422 (_Packet)->Private.NdisPacketOobOffset))->HeaderSize = (_HdrSize)
3423
3424 /*
3425 * VOID
3426 * NDIS_SET_PACKET_STATUS(
3427 * IN PNDIS_PACKET Packet,
3428 * IN NDIS_STATUS Status);
3429 */
3430 #define NDIS_SET_PACKET_STATUS(_Packet, _Status) \
3431 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
3432 (_Packet)->Private.NdisPacketOobOffset))->Status = (_Status)
3433
3434 /*
3435 * VOID
3436 * NDIS_SET_PACKET_TIME_TO_SEND(
3437 * IN PNDIS_PACKET Packet,
3438 * IN ULONGLONG TimeToSend);
3439 */
3440 #define NDIS_SET_PACKET_TIME_TO_SEND(_Packet, _TimeToSend) \
3441 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
3442 (_Packet)->Private.NdisPacketOobOffset))->TimeToSend = (_TimeToSend)
3443
3444 /*
3445 * VOID
3446 * NDIS_SET_PACKET_TIME_SENT(
3447 * IN PNDIS_PACKET Packet,
3448 * IN ULONGLONG TimeSent);
3449 */
3450 #define NDIS_SET_PACKET_TIME_SENT(_Packet, _TimeSent) \
3451 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
3452 (_Packet)->Private.NdisPacketOobOffset))->TimeSent = (_TimeSent)
3453
3454 /*
3455 * VOID
3456 * NDIS_SET_PACKET_TIME_RECEIVED(
3457 * IN PNDIS_PACKET Packet,
3458 * IN ULONGLONG TimeReceived);
3459 */
3460 #define NDIS_SET_PACKET_TIME_RECEIVED(_Packet, _TimeReceived) \
3461 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
3462 (_Packet)->Private.NdisPacketOobOffset))->TimeReceived = (_TimeReceived)
3463
3464 /*
3465 * VOID
3466 * NDIS_SET_PACKET_MEDIA_SPECIFIC_INFO(
3467 * IN PNDIS_PACKET Packet,
3468 * IN PVOID MediaSpecificInfo,
3469 * IN UINT SizeMediaSpecificInfo);
3470 */
3471 #define NDIS_SET_PACKET_MEDIA_SPECIFIC_INFO(_Packet, \
3472 _MediaSpecificInfo, \
3473 _SizeMediaSpecificInfo) \
3474 { \
3475 if ((_Packet)->Private.NdisPacketFlags & fPACKET_ALLOCATED_BY_NDIS) \
3476 { \
3477 (_Packet)->Private.NdisPacketFlags |= fPACKET_CONTAINS_MEDIA_SPECIFIC_INFO; \
3478 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
3479 (_Packet)->Private.NdisPacketOobOffset))->MediaSpecificInformation = \
3480 (_MediaSpecificInfo); \
3481 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
3482 (_Packet)->Private.NdisPacketOobOffset))->SizeMediaSpecificInfo = \
3483 (_SizeMediaSpecificInfo); \
3484 } \
3485 }
3486
3487 /*
3488 * VOID
3489 * NdisSetPacketFlags(
3490 * IN PNDIS_PACKET Packet,
3491 * IN UINT Flags);
3492 */
3493 #define NdisSetPacketFlags(Packet, Flags) (Packet)->Private.Flags |= (Flags)
3494
3495 /*
3496 * VOID
3497 * NdisClearPacketFlags(
3498 * IN PNDIS_PACKET Packet,
3499 * IN UINT Flags);
3500 */
3501 #define NdisClearPacketFlags(Packet, Flags) (Packet)->Private.Flags &= ~(Flags)
3502
3503 /*
3504 * VOID
3505 * NdisQueryPacket(
3506 * IN PNDIS_PACKET Packet,
3507 * OUT PUINT PhysicalBufferCount OPTIONAL,
3508 * OUT PUINT BufferCount OPTIONAL,
3509 * OUT PNDIS_BUFFER *FirstBuffer OPTIONAL,
3510 * OUT PUINT TotalPacketLength OPTIONAL);
3511 */
3512 static __inline
3513 VOID
3514 NdisQueryPacket(
3515 IN PNDIS_PACKET Packet,
3516 OUT PUINT PhysicalBufferCount OPTIONAL,
3517 OUT PUINT BufferCount OPTIONAL,
3518 OUT PNDIS_BUFFER *FirstBuffer OPTIONAL,
3519 OUT PUINT TotalPacketLength OPTIONAL)
3520 {
3521 if (FirstBuffer)
3522 *FirstBuffer = Packet->Private.Head;
3523 if (TotalPacketLength || BufferCount || PhysicalBufferCount) {
3524 if (!Packet->Private.ValidCounts) {
3525 UINT Offset;
3526 UINT PacketLength;
3527 PNDIS_BUFFER NdisBuffer;
3528 UINT PhysicalBufferCount = 0;
3529 UINT TotalPacketLength = 0;
3530 UINT Count = 0;
3531
3532 for (NdisBuffer = Packet->Private.Head;
3533 NdisBuffer != (PNDIS_BUFFER)NULL;
3534 NdisBuffer = NdisBuffer->Next) {
3535 PhysicalBufferCount += NDIS_BUFFER_TO_SPAN_PAGES(NdisBuffer);
3536 NdisQueryBufferOffset(NdisBuffer, &Offset, &PacketLength);
3537 TotalPacketLength += PacketLength;
3538 Count++;
3539 }
3540 Packet->Private.PhysicalCount = PhysicalBufferCount;
3541 Packet->Private.TotalLength = TotalPacketLength;
3542 Packet->Private.Count = Count;
3543 Packet->Private.ValidCounts = TRUE;
3544 }
3545
3546 if (PhysicalBufferCount)
3547 *PhysicalBufferCount = Packet->Private.PhysicalCount;
3548
3549 if (BufferCount)
3550 *BufferCount = Packet->Private.Count;
3551
3552 if (TotalPacketLength)
3553 *TotalPacketLength = Packet->Private.TotalLength;
3554 }
3555 }
3556
3557 /*
3558 * VOID
3559 * NdisQueryPacketLength(
3560 * IN PNDIS_PACKET Packet,
3561 * OUT PUINT PhysicalBufferCount OPTIONAL,
3562 * OUT PUINT BufferCount OPTIONAL,
3563 * OUT PNDIS_BUFFER *FirstBuffer OPTIONAL,
3564 * OUT PUINT TotalPacketLength OPTIONAL);
3565 */
3566 #define NdisQueryPacketLength(_Packet, \
3567 _TotalPacketLength) \
3568 { \
3569 if (!(_Packet)->Private.ValidCounts) { \
3570 NdisQueryPacket(_Packet, NULL, NULL, NULL, _TotalPacketLength); \
3571 } \
3572 else *(_TotalPacketLength) = (_Packet)->Private.TotalLength; \
3573 }
3574
3575 #endif /* NDIS_LEGACY_DRIVER */
3576
3577 /* Memory management routines */
3578
3579 /*
3580 NDISAPI
3581 VOID
3582 NTAPI
3583 NdisCreateLookaheadBufferFromSharedMemory(
3584 IN PVOID pSharedMemory,
3585 IN UINT LookaheadLength,
3586 OUT PVOID *pLookaheadBuffer);
3587 */
3588 #define NdisCreateLookaheadBufferFromSharedMemory(_S, _L, _B) ((*(_B)) = (_S))
3589
3590 NDISAPI
3591 VOID
3592 NTAPI
3593 NdisDestroyLookaheadBufferFromSharedMemory(
3594 IN PVOID pLookaheadBuffer);
3595
3596 #if defined(_M_IX86) || defined(_M_AMD64) || defined(_M_ARM) || defined(_M_PPC)
3597
3598 /*
3599 * VOID
3600 * NdisMoveMappedMemory(
3601 * OUT PVOID Destination,
3602 * IN PVOID Source,
3603 * IN ULONG Length);
3604 */
3605 #define NdisMoveMappedMemory(Destination, Source, Length) \
3606 RtlCopyMemory(Destination, Source, Length)
3607
3608 /*
3609 * VOID
3610 * NdisZeroMappedMemory(
3611 * IN PVOID Destination,
3612 * IN ULONG Length);
3613 */
3614 #define NdisZeroMappedMemory(Destination, Length) \
3615 RtlZeroMemory(Destination, Length)
3616
3617 #else
3618
3619 #define NdisMoveMappedMemory(Destination, Source, Length) \
3620 { \
3621 PUCHAR _Dest = Destination, _Src = Source, _End = _Dest + Length; \
3622 while (_Dest < _End) \
3623 *_Dest++ = _Src++; \
3624 }
3625
3626 #define NdisZeroMappedMemory(Destination, Length) \
3627 { \
3628 PUCHAR _Dest = Destination, _End = _Dest + Length; \
3629 while (_Dest < _End) \
3630 *_Dest++ = 0; \
3631 }
3632
3633 #endif /* _M_IX86 or _M_AMD64 */
3634
3635 /*
3636 * VOID
3637 * NdisMoveFromMappedMemory(
3638 * OUT PVOID Destination,
3639 * IN PVOID Source,
3640 * IN ULONG Length);
3641 */
3642 #define NdisMoveFromMappedMemory(Destination, Source, Length) \
3643 NdisMoveMappedMemory(Destination, Source, Length)
3644
3645 /*
3646 * VOID
3647 * NdisMoveToMappedMemory(
3648 * OUT PVOID Destination,
3649 * IN PVOID Source,
3650 * IN ULONG Length);
3651 */
3652 #define NdisMoveToMappedMemory(Destination, Source, Length) \
3653 NdisMoveMappedMemory(Destination, Source, Length)
3654
3655 /*
3656 * VOID
3657 * NdisMUpdateSharedMemory(
3658 * IN NDIS_HANDLE MiniportAdapterHandle,
3659 * IN ULONG Length,
3660 * IN PVOID VirtualAddress,
3661 * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress);
3662 */
3663 #define NdisMUpdateSharedMemory(_H, _L, _V, _P) \
3664 NdisUpdateSharedMemory(_H, _L, _V, _P)
3665
3666 NDISAPI
3667 VOID
3668 NTAPI
3669 NdisFreeMemory(
3670 IN PVOID VirtualAddress,
3671 IN UINT Length,
3672 IN UINT MemoryFlags);
3673
3674 NDISAPI
3675 VOID
3676 NTAPI
3677 NdisFreeMemoryWithTag(
3678 IN PVOID VirtualAddress,
3679 IN ULONG Tag);
3680
3681 NDISAPI
3682 VOID
3683 NTAPI
3684 NdisImmediateReadSharedMemory(
3685 IN NDIS_HANDLE WrapperConfigurationContext,
3686 IN ULONG SharedMemoryAddress,
3687 OUT PUCHAR Buffer,
3688 IN ULONG Length);
3689
3690 NDISAPI
3691 VOID
3692 NTAPI
3693 NdisImmediateWriteSharedMemory(
3694 IN NDIS_HANDLE WrapperConfigurationContext,
3695 IN ULONG SharedMemoryAddress,
3696 IN PUCHAR Buffer,
3697 IN ULONG Length);
3698
3699 NDISAPI
3700 VOID
3701 NTAPI
3702 NdisMAllocateSharedMemory(
3703 IN NDIS_HANDLE MiniportAdapterHandle,
3704 IN ULONG Length,
3705 IN BOOLEAN Cached,
3706 OUT PVOID *VirtualAddress,
3707 OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress);
3708
3709 NDISAPI
3710 NDIS_STATUS
3711 NTAPI
3712 NdisMAllocateSharedMemoryAsync(
3713 IN NDIS_HANDLE MiniportAdapterHandle,
3714 IN ULONG Length,
3715 IN BOOLEAN Cached,
3716 IN PVOID Context);
3717
3718 #if defined(NDIS50)
3719
3720 #define NdisUpdateSharedMemory(NdisAdapterHandle, \
3721 Length, \
3722 VirtualAddress, \
3723 PhysicalAddress)
3724
3725 #else
3726
3727 NDISAPI
3728 VOID
3729 NTAPI
3730 NdisUpdateSharedMemory(
3731 IN NDIS_HANDLE NdisAdapterHandle,
3732 IN ULONG Length,
3733 IN PVOID VirtualAddress,
3734 IN NDIS_PHYSICAL_ADDRESS PhysicalAddress);
3735
3736 #endif /* defined(NDIS50) */
3737
3738 /*
3739 * ULONG
3740 * NdisGetPhysicalAddressHigh(
3741 * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress);
3742 */
3743 #define NdisGetPhysicalAddressHigh(PhysicalAddress) \
3744 ((PhysicalAddress).HighPart)
3745
3746 /*
3747 * VOID
3748 * NdisSetPhysicalAddressHigh(
3749 * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress,
3750 * IN ULONG Value);
3751 */
3752 #define NdisSetPhysicalAddressHigh(PhysicalAddress, Value) \
3753 ((PhysicalAddress).HighPart) = (Value)
3754
3755 /*
3756 * ULONG
3757 * NdisGetPhysicalAddressLow(
3758 * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress);
3759 */
3760 #define NdisGetPhysicalAddressLow(PhysicalAddress) \
3761 ((PhysicalAddress).LowPart)
3762
3763
3764 /*
3765 * VOID
3766 * NdisSetPhysicalAddressLow(
3767 * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress,
3768 * IN ULONG Value);
3769 */
3770 #define NdisSetPhysicalAddressLow(PhysicalAddress, Value) \
3771 ((PhysicalAddress).LowPart) = (Value)
3772
3773 /*
3774 * VOID
3775 * NDIS_PHYSICAL_ADDRESS_CONST(
3776 * IN ULONG Low,
3777 * IN LONG High);
3778 */
3779 #define NDIS_PHYSICAL_ADDRESS_CONST(Low, High) \
3780 { {(ULONG)(Low), (LONG)(High)} }
3781
3782 /*
3783 * ULONG
3784 * NdisEqualMemory(
3785 * IN CONST VOID *Source1,
3786 * IN CONST VOID *Source2,
3787 * IN ULONG Length);
3788 */
3789 #define NdisEqualMemory(Source1, Source2, Length) \
3790 RtlEqualMemory(Source1, Source2, Length)
3791
3792 /*
3793 * VOID
3794 * NdisFillMemory(
3795 * IN PVOID Destination,
3796 * IN ULONG Length,
3797 * IN UCHAR Fill);
3798 */
3799 #define NdisFillMemory(Destination, Length, Fill) \
3800 RtlFillMemory(Destination, Length, Fill)
3801
3802 /*
3803 * VOID
3804 * NdisMoveMemory(
3805 * OUT PVOID Destination,
3806 * IN PVOID Source,
3807 * IN ULONG Length);
3808 */
3809 #define NdisMoveMemory(Destination, Source, Length) \
3810 RtlCopyMemory(Destination, Source, Length)
3811
3812
3813 /*
3814 * VOID
3815 * NdisRetrieveUlong(
3816 * IN PULONG DestinationAddress,
3817 * IN PULONG SourceAddress);
3818 */
3819 #define NdisRetrieveUlong(DestinationAddress, SourceAddress) \
3820 RtlRetrieveUlong(DestinationAddress, SourceAddress)
3821
3822
3823 /*
3824 * VOID
3825 * NdisStoreUlong(
3826 * IN PULONG DestinationAddress,
3827 * IN ULONG Value);
3828 */
3829 #define NdisStoreUlong(DestinationAddress, Value) \
3830 RtlStoreUlong(DestinationAddress, Value)
3831
3832
3833 /*
3834 * VOID
3835 * NdisZeroMemory(
3836 * IN PVOID Destination,
3837 * IN ULONG Length)
3838 */
3839 #define NdisZeroMemory(Destination, Length) \
3840 RtlZeroMemory(Destination, Length)
3841
3842 typedef VOID
3843 (NTAPI *NDIS_BLOCK_INITIALIZER) (
3844 IN PUCHAR Block,
3845 IN SIZE_T NumberOfBytes
3846 );
3847
3848 /* Configuration routines */
3849
3850 #if NDIS_LEGACY_DRIVER
3851 NDISAPI
3852 VOID
3853 NTAPI
3854 NdisOpenConfiguration(
3855 OUT PNDIS_STATUS Status,
3856 OUT PNDIS_HANDLE ConfigurationHandle,
3857 IN NDIS_HANDLE WrapperConfigurationContext);
3858 #endif
3859
3860 NDISAPI
3861 VOID
3862 NTAPI
3863 NdisReadNetworkAddress(
3864 OUT PNDIS_STATUS Status,
3865 OUT PVOID *NetworkAddress,
3866 OUT PUINT NetworkAddressLength,
3867 IN NDIS_HANDLE ConfigurationHandle);
3868
3869 NDISAPI
3870 VOID
3871 NTAPI
3872 NdisReadEisaSlotInformation(
3873 OUT PNDIS_STATUS Status,
3874 IN NDIS_HANDLE WrapperConfigurationContext,
3875 OUT PUINT SlotNumber,
3876 OUT PNDIS_EISA_FUNCTION_INFORMATION EisaData);
3877
3878 NDISAPI
3879 VOID
3880 NTAPI
3881 NdisReadEisaSlotInformationEx(
3882 OUT PNDIS_STATUS Status,
3883 IN NDIS_HANDLE WrapperConfigurationContext,
3884 OUT PUINT SlotNumber,
3885 OUT PNDIS_EISA_FUNCTION_INFORMATION *EisaData,
3886 OUT PUINT NumberOfFunctions);
3887
3888 #if NDIS_LEGACY_MINIPORT
3889
3890 NDISAPI
3891 ULONG
3892 NTAPI
3893 NdisReadPciSlotInformation(
3894 IN NDIS_HANDLE NdisAdapterHandle,
3895 IN ULONG SlotNumber,
3896 IN ULONG Offset,
3897 OUT PVOID Buffer,
3898 IN ULONG Length);
3899
3900 NDISAPI
3901 ULONG
3902 NTAPI
3903 NdisWritePciSlotInformation(
3904 IN NDIS_HANDLE NdisAdapterHandle,
3905 IN ULONG SlotNumber,
3906 IN ULONG Offset,
3907 IN PVOID Buffer,
3908 IN ULONG Length);
3909
3910 NDISAPI
3911 ULONG
3912 NTAPI
3913 NdisReadPcmciaAttributeMemory(
3914 IN NDIS_HANDLE NdisAdapterHandle,
3915 IN ULONG Offset,
3916 OUT PVOID Buffer,
3917 IN ULONG Length);
3918
3919 NDISAPI
3920 ULONG
3921 NTAPI
3922 NdisWritePcmciaAttributeMemory(