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