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