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