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