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