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