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