e58e5dbdeaded76b546cb332613bc948dfc0f389
[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
599 /* Lock */
600
601 typedef union _NDIS_RW_LOCK_REFCOUNT {
602 UINT RefCount;
603 UCHAR cacheLine[16];
604 } NDIS_RW_LOCK_REFCOUNT;
605
606 typedef struct _NDIS_RW_LOCK {
607 __GNU_EXTENSION union {
608 __GNU_EXTENSION struct {
609 KSPIN_LOCK SpinLock;
610 PVOID Context;
611 };
612 UCHAR Reserved[16];
613 };
614
615 NDIS_RW_LOCK_REFCOUNT RefCount[MAXIMUM_PROCESSORS];
616 } NDIS_RW_LOCK, *PNDIS_RW_LOCK;
617
618 typedef struct _LOCK_STATE {
619 USHORT LockState;
620 KIRQL OldIrql;
621 } LOCK_STATE, *PLOCK_STATE;
622
623
624
625 /* Timer */
626
627 typedef VOID
628 (NTAPI *PNDIS_TIMER_FUNCTION)(
629 IN PVOID SystemSpecific1,
630 IN PVOID FunctionContext,
631 IN PVOID SystemSpecific2,
632 IN PVOID SystemSpecific3);
633
634 typedef struct _NDIS_TIMER {
635 KTIMER Timer;
636 KDPC Dpc;
637 } NDIS_TIMER, *PNDIS_TIMER;
638
639 /* Hardware */
640
641 typedef CM_MCA_POS_DATA NDIS_MCA_POS_DATA, *PNDIS_MCA_POS_DATA;
642 typedef CM_EISA_SLOT_INFORMATION NDIS_EISA_SLOT_INFORMATION, *PNDIS_EISA_SLOT_INFORMATION;
643 typedef CM_EISA_FUNCTION_INFORMATION NDIS_EISA_FUNCTION_INFORMATION, *PNDIS_EISA_FUNCTION_INFORMATION;
644 typedef CM_PARTIAL_RESOURCE_LIST NDIS_RESOURCE_LIST, *PNDIS_RESOURCE_LIST;
645
646 /* Hardware status codes (OID_GEN_HARDWARE_STATUS) */
647 typedef enum _NDIS_HARDWARE_STATUS {
648 NdisHardwareStatusReady,
649 NdisHardwareStatusInitializing,
650 NdisHardwareStatusReset,
651 NdisHardwareStatusClosing,
652 NdisHardwareStatusNotReady
653 } NDIS_HARDWARE_STATUS, *PNDIS_HARDWARE_STATUS;
654
655 /* OID_GEN_GET_TIME_CAPS */
656 typedef struct _GEN_GET_TIME_CAPS {
657 ULONG Flags;
658 ULONG ClockPrecision;
659 } GEN_GET_TIME_CAPS, *PGEN_GET_TIME_CAPS;
660
661 /* Flag bits */
662 #define READABLE_LOCAL_CLOCK 0x00000001
663 #define CLOCK_NETWORK_DERIVED 0x00000002
664 #define CLOCK_PRECISION 0x00000004
665 #define RECEIVE_TIME_INDICATION_CAPABLE 0x00000008
666 #define TIMED_SEND_CAPABLE 0x00000010
667 #define TIME_STAMP_CAPABLE 0x00000020
668
669 /* OID_GEN_GET_NETCARD_TIME */
670 typedef struct _GEN_GET_NETCARD_TIME {
671 ULONGLONG ReadTime;
672 } GEN_GET_NETCARD_TIME, *PGEN_GET_NETCARD_TIME;
673
674 /* NDIS packet filter bits (OID_GEN_CURRENT_PACKET_FILTER) */
675 #define NDIS_PACKET_TYPE_DIRECTED 0x00000001
676 #define NDIS_PACKET_TYPE_MULTICAST 0x00000002
677 #define NDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004
678 #define NDIS_PACKET_TYPE_BROADCAST 0x00000008
679 #define NDIS_PACKET_TYPE_SOURCE_ROUTING 0x00000010
680 #define NDIS_PACKET_TYPE_PROMISCUOUS 0x00000020
681 #define NDIS_PACKET_TYPE_SMT 0x00000040
682 #define NDIS_PACKET_TYPE_ALL_LOCAL 0x00000080
683 #define NDIS_PACKET_TYPE_GROUP 0x00001000
684 #define NDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x00002000
685 #define NDIS_PACKET_TYPE_FUNCTIONAL 0x00004000
686 #define NDIS_PACKET_TYPE_MAC_FRAME 0x00008000
687
688 /* NDIS protocol option bits (OID_GEN_PROTOCOL_OPTIONS) */
689 #define NDIS_PROT_OPTION_ESTIMATED_LENGTH 0x00000001
690 #define NDIS_PROT_OPTION_NO_LOOPBACK 0x00000002
691 #define NDIS_PROT_OPTION_NO_RSVD_ON_RCVPKT 0x00000004
692
693 /* NDIS MAC option bits (OID_GEN_MAC_OPTIONS) */
694 #define NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA 0x00000001
695 #define NDIS_MAC_OPTION_RECEIVE_SERIALIZED 0x00000002
696 #define NDIS_MAC_OPTION_TRANSFERS_NOT_PEND 0x00000004
697 #define NDIS_MAC_OPTION_NO_LOOPBACK 0x00000008
698 #define NDIS_MAC_OPTION_FULL_DUPLEX 0x00000010
699 #define NDIS_MAC_OPTION_EOTX_INDICATION 0x00000020
700 #define NDIS_MAC_OPTION_8021P_PRIORITY 0x00000040
701 #define NDIS_MAC_OPTION_RESERVED 0x80000000
702
703 /* State of the LAN media (OID_GEN_MEDIA_CONNECT_STATUS) */
704 typedef enum _NDIS_MEDIA_STATE {
705 NdisMediaStateConnected,
706 NdisMediaStateDisconnected
707 } NDIS_MEDIA_STATE, *PNDIS_MEDIA_STATE;
708
709 /* OID_GEN_SUPPORTED_GUIDS */
710 typedef struct _NDIS_GUID {
711 GUID Guid;
712 union {
713 NDIS_OID Oid;
714 NDIS_STATUS Status;
715 } u;
716 ULONG Size;
717 ULONG Flags;
718 } NDIS_GUID, *PNDIS_GUID;
719
720 #define NDIS_GUID_TO_OID 0x00000001
721 #define NDIS_GUID_TO_STATUS 0x00000002
722 #define NDIS_GUID_ANSI_STRING 0x00000004
723 #define NDIS_GUID_UNICODE_STRING 0x00000008
724 #define NDIS_GUID_ARRAY 0x00000010
725
726 #if NDIS_LEGACY_DRIVER
727
728 /* NDIS_PACKET_PRIVATE.Flags constants */
729 #define fPACKET_WRAPPER_RESERVED 0x3f
730 #define fPACKET_CONTAINS_MEDIA_SPECIFIC_INFO 0x40
731 #define fPACKET_ALLOCATED_BY_NDIS 0x80
732
733 #define NDIS_FLAGS_PROTOCOL_ID_MASK 0x0000000f
734 #define NDIS_FLAGS_MULTICAST_PACKET 0x00000010
735 #define NDIS_FLAGS_RESERVED2 0x00000020
736 #define NDIS_FLAGS_RESERVED3 0x00000040
737 #define NDIS_FLAGS_DONT_LOOPBACK 0x00000080
738 #define NDIS_FLAGS_IS_LOOPBACK_PACKET 0x00000100
739 #define NDIS_FLAGS_LOOPBACK_ONLY 0x00000200
740 #define NDIS_FLAGS_RESERVED4 0x00000400
741 #define NDIS_FLAGS_DOUBLE_BUFFERED 0x00000800
742 #define NDIS_FLAGS_SENT_AT_DPC 0x00001000
743 #define NDIS_FLAGS_USES_SG_BUFFER_LIST 0x00002000
744 #define NDIS_FLAGS_USES_ORIGINAL_PACKET 0x00004000
745 #define NDIS_FLAGS_PADDED 0x00010000
746 #define NDIS_FLAGS_XLATE_AT_TOP 0x00020000
747
748 typedef NDIS_HANDLE PNDIS_PACKET_POOL;
749
750 typedef struct _NDIS_PACKET_PRIVATE {
751 UINT PhysicalCount;
752 UINT TotalLength;
753 PNDIS_BUFFER Head;
754 PNDIS_BUFFER Tail;
755 PNDIS_PACKET_POOL Pool;
756 UINT Count;
757 ULONG Flags;
758 BOOLEAN ValidCounts;
759 UCHAR NdisPacketFlags;
760 USHORT NdisPacketOobOffset;
761 } NDIS_PACKET_PRIVATE, *PNDIS_PACKET_PRIVATE;
762
763 typedef struct _NDIS_PACKET {
764 NDIS_PACKET_PRIVATE Private;
765 __MINGW_EXTENSION union {
766 __MINGW_EXTENSION struct {
767 UCHAR MiniportReserved[2 * sizeof(PVOID)];
768 UCHAR WrapperReserved[2 * sizeof(PVOID)];
769 };
770 __MINGW_EXTENSION struct {
771 UCHAR MiniportReservedEx[3 * sizeof(PVOID)];
772 UCHAR WrapperReservedEx[sizeof(PVOID)];
773 };
774 __MINGW_EXTENSION struct {
775 UCHAR MacReserved[4 * sizeof(PVOID)];
776 };
777 };
778 ULONG_PTR Reserved[2];
779 UCHAR ProtocolReserved[1];
780 } NDIS_PACKET, *PNDIS_PACKET, **PPNDIS_PACKET;
781
782 typedef struct _NDIS_PACKET_STACK {
783 ULONG_PTR IMReserved[2];
784 ULONG_PTR NdisReserved[4];
785 } NDIS_PACKET_STACK, *PNDIS_PACKET_STACK;
786
787 #endif /* NDIS_LEGACY_DRIVER */
788
789 typedef enum _NDIS_CLASS_ID {
790 NdisClass802_3Priority,
791 NdisClassWirelessWanMbxMailbox,
792 NdisClassIrdaPacketInfo,
793 NdisClassAtmAALInfo
794 } NDIS_CLASS_ID;
795
796 typedef struct _MEDIA_SPECIFIC_INFORMATION {
797 UINT NextEntryOffset;
798 NDIS_CLASS_ID ClassId;
799 UINT Size;
800 UCHAR ClassInformation[1];
801 } MEDIA_SPECIFIC_INFORMATION, *PMEDIA_SPECIFIC_INFORMATION;
802
803 #if NDIS_LEGACY_DRIVER
804 typedef struct _NDIS_PACKET_OOB_DATA {
805 __MINGW_EXTENSION union {
806 ULONGLONG TimeToSend;
807 ULONGLONG TimeSent;
808 };
809 ULONGLONG TimeReceived;
810 UINT HeaderSize;
811 UINT SizeMediaSpecificInfo;
812 PVOID MediaSpecificInformation;
813 NDIS_STATUS Status;
814 } NDIS_PACKET_OOB_DATA, *PNDIS_PACKET_OOB_DATA;
815 #endif
816
817 typedef struct _NDIS_PM_PACKET_PATTERN {
818 ULONG Priority;
819 ULONG Reserved;
820 ULONG MaskSize;
821 ULONG PatternOffset;
822 ULONG PatternSize;
823 ULONG PatternFlags;
824 } NDIS_PM_PACKET_PATTERN, *PNDIS_PM_PACKET_PATTERN;
825
826 /* Request types used by NdisRequest */
827 typedef enum _NDIS_REQUEST_TYPE {
828 NdisRequestQueryInformation,
829 NdisRequestSetInformation,
830 NdisRequestQueryStatistics,
831 NdisRequestOpen,
832 NdisRequestClose,
833 NdisRequestSend,
834 NdisRequestTransferData,
835 NdisRequestReset,
836 NdisRequestGeneric1,
837 NdisRequestGeneric2,
838 NdisRequestGeneric3,
839 NdisRequestGeneric4,
840 #if NDIS_SUPPORT_NDIS6
841 NdisRequestMethod,
842 #endif
843 } NDIS_REQUEST_TYPE, *PNDIS_REQUEST_TYPE;
844
845 #if NDIS_LEGACY_DRIVER
846 typedef struct _NDIS_REQUEST {
847 UCHAR MacReserved[4 * sizeof(PVOID)];
848 NDIS_REQUEST_TYPE RequestType;
849 union _DATA {
850 struct QUERY_INFORMATION {
851 NDIS_OID Oid;
852 PVOID InformationBuffer;
853 UINT InformationBufferLength;
854 UINT BytesWritten;
855 UINT BytesNeeded;
856 } QUERY_INFORMATION;
857 struct SET_INFORMATION {
858 NDIS_OID Oid;
859 PVOID InformationBuffer;
860 UINT InformationBufferLength;
861 UINT BytesRead;
862 UINT BytesNeeded;
863 } SET_INFORMATION;
864 } DATA;
865 #if (defined(NDIS50) || defined(NDIS51) || defined(NDIS50_MINIPORT) || defined(NDIS51_MINIPORT))
866 UCHAR NdisReserved[9 * sizeof(PVOID)];
867 __MINGW_EXTENSION union {
868 UCHAR CallMgrReserved[2 * sizeof(PVOID)];
869 UCHAR ProtocolReserved[2 * sizeof(PVOID)];
870 };
871 UCHAR MiniportReserved[2 * sizeof(PVOID)];
872 #endif
873 } NDIS_REQUEST, *PNDIS_REQUEST;
874 #endif /* NDIS_LEGACY_DRIVER */
875
876 /* Wide Area Networks definitions */
877
878 #if NDIS_LEGACY_DRIVER
879 typedef struct _NDIS_WAN_PACKET {
880 LIST_ENTRY WanPacketQueue;
881 PUCHAR CurrentBuffer;
882 ULONG CurrentLength;
883 PUCHAR StartBuffer;
884 PUCHAR EndBuffer;
885 PVOID ProtocolReserved1;
886 PVOID ProtocolReserved2;
887 PVOID ProtocolReserved3;
888 PVOID ProtocolReserved4;
889 PVOID MacReserved1;
890 PVOID MacReserved2;
891 PVOID MacReserved3;
892 PVOID MacReserved4;
893 } NDIS_WAN_PACKET, *PNDIS_WAN_PACKET;
894 #endif
895
896 /* DMA channel information */
897
898 typedef struct _NDIS_DMA_DESCRIPTION {
899 BOOLEAN DemandMode;
900 BOOLEAN AutoInitialize;
901 BOOLEAN DmaChannelSpecified;
902 DMA_WIDTH DmaWidth;
903 DMA_SPEED DmaSpeed;
904 ULONG DmaPort;
905 ULONG DmaChannel;
906 } NDIS_DMA_DESCRIPTION, *PNDIS_DMA_DESCRIPTION;
907
908 typedef struct _NDIS_DMA_BLOCK {
909 PVOID MapRegisterBase;
910 KEVENT AllocationEvent;
911 PADAPTER_OBJECT SystemAdapterObject;
912 PVOID Miniport;
913 BOOLEAN InProgress;
914 } NDIS_DMA_BLOCK, *PNDIS_DMA_BLOCK;
915
916 typedef UCHAR NDIS_DMA_SIZE;
917
918 #define NDIS_DMA_24BITS ((NDIS_DMA_SIZE)0)
919 #define NDIS_DMA_32BITS ((NDIS_DMA_SIZE)1)
920 #define NDIS_DMA_64BITS ((NDIS_DMA_SIZE)2)
921
922 typedef enum _NDIS_PROCESSOR_TYPE {
923 NdisProcessorX86,
924 NdisProcessorMips,
925 NdisProcessorAlpha,
926 NdisProcessorPpc,
927 NdisProcessorAmd64,
928 NdisProcessorIA64
929 } NDIS_PROCESSOR_TYPE, *PNDIS_PROCESSOR_TYPE;
930
931 typedef enum _NDIS_ENVIRONMENT_TYPE {
932 NdisEnvironmentWindows,
933 NdisEnvironmentWindowsNt
934 } NDIS_ENVIRONMENT_TYPE, *PNDIS_ENVIRONMENT_TYPE;
935
936 /* Possible hardware architecture */
937 typedef enum _NDIS_INTERFACE_TYPE {
938 NdisInterfaceInternal = Internal,
939 NdisInterfaceIsa = Isa,
940 NdisInterfaceEisa = Eisa,
941 NdisInterfaceMca = MicroChannel,
942 NdisInterfaceTurboChannel = TurboChannel,
943 NdisInterfacePci = PCIBus,
944 NdisInterfacePcMcia = PCMCIABus,
945 NdisInterfaceCBus = CBus,
946 NdisInterfaceMPIBus = MPIBus,
947 NdisInterfaceMPSABus = MPSABus,
948 NdisInterfaceProcessorInternal = ProcessorInternal,
949 NdisInterfaceInternalPowerBus = InternalPowerBus,
950 NdisInterfacePNPISABus = PNPISABus,
951 NdisInterfacePNPBus = PNPBus,
952 NdisInterfaceUSB,
953 NdisInterfaceIrda,
954 NdisInterface1394,
955 NdisMaximumInterfaceType
956 } NDIS_INTERFACE_TYPE, *PNDIS_INTERFACE_TYPE;
957
958 #define NdisInterruptLevelSensitive LevelSensitive
959 #define NdisInterruptLatched Latched
960
961 typedef KINTERRUPT_MODE NDIS_INTERRUPT_MODE, *PNDIS_INTERRUPT_MODE;
962
963 typedef enum _NDIS_PARAMETER_TYPE {
964 NdisParameterInteger,
965 NdisParameterHexInteger,
966 NdisParameterString,
967 NdisParameterMultiString,
968 NdisParameterBinary
969 } NDIS_PARAMETER_TYPE, *PNDIS_PARAMETER_TYPE;
970
971 typedef struct _BINARY_DATA {
972 USHORT Length;
973 PVOID Buffer;
974 } BINARY_DATA;
975
976 typedef struct _NDIS_CONFIGURATION_PARAMETER {
977 NDIS_PARAMETER_TYPE ParameterType;
978 union {
979 ULONG IntegerData;
980 NDIS_STRING StringData;
981 BINARY_DATA BinaryData;
982 } ParameterData;
983 } NDIS_CONFIGURATION_PARAMETER, *PNDIS_CONFIGURATION_PARAMETER;
984
985 typedef PHYSICAL_ADDRESS NDIS_PHYSICAL_ADDRESS, *PNDIS_PHYSICAL_ADDRESS;
986
987 typedef struct _NDIS_PHYSICAL_ADDRESS_UNIT {
988 NDIS_PHYSICAL_ADDRESS PhysicalAddress;
989 UINT Length;
990 } NDIS_PHYSICAL_ADDRESS_UNIT, *PNDIS_PHYSICAL_ADDRESS_UNIT;
991
992 typedef struct _NDIS_WAN_LINE_DOWN {
993 UCHAR RemoteAddress[6];
994 UCHAR LocalAddress[6];
995 } NDIS_WAN_LINE_DOWN, *PNDIS_WAN_LINE_DOWN;
996
997 typedef struct _NDIS_WAN_LINE_UP {
998 ULONG LinkSpeed;
999 ULONG MaximumTotalSize;
1000 NDIS_WAN_QUALITY Quality;
1001 USHORT SendWindow;
1002 UCHAR RemoteAddress[6];
1003 OUT UCHAR LocalAddress[6];
1004 ULONG ProtocolBufferLength;
1005 PUCHAR ProtocolBuffer;
1006 USHORT ProtocolType;
1007 NDIS_STRING DeviceName;
1008 } NDIS_WAN_LINE_UP, *PNDIS_WAN_LINE_UP;
1009
1010 typedef VOID
1011 (NTAPI *ADAPTER_SHUTDOWN_HANDLER)(
1012 IN PVOID ShutdownContext);
1013
1014 typedef NTSTATUS
1015 (NTAPI *TDI_REGISTER_CALLBACK)(
1016 IN PUNICODE_STRING DeviceName,
1017 OUT HANDLE* TdiHandle);
1018
1019 typedef NTSTATUS
1020 (NTAPI *TDI_PNP_HANDLER)(
1021 IN PUNICODE_STRING UpperComponent,
1022 IN PUNICODE_STRING LowerComponent,
1023 IN PUNICODE_STRING BindList,
1024 IN PVOID ReconfigBuffer,
1025 IN UINT ReconfigBufferSize,
1026 IN UINT Operation);
1027
1028 typedef struct _OID_LIST OID_LIST, *POID_LIST;
1029
1030 /* PnP state */
1031
1032 typedef enum _NDIS_PNP_DEVICE_STATE {
1033 NdisPnPDeviceAdded,
1034 NdisPnPDeviceStarted,
1035 NdisPnPDeviceQueryStopped,
1036 NdisPnPDeviceStopped,
1037 NdisPnPDeviceQueryRemoved,
1038 NdisPnPDeviceRemoved,
1039 NdisPnPDeviceSurpriseRemoved
1040 } NDIS_PNP_DEVICE_STATE;
1041
1042 #define NDIS_DEVICE_NOT_STOPPABLE 0x00000001
1043 #define NDIS_DEVICE_NOT_REMOVEABLE 0x00000002
1044 #define NDIS_DEVICE_NOT_SUSPENDABLE 0x00000004
1045 #define NDIS_DEVICE_DISABLE_PM 0x00000008
1046 #define NDIS_DEVICE_DISABLE_WAKE_UP 0x00000010
1047 #define NDIS_DEVICE_DISABLE_WAKE_ON_RECONNECT 0x00000020
1048 #define NDIS_DEVICE_RESERVED 0x00000040
1049 #define NDIS_DEVICE_DISABLE_WAKE_ON_MAGIC_PACKET 0x00000080
1050 #define NDIS_DEVICE_DISABLE_WAKE_ON_PATTERN_MATCH 0x00000100
1051
1052
1053 /* OID_GEN_NETWORK_LAYER_ADDRESSES */
1054 typedef struct _NETWORK_ADDRESS {
1055 USHORT AddressLength;
1056 USHORT AddressType;
1057 UCHAR Address[1];
1058 } NETWORK_ADDRESS, *PNETWORK_ADDRESS;
1059
1060 typedef struct _NETWORK_ADDRESS_LIST {
1061 LONG AddressCount;
1062 USHORT AddressType;
1063 NETWORK_ADDRESS Address[1];
1064 } NETWORK_ADDRESS_LIST, *PNETWORK_ADDRESS_LIST;
1065
1066 /* Protocol types supported by NDIS */
1067 #define NDIS_PROTOCOL_ID_DEFAULT 0x00
1068 #define NDIS_PROTOCOL_ID_TCP_IP 0x02
1069 #define NDIS_PROTOCOL_ID_IPX 0x06
1070 #define NDIS_PROTOCOL_ID_NBF 0x07
1071 #define NDIS_PROTOCOL_ID_MAX 0x0F
1072 #define NDIS_PROTOCOL_ID_MASK 0x0F
1073
1074 /* OID_GEN_TRANSPORT_HEADER_OFFSET */
1075 typedef struct _TRANSPORT_HEADER_OFFSET {
1076 USHORT ProtocolType;
1077 USHORT HeaderOffset;
1078 } TRANSPORT_HEADER_OFFSET, *PTRANSPORT_HEADER_OFFSET;
1079
1080 /* OID_GEN_CO_LINK_SPEED / OID_GEN_CO_MINIMUM_LINK_SPEED */
1081 typedef struct _NDIS_CO_LINK_SPEED {
1082 ULONG Outbound;
1083 ULONG Inbound;
1084 } NDIS_CO_LINK_SPEED, *PNDIS_CO_LINK_SPEED;
1085
1086 typedef ULONG NDIS_AF, *PNDIS_AF;
1087
1088 #define CO_ADDRESS_FAMILY_Q2931 ((NDIS_AF)0x1)
1089 #define CO_ADDRESS_FAMILY_PSCHED ((NDIS_AF)0x2)
1090 #define CO_ADDRESS_FAMILY_L2TP ((NDIS_AF)0x3)
1091 #define CO_ADDRESS_FAMILY_IRDA ((NDIS_AF)0x4)
1092 #define CO_ADDRESS_FAMILY_1394 ((NDIS_AF)0x5)
1093 #define CO_ADDRESS_FAMILY_PPP ((NDIS_AF)0x6)
1094 #define CO_ADDRESS_FAMILY_INFINIBAND ((NDIS_AF)0x7)
1095 #define CO_ADDRESS_FAMILY_TAPI ((NDIS_AF)0x800)
1096 #define CO_ADDRESS_FAMILY_TAPI_PROXY ((NDIS_AF)0x801)
1097
1098 #define CO_ADDRESS_FAMILY_PROXY 0x80000000
1099
1100 typedef struct _CO_ADDRESS_FAMILY {
1101 NDIS_AF AddressFamily;
1102 ULONG MajorVersion;
1103 ULONG MinorVersion;
1104 } CO_ADDRESS_FAMILY, *PCO_ADDRESS_FAMILY;
1105
1106 typedef struct _CO_SPECIFIC_PARAMETERS {
1107 ULONG ParamType;
1108 ULONG Length;
1109 UCHAR Parameters[1];
1110 } CO_SPECIFIC_PARAMETERS, *PCO_SPECIFIC_PARAMETERS;
1111
1112 typedef struct _CO_CALL_MANAGER_PARAMETERS {
1113 FLOWSPEC Transmit;
1114 FLOWSPEC Receive;
1115 CO_SPECIFIC_PARAMETERS CallMgrSpecific;
1116 } CO_CALL_MANAGER_PARAMETERS, *PCO_CALL_MANAGER_PARAMETERS;
1117
1118 /* CO_MEDIA_PARAMETERS.Flags constants */
1119 #define RECEIVE_TIME_INDICATION 0x00000001
1120 #define USE_TIME_STAMPS 0x00000002
1121 #define TRANSMIT_VC 0x00000004
1122 #define RECEIVE_VC 0x00000008
1123 #define INDICATE_ERRED_PACKETS 0x00000010
1124 #define INDICATE_END_OF_TX 0x00000020
1125 #define RESERVE_RESOURCES_VC 0x00000040
1126 #define ROUND_DOWN_FLOW 0x00000080
1127 #define ROUND_UP_FLOW 0x00000100
1128
1129 typedef struct _CO_MEDIA_PARAMETERS {
1130 ULONG Flags;
1131 ULONG ReceivePriority;
1132 ULONG ReceiveSizeHint;
1133 CO_SPECIFIC_PARAMETERS MediaSpecific;
1134 } CO_MEDIA_PARAMETERS, *PCO_MEDIA_PARAMETERS;
1135
1136 /* CO_CALL_PARAMETERS.Flags constants */
1137 #define PERMANENT_VC 0x00000001
1138 #define CALL_PARAMETERS_CHANGED 0x00000002
1139 #define QUERY_CALL_PARAMETERS 0x00000004
1140 #define BROADCAST_VC 0x00000008
1141 #define MULTIPOINT_VC 0x00000010
1142
1143 typedef struct _CO_CALL_PARAMETERS {
1144 ULONG Flags;
1145 PCO_CALL_MANAGER_PARAMETERS CallMgrParameters;
1146 PCO_MEDIA_PARAMETERS MediaParameters;
1147 } CO_CALL_PARAMETERS, *PCO_CALL_PARAMETERS;
1148
1149 typedef struct _CO_SAP {
1150 ULONG SapType;
1151 ULONG SapLength;
1152 UCHAR Sap[1];
1153 } CO_SAP, *PCO_SAP;
1154
1155 typedef struct _NDIS_IPSEC_PACKET_INFO {
1156 _ANONYMOUS_UNION union {
1157 struct {
1158 NDIS_HANDLE OffloadHandle;
1159 NDIS_HANDLE NextOffloadHandle;
1160 } Transmit;
1161 struct {
1162 ULONG SA_DELETE_REQ : 1;
1163 ULONG CRYPTO_DONE : 1;
1164 ULONG NEXT_CRYPTO_DONE : 1;
1165 ULONG CryptoStatus;
1166 } Receive;
1167 } DUMMYUNIONNAME;
1168 } NDIS_IPSEC_PACKET_INFO, *PNDIS_IPSEC_PACKET_INFO;
1169
1170 /* NDIS_MAC_FRAGMENT.Errors constants */
1171 #define WAN_ERROR_CRC 0x00000001
1172 #define WAN_ERROR_FRAMING 0x00000002
1173 #define WAN_ERROR_HARDWAREOVERRUN 0x00000004
1174 #define WAN_ERROR_BUFFEROVERRUN 0x00000008
1175 #define WAN_ERROR_TIMEOUT 0x00000010
1176 #define WAN_ERROR_ALIGNMENT 0x00000020
1177
1178 typedef struct _NDIS_MAC_FRAGMENT {
1179 NDIS_HANDLE NdisLinkContext;
1180 ULONG Errors;
1181 } NDIS_MAC_FRAGMENT, *PNDIS_MAC_FRAGMENT;
1182
1183 typedef struct _NDIS_MAC_LINE_DOWN {
1184 NDIS_HANDLE NdisLinkContext;
1185 } NDIS_MAC_LINE_DOWN, *PNDIS_MAC_LINE_DOWN;
1186
1187 typedef struct _NDIS_MAC_LINE_UP {
1188 ULONG LinkSpeed;
1189 NDIS_WAN_QUALITY Quality;
1190 USHORT SendWindow;
1191 NDIS_HANDLE ConnectionWrapperID;
1192 NDIS_HANDLE NdisLinkHandle;
1193 NDIS_HANDLE NdisLinkContext;
1194 } NDIS_MAC_LINE_UP, *PNDIS_MAC_LINE_UP;
1195
1196 typedef struct _NDIS_PACKET_8021Q_INFO {
1197 __MINGW_EXTENSION union {
1198 struct {
1199 UINT32 UserPriority:3;
1200 UINT32 CanonicalFormatId:1;
1201 UINT32 VlanId:12;
1202 UINT32 Reserved:16;
1203 } TagHeader;
1204 PVOID Value;
1205 };
1206 } NDIS_PACKET_8021Q_INFO, *PNDIS_PACKET_8021Q_INFO;
1207
1208 typedef enum _NDIS_PER_PACKET_INFO {
1209 TcpIpChecksumPacketInfo,
1210 IpSecPacketInfo,
1211 TcpLargeSendPacketInfo,
1212 ClassificationHandlePacketInfo,
1213 NdisReserved,
1214 ScatterGatherListPacketInfo,
1215 Ieee8021QInfo,
1216 OriginalPacketInfo,
1217 PacketCancelId,
1218 OriginalNetBufferList,
1219 CachedNetBufferList,
1220 ShortPacketPaddingInfo,
1221 MaxPerPacketInfo
1222 } NDIS_PER_PACKET_INFO, *PNDIS_PER_PACKET_INFO;
1223
1224 #if NDIS_LEGACY_DRIVER
1225
1226 typedef struct _NDIS_PACKET_EXTENSION {
1227 PVOID NdisPacketInfo[MaxPerPacketInfo];
1228 } NDIS_PACKET_EXTENSION, *PNDIS_PACKET_EXTENSION;
1229
1230 /*
1231 * PNDIS_PACKET
1232 * NDIS_GET_ORIGINAL_PACKET(
1233 * IN PNDIS_PACKET Packet);
1234 */
1235 #define NDIS_GET_ORIGINAL_PACKET(Packet) \
1236 NDIS_PER_PACKET_INFO_FROM_PACKET(Packet, OriginalPacketInfo)
1237
1238 /*
1239 * PVOID
1240 * NDIS_GET_PACKET_CANCEL_ID(
1241 * IN PNDIS_PACKET Packet);
1242 */
1243 #define NDIS_GET_PACKET_CANCEL_ID(Packet) \
1244 NDIS_PER_PACKET_INFO_FROM_PACKET(Packet, PacketCancelId)
1245
1246 /*
1247 * PNDIS_PACKET_EXTENSION
1248 * NDIS_PACKET_EXTENSION_FROM_PACKET(
1249 * IN PNDIS_PACKET Packet);
1250 */
1251 #define NDIS_PACKET_EXTENSION_FROM_PACKET(Packet) \
1252 ((PNDIS_PACKET_EXTENSION)((PUCHAR)(Packet) \
1253 + (Packet)->Private.NdisPacketOobOffset + sizeof(NDIS_PACKET_OOB_DATA)))
1254
1255 /*
1256 * PVOID
1257 * NDIS_PER_PACKET_INFO_FROM_PACKET(
1258 * IN OUT PNDIS_PACKET Packet,
1259 * IN NDIS_PER_PACKET_INFO InfoType);
1260 */
1261 #define NDIS_PER_PACKET_INFO_FROM_PACKET(Packet, InfoType) \
1262 ((PNDIS_PACKET_EXTENSION)((PUCHAR)(Packet) + (Packet)->Private.NdisPacketOobOffset \
1263 + sizeof(NDIS_PACKET_OOB_DATA)))->NdisPacketInfo[(InfoType)]
1264
1265 /*
1266 * VOID
1267 * NDIS_SET_ORIGINAL_PACKET(
1268 * IN OUT PNDIS_PACKET Packet,
1269 * IN PNDIS_PACKET OriginalPacket);
1270 */
1271 #define NDIS_SET_ORIGINAL_PACKET(Packet, OriginalPacket) \
1272 NDIS_PER_PACKET_INFO_FROM_PACKET(Packet, OriginalPacketInfo) = (OriginalPacket)
1273
1274 /*
1275 * VOID
1276 * NDIS_SET_PACKET_CANCEL_ID(
1277 * IN PNDIS_PACKET Packet
1278 * IN ULONG_PTR CancelId);
1279 */
1280 #define NDIS_SET_PACKET_CANCEL_ID(Packet, CancelId) \
1281 NDIS_PER_PACKET_INFO_FROM_PACKET(Packet, PacketCancelId) = (CancelId)
1282
1283 #define NdisSetPacketCancelId(_Packet, _CancelId) NDIS_SET_PACKET_CANCEL_ID(_Packet, _CancelId)
1284 #define NdisGetPacketCancelId(_Packet) NDIS_GET_PACKET_CANCEL_ID(_Packet)
1285
1286 #endif /* NDIS_LEGACY_DRIVER */
1287
1288 #if NDIS_SUPPORT_NDIS6
1289 typedef struct _NDIS_GENERIC_OBJECT {
1290 NDIS_OBJECT_HEADER Header;
1291 PVOID Caller;
1292 PVOID CallersCaller;
1293 PDRIVER_OBJECT DriverObject;
1294 } NDIS_GENERIC_OBJECT, *PNDIS_GENERIC_OBJECT;
1295 #endif
1296
1297 typedef enum _NDIS_TASK {
1298 TcpIpChecksumNdisTask,
1299 IpSecNdisTask,
1300 TcpLargeSendNdisTask,
1301 MaxNdisTask
1302 } NDIS_TASK, *PNDIS_TASK;
1303
1304 typedef struct _NDIS_TASK_IPSEC {
1305 struct {
1306 ULONG AH_ESP_COMBINED;
1307 ULONG TRANSPORT_TUNNEL_COMBINED;
1308 ULONG V4_OPTIONS;
1309 ULONG RESERVED;
1310 } Supported;
1311
1312 struct {
1313 ULONG MD5 : 1;
1314 ULONG SHA_1 : 1;
1315 ULONG Transport : 1;
1316 ULONG Tunnel : 1;
1317 ULONG Send : 1;
1318 ULONG Receive : 1;
1319 } V4AH;
1320
1321 struct {
1322 ULONG DES : 1;
1323 ULONG RESERVED : 1;
1324 ULONG TRIPLE_DES : 1;
1325 ULONG NULL_ESP : 1;
1326 ULONG Transport : 1;
1327 ULONG Tunnel : 1;
1328 ULONG Send : 1;
1329 ULONG Receive : 1;
1330 } V4ESP;
1331 } NDIS_TASK_IPSEC, *PNDIS_TASK_IPSEC;
1332
1333 typedef enum _NDIS_ENCAPSULATION {
1334 UNSPECIFIED_Encapsulation,
1335 NULL_Encapsulation,
1336 IEEE_802_3_Encapsulation,
1337 IEEE_802_5_Encapsulation,
1338 LLC_SNAP_ROUTED_Encapsulation,
1339 LLC_SNAP_BRIDGED_Encapsulation
1340 } NDIS_ENCAPSULATION;
1341
1342 typedef struct _NDIS_ENCAPSULATION_FORMAT {
1343 NDIS_ENCAPSULATION Encapsulation;
1344 struct {
1345 ULONG FixedHeaderSize : 1;
1346 ULONG Reserved : 31;
1347 } Flags;
1348 ULONG EncapsulationHeaderSize;
1349 } NDIS_ENCAPSULATION_FORMAT, *PNDIS_ENCAPSULATION_FORMAT;
1350
1351 typedef struct _NDIS_TASK_OFFLOAD_HEADER {
1352 ULONG Version;
1353 ULONG Size;
1354 ULONG Reserved;
1355 ULONG OffsetFirstTask;
1356 NDIS_ENCAPSULATION_FORMAT EncapsulationFormat;
1357 } NDIS_TASK_OFFLOAD_HEADER, *PNDIS_TASK_OFFLOAD_HEADER;
1358
1359 typedef struct _NDIS_TASK_OFFLOAD {
1360 ULONG Version;
1361 ULONG Size;
1362 NDIS_TASK Task;
1363 ULONG OffsetNextTask;
1364 ULONG TaskBufferLength;
1365 UCHAR TaskBuffer[1];
1366 } NDIS_TASK_OFFLOAD, *PNDIS_TASK_OFFLOAD;
1367
1368 /* NDIS_TASK_OFFLOAD_HEADER.Version constants */
1369 #define NDIS_TASK_OFFLOAD_VERSION 1
1370
1371 typedef struct _NDIS_TASK_TCP_IP_CHECKSUM {
1372 struct {
1373 ULONG IpOptionsSupported:1;
1374 ULONG TcpOptionsSupported:1;
1375 ULONG TcpChecksum:1;
1376 ULONG UdpChecksum:1;
1377 ULONG IpChecksum:1;
1378 } V4Transmit;
1379
1380 struct {
1381 ULONG IpOptionsSupported : 1;
1382 ULONG TcpOptionsSupported : 1;
1383 ULONG TcpChecksum : 1;
1384 ULONG UdpChecksum : 1;
1385 ULONG IpChecksum : 1;
1386 } V4Receive;
1387
1388 struct {
1389 ULONG IpOptionsSupported : 1;
1390 ULONG TcpOptionsSupported : 1;
1391 ULONG TcpChecksum : 1;
1392 ULONG UdpChecksum : 1;
1393 } V6Transmit;
1394
1395 struct {
1396 ULONG IpOptionsSupported : 1;
1397 ULONG TcpOptionsSupported : 1;
1398 ULONG TcpChecksum : 1;
1399 ULONG UdpChecksum : 1;
1400 } V6Receive;
1401 } NDIS_TASK_TCP_IP_CHECKSUM, *PNDIS_TASK_TCP_IP_CHECKSUM;
1402
1403 typedef struct _NDIS_TASK_TCP_LARGE_SEND {
1404 ULONG Version;
1405 ULONG MaxOffLoadSize;
1406 ULONG MinSegmentCount;
1407 BOOLEAN TcpOptions;
1408 BOOLEAN IpOptions;
1409 } NDIS_TASK_TCP_LARGE_SEND, *PNDIS_TASK_TCP_LARGE_SEND;
1410
1411 typedef struct _NDIS_TCP_IP_CHECKSUM_PACKET_INFO {
1412 __MINGW_EXTENSION union {
1413 struct {
1414 ULONG NdisPacketChecksumV4:1;
1415 ULONG NdisPacketChecksumV6:1;
1416 ULONG NdisPacketTcpChecksum:1;
1417 ULONG NdisPacketUdpChecksum:1;
1418 ULONG NdisPacketIpChecksum:1;
1419 } Transmit;
1420 struct {
1421 ULONG NdisPacketTcpChecksumFailed:1;
1422 ULONG NdisPacketUdpChecksumFailed:1;
1423 ULONG NdisPacketIpChecksumFailed:1;
1424 ULONG NdisPacketTcpChecksumSucceeded:1;
1425 ULONG NdisPacketUdpChecksumSucceeded:1;
1426 ULONG NdisPacketIpChecksumSucceeded:1;
1427 ULONG NdisPacketLoopback:1;
1428 } Receive;
1429 ULONG Value;
1430 };
1431 } NDIS_TCP_IP_CHECKSUM_PACKET_INFO, *PNDIS_TCP_IP_CHECKSUM_PACKET_INFO;
1432
1433 typedef struct _NDIS_WAN_CO_FRAGMENT {
1434 ULONG Errors;
1435 } NDIS_WAN_CO_FRAGMENT, *PNDIS_WAN_CO_FRAGMENT;
1436
1437 typedef struct _NDIS_WAN_FRAGMENT {
1438 UCHAR RemoteAddress[6];
1439 UCHAR LocalAddress[6];
1440 } NDIS_WAN_FRAGMENT, *PNDIS_WAN_FRAGMENT;
1441
1442 typedef struct _WAN_CO_LINKPARAMS {
1443 ULONG TransmitSpeed;
1444 ULONG ReceiveSpeed;
1445 ULONG SendWindow;
1446 } WAN_CO_LINKPARAMS, *PWAN_CO_LINKPARAMS;
1447
1448 typedef struct _NDIS_WAN_GET_STATS {
1449 UCHAR LocalAddress[6];
1450 ULONG BytesSent;
1451 ULONG BytesRcvd;
1452 ULONG FramesSent;
1453 ULONG FramesRcvd;
1454 ULONG CRCErrors;
1455 ULONG TimeoutErrors;
1456 ULONG AlignmentErrors;
1457 ULONG SerialOverrunErrors;
1458 ULONG FramingErrors;
1459 ULONG BufferOverrunErrors;
1460 ULONG BytesTransmittedUncompressed;
1461 ULONG BytesReceivedUncompressed;
1462 ULONG BytesTransmittedCompressed;
1463 ULONG BytesReceivedCompressed;
1464 } NDIS_WAN_GET_STATS, *PNDIS_WAN_GET_STATS;
1465
1466 /* Call Manager */
1467
1468 typedef VOID
1469 (NTAPI *CM_ACTIVATE_VC_COMPLETE_HANDLER)(
1470 IN NDIS_STATUS Status,
1471 IN NDIS_HANDLE CallMgrVcContext,
1472 IN PCO_CALL_PARAMETERS CallParameters);
1473
1474 typedef NDIS_STATUS
1475 (NTAPI *CM_ADD_PARTY_HANDLER)(
1476 IN NDIS_HANDLE CallMgrVcContext,
1477 IN OUT PCO_CALL_PARAMETERS CallParameters,
1478 IN NDIS_HANDLE NdisPartyHandle,
1479 OUT PNDIS_HANDLE CallMgrPartyContext);
1480
1481 typedef NDIS_STATUS
1482 (NTAPI *CM_CLOSE_AF_HANDLER)(
1483 IN NDIS_HANDLE CallMgrAfContext);
1484
1485 typedef NDIS_STATUS
1486 (NTAPI *CM_CLOSE_CALL_HANDLER)(
1487 IN NDIS_HANDLE CallMgrVcContext,
1488 IN NDIS_HANDLE CallMgrPartyContext OPTIONAL,
1489 IN PVOID CloseData OPTIONAL,
1490 IN UINT Size OPTIONAL);
1491
1492 typedef NDIS_STATUS
1493 (NTAPI *CM_DEREG_SAP_HANDLER)(
1494 IN NDIS_HANDLE CallMgrSapContext);
1495
1496 typedef VOID
1497 (NTAPI *CM_DEACTIVATE_VC_COMPLETE_HANDLER)(
1498 IN NDIS_STATUS Status,
1499 IN NDIS_HANDLE CallMgrVcContext);
1500
1501 typedef NDIS_STATUS
1502 (NTAPI *CM_DROP_PARTY_HANDLER)(
1503 IN NDIS_HANDLE CallMgrPartyContext,
1504 IN PVOID CloseData OPTIONAL,
1505 IN UINT Size OPTIONAL);
1506
1507 typedef VOID
1508 (NTAPI *CM_INCOMING_CALL_COMPLETE_HANDLER)(
1509 IN NDIS_STATUS Status,
1510 IN NDIS_HANDLE CallMgrVcContext,
1511 IN PCO_CALL_PARAMETERS CallParameters);
1512
1513 typedef NDIS_STATUS
1514 (NTAPI *CM_MAKE_CALL_HANDLER)(
1515 IN NDIS_HANDLE CallMgrVcContext,
1516 IN OUT PCO_CALL_PARAMETERS CallParameters,
1517 IN NDIS_HANDLE NdisPartyHandle OPTIONAL,
1518 OUT PNDIS_HANDLE CallMgrPartyContext OPTIONAL);
1519
1520 typedef NDIS_STATUS
1521 (NTAPI *CM_MODIFY_CALL_QOS_HANDLER)(
1522 IN NDIS_HANDLE CallMgrVcContext,
1523 IN PCO_CALL_PARAMETERS CallParameters);
1524
1525 typedef NDIS_STATUS
1526 (NTAPI *CM_OPEN_AF_HANDLER)(
1527 IN NDIS_HANDLE CallMgrBindingContext,
1528 IN PCO_ADDRESS_FAMILY AddressFamily,
1529 IN NDIS_HANDLE NdisAfHandle,
1530 OUT PNDIS_HANDLE CallMgrAfContext);
1531
1532 typedef NDIS_STATUS
1533 (NTAPI *CM_REG_SAP_HANDLER)(
1534 IN NDIS_HANDLE CallMgrAfContext,
1535 IN PCO_SAP Sap,
1536 IN NDIS_HANDLE NdisSapHandle,
1537 OUT PNDIS_HANDLE CallMgrSapContext);
1538
1539 typedef NDIS_STATUS
1540 (NTAPI *CO_CREATE_VC_HANDLER)(
1541 IN NDIS_HANDLE ProtocolAfContext,
1542 IN NDIS_HANDLE NdisVcHandle,
1543 OUT PNDIS_HANDLE ProtocolVcContext);
1544
1545 typedef NDIS_STATUS
1546 (NTAPI *CO_DELETE_VC_HANDLER)(
1547 IN NDIS_HANDLE ProtocolVcContext);
1548
1549 typedef VOID
1550 (NTAPI *CO_REQUEST_COMPLETE_HANDLER)(
1551 IN NDIS_STATUS Status,
1552 IN NDIS_HANDLE ProtocolAfContext OPTIONAL,
1553 IN NDIS_HANDLE ProtocolVcContext OPTIONAL,
1554 IN NDIS_HANDLE ProtocolPartyContext OPTIONAL,
1555 IN PNDIS_REQUEST NdisRequest);
1556
1557 typedef NDIS_STATUS
1558 (NTAPI *CO_REQUEST_HANDLER)(
1559 IN NDIS_HANDLE ProtocolAfContext,
1560 IN NDIS_HANDLE ProtocolVcContext OPTIONAL,
1561 IN NDIS_HANDLE ProtocolPartyContext OPTIONAL,
1562 IN OUT PNDIS_REQUEST NdisRequest);
1563
1564 typedef struct _NDIS_CALL_MANAGER_CHARACTERISTICS {
1565 UCHAR MajorVersion;
1566 UCHAR MinorVersion;
1567 USHORT Filler;
1568 UINT Reserved;
1569 CO_CREATE_VC_HANDLER CmCreateVcHandler;
1570 CO_DELETE_VC_HANDLER CmDeleteVcHandler;
1571 CM_OPEN_AF_HANDLER CmOpenAfHandler;
1572 CM_CLOSE_AF_HANDLER CmCloseAfHandler;
1573 CM_REG_SAP_HANDLER CmRegisterSapHandler;
1574 CM_DEREG_SAP_HANDLER CmDeregisterSapHandler;
1575 CM_MAKE_CALL_HANDLER CmMakeCallHandler;
1576 CM_CLOSE_CALL_HANDLER CmCloseCallHandler;
1577 CM_INCOMING_CALL_COMPLETE_HANDLER CmIncomingCallCompleteHandler;
1578 CM_ADD_PARTY_HANDLER CmAddPartyHandler;
1579 CM_DROP_PARTY_HANDLER CmDropPartyHandler;
1580 CM_ACTIVATE_VC_COMPLETE_HANDLER CmActivateVcCompleteHandler;
1581 CM_DEACTIVATE_VC_COMPLETE_HANDLER CmDeactivateVcCompleteHandler;
1582 CM_MODIFY_CALL_QOS_HANDLER CmModifyCallQoSHandler;
1583 CO_REQUEST_HANDLER CmRequestHandler;
1584 CO_REQUEST_COMPLETE_HANDLER CmRequestCompleteHandler;
1585 } NDIS_CALL_MANAGER_CHARACTERISTICS, *PNDIS_CALL_MANAGER_CHARACTERISTICS;
1586
1587
1588
1589 /* Call Manager clients */
1590
1591 typedef VOID (*CL_OPEN_AF_COMPLETE_HANDLER)(
1592 IN NDIS_STATUS Status,
1593 IN NDIS_HANDLE ProtocolAfContext,
1594 IN NDIS_HANDLE NdisAfHandle);
1595
1596 typedef VOID
1597 (NTAPI *CL_CLOSE_AF_COMPLETE_HANDLER)(
1598 IN NDIS_STATUS Status,
1599 IN NDIS_HANDLE ProtocolAfContext);
1600
1601 typedef VOID
1602 (NTAPI *CL_REG_SAP_COMPLETE_HANDLER)(
1603 IN NDIS_STATUS Status,
1604 IN NDIS_HANDLE ProtocolSapContext,
1605 IN PCO_SAP Sap,
1606 IN NDIS_HANDLE NdisSapHandle);
1607
1608 typedef VOID
1609 (NTAPI *CL_DEREG_SAP_COMPLETE_HANDLER)(
1610 IN NDIS_STATUS Status,
1611 IN NDIS_HANDLE ProtocolSapContext);
1612
1613 typedef VOID
1614 (NTAPI *CL_MAKE_CALL_COMPLETE_HANDLER)(
1615 IN NDIS_STATUS Status,
1616 IN NDIS_HANDLE ProtocolVcContext,
1617 IN NDIS_HANDLE NdisPartyHandle OPTIONAL,
1618 IN PCO_CALL_PARAMETERS CallParameters);
1619
1620 typedef VOID
1621 (NTAPI *CL_MODIFY_CALL_QOS_COMPLETE_HANDLER)(
1622 IN NDIS_STATUS Status,
1623 IN NDIS_HANDLE ProtocolVcContext,
1624 IN PCO_CALL_PARAMETERS CallParameters);
1625
1626 typedef VOID
1627 (NTAPI *CL_CLOSE_CALL_COMPLETE_HANDLER)(
1628 IN NDIS_STATUS Status,
1629 IN NDIS_HANDLE ProtocolVcContext,
1630 IN NDIS_HANDLE ProtocolPartyContext OPTIONAL);
1631
1632 typedef VOID
1633 (NTAPI *CL_ADD_PARTY_COMPLETE_HANDLER)(
1634 IN NDIS_STATUS Status,
1635 IN NDIS_HANDLE ProtocolPartyContext,
1636 IN NDIS_HANDLE NdisPartyHandle,
1637 IN PCO_CALL_PARAMETERS CallParameters);
1638
1639 typedef VOID
1640 (NTAPI *CL_DROP_PARTY_COMPLETE_HANDLER)(
1641 IN NDIS_STATUS Status,
1642 IN NDIS_HANDLE ProtocolPartyContext);
1643
1644 typedef NDIS_STATUS
1645 (NTAPI *CL_INCOMING_CALL_HANDLER)(
1646 IN NDIS_HANDLE ProtocolSapContext,
1647 IN NDIS_HANDLE ProtocolVcContext,
1648 IN OUT PCO_CALL_PARAMETERS CallParameters);
1649
1650 typedef VOID
1651 (NTAPI *CL_INCOMING_CALL_QOS_CHANGE_HANDLER)(
1652 IN NDIS_HANDLE ProtocolVcContext,
1653 IN PCO_CALL_PARAMETERS CallParameters);
1654
1655 typedef VOID
1656 (NTAPI *CL_INCOMING_CLOSE_CALL_HANDLER)(
1657 IN NDIS_STATUS CloseStatus,
1658 IN NDIS_HANDLE ProtocolVcContext,
1659 IN PVOID CloseData OPTIONAL,
1660 IN UINT Size OPTIONAL);
1661
1662 typedef VOID
1663 (NTAPI *CL_INCOMING_DROP_PARTY_HANDLER)(
1664 IN NDIS_STATUS DropStatus,
1665 IN NDIS_HANDLE ProtocolPartyContext,
1666 IN PVOID CloseData OPTIONAL,
1667 IN UINT Size OPTIONAL);
1668
1669 typedef VOID
1670 (NTAPI *CL_CALL_CONNECTED_HANDLER)(
1671 IN NDIS_HANDLE ProtocolVcContext);
1672
1673
1674 typedef struct _NDIS_CLIENT_CHARACTERISTICS {
1675 UCHAR MajorVersion;
1676 UCHAR MinorVersion;
1677 USHORT Filler;
1678 UINT Reserved;
1679 CO_CREATE_VC_HANDLER ClCreateVcHandler;
1680 CO_DELETE_VC_HANDLER ClDeleteVcHandler;
1681 CO_REQUEST_HANDLER ClRequestHandler;
1682 CO_REQUEST_COMPLETE_HANDLER ClRequestCompleteHandler;
1683 CL_OPEN_AF_COMPLETE_HANDLER ClOpenAfCompleteHandler;
1684 CL_CLOSE_AF_COMPLETE_HANDLER ClCloseAfCompleteHandler;
1685 CL_REG_SAP_COMPLETE_HANDLER ClRegisterSapCompleteHandler;
1686 CL_DEREG_SAP_COMPLETE_HANDLER ClDeregisterSapCompleteHandler;
1687 CL_MAKE_CALL_COMPLETE_HANDLER ClMakeCallCompleteHandler;
1688 CL_MODIFY_CALL_QOS_COMPLETE_HANDLER ClModifyCallQoSCompleteHandler;
1689 CL_CLOSE_CALL_COMPLETE_HANDLER ClCloseCallCompleteHandler;
1690 CL_ADD_PARTY_COMPLETE_HANDLER ClAddPartyCompleteHandler;
1691 CL_DROP_PARTY_COMPLETE_HANDLER ClDropPartyCompleteHandler;
1692 CL_INCOMING_CALL_HANDLER ClIncomingCallHandler;
1693 CL_INCOMING_CALL_QOS_CHANGE_HANDLER ClIncomingCallQoSChangeHandler;
1694 CL_INCOMING_CLOSE_CALL_HANDLER ClIncomingCloseCallHandler;
1695 CL_INCOMING_DROP_PARTY_HANDLER ClIncomingDropPartyHandler;
1696 CL_CALL_CONNECTED_HANDLER ClCallConnectedHandler;
1697 } NDIS_CLIENT_CHARACTERISTICS, *PNDIS_CLIENT_CHARACTERISTICS;
1698
1699
1700 /* NDIS protocol structures */
1701
1702 /* Prototypes for NDIS 3.0 protocol characteristics */
1703
1704 typedef VOID
1705 (NTAPI *OPEN_ADAPTER_COMPLETE_HANDLER)(
1706 IN NDIS_HANDLE ProtocolBindingContext,
1707 IN NDIS_STATUS Status,
1708 IN NDIS_STATUS OpenErrorStatus);
1709
1710 typedef VOID
1711 (NTAPI *CLOSE_ADAPTER_COMPLETE_HANDLER)(
1712 IN NDIS_HANDLE ProtocolBindingContext,
1713 IN NDIS_STATUS Status);
1714
1715 typedef VOID
1716 (NTAPI *RESET_COMPLETE_HANDLER)(
1717 IN NDIS_HANDLE ProtocolBindingContext,
1718 IN NDIS_STATUS Status);
1719
1720 typedef VOID
1721 (NTAPI *REQUEST_COMPLETE_HANDLER)(
1722 IN NDIS_HANDLE ProtocolBindingContext,
1723 IN PNDIS_REQUEST NdisRequest,
1724 IN NDIS_STATUS Status);
1725
1726 typedef VOID
1727 (NTAPI *STATUS_HANDLER)(
1728 IN NDIS_HANDLE ProtocolBindingContext,
1729 IN NDIS_STATUS GeneralStatus,
1730 IN PVOID StatusBuffer,
1731 IN UINT StatusBufferSize);
1732
1733 typedef VOID
1734 (NTAPI *STATUS_COMPLETE_HANDLER)(
1735 IN NDIS_HANDLE ProtocolBindingContext);
1736
1737 typedef VOID
1738 (NTAPI *SEND_COMPLETE_HANDLER)(
1739 IN NDIS_HANDLE ProtocolBindingContext,
1740 IN PNDIS_PACKET Packet,
1741 IN NDIS_STATUS Status);
1742
1743 typedef VOID
1744 (NTAPI *WAN_SEND_COMPLETE_HANDLER)(
1745 IN NDIS_HANDLE ProtocolBindingContext,
1746 IN PNDIS_WAN_PACKET Packet,
1747 IN NDIS_STATUS Status);
1748
1749 typedef VOID
1750 (NTAPI *TRANSFER_DATA_COMPLETE_HANDLER)(
1751 IN NDIS_HANDLE ProtocolBindingContext,
1752 IN PNDIS_PACKET Packet,
1753 IN NDIS_STATUS Status,
1754 IN UINT BytesTransferred);
1755
1756 typedef VOID
1757 (NTAPI *WAN_TRANSFER_DATA_COMPLETE_HANDLER)(
1758 VOID);
1759
1760
1761 typedef NDIS_STATUS
1762 (NTAPI *RECEIVE_HANDLER)(
1763 IN NDIS_HANDLE ProtocolBindingContext,
1764 IN NDIS_HANDLE MacReceiveContext,
1765 IN PVOID HeaderBuffer,
1766 IN UINT HeaderBufferSize,
1767 IN PVOID LookAheadBuffer,
1768 IN UINT LookaheadBufferSize,
1769 IN UINT PacketSize);
1770
1771 typedef NDIS_STATUS
1772 (NTAPI *WAN_RECEIVE_HANDLER)(
1773 IN NDIS_HANDLE NdisLinkHandle,
1774 IN PUCHAR Packet,
1775 IN ULONG PacketSize);
1776
1777 typedef VOID
1778 (NTAPI *RECEIVE_COMPLETE_HANDLER)(
1779 IN NDIS_HANDLE ProtocolBindingContext);
1780
1781
1782 /* Protocol characteristics for NDIS 3.0 protocols */
1783
1784 #define NDIS30_PROTOCOL_CHARACTERISTICS_S \
1785 UCHAR MajorNdisVersion; \
1786 UCHAR MinorNdisVersion; \
1787 USHORT Filler; \
1788 _ANONYMOUS_UNION union { \
1789 UINT Reserved; \
1790 UINT Flags; \
1791 } DUMMYUNIONNAME; \
1792 OPEN_ADAPTER_COMPLETE_HANDLER OpenAdapterCompleteHandler; \
1793 CLOSE_ADAPTER_COMPLETE_HANDLER CloseAdapterCompleteHandler; \
1794 _ANONYMOUS_UNION union { \
1795 SEND_COMPLETE_HANDLER SendCompleteHandler; \
1796 WAN_SEND_COMPLETE_HANDLER WanSendCompleteHandler; \
1797 } DUMMYUNIONNAME2; \
1798 _ANONYMOUS_UNION union { \
1799 TRANSFER_DATA_COMPLETE_HANDLER TransferDataCompleteHandler; \
1800 WAN_TRANSFER_DATA_COMPLETE_HANDLER WanTransferDataCompleteHandler; \
1801 } DUMMYUNIONNAME3; \
1802 RESET_COMPLETE_HANDLER ResetCompleteHandler; \
1803 REQUEST_COMPLETE_HANDLER RequestCompleteHandler; \
1804 _ANONYMOUS_UNION union { \
1805 RECEIVE_HANDLER ReceiveHandler; \
1806 WAN_RECEIVE_HANDLER WanReceiveHandler; \
1807 } DUMMYUNIONNAME4; \
1808 RECEIVE_COMPLETE_HANDLER ReceiveCompleteHandler; \
1809 STATUS_HANDLER StatusHandler; \
1810 STATUS_COMPLETE_HANDLER StatusCompleteHandler; \
1811 NDIS_STRING Name;
1812
1813 typedef struct _NDIS30_PROTOCOL_CHARACTERISTICS {
1814 NDIS30_PROTOCOL_CHARACTERISTICS_S
1815 } NDIS30_PROTOCOL_CHARACTERISTICS, *PNDIS30_PROTOCOL_CHARACTERISTICS;
1816
1817
1818 /* Prototypes for NDIS 4.0 protocol characteristics */
1819
1820 typedef INT
1821 (NTAPI *RECEIVE_PACKET_HANDLER)(
1822 IN NDIS_HANDLE ProtocolBindingContext,
1823 IN PNDIS_PACKET Packet);
1824
1825 typedef VOID
1826 (NTAPI *BIND_HANDLER)(
1827 OUT PNDIS_STATUS Status,
1828 IN NDIS_HANDLE BindContext,
1829 IN PNDIS_STRING DeviceName,
1830 IN PVOID SystemSpecific1,
1831 IN PVOID SystemSpecific2);
1832
1833 typedef VOID
1834 (NTAPI *UNBIND_HANDLER)(
1835 OUT PNDIS_STATUS Status,
1836 IN NDIS_HANDLE ProtocolBindingContext,
1837 IN NDIS_HANDLE UnbindContext);
1838
1839 typedef NDIS_STATUS
1840 (NTAPI *PNP_EVENT_HANDLER)(
1841 IN NDIS_HANDLE ProtocolBindingContext,
1842 IN PNET_PNP_EVENT NetPnPEvent);
1843
1844 typedef VOID
1845 (NTAPI *UNLOAD_PROTOCOL_HANDLER)(
1846 VOID);
1847
1848
1849 /* Protocol characteristics for NDIS 4.0 protocols */
1850
1851 #ifdef __cplusplus
1852
1853 #define NDIS40_PROTOCOL_CHARACTERISTICS_S \
1854 NDIS30_PROTOCOL_CHARACTERISTICS Ndis30Chars; \
1855 RECEIVE_PACKET_HANDLER ReceivePacketHandler; \
1856 BIND_HANDLER BindAdapterHandler; \
1857 UNBIND_HANDLER UnbindAdapterHandler; \
1858 PNP_EVENT_HANDLER PnPEventHandler; \
1859 UNLOAD_PROTOCOL_HANDLER UnloadHandler;
1860
1861 #else /* !__cplusplus */
1862
1863 #define NDIS40_PROTOCOL_CHARACTERISTICS_S \
1864 NDIS30_PROTOCOL_CHARACTERISTICS_S \
1865 RECEIVE_PACKET_HANDLER ReceivePacketHandler; \
1866 BIND_HANDLER BindAdapterHandler; \
1867 UNBIND_HANDLER UnbindAdapterHandler; \
1868 PNP_EVENT_HANDLER PnPEventHandler; \
1869 UNLOAD_PROTOCOL_HANDLER UnloadHandler;
1870
1871 #endif /* __cplusplus */
1872
1873 typedef struct _NDIS40_PROTOCOL_CHARACTERISTICS {
1874 NDIS40_PROTOCOL_CHARACTERISTICS_S
1875 } NDIS40_PROTOCOL_CHARACTERISTICS, *PNDIS40_PROTOCOL_CHARACTERISTICS;
1876
1877 /* Prototypes for NDIS 5.0 protocol characteristics */
1878
1879 typedef VOID
1880 (NTAPI *CO_SEND_COMPLETE_HANDLER)(
1881 IN NDIS_STATUS Status,
1882 IN NDIS_HANDLE ProtocolVcContext,
1883 IN PNDIS_PACKET Packet);
1884
1885 typedef VOID
1886 (NTAPI *CO_STATUS_HANDLER)(
1887 IN NDIS_HANDLE ProtocolBindingContext,
1888 IN NDIS_HANDLE ProtocolVcContext OPTIONAL,
1889 IN NDIS_STATUS GeneralStatus,
1890 IN PVOID StatusBuffer,
1891 IN UINT StatusBufferSize);
1892
1893 typedef UINT
1894 (NTAPI *CO_RECEIVE_PACKET_HANDLER)(
1895 IN NDIS_HANDLE ProtocolBindingContext,
1896 IN NDIS_HANDLE ProtocolVcContext,
1897 IN PNDIS_PACKET Packet);
1898
1899 typedef VOID
1900 (NTAPI *CO_AF_REGISTER_NOTIFY_HANDLER)(
1901 IN NDIS_HANDLE ProtocolBindingContext,
1902 IN PCO_ADDRESS_FAMILY AddressFamily);
1903
1904 #ifdef __cplusplus \
1905
1906 #define NDIS50_PROTOCOL_CHARACTERISTICS_S \
1907 NDIS40_PROTOCOL_CHARACTERISTICS Ndis40Chars; \
1908 PVOID ReservedHandlers[4]; \
1909 CO_SEND_COMPLETE_HANDLER CoSendCompleteHandler; \
1910 CO_STATUS_HANDLER CoStatusHandler; \
1911 CO_RECEIVE_PACKET_HANDLER CoReceivePacketHandler; \
1912 CO_AF_REGISTER_NOTIFY_HANDLER CoAfRegisterNotifyHandler;
1913
1914 #else /* !__cplusplus */
1915
1916 #define NDIS50_PROTOCOL_CHARACTERISTICS_S \
1917 NDIS40_PROTOCOL_CHARACTERISTICS_S \
1918 PVOID ReservedHandlers[4]; \
1919 CO_SEND_COMPLETE_HANDLER CoSendCompleteHandler; \
1920 CO_STATUS_HANDLER CoStatusHandler; \
1921 CO_RECEIVE_PACKET_HANDLER CoReceivePacketHandler; \
1922 CO_AF_REGISTER_NOTIFY_HANDLER CoAfRegisterNotifyHandler;
1923
1924 #endif /* !__cplusplus */
1925
1926 typedef struct _NDIS50_PROTOCOL_CHARACTERISTICS {
1927 NDIS50_PROTOCOL_CHARACTERISTICS_S
1928 } NDIS50_PROTOCOL_CHARACTERISTICS, *PNDIS50_PROTOCOL_CHARACTERISTICS;
1929
1930 #if defined(NDIS50) || defined(NDIS51)
1931 typedef struct _NDIS_PROTOCOL_CHARACTERISTICS {
1932 NDIS50_PROTOCOL_CHARACTERISTICS_S
1933 } NDIS_PROTOCOL_CHARACTERISTICS, *PNDIS_PROTOCOL_CHARACTERISTICS;
1934 #elif defined(NDIS40)
1935 typedef struct _NDIS_PROTOCOL_CHARACTERISTICS {
1936 NDIS40_PROTOCOL_CHARACTERISTICS_S
1937 } NDIS_PROTOCOL_CHARACTERISTICS, *PNDIS_PROTOCOL_CHARACTERISTICS;
1938 #else /* NDIS30 */
1939 typedef struct _NDIS_PROTOCOL_CHARACTERISTICS {
1940 NDIS30_PROTOCOL_CHARACTERISTICS_S
1941 } NDIS_PROTOCOL_CHARACTERISTICS, *PNDIS_PROTOCOL_CHARACTERISTICS;
1942 #endif
1943
1944
1945
1946 /* Buffer management routines */
1947
1948 NDISAPI
1949 VOID
1950 NTAPI
1951 NdisAllocateBuffer(
1952 OUT PNDIS_STATUS Status,
1953 OUT PNDIS_BUFFER *Buffer,
1954 IN NDIS_HANDLE PoolHandle,
1955 IN PVOID VirtualAddress,
1956 IN UINT Length);
1957
1958
1959 NDISAPI
1960 VOID
1961 NTAPI
1962 NdisAllocateBufferPool(
1963 OUT PNDIS_STATUS Status,
1964 OUT PNDIS_HANDLE PoolHandle,
1965 IN UINT NumberOfDescriptors);
1966
1967 NDISAPI
1968 VOID
1969 NTAPI
1970 NdisAllocatePacket(
1971 OUT PNDIS_STATUS Status,
1972 OUT PNDIS_PACKET *Packet,
1973 IN NDIS_HANDLE PoolHandle);
1974
1975 NDISAPI
1976 VOID
1977 NTAPI
1978 NdisAllocatePacketPool(
1979 OUT PNDIS_STATUS Status,
1980 OUT PNDIS_HANDLE PoolHandle,
1981 IN UINT NumberOfDescriptors,
1982 IN UINT ProtocolReservedLength);
1983
1984 #define PROTOCOL_RESERVED_SIZE_IN_PACKET (4 * sizeof(PVOID))
1985
1986 NDISAPI
1987 VOID
1988 NTAPI
1989 NdisCopyBuffer(
1990 OUT PNDIS_STATUS Status,
1991 OUT PNDIS_BUFFER *Buffer,
1992 IN NDIS_HANDLE PoolHandle,
1993 IN PVOID MemoryDescriptor,
1994 IN UINT Offset,
1995 IN UINT Length);
1996
1997 NDISAPI
1998 VOID
1999 NTAPI
2000 NdisCopyFromPacketToPacket(
2001 IN PNDIS_PACKET Destination,
2002 IN UINT DestinationOffset,
2003 IN UINT BytesToCopy,
2004 IN PNDIS_PACKET Source,
2005 IN UINT SourceOffset,
2006 OUT PUINT BytesCopied);
2007
2008 /*
2009 * VOID
2010 * NdisCopyLookaheadData(
2011 * IN PVOID Destination,
2012 * IN PVOID Source,
2013 * IN ULONG Length,
2014 * IN ULONG ReceiveFlags);
2015 */
2016
2017 #if defined(_M_IX86) || defined(_M_AMD64)
2018 #define NdisCopyLookaheadData(Destination, Source, Length, MacOptions) \
2019 RtlCopyMemory(Destination, Source, Length)
2020 #else
2021 #define NdisCopyLookaheadData(Destination, Source, Length, MacOptions) \
2022 { \
2023 if ((MacOptions) & NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA) \
2024 { \
2025 RtlCopyMemory(_Destination, _Source, _Length); \
2026 } \
2027 else \
2028 { \
2029 PUCHAR _Src = (PUCHAR)(Source); \
2030 PUCHAR _Dest = (PUCHAR)(Destination); \
2031 PUCHAR _End = _Dest + (Length); \
2032 while (_Dest < _End) \
2033 *_Dest++ = *_Src++; \
2034 } \
2035 }
2036 #endif
2037
2038 NDISAPI
2039 VOID
2040 NTAPI
2041 NdisDprAllocatePacket(
2042 OUT PNDIS_STATUS Status,
2043 OUT PNDIS_PACKET *Packet,
2044 IN NDIS_HANDLE PoolHandle);
2045
2046 NDISAPI
2047 VOID
2048 NTAPI
2049 NdisDprAllocatePacketNonInterlocked(
2050 OUT PNDIS_STATUS Status,
2051 OUT PNDIS_PACKET *Packet,
2052 IN NDIS_HANDLE PoolHandle);
2053
2054 NDISAPI
2055 VOID
2056 NTAPI
2057 NdisDprFreePacket(
2058 IN PNDIS_PACKET Packet);
2059
2060 NDISAPI
2061 VOID
2062 NTAPI
2063 NdisDprFreePacketNonInterlocked(
2064 IN PNDIS_PACKET Packet);
2065
2066 NDISAPI
2067 VOID
2068 NTAPI
2069 NdisFreeBufferPool(
2070 IN NDIS_HANDLE PoolHandle);
2071
2072 NDISAPI
2073 VOID
2074 NTAPI
2075 NdisFreePacket(
2076 IN PNDIS_PACKET Packet);
2077
2078 NDISAPI
2079 VOID
2080 NTAPI
2081 NdisFreePacketPool(
2082 IN NDIS_HANDLE PoolHandle);
2083
2084 NDISAPI
2085 VOID
2086 NTAPI
2087 NdisReturnPackets(
2088 IN PNDIS_PACKET *PacketsToReturn,
2089 IN UINT NumberOfPackets);
2090
2091 NDISAPI
2092 VOID
2093 NTAPI
2094 NdisUnchainBufferAtBack(
2095 IN OUT PNDIS_PACKET Packet,
2096 OUT PNDIS_BUFFER *Buffer);
2097
2098 NDISAPI
2099 VOID
2100 NTAPI
2101 NdisUnchainBufferAtFront(
2102 IN OUT PNDIS_PACKET Packet,
2103 OUT PNDIS_BUFFER *Buffer);
2104
2105 NDISAPI
2106 VOID
2107 NTAPI
2108 NdisAdjustBufferLength(
2109 IN PNDIS_BUFFER Buffer,
2110 IN UINT Length);
2111
2112 NDISAPI
2113 ULONG
2114 NTAPI
2115 NdisBufferLength(
2116 IN PNDIS_BUFFER Buffer);
2117
2118 NDISAPI
2119 PVOID
2120 NTAPI
2121 NdisBufferVirtualAddress(
2122 IN PNDIS_BUFFER Buffer);
2123
2124 NDISAPI
2125 ULONG
2126 NTAPI
2127 NDIS_BUFFER_TO_SPAN_PAGES(
2128 IN PNDIS_BUFFER Buffer);
2129
2130 NDISAPI
2131 VOID
2132 NTAPI
2133 NdisFreeBuffer(
2134 IN PNDIS_BUFFER Buffer);
2135
2136 NDISAPI
2137 VOID
2138 NTAPI
2139 NdisGetBufferPhysicalArraySize(
2140 IN PNDIS_BUFFER Buffer,
2141 OUT PUINT ArraySize);
2142
2143 NDISAPI
2144 VOID
2145 NTAPI
2146 NdisGetFirstBufferFromPacket(
2147 IN PNDIS_PACKET _Packet,
2148 OUT PNDIS_BUFFER *_FirstBuffer,
2149 OUT PVOID *_FirstBufferVA,
2150 OUT PUINT _FirstBufferLength,
2151 OUT PUINT _TotalBufferLength);
2152
2153 /*
2154 * VOID
2155 * NdisGetFirstBufferFromPacketSafe(
2156 * IN PNDIS_PACKET _Packet,
2157 * OUT PNDIS_BUFFER * _FirstBuffer,
2158 * OUT PVOID * _FirstBufferVA,
2159 * OUT PUINT _FirstBufferLength,
2160 * OUT PUINT _TotalBufferLength),
2161 * IN MM_PAGE_PRIORITY _Priority)
2162 */
2163 #define NdisGetFirstBufferFromPacketSafe(_Packet, \
2164 _FirstBuffer, \
2165 _FirstBufferVA, \
2166 _FirstBufferLength, \
2167 _TotalBufferLength, \
2168 _Priority) \
2169 { \
2170 PNDIS_BUFFER _Buffer; \
2171 \
2172 _Buffer = (_Packet)->Private.Head; \
2173 *(_FirstBuffer) = _Buffer; \
2174 if (_Buffer != NULL) \
2175 { \
2176 *(_FirstBufferVA) = MmGetSystemAddressForMdlSafe(_Buffer, _Priority); \
2177 *(_FirstBufferLength) = MmGetMdlByteCount(_Buffer); \
2178 _Buffer = _Buffer->Next; \
2179 *(_TotalBufferLength) = *(_FirstBufferLength); \
2180 while (_Buffer != NULL) { \
2181 *(_TotalBufferLength) += MmGetMdlByteCount(_Buffer); \
2182 _Buffer = _Buffer->Next; \
2183 } \
2184 } \
2185 else \
2186 { \
2187 *(_FirstBufferVA) = 0; \
2188 *(_FirstBufferLength) = 0; \
2189 *(_TotalBufferLength) = 0; \
2190 } \
2191 }
2192
2193 NDISAPI
2194 VOID
2195 NTAPI
2196 NdisQueryBuffer(
2197 IN PNDIS_BUFFER Buffer,
2198 OUT PVOID *VirtualAddress OPTIONAL,
2199 OUT PUINT Length);
2200
2201 NDISAPI
2202 VOID
2203 NTAPI
2204 NdisQueryBufferOffset(
2205 IN PNDIS_BUFFER Buffer,
2206 OUT PUINT Offset,
2207 OUT PUINT Length);
2208
2209 /*
2210 * PVOID
2211 * NDIS_BUFFER_LINKAGE(
2212 * IN PNDIS_BUFFER Buffer);
2213 */
2214 #define NDIS_BUFFER_LINKAGE(Buffer)(Buffer)->Next;
2215
2216
2217 /*
2218 * VOID
2219 * NdisChainBufferAtBack(
2220 * IN OUT PNDIS_PACKET Packet,
2221 * IN OUT PNDIS_BUFFER Buffer)
2222 */
2223 #define NdisChainBufferAtBack(Packet, \
2224 Buffer) \
2225 { \
2226 PNDIS_BUFFER NdisBuffer = (Buffer); \
2227 \
2228 while (NdisBuffer->Next != NULL) \
2229 NdisBuffer = NdisBuffer->Next; \
2230 \
2231 NdisBuffer->Next = NULL; \
2232 \
2233 if ((Packet)->Private.Head != NULL) \
2234 (Packet)->Private.Tail->Next = (Buffer); \
2235 else \
2236 (Packet)->Private.Head = (Buffer); \
2237 \
2238 (Packet)->Private.Tail = NdisBuffer; \
2239 (Packet)->Private.ValidCounts = FALSE; \
2240 }
2241
2242
2243 /*
2244 * VOID
2245 * NdisChainBufferAtFront(
2246 * IN OUT PNDIS_PACKET Packet,
2247 * IN OUT PNDIS_BUFFER Buffer)
2248 */
2249 #define NdisChainBufferAtFront(Packet, \
2250 Buffer) \
2251 { \
2252 PNDIS_BUFFER _NdisBuffer = (Buffer); \
2253 \
2254 while (_NdisBuffer->Next != NULL) \
2255 _NdisBuffer = _NdisBuffer->Next; \
2256 \
2257 if ((Packet)->Private.Head == NULL) \
2258 (Packet)->Private.Tail = _NdisBuffer; \
2259 \
2260 _NdisBuffer->Next = (Packet)->Private.Head; \
2261 (Packet)->Private.Head = (Buffer); \
2262 (Packet)->Private.ValidCounts = FALSE; \
2263 }
2264
2265
2266 /*
2267 * VOID
2268 * NdisGetNextBuffer(
2269 * IN PNDIS_BUFFER CurrentBuffer,
2270 * OUT PNDIS_BUFFER * NextBuffer)
2271 */
2272 #define NdisGetNextBuffer(CurrentBuffer, \
2273 NextBuffer) \
2274 { \
2275 *(NextBuffer) = (CurrentBuffer)->Next; \
2276 }
2277
2278 #if NDIS_LEGACY_DRIVER
2279
2280 #define NDIS_PACKET_FIRST_NDIS_BUFFER(_Packet) ((_Packet)->Private.Head)
2281 #define NDIS_PACKET_LAST_NDIS_BUFFER(_Packet) ((_Packet)->Private.Tail)
2282 #define NDIS_PACKET_VALID_COUNTS(_Packet) ((_Packet)->Private.ValidCounts)
2283
2284 /*
2285 * UINT
2286 * NdisGetPacketFlags(
2287 * IN PNDIS_PACKET Packet);
2288 */
2289 #define NdisGetPacketFlags(Packet)(Packet)->Private.Flags;
2290
2291 /*
2292 * ULONG
2293 * NDIS_GET_PACKET_PROTOCOL_TYPE(
2294 * IN PNDIS_PACKET Packet);
2295 */
2296 #define NDIS_GET_PACKET_PROTOCOL_TYPE(_Packet) \
2297 ((_Packet)->Private.Flags & NDIS_PROTOCOL_ID_MASK)
2298
2299 /*
2300 * PNDIS_PACKET_OOB_DATA
2301 * NDIS_OOB_DATA_FROM_PACKET(
2302 * IN PNDIS_PACKET Packet);
2303 */
2304 #define NDIS_OOB_DATA_FROM_PACKET(_Packet) \
2305 (PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
2306 (_Packet)->Private.NdisPacketOobOffset)
2307
2308 /*
2309 * ULONG
2310 * NDIS_GET_PACKET_HEADER_SIZE(
2311 * IN PNDIS_PACKET Packet);
2312 */
2313 #define NDIS_GET_PACKET_HEADER_SIZE(_Packet) \
2314 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
2315 (_Packet)->Private.NdisPacketOobOffset))->HeaderSize
2316
2317 /*
2318 * NDIS_STATUS
2319 * NDIS_GET_PACKET_STATUS(
2320 * IN PNDIS_PACKET Packet);
2321 */
2322 #define NDIS_GET_PACKET_STATUS(_Packet) \
2323 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
2324 (_Packet)->Private.NdisPacketOobOffset))->Status
2325
2326 /*
2327 * ULONGLONG
2328 * NDIS_GET_PACKET_TIME_TO_SEND(
2329 * IN PNDIS_PACKET Packet);
2330 */
2331 #define NDIS_GET_PACKET_TIME_TO_SEND(_Packet) \
2332 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
2333 (_Packet)->Private.NdisPacketOobOffset))->TimeToSend
2334
2335 /*
2336 * ULONGLONG
2337 * NDIS_GET_PACKET_TIME_SENT(
2338 * IN PNDIS_PACKET Packet);
2339 */
2340 #define NDIS_GET_PACKET_TIME_SENT(_Packet) \
2341 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
2342 (_Packet)->Private.NdisPacketOobOffset))->TimeSent
2343
2344 /*
2345 * ULONGLONG
2346 * NDIS_GET_PACKET_TIME_RECEIVED(
2347 * IN PNDIS_PACKET Packet);
2348 */
2349 #define NDIS_GET_PACKET_TIME_RECEIVED(_Packet) \
2350 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
2351 (_Packet)->Private.NdisPacketOobOffset))->TimeReceived
2352
2353 /*
2354 * VOID
2355 * NDIS_GET_PACKET_MEDIA_SPECIFIC_INFO(
2356 * IN PNDIS_PACKET Packet,
2357 * IN PPVOID pMediaSpecificInfo,
2358 * IN PUINT pSizeMediaSpecificInfo);
2359 */
2360 #define NDIS_GET_PACKET_MEDIA_SPECIFIC_INFO(_Packet, \
2361 _pMediaSpecificInfo, \
2362 _pSizeMediaSpecificInfo) \
2363 { \
2364 if (!((_Packet)->Private.NdisPacketFlags & fPACKET_ALLOCATED_BY_NDIS) || \
2365 !((_Packet)->Private.NdisPacketFlags & fPACKET_CONTAINS_MEDIA_SPECIFIC_INFO)) \
2366 { \
2367 *(_pMediaSpecificInfo) = NULL; \
2368 *(_pSizeMediaSpecificInfo) = 0; \
2369 } \
2370 else \
2371 { \
2372 *(_pMediaSpecificInfo) = ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
2373 (_Packet)->Private.NdisPacketOobOffset))->MediaSpecificInformation; \
2374 *(_pSizeMediaSpecificInfo) = ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
2375 (_Packet)->Private.NdisPacketOobOffset))->SizeMediaSpecificInfo; \
2376 } \
2377 }
2378
2379 /*
2380 * VOID
2381 * NDIS_SET_PACKET_HEADER_SIZE(
2382 * IN PNDIS_PACKET Packet,
2383 * IN UINT HdrSize);
2384 */
2385 #define NDIS_SET_PACKET_HEADER_SIZE(_Packet, _HdrSize) \
2386 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
2387 (_Packet)->Private.NdisPacketOobOffset))->HeaderSize = (_HdrSize)
2388
2389 /*
2390 * VOID
2391 * NDIS_SET_PACKET_STATUS(
2392 * IN PNDIS_PACKET Packet,
2393 * IN NDIS_STATUS Status);
2394 */
2395 #define NDIS_SET_PACKET_STATUS(_Packet, _Status) \
2396 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
2397 (_Packet)->Private.NdisPacketOobOffset))->Status = (_Status)
2398
2399 /*
2400 * VOID
2401 * NDIS_SET_PACKET_TIME_TO_SEND(
2402 * IN PNDIS_PACKET Packet,
2403 * IN ULONGLONG TimeToSend);
2404 */
2405 #define NDIS_SET_PACKET_TIME_TO_SEND(_Packet, _TimeToSend) \
2406 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
2407 (_Packet)->Private.NdisPacketOobOffset))->TimeToSend = (_TimeToSend)
2408
2409 /*
2410 * VOID
2411 * NDIS_SET_PACKET_TIME_SENT(
2412 * IN PNDIS_PACKET Packet,
2413 * IN ULONGLONG TimeSent);
2414 */
2415 #define NDIS_SET_PACKET_TIME_SENT(_Packet, _TimeSent) \
2416 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
2417 (_Packet)->Private.NdisPacketOobOffset))->TimeSent = (_TimeSent)
2418
2419 /*
2420 * VOID
2421 * NDIS_SET_PACKET_TIME_RECEIVED(
2422 * IN PNDIS_PACKET Packet,
2423 * IN ULONGLONG TimeReceived);
2424 */
2425 #define NDIS_SET_PACKET_TIME_RECEIVED(_Packet, _TimeReceived) \
2426 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
2427 (_Packet)->Private.NdisPacketOobOffset))->TimeReceived = (_TimeReceived)
2428
2429 /*
2430 * VOID
2431 * NDIS_SET_PACKET_MEDIA_SPECIFIC_INFO(
2432 * IN PNDIS_PACKET Packet,
2433 * IN PVOID MediaSpecificInfo,
2434 * IN UINT SizeMediaSpecificInfo);
2435 */
2436 #define NDIS_SET_PACKET_MEDIA_SPECIFIC_INFO(_Packet, \
2437 _MediaSpecificInfo, \
2438 _SizeMediaSpecificInfo) \
2439 { \
2440 if ((_Packet)->Private.NdisPacketFlags & fPACKET_ALLOCATED_BY_NDIS) \
2441 { \
2442 (_Packet)->Private.NdisPacketFlags |= fPACKET_CONTAINS_MEDIA_SPECIFIC_INFO; \
2443 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
2444 (_Packet)->Private.NdisPacketOobOffset))->MediaSpecificInformation = \
2445 (_MediaSpecificInfo); \
2446 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
2447 (_Packet)->Private.NdisPacketOobOffset))->SizeMediaSpecificInfo = \
2448 (_SizeMediaSpecificInfo); \
2449 } \
2450 }
2451
2452 /*
2453 * VOID
2454 * NdisSetPacketFlags(
2455 * IN PNDIS_PACKET Packet,
2456 * IN UINT Flags);
2457 */
2458 #define NdisSetPacketFlags(Packet, Flags) (Packet)->Private.Flags |= (Flags)
2459
2460 /*
2461 * VOID
2462 * NdisClearPacketFlags(
2463 * IN PNDIS_PACKET Packet,
2464 * IN UINT Flags);
2465 */
2466 #define NdisClearPacketFlags(Packet, Flags) (Packet)->Private.Flags &= ~(Flags)
2467
2468 #endif /* NDIS_LEGACY_DRIVER */
2469
2470 /*
2471 * VOID
2472 * NdisQueryPacket(
2473 * IN PNDIS_PACKET Packet,
2474 * OUT PUINT PhysicalBufferCount OPTIONAL,
2475 * OUT PUINT BufferCount OPTIONAL,
2476 * OUT PNDIS_BUFFER *FirstBuffer OPTIONAL,
2477 * OUT PUINT TotalPacketLength OPTIONAL);
2478 */
2479 static __inline
2480 VOID
2481 NdisQueryPacket(
2482 IN PNDIS_PACKET Packet,
2483 OUT PUINT PhysicalBufferCount OPTIONAL,
2484 OUT PUINT BufferCount OPTIONAL,
2485 OUT PNDIS_BUFFER *FirstBuffer OPTIONAL,
2486 OUT PUINT TotalPacketLength OPTIONAL)
2487 {
2488 if (FirstBuffer)
2489 *FirstBuffer = Packet->Private.Head;
2490 if (TotalPacketLength || BufferCount || PhysicalBufferCount)
2491 {
2492 if (!Packet->Private.ValidCounts)
2493 {
2494 UINT Offset;
2495 UINT PacketLength;
2496 PNDIS_BUFFER NdisBuffer;
2497 UINT PhysicalBufferCount = 0;
2498 UINT TotalPacketLength = 0;
2499 UINT Count = 0;
2500
2501 for (NdisBuffer = Packet->Private.Head;
2502 NdisBuffer != (PNDIS_BUFFER)NULL;
2503 NdisBuffer = NdisBuffer->Next)
2504 {
2505 PhysicalBufferCount += NDIS_BUFFER_TO_SPAN_PAGES(NdisBuffer);
2506 NdisQueryBufferOffset(NdisBuffer, &Offset, &PacketLength);
2507 TotalPacketLength += PacketLength;
2508 Count++;
2509 }
2510 Packet->Private.PhysicalCount = PhysicalBufferCount;
2511 Packet->Private.TotalLength = TotalPacketLength;
2512 Packet->Private.Count = Count;
2513 Packet->Private.ValidCounts = TRUE;
2514 }
2515
2516 if (PhysicalBufferCount)
2517 *PhysicalBufferCount = Packet->Private.PhysicalCount;
2518
2519 if (BufferCount)
2520 *BufferCount = Packet->Private.Count;
2521
2522 if (TotalPacketLength)
2523 *TotalPacketLength = Packet->Private.TotalLength;
2524 }
2525 }
2526
2527 /*
2528 * VOID
2529 * NdisQueryPacketLength(
2530 * IN PNDIS_PACKET Packet,
2531 * OUT PUINT PhysicalBufferCount OPTIONAL,
2532 * OUT PUINT BufferCount OPTIONAL,
2533 * OUT PNDIS_BUFFER *FirstBuffer OPTIONAL,
2534 * OUT PUINT TotalPacketLength OPTIONAL);
2535 */
2536 static __inline
2537 VOID
2538 NdisQueryPacketLength(
2539 IN PNDIS_PACKET Packet,
2540 OUT PUINT TotalPacketLength OPTIONAL)
2541 {
2542 if (!(Packet)->Private.ValidCounts) \
2543 NdisQueryPacket(Packet, NULL, NULL, NULL, TotalPacketLength); \
2544 else \
2545 *(TotalPacketLength) = (Packet)->Private.TotalLength; \
2546 }
2547
2548
2549 /*
2550 * VOID
2551 * NdisRecalculatePacketCounts(
2552 * IN OUT PNDIS_PACKET Packet);
2553 */
2554 #define NdisRecalculatePacketCounts(Packet) \
2555 { \
2556 PNDIS_BUFFER _Buffer = (Packet)->Private.Head; \
2557 if (_Buffer != NULL) \
2558 { \
2559 while (_Buffer->Next != NULL) \
2560 { \
2561 _Buffer = _Buffer->Next; \
2562 } \
2563 (Packet)->Private.Tail = _Buffer; \
2564 } \
2565 (Packet)->Private.ValidCounts = FALSE; \
2566 }
2567
2568
2569 /*
2570 * VOID
2571 * NdisReinitializePacket(
2572 * IN OUT PNDIS_PACKET Packet);
2573 */
2574 #define NdisReinitializePacket(Packet) \
2575 { \
2576 (Packet)->Private.Head = (PNDIS_BUFFER)NULL; \
2577 (Packet)->Private.ValidCounts = FALSE; \
2578 }
2579
2580 /*
2581 * VOID
2582 * NdisSetSendFlags(
2583 * IN PNDIS_PACKET Packet,
2584 * IN UINT Flags);
2585 */
2586 #define NdisSetSendFlags(_Packet,_Flags)(_Packet)->Private.Flags = (_Flags)
2587
2588
2589
2590 /* Memory management routines */
2591
2592 NDISAPI
2593 VOID
2594 NTAPI
2595 NdisCreateLookaheadBufferFromSharedMemory(
2596 IN PVOID pSharedMemory,
2597 IN UINT LookaheadLength,
2598 OUT PVOID *pLookaheadBuffer);
2599
2600 NDISAPI
2601 VOID
2602 NTAPI
2603 NdisDestroyLookaheadBufferFromSharedMemory(
2604 IN PVOID pLookaheadBuffer);
2605
2606 #if defined(_M_IX86) || defined(_M_AMD64) || defined(_M_ARM) || defined(_M_PPC)
2607
2608 /*
2609 * VOID
2610 * NdisMoveMappedMemory(
2611 * OUT PVOID Destination,
2612 * IN PVOID Source,
2613 * IN ULONG Length);
2614 */
2615 #define NdisMoveMappedMemory(Destination, Source, Length) \
2616 RtlCopyMemory(Destination, Source, Length)
2617
2618 /*
2619 * VOID
2620 * NdisZeroMappedMemory(
2621 * IN PVOID Destination,
2622 * IN ULONG Length);
2623 */
2624 #define NdisZeroMappedMemory(Destination, Length) \
2625 RtlZeroMemory(Destination, Length)
2626
2627 #else
2628
2629 #define NdisMoveMappedMemory(Destination, Source, Length) \
2630 { \
2631 PUCHAR _Dest = Destination, _Src = Source, _End = _Dest + Length; \
2632 while (_Dest < _End) \
2633 *_Dest++ = _Src++; \
2634 }
2635
2636 #define NdisZeroMappedMemory(Destination, Length) \
2637 { \
2638 PUCHAR _Dest = Destination, _End = _Dest + Length; \
2639 while (_Dest < _End) \
2640 *_Dest++ = 0; \
2641 }
2642
2643 #endif /* _M_IX86 or _M_AMD64 */
2644
2645 /*
2646 * VOID
2647 * NdisMoveFromMappedMemory(
2648 * OUT PVOID Destination,
2649 * IN PVOID Source,
2650 * IN ULONG Length);
2651 */
2652 #define NdisMoveFromMappedMemory(Destination, Source, Length) \
2653 NdisMoveMappedMemory(Destination, Source, Length)
2654
2655 /*
2656 * VOID
2657 * NdisMoveToMappedMemory(
2658 * OUT PVOID Destination,
2659 * IN PVOID Source,
2660 * IN ULONG Length);
2661 */
2662 #define NdisMoveToMappedMemory(Destination, Source, Length) \
2663 NdisMoveMappedMemory(Destination, Source, Length)
2664
2665 /*
2666 * VOID
2667 * NdisMUpdateSharedMemory(
2668 * IN NDIS_HANDLE MiniportAdapterHandle,
2669 * IN ULONG Length,
2670 * IN PVOID VirtualAddress,
2671 * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress);
2672 */
2673 #define NdisMUpdateSharedMemory(_H, _L, _V, _P) \
2674 NdisUpdateSharedMemory(_H, _L, _V, _P)
2675
2676 NDISAPI
2677 NDIS_STATUS
2678 NTAPI
2679 NdisAllocateMemory(
2680 OUT PVOID *VirtualAddress,
2681 IN UINT Length,
2682 IN UINT MemoryFlags,
2683 IN NDIS_PHYSICAL_ADDRESS HighestAcceptableAddress);
2684
2685 NDISAPI
2686 VOID
2687 NTAPI
2688 NdisFreeMemory(
2689 IN PVOID VirtualAddress,
2690 IN UINT Length,
2691 IN UINT MemoryFlags);
2692
2693 NDISAPI
2694 VOID
2695 NTAPI
2696 NdisImmediateReadSharedMemory(
2697 IN NDIS_HANDLE WrapperConfigurationContext,
2698 IN ULONG SharedMemoryAddress,
2699 OUT PUCHAR Buffer,
2700 IN ULONG Length);
2701
2702 NDISAPI
2703 VOID
2704 NTAPI
2705 NdisImmediateWriteSharedMemory(
2706 IN NDIS_HANDLE WrapperConfigurationContext,
2707 IN ULONG SharedMemoryAddress,
2708 IN PUCHAR Buffer,
2709 IN ULONG Length);
2710
2711 NDISAPI
2712 VOID
2713 NTAPI
2714 NdisMAllocateSharedMemory(
2715 IN NDIS_HANDLE MiniportAdapterHandle,
2716 IN ULONG Length,
2717 IN BOOLEAN Cached,
2718 OUT PVOID *VirtualAddress,
2719 OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress);
2720
2721 NDISAPI
2722 NDIS_STATUS
2723 NTAPI
2724 NdisMAllocateSharedMemoryAsync(
2725 IN NDIS_HANDLE MiniportAdapterHandle,
2726 IN ULONG Length,
2727 IN BOOLEAN Cached,
2728 IN PVOID Context);
2729
2730 #if defined(NDIS50)
2731
2732 #define NdisUpdateSharedMemory(NdisAdapterHandle, \
2733 Length, \
2734 VirtualAddress, \
2735 PhysicalAddress)
2736
2737 #else
2738
2739 NDISAPI
2740 VOID
2741 NTAPI
2742 NdisUpdateSharedMemory(
2743 IN NDIS_HANDLE NdisAdapterHandle,
2744 IN ULONG Length,
2745 IN PVOID VirtualAddress,
2746 IN NDIS_PHYSICAL_ADDRESS PhysicalAddress);
2747
2748 #endif /* defined(NDIS50) */
2749
2750 /*
2751 * ULONG
2752 * NdisGetPhysicalAddressHigh(
2753 * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress);
2754 */
2755 #define NdisGetPhysicalAddressHigh(PhysicalAddress) \
2756 ((PhysicalAddress).HighPart)
2757
2758 /*
2759 * VOID
2760 * NdisSetPhysicalAddressHigh(
2761 * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress,
2762 * IN ULONG Value);
2763 */
2764 #define NdisSetPhysicalAddressHigh(PhysicalAddress, Value) \
2765 ((PhysicalAddress).HighPart) = (Value)
2766
2767 /*
2768 * ULONG
2769 * NdisGetPhysicalAddressLow(
2770 * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress);
2771 */
2772 #define NdisGetPhysicalAddressLow(PhysicalAddress) \
2773 ((PhysicalAddress).LowPart)
2774
2775
2776 /*
2777 * VOID
2778 * NdisSetPhysicalAddressLow(
2779 * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress,
2780 * IN ULONG Value);
2781 */
2782 #define NdisSetPhysicalAddressLow(PhysicalAddress, Value) \
2783 ((PhysicalAddress).LowPart) = (Value)
2784
2785 /*
2786 * VOID
2787 * NDIS_PHYSICAL_ADDRESS_CONST(
2788 * IN ULONG Low,
2789 * IN LONG High);
2790 */
2791 #define NDIS_PHYSICAL_ADDRESS_CONST(Low, High) \
2792 { {(ULONG)(Low), (LONG)(High)} }
2793
2794 /*
2795 * ULONG
2796 * NdisEqualMemory(
2797 * IN CONST VOID *Source1,
2798 * IN CONST VOID *Source2,
2799 * IN ULONG Length);
2800 */
2801 #define NdisEqualMemory(Source1, Source2, Length) \
2802 RtlEqualMemory(Source1, Source2, Length)
2803
2804 /*
2805 * VOID
2806 * NdisFillMemory(
2807 * IN PVOID Destination,
2808 * IN ULONG Length,
2809 * IN UCHAR Fill);
2810 */
2811 #define NdisFillMemory(Destination, Length, Fill) \
2812 RtlFillMemory(Destination, Length, Fill)
2813
2814 /*
2815 * VOID
2816 * NdisMoveMemory(
2817 * OUT PVOID Destination,
2818 * IN PVOID Source,
2819 * IN ULONG Length);
2820 */
2821 #define NdisMoveMemory(Destination, Source, Length) \
2822 RtlCopyMemory(Destination, Source, Length)
2823
2824
2825 /*
2826 * VOID
2827 * NdisRetrieveUlong(
2828 * IN PULONG DestinationAddress,
2829 * IN PULONG SourceAddress);
2830 */
2831 #define NdisRetrieveUlong(DestinationAddress, SourceAddress) \
2832 RtlRetrieveUlong(DestinationAddress, SourceAddress)
2833
2834
2835 /*
2836 * VOID
2837 * NdisStoreUlong(
2838 * IN PULONG DestinationAddress,
2839 * IN ULONG Value);
2840 */
2841 #define NdisStoreUlong(DestinationAddress, Value) \
2842 RtlStoreUlong(DestinationAddress, Value)
2843
2844
2845 /*
2846 * VOID
2847 * NdisZeroMemory(
2848 * IN PVOID Destination,
2849 * IN ULONG Length)
2850 */
2851 #define NdisZeroMemory(Destination, Length) \
2852 RtlZeroMemory(Destination, Length)
2853
2854 typedef VOID
2855 (NTAPI *NDIS_BLOCK_INITIALIZER) (
2856 IN PUCHAR Block,
2857 IN SIZE_T NumberOfBytes
2858 );
2859
2860 /* Configuration routines */
2861
2862 NDISAPI
2863 VOID
2864 NTAPI
2865 NdisOpenConfiguration(
2866 OUT PNDIS_STATUS Status,
2867 OUT PNDIS_HANDLE ConfigurationHandle,
2868 IN NDIS_HANDLE WrapperConfigurationContext);
2869
2870 NDISAPI
2871 VOID
2872 NTAPI
2873 NdisReadNetworkAddress(
2874 OUT PNDIS_STATUS Status,
2875 OUT PVOID *NetworkAddress,
2876 OUT PUINT NetworkAddressLength,
2877 IN NDIS_HANDLE ConfigurationHandle);
2878
2879 NDISAPI
2880 VOID
2881 NTAPI
2882 NdisReadEisaSlotInformation(
2883 OUT PNDIS_STATUS Status,
2884 IN NDIS_HANDLE WrapperConfigurationContext,
2885 OUT PUINT SlotNumber,
2886 OUT PNDIS_EISA_FUNCTION_INFORMATION EisaData);
2887
2888 NDISAPI
2889 VOID
2890 NTAPI
2891 NdisReadEisaSlotInformationEx(
2892 OUT PNDIS_STATUS Status,
2893 IN NDIS_HANDLE WrapperConfigurationContext,
2894 OUT PUINT SlotNumber,
2895 OUT PNDIS_EISA_FUNCTION_INFORMATION *EisaData,
2896 OUT PUINT NumberOfFunctions);
2897
2898 NDISAPI
2899 ULONG
2900 NTAPI
2901 NdisReadPciSlotInformation(
2902 IN NDIS_HANDLE NdisAdapterHandle,
2903 IN ULONG SlotNumber,
2904 IN ULONG Offset,
2905 IN PVOID Buffer,
2906 IN ULONG Length);
2907
2908 NDISAPI
2909 ULONG
2910 NTAPI
2911 NdisWritePciSlotInformation(
2912 IN NDIS_HANDLE NdisAdapterHandle,
2913 IN ULONG SlotNumber,
2914 IN ULONG Offset,
2915 IN PVOID Buffer,
2916 IN ULONG Length);
2917
2918
2919
2920 /* String management routines */
2921
2922 NDISAPI
2923 NDIS_STATUS
2924 NTAPI
2925 NdisAnsiStringToUnicodeString(
2926 IN OUT PNDIS_STRING DestinationString,
2927 IN PNDIS_ANSI_STRING SourceString);
2928
2929 /*
2930 * BOOLEAN
2931 * NdisEqualString(
2932 * IN PNDIS_STRING String1,
2933 * IN PNDIS_STRING String2,
2934 * IN BOOLEAN CaseInsensitive);
2935 */
2936 #define NdisEqualString(_String1, _String2, _CaseInsensitive) \
2937 RtlEqualUnicodeString(_String1, _String2, _CaseInsensitive)
2938
2939 NDISAPI
2940 VOID
2941 NTAPI
2942 NdisInitAnsiString(
2943 IN OUT PNDIS_ANSI_STRING DestinationString,
2944 IN PCSTR SourceString);
2945
2946 NDISAPI
2947 VOID
2948 NTAPI
2949 NdisInitUnicodeString(
2950 IN OUT PNDIS_STRING DestinationString,
2951 IN PCWSTR SourceString);
2952
2953 NDISAPI
2954 NDIS_STATUS
2955 NTAPI
2956 NdisUnicodeStringToAnsiString(
2957 IN OUT PNDIS_ANSI_STRING DestinationString,
2958 IN PNDIS_STRING SourceString);
2959
2960 #define NdisFreeString(_s) NdisFreeMemory((_s).Buffer, (_s).MaximumLength, 0)
2961 #define NdisPrintString(_s) DbgPrint("%ls", (_s).Buffer)
2962
2963
2964 /* Spin lock reoutines */
2965
2966 /*
2967 NDISAPI
2968 VOID
2969 NTAPI
2970 NdisAllocateSpinLock(
2971 IN PNDIS_SPIN_LOCK SpinLock);
2972 */
2973 #define NdisAllocateSpinLock(_SpinLock) KeInitializeSpinLock(&(_SpinLock)->SpinLock)
2974
2975 /*
2976 NDISAPI
2977 VOID
2978 NTAPI
2979 NdisFreeSpinLock(
2980 IN PNDIS_SPIN_LOCK SpinLock);
2981 */
2982 #define NdisFreeSpinLock(_SpinLock)
2983
2984 /*
2985 NDISAPI
2986 VOID
2987 NTAPI
2988 NdisAcquireSpinLock(
2989 IN PNDIS_SPIN_LOCK SpinLock);
2990 */
2991 #define NdisAcquireSpinLock(_SpinLock) KeAcquireSpinLock(&(_SpinLock)->SpinLock, &(_SpinLock)->OldIrql)
2992
2993 /*
2994 NDISAPI
2995 VOID
2996 NTAPI
2997 NdisReleaseSpinLock(
2998 IN PNDIS_SPIN_LOCK SpinLock);
2999 */
3000 #define NdisReleaseSpinLock(_SpinLock) KeReleaseSpinLock(&(_SpinLock)->SpinLock,(_SpinLock)->OldIrql)
3001
3002 /*
3003 NDISAPI
3004 VOID
3005 NTAPI
3006 NdisDprAcquireSpinLock(
3007 IN PNDIS_SPIN_LOCK SpinLock);
3008 */
3009 #define NdisDprAcquireSpinLock(_SpinLock) KeAcquireSpinLockAtDpcLevel(&(_SpinLock)->SpinLock)
3010
3011 /*
3012 NDISAPI
3013 VOID
3014 NTAPI
3015 NdisDprReleaseSpinLock(
3016 IN PNDIS_SPIN_LOCK SpinLock);
3017 */
3018 #define NdisDprReleaseSpinLock(_SpinLock) KeReleaseSpinLockFromDpcLevel(&(_SpinLock)->SpinLock)
3019
3020 /* I/O routines */
3021
3022 /*
3023 * VOID
3024 * NdisRawReadPortBufferUchar(
3025 * IN ULONG Port,
3026 * OUT PUCHAR Buffer,
3027 * IN ULONG Length);
3028 */
3029 #define NdisRawReadPortBufferUchar(Port, Buffer, Length) \
3030 READ_PORT_BUFFER_UCHAR((PUCHAR)(Port), (PUCHAR)(Buffer), (Length))
3031
3032 /*
3033 * VOID
3034 * NdisRawReadPortBufferUlong(
3035 * IN ULONG Port,
3036 * OUT PULONG Buffer,
3037 * IN ULONG Length);
3038 */
3039 #define NdisRawReadPortBufferUlong(Port, Buffer, Length) \
3040 READ_PORT_BUFFER_ULONG((PULONG)(Port), (PULONG)(Buffer), (Length))
3041
3042 /*
3043 * VOID
3044 * NdisRawReadPortBufferUshort(
3045 * IN ULONG Port,
3046 * OUT PUSHORT Buffer,
3047 * IN ULONG Length);
3048 */
3049 #define NdisRawReadPortBufferUshort(Port, Buffer, Length) \
3050 READ_PORT_BUFFER_USHORT((PUSHORT)(Port), (PUSHORT)(Buffer), (Length))
3051
3052
3053 /*
3054 * VOID
3055 * NdisRawReadPortUchar(
3056 * IN ULONG Port,
3057 * OUT PUCHAR Data);
3058 */
3059 #define NdisRawReadPortUchar(Port, Data) \
3060 *(Data) = READ_PORT_UCHAR((PUCHAR)(Port))
3061
3062 /*
3063 * VOID
3064 * NdisRawReadPortUlong(
3065 * IN ULONG Port,
3066 * OUT PULONG Data);
3067 */
3068 #define NdisRawReadPortUlong(Port, Data) \
3069 *(Data) = READ_PORT_ULONG((PULONG)(Port))
3070
3071 /*
3072 * VOID
3073 * NdisRawReadPortUshort(
3074 * IN ULONG Port,
3075 * OUT PUSHORT Data);
3076 */
3077 #define NdisRawReadPortUshort(Port, Data) \
3078 *(Data) = READ_PORT_USHORT((PUSHORT)(Port))
3079
3080
3081 /*
3082 * VOID
3083 * NdisRawWritePortBufferUchar(
3084 * IN ULONG Port,
3085 * IN PUCHAR Buffer,
3086 * IN ULONG Length);
3087 */
3088 #define NdisRawWritePortBufferUchar(Port, Buffer, Length) \
3089 WRITE_PORT_BUFFER_UCHAR((PUCHAR)(Port), (PUCHAR)(Buffer), (Length))
3090
3091 /*
3092 * VOID
3093 * NdisRawWritePortBufferUlong(
3094 * IN ULONG Port,
3095 * IN PULONG Buffer,
3096 * IN ULONG Length);
3097 */
3098 #define NdisRawWritePortBufferUlong(Port, Buffer, Length) \
3099 WRITE_PORT_BUFFER_ULONG((PULONG)(Port), (PULONG)(Buffer), (Length))
3100
3101 /*
3102 * VOID
3103 * NdisRawWritePortBufferUshort(
3104 * IN ULONG Port,
3105 * IN PUSHORT Buffer,
3106 * IN ULONG Length);
3107 */
3108 #define NdisRawWritePortBufferUshort(Port, Buffer, Length) \
3109 WRITE_PORT_BUFFER_USHORT((PUSHORT)(Port), (PUSHORT)(Buffer), (Length))
3110
3111
3112 /*
3113 * VOID
3114 * NdisRawWritePortUchar(
3115 * IN ULONG Port,
3116 * IN UCHAR Data);
3117 */
3118 #define NdisRawWritePortUchar(Port, Data) \
3119 WRITE_PORT_UCHAR((PUCHAR)(Port), (UCHAR)(Data))
3120
3121 /*
3122 * VOID
3123 * NdisRawWritePortUlong(
3124 * IN ULONG Port,
3125 * IN ULONG Data);
3126 */
3127 #define NdisRawWritePortUlong(Port, Data) \
3128 WRITE_PORT_ULONG((PULONG)(Port), (ULONG)(Data))
3129
3130 /*
3131 * VOID
3132 * NdisRawWritePortUshort(
3133 * IN ULONG Port,
3134 * IN USHORT Data);
3135 */
3136 #define NdisRawWritePortUshort(Port, Data) \
3137 WRITE_PORT_USHORT((PUSHORT)(Port), (USHORT)(Data))
3138
3139
3140 /*
3141 * VOID
3142 * NdisReadRegisterUchar(
3143 * IN PUCHAR Register,
3144 * OUT PUCHAR Data);
3145 */
3146 #define NdisReadRegisterUchar(Register, Data) \
3147 *(Data) = *(Register)
3148
3149 /*
3150 * VOID
3151 * NdisReadRegisterUlong(
3152 * IN PULONG Register,
3153 * OUT PULONG Data);
3154 */
3155 #define NdisReadRegisterUlong(Register, Data) \
3156 *(Data) = *(Register)
3157
3158 /*
3159 * VOID
3160 * NdisReadRegisterUshort(
3161 * IN PUSHORT Register,
3162 * OUT PUSHORT Data);
3163 */
3164 #define NdisReadRegisterUshort(Register, Data) \
3165 *(Data) = *(Register)
3166
3167 /*
3168 * VOID
3169 * NdisReadRegisterUchar(
3170 * IN PUCHAR Register,
3171 * IN UCHAR Data);
3172 */
3173 #define NdisWriteRegisterUchar(Register, Data) \
3174 WRITE_REGISTER_UCHAR((Register), (Data))
3175
3176 /*
3177 * VOID
3178 * NdisReadRegisterUlong(
3179 * IN PULONG Register,
3180 * IN ULONG Data);
3181 */
3182 #define NdisWriteRegisterUlong(Register, Data) \
3183 WRITE_REGISTER_ULONG((Register), (Data))
3184
3185 /*
3186 * VOID
3187 * NdisReadRegisterUshort(
3188 * IN PUSHORT Register,
3189 * IN USHORT Data);
3190 */
3191 #define NdisWriteRegisterUshort(Register, Data) \
3192 WRITE_REGISTER_USHORT((Register), (Data))
3193
3194
3195 /* Linked lists */
3196
3197 /*
3198 * VOID
3199 * NdisInitializeListHead(
3200 * IN PLIST_ENTRY ListHead);
3201 */
3202 #define NdisInitializeListHead(_ListHead) \
3203 InitializeListHead(_ListHead)
3204
3205 /*
3206 * PLIST_ENTRY
3207 * NdisInterlockedInsertHeadList(
3208 * IN PLIST_ENTRY ListHead,
3209 * IN PLIST_ENTRY ListEntry,
3210 * IN PNDIS_SPIN_LOCK SpinLock);
3211 */
3212 #define NdisInterlockedInsertHeadList(_ListHead, _ListEntry, _SpinLock) \
3213 ExInterlockedInsertHeadList(_ListHead, _ListEntry, &(_SpinLock)->SpinLock)
3214
3215 /*
3216 * PLIST_ENTRY
3217 * NdisInterlockedInsertTailList(
3218 * IN PLIST_ENTRY ListHead,
3219 * IN PLIST_ENTRY ListEntry,
3220 * IN PNDIS_SPIN_LOCK SpinLock);
3221 */
3222 #define NdisInterlockedInsertTailList(_ListHead, _ListEntry, _SpinLock) \
3223 ExInterlockedInsertTailList(_ListHead, _ListEntry, &(_SpinLock)->SpinLock)
3224
3225 /*
3226 * PLIST_ENTRY
3227 * NdisInterlockedRemoveHeadList(
3228 * IN PLIST_ENTRY ListHead,
3229 * IN PNDIS_SPIN_LOCK SpinLock);
3230 */
3231 #define NdisInterlockedRemoveHeadList(_ListHead, _SpinLock) \
3232 ExInterlockedRemoveHeadList(_ListHead, &(_SpinLock)->SpinLock)
3233
3234 /*
3235 * VOID
3236 * NdisInitializeSListHead(
3237 * IN PSLIST_HEADER SListHead);
3238 */
3239 #define NdisInitializeSListHead(SListHead) ExInitializeSListHead(SListHead)
3240
3241 /*
3242 * USHORT NdisQueryDepthSList(
3243 * IN PSLIST_HEADER SListHead);
3244 */
3245 #define NdisQueryDepthSList(SListHead) ExQueryDepthSList(SListHead)
3246
3247 #define NdisInterlockedPushEntryList(ListHead, ListEntry, Lock) \
3248 ExInterlockedPushEntryList(ListHead, ListEntry, &(Lock)->SpinLock)
3249
3250 #define NdisInterlockedPopEntryList(ListHead, Lock) \
3251 ExInterlockedPopEntryList(ListHead, &(Lock)->SpinLock)
3252
3253 /* Interlocked routines */
3254
3255 /*
3256 * LONG
3257 * NdisInterlockedDecrement(
3258 * IN PLONG Addend);
3259 */
3260 #define NdisInterlockedDecrement(Addend) InterlockedDecrement(Addend)
3261
3262 /*
3263 * LONG
3264 * NdisInterlockedIncrement(
3265 * IN PLONG Addend);
3266 */
3267 #define NdisInterlockedIncrement(Addend) InterlockedIncrement(Addend)
3268
3269 /*
3270 * VOID
3271 * NdisInterlockedAddUlong(
3272 * IN PULONG Addend,
3273 * IN ULONG Increment,
3274 * IN PNDIS_SPIN_LOCK SpinLock);
3275 */
3276 #define NdisInterlockedAddUlong(_Addend, _Increment, _SpinLock) \
3277 ExInterlockedAddUlong(_Addend, _Increment, &(_SpinLock)->SpinLock)
3278
3279
3280
3281 /* Miscellaneous routines */
3282
3283 NDISAPI
3284 VOID
3285 NTAPI
3286 NdisCloseConfiguration(
3287 IN NDIS_HANDLE ConfigurationHandle);
3288
3289 NDISAPI
3290 VOID
3291 NTAPI
3292 NdisReadConfiguration(
3293 OUT PNDIS_STATUS Status,
3294 OUT PNDIS_CONFIGURATION_PARAMETER *ParameterValue,
3295 IN NDIS_HANDLE ConfigurationHandle,
3296 IN PNDIS_STRING Keyword,
3297 IN NDIS_PARAMETER_TYPE ParameterType);
3298
3299 NDISAPI
3300 VOID
3301 NTAPI
3302 NdisWriteConfiguration(
3303 OUT PNDIS_STATUS Status,
3304 IN NDIS_HANDLE WrapperConfigurationContext,
3305 IN PNDIS_STRING Keyword,
3306 IN PNDIS_CONFIGURATION_PARAMETER ParameterValue);
3307
3308 NDISAPI
3309 VOID
3310 __cdecl
3311 NdisWriteErrorLogEntry(
3312 IN NDIS_HANDLE NdisAdapterHandle,
3313 IN NDIS_ERROR_CODE ErrorCode,
3314 IN ULONG NumberOfErrorValues,
3315 IN ...);
3316
3317 /*
3318 * VOID
3319 * NdisStallExecution(
3320 * IN UINT MicrosecondsToStall)
3321 */
3322 #define NdisStallExecution KeStallExecutionProcessor
3323
3324 /*
3325 NDISAPI
3326 VOID
3327 NTAPI
3328 NdisGetCurrentSystemTime(
3329 IN PLARGE_INTEGER pSystemTime);
3330 */
3331 #define NdisGetCurrentSystemTime KeQuerySystemTime
3332
3333 NDISAPI
3334 CCHAR
3335 NTAPI
3336 NdisSystemProcessorCount(VOID);
3337
3338 NDISAPI
3339 VOID
3340 NTAPI
3341 NdisGetCurrentProcessorCpuUsage(
3342 OUT PULONG pCpuUsage);
3343
3344
3345
3346 /* NDIS helper macros */
3347
3348 /*
3349 * VOID
3350 * NDIS_INIT_FUNCTION(FunctionName)
3351 */
3352 #define NDIS_INIT_FUNCTION(FunctionName) \
3353 alloc_text(init, FunctionName)
3354
3355 /*
3356 * VOID
3357 * NDIS_PAGABLE_FUNCTION(FunctionName)
3358 */
3359 #define NDIS_PAGEABLE_FUNCTION(FunctionName) \
3360 alloc_text(page, FunctionName)
3361
3362 #define NDIS_PAGABLE_FUNCTION NDIS_PAGEABLE_FUNCTION
3363
3364
3365 /* NDIS 4.0 extensions */
3366
3367 NDISAPI
3368 VOID
3369 NTAPI
3370 NdisMFreeSharedMemory(
3371 IN NDIS_HANDLE MiniportAdapterHandle,
3372 IN ULONG Length,
3373 IN BOOLEAN Cached,
3374 IN PVOID VirtualAddress,
3375 IN NDIS_PHYSICAL_ADDRESS PhysicalAddress);
3376
3377 NDISAPI
3378 VOID
3379 NTAPI
3380 NdisMWanIndicateReceive(
3381 OUT PNDIS_STATUS Status,
3382 IN NDIS_HANDLE MiniportAdapterHandle,
3383 IN NDIS_HANDLE NdisLinkContext,
3384 IN PUCHAR PacketBuffer,
3385 IN UINT PacketSize);
3386
3387 NDISAPI
3388 VOID
3389 NTAPI
3390 NdisMWanIndicateReceiveComplete(
3391 IN NDIS_HANDLE MiniportAdapterHandle);
3392
3393 NDISAPI
3394 VOID
3395 NTAPI
3396 NdisMWanSendComplete(
3397 IN NDIS_HANDLE MiniportAdapterHandle,
3398 IN PNDIS_WAN_PACKET Packet,
3399 IN NDIS_STATUS Status);
3400
3401 NDISAPI
3402 NDIS_STATUS
3403 NTAPI
3404 NdisPciAssignResources(
3405 IN NDIS_HANDLE NdisMacHandle,
3406 IN NDIS_HANDLE NdisWrapperHandle,
3407 IN NDIS_HANDLE WrapperConfigurationContext,
3408 IN ULONG SlotNumber,
3409 OUT PNDIS_RESOURCE_LIST *AssignedResources);
3410
3411
3412 /* NDIS 5.0 extensions */
3413
3414 NDISAPI
3415 VOID
3416 NTAPI
3417 NdisAcquireReadWriteLock(
3418 IN PNDIS_RW_LOCK Lock,
3419 IN BOOLEAN fWrite,
3420 IN PLOCK_STATE LockState);
3421
3422 NDISAPI
3423 NDIS_STATUS
3424 NTAPI
3425 NdisAllocateMemoryWithTag(
3426 OUT PVOID *VirtualAddress,
3427 IN UINT Length,
3428 IN ULONG Tag);
3429
3430 NDISAPI
3431 VOID
3432 NTAPI
3433 NdisAllocatePacketPoolEx(
3434 OUT PNDIS_STATUS Status,
3435 OUT PNDIS_HANDLE PoolHandle,
3436 IN UINT NumberOfDescriptors,
3437 IN UINT NumberOfOverflowDescriptors,
3438 IN UINT ProtocolReservedLength);
3439
3440 NDISAPI
3441 VOID
3442 NTAPI
3443 NdisSetPacketPoolProtocolId(
3444 IN NDIS_HANDLE PacketPoolHandle,
3445 IN UINT ProtocolId);
3446
3447 NDISAPI
3448 VOID
3449 NTAPI
3450 NdisCompletePnPEvent(
3451 IN NDIS_STATUS Status,
3452 IN NDIS_HANDLE NdisBindingHandle,
3453 IN PNET_PNP_EVENT NetPnPEvent);
3454
3455 NDISAPI
3456 VOID
3457 NTAPI
3458 NdisGetCurrentProcessorCounts(
3459 OUT PULONG pIdleCount,
3460 OUT PULONG pKernelAndUser,
3461 OUT PULONG pIndex);
3462
3463 NDISAPI
3464 VOID
3465 NTAPI
3466 NdisGetDriverHandle(
3467 IN PNDIS_HANDLE NdisBindingHandle,
3468 OUT PNDIS_HANDLE NdisDriverHandle);
3469
3470 NDISAPI
3471 PNDIS_PACKET
3472 NTAPI
3473 NdisGetReceivedPacket(
3474 IN PNDIS_HANDLE NdisBindingHandle,
3475 IN PNDIS_HANDLE MacContext);
3476
3477 NDISAPI
3478 VOID
3479 NTAPI
3480 NdisGetSystemUpTime(
3481 OUT PULONG pSystemUpTime);
3482
3483 NDISAPI
3484 VOID
3485 NTAPI
3486 NdisInitializeReadWriteLock(
3487 IN PNDIS_RW_LOCK Lock);
3488
3489 NDISAPI
3490 NDIS_STATUS
3491 NTAPI
3492 NdisMDeregisterDevice(
3493 IN NDIS_HANDLE NdisDeviceHandle);
3494
3495 NDISAPI
3496 VOID
3497 NTAPI
3498 NdisMGetDeviceProperty(
3499 IN NDIS_HANDLE MiniportAdapterHandle,
3500 IN OUT PDEVICE_OBJECT *PhysicalDeviceObject OPTIONAL,
3501 IN OUT PDEVICE_OBJECT *FunctionalDeviceObject OPTIONAL,
3502 IN OUT PDEVICE_OBJECT *NextDeviceObject OPTIONAL,
3503 IN OUT PCM_RESOURCE_LIST *AllocatedResources OPTIONAL,
3504 IN OUT PCM_RESOURCE_LIST *AllocatedResourcesTranslated OPTIONAL);
3505
3506 NDISAPI
3507 NDIS_STATUS
3508 NTAPI
3509 NdisMInitializeScatterGatherDma(
3510 IN NDIS_HANDLE MiniportAdapterHandle,
3511 IN BOOLEAN Dma64BitAddresses,
3512 IN ULONG MaximumPhysicalMapping);
3513
3514 NDISAPI
3515 NDIS_STATUS
3516 NTAPI
3517 NdisMPromoteMiniport(
3518 IN NDIS_HANDLE MiniportAdapterHandle);
3519
3520 NDISAPI
3521 NDIS_STATUS
3522 NTAPI
3523 NdisMQueryAdapterInstanceName(
3524 OUT PNDIS_STRING AdapterInstanceName,
3525 IN NDIS_HANDLE MiniportAdapterHandle);
3526
3527 NDISAPI
3528 NDIS_STATUS
3529 NTAPI
3530 NdisMRegisterDevice(
3531 IN NDIS_HANDLE NdisWrapperHandle,
3532 IN PNDIS_STRING DeviceName,
3533 IN PNDIS_STRING SymbolicName,
3534 IN PDRIVER_DISPATCH MajorFunctions[],
3535 OUT PDEVICE_OBJECT *pDeviceObject,
3536 OUT NDIS_HANDLE *NdisDeviceHandle);
3537
3538 NDISAPI
3539 VOID
3540 NTAPI
3541 NdisMRegisterUnloadHandler(
3542 IN NDIS_HANDLE NdisWrapperHandle,
3543 IN PDRIVER_UNLOAD UnloadHandler);
3544
3545 NDISAPI
3546 NDIS_STATUS
3547 NTAPI
3548 NdisMRemoveMiniport(
3549 IN NDIS_HANDLE MiniportAdapterHandle);
3550
3551 NDISAPI
3552 NDIS_STATUS
3553 NTAPI
3554 NdisMSetMiniportSecondary(
3555 IN NDIS_HANDLE MiniportAdapterHandle,
3556 IN NDIS_HANDLE PrimaryMiniportAdapterHandle);
3557
3558 NDISAPI
3559 VOID
3560 NTAPI
3561 NdisOpenConfigurationKeyByIndex(
3562 OUT PNDIS_STATUS Status,
3563 IN NDIS_HANDLE ConfigurationHandle,
3564 IN ULONG Index,
3565 OUT PNDIS_STRING KeyName,
3566 OUT PNDIS_HANDLE KeyHandle);
3567
3568 NDISAPI
3569 VOID
3570 NTAPI
3571 NdisOpenConfigurationKeyByName(
3572 OUT PNDIS_STATUS Status,
3573 IN NDIS_HANDLE ConfigurationHandle,
3574 IN PNDIS_STRING SubKeyName,
3575 OUT PNDIS_HANDLE SubKeyHandle);
3576
3577 NDISAPI
3578 UINT
3579 NTAPI
3580 NdisPacketPoolUsage(
3581 IN NDIS_HANDLE PoolHandle);
3582
3583 NDISAPI
3584 NDIS_STATUS
3585 NTAPI
3586 NdisQueryAdapterInstanceName(
3587 OUT PNDIS_STRING AdapterInstanceName,
3588 IN NDIS_HANDLE NdisBindingHandle);
3589
3590 NDISAPI
3591 ULONG
3592 NTAPI
3593 NdisReadPcmciaAttributeMemory(
3594 IN NDIS_HANDLE NdisAdapterHandle,
3595 IN ULONG Offset,
3596 IN PVOID Buffer,
3597 IN ULONG Length);
3598
3599 NDISAPI
3600 VOID
3601 NTAPI
3602 NdisReleaseReadWriteLock(
3603 IN PNDIS_RW_LOCK Lock,
3604 IN PLOCK_STATE LockState);
3605
3606 NDISAPI
3607 NDIS_STATUS
3608 NTAPI
3609 NdisWriteEventLogEntry(
3610 IN PVOID LogHandle,
3611 IN NDIS_STATUS EventCode,
3612 IN ULONG UniqueEventValue,
3613 IN USHORT NumStrings,
3614 IN PVOID StringsList OPTIONAL,
3615 IN ULONG DataSize,
3616 IN PVOID Data OPTIONAL);
3617
3618 NDISAPI
3619 ULONG
3620 NTAPI
3621 NdisWritePcmciaAttributeMemory(
3622 IN NDIS_HANDLE NdisAdapterHandle,
3623 IN ULONG Offset,
3624 IN PVOID Buffer,
3625 IN ULONG Length);
3626
3627
3628 /* Connectionless services */
3629
3630 NDISAPI
3631 NDIS_STATUS
3632 NTAPI
3633 NdisClAddParty(
3634 IN NDIS_HANDLE NdisVcHandle,
3635 IN NDIS_HANDLE ProtocolPartyContext,
3636 IN OUT PCO_CALL_PARAMETERS CallParameters,
3637 OUT PNDIS_HANDLE NdisPartyHandle);
3638
3639 NDISAPI
3640 NDIS_STATUS
3641 NTAPI
3642 NdisClCloseAddressFamily(
3643 IN NDIS_HANDLE NdisAfHandle);
3644
3645 NDISAPI
3646 NDIS_STATUS
3647 NTAPI
3648 NdisClCloseCall(
3649 IN NDIS_HANDLE NdisVcHandle,
3650 IN NDIS_HANDLE NdisPartyHandle OPTIONAL,
3651 IN PVOID Buffer OPTIONAL,
3652 IN UINT Size);
3653
3654 NDISAPI
3655 NDIS_STATUS
3656 NTAPI
3657 NdisClDeregisterSap(
3658 IN NDIS_HANDLE NdisSapHandle);
3659
3660 NDISAPI
3661 NDIS_STATUS
3662 NTAPI
3663 NdisClDropParty(
3664 IN NDIS_HANDLE NdisPartyHandle,
3665 IN PVOID Buffer OPTIONAL,
3666 IN UINT Size);
3667
3668 NDISAPI
3669 VOID
3670 NTAPI
3671 NdisClIncomingCallComplete(
3672 IN NDIS_STATUS Status,
3673 IN NDIS_HANDLE NdisVcHandle,
3674 IN PCO_CALL_PARAMETERS CallParameters);
3675
3676 NDISAPI
3677 NDIS_STATUS
3678 NTAPI
3679 NdisClMakeCall(
3680 IN NDIS_HANDLE NdisVcHandle,
3681 IN OUT PCO_CALL_PARAMETERS CallParameters,
3682 IN NDIS_HANDLE ProtocolPartyContext OPTIONAL,
3683 OUT PNDIS_HANDLE NdisPartyHandle OPTIONAL);
3684
3685 NDISAPI
3686 NDIS_STATUS
3687 NTAPI
3688 NdisClModifyCallQoS(
3689 IN NDIS_HANDLE NdisVcHandle,
3690 IN PCO_CALL_PARAMETERS CallParameters);
3691
3692
3693 NDISAPI
3694 NDIS_STATUS
3695 NTAPI
3696 NdisClOpenAddressFamily(
3697 IN NDIS_HANDLE NdisBindingHandle,
3698 IN PCO_ADDRESS_FAMILY AddressFamily,
3699 IN NDIS_HANDLE ProtocolAfContext,
3700 IN PNDIS_CLIENT_CHARACTERISTICS ClCharacteristics,
3701 IN UINT SizeOfClCharacteristics,
3702 OUT PNDIS_HANDLE NdisAfHandle);
3703
3704 NDISAPI
3705 NDIS_STATUS
3706 NTAPI
3707 NdisClRegisterSap(
3708 IN NDIS_HANDLE NdisAfHandle,
3709 IN NDIS_HANDLE ProtocolSapContext,
3710 IN PCO_SAP Sap,
3711 OUT PNDIS_HANDLE NdisSapHandle);
3712
3713
3714 /* Call Manager services */
3715
3716 NDISAPI
3717 NDIS_STATUS
3718 NTAPI
3719 NdisCmActivateVc(
3720 IN NDIS_HANDLE NdisVcHandle,
3721 IN OUT PCO_CALL_PARAMETERS CallParameters);
3722
3723 NDISAPI
3724 VOID
3725 NTAPI
3726 NdisCmAddPartyComplete(
3727 IN NDIS_STATUS Status,
3728 IN NDIS_HANDLE NdisPartyHandle,
3729 IN NDIS_HANDLE CallMgrPartyContext OPTIONAL,
3730 IN PCO_CALL_PARAMETERS CallParameters);
3731
3732 NDISAPI
3733 VOID
3734 NTAPI
3735 NdisCmCloseAddressFamilyComplete(
3736 IN NDIS_STATUS Status,
3737 IN NDIS_HANDLE NdisAfHandle);
3738
3739 NDISAPI
3740 VOID
3741 NTAPI
3742 NdisCmCloseCallComplete(
3743 IN NDIS_STATUS Status,
3744 IN NDIS_HANDLE NdisVcHandle,
3745 IN NDIS_HANDLE NdisPartyHandle OPTIONAL);
3746
3747 NDISAPI
3748 NDIS_STATUS
3749 NTAPI
3750 NdisCmDeactivateVc(
3751 IN NDIS_HANDLE NdisVcHandle);
3752
3753 NDISAPI
3754 VOID
3755 NTAPI
3756 NdisCmDeregisterSapComplete(
3757 IN NDIS_STATUS Status,
3758 IN NDIS_HANDLE NdisSapHandle);
3759
3760 NDISAPI
3761 VOID
3762 NTAPI
3763 NdisCmDispatchCallConnected(
3764 IN NDIS_HANDLE NdisVcHandle);
3765
3766 NDISAPI
3767 NDIS_STATUS
3768 NTAPI
3769 NdisCmDispatchIncomingCall(
3770 IN NDIS_HANDLE NdisSapHandle,
3771 IN NDIS_HANDLE NdisVcHandle,
3772 IN PCO_CALL_PARAMETERS CallParameters);
3773
3774 NDISAPI
3775 VOID
3776 NTAPI
3777 NdisCmDispatchIncomingCallQoSChange(
3778 IN NDIS_HANDLE NdisVcHandle,
3779 IN PCO_CALL_PARAMETERS CallParameters);
3780
3781 NDISAPI
3782 VOID
3783 NTAPI
3784 NdisCmDispatchIncomingCloseCall(
3785 IN NDIS_STATUS CloseStatus,
3786 IN NDIS_HANDLE NdisVcHandle,
3787 IN PVOID Buffer OPTIONAL,
3788 IN UINT Size);
3789
3790 NDISAPI
3791 VOID
3792 NTAPI
3793 NdisCmDispatchIncomingDropParty(
3794 IN NDIS_STATUS DropStatus,
3795 IN NDIS_HANDLE NdisPartyHandle,
3796 IN PVOID Buffer OPTIONAL,
3797 IN UINT Size);
3798
3799 NDISAPI
3800 VOID
3801 NTAPI
3802 NdisCmDropPartyComplete(
3803 IN NDIS_STATUS Status,
3804 IN NDIS_HANDLE NdisPartyHandle);
3805
3806 NDISAPI
3807 VOID
3808 NTAPI
3809 NdisCmMakeCallComplete(
3810 IN NDIS_STATUS Status,
3811 IN NDIS_HANDLE NdisVcHandle,
3812 IN NDIS_HANDLE NdisPartyHandle OPTIONAL,
3813 IN NDIS_HANDLE CallMgrPartyContext OPTIONAL,
3814 IN PCO_CALL_PARAMETERS CallParameters);
3815
3816 NDISAPI
3817 VOID
3818 NTAPI
3819 NdisCmModifyCallQoSComplete(
3820 IN NDIS_STATUS Status,
3821 IN NDIS_HANDLE NdisVcHandle,
3822 IN PCO_CALL_PARAMETERS CallParameters);
3823
3824 NDISAPI
3825 VOID
3826 NTAPI
3827 NdisCmOpenAddressFamilyComplete(
3828 IN NDIS_STATUS Status,
3829 IN NDIS_HANDLE NdisAfHandle,
3830 IN NDIS_HANDLE CallMgrAfContext);
3831
3832 NDISAPI
3833 NDIS_STATUS
3834 NTAPI
3835 NdisCmRegisterAddressFamily(
3836 IN NDIS_HANDLE NdisBindingHandle,
3837 IN PCO_ADDRESS_FAMILY AddressFamily,
3838 IN PNDIS_CALL_MANAGER_CHARACTERISTICS CmCharacteristics,
3839 IN UINT SizeOfCmCharacteristics);
3840
3841 NDISAPI
3842 VOID
3843 NTAPI
3844 NdisCmRegisterSapComplete(
3845 IN NDIS_STATUS Status,
3846 IN NDIS_HANDLE NdisSapHandle,
3847 IN NDIS_HANDLE CallMgrSapContext);
3848
3849
3850 NDISAPI
3851 NDIS_STATUS
3852 NTAPI
3853 NdisMCmActivateVc(
3854 IN NDIS_HANDLE NdisVcHandle,
3855 IN PCO_CALL_PARAMETERS CallParameters);
3856
3857 NDISAPI
3858 NDIS_STATUS
3859 NTAPI
3860 NdisMCmCreateVc(
3861 IN NDIS_HANDLE MiniportAdapterHandle,
3862 IN NDIS_HANDLE NdisAfHandle,
3863 IN NDIS_HANDLE MiniportVcContext,
3864 OUT PNDIS_HANDLE NdisVcHandle);
3865
3866 NDISAPI
3867 NDIS_STATUS
3868 NTAPI
3869 NdisMCmDeactivateVc(
3870 IN NDIS_HANDLE NdisVcHandle);
3871
3872 NDISAPI
3873 NDIS_STATUS
3874 NTAPI
3875 NdisMCmDeleteVc(
3876 IN NDIS_HANDLE NdisVcHandle);
3877
3878 NDISAPI
3879 NDIS_STATUS
3880 NTAPI
3881 NdisMCmRegisterAddressFamily(
3882 IN NDIS_HANDLE MiniportAdapterHandle,
3883 IN PCO_ADDRESS_FAMILY AddressFamily,
3884 IN PNDIS_CALL_MANAGER_CHARACTERISTICS CmCharacteristics,
3885 IN UINT SizeOfCmCharacteristics);
3886
3887 NDISAPI
3888 NDIS_STATUS
3889 NTAPI
3890 NdisMCmRequest(
3891 IN NDIS_HANDLE NdisAfHandle,
3892 IN NDIS_HANDLE NdisVcHandle OPTIONAL,
3893 IN NDIS_HANDLE NdisPartyHandle OPTIONAL,
3894 IN OUT PNDIS_REQUEST NdisRequest);
3895
3896
3897 /* Connection-oriented services */
3898
3899 NDISAPI
3900 NDIS_STATUS
3901 NTAPI
3902 NdisCoCreateVc(
3903 IN NDIS_HANDLE NdisBindingHandle,
3904 IN NDIS_HANDLE NdisAfHandle OPTIONAL,
3905 IN NDIS_HANDLE ProtocolVcContext,
3906 IN OUT PNDIS_HANDLE NdisVcHandle);
3907
3908 NDISAPI
3909 NDIS_STATUS
3910 NTAPI
3911 NdisCoDeleteVc(
3912 IN NDIS_HANDLE NdisVcHandle);
3913
3914 NDISAPI
3915 NDIS_STATUS
3916 NTAPI
3917 NdisCoRequest(
3918 IN NDIS_HANDLE NdisBindingHandle,
3919 IN NDIS_HANDLE NdisAfHandle OPTIONAL,
3920 IN NDIS_HANDLE NdisVcHandle OPTIONAL,
3921 IN NDIS_HANDLE NdisPartyHandle OPTIONAL,
3922 IN OUT PNDIS_REQUEST NdisRequest);
3923
3924 NDISAPI
3925 VOID
3926 NTAPI
3927 NdisCoRequestComplete(
3928 IN NDIS_STATUS Status,
3929 IN NDIS_HANDLE NdisAfHandle,
3930 IN NDIS_HANDLE NdisVcHandle OPTIONAL,
3931 IN NDIS_HANDLE NdisPartyHandle OPTIONAL,
3932 IN PNDIS_REQUEST NdisRequest);
3933
3934 NDISAPI
3935 VOID
3936 NTAPI
3937 NdisCoSendPackets(
3938 IN NDIS_HANDLE NdisVcHandle,
3939 IN PPNDIS_PACKET PacketArray,
3940 IN UINT NumberOfPackets);
3941
3942 NDISAPI
3943 VOID
3944 NTAPI
3945 NdisMCoActivateVcComplete(
3946 IN NDIS_STATUS Status,
3947 IN NDIS_HANDLE NdisVcHandle,
3948 IN PCO_CALL_PARAMETERS CallParameters);
3949
3950 NDISAPI
3951 VOID
3952 NTAPI
3953 NdisMCoDeactivateVcComplete(
3954 IN NDIS_STATUS Status,
3955 IN NDIS_HANDLE NdisVcHandle);
3956
3957 NDISAPI
3958 VOID
3959 NTAPI
3960 NdisMCoIndicateReceivePacket(
3961 IN NDIS_HANDLE NdisVcHandle,
3962 IN PPNDIS_PACKET PacketArray,
3963 IN UINT NumberOfPackets);
3964
3965 NDISAPI
3966 VOID
3967 NTAPI
3968 NdisMCoIndicateStatus(
3969 IN NDIS_HANDLE MiniportAdapterHandle,
3970 IN NDIS_HANDLE NdisVcHandle OPTIONAL,
3971 IN NDIS_STATUS GeneralStatus,
3972 IN PVOID StatusBuffer OPTIONAL,
3973 IN ULONG StatusBufferSize);
3974
3975 NDISAPI
3976 VOID
3977 NTAPI
3978 NdisMCoReceiveComplete(
3979 IN NDIS_HANDLE MiniportAdapterHandle);
3980
3981 NDISAPI
3982 VOID
3983 NTAPI
3984 NdisMCoRequestComplete(
3985 IN NDIS_STATUS Status,
3986 IN NDIS_HANDLE MiniportAdapterHandle,
3987 IN PNDIS_REQUEST Request);
3988
3989 NDISAPI
3990 VOID
3991 NTAPI
3992 NdisMCoSendComplete(
3993 IN NDIS_STATUS Status,
3994 IN NDIS_HANDLE NdisVcHandle,
3995 IN PNDIS_PACKET Packet);
3996
3997
3998 /* NDIS 5.0 extensions for intermediate drivers */
3999
4000 NDISAPI
4001 VOID
4002 NTAPI
4003 NdisIMAssociateMiniport(
4004 IN NDIS_HANDLE DriverHandle,
4005 IN NDIS_HANDLE ProtocolHandle);
4006
4007 NDISAPI
4008 NDIS_STATUS
4009 NTAPI
4010 NdisIMCancelInitializeDeviceInstance(
4011 IN NDIS_HANDLE DriverHandle,
4012 IN PNDIS_STRING DeviceInstance);
4013
4014 NDISAPI
4015 VOID
4016 NTAPI
4017 NdisIMCopySendCompletePerPacketInfo(
4018 IN PNDIS_PACKET DstPacket,
4019 IN PNDIS_PACKET SrcPacket);
4020
4021 NDISAPI
4022 VOID
4023 NTAPI
4024 NdisIMCopySendPerPacketInfo(
4025 IN PNDIS_PACKET DstPacket,
4026 IN PNDIS_PACKET SrcPacket);
4027
4028 NDISAPI
4029 VOID
4030 NTAPI
4031 NdisIMDeregisterLayeredMiniport(
4032 IN NDIS_HANDLE DriverHandle);
4033
4034 NDISAPI
4035 NDIS_HANDLE
4036 NTAPI
4037 NdisIMGetBindingContext(
4038 IN NDIS_HANDLE NdisBindingHandle);
4039
4040 NDISAPI
4041 NDIS_HANDLE
4042 NTAPI
4043 NdisIMGetDeviceContext(
4044 IN NDIS_HANDLE MiniportAdapterHandle);
4045
4046 NDISAPI
4047 NDIS_STATUS
4048 NTAPI
4049 NdisIMInitializeDeviceInstanceEx(
4050 IN NDIS_HANDLE DriverHandle,
4051 IN PNDIS_STRING DriverInstance,
4052 IN NDIS_HANDLE DeviceContext OPTIONAL);
4053
4054 NDISAPI
4055 PSINGLE_LIST_ENTRY
4056 NTAPI
4057 NdisInterlockedPopEntrySList(
4058 IN PSLIST_HEADER ListHead,
4059 IN PKSPIN_LOCK Lock);
4060
4061 NDISAPI
4062 PSINGLE_LIST_ENTRY
4063 NTAPI
4064 NdisInterlockedPushEntrySList(
4065 IN PSLIST_HEADER ListHead,
4066 IN PSINGLE_LIST_ENTRY ListEntry,
4067 IN PKSPIN_LOCK Lock);
4068
4069 NDISAPI
4070 VOID
4071 NTAPI
4072 NdisQueryBufferSafe(
4073 IN PNDIS_BUFFER Buffer,
4074 OUT PVOID *VirtualAddress OPTIONAL,
4075 OUT PUINT Length,
4076 IN UINT Priority);
4077
4078 /* Prototypes for NDIS_MINIPORT_CHARACTERISTICS */
4079
4080 typedef BOOLEAN
4081 (NTAPI *W_CHECK_FOR_HANG_HANDLER)(
4082 IN NDIS_HANDLE MiniportAdapterContext);
4083
4084 typedef VOID
4085 (NTAPI *W_DISABLE_INTERRUPT_HANDLER)(
4086 IN NDIS_HANDLE MiniportAdapterContext);
4087
4088 typedef VOID
4089 (NTAPI *W_ENABLE_INTERRUPT_HANDLER)(
4090 IN NDIS_HANDLE MiniportAdapterContext);
4091
4092 typedef VOID
4093 (NTAPI *W_HALT_HANDLER)(
4094 IN NDIS_HANDLE MiniportAdapterContext);
4095
4096 typedef VOID
4097 (NTAPI *W_HANDLE_INTERRUPT_HANDLER)(
4098 IN NDIS_HANDLE MiniportAdapterContext);
4099
4100 typedef NDIS_STATUS
4101 (NTAPI *W_INITIALIZE_HANDLER)(
4102 OUT PNDIS_STATUS OpenErrorStatus,
4103 OUT PUINT SelectedMediumIndex,
4104 IN PNDIS_MEDIUM MediumArray,
4105 IN UINT MediumArraySize,
4106 IN NDIS_HANDLE MiniportAdapterContext,
4107 IN NDIS_HANDLE WrapperConfigurationContext);
4108
4109 typedef VOID
4110 (NTAPI *W_ISR_HANDLER)(
4111 OUT PBOOLEAN InterruptRecognized,
4112 OUT PBOOLEAN QueueMiniportHandleInterrupt,
4113 IN NDIS_HANDLE MiniportAdapterContext);
4114
4115 typedef NDIS_STATUS
4116 (NTAPI *W_QUERY_INFORMATION_HANDLER)(
4117 IN NDIS_HANDLE MiniportAdapterContext,
4118 IN NDIS_OID Oid,
4119 IN PVOID InformationBuffer,
4120 IN ULONG InformationBufferLength,
4121 OUT PULONG BytesWritten,
4122 OUT PULONG BytesNeeded);
4123
4124 typedef NDIS_STATUS
4125 (NTAPI *W_RECONFIGURE_HANDLER)(
4126 OUT PNDIS_STATUS OpenErrorStatus,
4127 IN NDIS_HANDLE MiniportAdapterContext,
4128 IN NDIS_HANDLE WrapperConfigurationContext);
4129
4130 typedef NDIS_STATUS
4131 (NTAPI *W_RESET_HANDLER)(
4132 OUT PBOOLEAN AddressingReset,
4133 IN NDIS_HANDLE MiniportAdapterContext);
4134
4135 typedef NDIS_STATUS
4136 (NTAPI *W_SEND_HANDLER)(
4137 IN NDIS_HANDLE MiniportAdapterContext,
4138 IN PNDIS_PACKET Packet,
4139 IN UINT Flags);
4140
4141 typedef NDIS_STATUS
4142 (NTAPI *WM_SEND_HANDLER)(
4143 IN NDIS_HANDLE MiniportAdapterContext,
4144 IN NDIS_HANDLE NdisLinkHandle,
4145 IN PNDIS_WAN_PACKET Packet);
4146
4147 typedef NDIS_STATUS
4148 (NTAPI *W_SET_INFORMATION_HANDLER)(
4149 IN NDIS_HANDLE MiniportAdapterContext,
4150 IN NDIS_OID Oid,
4151 IN PVOID InformationBuffer,
4152 IN ULONG InformationBufferLength,
4153 OUT PULONG BytesRead,
4154 OUT PULONG BytesNeeded);
4155
4156 typedef NDIS_STATUS
4157 (NTAPI *W_TRANSFER_DATA_HANDLER)(
4158 OUT PNDIS_PACKET Packet,
4159 OUT PUINT BytesTransferred,
4160 IN NDIS_HANDLE MiniportAdapterContext,
4161 IN NDIS_HANDLE MiniportReceiveContext,
4162 IN UINT ByteOffset,
4163 IN UINT BytesToTransfer);
4164
4165 typedef NDIS_STATUS
4166 (NTAPI *WM_TRANSFER_DATA_HANDLER)(
4167 VOID);
4168
4169
4170 /* NDIS structures available only to miniport drivers */
4171
4172 #define NDIS30_MINIPORT_CHARACTERISTICS_S \
4173 UCHAR MajorNdisVersion; \
4174 UCHAR MinorNdisVersion; \
4175 UINT Reserved; \
4176 W_CHECK_FOR_HANG_HANDLER CheckForHangHandler; \
4177 W_DISABLE_INTERRUPT_HANDLER DisableInterruptHandler; \
4178 W_ENABLE_INTERRUPT_HANDLER EnableInterruptHandler; \
4179 W_HALT_HANDLER HaltHandler; \
4180 W_HANDLE_INTERRUPT_HANDLER HandleInterruptHandler; \
4181 W_INITIALIZE_HANDLER InitializeHandler; \
4182 W_ISR_HANDLER ISRHandler; \
4183 W_QUERY_INFORMATION_HANDLER QueryInformationHandler; \
4184 W_RECONFIGURE_HANDLER ReconfigureHandler; \
4185 W_RESET_HANDLER ResetHandler; \
4186 W_SEND_HANDLER SendHandler; \
4187 W_SET_INFORMATION_HANDLER SetInformationHandler; \
4188 W_TRANSFER_DATA_HANDLER TransferDataHandler;
4189
4190 typedef struct _NDIS30_MINIPORT_CHARACTERISTICS {
4191 NDIS30_MINIPORT_CHARACTERISTICS_S
4192 } NDIS30_MINIPORT_CHARACTERISTICS, *PSNDIS30_MINIPORT_CHARACTERISTICS;
4193
4194
4195 /* Extensions for NDIS 4.0 miniports */
4196
4197 typedef VOID
4198 (NTAPI *W_SEND_PACKETS_HANDLER)(
4199 IN NDIS_HANDLE MiniportAdapterContext,
4200 IN PPNDIS_PACKET PacketArray,
4201 IN UINT NumberOfPackets);
4202
4203 typedef VOID
4204 (NTAPI *W_RETURN_PACKET_HANDLER)(
4205 IN NDIS_HANDLE MiniportAdapterContext,
4206 IN PNDIS_PACKET Packet);
4207
4208 typedef VOID
4209 (NTAPI *W_ALLOCATE_COMPLETE_HANDLER)(
4210 IN NDIS_HANDLE MiniportAdapterContext,
4211 IN PVOID VirtualAddress,
4212 IN PNDIS_PHYSICAL_ADDRESS PhysicalAddress,
4213 IN ULONG Length,
4214 IN PVOID Context);
4215
4216 #ifdef __cplusplus
4217
4218 #define NDIS40_MINIPORT_CHARACTERISTICS_S \
4219 NDIS30_MINIPORT_CHARACTERISTICS Ndis30Chars; \
4220 W_RETURN_PACKET_HANDLER ReturnPacketHandler; \
4221 W_SEND_PACKETS_HANDLER SendPacketsHandler; \
4222 W_ALLOCATE_COMPLETE_HANDLER AllocateCompleteHandler;
4223
4224 #else /* !__cplusplus */
4225
4226 #define NDIS40_MINIPORT_CHARACTERISTICS_S \
4227 NDIS30_MINIPORT_CHARACTERISTICS_S \
4228 W_RETURN_PACKET_HANDLER ReturnPacketHandler; \
4229 W_SEND_PACKETS_HANDLER SendPacketsHandler; \
4230 W_ALLOCATE_COMPLETE_HANDLER AllocateCompleteHandler;
4231
4232 #endif /* !__cplusplus */
4233
4234 typedef struct _NDIS40_MINIPORT_CHARACTERISTICS {
4235 NDIS40_MINIPORT_CHARACTERISTICS_S
4236 } NDIS40_MINIPORT_CHARACTERISTICS, *PNDIS40_MINIPORT_CHARACTERISTICS;
4237
4238
4239 /* Extensions for NDIS 5.0 miniports */
4240
4241 typedef NDIS_STATUS
4242 (NTAPI *W_CO_CREATE_VC_HANDLER)(
4243 IN NDIS_HANDLE MiniportAdapterContext,
4244 IN NDIS_HANDLE NdisVcHandle,
4245 OUT PNDIS_HANDLE MiniportVcContext);
4246
4247 typedef NDIS_STATUS
4248 (NTAPI *W_CO_DELETE_VC_HANDLER)(
4249 IN NDIS_HANDLE MiniportVcContext);
4250
4251 typedef NDIS_STATUS
4252 (NTAPI *W_CO_ACTIVATE_VC_HANDLER)(
4253 IN NDIS_HANDLE MiniportVcContext,
4254 IN OUT PCO_CALL_PARAMETERS CallParameters);
4255
4256 typedef NDIS_STATUS
4257 (NTAPI *W_CO_DEACTIVATE_VC_HANDLER)(
4258 IN NDIS_HANDLE MiniportVcContext);
4259
4260 typedef VOID
4261 (NTAPI *W_CO_SEND_PACKETS_HANDLER)(
4262 IN NDIS_HANDLE MiniportVcContext,
4263 IN PPNDIS_PACKET PacketArray,
4264 IN UINT NumberOfPackets);
4265
4266 typedef NDIS_STATUS
4267 (NTAPI *W_CO_REQUEST_HANDLER)(
4268 IN NDIS_HANDLE MiniportAdapterContext,
4269 IN NDIS_HANDLE MiniportVcContext OPTIONAL,
4270 IN OUT PNDIS_REQUEST NdisRequest);
4271
4272 #ifdef __cplusplus
4273
4274 #define NDIS50_MINIPORT_CHARACTERISTICS_S \
4275 NDIS40_MINIPORT_CHARACTERISTICS Ndis40Chars; \
4276 W_CO_CREATE_VC_HANDLER CoCreateVcHandler; \
4277 W_CO_DELETE_VC_HANDLER CoDeleteVcHandler; \
4278 W_CO_ACTIVATE_VC_HANDLER CoActivateVcHandler; \
4279 W_CO_DEACTIVATE_VC_HANDLER CoDeactivateVcHandler; \
4280 W_CO_SEND_PACKETS_HANDLER CoSendPacketsHandler; \
4281 W_CO_REQUEST_HANDLER CoRequestHandler;
4282
4283 #else /* !__cplusplus */
4284
4285 #define NDIS50_MINIPORT_CHARACTERISTICS_S \
4286 NDIS40_MINIPORT_CHARACTERISTICS_S \
4287 W_CO_CREATE_VC_HANDLER CoCreateVcHandler; \
4288 W_CO_DELETE_VC_HANDLER CoDeleteVcHandler; \
4289 W_CO_ACTIVATE_VC_HANDLER CoActivateVcHandler; \
4290 W_CO_DEACTIVATE_VC_HANDLER CoDeactivateVcHandler; \
4291 W_CO_SEND_PACKETS_HANDLER CoSendPacketsHandler; \
4292 W_CO_REQUEST_HANDLER CoRequestHandler;
4293
4294 #endif /* !__cplusplus */
4295
4296 typedef struct _NDIS50_MINIPORT_CHARACTERISTICS {
4297 NDIS50_MINIPORT_CHARACTERISTICS_S
4298 } NDIS50_MINIPORT_CHARACTERISTICS, *PSNDIS50_MINIPORT_CHARACTERISTICS;
4299
4300
4301 /* Extensions for NDIS 5.1 miniports */
4302
4303 typedef VOID
4304 (NTAPI *W_CANCEL_SEND_PACKETS_HANDLER)(
4305 IN NDIS_HANDLE MiniportAdapterContext,
4306 IN PVOID CancelId);
4307
4308 typedef VOID
4309 (NTAPI *W_PNP_EVENT_NOTIFY_HANDLER)(
4310 IN NDIS_HANDLE MiniportAdapterContext,
4311 IN NDIS_DEVICE_PNP_EVENT PnPEvent,
4312 IN PVOID InformationBuffer,
4313 IN ULONG InformationBufferLength);
4314
4315 typedef VOID
4316 (NTAPI *W_MINIPORT_SHUTDOWN_HANDLER)(
4317 IN PVOID ShutdownContext);
4318
4319 #ifdef __cplusplus
4320
4321 #define NDIS51_MINIPORT_CHARACTERISTICS_S \
4322 NDIS50_MINIPORT_CHARACTERISTICS Ndis50Chars; \
4323 W_CANCEL_SEND_PACKETS_HANDLER CancelSendPacketsHandler; \
4324 W_PNP_EVENT_NOTIFY_HANDLER PnPEventNotifyHandler; \
4325 W_MINIPORT_SHUTDOWN_HANDLER AdapterShutdownHandler;
4326
4327 #else
4328
4329 #define NDIS51_MINIPORT_CHARACTERISTICS_S \
4330 NDIS50_MINIPORT_CHARACTERISTICS_S \
4331 W_CANCEL_SEND_PACKETS_HANDLER CancelSendPacketsHandler; \
4332 W_PNP_EVENT_NOTIFY_HANDLER PnPEventNotifyHandler; \
4333 W_MINIPORT_SHUTDOWN_HANDLER AdapterShutdownHandler;
4334
4335 #endif
4336
4337 typedef struct _NDIS51_MINIPORT_CHARACTERISTICS {
4338 NDIS51_MINIPORT_CHARACTERISTICS_S
4339 } NDIS51_MINIPORT_CHARACTERISTICS, *PSNDIS51_MINIPORT_CHARACTERISTICS;
4340
4341 #if defined(NDIS51_MINIPORT)
4342 typedef struct _NDIS_MINIPORT_CHARACTERISTICS {
4343 NDIS51_MINIPORT_CHARACTERISTICS_S
4344 } NDIS_MINIPORT_CHARACTERISTICS, *PNDIS_MINIPORT_CHARACTERISTICS;
4345 #elif defined(NDIS50_MINIPORT)
4346 typedef struct _NDIS_MINIPORT_CHARACTERISTICS {
4347 NDIS50_MINIPORT_CHARACTERISTICS_S
4348 } NDIS_MINIPORT_CHARACTERISTICS, *PNDIS_MINIPORT_CHARACTERISTICS;
4349 #elif defined(NDIS40_MINIPORT)
4350 typedef struct _NDIS_MINIPORT_CHARACTERISTICS {
4351 NDIS40_MINIPORT_CHARACTERISTICS_S
4352 } NDIS_MINIPORT_CHARACTERISTICS, *PNDIS_MINIPORT_CHARACTERISTICS;
4353 #else /* NDIS30 */
4354 typedef struct _NDIS_MINIPORT_CHARACTERISTICS {
4355 NDIS30_MINIPORT_CHARACTERISTICS_S
4356 } NDIS_MINIPORT_CHARACTERISTICS, *PNDIS_MINIPORT_CHARACTERISTICS;
4357 #endif
4358
4359
4360 typedef NDIS_STATUS
4361 (NTAPI *SEND_HANDLER)(
4362 IN NDIS_HANDLE MacBindingHandle,
4363 IN PNDIS_PACKET Packet);
4364
4365 typedef NDIS_STATUS
4366 (NTAPI *TRANSFER_DATA_HANDLER)(
4367 IN NDIS_HANDLE MacBindingHandle,
4368 IN NDIS_HANDLE MacReceiveContext,
4369 IN UINT ByteOffset,
4370 IN UINT BytesToTransfer,
4371 OUT PNDIS_PACKET Packet,
4372 OUT PUINT BytesTransferred);
4373
4374 typedef NDIS_STATUS
4375 (NTAPI *RESET_HANDLER)(
4376 IN NDIS_HANDLE MacBindingHandle);
4377
4378 typedef NDIS_STATUS
4379 (NTAPI *REQUEST_HANDLER)(
4380 IN NDIS_HANDLE MacBindingHandle,
4381 IN PNDIS_REQUEST NdisRequest);
4382
4383
4384
4385 /* Structures available only to full MAC drivers */
4386
4387 typedef BOOLEAN
4388 (NTAPI *PNDIS_INTERRUPT_SERVICE)(
4389 IN PVOID InterruptContext);
4390
4391 typedef VOID
4392 (NTAPI *PNDIS_DEFERRED_PROCESSING)(
4393 IN PVOID SystemSpecific1,
4394 IN PVOID InterruptContext,
4395 IN PVOID SystemSpecific2,
4396 IN PVOID SystemSpecific3);
4397
4398
4399
4400 typedef struct _NDIS_MINIPORT_BLOCK NDIS_MINIPORT_BLOCK, *PNDIS_MINIPORT_BLOCK;
4401 typedef struct _NDIS_PROTOCOL_BLOCK NDIS_PROTOCOL_BLOCK, *PNDIS_PROTOCOL_BLOCK;
4402 typedef struct _NDIS_OPEN_BLOCK NDIS_OPEN_BLOCK, *PNDIS_OPEN_BLOCK;
4403 typedef struct _NDIS_M_DRIVER_BLOCK NDIS_M_DRIVER_BLOCK, *PNDIS_M_DRIVER_BLOCK;
4404 typedef struct _NDIS_AF_LIST NDIS_AF_LIST, *PNDIS_AF_LIST;
4405
4406 //
4407 // FIXME: Should be typedef struct _X_FILTER ETH_FILTER, *PETH_FILTER;
4408 //
4409 typedef PVOID ETH_FILTER, *PETH_FILTER;
4410
4411
4412 typedef struct _NDIS_MINIPORT_INTERRUPT {
4413 PKINTERRUPT InterruptObject;
4414 KSPIN_LOCK DpcCountLock;
4415 PVOID MiniportIdField;
4416 W_ISR_HANDLER MiniportIsr;
4417 W_HANDLE_INTERRUPT_HANDLER MiniportDpc;
4418 KDPC InterruptDpc;
4419 PNDIS_MINIPORT_BLOCK Miniport;
4420 UCHAR DpcCount;
4421 BOOLEAN Filler1;
4422 KEVENT DpcsCompletedEvent;
4423 BOOLEAN SharedInterrupt;
4424 BOOLEAN IsrRequested;
4425 } NDIS_MINIPORT_INTERRUPT, *PNDIS_MINIPORT_INTERRUPT;
4426
4427 typedef struct _NDIS_MINIPORT_TIMER {
4428 KTIMER Timer;
4429 KDPC Dpc;
4430 PNDIS_TIMER_FUNCTION MiniportTimerFunction;
4431 PVOID MiniportTimerContext;
4432 PNDIS_MINIPORT_BLOCK Miniport;
4433 struct _NDIS_MINIPORT_TIMER *NextDeferredTimer;
4434 } NDIS_MINIPORT_TIMER, *PNDIS_MINIPORT_TIMER;
4435
4436 typedef struct _NDIS_INTERRUPT {
4437 PKINTERRUPT InterruptObject;
4438 KSPIN_LOCK DpcCountLock;
4439 PNDIS_INTERRUPT_SERVICE MacIsr;
4440 PNDIS_DEFERRED_PROCESSING MacDpc;
4441 KDPC InterruptDpc;
4442 PVOID InterruptContext;
4443 UCHAR DpcCount;
4444 BOOLEAN Removing;
4445 KEVENT DpcsCompletedEvent;
4446 } NDIS_INTERRUPT, *PNDIS_INTERRUPT;
4447
4448
4449 typedef enum _NDIS_WORK_ITEM_TYPE {
4450 NdisWorkItemRequest,
4451 NdisWorkItemSend,
4452 NdisWorkItemReturnPackets,
4453 NdisWorkItemResetRequested,
4454 NdisWorkItemResetInProgress,
4455 NdisWorkItemHalt,
4456 NdisWorkItemSendLoopback,
4457 NdisWorkItemMiniportCallback,
4458 NdisMaxWorkItems
4459 } NDIS_WORK_ITEM_TYPE, *PNDIS_WORK_ITEM_TYPE;
4460
4461 #define NUMBER_OF_WORK_ITEM_TYPES NdisMaxWorkItems
4462 #define NUMBER_OF_SINGLE_WORK_ITEMS 6
4463
4464 typedef struct _NDIS_MINIPORT_WORK_ITEM {
4465 SINGLE_LIST_ENTRY Link;
4466 NDIS_WORK_ITEM_TYPE WorkItemType;
4467 PVOID WorkItemContext;
4468 } NDIS_MINIPORT_WORK_ITEM, *PNDIS_MINIPORT_WORK_ITEM;
4469
4470 struct _NDIS_WORK_ITEM;
4471 typedef VOID (*NDIS_PROC)(struct _NDIS_WORK_ITEM *, PVOID);
4472
4473 typedef struct _NDIS_WORK_ITEM {
4474 PVOID Context;
4475 NDIS_PROC Routine;
4476 UCHAR WrapperReserved[8*sizeof(PVOID)];
4477 } NDIS_WORK_ITEM, *PNDIS_WORK_ITEM;
4478
4479 typedef struct _NDIS_BIND_PATHS {
4480 UINT Number;
4481 NDIS_STRING Paths[1];
4482 } NDIS_BIND_PATHS, *PNDIS_BIND_PATHS;
4483
4484
4485 typedef VOID
4486 (NTAPI *ETH_RCV_COMPLETE_HANDLER)(
4487 IN PETH_FILTER Filter);
4488
4489 typedef VOID
4490 (NTAPI *ETH_RCV_INDICATE_HANDLER)(
4491 IN PETH_FILTER Filter,
4492 IN NDIS_HANDLE MacReceiveContext,
4493 IN PCHAR Address,
4494 IN PVOID HeaderBuffer,
4495 IN UINT HeaderBufferSize,
4496 IN PVOID LookaheadBuffer,
4497 IN UINT LookaheadBufferSize,
4498 IN UINT PacketSize);
4499
4500 typedef VOID
4501 (NTAPI *FDDI_RCV_COMPLETE_HANDLER)(
4502 IN PFDDI_FILTER Filter);
4503
4504 typedef VOID
4505 (NTAPI *FDDI_RCV_INDICATE_HANDLER)(
4506 IN PFDDI_FILTER Filter,
4507 IN NDIS_HANDLE MacReceiveContext,
4508 IN PCHAR Address,
4509 IN UINT AddressLength,
4510 IN PVOID HeaderBuffer,
4511 IN UINT HeaderBufferSize,
4512 IN PVOID LookaheadBuffer,
4513 IN UINT LookaheadBufferSize,
4514 IN UINT PacketSize);
4515
4516 typedef VOID
4517 (NTAPI *FILTER_PACKET_INDICATION_HANDLER)(
4518 IN NDIS_HANDLE Miniport,
4519 IN PPNDIS_PACKET PacketArray,
4520 IN UINT NumberOfPackets);
4521
4522 typedef VOID
4523 (NTAPI *TR_RCV_COMPLETE_HANDLER)(
4524 IN PTR_FILTER Filter);
4525
4526 typedef VOID
4527 (NTAPI *TR_RCV_INDICATE_HANDLER)(
4528 IN PTR_FILTER Filter,
4529 IN NDIS_HANDLE MacReceiveContext,
4530 IN PVOID HeaderBuffer,
4531 IN UINT HeaderBufferSize,
4532 IN PVOID LookaheadBuffer,
4533 IN UINT LookaheadBufferSize,
4534 IN UINT PacketSize);
4535
4536 typedef VOID
4537 (NTAPI *WAN_RCV_COMPLETE_HANDLER)(
4538 IN NDIS_HANDLE MiniportAdapterHandle,
4539 IN NDIS_HANDLE NdisLinkContext);
4540
4541 typedef VOID
4542 (NTAPI *WAN_RCV_HANDLER)(
4543 OUT PNDIS_STATUS Status,
4544 IN NDIS_HANDLE MiniportAdapterHandle,
4545 IN NDIS_HANDLE NdisLinkContext,
4546 IN PUCHAR Packet,
4547 IN ULONG PacketSize);
4548
4549 typedef VOID
4550 (FASTCALL *NDIS_M_DEQUEUE_WORK_ITEM)(
4551 IN PNDIS_MINIPORT_BLOCK Miniport,
4552 IN NDIS_WORK_ITEM_TYPE WorkItemType,
4553 OUT PVOID *WorkItemContext);
4554
4555 typedef NDIS_STATUS
4556 (FASTCALL *NDIS_M_QUEUE_NEW_WORK_ITEM)(
4557 IN PNDIS_MINIPORT_BLOCK Miniport,
4558 IN NDIS_WORK_ITEM_TYPE WorkItemType,
4559 IN PVOID WorkItemContext);
4560
4561 typedef NDIS_STATUS
4562 (FASTCALL *NDIS_M_QUEUE_WORK_ITEM)(
4563 IN PNDIS_MINIPORT_BLOCK Miniport,
4564 IN NDIS_WORK_ITEM_TYPE WorkItemType,
4565 IN PVOID WorkItemContext);
4566
4567 typedef VOID
4568 (NTAPI *NDIS_M_REQ_COMPLETE_HANDLER)(
4569 IN NDIS_HANDLE MiniportAdapterHandle,
4570 IN NDIS_STATUS Status);
4571
4572 typedef VOID
4573 (NTAPI *NDIS_M_RESET_COMPLETE_HANDLER)(
4574 IN NDIS_HANDLE MiniportAdapterHandle,
4575 IN NDIS_STATUS Status,
4576 IN BOOLEAN AddressingReset);
4577
4578 typedef VOID
4579 (NTAPI *NDIS_M_SEND_COMPLETE_HANDLER)(
4580 IN NDIS_HANDLE MiniportAdapterHandle,
4581 IN PNDIS_PACKET Packet,
4582 IN NDIS_STATUS Status);
4583
4584 typedef VOID
4585 (NTAPI *NDIS_M_SEND_RESOURCES_HANDLER)(
4586 IN NDIS_HANDLE MiniportAdapterHandle);
4587
4588 typedef BOOLEAN
4589 (FASTCALL *NDIS_M_START_SENDS)(
4590 IN PNDIS_MINIPORT_BLOCK Miniport);
4591
4592 typedef VOID
4593 (NTAPI *NDIS_M_STATUS_HANDLER)(
4594 IN NDIS_HANDLE MiniportHandle,
4595 IN NDIS_STATUS GeneralStatus,
4596 IN PVOID StatusBuffer,
4597 IN UINT StatusBufferSize);
4598
4599 typedef VOID
4600 (NTAPI *NDIS_M_STS_COMPLETE_HANDLER)(
4601 IN NDIS_HANDLE MiniportAdapterHandle);
4602
4603 typedef VOID
4604 (NTAPI *NDIS_M_TD_COMPLETE_HANDLER)(
4605 IN NDIS_HANDLE MiniportAdapterHandle,
4606 IN PNDIS_PACKET Packet,
4607 IN NDIS_STATUS Status,
4608 IN UINT BytesTransferred);
4609
4610 typedef VOID (NTAPI *NDIS_WM_SEND_COMPLETE_HANDLER)(
4611 IN NDIS_HANDLE MiniportAdapterHandle,
4612 IN PVOID Packet,
4613 IN NDIS_STATUS Status);
4614
4615
4616 #if ARCNET
4617
4618 #define ARC_SEND_BUFFERS 8
4619 #define ARC_HEADER_SIZE 4
4620
4621 typedef struct _NDIS_ARC_BUF {
4622 NDIS_HANDLE ArcnetBufferPool;
4623 PUCHAR ArcnetLookaheadBuffer;
4624 UINT NumFree;
4625 ARC_BUFFER_LIST ArcnetBuffers[ARC_SEND_BUFFERS];
4626 } NDIS_ARC_BUF, *PNDIS_ARC_BUF;
4627
4628 #endif /* ARCNET */
4629
4630 typedef struct _NDIS_LOG {
4631 PNDIS_MINIPORT_BLOCK Miniport;
4632 KSPIN_LOCK LogLock;
4633 PIRP Irp;
4634 UINT TotalSize;
4635 UINT CurrentSize;
4636 UINT InPtr;
4637 UINT OutPtr;