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