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