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