- Merge aicom-network-fixes up to r36740
[reactos.git] / reactos / include / ddk / ndis.h
1 /*
2 * ndis.h
3 *
4 * Network Device Interface Specification definitions
5 *
6 * This file is part of the w32api package.
7 *
8 * Contributors:
9 * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
10 *
11 * THIS SOFTWARE IS NOT COPYRIGHTED
12 *
13 * This source code is offered for use in the public domain. You may
14 * use, modify or distribute it freely.
15 *
16 * This code is distributed in the hope that it will be useful but
17 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18 * DISCLAIMED. This includes but is not limited to warranties of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 *
21 * DEFINES: i386 - Target platform is i386
22 * NDIS_WRAPPER - Define only for NDIS library
23 * NDIS_MINIPORT_DRIVER - Define only for NDIS miniport drivers
24 * NDIS40 - Use NDIS 4.0 structures by default
25 * NDIS50 - Use NDIS 5.0 structures by default
26 * NDIS51 - Use NDIS 5.1 structures by default
27 * NDIS40_MINIPORT - Building NDIS 4.0 miniport driver
28 * NDIS50_MINIPORT - Building NDIS 5.0 miniport driver
29 * NDIS51_MINIPORT - Building NDIS 5.1 miniport driver
30 */
31
32 #ifndef __NDIS_H
33 #define __NDIS_H
34
35 #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 typedef struct _NDIS_OBJECT_HEADER {
846 UCHAR Type;
847 UCHAR Revision;
848 USHORT Size;
849 } NDIS_OBJECT_HEADER, *PNDIS_OBJECT_HEADER;
850
851 typedef struct _NDIS_GENERIC_OBJECT {
852 NDIS_OBJECT_HEADER Header;
853 PVOID Caller;
854 PVOID CallersCaller;
855 PDRIVER_OBJECT DriverObject;
856 } NDIS_GENERIC_OBJECT, *PNDIS_GENERIC_OBJECT;
857
858 /*
859 * PNDIS_PACKET
860 * NDIS_GET_ORIGINAL_PACKET(
861 * IN PNDIS_PACKET Packet);
862 */
863 #define NDIS_GET_ORIGINAL_PACKET(Packet) \
864 NDIS_PER_PACKET_INFO_FROM_PACKET(Packet, OriginalPacketInfo)
865
866 /*
867 * PVOID
868 * NDIS_GET_PACKET_CANCEL_ID(
869 * IN PNDIS_PACKET Packet);
870 */
871 #define NDIS_GET_PACKET_CANCEL_ID(Packet) \
872 NDIS_PER_PACKET_INFO_FROM_PACKET(Packet, PacketCancelId)
873
874 /*
875 * PNDIS_PACKET_EXTENSION
876 * NDIS_PACKET_EXTENSION_FROM_PACKET(
877 * IN PNDIS_PACKET Packet);
878 */
879 #define NDIS_PACKET_EXTENSION_FROM_PACKET(Packet) \
880 ((PNDIS_PACKET_EXTENSION)((PUCHAR)(Packet) \
881 + (Packet)->Private.NdisPacketOobOffset + sizeof(NDIS_PACKET_OOB_DATA)))
882
883 /*
884 * PVOID
885 * NDIS_PER_PACKET_INFO_FROM_PACKET(
886 * IN OUT PNDIS_PACKET Packet,
887 * IN NDIS_PER_PACKET_INFO InfoType);
888 */
889 #define NDIS_PER_PACKET_INFO_FROM_PACKET(Packet, InfoType) \
890 ((PNDIS_PACKET_EXTENSION)((PUCHAR)(Packet) + (Packet)->Private.NdisPacketOobOffset \
891 + sizeof(NDIS_PACKET_OOB_DATA)))->NdisPacketInfo[(InfoType)]
892
893 /*
894 * VOID
895 * NDIS_SET_ORIGINAL_PACKET(
896 * IN OUT PNDIS_PACKET Packet,
897 * IN PNDIS_PACKET OriginalPacket);
898 */
899 #define NDIS_SET_ORIGINAL_PACKET(Packet, OriginalPacket) \
900 NDIS_PER_PACKET_INFO_FROM_PACKET(Packet, OriginalPacketInfo) = (OriginalPacket)
901
902 /*
903 * VOID
904 * NDIS_SET_PACKET_CANCEL_ID(
905 * IN PNDIS_PACKET Packet
906 * IN ULONG_PTR CancelId);
907 */
908 #define NDIS_SET_PACKET_CANCEL_ID(Packet, CancelId) \
909 NDIS_PER_PACKET_INFO_FROM_PACKET(Packet, PacketCancelId) = (CancelId)
910
911 typedef enum _NDIS_TASK {
912 TcpIpChecksumNdisTask,
913 IpSecNdisTask,
914 TcpLargeSendNdisTask,
915 MaxNdisTask
916 } NDIS_TASK, *PNDIS_TASK;
917
918 typedef struct _NDIS_TASK_IPSEC {
919 struct {
920 ULONG AH_ESP_COMBINED;
921 ULONG TRANSPORT_TUNNEL_COMBINED;
922 ULONG V4_OPTIONS;
923 ULONG RESERVED;
924 } Supported;
925
926 struct {
927 ULONG MD5 : 1;
928 ULONG SHA_1 : 1;
929 ULONG Transport : 1;
930 ULONG Tunnel : 1;
931 ULONG Send : 1;
932 ULONG Receive : 1;
933 } V4AH;
934
935 struct {
936 ULONG DES : 1;
937 ULONG RESERVED : 1;
938 ULONG TRIPLE_DES : 1;
939 ULONG NULL_ESP : 1;
940 ULONG Transport : 1;
941 ULONG Tunnel : 1;
942 ULONG Send : 1;
943 ULONG Receive : 1;
944 } V4ESP;
945 } NDIS_TASK_IPSEC, *PNDIS_TASK_IPSEC;
946
947 typedef struct _NDIS_TASK_OFFLOAD {
948 ULONG Version;
949 ULONG Size;
950 NDIS_TASK Task;
951 ULONG OffsetNextTask;
952 ULONG TaskBufferLength;
953 UCHAR TaskBuffer[1];
954 } NDIS_TASK_OFFLOAD, *PNDIS_TASK_OFFLOAD;
955
956 /* NDIS_TASK_OFFLOAD_HEADER.Version constants */
957 #define NDIS_TASK_OFFLOAD_VERSION 1
958
959 typedef enum _NDIS_ENCAPSULATION {
960 UNSPECIFIED_Encapsulation,
961 NULL_Encapsulation,
962 IEEE_802_3_Encapsulation,
963 IEEE_802_5_Encapsulation,
964 LLC_SNAP_ROUTED_Encapsulation,
965 LLC_SNAP_BRIDGED_Encapsulation
966 } NDIS_ENCAPSULATION;
967
968 typedef struct _NDIS_ENCAPSULATION_FORMAT {
969 NDIS_ENCAPSULATION Encapsulation;
970 struct {
971 ULONG FixedHeaderSize : 1;
972 ULONG Reserved : 31;
973 } Flags;
974 ULONG EncapsulationHeaderSize;
975 } NDIS_ENCAPSULATION_FORMAT, *PNDIS_ENCAPSULATION_FORMAT;
976
977 typedef struct _NDIS_TASK_TCP_IP_CHECKSUM {
978 struct {
979 ULONG IpOptionsSupported:1;
980 ULONG TcpOptionsSupported:1;
981 ULONG TcpChecksum:1;
982 ULONG UdpChecksum:1;
983 ULONG IpChecksum:1;
984 } V4Transmit;
985
986 struct {
987 ULONG IpOptionsSupported : 1;
988 ULONG TcpOptionsSupported : 1;
989 ULONG TcpChecksum : 1;
990 ULONG UdpChecksum : 1;
991 ULONG IpChecksum : 1;
992 } V4Receive;
993
994 struct {
995 ULONG IpOptionsSupported : 1;
996 ULONG TcpOptionsSupported : 1;
997 ULONG TcpChecksum : 1;
998 ULONG UdpChecksum : 1;
999 } V6Transmit;
1000
1001 struct {
1002 ULONG IpOptionsSupported : 1;
1003 ULONG TcpOptionsSupported : 1;
1004 ULONG TcpChecksum : 1;
1005 ULONG UdpChecksum : 1;
1006 } V6Receive;
1007 } NDIS_TASK_TCP_IP_CHECKSUM, *PNDIS_TASK_TCP_IP_CHECKSUM;
1008
1009 typedef struct _NDIS_TASK_TCP_LARGE_SEND {
1010 ULONG Version;
1011 ULONG MaxOffLoadSize;
1012 ULONG MinSegmentCount;
1013 BOOLEAN TcpOptions;
1014 BOOLEAN IpOptions;
1015 } NDIS_TASK_TCP_LARGE_SEND, *PNDIS_TASK_TCP_LARGE_SEND;
1016
1017 typedef struct _NDIS_TCP_IP_CHECKSUM_PACKET_INFO {
1018 _ANONYMOUS_UNION union {
1019 struct {
1020 ULONG NdisPacketChecksumV4 : 1;
1021 ULONG NdisPacketChecksumV6 : 1;
1022 ULONG NdisPacketTcpChecksum : 1;
1023 ULONG NdisPacketUdpChecksum : 1;
1024 ULONG NdisPacketIpChecksum : 1;
1025 } Transmit;
1026
1027 struct {
1028 ULONG NdisPacketTcpChecksumFailed : 1;
1029 ULONG NdisPacketUdpChecksumFailed : 1;
1030 ULONG NdisPacketIpChecksumFailed : 1;
1031 ULONG NdisPacketTcpChecksumSucceeded : 1;
1032 ULONG NdisPacketUdpChecksumSucceeded : 1;
1033 ULONG NdisPacketIpChecksumSucceeded : 1;
1034 ULONG NdisPacketLoopback : 1;
1035 } Receive;
1036 ULONG Value;
1037 } DUMMYUNIONNAME;
1038 } NDIS_TCP_IP_CHECKSUM_PACKET_INFO, *PNDIS_TCP_IP_CHECKSUM_PACKET_INFO;
1039
1040 typedef struct _NDIS_WAN_CO_FRAGMENT {
1041 ULONG Errors;
1042 } NDIS_WAN_CO_FRAGMENT, *PNDIS_WAN_CO_FRAGMENT;
1043
1044 typedef struct _NDIS_WAN_FRAGMENT {
1045 UCHAR RemoteAddress[6];
1046 UCHAR LocalAddress[6];
1047 } NDIS_WAN_FRAGMENT, *PNDIS_WAN_FRAGMENT;
1048
1049 typedef struct _WAN_CO_LINKPARAMS {
1050 ULONG TransmitSpeed;
1051 ULONG ReceiveSpeed;
1052 ULONG SendWindow;
1053 } WAN_CO_LINKPARAMS, *PWAN_CO_LINKPARAMS;
1054
1055
1056 /* Call Manager */
1057
1058 typedef VOID DDKAPI
1059 (*CM_ACTIVATE_VC_COMPLETE_HANDLER)(
1060 IN NDIS_STATUS Status,
1061 IN NDIS_HANDLE CallMgrVcContext,
1062 IN PCO_CALL_PARAMETERS CallParameters);
1063
1064 typedef NDIS_STATUS DDKAPI
1065 (*CM_ADD_PARTY_HANDLER)(
1066 IN NDIS_HANDLE CallMgrVcContext,
1067 IN OUT PCO_CALL_PARAMETERS CallParameters,
1068 IN NDIS_HANDLE NdisPartyHandle,
1069 OUT PNDIS_HANDLE CallMgrPartyContext);
1070
1071 typedef NDIS_STATUS DDKAPI
1072 (*CM_CLOSE_AF_HANDLER)(
1073 IN NDIS_HANDLE CallMgrAfContext);
1074
1075 typedef NDIS_STATUS DDKAPI
1076 (*CM_CLOSE_CALL_HANDLER)(
1077 IN NDIS_HANDLE CallMgrVcContext,
1078 IN NDIS_HANDLE CallMgrPartyContext OPTIONAL,
1079 IN PVOID CloseData OPTIONAL,
1080 IN UINT Size OPTIONAL);
1081
1082 typedef NDIS_STATUS DDKAPI
1083 (*CM_DEREG_SAP_HANDLER)(
1084 IN NDIS_HANDLE CallMgrSapContext);
1085
1086 typedef VOID DDKAPI
1087 (*CM_DEACTIVATE_VC_COMPLETE_HANDLER)(
1088 IN NDIS_STATUS Status,
1089 IN NDIS_HANDLE CallMgrVcContext);
1090
1091 typedef NDIS_STATUS DDKAPI
1092 (*CM_DROP_PARTY_HANDLER)(
1093 IN NDIS_HANDLE CallMgrPartyContext,
1094 IN PVOID CloseData OPTIONAL,
1095 IN UINT Size OPTIONAL);
1096
1097 typedef VOID DDKAPI
1098 (*CM_INCOMING_CALL_COMPLETE_HANDLER)(
1099 IN NDIS_STATUS Status,
1100 IN NDIS_HANDLE CallMgrVcContext,
1101 IN PCO_CALL_PARAMETERS CallParameters);
1102
1103 typedef NDIS_STATUS DDKAPI
1104 (*CM_MAKE_CALL_HANDLER)(
1105 IN NDIS_HANDLE CallMgrVcContext,
1106 IN OUT PCO_CALL_PARAMETERS CallParameters,
1107 IN NDIS_HANDLE NdisPartyHandle OPTIONAL,
1108 OUT PNDIS_HANDLE CallMgrPartyContext OPTIONAL);
1109
1110 typedef NDIS_STATUS DDKAPI
1111 (*CM_MODIFY_CALL_QOS_HANDLER)(
1112 IN NDIS_HANDLE CallMgrVcContext,
1113 IN PCO_CALL_PARAMETERS CallParameters);
1114
1115 typedef NDIS_STATUS DDKAPI
1116 (*CM_OPEN_AF_HANDLER)(
1117 IN NDIS_HANDLE CallMgrBindingContext,
1118 IN PCO_ADDRESS_FAMILY AddressFamily,
1119 IN NDIS_HANDLE NdisAfHandle,
1120 OUT PNDIS_HANDLE CallMgrAfContext);
1121
1122 typedef NDIS_STATUS DDKAPI
1123 (*CM_REG_SAP_HANDLER)(
1124 IN NDIS_HANDLE CallMgrAfContext,
1125 IN PCO_SAP Sap,
1126 IN NDIS_HANDLE NdisSapHandle,
1127 OUT PNDIS_HANDLE CallMgrSapContext);
1128
1129 typedef NDIS_STATUS DDKAPI
1130 (*CO_CREATE_VC_HANDLER)(
1131 IN NDIS_HANDLE ProtocolAfContext,
1132 IN NDIS_HANDLE NdisVcHandle,
1133 OUT PNDIS_HANDLE ProtocolVcContext);
1134
1135 typedef NDIS_STATUS DDKAPI
1136 (*CO_DELETE_VC_HANDLER)(
1137 IN NDIS_HANDLE ProtocolVcContext);
1138
1139 typedef VOID DDKAPI
1140 (*CO_REQUEST_COMPLETE_HANDLER)(
1141 IN NDIS_STATUS Status,
1142 IN NDIS_HANDLE ProtocolAfContext OPTIONAL,
1143 IN NDIS_HANDLE ProtocolVcContext OPTIONAL,
1144 IN NDIS_HANDLE ProtocolPartyContext OPTIONAL,
1145 IN PNDIS_REQUEST NdisRequest);
1146
1147 typedef NDIS_STATUS DDKAPI
1148 (*CO_REQUEST_HANDLER)(
1149 IN NDIS_HANDLE ProtocolAfContext,
1150 IN NDIS_HANDLE ProtocolVcContext OPTIONAL,
1151 IN NDIS_HANDLE ProtocolPartyContext OPTIONAL,
1152 IN OUT PNDIS_REQUEST NdisRequest);
1153
1154 typedef struct _NDIS_CALL_MANAGER_CHARACTERISTICS {
1155 UCHAR MajorVersion;
1156 UCHAR MinorVersion;
1157 USHORT Filler;
1158 UINT Reserved;
1159 CO_CREATE_VC_HANDLER CmCreateVcHandler;
1160 CO_DELETE_VC_HANDLER CmDeleteVcHandler;
1161 CM_OPEN_AF_HANDLER CmOpenAfHandler;
1162 CM_CLOSE_AF_HANDLER CmCloseAfHandler;
1163 CM_REG_SAP_HANDLER CmRegisterSapHandler;
1164 CM_DEREG_SAP_HANDLER CmDeregisterSapHandler;
1165 CM_MAKE_CALL_HANDLER CmMakeCallHandler;
1166 CM_CLOSE_CALL_HANDLER CmCloseCallHandler;
1167 CM_INCOMING_CALL_COMPLETE_HANDLER CmIncomingCallCompleteHandler;
1168 CM_ADD_PARTY_HANDLER CmAddPartyHandler;
1169 CM_DROP_PARTY_HANDLER CmDropPartyHandler;
1170 CM_ACTIVATE_VC_COMPLETE_HANDLER CmActivateVcCompleteHandler;
1171 CM_DEACTIVATE_VC_COMPLETE_HANDLER CmDeactivateVcCompleteHandler;
1172 CM_MODIFY_CALL_QOS_HANDLER CmModifyCallQoSHandler;
1173 CO_REQUEST_HANDLER CmRequestHandler;
1174 CO_REQUEST_COMPLETE_HANDLER CmRequestCompleteHandler;
1175 } NDIS_CALL_MANAGER_CHARACTERISTICS, *PNDIS_CALL_MANAGER_CHARACTERISTICS;
1176
1177
1178
1179 /* Call Manager clients */
1180
1181 typedef VOID (*CL_OPEN_AF_COMPLETE_HANDLER)(
1182 IN NDIS_STATUS Status,
1183 IN NDIS_HANDLE ProtocolAfContext,
1184 IN NDIS_HANDLE NdisAfHandle);
1185
1186 typedef VOID DDKAPI
1187 (*CL_CLOSE_AF_COMPLETE_HANDLER)(
1188 IN NDIS_STATUS Status,
1189 IN NDIS_HANDLE ProtocolAfContext);
1190
1191 typedef VOID DDKAPI
1192 (*CL_REG_SAP_COMPLETE_HANDLER)(
1193 IN NDIS_STATUS Status,
1194 IN NDIS_HANDLE ProtocolSapContext,
1195 IN PCO_SAP Sap,
1196 IN NDIS_HANDLE NdisSapHandle);
1197
1198 typedef VOID DDKAPI
1199 (*CL_DEREG_SAP_COMPLETE_HANDLER)(
1200 IN NDIS_STATUS Status,
1201 IN NDIS_HANDLE ProtocolSapContext);
1202
1203 typedef VOID DDKAPI
1204 (*CL_MAKE_CALL_COMPLETE_HANDLER)(
1205 IN NDIS_STATUS Status,
1206 IN NDIS_HANDLE ProtocolVcContext,
1207 IN NDIS_HANDLE NdisPartyHandle OPTIONAL,
1208 IN PCO_CALL_PARAMETERS CallParameters);
1209
1210 typedef VOID DDKAPI
1211 (*CL_MODIFY_CALL_QOS_COMPLETE_HANDLER)(
1212 IN NDIS_STATUS Status,
1213 IN NDIS_HANDLE ProtocolVcContext,
1214 IN PCO_CALL_PARAMETERS CallParameters);
1215
1216 typedef VOID DDKAPI
1217 (*CL_CLOSE_CALL_COMPLETE_HANDLER)(
1218 IN NDIS_STATUS Status,
1219 IN NDIS_HANDLE ProtocolVcContext,
1220 IN NDIS_HANDLE ProtocolPartyContext OPTIONAL);
1221
1222 typedef VOID DDKAPI
1223 (*CL_ADD_PARTY_COMPLETE_HANDLER)(
1224 IN NDIS_STATUS Status,
1225 IN NDIS_HANDLE ProtocolPartyContext,
1226 IN NDIS_HANDLE NdisPartyHandle,
1227 IN PCO_CALL_PARAMETERS CallParameters);
1228
1229 typedef VOID DDKAPI
1230 (*CL_DROP_PARTY_COMPLETE_HANDLER)(
1231 IN NDIS_STATUS Status,
1232 IN NDIS_HANDLE ProtocolPartyContext);
1233
1234 typedef NDIS_STATUS DDKAPI
1235 (*CL_INCOMING_CALL_HANDLER)(
1236 IN NDIS_HANDLE ProtocolSapContext,
1237 IN NDIS_HANDLE ProtocolVcContext,
1238 IN OUT PCO_CALL_PARAMETERS CallParameters);
1239
1240 typedef VOID DDKAPI
1241 (*CL_INCOMING_CALL_QOS_CHANGE_HANDLER)(
1242 IN NDIS_HANDLE ProtocolVcContext,
1243 IN PCO_CALL_PARAMETERS CallParameters);
1244
1245 typedef VOID DDKAPI
1246 (*CL_INCOMING_CLOSE_CALL_HANDLER)(
1247 IN NDIS_STATUS CloseStatus,
1248 IN NDIS_HANDLE ProtocolVcContext,
1249 IN PVOID CloseData OPTIONAL,
1250 IN UINT Size OPTIONAL);
1251
1252 typedef VOID DDKAPI
1253 (*CL_INCOMING_DROP_PARTY_HANDLER)(
1254 IN NDIS_STATUS DropStatus,
1255 IN NDIS_HANDLE ProtocolPartyContext,
1256 IN PVOID CloseData OPTIONAL,
1257 IN UINT Size OPTIONAL);
1258
1259 typedef VOID DDKAPI
1260 (*CL_CALL_CONNECTED_HANDLER)(
1261 IN NDIS_HANDLE ProtocolVcContext);
1262
1263
1264 typedef struct _NDIS_CLIENT_CHARACTERISTICS {
1265 UCHAR MajorVersion;
1266 UCHAR MinorVersion;
1267 USHORT Filler;
1268 UINT Reserved;
1269 CO_CREATE_VC_HANDLER ClCreateVcHandler;
1270 CO_DELETE_VC_HANDLER ClDeleteVcHandler;
1271 CO_REQUEST_HANDLER ClRequestHandler;
1272 CO_REQUEST_COMPLETE_HANDLER ClRequestCompleteHandler;
1273 CL_OPEN_AF_COMPLETE_HANDLER ClOpenAfCompleteHandler;
1274 CL_CLOSE_AF_COMPLETE_HANDLER ClCloseAfCompleteHandler;
1275 CL_REG_SAP_COMPLETE_HANDLER ClRegisterSapCompleteHandler;
1276 CL_DEREG_SAP_COMPLETE_HANDLER ClDeregisterSapCompleteHandler;
1277 CL_MAKE_CALL_COMPLETE_HANDLER ClMakeCallCompleteHandler;
1278 CL_MODIFY_CALL_QOS_COMPLETE_HANDLER ClModifyCallQoSCompleteHandler;
1279 CL_CLOSE_CALL_COMPLETE_HANDLER ClCloseCallCompleteHandler;
1280 CL_ADD_PARTY_COMPLETE_HANDLER ClAddPartyCompleteHandler;
1281 CL_DROP_PARTY_COMPLETE_HANDLER ClDropPartyCompleteHandler;
1282 CL_INCOMING_CALL_HANDLER ClIncomingCallHandler;
1283 CL_INCOMING_CALL_QOS_CHANGE_HANDLER ClIncomingCallQoSChangeHandler;
1284 CL_INCOMING_CLOSE_CALL_HANDLER ClIncomingCloseCallHandler;
1285 CL_INCOMING_DROP_PARTY_HANDLER ClIncomingDropPartyHandler;
1286 CL_CALL_CONNECTED_HANDLER ClCallConnectedHandler;
1287 } NDIS_CLIENT_CHARACTERISTICS, *PNDIS_CLIENT_CHARACTERISTICS;
1288
1289
1290 /* NDIS protocol structures */
1291
1292 /* Prototypes for NDIS 3.0 protocol characteristics */
1293
1294 typedef VOID DDKAPI
1295 (*OPEN_ADAPTER_COMPLETE_HANDLER)(
1296 IN NDIS_HANDLE ProtocolBindingContext,
1297 IN NDIS_STATUS Status,
1298 IN NDIS_STATUS OpenErrorStatus);
1299
1300 typedef VOID DDKAPI
1301 (*CLOSE_ADAPTER_COMPLETE_HANDLER)(
1302 IN NDIS_HANDLE ProtocolBindingContext,
1303 IN NDIS_STATUS Status);
1304
1305 typedef VOID DDKAPI
1306 (*RESET_COMPLETE_HANDLER)(
1307 IN NDIS_HANDLE ProtocolBindingContext,
1308 IN NDIS_STATUS Status);
1309
1310 typedef VOID DDKAPI
1311 (*REQUEST_COMPLETE_HANDLER)(
1312 IN NDIS_HANDLE ProtocolBindingContext,
1313 IN PNDIS_REQUEST NdisRequest,
1314 IN NDIS_STATUS Status);
1315
1316 typedef VOID DDKAPI
1317 (*STATUS_HANDLER)(
1318 IN NDIS_HANDLE ProtocolBindingContext,
1319 IN NDIS_STATUS GeneralStatus,
1320 IN PVOID StatusBuffer,
1321 IN UINT StatusBufferSize);
1322
1323 typedef VOID DDKAPI
1324 (*STATUS_COMPLETE_HANDLER)(
1325 IN NDIS_HANDLE ProtocolBindingContext);
1326
1327 typedef VOID DDKAPI
1328 (*SEND_COMPLETE_HANDLER)(
1329 IN NDIS_HANDLE ProtocolBindingContext,
1330 IN PNDIS_PACKET Packet,
1331 IN NDIS_STATUS Status);
1332
1333 typedef VOID DDKAPI
1334 (*WAN_SEND_COMPLETE_HANDLER)(
1335 IN NDIS_HANDLE ProtocolBindingContext,
1336 IN PNDIS_WAN_PACKET Packet,
1337 IN NDIS_STATUS Status);
1338
1339 typedef VOID DDKAPI
1340 (*TRANSFER_DATA_COMPLETE_HANDLER)(
1341 IN NDIS_HANDLE ProtocolBindingContext,
1342 IN PNDIS_PACKET Packet,
1343 IN NDIS_STATUS Status,
1344 IN UINT BytesTransferred);
1345
1346 typedef VOID DDKAPI
1347 (*WAN_TRANSFER_DATA_COMPLETE_HANDLER)(
1348 VOID);
1349
1350
1351 typedef NDIS_STATUS DDKAPI
1352 (*RECEIVE_HANDLER)(
1353 IN NDIS_HANDLE ProtocolBindingContext,
1354 IN NDIS_HANDLE MacReceiveContext,
1355 IN PVOID HeaderBuffer,
1356 IN UINT HeaderBufferSize,
1357 IN PVOID LookAheadBuffer,
1358 IN UINT LookaheadBufferSize,
1359 IN UINT PacketSize);
1360
1361 typedef NDIS_STATUS DDKAPI
1362 (*WAN_RECEIVE_HANDLER)(
1363 IN NDIS_HANDLE NdisLinkHandle,
1364 IN PUCHAR Packet,
1365 IN ULONG PacketSize);
1366
1367 typedef VOID DDKAPI
1368 (*RECEIVE_COMPLETE_HANDLER)(
1369 IN NDIS_HANDLE ProtocolBindingContext);
1370
1371
1372 /* Protocol characteristics for NDIS 3.0 protocols */
1373
1374 #define NDIS30_PROTOCOL_CHARACTERISTICS_S \
1375 UCHAR MajorNdisVersion; \
1376 UCHAR MinorNdisVersion; \
1377 USHORT Filler; \
1378 _ANONYMOUS_UNION union { \
1379 UINT Reserved; \
1380 UINT Flags; \
1381 } DUMMYUNIONNAME; \
1382 OPEN_ADAPTER_COMPLETE_HANDLER OpenAdapterCompleteHandler; \
1383 CLOSE_ADAPTER_COMPLETE_HANDLER CloseAdapterCompleteHandler; \
1384 _ANONYMOUS_UNION union { \
1385 SEND_COMPLETE_HANDLER SendCompleteHandler; \
1386 WAN_SEND_COMPLETE_HANDLER WanSendCompleteHandler; \
1387 } DUMMYUNIONNAME2; \
1388 _ANONYMOUS_UNION union { \
1389 TRANSFER_DATA_COMPLETE_HANDLER TransferDataCompleteHandler; \
1390 WAN_TRANSFER_DATA_COMPLETE_HANDLER WanTransferDataCompleteHandler; \
1391 } DUMMYUNIONNAME3; \
1392 RESET_COMPLETE_HANDLER ResetCompleteHandler; \
1393 REQUEST_COMPLETE_HANDLER RequestCompleteHandler; \
1394 _ANONYMOUS_UNION union { \
1395 RECEIVE_HANDLER ReceiveHandler; \
1396 WAN_RECEIVE_HANDLER WanReceiveHandler; \
1397 } DUMMYUNIONNAME4; \
1398 RECEIVE_COMPLETE_HANDLER ReceiveCompleteHandler; \
1399 STATUS_HANDLER StatusHandler; \
1400 STATUS_COMPLETE_HANDLER StatusCompleteHandler; \
1401 NDIS_STRING Name;
1402
1403 typedef struct _NDIS30_PROTOCOL_CHARACTERISTICS {
1404 NDIS30_PROTOCOL_CHARACTERISTICS_S
1405 } NDIS30_PROTOCOL_CHARACTERISTICS, *PNDIS30_PROTOCOL_CHARACTERISTICS;
1406
1407
1408 /* Prototypes for NDIS 4.0 protocol characteristics */
1409
1410 typedef INT DDKAPI
1411 (*RECEIVE_PACKET_HANDLER)(
1412 IN NDIS_HANDLE ProtocolBindingContext,
1413 IN PNDIS_PACKET Packet);
1414
1415 typedef VOID DDKAPI
1416 (*BIND_HANDLER)(
1417 OUT PNDIS_STATUS Status,
1418 IN NDIS_HANDLE BindContext,
1419 IN PNDIS_STRING DeviceName,
1420 IN PVOID SystemSpecific1,
1421 IN PVOID SystemSpecific2);
1422
1423 typedef VOID DDKAPI
1424 (*UNBIND_HANDLER)(
1425 OUT PNDIS_STATUS Status,
1426 IN NDIS_HANDLE ProtocolBindingContext,
1427 IN NDIS_HANDLE UnbindContext);
1428
1429 typedef NDIS_STATUS DDKAPI
1430 (*PNP_EVENT_HANDLER)(
1431 IN NDIS_HANDLE ProtocolBindingContext,
1432 IN PNET_PNP_EVENT NetPnPEvent);
1433
1434 typedef VOID DDKAPI
1435 (*UNLOAD_PROTOCOL_HANDLER)(
1436 VOID);
1437
1438
1439 /* Protocol characteristics for NDIS 4.0 protocols */
1440
1441 #ifdef __cplusplus
1442
1443 #define NDIS40_PROTOCOL_CHARACTERISTICS_S \
1444 NDIS30_PROTOCOL_CHARACTERISTICS Ndis30Chars; \
1445 RECEIVE_PACKET_HANDLER ReceivePacketHandler; \
1446 BIND_HANDLER BindAdapterHandler; \
1447 UNBIND_HANDLER UnbindAdapterHandler; \
1448 PNP_EVENT_HANDLER PnPEventHandler; \
1449 UNLOAD_PROTOCOL_HANDLER UnloadHandler;
1450
1451 #else /* !__cplusplus */
1452
1453 #define NDIS40_PROTOCOL_CHARACTERISTICS_S \
1454 NDIS30_PROTOCOL_CHARACTERISTICS_S \
1455 RECEIVE_PACKET_HANDLER ReceivePacketHandler; \
1456 BIND_HANDLER BindAdapterHandler; \
1457 UNBIND_HANDLER UnbindAdapterHandler; \
1458 PNP_EVENT_HANDLER PnPEventHandler; \
1459 UNLOAD_PROTOCOL_HANDLER UnloadHandler;
1460
1461 #endif /* __cplusplus */
1462
1463 typedef struct _NDIS40_PROTOCOL_CHARACTERISTICS {
1464 NDIS40_PROTOCOL_CHARACTERISTICS_S
1465 } NDIS40_PROTOCOL_CHARACTERISTICS, *PNDIS40_PROTOCOL_CHARACTERISTICS;
1466
1467 /* Prototypes for NDIS 5.0 protocol characteristics */
1468
1469 typedef VOID DDKAPI
1470 (*CO_SEND_COMPLETE_HANDLER)(
1471 IN NDIS_STATUS Status,
1472 IN NDIS_HANDLE ProtocolVcContext,
1473 IN PNDIS_PACKET Packet);
1474
1475 typedef VOID DDKAPI
1476 (*CO_STATUS_HANDLER)(
1477 IN NDIS_HANDLE ProtocolBindingContext,
1478 IN NDIS_HANDLE ProtocolVcContext OPTIONAL,
1479 IN NDIS_STATUS GeneralStatus,
1480 IN PVOID StatusBuffer,
1481 IN UINT StatusBufferSize);
1482
1483 typedef UINT DDKAPI
1484 (*CO_RECEIVE_PACKET_HANDLER)(
1485 IN NDIS_HANDLE ProtocolBindingContext,
1486 IN NDIS_HANDLE ProtocolVcContext,
1487 IN PNDIS_PACKET Packet);
1488
1489 typedef VOID DDKAPI
1490 (*CO_AF_REGISTER_NOTIFY_HANDLER)(
1491 IN NDIS_HANDLE ProtocolBindingContext,
1492 IN PCO_ADDRESS_FAMILY AddressFamily);
1493
1494 #ifdef __cplusplus \
1495
1496 #define NDIS50_PROTOCOL_CHARACTERISTICS_S \
1497 NDIS40_PROTOCOL_CHARACTERISTICS Ndis40Chars; \
1498 PVOID ReservedHandlers[4]; \
1499 CO_SEND_COMPLETE_HANDLER CoSendCompleteHandler; \
1500 CO_STATUS_HANDLER CoStatusHandler; \
1501 CO_RECEIVE_PACKET_HANDLER CoReceivePacketHandler; \
1502 CO_AF_REGISTER_NOTIFY_HANDLER CoAfRegisterNotifyHandler;
1503
1504 #else /* !__cplusplus */
1505
1506 #define NDIS50_PROTOCOL_CHARACTERISTICS_S \
1507 NDIS40_PROTOCOL_CHARACTERISTICS_S \
1508 PVOID ReservedHandlers[4]; \
1509 CO_SEND_COMPLETE_HANDLER CoSendCompleteHandler; \
1510 CO_STATUS_HANDLER CoStatusHandler; \
1511 CO_RECEIVE_PACKET_HANDLER CoReceivePacketHandler; \
1512 CO_AF_REGISTER_NOTIFY_HANDLER CoAfRegisterNotifyHandler;
1513
1514 #endif /* !__cplusplus */
1515
1516 typedef struct _NDIS50_PROTOCOL_CHARACTERISTICS {
1517 NDIS50_PROTOCOL_CHARACTERISTICS_S
1518 } NDIS50_PROTOCOL_CHARACTERISTICS, *PNDIS50_PROTOCOL_CHARACTERISTICS;
1519
1520 #if defined(NDIS50) || defined(NDIS51)
1521 typedef struct _NDIS_PROTOCOL_CHARACTERISTICS {
1522 NDIS50_PROTOCOL_CHARACTERISTICS_S;
1523 } NDIS_PROTOCOL_CHARACTERISTICS, *PNDIS_PROTOCOL_CHARACTERISTICS;
1524 #elif defined(NDIS40)
1525 typedef struct _NDIS_PROTOCOL_CHARACTERISTICS {
1526 NDIS40_PROTOCOL_CHARACTERISTICS_S;
1527 } NDIS_PROTOCOL_CHARACTERISTICS, *PNDIS_PROTOCOL_CHARACTERISTICS;
1528 #else /* NDIS30 */
1529 typedef struct _NDIS_PROTOCOL_CHARACTERISTICS {
1530 NDIS30_PROTOCOL_CHARACTERISTICS_S
1531 } NDIS_PROTOCOL_CHARACTERISTICS, *PNDIS_PROTOCOL_CHARACTERISTICS;
1532 #endif
1533
1534
1535
1536 /* Buffer management routines */
1537
1538 NDISAPI
1539 VOID
1540 DDKAPI
1541 NdisAllocateBuffer(
1542 OUT PNDIS_STATUS Status,
1543 OUT PNDIS_BUFFER *Buffer,
1544 IN NDIS_HANDLE PoolHandle,
1545 IN PVOID VirtualAddress,
1546 IN UINT Length);
1547
1548
1549 NDISAPI
1550 VOID
1551 DDKAPI
1552 NdisAllocateBufferPool(
1553 OUT PNDIS_STATUS Status,
1554 OUT PNDIS_HANDLE PoolHandle,
1555 IN UINT NumberOfDescriptors);
1556
1557 NDISAPI
1558 VOID
1559 DDKAPI
1560 NdisAllocatePacket(
1561 OUT PNDIS_STATUS Status,
1562 OUT PNDIS_PACKET *Packet,
1563 IN NDIS_HANDLE PoolHandle);
1564
1565 NDISAPI
1566 VOID
1567 DDKAPI
1568 NdisAllocatePacketPool(
1569 OUT PNDIS_STATUS Status,
1570 OUT PNDIS_HANDLE PoolHandle,
1571 IN UINT NumberOfDescriptors,
1572 IN UINT ProtocolReservedLength);
1573
1574 NDISAPI
1575 VOID
1576 DDKAPI
1577 NdisCopyBuffer(
1578 OUT PNDIS_STATUS Status,
1579 OUT PNDIS_BUFFER *Buffer,
1580 IN NDIS_HANDLE PoolHandle,
1581 IN PVOID MemoryDescriptor,
1582 IN UINT Offset,
1583 IN UINT Length);
1584
1585 NDISAPI
1586 VOID
1587 DDKAPI
1588 NdisCopyFromPacketToPacket(
1589 IN PNDIS_PACKET Destination,
1590 IN UINT DestinationOffset,
1591 IN UINT BytesToCopy,
1592 IN PNDIS_PACKET Source,
1593 IN UINT SourceOffset,
1594 OUT PUINT BytesCopied);
1595
1596 /*
1597 * VOID
1598 * NdisCopyLookaheadData(
1599 * IN PVOID Destination,
1600 * IN PVOID Source,
1601 * IN ULONG Length,
1602 * IN ULONG ReceiveFlags);
1603 */
1604
1605 #if defined(_M_IX86) || defined(_M_AMD64)
1606 #define NdisCopyLookaheadData(Destination, Source, Length, MacOptions) \
1607 RtlCopyMemory(Destination, Source, Length)
1608 #else
1609 #define NdisCopyLookaheadData(Destination, Source, Length, MacOptions) \
1610 { \
1611 if ((MacOptions) & NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA) \
1612 { \
1613 RtlCopyMemory(_Destination, _Source, _Length); \
1614 } \
1615 else \
1616 { \
1617 PUCHAR _Src = (PUCHAR)(Source); \
1618 PUCHAR _Dest = (PUCHAR)(Destination); \
1619 PUCHAR _End = _Dest + (Length); \
1620 while (_Dest < _End) \
1621 *_Dest++ = *_Src++; \
1622 } \
1623 }
1624 #endif
1625
1626 NDISAPI
1627 VOID
1628 DDKAPI
1629 NdisDprAllocatePacket(
1630 OUT PNDIS_STATUS Status,
1631 OUT PNDIS_PACKET *Packet,
1632 IN NDIS_HANDLE PoolHandle);
1633
1634 NDISAPI
1635 VOID
1636 DDKAPI
1637 NdisDprAllocatePacketNonInterlocked(
1638 OUT PNDIS_STATUS Status,
1639 OUT PNDIS_PACKET *Packet,
1640 IN NDIS_HANDLE PoolHandle);
1641
1642 NDISAPI
1643 VOID
1644 DDKAPI
1645 NdisDprFreePacket(
1646 IN PNDIS_PACKET Packet);
1647
1648 NDISAPI
1649 VOID
1650 DDKAPI
1651 NdisDprFreePacketNonInterlocked(
1652 IN PNDIS_PACKET Packet);
1653
1654 NDISAPI
1655 VOID
1656 DDKAPI
1657 NdisFreeBufferPool(
1658 IN NDIS_HANDLE PoolHandle);
1659
1660 NDISAPI
1661 VOID
1662 DDKAPI
1663 NdisFreePacket(
1664 IN PNDIS_PACKET Packet);
1665
1666 NDISAPI
1667 VOID
1668 DDKAPI
1669 NdisFreePacketPool(
1670 IN NDIS_HANDLE PoolHandle);
1671
1672 NDISAPI
1673 VOID
1674 DDKAPI
1675 NdisReturnPackets(
1676 IN PNDIS_PACKET *PacketsToReturn,
1677 IN UINT NumberOfPackets);
1678
1679 NDISAPI
1680 VOID
1681 DDKAPI
1682 NdisUnchainBufferAtBack(
1683 IN OUT PNDIS_PACKET Packet,
1684 OUT PNDIS_BUFFER *Buffer);
1685
1686 NDISAPI
1687 VOID
1688 DDKAPI
1689 NdisUnchainBufferAtFront(
1690 IN OUT PNDIS_PACKET Packet,
1691 OUT PNDIS_BUFFER *Buffer);
1692
1693 NDISAPI
1694 VOID
1695 DDKAPI
1696 NdisAdjustBufferLength(
1697 IN PNDIS_BUFFER Buffer,
1698 IN UINT Length);
1699
1700 NDISAPI
1701 ULONG
1702 DDKAPI
1703 NdisBufferLength(
1704 IN PNDIS_BUFFER Buffer);
1705
1706 NDISAPI
1707 PVOID
1708 DDKAPI
1709 NdisBufferVirtualAddress(
1710 IN PNDIS_BUFFER Buffer);
1711
1712 NDISAPI
1713 ULONG
1714 DDKAPI
1715 NDIS_BUFFER_TO_SPAN_PAGES(
1716 IN PNDIS_BUFFER Buffer);
1717
1718 NDISAPI
1719 VOID
1720 DDKAPI
1721 NdisFreeBuffer(
1722 IN PNDIS_BUFFER Buffer);
1723
1724 #if BINARY_COMPATIBLE
1725
1726 NDISAPI
1727 VOID
1728 DDKAPI
1729 NdisGetBufferPhysicalArraySize(
1730 IN PNDIS_BUFFER Buffer,
1731 OUT PUINT ArraySize);
1732
1733 NDISAPI
1734 VOID
1735 DDKAPI
1736 NdisGetFirstBufferFromPacket(
1737 IN PNDIS_PACKET _Packet,
1738 OUT PNDIS_BUFFER *_FirstBuffer,
1739 OUT PVOID *_FirstBufferVA,
1740 OUT PUINT _FirstBufferLength,
1741 OUT PUINT _TotalBufferLength);
1742
1743 NDISAPI
1744 VOID
1745 DDKAPI
1746 NdisQueryBuffer(
1747 IN PNDIS_BUFFER Buffer,
1748 OUT PVOID *VirtualAddress OPTIONAL,
1749 OUT PUINT Length);
1750
1751 NDISAPI
1752 VOID
1753 DDKAPI
1754 NdisQueryBufferOffset(
1755 IN PNDIS_BUFFER Buffer,
1756 OUT PUINT Offset,
1757 OUT PUINT Length);
1758
1759 #else
1760
1761 /*
1762 * VOID
1763 * NdisGetBufferPhysicalArraySize(
1764 * IN PNDIS_BUFFER Buffer,
1765 * OUT PUINT ArraySize);
1766 */
1767 #define NdisGetBufferPhysicalArraySize(Buffer, \
1768 ArraySize) \
1769 { \
1770 (*(ArraySize) = NDIS_BUFFER_TO_SPAN_PAGES(Buffer)) \
1771 }
1772
1773 /*
1774 * VOID
1775 * NdisGetFirstBufferFromPacket(
1776 * IN PNDIS_PACKET _Packet,
1777 * OUT PNDIS_BUFFER * _FirstBuffer,
1778 * OUT PVOID * _FirstBufferVA,
1779 * OUT PUINT _FirstBufferLength,
1780 * OUT PUINT _TotalBufferLength)
1781 */
1782 #define NdisGetFirstBufferFromPacket(_Packet, \
1783 _FirstBuffer, \
1784 _FirstBufferVA, \
1785 _FirstBufferLength, \
1786 _TotalBufferLength) \
1787 { \
1788 PNDIS_BUFFER _Buffer; \
1789 \
1790 _Buffer = (_Packet)->Private.Head; \
1791 *(_FirstBuffer) = _Buffer; \
1792 if (_Buffer != NULL) \
1793 { \
1794 *(_FirstBufferVA) = MmGetSystemAddressForMdl(_Buffer); \
1795 *(_FirstBufferLength) = MmGetMdlByteCount(_Buffer); \
1796 _Buffer = _Buffer->Next; \
1797 *(_TotalBufferLength) = *(_FirstBufferLength); \
1798 while (_Buffer != NULL) { \
1799 *(_TotalBufferLength) += MmGetMdlByteCount(_Buffer); \
1800 _Buffer = _Buffer->Next; \
1801 } \
1802 } \
1803 else \
1804 { \
1805 *(_FirstBufferVA) = 0; \
1806 *(_FirstBufferLength) = 0; \
1807 *(_TotalBufferLength) = 0; \
1808 } \
1809 }
1810
1811 /*
1812 * VOID
1813 * NdisQueryBuffer(
1814 * IN PNDIS_BUFFER Buffer,
1815 * OUT PVOID *VirtualAddress OPTIONAL,
1816 * OUT PUINT Length)
1817 */
1818 #define NdisQueryBuffer(Buffer, \
1819 VirtualAddress, \
1820 Length) \
1821 { \
1822 if (ARGUMENT_PRESENT(VirtualAddress)) \
1823 *((PVOID*)VirtualAddress) = MmGetSystemAddressForMdl(Buffer); \
1824 \
1825 *((PUINT)Length) = MmGetMdlByteCount(Buffer); \
1826 }
1827
1828
1829 /*
1830 * VOID
1831 * NdisQueryBufferOffset(
1832 * IN PNDIS_BUFFER Buffer,
1833 * OUT PUINT Offset,
1834 * OUT PUINT Length);
1835 */
1836 #define NdisQueryBufferOffset(Buffer, \
1837 Offset, \
1838 Length) \
1839 { \
1840 *((PUINT)Offset) = MmGetMdlByteOffset(Buffer); \
1841 *((PUINT)Length) = MmGetMdlByteCount(Buffer); \
1842 }
1843
1844 #endif /* BINARY_COMPATIBLE */
1845
1846 /*
1847 * PVOID
1848 * NDIS_BUFFER_LINKAGE(
1849 * IN PNDIS_BUFFER Buffer);
1850 */
1851 #define NDIS_BUFFER_LINKAGE(Buffer)(Buffer)->Next;
1852
1853
1854 /*
1855 * VOID
1856 * NdisChainBufferAtBack(
1857 * IN OUT PNDIS_PACKET Packet,
1858 * IN OUT PNDIS_BUFFER Buffer)
1859 */
1860 #define NdisChainBufferAtBack(Packet, \
1861 Buffer) \
1862 { \
1863 PNDIS_BUFFER NdisBuffer = (Buffer); \
1864 \
1865 while (NdisBuffer->Next != NULL) \
1866 NdisBuffer = NdisBuffer->Next; \
1867 \
1868 NdisBuffer->Next = NULL; \
1869 \
1870 if ((Packet)->Private.Head != NULL) \
1871 (Packet)->Private.Tail->Next = (Buffer); \
1872 else \
1873 (Packet)->Private.Head = (Buffer); \
1874 \
1875 (Packet)->Private.Tail = NdisBuffer; \
1876 (Packet)->Private.ValidCounts = FALSE; \
1877 }
1878
1879
1880 /*
1881 * VOID
1882 * NdisChainBufferAtFront(
1883 * IN OUT PNDIS_PACKET Packet,
1884 * IN OUT PNDIS_BUFFER Buffer)
1885 */
1886 #define NdisChainBufferAtFront(Packet, \
1887 Buffer) \
1888 { \
1889 PNDIS_BUFFER _NdisBuffer = (Buffer); \
1890 \
1891 while (_NdisBuffer->Next != NULL) \
1892 _NdisBuffer = _NdisBuffer->Next; \
1893 \
1894 if ((Packet)->Private.Head == NULL) \
1895 (Packet)->Private.Tail = _NdisBuffer; \
1896 \
1897 _NdisBuffer->Next = (Packet)->Private.Head; \
1898 (Packet)->Private.Head = (Buffer); \
1899 (Packet)->Private.ValidCounts = FALSE; \
1900 }
1901
1902
1903 /*
1904 * VOID
1905 * NdisGetNextBuffer(
1906 * IN PNDIS_BUFFER CurrentBuffer,
1907 * OUT PNDIS_BUFFER * NextBuffer)
1908 */
1909 #define NdisGetNextBuffer(CurrentBuffer, \
1910 NextBuffer) \
1911 { \
1912 *(NextBuffer) = (CurrentBuffer)->Next; \
1913 }
1914
1915
1916 /*
1917 * UINT
1918 * NdisGetPacketFlags(
1919 * IN PNDIS_PACKET Packet);
1920 */
1921 #define NdisGetPacketFlags(Packet)(Packet)->Private.Flags;
1922
1923
1924 /*
1925 * VOID
1926 * NdisClearPacketFlags(
1927 * IN PNDIS_PACKET Packet,
1928 * IN UINT Flags);
1929 */
1930 #define NdisClearPacketFlags(Packet, Flags) \
1931 (Packet)->Private.Flags &= ~(Flags)
1932
1933
1934 /*
1935 * VOID
1936 * NDIS_GET_PACKET_MEDIA_SPECIFIC_INFO(
1937 * IN PNDIS_PACKET Packet,
1938 * IN PPVOID pMediaSpecificInfo,
1939 * IN PUINT pSizeMediaSpecificInfo);
1940 */
1941 #define NDIS_GET_PACKET_MEDIA_SPECIFIC_INFO(_Packet, \
1942 _pMediaSpecificInfo, \
1943 _pSizeMediaSpecificInfo) \
1944 { \
1945 if (!((_Packet)->Private.NdisPacketFlags & fPACKET_ALLOCATED_BY_NDIS) || \
1946 !((_Packet)->Private.NdisPacketFlags & fPACKET_CONTAINS_MEDIA_SPECIFIC_INFO)) \
1947 { \
1948 *(_pMediaSpecificInfo) = NULL; \
1949 *(_pSizeMediaSpecificInfo) = 0; \
1950 } \
1951 else \
1952 { \
1953 *(_pMediaSpecificInfo) = ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
1954 (_Packet)->Private.NdisPacketOobOffset))->MediaSpecificInformation; \
1955 *(_pSizeMediaSpecificInfo) = ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
1956 (_Packet)->Private.NdisPacketOobOffset))->SizeMediaSpecificInfo; \
1957 } \
1958 }
1959
1960
1961 /*
1962 * ULONG
1963 * NDIS_GET_PACKET_PROTOCOL_TYPE(
1964 * IN PNDIS_PACKET Packet);
1965 */
1966 #define NDIS_GET_PACKET_PROTOCOL_TYPE(_Packet) \
1967 ((_Packet)->Private.Flags & NDIS_PROTOCOL_ID_MASK)
1968
1969 /*
1970 * ULONG
1971 * NDIS_GET_PACKET_HEADER_SIZE(
1972 * IN PNDIS_PACKET Packet);
1973 */
1974 #define NDIS_GET_PACKET_HEADER_SIZE(_Packet) \
1975 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
1976 (_Packet)->Private.NdisPacketOobOffset))->HeaderSize
1977
1978
1979 /*
1980 * NDIS_STATUS
1981 * NDIS_GET_PACKET_STATUS(
1982 * IN PNDIS_PACKET Packet);
1983 */
1984 #define NDIS_GET_PACKET_STATUS(_Packet) \
1985 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
1986 (_Packet)->Private.NdisPacketOobOffset))->Status
1987
1988
1989 /*
1990 * ULONGLONG
1991 * NDIS_GET_PACKET_TIME_RECEIVED(
1992 * IN PNDIS_PACKET Packet);
1993 */
1994 #define NDIS_GET_PACKET_TIME_RECEIVED(_Packet) \
1995 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
1996 (_Packet)->Private.NdisPacketOobOffset))->TimeReceived
1997
1998
1999 /*
2000 * ULONGLONG
2001 * NDIS_GET_PACKET_TIME_SENT(
2002 * IN PNDIS_PACKET Packet);
2003 */
2004 #define NDIS_GET_PACKET_TIME_SENT(_Packet) \
2005 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
2006 (_Packet)->Private.NdisPacketOobOffset))->TimeSent
2007
2008
2009 /*
2010 * ULONGLONG
2011 * NDIS_GET_PACKET_TIME_TO_SEND(
2012 * IN PNDIS_PACKET Packet);
2013 */
2014 #define NDIS_GET_PACKET_TIME_TO_SEND(_Packet) \
2015 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
2016 (_Packet)->Private.NdisPacketOobOffset))->TimeToSend
2017
2018
2019 /*
2020 * PNDIS_PACKET_OOB_DATA
2021 * NDIS_OOB_DATA_FROM_PACKET(
2022 * IN PNDIS_PACKET Packet);
2023 */
2024 #define NDIS_OOB_DATA_FROM_PACKET(_Packet) \
2025 (PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
2026 (_Packet)->Private.NdisPacketOobOffset)
2027
2028
2029 /*
2030 * VOID
2031 * NdisQueryPacket(
2032 * IN PNDIS_PACKET Packet,
2033 * OUT PUINT PhysicalBufferCount OPTIONAL,
2034 * OUT PUINT BufferCount OPTIONAL,
2035 * OUT PNDIS_BUFFER *FirstBuffer OPTIONAL,
2036 * OUT PUINT TotalPacketLength OPTIONAL);
2037 */
2038 static __inline
2039 VOID
2040 NdisQueryPacket(
2041 IN PNDIS_PACKET Packet,
2042 OUT PUINT PhysicalBufferCount OPTIONAL,
2043 OUT PUINT BufferCount OPTIONAL,
2044 OUT PNDIS_BUFFER *FirstBuffer OPTIONAL,
2045 OUT PUINT TotalPacketLength OPTIONAL)
2046 {
2047 if (FirstBuffer)
2048 *FirstBuffer = Packet->Private.Head;
2049 if (TotalPacketLength || BufferCount || PhysicalBufferCount)
2050 {
2051 if (!Packet->Private.ValidCounts)
2052 {
2053 UINT Offset;
2054 UINT PacketLength;
2055 PNDIS_BUFFER NdisBuffer;
2056 UINT PhysicalBufferCount = 0;
2057 UINT TotalPacketLength = 0;
2058 UINT Count = 0;
2059
2060 for (NdisBuffer = Packet->Private.Head;
2061 NdisBuffer != (PNDIS_BUFFER)NULL;
2062 NdisBuffer = NdisBuffer->Next)
2063 {
2064 PhysicalBufferCount += NDIS_BUFFER_TO_SPAN_PAGES(NdisBuffer);
2065 NdisQueryBufferOffset(NdisBuffer, &Offset, &PacketLength);
2066 TotalPacketLength += PacketLength;
2067 Count++;
2068 }
2069 Packet->Private.PhysicalCount = PhysicalBufferCount;
2070 Packet->Private.TotalLength = TotalPacketLength;
2071 Packet->Private.Count = Count;
2072 Packet->Private.ValidCounts = TRUE;
2073 }
2074
2075 if (PhysicalBufferCount)
2076 *PhysicalBufferCount = Packet->Private.PhysicalCount;
2077
2078 if (BufferCount)
2079 *BufferCount = Packet->Private.Count;
2080
2081 if (TotalPacketLength)
2082 *TotalPacketLength = Packet->Private.TotalLength;
2083 }
2084 }
2085
2086 /*
2087 * VOID
2088 * NdisQueryPacketLength(
2089 * IN PNDIS_PACKET Packet,
2090 * OUT PUINT PhysicalBufferCount OPTIONAL,
2091 * OUT PUINT BufferCount OPTIONAL,
2092 * OUT PNDIS_BUFFER *FirstBuffer OPTIONAL,
2093 * OUT PUINT TotalPacketLength OPTIONAL);
2094 */
2095 #define NdisQueryPacketLength(Packet, \
2096 TotalPacketLength) \
2097 { \
2098 if ((TotalPacketLength)) \
2099 { \
2100 if (!(Packet)->Private.ValidCounts) { \
2101 UINT _Offset; \
2102 UINT _PacketLength; \
2103 PNDIS_BUFFER _NdisBuffer; \
2104 UINT _PhysicalBufferCount = 0; \
2105 UINT _TotalPacketLength = 0; \
2106 UINT _Count = 0; \
2107 \
2108 for (_NdisBuffer = (Packet)->Private.Head; \
2109 _NdisBuffer != (PNDIS_BUFFER)NULL; \
2110 _NdisBuffer = _NdisBuffer->Next) \
2111 { \
2112 _PhysicalBufferCount += NDIS_BUFFER_TO_SPAN_PAGES(_NdisBuffer); \
2113 NdisQueryBufferOffset(_NdisBuffer, &_Offset, &_PacketLength); \
2114 _TotalPacketLength += _PacketLength; \
2115 _Count++; \
2116 } \
2117 (Packet)->Private.PhysicalCount = _PhysicalBufferCount; \
2118 (Packet)->Private.TotalLength = _TotalPacketLength; \
2119 (Packet)->Private.Count = _Count; \
2120 (Packet)->Private.ValidCounts = TRUE; \
2121 } \
2122 \
2123 if (TotalPacketLength) \
2124 *((PUINT)TotalPacketLength) = (Packet)->Private.TotalLength; \
2125 } \
2126 }
2127
2128
2129 /*
2130 * VOID
2131 * NdisRecalculatePacketCounts(
2132 * IN OUT PNDIS_PACKET Packet);
2133 */
2134 #define NdisRecalculatePacketCounts(Packet) \
2135 { \
2136 PNDIS_BUFFER _Buffer = (Packet)->Private.Head; \
2137 if (_Buffer != NULL) \
2138 { \
2139 while (_Buffer->Next != NULL) \
2140 { \
2141 ยด_Buffer = _Buffer->Next; \
2142 } \
2143 (Packet)->Private.Tail = _Buffer; \
2144 } \
2145 (Packet)->Private.ValidCounts = FALSE; \
2146 }
2147
2148
2149 /*
2150 * VOID
2151 * NdisReinitializePacket(
2152 * IN OUT PNDIS_PACKET Packet);
2153 */
2154 #define NdisReinitializePacketCounts(Packet) \
2155 { \
2156 (Packet)->Private.Head = (PNDIS_BUFFER)NULL; \
2157 (Packet)->Private.ValidCounts = FALSE; \
2158 }
2159
2160
2161 /*
2162 * VOID
2163 * NdisSetPacketFlags(
2164 * IN PNDIS_PACKET Packet,
2165 * IN UINT Flags);
2166 */
2167 #define NdisSetPacketFlags(Packet, Flags) \
2168 (Packet)->Private.Flags |= (Flags);
2169
2170
2171 /*
2172 * VOID
2173 * NDIS_SET_PACKET_HEADER_SIZE(
2174 * IN PNDIS_PACKET Packet,
2175 * IN UINT HdrSize);
2176 */
2177 #define NDIS_SET_PACKET_HEADER_SIZE(_Packet, _HdrSize) \
2178 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
2179 (_Packet)->Private.NdisPacketOobOffset))->HeaderSize = (_HdrSize)
2180
2181
2182 /*
2183 * VOID
2184 * NDIS_SET_PACKET_MEDIA_SPECIFIC_INFO(
2185 * IN PNDIS_PACKET Packet,
2186 * IN PVOID MediaSpecificInfo,
2187 * IN UINT SizeMediaSpecificInfo);
2188 */
2189 #define NDIS_SET_PACKET_MEDIA_SPECIFIC_INFO(_Packet, \
2190 _MediaSpecificInfo, \
2191 _SizeMediaSpecificInfo) \
2192 { \
2193 if ((_Packet)->Private.NdisPacketFlags & fPACKET_ALLOCATED_BY_NDIS) \
2194 { \
2195 (_Packet)->Private.NdisPacketFlags |= fPACKET_CONTAINS_MEDIA_SPECIFIC_INFO; \
2196 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
2197 (_Packet)->Private.NdisPacketOobOffset))->MediaSpecificInformation = \
2198 (_MediaSpecificInfo); \
2199 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
2200 (_Packet)->Private.NdisPacketOobOffset))->SizeMediaSpecificInfo = \
2201 (_SizeMediaSpecificInfo); \
2202 } \
2203 }
2204
2205
2206 /*
2207 * VOID
2208 * NDIS_SET_PACKET_STATUS(
2209 * IN PNDIS_PACKET Packet,
2210 * IN NDIS_STATUS Status);
2211 */
2212 #define NDIS_SET_PACKET_STATUS(_Packet, _Status) \
2213 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
2214 (_Packet)->Private.NdisPacketOobOffset))->Status = (_Status)
2215
2216
2217 /*
2218 * VOID
2219 * NDIS_SET_PACKET_TIME_RECEIVED(
2220 * IN PNDIS_PACKET Packet,
2221 * IN ULONGLONG TimeReceived);
2222 */
2223 #define NDIS_SET_PACKET_TIME_RECEIVED(_Packet, _TimeReceived) \
2224 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
2225 (_Packet)->Private.NdisPacketOobOffset))->TimeReceived = (_TimeReceived)
2226
2227
2228 /*
2229 * VOID
2230 * NDIS_SET_PACKET_TIME_SENT(
2231 * IN PNDIS_PACKET Packet,
2232 * IN ULONGLONG TimeSent);
2233 */
2234 #define NDIS_SET_PACKET_TIME_SENT(_Packet, _TimeSent) \
2235 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
2236 (_Packet)->Private.NdisPacketOobOffset))->TimeSent = (_TimeSent)
2237
2238
2239 /*
2240 * VOID
2241 * NDIS_SET_PACKET_TIME_TO_SEND(
2242 * IN PNDIS_PACKET Packet,
2243 * IN ULONGLONG TimeToSend);
2244 */
2245 #define NDIS_SET_PACKET_TIME_TO_SEND(_Packet, _TimeToSend) \
2246 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
2247 (_Packet)->Private.NdisPacketOobOffset))->TimeToSend = (_TimeToSend)
2248
2249
2250 /*
2251 * VOID
2252 * NdisSetSendFlags(
2253 * IN PNDIS_PACKET Packet,
2254 * IN UINT Flags);
2255 */
2256 #define NdisSetSendFlags(_Packet,_Flags)(_Packet)->Private.Flags = (_Flags)
2257
2258
2259
2260 /* Memory management routines */
2261
2262 #if BINARY_COMPATIBLE
2263
2264 NDISAPI
2265 VOID
2266 DDKAPI
2267 NdisCreateLookaheadBufferFromSharedMemory(
2268 IN PVOID pSharedMemory,
2269 IN UINT LookaheadLength,
2270 OUT PVOID *pLookaheadBuffer);
2271
2272 NDISAPI
2273 VOID
2274 DDKAPI
2275 NdisDestroyLookaheadBufferFromSharedMemory(
2276 IN PVOID pLookaheadBuffer);
2277
2278 #else
2279
2280 /*
2281 * VOID
2282 * NdisCreateLookaheadBufferFromSharedMemory(
2283 * IN PVOID pSharedMemory,
2284 * IN UINT LookaheadLength,
2285 * OUT PVOID *pLookaheadBuffer)
2286 */
2287 #define NdisCreateLookaheadBufferFromSharedMemory(_pSharedMemory, \
2288 _LookaheadLength, \
2289 _pLookaheadBuffer) \
2290 ((*(_pLookaheadBuffer)) = (_pSharedMemory))
2291
2292 /*
2293 * VOID
2294 * NdisDestroyLookaheadBufferFromSharedMemory(
2295 * IN PVOID pLookaheadBuffer)
2296 */
2297 #define NdisDestroyLookaheadBufferFromSharedMemory(_pLookaheadBuffer)
2298
2299 #endif
2300
2301 #if defined(_M_IX86) || defined(_M_AMD64) || defined(_M_ARM) || defined(_M_PPC)
2302
2303 /*
2304 * VOID
2305 * NdisMoveMappedMemory(
2306 * OUT PVOID Destination,
2307 * IN PVOID Source,
2308 * IN ULONG Length);
2309 */
2310 #define NdisMoveMappedMemory(Destination, Source, Length) \
2311 RtlCopyMemory(Destination, Source, Length)
2312
2313 /*
2314 * VOID
2315 * NdisZeroMappedMemory(
2316 * IN PVOID Destination,
2317 * IN ULONG Length);
2318 */
2319 #define NdisZeroMappedMemory(Destination, Length) \
2320 RtlZeroMemory(Destination, Length)
2321
2322 #else
2323
2324 #define NdisMoveMappedMemory(Destination, Source, Length) \
2325 { \
2326 PUCHAR _Dest = Destination, _Src = Source, _End = _Dest + Length; \
2327 while (_Dest < _End) \
2328 *_Dest++ = _Src++; \
2329 }
2330
2331 #define NdisZeroMappedMemory(Destination, Length) \
2332 { \
2333 PUCHAR _Dest = Destination, _End = _Dest + Length; \
2334 while (_Dest < _End) \
2335 *_Dest++ = 0; \
2336 }
2337
2338 #endif /* _M_IX86 or _M_AMD64 */
2339
2340 /*
2341 * VOID
2342 * NdisMoveFromMappedMemory(
2343 * OUT PVOID Destination,
2344 * IN PVOID Source,
2345 * IN ULONG Length);
2346 */
2347 #define NdisMoveFromMappedMemory(Destination, Source, Length) \
2348 NdisMoveMappedMemory(Destination, Source, Length)
2349
2350 /*
2351 * VOID
2352 * NdisMoveToMappedMemory(
2353 * OUT PVOID Destination,
2354 * IN PVOID Source,
2355 * IN ULONG Length);
2356 */
2357 #define NdisMoveToMappedMemory(Destination, Source, Length) \
2358 NdisMoveMappedMemory(Destination, Source, Length)
2359
2360 /*
2361 * VOID
2362 * NdisMUpdateSharedMemory(
2363 * IN NDIS_HANDLE MiniportAdapterHandle,
2364 * IN ULONG Length,
2365 * IN PVOID VirtualAddress,
2366 * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress);
2367 */
2368 #define NdisMUpdateSharedMemory(_H, _L, _V, _P) \
2369 NdisUpdateSharedMemory(_H, _L, _V, _P)
2370
2371 NDISAPI
2372 NDIS_STATUS
2373 DDKAPI
2374 NdisAllocateMemory(
2375 OUT PVOID *VirtualAddress,
2376 IN UINT Length,
2377 IN UINT MemoryFlags,
2378 IN NDIS_PHYSICAL_ADDRESS HighestAcceptableAddress);
2379
2380 NDISAPI
2381 VOID
2382 DDKAPI
2383 NdisFreeMemory(
2384 IN PVOID VirtualAddress,
2385 IN UINT Length,
2386 IN UINT MemoryFlags);
2387
2388 NDISAPI
2389 VOID
2390 DDKAPI
2391 NdisImmediateReadSharedMemory(
2392 IN NDIS_HANDLE WrapperConfigurationContext,
2393 IN ULONG SharedMemoryAddress,
2394 OUT PUCHAR Buffer,
2395 IN ULONG Length);
2396
2397 NDISAPI
2398 VOID
2399 DDKAPI
2400 NdisImmediateWriteSharedMemory(
2401 IN NDIS_HANDLE WrapperConfigurationContext,
2402 IN ULONG SharedMemoryAddress,
2403 IN PUCHAR Buffer,
2404 IN ULONG Length);
2405
2406 NDISAPI
2407 VOID
2408 DDKAPI
2409 NdisMAllocateSharedMemory(
2410 IN NDIS_HANDLE MiniportAdapterHandle,
2411 IN ULONG Length,
2412 IN BOOLEAN Cached,
2413 OUT PVOID *VirtualAddress,
2414 OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress);
2415
2416 NDISAPI
2417 NDIS_STATUS
2418 DDKAPI
2419 NdisMAllocateSharedMemoryAsync(
2420 IN NDIS_HANDLE MiniportAdapterHandle,
2421 IN ULONG Length,
2422 IN BOOLEAN Cached,
2423 IN PVOID Context);
2424
2425 #if defined(NDIS50)
2426
2427 #define NdisUpdateSharedMemory(NdisAdapterHandle, \
2428 Length, \
2429 VirtualAddress, \
2430 PhysicalAddress)
2431
2432 #else
2433
2434 NDISAPI
2435 VOID
2436 DDKAPI
2437 NdisUpdateSharedMemory(
2438 IN NDIS_HANDLE NdisAdapterHandle,
2439 IN ULONG Length,
2440 IN PVOID VirtualAddress,
2441 IN NDIS_PHYSICAL_ADDRESS PhysicalAddress);
2442
2443 #endif /* defined(NDIS50) */
2444
2445 /*
2446 * ULONG
2447 * NdisGetPhysicalAddressHigh(
2448 * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress);
2449 */
2450 #define NdisGetPhysicalAddressHigh(PhysicalAddress) \
2451 ((PhysicalAddress).HighPart)
2452
2453 /*
2454 * VOID
2455 * NdisSetPhysicalAddressHigh(
2456 * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress,
2457 * IN ULONG Value);
2458 */
2459 #define NdisSetPhysicalAddressHigh(PhysicalAddress, Value) \
2460 ((PhysicalAddress).HighPart) = (Value)
2461
2462 /*
2463 * ULONG
2464 * NdisGetPhysicalAddressLow(
2465 * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress);
2466 */
2467 #define NdisGetPhysicalAddressLow(PhysicalAddress) \
2468 ((PhysicalAddress).LowPart)
2469
2470
2471 /*
2472 * VOID
2473 * NdisSetPhysicalAddressLow(
2474 * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress,
2475 * IN ULONG Value);
2476 */
2477 #define NdisSetPhysicalAddressLow(PhysicalAddress, Value) \
2478 ((PhysicalAddress).LowPart) = (Value)
2479
2480 /*
2481 * VOID
2482 * NDIS_PHYSICAL_ADDRESS_CONST(
2483 * IN ULONG Low,
2484 * IN LONG High);
2485 */
2486 #define NDIS_PHYSICAL_ADDRESS_CONST(Low, High) \
2487 { {(ULONG)(Low), (LONG)(High)} }
2488
2489 /*
2490 * ULONG
2491 * NdisEqualMemory(
2492 * IN CONST VOID *Source1,
2493 * IN CONST VOID *Source2,
2494 * IN ULONG Length);
2495 */
2496 #define NdisEqualMemory(Source1, Source2, Length) \
2497 RtlEqualMemory(Source1, Source2, Length)
2498
2499 /*
2500 * VOID
2501 * NdisFillMemory(
2502 * IN PVOID Destination,
2503 * IN ULONG Length,
2504 * IN UCHAR Fill);
2505 */
2506 #define NdisFillMemory(Destination, Length, Fill) \
2507 RtlFillMemory(Destination, Length, Fill)
2508
2509 /*
2510 * VOID
2511 * NdisMoveMemory(
2512 * OUT PVOID Destination,
2513 * IN PVOID Source,
2514 * IN ULONG Length);
2515 */
2516 #define NdisMoveMemory(Destination, Source, Length) \
2517 RtlCopyMemory(Destination, Source, Length)
2518
2519
2520 /*
2521 * VOID
2522 * NdisRetrieveUlong(
2523 * IN PULONG DestinationAddress,
2524 * IN PULONG SourceAddress);
2525 */
2526 #define NdisRetrieveUlong(DestinationAddress, SourceAddress) \
2527 RtlRetrieveUlong(DestinationAddress, SourceAddress)
2528
2529
2530 /*
2531 * VOID
2532 * NdisStoreUlong(
2533 * IN PULONG DestinationAddress,
2534 * IN ULONG Value);
2535 */
2536 #define NdisStoreUlong(DestinationAddress, Value) \
2537 RtlStoreUlong(DestinationAddress, Value)
2538
2539
2540 /*
2541 * VOID
2542 * NdisZeroMemory(
2543 * IN PVOID Destination,
2544 * IN ULONG Length)
2545 */
2546 #define NdisZeroMemory(Destination, Length) \
2547 RtlZeroMemory(Destination, Length)
2548
2549
2550
2551 /* Configuration routines */
2552
2553 NDISAPI
2554 VOID
2555 DDKAPI
2556 NdisOpenConfiguration(
2557 OUT PNDIS_STATUS Status,
2558 OUT PNDIS_HANDLE ConfigurationHandle,
2559 IN NDIS_HANDLE WrapperConfigurationContext);
2560
2561 NDISAPI
2562 VOID
2563 DDKAPI
2564 NdisReadNetworkAddress(
2565 OUT PNDIS_STATUS Status,
2566 OUT PVOID *NetworkAddress,
2567 OUT PUINT NetworkAddressLength,
2568 IN NDIS_HANDLE ConfigurationHandle);
2569
2570 NDISAPI
2571 VOID
2572 DDKAPI
2573 NdisReadEisaSlotInformation(
2574 OUT PNDIS_STATUS Status,
2575 IN NDIS_HANDLE WrapperConfigurationContext,
2576 OUT PUINT SlotNumber,
2577 OUT PNDIS_EISA_FUNCTION_INFORMATION EisaData);
2578
2579 NDISAPI
2580 VOID
2581 DDKAPI
2582 NdisReadEisaSlotInformationEx(
2583 OUT PNDIS_STATUS Status,
2584 IN NDIS_HANDLE WrapperConfigurationContext,
2585 OUT PUINT SlotNumber,
2586 OUT PNDIS_EISA_FUNCTION_INFORMATION *EisaData,
2587 OUT PUINT NumberOfFunctions);
2588
2589 NDISAPI
2590 ULONG
2591 DDKAPI
2592 NdisReadPciSlotInformation(
2593 IN NDIS_HANDLE NdisAdapterHandle,
2594 IN ULONG SlotNumber,
2595 IN ULONG Offset,
2596 IN PVOID Buffer,
2597 IN ULONG Length);
2598
2599 NDISAPI
2600 ULONG
2601 DDKAPI
2602 NdisWritePciSlotInformation(
2603 IN NDIS_HANDLE NdisAdapterHandle,
2604 IN ULONG SlotNumber,
2605 IN ULONG Offset,
2606 IN PVOID Buffer,
2607 IN ULONG Length);
2608
2609
2610
2611 /* String management routines */
2612
2613 NDISAPI
2614 NDIS_STATUS
2615 DDKAPI
2616 NdisAnsiStringToUnicodeString(
2617 IN OUT PNDIS_STRING DestinationString,
2618 IN PNDIS_ANSI_STRING SourceString);
2619
2620 /*
2621 * BOOLEAN
2622 * NdisEqualString(
2623 * IN PNDIS_STRING String1,
2624 * IN PNDIS_STRING String2,
2625 * IN BOOLEAN CaseInsensitive);
2626 */
2627 #define NdisEqualString(_String1, _String2, _CaseInsensitive) \
2628 RtlEqualUnicodeString(_String1, _String2, _CaseInsensitive)
2629
2630 NDISAPI
2631 VOID
2632 DDKAPI
2633 NdisInitAnsiString(
2634 IN OUT PNDIS_ANSI_STRING DestinationString,
2635 IN PCSTR SourceString);
2636
2637 NDISAPI
2638 VOID
2639 DDKAPI
2640 NdisInitUnicodeString(
2641 IN OUT PNDIS_STRING DestinationString,
2642 IN PCWSTR SourceString);
2643
2644 NDISAPI
2645 NDIS_STATUS
2646 DDKAPI
2647 NdisUnicodeStringToAnsiString(
2648 IN OUT PNDIS_ANSI_STRING DestinationString,
2649 IN PNDIS_STRING SourceString);
2650
2651 #define NdisFreeString(_s) NdisFreeMemory((_s).Buffer, (_s).MaximumLength, 0)
2652 #define NdisPrintString(_s) DbgPrint("%ls", (_s).Buffer)
2653
2654
2655 /* Spin lock reoutines */
2656
2657 #if BINARY_COMPATIBLE
2658
2659 NDISAPI
2660 VOID
2661 DDKAPI
2662 NdisAllocateSpinLock(
2663 IN PNDIS_SPIN_LOCK SpinLock);
2664
2665 NDISAPI
2666 VOID
2667 DDKAPI
2668 NdisFreeSpinLock(
2669 IN PNDIS_SPIN_LOCK SpinLock);
2670
2671 NDISAPI
2672 VOID
2673 DDKAPI
2674 NdisAcquireSpinLock(
2675 IN PNDIS_SPIN_LOCK SpinLock);
2676
2677 NDISAPI
2678 VOID
2679 DDKAPI
2680 NdisReleaseSpinLock(
2681 IN PNDIS_SPIN_LOCK SpinLock);
2682
2683 NDISAPI
2684 VOID
2685 DDKAPI
2686 NdisDprAcquireSpinLock(
2687 IN PNDIS_SPIN_LOCK SpinLock);
2688
2689 NDISAPI
2690 VOID
2691 DDKAPI
2692 NdisDprReleaseSpinLock(
2693 IN PNDIS_SPIN_LOCK SpinLock);
2694
2695 #else
2696
2697 /*
2698 * VOID
2699 * NdisAllocateSpinLock(
2700 * IN PNDIS_SPIN_LOCK SpinLock);
2701 */
2702 #define NdisAllocateSpinLock(_SpinLock) \
2703 KeInitializeSpinLock(&(_SpinLock)->SpinLock)
2704
2705 /*
2706 * VOID
2707 * NdisFreeSpinLock(
2708 * IN PNDIS_SPIN_LOCK SpinLock);
2709 */
2710 #define NdisFreeSpinLock(_SpinLock)
2711
2712 /*
2713 * VOID
2714 * NdisAcquireSpinLock(
2715 * IN PNDIS_SPIN_LOCK SpinLock);
2716 */
2717 #define NdisAcquireSpinLock(_SpinLock) \
2718 KeAcquireSpinLock(&(_SpinLock)->SpinLock, &(_SpinLock)->OldIrql)
2719
2720 /*
2721 * VOID
2722 * NdisReleaseSpinLock(
2723 * IN PNDIS_SPIN_LOCK SpinLock);
2724 */
2725 #define NdisReleaseSpinLock(_SpinLock) \
2726 KeReleaseSpinLock(&(_SpinLock)->SpinLock, (_SpinLock)->OldIrql)
2727
2728 /*
2729 * VOID
2730 * NdisDprAcquireSpinLock(
2731 * IN PNDIS_SPIN_LOCK SpinLock);
2732 */
2733 #define NdisDprAcquireSpinLock(_SpinLock) \
2734 { \
2735 KeAcquireSpinLockAtDpcLevel(&(_SpinLock)->SpinLock); \
2736 (_SpinLock)->OldIrql = DISPATCH_LEVEL; \
2737 }
2738
2739 /*
2740 * VOID
2741 * NdisDprReleaseSpinLock(
2742 * IN PNDIS_SPIN_LOCK SpinLock);
2743 */
2744 #define NdisDprReleaseSpinLock(_SpinLock) \
2745 KeReleaseSpinLockFromDpcLevel(&(_SpinLock)->SpinLock)
2746
2747 #endif /* BINARY_COMPATIBLE */
2748
2749 /* I/O routines */
2750
2751 /*
2752 * VOID
2753 * NdisRawReadPortBufferUchar(
2754 * IN ULONG Port,
2755 * OUT PUCHAR Buffer,
2756 * IN ULONG Length);
2757 */
2758 #define NdisRawReadPortBufferUchar(Port, Buffer, Length) \
2759 READ_PORT_BUFFER_UCHAR((PUCHAR)(Port), (PUCHAR)(Buffer), (Length))
2760
2761 /*
2762 * VOID
2763 * NdisRawReadPortBufferUlong(
2764 * IN ULONG Port,
2765 * OUT PULONG Buffer,
2766 * IN ULONG Length);
2767 */
2768 #define NdisRawReadPortBufferUlong(Port, Buffer, Length) \
2769 READ_PORT_BUFFER_ULONG((PULONG)(Port), (PULONG)(Buffer), (Length))
2770
2771 /*
2772 * VOID
2773 * NdisRawReadPortBufferUshort(
2774 * IN ULONG Port,
2775 * OUT PUSHORT Buffer,
2776 * IN ULONG Length);
2777 */
2778 #define NdisRawReadPortBufferUshort(Port, Buffer, Length) \
2779 READ_PORT_BUFFER_USHORT((PUSHORT)(Port), (PUSHORT)(Buffer), (Length))
2780
2781
2782 /*
2783 * VOID
2784 * NdisRawReadPortUchar(
2785 * IN ULONG Port,
2786 * OUT PUCHAR Data);
2787 */
2788 #define NdisRawReadPortUchar(Port, Data) \
2789 *(Data) = READ_PORT_UCHAR((PUCHAR)(Port))
2790
2791 /*
2792 * VOID
2793 * NdisRawReadPortUlong(
2794 * IN ULONG Port,
2795 * OUT PULONG Data);
2796 */
2797 #define NdisRawReadPortUlong(Port, Data) \
2798 *(Data) = READ_PORT_ULONG((PULONG)(Port))
2799
2800 /*
2801 * VOID
2802 * NdisRawReadPortUshort(
2803 * IN ULONG Port,
2804 * OUT PUSHORT Data);
2805 */
2806 #define NdisRawReadPortUshort(Port, Data) \
2807 *(Data) = READ_PORT_USHORT((PUSHORT)(Port))
2808
2809
2810 /*
2811 * VOID
2812 * NdisRawWritePortBufferUchar(
2813 * IN ULONG Port,
2814 * IN PUCHAR Buffer,
2815 * IN ULONG Length);
2816 */
2817 #define NdisRawWritePortBufferUchar(Port, Buffer, Length) \
2818 WRITE_PORT_BUFFER_UCHAR((PUCHAR)(Port), (PUCHAR)(Buffer), (Length))
2819
2820 /*
2821 * VOID
2822 * NdisRawWritePortBufferUlong(
2823 * IN ULONG Port,
2824 * IN PULONG Buffer,
2825 * IN ULONG Length);
2826 */
2827 #define NdisRawWritePortBufferUlong(Port, Buffer, Length) \
2828 WRITE_PORT_BUFFER_ULONG((PULONG)(Port), (PULONG)(Buffer), (Length))
2829
2830 /*
2831 * VOID
2832 * NdisRawWritePortBufferUshort(
2833 * IN ULONG Port,
2834 * IN PUSHORT Buffer,
2835 * IN ULONG Length);
2836 */
2837 #define NdisRawWritePortBufferUshort(Port, Buffer, Length) \
2838 WRITE_PORT_BUFFER_USHORT((PUSHORT)(Port), (PUSHORT)(Buffer), (Length))
2839
2840
2841 /*
2842 * VOID
2843 * NdisRawWritePortUchar(
2844 * IN ULONG Port,
2845 * IN UCHAR Data);
2846 */
2847 #define NdisRawWritePortUchar(Port, Data) \
2848 WRITE_PORT_UCHAR((PUCHAR)(Port), (UCHAR)(Data))
2849
2850 /*
2851 * VOID
2852 * NdisRawWritePortUlong(
2853 * IN ULONG Port,
2854 * IN ULONG Data);
2855 */
2856 #define NdisRawWritePortUlong(Port, Data) \
2857 WRITE_PORT_ULONG((PULONG)(Port), (ULONG)(Data))
2858
2859 /*
2860 * VOID
2861 * NdisRawWritePortUshort(
2862 * IN ULONG Port,
2863 * IN USHORT Data);
2864 */
2865 #define NdisRawWritePortUshort(Port, Data) \
2866 WRITE_PORT_USHORT((PUSHORT)(Port), (USHORT)(Data))
2867
2868
2869 /*
2870 * VOID
2871 * NdisReadRegisterUchar(
2872 * IN PUCHAR Register,
2873 * OUT PUCHAR Data);
2874 */
2875 #define NdisReadRegisterUchar(Register, Data) \
2876 *(Data) = *(Register)
2877
2878 /*
2879 * VOID
2880 * NdisReadRegisterUlong(
2881 * IN PULONG Register,
2882 * OUT PULONG Data);
2883 */
2884 #define NdisReadRegisterUlong(Register, Data) \
2885 *(Data) = *(Register)
2886
2887 /*
2888 * VOID
2889 * NdisReadRegisterUshort(
2890 * IN PUSHORT Register,
2891 * OUT PUSHORT Data);
2892 */
2893 #define NdisReadRegisterUshort(Register, Data) \
2894 *(Data) = *(Register)
2895
2896 /*
2897 * VOID
2898 * NdisReadRegisterUchar(
2899 * IN PUCHAR Register,
2900 * IN UCHAR Data);
2901 */
2902 #define NdisWriteRegisterUchar(Register, Data) \
2903 WRITE_REGISTER_UCHAR((Register), (Data))
2904
2905 /*
2906 * VOID
2907 * NdisReadRegisterUlong(
2908 * IN PULONG Register,
2909 * IN ULONG Data);
2910 */
2911 #define NdisWriteRegisterUlong(Register, Data) \
2912 WRITE_REGISTER_ULONG((Register), (Data))
2913
2914 /*
2915 * VOID
2916 * NdisReadRegisterUshort(
2917 * IN PUSHORT Register,
2918 * IN USHORT Data);
2919 */
2920 #define NdisWriteRegisterUshort(Register, Data) \
2921 WRITE_REGISTER_USHORT((Register), (Data))
2922
2923
2924 /* Linked lists */
2925
2926 /*
2927 * VOID
2928 * NdisInitializeListHead(
2929 * IN PLIST_ENTRY ListHead);
2930 */
2931 #define NdisInitializeListHead(_ListHead) \
2932 InitializeListHead(_ListHead)
2933
2934 /*
2935 * PLIST_ENTRY
2936 * NdisInterlockedInsertHeadList(
2937 * IN PLIST_ENTRY ListHead,
2938 * IN PLIST_ENTRY ListEntry,
2939 * IN PNDIS_SPIN_LOCK SpinLock);
2940 */
2941 #define NdisInterlockedInsertHeadList(_ListHead, _ListEntry, _SpinLock) \
2942 ExInterlockedInsertHeadList(_ListHead, _ListEntry, &(_SpinLock)->SpinLock)
2943
2944 /*
2945 * PLIST_ENTRY
2946 * NdisInterlockedInsertTailList(
2947 * IN PLIST_ENTRY ListHead,
2948 * IN PLIST_ENTRY ListEntry,
2949 * IN PNDIS_SPIN_LOCK SpinLock);
2950 */
2951 #define NdisInterlockedInsertTailList(_ListHead, _ListEntry, _SpinLock) \
2952 ExInterlockedInsertTailList(_ListHead, _ListEntry, &(_SpinLock)->SpinLock)
2953
2954 /*
2955 * PLIST_ENTRY
2956 * NdisInterlockedRemoveHeadList(
2957 * IN PLIST_ENTRY ListHead,
2958 * IN PNDIS_SPIN_LOCK SpinLock);
2959 */
2960 #define NdisInterlockedRemoveHeadList(_ListHead, _SpinLock) \
2961 ExInterlockedRemoveHeadList(_ListHead, &(_SpinLock)->SpinLock)
2962
2963 /*
2964 * VOID
2965 * NdisInitializeSListHead(
2966 * IN PSLIST_HEADER SListHead);
2967 */
2968 #define NdisInitializeSListHead(SListHead) ExInitializeSListHead(SListHead)
2969
2970 /*
2971 * USHORT NdisQueryDepthSList(
2972 * IN PSLIST_HEADER SListHead);
2973 */
2974 #define NdisQueryDepthSList(SListHead) ExQueryDepthSList(SListHead)
2975
2976
2977
2978 /* Interlocked routines */
2979
2980 /*
2981 * LONG
2982 * NdisInterlockedDecrement(
2983 * IN PLONG Addend);
2984 */
2985 #define NdisInterlockedDecrement(Addend) InterlockedDecrement(Addend)
2986
2987 /*
2988 * LONG
2989 * NdisInterlockedIncrement(
2990 * IN PLONG Addend);
2991 */
2992 #define NdisInterlockedIncrement(Addend) InterlockedIncrement(Addend)
2993
2994 /*
2995 * VOID
2996 * NdisInterlockedAddUlong(
2997 * IN PULONG Addend,
2998 * IN ULONG Increment,
2999 * IN PNDIS_SPIN_LOCK SpinLock);
3000 */
3001 #define NdisInterlockedAddUlong(_Addend, _Increment, _SpinLock) \
3002 ExInterlockedAddUlong(_Addend, _Increment, &(_SpinLock)->SpinLock)
3003
3004
3005
3006 /* Miscellaneous routines */
3007
3008 NDISAPI
3009 VOID
3010 DDKAPI
3011 NdisCloseConfiguration(
3012 IN NDIS_HANDLE ConfigurationHandle);
3013
3014 NDISAPI
3015 VOID
3016 DDKAPI
3017 NdisReadConfiguration(
3018 OUT PNDIS_STATUS Status,
3019 OUT PNDIS_CONFIGURATION_PARAMETER *ParameterValue,
3020 IN NDIS_HANDLE ConfigurationHandle,
3021 IN PNDIS_STRING Keyword,
3022 IN NDIS_PARAMETER_TYPE ParameterType);
3023
3024 NDISAPI
3025 VOID
3026 DDKAPI
3027 NdisWriteConfiguration(
3028 OUT PNDIS_STATUS Status,
3029 IN NDIS_HANDLE WrapperConfigurationContext,
3030 IN PNDIS_STRING Keyword,
3031 IN PNDIS_CONFIGURATION_PARAMETER ParameterValue);
3032
3033 NDISAPI
3034 VOID
3035 DDKCDECLAPI
3036 NdisWriteErrorLogEntry(
3037 IN NDIS_HANDLE NdisAdapterHandle,
3038 IN NDIS_ERROR_CODE ErrorCode,
3039 IN ULONG NumberOfErrorValues,
3040 IN ...);
3041
3042 /*
3043 * VOID
3044 * NdisStallExecution(
3045 * IN UINT MicrosecondsToStall)
3046 */
3047 #define NdisStallExecution KeStallExecutionProcessor
3048
3049 #if BINARY_COMPATIBLE
3050
3051 NDISAPI
3052 VOID
3053 DDKAPI
3054 NdisGetCurrentSystemTime(
3055 IN PLARGE_INTEGER pSystemTime);
3056
3057 #else
3058
3059 /*
3060 * VOID
3061 * NdisGetCurrentSystemTime(
3062 * IN PLARGE_INTEGER pSystemTime);
3063 */
3064 #define NdisGetCurrentSystemTime KeQuerySystemTime
3065
3066 #endif
3067
3068 NDISAPI
3069 CCHAR
3070 DDKAPI
3071 NdisSystemProcessorCount(VOID);
3072
3073 NDISAPI
3074 VOID
3075 DDKAPI
3076 NdisGetCurrentProcessorCpuUsage(
3077 OUT PULONG pCpuUsage);
3078
3079
3080
3081 /* NDIS helper macros */
3082
3083 /*
3084 * VOID
3085 * NDIS_INIT_FUNCTION(FunctionName)
3086 */
3087 #define NDIS_INIT_FUNCTION(FunctionName) \
3088 alloc_text(init, FunctionName)
3089
3090 /*
3091 * VOID
3092 * NDIS_PAGABLE_FUNCTION(FunctionName)
3093 */
3094 #define NDIS_PAGEABLE_FUNCTION(FunctionName) \
3095 alloc_text(page, FunctionName)
3096
3097 #define NDIS_PAGABLE_FUNCTION NDIS_PAGEABLE_FUNCTION
3098
3099
3100 /* NDIS 4.0 extensions */
3101
3102 NDISAPI
3103 VOID
3104 DDKAPI
3105 NdisMFreeSharedMemory(
3106 IN NDIS_HANDLE MiniportAdapterHandle,
3107 IN ULONG Length,
3108 IN BOOLEAN Cached,
3109 IN PVOID VirtualAddress,
3110 IN NDIS_PHYSICAL_ADDRESS PhysicalAddress);
3111
3112 NDISAPI
3113 VOID
3114 DDKAPI
3115 NdisMWanIndicateReceive(
3116 OUT PNDIS_STATUS Status,
3117 IN NDIS_HANDLE MiniportAdapterHandle,
3118 IN NDIS_HANDLE NdisLinkContext,
3119 IN PUCHAR PacketBuffer,
3120 IN UINT PacketSize);
3121
3122 NDISAPI
3123 VOID
3124 DDKAPI
3125 NdisMWanIndicateReceiveComplete(
3126 IN NDIS_HANDLE MiniportAdapterHandle);
3127
3128 NDISAPI
3129 VOID
3130 DDKAPI
3131 NdisMWanSendComplete(
3132 IN NDIS_HANDLE MiniportAdapterHandle,
3133 IN PNDIS_WAN_PACKET Packet,
3134 IN NDIS_STATUS Status);
3135
3136 NDISAPI
3137 NDIS_STATUS
3138 DDKAPI
3139 NdisPciAssignResources(
3140 IN NDIS_HANDLE NdisMacHandle,
3141 IN NDIS_HANDLE NdisWrapperHandle,
3142 IN NDIS_HANDLE WrapperConfigurationContext,
3143 IN ULONG SlotNumber,
3144 OUT PNDIS_RESOURCE_LIST *AssignedResources);
3145
3146
3147 /* NDIS 5.0 extensions */
3148
3149 NDISAPI
3150 VOID
3151 DDKAPI
3152 NdisAcquireReadWriteLock(
3153 IN PNDIS_RW_LOCK Lock,
3154 IN BOOLEAN fWrite,
3155 IN PLOCK_STATE LockState);
3156
3157 NDISAPI
3158 NDIS_STATUS
3159 DDKAPI
3160 NdisAllocateMemoryWithTag(
3161 OUT PVOID *VirtualAddress,
3162 IN UINT Length,
3163 IN ULONG Tag);
3164
3165 NDISAPI
3166 VOID
3167 DDKAPI
3168 NdisAllocatePacketPoolEx(
3169 OUT PNDIS_STATUS Status,
3170 OUT PNDIS_HANDLE PoolHandle,
3171 IN UINT NumberOfDescriptors,
3172 IN UINT NumberOfOverflowDescriptors,
3173 IN UINT ProtocolReservedLength);
3174
3175 NDISAPI
3176 VOID
3177 DDKAPI
3178 NdisCompletePnPEvent(
3179 IN NDIS_STATUS Status,
3180 IN NDIS_HANDLE NdisBindingHandle,
3181 IN PNET_PNP_EVENT NetPnPEvent);
3182
3183 NDISAPI
3184 VOID
3185 DDKAPI
3186 NdisGetCurrentProcessorCounts(
3187 OUT PULONG pIdleCount,
3188 OUT PULONG pKernelAndUser,
3189 OUT PULONG pIndex);
3190
3191 NDISAPI
3192 VOID
3193 DDKAPI
3194 NdisGetDriverHandle(
3195 IN PNDIS_HANDLE NdisBindingHandle,
3196 OUT PNDIS_HANDLE NdisDriverHandle);
3197
3198 NDISAPI
3199 PNDIS_PACKET
3200 DDKAPI
3201 NdisGetReceivedPacket(
3202 IN PNDIS_HANDLE NdisBindingHandle,
3203 IN PNDIS_HANDLE MacContext);
3204
3205 NDISAPI
3206 VOID
3207 DDKAPI
3208 NdisGetSystemUpTime(
3209 OUT PULONG pSystemUpTime);
3210
3211 NDISAPI
3212 VOID
3213 DDKAPI
3214 NdisInitializeReadWriteLock(
3215 IN PNDIS_RW_LOCK Lock);
3216
3217 NDISAPI
3218 NDIS_STATUS
3219 DDKAPI
3220 NdisMDeregisterDevice(
3221 IN NDIS_HANDLE NdisDeviceHandle);
3222
3223 NDISAPI
3224 VOID
3225 DDKAPI
3226 NdisMGetDeviceProperty(
3227 IN NDIS_HANDLE MiniportAdapterHandle,
3228 IN OUT PDEVICE_OBJECT *PhysicalDeviceObject OPTIONAL,
3229 IN OUT PDEVICE_OBJECT *FunctionalDeviceObject OPTIONAL,
3230 IN OUT PDEVICE_OBJECT *NextDeviceObject OPTIONAL,
3231 IN OUT PCM_RESOURCE_LIST *AllocatedResources OPTIONAL,
3232 IN OUT PCM_RESOURCE_LIST *AllocatedResourcesTranslated OPTIONAL);
3233
3234 NDISAPI
3235 NDIS_STATUS
3236 DDKAPI
3237 NdisMInitializeScatterGatherDma(
3238 IN NDIS_HANDLE MiniportAdapterHandle,
3239 IN BOOLEAN Dma64BitAddresses,
3240 IN ULONG MaximumPhysicalMapping);
3241
3242 NDISAPI
3243 NDIS_STATUS
3244 DDKAPI
3245 NdisMPromoteMiniport(
3246 IN NDIS_HANDLE MiniportAdapterHandle);
3247
3248 NDISAPI
3249 NDIS_STATUS
3250 DDKAPI
3251 NdisMQueryAdapterInstanceName(
3252 OUT PNDIS_STRING AdapterInstanceName,
3253 IN NDIS_HANDLE MiniportAdapterHandle);
3254
3255 NDISAPI
3256 NDIS_STATUS
3257 DDKAPI
3258 NdisMRegisterDevice(
3259 IN NDIS_HANDLE NdisWrapperHandle,
3260 IN PNDIS_STRING DeviceName,
3261 IN PNDIS_STRING SymbolicName,
3262 IN PDRIVER_DISPATCH MajorFunctions[],
3263 OUT PDEVICE_OBJECT *pDeviceObject,
3264 OUT NDIS_HANDLE *NdisDeviceHandle);
3265
3266 NDISAPI
3267 VOID
3268 DDKAPI
3269 NdisMRegisterUnloadHandler(
3270 IN NDIS_HANDLE NdisWrapperHandle,
3271 IN PDRIVER_UNLOAD UnloadHandler);
3272
3273 NDISAPI
3274 NDIS_STATUS
3275 DDKAPI
3276 NdisMRemoveMiniport(
3277 IN NDIS_HANDLE MiniportAdapterHandle);
3278
3279 NDISAPI
3280 NDIS_STATUS
3281 DDKAPI
3282 NdisMSetMiniportSecondary(
3283 IN NDIS_HANDLE MiniportAdapterHandle,
3284 IN NDIS_HANDLE PrimaryMiniportAdapterHandle);
3285
3286 NDISAPI
3287 VOID
3288 DDKAPI
3289 NdisOpenConfigurationKeyByIndex(
3290 OUT PNDIS_STATUS Status,
3291 IN NDIS_HANDLE ConfigurationHandle,
3292 IN ULONG Index,
3293 OUT PNDIS_STRING KeyName,
3294 OUT PNDIS_HANDLE KeyHandle);
3295
3296 NDISAPI
3297 VOID
3298 DDKAPI
3299 NdisOpenConfigurationKeyByName(
3300 OUT PNDIS_STATUS Status,
3301 IN NDIS_HANDLE ConfigurationHandle,
3302 IN PNDIS_STRING SubKeyName,
3303 OUT PNDIS_HANDLE SubKeyHandle);
3304
3305 NDISAPI
3306 UINT
3307 DDKAPI
3308 NdisPacketPoolUsage(
3309 IN NDIS_HANDLE PoolHandle);
3310
3311 NDISAPI
3312 NDIS_STATUS
3313 DDKAPI
3314 NdisQueryAdapterInstanceName(
3315 OUT PNDIS_STRING AdapterInstanceName,
3316 IN NDIS_HANDLE NdisBindingHandle);
3317
3318 NDISAPI
3319 ULONG
3320 DDKAPI
3321 NdisReadPcmciaAttributeMemory(
3322 IN NDIS_HANDLE NdisAdapterHandle,
3323 IN ULONG Offset,
3324 IN PVOID Buffer,
3325 IN ULONG Length);
3326
3327 NDISAPI
3328 VOID
3329 DDKAPI
3330 NdisReleaseReadWriteLock(
3331 IN PNDIS_RW_LOCK Lock,
3332 IN PLOCK_STATE LockState);
3333
3334 NDISAPI
3335 NDIS_STATUS
3336 DDKAPI
3337 NdisWriteEventLogEntry(
3338 IN PVOID LogHandle,
3339 IN NDIS_STATUS EventCode,
3340 IN ULONG UniqueEventValue,
3341 IN USHORT NumStrings,
3342 IN PVOID StringsList OPTIONAL,
3343 IN ULONG DataSize,
3344 IN PVOID Data OPTIONAL);
3345
3346 NDISAPI
3347 ULONG
3348 DDKAPI
3349 NdisWritePcmciaAttributeMemory(
3350 IN NDIS_HANDLE NdisAdapterHandle,
3351 IN ULONG Offset,
3352 IN PVOID Buffer,
3353 IN ULONG Length);
3354
3355
3356 /* Connectionless services */
3357
3358 NDISAPI
3359 NDIS_STATUS
3360 DDKAPI
3361 NdisClAddParty(
3362 IN NDIS_HANDLE NdisVcHandle,
3363 IN NDIS_HANDLE ProtocolPartyContext,
3364 IN OUT PCO_CALL_PARAMETERS CallParameters,
3365 OUT PNDIS_HANDLE NdisPartyHandle);
3366
3367 NDISAPI
3368 NDIS_STATUS
3369 DDKAPI
3370 NdisClCloseAddressFamily(
3371 IN NDIS_HANDLE NdisAfHandle);
3372
3373 NDISAPI
3374 NDIS_STATUS
3375 DDKAPI
3376 NdisClCloseCall(
3377 IN NDIS_HANDLE NdisVcHandle,
3378 IN NDIS_HANDLE NdisPartyHandle OPTIONAL,
3379 IN PVOID Buffer OPTIONAL,
3380 IN UINT Size);
3381
3382 NDISAPI
3383 NDIS_STATUS
3384 DDKAPI
3385 NdisClDeregisterSap(
3386 IN NDIS_HANDLE NdisSapHandle);
3387
3388 NDISAPI
3389 NDIS_STATUS
3390 DDKAPI
3391 NdisClDropParty(
3392 IN NDIS_HANDLE NdisPartyHandle,
3393 IN PVOID Buffer OPTIONAL,
3394 IN UINT Size);
3395
3396 NDISAPI
3397 VOID
3398 DDKAPI
3399 NdisClIncomingCallComplete(
3400 IN NDIS_STATUS Status,
3401 IN NDIS_HANDLE NdisVcHandle,
3402 IN PCO_CALL_PARAMETERS CallParameters);
3403
3404 NDISAPI
3405 NDIS_STATUS
3406 DDKAPI
3407 NdisClMakeCall(
3408 IN NDIS_HANDLE NdisVcHandle,
3409 IN OUT PCO_CALL_PARAMETERS CallParameters,
3410 IN NDIS_HANDLE ProtocolPartyContext OPTIONAL,
3411 OUT PNDIS_HANDLE NdisPartyHandle OPTIONAL);
3412
3413 NDISAPI
3414 NDIS_STATUS
3415 DDKAPI
3416 NdisClModifyCallQoS(
3417 IN NDIS_HANDLE NdisVcHandle,
3418 IN PCO_CALL_PARAMETERS CallParameters);
3419
3420
3421 NDISAPI
3422 NDIS_STATUS
3423 DDKAPI
3424 NdisClOpenAddressFamily(
3425 IN NDIS_HANDLE NdisBindingHandle,
3426 IN PCO_ADDRESS_FAMILY AddressFamily,
3427 IN NDIS_HANDLE ProtocolAfContext,
3428 IN PNDIS_CLIENT_CHARACTERISTICS ClCharacteristics,
3429 IN UINT SizeOfClCharacteristics,
3430 OUT PNDIS_HANDLE NdisAfHandle);
3431
3432 NDISAPI
3433 NDIS_STATUS
3434 DDKAPI
3435 NdisClRegisterSap(
3436 IN NDIS_HANDLE NdisAfHandle,
3437 IN NDIS_HANDLE ProtocolSapContext,
3438 IN PCO_SAP Sap,
3439 OUT PNDIS_HANDLE NdisSapHandle);
3440
3441
3442 /* Call Manager services */
3443
3444 NDISAPI
3445 NDIS_STATUS
3446 DDKAPI
3447 NdisCmActivateVc(
3448 IN NDIS_HANDLE NdisVcHandle,
3449 IN OUT PCO_CALL_PARAMETERS CallParameters);
3450
3451 NDISAPI
3452 VOID
3453 DDKAPI
3454 NdisCmAddPartyComplete(
3455 IN NDIS_STATUS Status,
3456 IN NDIS_HANDLE NdisPartyHandle,
3457 IN NDIS_HANDLE CallMgrPartyContext OPTIONAL,
3458 IN PCO_CALL_PARAMETERS CallParameters);
3459
3460 NDISAPI
3461 VOID
3462 DDKAPI
3463 NdisCmCloseAddressFamilyComplete(
3464 IN NDIS_STATUS Status,
3465 IN NDIS_HANDLE NdisAfHandle);
3466
3467 NDISAPI
3468 VOID
3469 DDKAPI
3470 NdisCmCloseCallComplete(
3471 IN NDIS_STATUS Status,
3472 IN NDIS_HANDLE NdisVcHandle,
3473 IN NDIS_HANDLE NdisPartyHandle OPTIONAL);
3474
3475 NDISAPI
3476 NDIS_STATUS
3477 DDKAPI
3478 NdisCmDeactivateVc(
3479 IN NDIS_HANDLE NdisVcHandle);
3480
3481 NDISAPI
3482 VOID
3483 DDKAPI
3484 NdisCmDeregisterSapComplete(
3485 IN NDIS_STATUS Status,
3486 IN NDIS_HANDLE NdisSapHandle);
3487
3488 NDISAPI
3489 VOID
3490 DDKAPI
3491 NdisCmDispatchCallConnected(
3492 IN NDIS_HANDLE NdisVcHandle);
3493
3494 NDISAPI
3495 NDIS_STATUS
3496 DDKAPI
3497 NdisCmDispatchIncomingCall(
3498 IN NDIS_HANDLE NdisSapHandle,
3499 IN NDIS_HANDLE NdisVcHandle,
3500 IN PCO_CALL_PARAMETERS CallParameters);
3501
3502 NDISAPI
3503 VOID
3504 DDKAPI
3505 NdisCmDispatchIncomingCallQoSChange(
3506 IN NDIS_HANDLE NdisVcHandle,
3507 IN PCO_CALL_PARAMETERS CallParameters);
3508
3509 NDISAPI
3510 VOID
3511 DDKAPI
3512 NdisCmDispatchIncomingCloseCall(
3513 IN NDIS_STATUS CloseStatus,
3514 IN NDIS_HANDLE NdisVcHandle,
3515 IN PVOID Buffer OPTIONAL,
3516 IN UINT Size);
3517
3518 NDISAPI
3519 VOID
3520 DDKAPI
3521 NdisCmDispatchIncomingDropParty(
3522 IN NDIS_STATUS DropStatus,
3523 IN NDIS_HANDLE NdisPartyHandle,
3524 IN PVOID Buffer OPTIONAL,
3525 IN UINT Size);
3526
3527 NDISAPI
3528 VOID
3529 DDKAPI
3530 NdisCmDropPartyComplete(
3531 IN NDIS_STATUS Status,
3532 IN NDIS_HANDLE NdisPartyHandle);
3533
3534 NDISAPI
3535 VOID
3536 DDKAPI
3537 NdisCmMakeCallComplete(
3538 IN NDIS_STATUS Status,
3539 IN NDIS_HANDLE NdisVcHandle,
3540 IN NDIS_HANDLE NdisPartyHandle OPTIONAL,
3541 IN NDIS_HANDLE CallMgrPartyContext OPTIONAL,
3542 IN PCO_CALL_PARAMETERS CallParameters);
3543
3544 NDISAPI
3545 VOID
3546 DDKAPI
3547 NdisCmModifyCallQoSComplete(
3548 IN NDIS_STATUS Status,
3549 IN NDIS_HANDLE NdisVcHandle,
3550 IN PCO_CALL_PARAMETERS CallParameters);
3551
3552 NDISAPI
3553 VOID
3554 DDKAPI
3555 NdisCmOpenAddressFamilyComplete(
3556 IN NDIS_STATUS Status,
3557 IN NDIS_HANDLE NdisAfHandle,
3558 IN NDIS_HANDLE CallMgrAfContext);
3559
3560 NDISAPI
3561 NDIS_STATUS
3562 DDKAPI
3563 NdisCmRegisterAddressFamily(
3564 IN NDIS_HANDLE NdisBindingHandle,
3565 IN PCO_ADDRESS_FAMILY AddressFamily,
3566 IN PNDIS_CALL_MANAGER_CHARACTERISTICS CmCharacteristics,
3567 IN UINT SizeOfCmCharacteristics);
3568
3569 NDISAPI
3570 VOID
3571 DDKAPI
3572 NdisCmRegisterSapComplete(
3573 IN NDIS_STATUS Status,
3574 IN NDIS_HANDLE NdisSapHandle,
3575 IN NDIS_HANDLE CallMgrSapContext);
3576
3577
3578 NDISAPI
3579 NDIS_STATUS
3580 DDKAPI
3581 NdisMCmActivateVc(
3582 IN NDIS_HANDLE NdisVcHandle,
3583 IN PCO_CALL_PARAMETERS CallParameters);
3584
3585 NDISAPI
3586 NDIS_STATUS
3587 DDKAPI
3588 NdisMCmCreateVc(
3589 IN NDIS_HANDLE MiniportAdapterHandle,
3590 IN NDIS_HANDLE NdisAfHandle,
3591 IN NDIS_HANDLE MiniportVcContext,
3592 OUT PNDIS_HANDLE NdisVcHandle);
3593
3594 NDISAPI
3595 NDIS_STATUS
3596 DDKAPI
3597 NdisMCmDeactivateVc(
3598 IN NDIS_HANDLE NdisVcHandle);
3599
3600 NDISAPI
3601 NDIS_STATUS
3602 DDKAPI
3603 NdisMCmDeleteVc(
3604 IN NDIS_HANDLE NdisVcHandle);
3605
3606 NDISAPI
3607 NDIS_STATUS
3608 DDKAPI
3609 NdisMCmRegisterAddressFamily(
3610 IN NDIS_HANDLE MiniportAdapterHandle,
3611 IN PCO_ADDRESS_FAMILY AddressFamily,
3612 IN PNDIS_CALL_MANAGER_CHARACTERISTICS CmCharacteristics,
3613 IN UINT SizeOfCmCharacteristics);
3614
3615 NDISAPI
3616 NDIS_STATUS
3617 DDKAPI
3618 NdisMCmRequest(
3619 IN NDIS_HANDLE NdisAfHandle,
3620 IN NDIS_HANDLE NdisVcHandle OPTIONAL,
3621 IN NDIS_HANDLE NdisPartyHandle OPTIONAL,
3622 IN OUT PNDIS_REQUEST NdisRequest);
3623
3624
3625 /* Connection-oriented services */
3626
3627 NDISAPI
3628 NDIS_STATUS
3629 DDKAPI
3630 NdisCoCreateVc(
3631 IN NDIS_HANDLE NdisBindingHandle,
3632 IN NDIS_HANDLE NdisAfHandle OPTIONAL,
3633 IN NDIS_HANDLE ProtocolVcContext,
3634 IN OUT PNDIS_HANDLE NdisVcHandle);
3635
3636 NDISAPI
3637 NDIS_STATUS
3638 DDKAPI
3639 NdisCoDeleteVc(
3640 IN NDIS_HANDLE NdisVcHandle);
3641
3642 NDISAPI
3643 NDIS_STATUS
3644 DDKAPI
3645 NdisCoRequest(
3646 IN NDIS_HANDLE NdisBindingHandle,
3647 IN NDIS_HANDLE NdisAfHandle OPTIONAL,
3648 IN NDIS_HANDLE NdisVcHandle OPTIONAL,
3649 IN NDIS_HANDLE NdisPartyHandle OPTIONAL,
3650 IN OUT PNDIS_REQUEST NdisRequest);
3651
3652 NDISAPI
3653 VOID
3654 DDKAPI
3655 NdisCoRequestComplete(
3656 IN NDIS_STATUS Status,
3657 IN NDIS_HANDLE NdisAfHandle,
3658 IN NDIS_HANDLE NdisVcHandle OPTIONAL,
3659 IN NDIS_HANDLE NdisPartyHandle OPTIONAL,
3660 IN PNDIS_REQUEST NdisRequest);
3661
3662 NDISAPI
3663 VOID
3664 DDKAPI
3665 NdisCoSendPackets(
3666 IN NDIS_HANDLE NdisVcHandle,
3667 IN PPNDIS_PACKET PacketArray,
3668 IN UINT NumberOfPackets);
3669
3670 NDISAPI
3671 VOID
3672 DDKAPI
3673 NdisMCoActivateVcComplete(
3674 IN NDIS_STATUS Status,
3675 IN NDIS_HANDLE NdisVcHandle,
3676 IN PCO_CALL_PARAMETERS CallParameters);
3677
3678 NDISAPI
3679 VOID
3680 DDKAPI
3681 NdisMCoDeactivateVcComplete(
3682 IN NDIS_STATUS Status,
3683 IN NDIS_HANDLE NdisVcHandle);
3684
3685 NDISAPI
3686 VOID
3687 DDKAPI
3688 NdisMCoIndicateReceivePacket(
3689 IN NDIS_HANDLE NdisVcHandle,
3690 IN PPNDIS_PACKET PacketArray,
3691 IN UINT NumberOfPackets);
3692
3693 NDISAPI
3694 VOID
3695 DDKAPI
3696 NdisMCoIndicateStatus(
3697 IN NDIS_HANDLE MiniportAdapterHandle,
3698 IN NDIS_HANDLE NdisVcHandle OPTIONAL,
3699 IN NDIS_STATUS GeneralStatus,
3700 IN PVOID StatusBuffer OPTIONAL,
3701 IN ULONG StatusBufferSize);
3702
3703 NDISAPI
3704 VOID
3705 DDKAPI
3706 NdisMCoReceiveComplete(
3707 IN NDIS_HANDLE MiniportAdapterHandle);
3708
3709 NDISAPI
3710 VOID
3711 DDKAPI
3712 NdisMCoRequestComplete(
3713 IN NDIS_STATUS Status,
3714 IN NDIS_HANDLE MiniportAdapterHandle,
3715 IN PNDIS_REQUEST Request);
3716
3717 NDISAPI
3718 VOID
3719 DDKAPI
3720 NdisMCoSendComplete(
3721 IN NDIS_STATUS Status,
3722 IN NDIS_HANDLE NdisVcHandle,
3723 IN PNDIS_PACKET Packet);
3724
3725
3726 /* NDIS 5.0 extensions for intermediate drivers */
3727
3728 NDISAPI
3729 VOID
3730 DDKAPI
3731 NdisIMAssociateMiniport(
3732 IN NDIS_HANDLE DriverHandle,
3733 IN NDIS_HANDLE ProtocolHandle);
3734
3735 NDISAPI
3736 NDIS_STATUS
3737 DDKAPI
3738 NdisIMCancelInitializeDeviceInstance(
3739 IN NDIS_HANDLE DriverHandle,
3740 IN PNDIS_STRING DeviceInstance);
3741
3742 NDISAPI
3743 VOID
3744 DDKAPI
3745 NdisIMCopySendCompletePerPacketInfo(
3746 IN PNDIS_PACKET DstPacket,
3747 IN PNDIS_PACKET SrcPacket);
3748
3749 NDISAPI
3750 VOID
3751 DDKAPI
3752 NdisIMCopySendPerPacketInfo(
3753 IN PNDIS_PACKET DstPacket,
3754 IN PNDIS_PACKET SrcPacket);
3755
3756 NDISAPI
3757 VOID
3758 DDKAPI
3759 NdisIMDeregisterLayeredMiniport(
3760 IN NDIS_HANDLE DriverHandle);
3761
3762 NDISAPI
3763 NDIS_HANDLE
3764 DDKAPI
3765 NdisIMGetBindingContext(
3766 IN NDIS_HANDLE NdisBindingHandle);
3767
3768 NDISAPI
3769 NDIS_HANDLE
3770 DDKAPI
3771 NdisIMGetDeviceContext(
3772 IN NDIS_HANDLE MiniportAdapterHandle);
3773
3774 NDISAPI
3775 NDIS_STATUS
3776 DDKAPI
3777 NdisIMInitializeDeviceInstanceEx(
3778 IN NDIS_HANDLE DriverHandle,
3779 IN PNDIS_STRING DriverInstance,
3780 IN NDIS_HANDLE DeviceContext OPTIONAL);
3781
3782 NDISAPI
3783 PSINGLE_LIST_ENTRY
3784 DDKAPI
3785 NdisInterlockedPopEntrySList(
3786 IN PSLIST_HEADER ListHead,
3787 IN PKSPIN_LOCK Lock);
3788
3789 NDISAPI
3790 PSINGLE_LIST_ENTRY
3791 DDKAPI
3792 NdisInterlockedPushEntrySList(
3793 IN PSLIST_HEADER ListHead,
3794 IN PSINGLE_LIST_ENTRY ListEntry,
3795 IN PKSPIN_LOCK Lock);
3796
3797 NDISAPI
3798 VOID
3799 DDKAPI
3800 NdisQueryBufferSafe(
3801 IN PNDIS_BUFFER Buffer,
3802 OUT PVOID *VirtualAddress OPTIONAL,
3803 OUT PUINT Length,
3804 IN UINT Priority);
3805
3806 /* Prototypes for NDIS_MINIPORT_CHARACTERISTICS */
3807
3808 typedef BOOLEAN DDKAPI
3809 (*W_CHECK_FOR_HANG_HANDLER)(
3810 IN NDIS_HANDLE MiniportAdapterContext);
3811
3812 typedef VOID DDKAPI
3813 (*W_DISABLE_INTERRUPT_HANDLER)(
3814 IN NDIS_HANDLE MiniportAdapterContext);
3815
3816 typedef VOID DDKAPI
3817 (*W_ENABLE_INTERRUPT_HANDLER)(
3818 IN NDIS_HANDLE MiniportAdapterContext);
3819
3820 typedef VOID DDKAPI
3821 (*W_HALT_HANDLER)(
3822 IN NDIS_HANDLE MiniportAdapterContext);
3823
3824 typedef VOID DDKAPI
3825 (*W_HANDLE_INTERRUPT_HANDLER)(
3826 IN NDIS_HANDLE MiniportAdapterContext);
3827
3828 typedef NDIS_STATUS DDKAPI
3829 (*W_INITIALIZE_HANDLER)(
3830 OUT PNDIS_STATUS OpenErrorStatus,
3831 OUT PUINT SelectedMediumIndex,
3832 IN PNDIS_MEDIUM MediumArray,
3833 IN UINT MediumArraySize,
3834 IN NDIS_HANDLE MiniportAdapterContext,
3835 IN NDIS_HANDLE WrapperConfigurationContext);
3836
3837 typedef VOID DDKAPI
3838 (*W_ISR_HANDLER)(
3839 OUT PBOOLEAN InterruptRecognized,
3840 OUT PBOOLEAN QueueMiniportHandleInterrupt,
3841 IN NDIS_HANDLE MiniportAdapterContext);
3842
3843 typedef NDIS_STATUS DDKAPI
3844 (*W_QUERY_INFORMATION_HANDLER)(
3845 IN NDIS_HANDLE MiniportAdapterContext,
3846 IN NDIS_OID Oid,
3847 IN PVOID InformationBuffer,
3848 IN ULONG InformationBufferLength,
3849 OUT PULONG BytesWritten,
3850 OUT PULONG BytesNeeded);
3851
3852 typedef NDIS_STATUS DDKAPI
3853 (*W_RECONFIGURE_HANDLER)(
3854 OUT PNDIS_STATUS OpenErrorStatus,
3855 IN NDIS_HANDLE MiniportAdapterContext,
3856 IN NDIS_HANDLE WrapperConfigurationContext);
3857
3858 typedef NDIS_STATUS DDKAPI
3859 (*W_RESET_HANDLER)(
3860 OUT PBOOLEAN AddressingReset,
3861 IN NDIS_HANDLE MiniportAdapterContext);
3862
3863 typedef NDIS_STATUS DDKAPI
3864 (*W_SEND_HANDLER)(
3865 IN NDIS_HANDLE MiniportAdapterContext,
3866 IN PNDIS_PACKET Packet,
3867 IN UINT Flags);
3868
3869 typedef NDIS_STATUS DDKAPI
3870 (*WM_SEND_HANDLER)(
3871 IN NDIS_HANDLE MiniportAdapterContext,
3872 IN NDIS_HANDLE NdisLinkHandle,
3873 IN PNDIS_WAN_PACKET Packet);
3874
3875 typedef NDIS_STATUS DDKAPI
3876 (*W_SET_INFORMATION_HANDLER)(
3877 IN NDIS_HANDLE MiniportAdapterContext,
3878 IN NDIS_OID Oid,
3879 IN PVOID InformationBuffer,
3880 IN ULONG InformationBufferLength,
3881 OUT PULONG BytesRead,
3882 OUT PULONG BytesNeeded);
3883
3884 typedef NDIS_STATUS DDKAPI
3885 (*W_TRANSFER_DATA_HANDLER)(
3886 OUT PNDIS_PACKET Packet,
3887 OUT PUINT BytesTransferred,
3888 IN NDIS_HANDLE MiniportAdapterContext,
3889 IN NDIS_HANDLE MiniportReceiveContext,
3890 IN UINT ByteOffset,
3891 IN UINT BytesToTransfer);
3892
3893 typedef NDIS_STATUS DDKAPI
3894 (*WM_TRANSFER_DATA_HANDLER)(
3895 VOID);
3896
3897
3898 /* NDIS structures available only to miniport drivers */
3899
3900 #define NDIS30_MINIPORT_CHARACTERISTICS_S \
3901 UCHAR MajorNdisVersion; \
3902 UCHAR MinorNdisVersion; \
3903 USHORT Filler; \
3904 UINT Reserved; \
3905 W_CHECK_FOR_HANG_HANDLER CheckForHangHandler; \
3906 W_DISABLE_INTERRUPT_HANDLER DisableInterruptHandler; \
3907 W_ENABLE_INTERRUPT_HANDLER EnableInterruptHandler; \
3908 W_HALT_HANDLER HaltHandler; \
3909 W_HANDLE_INTERRUPT_HANDLER HandleInterruptHandler; \
3910 W_INITIALIZE_HANDLER InitializeHandler; \
3911 W_ISR_HANDLER ISRHandler; \
3912 W_QUERY_INFORMATION_HANDLER QueryInformationHandler; \
3913 W_RECONFIGURE_HANDLER ReconfigureHandler; \
3914 W_RESET_HANDLER ResetHandler; \
3915 _ANONYMOUS_UNION union { \
3916 W_SEND_HANDLER SendHandler; \
3917 WM_SEND_HANDLER WanSendHandler; \
3918 } _UNION_NAME(u1); \
3919 W_SET_INFORMATION_HANDLER SetInformationHandler; \