source: Daodan/MinGW/include/ddk/ndis.h@ 1089

Last change on this file since 1089 was 1046, checked in by alloc, 8 years ago

Daodan: Added Windows MinGW and build batch file

File size: 144.5 KB
Line 
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_ - 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 * NDIS50_MINIPORT - Building NDIS 5.0 miniport driver
27 * NDIS51_MINIPORT - Building NDIS 5.1 miniport driver
28 */
29#ifndef __NDIS_H
30#define __NDIS_H
31
32#if __GNUC__ >=3
33#pragma GCC system_header
34#endif
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40#include "ntddk.h"
41#include "ntddndis.h"
42#include "netpnp.h"
43#include "netevent.h"
44#include <winsock2.h>
45
46#if defined(_NDIS_)
47 #define NDISAPI DECLSPEC_EXPORT
48#else
49 #define NDISAPI DECLSPEC_IMPORT
50#endif
51
52#if defined(NDIS50_MINIPORT)
53#ifndef NDIS50
54#define NDIS50
55#define NDIS_MINIPORT_MAJOR_VERSION 5
56#define NDIS_MINIPORT_MINOR_VERSION 0
57#endif
58#endif /* NDIS50_MINIPORT */
59
60#if defined(NDIS51_MINIPORT)
61#ifndef NDIS51
62#define NDIS51
63#define NDIS_MINIPORT_MAJOR_VERSION 5
64#define NDIS_MINIPORT_MINOR_VERSION 1
65#endif
66#endif /* NDIS51_MINIPORT */
67
68/* NDIS 3.0 is default */
69#if !defined(NDIS30) || !defined(NDIS40) || !defined(NDIS50) || !defined(NDIS51)
70#define NDIS30
71#endif /* !NDIS30 || !NDIS40 || !NDIS50 || !NDIS51 */
72
73#if 1
74/* FIXME: */
75typedef PVOID QUEUED_CLOSE;
76#endif
77
78typedef ULONG NDIS_OID, *PNDIS_OID;
79
80typedef struct _X_FILTER FDDI_FILTER, *PFDDI_FILTER;
81typedef struct _X_FILTER TR_FILTER, *PTR_FILTER;
82typedef struct _X_FILTER NULL_FILTER, *PNULL_FILTER;
83
84typedef struct _REFERENCE {
85 KSPIN_LOCK SpinLock;
86 USHORT ReferenceCount;
87 BOOLEAN Closing;
88} REFERENCE, * PREFERENCE;
89
90
91/* NDIS base types */
92
93typedef struct _NDIS_SPIN_LOCK {
94 KSPIN_LOCK SpinLock;
95 KIRQL OldIrql;
96} NDIS_SPIN_LOCK, * PNDIS_SPIN_LOCK;
97
98typedef struct _NDIS_EVENT {
99 KEVENT Event;
100} NDIS_EVENT, *PNDIS_EVENT;
101
102typedef PVOID NDIS_HANDLE, *PNDIS_HANDLE;
103typedef int NDIS_STATUS, *PNDIS_STATUS;
104
105typedef ANSI_STRING NDIS_ANSI_STRING, *PNDIS_ANSI_STRING;
106typedef UNICODE_STRING NDIS_STRING, *PNDIS_STRING;
107
108typedef MDL NDIS_BUFFER, *PNDIS_BUFFER;
109typedef ULONG NDIS_ERROR_CODE, *PNDIS_ERROR_CODE;
110
111
112/* NDIS_STATUS constants */
113#define NDIS_STATUS_SUCCESS ((NDIS_STATUS)STATUS_SUCCESS)
114#define NDIS_STATUS_PENDING ((NDIS_STATUS)STATUS_PENDING)
115#define NDIS_STATUS_NOT_RECOGNIZED ((NDIS_STATUS)0x00010001L)
116#define NDIS_STATUS_NOT_COPIED ((NDIS_STATUS)0x00010002L)
117#define NDIS_STATUS_NOT_ACCEPTED ((NDIS_STATUS)0x00010003L)
118#define NDIS_STATUS_CALL_ACTIVE ((NDIS_STATUS)0x00010007L)
119#define NDIS_STATUS_ONLINE ((NDIS_STATUS)0x40010003L)
120#define NDIS_STATUS_RESET_START ((NDIS_STATUS)0x40010004L)
121#define NDIS_STATUS_RESET_END ((NDIS_STATUS)0x40010005L)
122#define NDIS_STATUS_RING_STATUS ((NDIS_STATUS)0x40010006L)
123#define NDIS_STATUS_CLOSED ((NDIS_STATUS)0x40010007L)
124#define NDIS_STATUS_WAN_LINE_UP ((NDIS_STATUS)0x40010008L)
125#define NDIS_STATUS_WAN_LINE_DOWN ((NDIS_STATUS)0x40010009L)
126#define NDIS_STATUS_WAN_FRAGMENT ((NDIS_STATUS)0x4001000AL)
127#define NDIS_STATUS_MEDIA_CONNECT ((NDIS_STATUS)0x4001000BL)
128#define NDIS_STATUS_MEDIA_DISCONNECT ((NDIS_STATUS)0x4001000CL)
129#define NDIS_STATUS_HARDWARE_LINE_UP ((NDIS_STATUS)0x4001000DL)
130#define NDIS_STATUS_HARDWARE_LINE_DOWN ((NDIS_STATUS)0x4001000EL)
131#define NDIS_STATUS_INTERFACE_UP ((NDIS_STATUS)0x4001000FL)
132#define NDIS_STATUS_INTERFACE_DOWN ((NDIS_STATUS)0x40010010L)
133#define NDIS_STATUS_MEDIA_BUSY ((NDIS_STATUS)0x40010011L)
134#define NDIS_STATUS_MEDIA_SPECIFIC_INDICATION ((NDIS_STATUS)0x40010012L)
135#define NDIS_STATUS_WW_INDICATION NDIS_STATUS_MEDIA_SPECIFIC_INDICATION
136#define NDIS_STATUS_LINK_SPEED_CHANGE ((NDIS_STATUS)0x40010013L)
137#define NDIS_STATUS_WAN_GET_STATS ((NDIS_STATUS)0x40010014L)
138#define NDIS_STATUS_WAN_CO_FRAGMENT ((NDIS_STATUS)0x40010015L)
139#define NDIS_STATUS_WAN_CO_LINKPARAMS ((NDIS_STATUS)0x40010016L)
140
141#define NDIS_STATUS_NOT_RESETTABLE ((NDIS_STATUS)0x80010001L)
142#define NDIS_STATUS_SOFT_ERRORS ((NDIS_STATUS)0x80010003L)
143#define NDIS_STATUS_HARD_ERRORS ((NDIS_STATUS)0x80010004L)
144#define NDIS_STATUS_BUFFER_OVERFLOW ((NDIS_STATUS)STATUS_BUFFER_OVERFLOW)
145
146#define NDIS_STATUS_FAILURE ((NDIS_STATUS)STATUS_UNSUCCESSFUL)
147#define NDIS_STATUS_RESOURCES ((NDIS_STATUS)STATUS_INSUFFICIENT_RESOURCES)
148#define NDIS_STATUS_CLOSING ((NDIS_STATUS)0xC0010002L)
149#define NDIS_STATUS_BAD_VERSION ((NDIS_STATUS)0xC0010004L)
150#define NDIS_STATUS_BAD_CHARACTERISTICS ((NDIS_STATUS)0xC0010005L)
151#define NDIS_STATUS_ADAPTER_NOT_FOUND ((NDIS_STATUS)0xC0010006L)
152#define NDIS_STATUS_OPEN_FAILED ((NDIS_STATUS)0xC0010007L)
153#define NDIS_STATUS_DEVICE_FAILED ((NDIS_STATUS)0xC0010008L)
154#define NDIS_STATUS_MULTICAST_FULL ((NDIS_STATUS)0xC0010009L)
155#define NDIS_STATUS_MULTICAST_EXISTS ((NDIS_STATUS)0xC001000AL)
156#define NDIS_STATUS_MULTICAST_NOT_FOUND ((NDIS_STATUS)0xC001000BL)
157#define NDIS_STATUS_REQUEST_ABORTED ((NDIS_STATUS)0xC001000CL)
158#define NDIS_STATUS_RESET_IN_PROGRESS ((NDIS_STATUS)0xC001000DL)
159#define NDIS_STATUS_CLOSING_INDICATING ((NDIS_STATUS)0xC001000EL)
160#define NDIS_STATUS_NOT_SUPPORTED ((NDIS_STATUS)STATUS_NOT_SUPPORTED)
161#define NDIS_STATUS_INVALID_PACKET ((NDIS_STATUS)0xC001000FL)
162#define NDIS_STATUS_OPEN_LIST_FULL ((NDIS_STATUS)0xC0010010L)
163#define NDIS_STATUS_ADAPTER_NOT_READY ((NDIS_STATUS)0xC0010011L)
164#define NDIS_STATUS_ADAPTER_NOT_OPEN ((NDIS_STATUS)0xC0010012L)
165#define NDIS_STATUS_NOT_INDICATING ((NDIS_STATUS)0xC0010013L)
166#define NDIS_STATUS_INVALID_LENGTH ((NDIS_STATUS)0xC0010014L)
167#define NDIS_STATUS_INVALID_DATA ((NDIS_STATUS)0xC0010015L)
168#define NDIS_STATUS_BUFFER_TOO_SHORT ((NDIS_STATUS)0xC0010016L)
169#define NDIS_STATUS_INVALID_OID ((NDIS_STATUS)0xC0010017L)
170#define NDIS_STATUS_ADAPTER_REMOVED ((NDIS_STATUS)0xC0010018L)
171#define NDIS_STATUS_UNSUPPORTED_MEDIA ((NDIS_STATUS)0xC0010019L)
172#define NDIS_STATUS_GROUP_ADDRESS_IN_USE ((NDIS_STATUS)0xC001001AL)
173#define NDIS_STATUS_FILE_NOT_FOUND ((NDIS_STATUS)0xC001001BL)
174#define NDIS_STATUS_ERROR_READING_FILE ((NDIS_STATUS)0xC001001CL)
175#define NDIS_STATUS_ALREADY_MAPPED ((NDIS_STATUS)0xC001001DL)
176#define NDIS_STATUS_RESOURCE_CONFLICT ((NDIS_STATUS)0xC001001EL)
177#define NDIS_STATUS_NO_CABLE ((NDIS_STATUS)0xC001001FL)
178
179#define NDIS_STATUS_INVALID_SAP ((NDIS_STATUS)0xC0010020L)
180#define NDIS_STATUS_SAP_IN_USE ((NDIS_STATUS)0xC0010021L)
181#define NDIS_STATUS_INVALID_ADDRESS ((NDIS_STATUS)0xC0010022L)
182#define NDIS_STATUS_VC_NOT_ACTIVATED ((NDIS_STATUS)0xC0010023L)
183#define NDIS_STATUS_DEST_OUT_OF_ORDER ((NDIS_STATUS)0xC0010024L)
184#define NDIS_STATUS_VC_NOT_AVAILABLE ((NDIS_STATUS)0xC0010025L)
185#define NDIS_STATUS_CELLRATE_NOT_AVAILABLE ((NDIS_STATUS)0xC0010026L)
186#define NDIS_STATUS_INCOMPATABLE_QOS ((NDIS_STATUS)0xC0010027L)
187#define NDIS_STATUS_AAL_PARAMS_UNSUPPORTED ((NDIS_STATUS)0xC0010028L)
188#define NDIS_STATUS_NO_ROUTE_TO_DESTINATION ((NDIS_STATUS)0xC0010029L)
189
190#define NDIS_STATUS_TOKEN_RING_OPEN_ERROR ((NDIS_STATUS)0xC0011000L)
191#define NDIS_STATUS_INVALID_DEVICE_REQUEST ((NDIS_STATUS)STATUS_INVALID_DEVICE_REQUEST)
192#define NDIS_STATUS_NETWORK_UNREACHABLE ((NDIS_STATUS)STATUS_NETWORK_UNREACHABLE)
193
194
195/* NDIS error codes for error logging */
196
197#define NDIS_ERROR_CODE_RESOURCE_CONFLICT EVENT_NDIS_RESOURCE_CONFLICT
198#define NDIS_ERROR_CODE_OUT_OF_RESOURCES EVENT_NDIS_OUT_OF_RESOURCE
199#define NDIS_ERROR_CODE_HARDWARE_FAILURE EVENT_NDIS_HARDWARE_FAILURE
200#define NDIS_ERROR_CODE_ADAPTER_NOT_FOUND EVENT_NDIS_ADAPTER_NOT_FOUND
201#define NDIS_ERROR_CODE_INTERRUPT_CONNECT EVENT_NDIS_INTERRUPT_CONNECT
202#define NDIS_ERROR_CODE_DRIVER_FAILURE EVENT_NDIS_DRIVER_FAILURE
203#define NDIS_ERROR_CODE_BAD_VERSION EVENT_NDIS_BAD_VERSION
204#define NDIS_ERROR_CODE_TIMEOUT EVENT_NDIS_TIMEOUT
205#define NDIS_ERROR_CODE_NETWORK_ADDRESS EVENT_NDIS_NETWORK_ADDRESS
206#define NDIS_ERROR_CODE_UNSUPPORTED_CONFIGURATION EVENT_NDIS_UNSUPPORTED_CONFIGURATION
207#define NDIS_ERROR_CODE_INVALID_VALUE_FROM_ADAPTER EVENT_NDIS_INVALID_VALUE_FROM_ADAPTER
208#define NDIS_ERROR_CODE_MISSING_CONFIGURATION_PARAMETER EVENT_NDIS_MISSING_CONFIGURATION_PARAMETER
209#define NDIS_ERROR_CODE_BAD_IO_BASE_ADDRESS EVENT_NDIS_BAD_IO_BASE_ADDRESS
210#define NDIS_ERROR_CODE_RECEIVE_SPACE_SMALL EVENT_NDIS_RECEIVE_SPACE_SMALL
211#define NDIS_ERROR_CODE_ADAPTER_DISABLED EVENT_NDIS_ADAPTER_DISABLED
212
213
214/* Memory allocation flags. Used by Ndis[Allocate|Free]Memory */
215#define NDIS_MEMORY_CONTIGUOUS 0x00000001
216#define NDIS_MEMORY_NONCACHED 0x00000002
217
218/* NIC attribute flags. Used by NdisMSetAttributes(Ex) */
219#define NDIS_ATTRIBUTE_IGNORE_PACKET_TIMEOUT 0x00000001
220#define NDIS_ATTRIBUTE_IGNORE_REQUEST_TIMEOUT 0x00000002
221#define NDIS_ATTRIBUTE_IGNORE_TOKEN_RING_ERRORS 0x00000004
222#define NDIS_ATTRIBUTE_BUS_MASTER 0x00000008
223#define NDIS_ATTRIBUTE_INTERMEDIATE_DRIVER 0x00000010
224#define NDIS_ATTRIBUTE_DESERIALIZE 0x00000020
225#define NDIS_ATTRIBUTE_NO_HALT_ON_SUSPEND 0x00000040
226#define NDIS_ATTRIBUTE_SURPRISE_REMOVE_OK 0x00000080
227#define NDIS_ATTRIBUTE_NOT_CO_NDIS 0x00000100
228#define NDIS_ATTRIBUTE_USES_SAFE_BUFFER_APIS 0x00000200
229
230
231/* Lock */
232
233typedef union _NDIS_RW_LOCK_REFCOUNT {
234 UINT RefCount;
235 UCHAR cacheLine[16];
236} NDIS_RW_LOCK_REFCOUNT;
237
238typedef struct _NDIS_RW_LOCK {
239 union {
240 struct {
241 KSPIN_LOCK SpinLock;
242 PVOID Context;
243 } s;
244 UCHAR Reserved[16];
245 } u;
246
247 NDIS_RW_LOCK_REFCOUNT RefCount[MAXIMUM_PROCESSORS];
248} NDIS_RW_LOCK, *PNDIS_RW_LOCK;
249
250typedef struct _LOCK_STATE {
251 USHORT LockState;
252 KIRQL OldIrql;
253} LOCK_STATE, *PLOCK_STATE;
254
255
256
257/* Timer */
258
259typedef VOID DDKAPI
260(*PNDIS_TIMER_FUNCTION)(
261 /*IN*/ PVOID SystemSpecific1,
262 /*IN*/ PVOID FunctionContext,
263 /*IN*/ PVOID SystemSpecific2,
264 /*IN*/ PVOID SystemSpecific3);
265
266typedef struct _NDIS_TIMER {
267 KTIMER Timer;
268 KDPC Dpc;
269} NDIS_TIMER, *PNDIS_TIMER;
270
271
272
273/* Hardware */
274
275typedef CM_MCA_POS_DATA NDIS_MCA_POS_DATA, *PNDIS_MCA_POS_DATA;
276typedef CM_EISA_SLOT_INFORMATION NDIS_EISA_SLOT_INFORMATION, *PNDIS_EISA_SLOT_INFORMATION;
277typedef CM_EISA_FUNCTION_INFORMATION NDIS_EISA_FUNCTION_INFORMATION, *PNDIS_EISA_FUNCTION_INFORMATION;
278typedef CM_PARTIAL_RESOURCE_LIST NDIS_RESOURCE_LIST, *PNDIS_RESOURCE_LIST;
279
280/* Hardware status codes (OID_GEN_HARDWARE_STATUS) */
281typedef enum _NDIS_HARDWARE_STATUS {
282 NdisHardwareStatusReady,
283 NdisHardwareStatusInitializing,
284 NdisHardwareStatusReset,
285 NdisHardwareStatusClosing,
286 NdisHardwareStatusNotReady
287} NDIS_HARDWARE_STATUS, *PNDIS_HARDWARE_STATUS;
288
289/* OID_GEN_GET_TIME_CAPS */
290typedef struct _GEN_GET_TIME_CAPS {
291 ULONG Flags;
292 ULONG ClockPrecision;
293} GEN_GET_TIME_CAPS, *PGEN_GET_TIME_CAPS;
294
295/* Flag bits */
296#define READABLE_LOCAL_CLOCK 0x00000001
297#define CLOCK_NETWORK_DERIVED 0x00000002
298#define CLOCK_PRECISION 0x00000004
299#define RECEIVE_TIME_INDICATION_CAPABLE 0x00000008
300#define TIMED_SEND_CAPABLE 0x00000010
301#define TIME_STAMP_CAPABLE 0x00000020
302
303/* OID_GEN_GET_NETCARD_TIME */
304typedef struct _GEN_GET_NETCARD_TIME {
305 ULONGLONG ReadTime;
306} GEN_GET_NETCARD_TIME, *PGEN_GET_NETCARD_TIME;
307
308/* NDIS driver medium (OID_GEN_MEDIA_SUPPORTED / OID_GEN_MEDIA_IN_USE) */
309typedef enum _NDIS_MEDIUM {
310 NdisMedium802_3,
311 NdisMedium802_5,
312 NdisMediumFddi,
313 NdisMediumWan,
314 NdisMediumLocalTalk,
315 NdisMediumDix,
316 NdisMediumArcnetRaw,
317 NdisMediumArcnet878_2,
318 NdisMediumAtm,
319 NdisMediumWirelessWan,
320 NdisMediumIrda,
321 NdisMediumBpc,
322 NdisMediumCoWan,
323 NdisMedium1394,
324 NdisMediumMax
325} NDIS_MEDIUM, *PNDIS_MEDIUM;
326
327/* NDIS packet filter bits (OID_GEN_CURRENT_PACKET_FILTER) */
328#define NDIS_PACKET_TYPE_DIRECTED 0x00000001
329#define NDIS_PACKET_TYPE_MULTICAST 0x00000002
330#define NDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004
331#define NDIS_PACKET_TYPE_BROADCAST 0x00000008
332#define NDIS_PACKET_TYPE_SOURCE_ROUTING 0x00000010
333#define NDIS_PACKET_TYPE_PROMISCUOUS 0x00000020
334#define NDIS_PACKET_TYPE_SMT 0x00000040
335#define NDIS_PACKET_TYPE_ALL_LOCAL 0x00000080
336#define NDIS_PACKET_TYPE_GROUP 0x00001000
337#define NDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x00002000
338#define NDIS_PACKET_TYPE_FUNCTIONAL 0x00004000
339#define NDIS_PACKET_TYPE_MAC_FRAME 0x00008000
340
341/* NDIS protocol option bits (OID_GEN_PROTOCOL_OPTIONS) */
342#define NDIS_PROT_OPTION_ESTIMATED_LENGTH 0x00000001
343#define NDIS_PROT_OPTION_NO_LOOPBACK 0x00000002
344#define NDIS_PROT_OPTION_NO_RSVD_ON_RCVPKT 0x00000004
345
346/* NDIS MAC option bits (OID_GEN_MAC_OPTIONS) */
347#define NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA 0x00000001
348#define NDIS_MAC_OPTION_RECEIVE_SERIALIZED 0x00000002
349#define NDIS_MAC_OPTION_TRANSFERS_NOT_PEND 0x00000004
350#define NDIS_MAC_OPTION_NO_LOOPBACK 0x00000008
351#define NDIS_MAC_OPTION_FULL_DUPLEX 0x00000010
352#define NDIS_MAC_OPTION_EOTX_INDICATION 0x00000020
353#define NDIS_MAC_OPTION_8021P_PRIORITY 0x00000040
354#define NDIS_MAC_OPTION_RESERVED 0x80000000
355
356/* State of the LAN media (OID_GEN_MEDIA_CONNECT_STATUS) */
357typedef enum _NDIS_MEDIA_STATE {
358 NdisMediaStateConnected,
359 NdisMediaStateDisconnected
360} NDIS_MEDIA_STATE, *PNDIS_MEDIA_STATE;
361
362/* OID_GEN_SUPPORTED_GUIDS */
363typedef struct _NDIS_GUID {
364 GUID Guid;
365 union {
366 NDIS_OID Oid;
367 NDIS_STATUS Status;
368 } u;
369 ULONG Size;
370 ULONG Flags;
371} NDIS_GUID, *PNDIS_GUID;
372
373#define NDIS_GUID_TO_OID 0x00000001
374#define NDIS_GUID_TO_STATUS 0x00000002
375#define NDIS_GUID_ANSI_STRING 0x00000004
376#define NDIS_GUID_UNICODE_STRING 0x00000008
377#define NDIS_GUID_ARRAY 0x00000010
378
379
380typedef struct _NDIS_PACKET_POOL {
381 NDIS_SPIN_LOCK SpinLock;
382 struct _NDIS_PACKET *FreeList;
383 UINT PacketLength;
384 UCHAR Buffer[1];
385} NDIS_PACKET_POOL, * PNDIS_PACKET_POOL;
386
387/* NDIS_PACKET_PRIVATE.Flags constants */
388#define fPACKET_CONTAINS_MEDIA_SPECIFIC_INFO 0x40
389#define fPACKET_ALLOCATED_BY_NDIS 0x80
390
391typedef struct _NDIS_PACKET_PRIVATE {
392 UINT PhysicalCount;
393 UINT TotalLength;
394 PNDIS_BUFFER Head;
395 PNDIS_BUFFER Tail;
396 PNDIS_PACKET_POOL Pool;
397 UINT Count;
398 ULONG Flags;
399 BOOLEAN ValidCounts;
400 UCHAR NdisPacketFlags;
401 USHORT NdisPacketOobOffset;
402} NDIS_PACKET_PRIVATE, * PNDIS_PACKET_PRIVATE;
403
404typedef struct _NDIS_PACKET {
405 NDIS_PACKET_PRIVATE Private;
406 _ANONYMOUS_UNION union {
407 _ANONYMOUS_STRUCT struct {
408 UCHAR MiniportReserved[2 * sizeof(PVOID)];
409 UCHAR WrapperReserved[2 * sizeof(PVOID)];
410 } DUMMYSTRUCTNAME;
411 _ANONYMOUS_STRUCT struct {
412 UCHAR MiniportReservedEx[3 * sizeof(PVOID)];
413 UCHAR WrapperReservedEx[sizeof(PVOID)];
414 } DUMMYSTRUCTNAME;
415 _ANONYMOUS_STRUCT struct {
416 UCHAR MacReserved[4 * sizeof(PVOID)];
417 } DUMMYSTRUCTNAME;
418 } DUMMYUNIONNAME;
419 ULONG_PTR Reserved[2];
420 UCHAR ProtocolReserved[1];
421} NDIS_PACKET, *PNDIS_PACKET, **PPNDIS_PACKET;
422
423typedef enum _NDIS_CLASS_ID {
424 NdisClass802_3Priority,
425 NdisClassWirelessWanMbxMailbox,
426 NdisClassIrdaPacketInfo,
427 NdisClassAtmAALInfo
428} NDIS_CLASS_ID;
429
430typedef struct MediaSpecificInformation {
431 UINT NextEntryOffset;
432 NDIS_CLASS_ID ClassId;
433 UINT Size;
434 UCHAR ClassInformation[1];
435} MEDIA_SPECIFIC_INFORMATION;
436
437typedef struct _NDIS_PACKET_OOB_DATA {
438 _ANONYMOUS_UNION union {
439 ULONGLONG TimeToSend;
440 ULONGLONG TimeSent;
441 } DUMMYUNIONNAME;
442 ULONGLONG TimeReceived;
443 UINT HeaderSize;
444 UINT SizeMediaSpecificInfo;
445 PVOID MediaSpecificInformation;
446 NDIS_STATUS Status;
447} NDIS_PACKET_OOB_DATA, *PNDIS_PACKET_OOB_DATA;
448
449typedef struct _NDIS_PM_PACKET_PATTERN {
450 ULONG Priority;
451 ULONG Reserved;
452 ULONG MaskSize;
453 ULONG PatternOffset;
454 ULONG PatternSize;
455 ULONG PatternFlags;
456} NDIS_PM_PACKET_PATTERN, *PNDIS_PM_PACKET_PATTERN;
457
458
459/* Request types used by NdisRequest */
460typedef 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
475typedef 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
508typedef 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
528typedef 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
538typedef 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
547/* Possible hardware architecture */
548typedef enum _NDIS_INTERFACE_TYPE {
549 NdisInterfaceInternal = Internal,
550 NdisInterfaceIsa = Isa,
551 NdisInterfaceEisa = Eisa,
552 NdisInterfaceMca = MicroChannel,
553 NdisInterfaceTurboChannel = TurboChannel,
554 NdisInterfacePci = PCIBus,
555 NdisInterfacePcMcia = PCMCIABus,
556 NdisInterfaceCBus = CBus,
557 NdisInterfaceMPIBus = MPIBus,
558 NdisInterfaceMPSABus = MPSABus,
559 NdisInterfaceProcessorInternal = ProcessorInternal,
560 NdisInterfaceInternalPowerBus = InternalPowerBus,
561 NdisInterfacePNPISABus = PNPISABus,
562 NdisInterfacePNPBus = PNPBus,
563 NdisMaximumInterfaceType
564} NDIS_INTERFACE_TYPE, *PNDIS_INTERFACE_TYPE;
565
566#define NdisInterruptLevelSensitive LevelSensitive
567#define NdisInterruptLatched Latched
568typedef KINTERRUPT_MODE NDIS_INTERRUPT_MODE, *PNDIS_INTERRUPT_MODE;
569
570
571typedef enum _NDIS_PARAMETER_TYPE {
572 NdisParameterInteger,
573 NdisParameterHexInteger,
574 NdisParameterString,
575 NdisParameterMultiString,
576 NdisParameterBinary
577} NDIS_PARAMETER_TYPE, *PNDIS_PARAMETER_TYPE;
578
579typedef struct {
580 USHORT Length;
581 PVOID Buffer;
582} BINARY_DATA;
583
584typedef struct _NDIS_CONFIGURATION_PARAMETER {
585 NDIS_PARAMETER_TYPE ParameterType;
586 union {
587 ULONG IntegerData;
588 NDIS_STRING StringData;
589 BINARY_DATA BinaryData;
590 } ParameterData;
591} NDIS_CONFIGURATION_PARAMETER, *PNDIS_CONFIGURATION_PARAMETER;
592
593
594typedef PHYSICAL_ADDRESS NDIS_PHYSICAL_ADDRESS, *PNDIS_PHYSICAL_ADDRESS;
595
596typedef struct _NDIS_PHYSICAL_ADDRESS_UNIT {
597 NDIS_PHYSICAL_ADDRESS PhysicalAddress;
598 UINT Length;
599} NDIS_PHYSICAL_ADDRESS_UNIT, *PNDIS_PHYSICAL_ADDRESS_UNIT;
600
601typedef struct _NDIS_WAN_LINE_DOWN {
602 UCHAR RemoteAddress[6];
603 UCHAR LocalAddress[6];
604} NDIS_WAN_LINE_DOWN, *PNDIS_WAN_LINE_DOWN;
605
606typedef struct _NDIS_WAN_LINE_UP {
607 ULONG LinkSpeed;
608 ULONG MaximumTotalSize;
609 NDIS_WAN_QUALITY Quality;
610 USHORT SendWindow;
611 UCHAR RemoteAddress[6];
612 /*OUT*/ UCHAR LocalAddress[6];
613 ULONG ProtocolBufferLength;
614 PUCHAR ProtocolBuffer;
615 USHORT ProtocolType;
616 NDIS_STRING DeviceName;
617} NDIS_WAN_LINE_UP, *PNDIS_WAN_LINE_UP;
618
619
620typedef VOID DDKAPI
621(*ADAPTER_SHUTDOWN_HANDLER)(
622 /*IN*/ PVOID ShutdownContext);
623
624
625typedef struct _OID_LIST OID_LIST, *POID_LIST;
626
627/* PnP state */
628
629typedef enum _NDIS_PNP_DEVICE_STATE {
630 NdisPnPDeviceAdded,
631 NdisPnPDeviceStarted,
632 NdisPnPDeviceQueryStopped,
633 NdisPnPDeviceStopped,
634 NdisPnPDeviceQueryRemoved,
635 NdisPnPDeviceRemoved,
636 NdisPnPDeviceSurpriseRemoved
637} NDIS_PNP_DEVICE_STATE;
638
639#define NDIS_DEVICE_NOT_STOPPABLE 0x00000001
640#define NDIS_DEVICE_NOT_REMOVEABLE 0x00000002
641#define NDIS_DEVICE_NOT_SUSPENDABLE 0x00000004
642#define NDIS_DEVICE_DISABLE_PM 0x00000008
643#define NDIS_DEVICE_DISABLE_WAKE_UP 0x00000010
644#define NDIS_DEVICE_DISABLE_WAKE_ON_RECONNECT 0x00000020
645#define NDIS_DEVICE_RESERVED 0x00000040
646#define NDIS_DEVICE_DISABLE_WAKE_ON_MAGIC_PACKET 0x00000080
647#define NDIS_DEVICE_DISABLE_WAKE_ON_PATTERN_MATCH 0x00000100
648
649
650/* OID_GEN_NETWORK_LAYER_ADDRESSES */
651typedef struct _NETWORK_ADDRESS {
652 USHORT AddressLength;
653 USHORT AddressType;
654 UCHAR Address[1];
655} NETWORK_ADDRESS, *PNETWORK_ADDRESS;
656
657typedef struct _NETWORK_ADDRESS_LIST {
658 LONG AddressCount;
659 USHORT AddressType;
660 NETWORK_ADDRESS Address[1];
661} NETWORK_ADDRESS_LIST, *PNETWORK_ADDRESS_LIST;
662
663/* Protocol types supported by NDIS */
664#define NDIS_PROTOCOL_ID_DEFAULT 0x00
665#define NDIS_PROTOCOL_ID_TCP_IP 0x02
666#define NDIS_PROTOCOL_ID_IPX 0x06
667#define NDIS_PROTOCOL_ID_NBF 0x07
668#define NDIS_PROTOCOL_ID_MAX 0x0F
669#define NDIS_PROTOCOL_ID_MASK 0x0F
670
671
672/* OID_GEN_TRANSPORT_HEADER_OFFSET */
673typedef struct _TRANSPORT_HEADER_OFFSET {
674 USHORT ProtocolType;
675 USHORT HeaderOffset;
676} TRANSPORT_HEADER_OFFSET, *PTRANSPORT_HEADER_OFFSET;
677
678
679/* OID_GEN_CO_LINK_SPEED / OID_GEN_CO_MINIMUM_LINK_SPEED */
680typedef struct _NDIS_CO_LINK_SPEED {
681 ULONG Outbound;
682 ULONG Inbound;
683} NDIS_CO_LINK_SPEED, *PNDIS_CO_LINK_SPEED;
684
685typedef ULONG NDIS_AF, *PNDIS_AF;
686#define CO_ADDRESS_FAMILY_Q2931 ((NDIS_AF)0x1)
687#define CO_ADDRESS_FAMILY_PSCHED ((NDIS_AF)0x2)
688#define CO_ADDRESS_FAMILY_L2TP ((NDIS_AF)0x3)
689#define CO_ADDRESS_FAMILY_IRDA ((NDIS_AF)0x4)
690#define CO_ADDRESS_FAMILY_1394 ((NDIS_AF)0x5)
691#define CO_ADDRESS_FAMILY_PPP ((NDIS_AF)0x6)
692#define CO_ADDRESS_FAMILY_TAPI ((NDIS_AF)0x800)
693#define CO_ADDRESS_FAMILY_TAPI_PROXY ((NDIS_AF)0x801)
694
695#define CO_ADDRESS_FAMILY_PROXY 0x80000000
696
697typedef struct {
698 NDIS_AF AddressFamily;
699 ULONG MajorVersion;
700 ULONG MinorVersion;
701} CO_ADDRESS_FAMILY, *PCO_ADDRESS_FAMILY;
702
703typedef struct _CO_FLOW_PARAMETERS {
704 ULONG TokenRate;
705 ULONG TokenBucketSize;
706 ULONG PeakBandwidth;
707 ULONG Latency;
708 ULONG DelayVariation;
709 SERVICETYPE ServiceType;
710 ULONG MaxSduSize;
711 ULONG MinimumPolicedSize;
712} CO_FLOW_PARAMETERS, *PCO_FLOW_PARAMETERS;
713
714typedef struct _CO_SPECIFIC_PARAMETERS {
715 ULONG ParamType;
716 ULONG Length;
717 UCHAR Parameters[1];
718} CO_SPECIFIC_PARAMETERS, *PCO_SPECIFIC_PARAMETERS;
719
720typedef struct _CO_CALL_MANAGER_PARAMETERS {
721 CO_FLOW_PARAMETERS Transmit;
722 CO_FLOW_PARAMETERS Receive;
723 CO_SPECIFIC_PARAMETERS CallMgrSpecific;
724} CO_CALL_MANAGER_PARAMETERS, *PCO_CALL_MANAGER_PARAMETERS;
725
726/* CO_MEDIA_PARAMETERS.Flags constants */
727#define RECEIVE_TIME_INDICATION 0x00000001
728#define USE_TIME_STAMPS 0x00000002
729#define TRANSMIT_VC 0x00000004
730#define RECEIVE_VC 0x00000008
731#define INDICATE_ERRED_PACKETS 0x00000010
732#define INDICATE_END_OF_TX 0x00000020
733#define RESERVE_RESOURCES_VC 0x00000040
734#define ROUND_DOWN_FLOW 0x00000080
735#define ROUND_UP_FLOW 0x00000100
736
737typedef struct _CO_MEDIA_PARAMETERS {
738 ULONG Flags;
739 ULONG ReceivePriority;
740 ULONG ReceiveSizeHint;
741 CO_SPECIFIC_PARAMETERS MediaSpecific;
742} CO_MEDIA_PARAMETERS, *PCO_MEDIA_PARAMETERS;
743
744/* CO_CALL_PARAMETERS.Flags constants */
745#define PERMANENT_VC 0x00000001
746#define CALL_PARAMETERS_CHANGED 0x00000002
747#define QUERY_CALL_PARAMETERS 0x00000004
748#define BROADCAST_VC 0x00000008
749#define MULTIPOINT_VC 0x00000010
750
751typedef struct _CO_CALL_PARAMETERS {
752 ULONG Flags;
753 PCO_CALL_MANAGER_PARAMETERS CallMgrParameters;
754 PCO_MEDIA_PARAMETERS MediaParameters;
755} CO_CALL_PARAMETERS, *PCO_CALL_PARAMETERS;
756
757typedef struct _CO_SAP {
758 ULONG SapType;
759 ULONG SapLength;
760 UCHAR Sap[1];
761} CO_SAP, *PCO_SAP;
762
763typedef struct _NDIS_IPSEC_PACKET_INFO {
764 _ANONYMOUS_UNION union {
765 struct {
766 NDIS_HANDLE OffloadHandle;
767 NDIS_HANDLE NextOffloadHandle;
768 } Transmit;
769 struct {
770 ULONG SA_DELETE_REQ : 1;
771 ULONG CRYPTO_DONE : 1;
772 ULONG NEXT_CRYPTO_DONE : 1;
773 ULONG CryptoStatus;
774 } Receive;
775 } DUMMYUNIONNAME;
776} NDIS_IPSEC_PACKET_INFO, *PNDIS_IPSEC_PACKET_INFO;
777
778/* NDIS_MAC_FRAGMENT.Errors constants */
779#define WAN_ERROR_CRC 0x00000001
780#define WAN_ERROR_FRAMING 0x00000002
781#define WAN_ERROR_HARDWAREOVERRUN 0x00000004
782#define WAN_ERROR_BUFFEROVERRUN 0x00000008
783#define WAN_ERROR_TIMEOUT 0x00000010
784#define WAN_ERROR_ALIGNMENT 0x00000020
785
786typedef struct _NDIS_MAC_FRAGMENT {
787 NDIS_HANDLE NdisLinkContext;
788 ULONG Errors;
789} NDIS_MAC_FRAGMENT, *PNDIS_MAC_FRAGMENT;
790
791typedef struct _NDIS_MAC_LINE_DOWN {
792 NDIS_HANDLE NdisLinkContext;
793} NDIS_MAC_LINE_DOWN, *PNDIS_MAC_LINE_DOWN;
794
795typedef struct _NDIS_MAC_LINE_UP {
796 ULONG LinkSpeed;
797 NDIS_WAN_QUALITY Quality;
798 USHORT SendWindow;
799 NDIS_HANDLE ConnectionWrapperID;
800 NDIS_HANDLE NdisLinkHandle;
801 NDIS_HANDLE NdisLinkContext;
802} NDIS_MAC_LINE_UP, *PNDIS_MAC_LINE_UP;
803
804typedef struct _NDIS_PACKET_8021Q_INFO {
805 _ANONYMOUS_UNION union {
806 struct {
807 UINT32 UserPriority : 3;
808 UINT32 CanonicalFormatId : 1;
809 UINT32 VlanId : 12;
810 UINT32 Reserved : 16;
811 } TagHeader;
812 PVOID Value;
813 } DUMMYUNIONNAME;
814} NDIS_PACKET_8021Q_INFO, *PNDIS_PACKET_8021Q_INFO;
815
816typedef enum _NDIS_PER_PACKET_INFO {
817 TcpIpChecksumPacketInfo,
818 IpSecPacketInfo,
819 TcpLargeSendPacketInfo,
820 ClassificationHandlePacketInfo,
821 NdisReserved,
822 ScatterGatherListPacketInfo,
823 Ieee8021QInfo,
824 OriginalPacketInfo,
825 PacketCancelId,
826 MaxPerPacketInfo
827} NDIS_PER_PACKET_INFO, *PNDIS_PER_PACKET_INFO;
828
829typedef struct _NDIS_PACKET_EXTENSION {
830 PVOID NdisPacketInfo[MaxPerPacketInfo];
831} NDIS_PACKET_EXTENSION, *PNDIS_PACKET_EXTENSION;
832
833/*
834 * PNDIS_PACKET
835 * NDIS_GET_ORIGINAL_PACKET(
836 * IN PNDIS_PACKET Packet);
837 */
838#define NDIS_GET_ORIGINAL_PACKET(Packet) \
839 NDIS_PER_PACKET_INFO_FROM_PACKET(Packet, OriginalPacketInfo)
840
841/*
842 * PVOID
843 * NDIS_GET_PACKET_CANCEL_ID(
844 * IN PNDIS_PACKET Packet);
845 */
846#define NDIS_GET_PACKET_CANCEL_ID(Packet) \
847 NDIS_PER_PACKET_INFO_FROM_PACKET(Packet, PacketCancelId)
848
849/*
850 * PNDIS_PACKET_EXTENSION
851 * NDIS_PACKET_EXTENSION_FROM_PACKET(
852 * IN PNDIS_PACKET Packet);
853 */
854#define NDIS_PACKET_EXTENSION_FROM_PACKET(Packet) \
855 ((PNDIS_PACKET_EXTENSION)((PUCHAR)(Packet) \
856 + (Packet)->Private.NdisPacketOobOffset + sizeof(NDIS_PACKET_OOB_DATA)))
857
858/*
859 * PVOID
860 * NDIS_PER_PACKET_INFO_FROM_PACKET(
861 * IN OUT PNDIS_PACKET Packet,
862 * IN NDIS_PER_PACKET_INFO InfoType);
863 */
864#define NDIS_PER_PACKET_INFO_FROM_PACKET(Packet, InfoType) \
865 ((PNDIS_PACKET_EXTENSION)((PUCHAR)(Packet) + (Packet)->Private.NdisPacketOobOffset \
866 + sizeof(NDIS_PACKET_OOB_DATA)))->NdisPacketInfo[(InfoType)]
867
868/*
869 * VOID
870 * NDIS_SET_ORIGINAL_PACKET(
871 * IN OUT PNDIS_PACKET Packet,
872 * IN PNDIS_PACKET OriginalPacket);
873 */
874#define NDIS_SET_ORIGINAL_PACKET(Packet, OriginalPacket) \
875 NDIS_PER_PACKET_INFO_FROM_PACKET(Packet, OriginalPacketInfo) = (OriginalPacket)
876
877/*
878 * VOID
879 * NDIS_SET_PACKET_CANCEL_ID(
880 * IN PNDIS_PACKET Packet
881 * IN ULONG_PTR CancelId);
882 */
883#define NDIS_SET_PACKET_CANCEL_ID(Packet, CancelId) \
884 NDIS_PER_PACKET_INFO_FROM_PACKET(Packet, PacketCancelId) = (CancelId)
885
886typedef enum _NDIS_TASK {
887 TcpIpChecksumNdisTask,
888 IpSecNdisTask,
889 TcpLargeSendNdisTask,
890 MaxNdisTask
891} NDIS_TASK, *PNDIS_TASK;
892
893typedef struct _NDIS_TASK_IPSEC {
894 struct {
895 ULONG AH_ESP_COMBINED;
896 ULONG TRANSPORT_TUNNEL_COMBINED;
897 ULONG V4_OPTIONS;
898 ULONG RESERVED;
899 } Supported;
900
901 struct {
902 ULONG MD5 : 1;
903 ULONG SHA_1 : 1;
904 ULONG Transport : 1;
905 ULONG Tunnel : 1;
906 ULONG Send : 1;
907 ULONG Receive : 1;
908 } V4AH;
909
910 struct {
911 ULONG DES : 1;
912 ULONG RESERVED : 1;
913 ULONG TRIPLE_DES : 1;
914 ULONG NULL_ESP : 1;
915 ULONG Transport : 1;
916 ULONG Tunnel : 1;
917 ULONG Send : 1;
918 ULONG Receive : 1;
919 } V4ESP;
920} NDIS_TASK_IPSEC, *PNDIS_TASK_IPSEC;
921
922typedef enum _NDIS_ENCAPSULATION {
923 UNSPECIFIED_Encapsulation,
924 NULL_Encapsulation,
925 IEEE_802_3_Encapsulation,
926 IEEE_802_5_Encapsulation,
927 LLC_SNAP_ROUTED_Encapsulation,
928 LLC_SNAP_BRIDGED_Encapsulation
929} NDIS_ENCAPSULATION;
930
931typedef struct _NDIS_ENCAPSULATION_FORMAT {
932 NDIS_ENCAPSULATION Encapsulation;
933 struct {
934 ULONG FixedHeaderSize : 1;
935 ULONG Reserved : 31;
936 } Flags;
937 ULONG EncapsulationHeaderSize;
938} NDIS_ENCAPSULATION_FORMAT, *PNDIS_ENCAPSULATION_FORMAT;
939
940typedef struct _NDIS_TASK_OFFLOAD_HEADER
941{
942 ULONG Version;
943 ULONG Size;
944 ULONG Reserved;
945 UCHAR OffsetFirstTask;
946 NDIS_ENCAPSULATION_FORMAT EncapsulationFormat;
947} NDIS_TASK_OFFLOAD_HEADER, *PNDIS_TASK_OFFLOAD_HEADER;
948
949typedef struct _NDIS_TASK_OFFLOAD {
950 ULONG Version;
951 ULONG Size;
952 NDIS_TASK Task;
953 ULONG OffsetNextTask;
954 ULONG TaskBufferLength;
955 UCHAR TaskBuffer[1];
956} NDIS_TASK_OFFLOAD, *PNDIS_TASK_OFFLOAD;
957
958/* NDIS_TASK_OFFLOAD_HEADER.Version constants */
959#define NDIS_TASK_OFFLOAD_VERSION 1
960
961typedef struct _NDIS_TASK_TCP_IP_CHECKSUM {
962 struct {
963 ULONG IpOptionsSupported:1;
964 ULONG TcpOptionsSupported:1;
965 ULONG TcpChecksum:1;
966 ULONG UdpChecksum:1;
967 ULONG IpChecksum:1;
968 } V4Transmit;
969
970 struct {
971 ULONG IpOptionsSupported : 1;
972 ULONG TcpOptionsSupported : 1;
973 ULONG TcpChecksum : 1;
974 ULONG UdpChecksum : 1;
975 ULONG IpChecksum : 1;
976 } V4Receive;
977
978 struct {
979 ULONG IpOptionsSupported : 1;
980 ULONG TcpOptionsSupported : 1;
981 ULONG TcpChecksum : 1;
982 ULONG UdpChecksum : 1;
983 } V6Transmit;
984
985 struct {
986 ULONG IpOptionsSupported : 1;
987 ULONG TcpOptionsSupported : 1;
988 ULONG TcpChecksum : 1;
989 ULONG UdpChecksum : 1;
990 } V6Receive;
991} NDIS_TASK_TCP_IP_CHECKSUM, *PNDIS_TASK_TCP_IP_CHECKSUM;
992
993typedef struct _NDIS_TASK_TCP_LARGE_SEND {
994 ULONG Version;
995 ULONG MaxOffLoadSize;
996 ULONG MinSegmentCount;
997 BOOLEAN TcpOptions;
998 BOOLEAN IpOptions;
999} NDIS_TASK_TCP_LARGE_SEND, *PNDIS_TASK_TCP_LARGE_SEND;
1000
1001typedef struct _NDIS_TCP_IP_CHECKSUM_PACKET_INFO {
1002 _ANONYMOUS_UNION union {
1003 struct {
1004 ULONG NdisPacketChecksumV4 : 1;
1005 ULONG NdisPacketChecksumV6 : 1;
1006 ULONG NdisPacketTcpChecksum : 1;
1007 ULONG NdisPacketUdpChecksum : 1;
1008 ULONG NdisPacketIpChecksum : 1;
1009 } Transmit;
1010
1011 struct {
1012 ULONG NdisPacketTcpChecksumFailed : 1;
1013 ULONG NdisPacketUdpChecksumFailed : 1;
1014 ULONG NdisPacketIpChecksumFailed : 1;
1015 ULONG NdisPacketTcpChecksumSucceeded : 1;
1016 ULONG NdisPacketUdpChecksumSucceeded : 1;
1017 ULONG NdisPacketIpChecksumSucceeded : 1;
1018 ULONG NdisPacketLoopback : 1;
1019 } Receive;
1020 ULONG Value;
1021 } DUMMYUNIONNAME;
1022} NDIS_TCP_IP_CHECKSUM_PACKET_INFO, *PNDIS_TCP_IP_CHECKSUM_PACKET_INFO;
1023
1024typedef struct _NDIS_WAN_CO_FRAGMENT {
1025 ULONG Errors;
1026} NDIS_WAN_CO_FRAGMENT, *PNDIS_WAN_CO_FRAGMENT;
1027
1028typedef struct _NDIS_WAN_FRAGMENT {
1029 UCHAR RemoteAddress[6];
1030 UCHAR LocalAddress[6];
1031} NDIS_WAN_FRAGMENT, *PNDIS_WAN_FRAGMENT;
1032
1033typedef struct _WAN_CO_LINKPARAMS {
1034 ULONG TransmitSpeed;
1035 ULONG ReceiveSpeed;
1036 ULONG SendWindow;
1037} WAN_CO_LINKPARAMS, *PWAN_CO_LINKPARAMS;
1038
1039
1040/* Call Manager */
1041
1042typedef VOID DDKAPI
1043(*CM_ACTIVATE_VC_COMPLETE_HANDLER)(
1044 /*IN*/ NDIS_STATUS Status,
1045 /*IN*/ NDIS_HANDLE CallMgrVcContext,
1046 /*IN*/ PCO_CALL_PARAMETERS CallParameters);
1047
1048typedef NDIS_STATUS DDKAPI
1049(*CM_ADD_PARTY_HANDLER)(
1050 /*IN*/ NDIS_HANDLE CallMgrVcContext,
1051 /*IN OUT*/ PCO_CALL_PARAMETERS CallParameters,
1052 /*IN*/ NDIS_HANDLE NdisPartyHandle,
1053 /*OUT*/ PNDIS_HANDLE CallMgrPartyContext);
1054
1055typedef NDIS_STATUS DDKAPI
1056(*CM_CLOSE_AF_HANDLER)(
1057 /*IN*/ NDIS_HANDLE CallMgrAfContext);
1058
1059typedef NDIS_STATUS DDKAPI
1060(*CM_CLOSE_CALL_HANDLER)(
1061 /*IN*/ NDIS_HANDLE CallMgrVcContext,
1062 /*IN*/ NDIS_HANDLE CallMgrPartyContext /*OPTIONAL*/,
1063 /*IN*/ PVOID CloseData /*OPTIONAL*/,
1064 /*IN*/ UINT Size /*OPTIONAL*/);
1065
1066typedef NDIS_STATUS DDKAPI
1067(*CM_DEREG_SAP_HANDLER)(
1068 /*IN*/ NDIS_HANDLE CallMgrSapContext);
1069
1070typedef VOID DDKAPI
1071(*CM_DEACTIVATE_VC_COMPLETE_HANDLER)(
1072 /*IN*/ NDIS_STATUS Status,
1073 /*IN*/ NDIS_HANDLE CallMgrVcContext);
1074
1075typedef NDIS_STATUS DDKAPI
1076(*CM_DROP_PARTY_HANDLER)(
1077 /*IN*/ NDIS_HANDLE CallMgrPartyContext,
1078 /*IN*/ PVOID CloseData /*OPTIONAL*/,
1079 /*IN*/ UINT Size /*OPTIONAL*/);
1080
1081typedef VOID DDKAPI
1082(*CM_INCOMING_CALL_COMPLETE_HANDLER)(
1083 /*IN*/ NDIS_STATUS Status,
1084 /*IN*/ NDIS_HANDLE CallMgrVcContext,
1085 /*IN*/ PCO_CALL_PARAMETERS CallParameters);
1086
1087typedef NDIS_STATUS DDKAPI
1088(*CM_MAKE_CALL_HANDLER)(
1089 /*IN*/ NDIS_HANDLE CallMgrVcContext,
1090 /*IN OUT*/ PCO_CALL_PARAMETERS CallParameters,
1091 /*IN*/ NDIS_HANDLE NdisPartyHandle /*OPTIONAL*/,
1092 /*OUT*/ PNDIS_HANDLE CallMgrPartyContext /*OPTIONAL*/);
1093
1094typedef NDIS_STATUS DDKAPI
1095(*CM_MODIFY_CALL_QOS_HANDLER)(
1096 /*IN*/ NDIS_HANDLE CallMgrVcContext,
1097 /*IN*/ PCO_CALL_PARAMETERS CallParameters);
1098
1099typedef NDIS_STATUS DDKAPI
1100(*CM_OPEN_AF_HANDLER)(
1101 /*IN*/ NDIS_HANDLE CallMgrBindingContext,
1102 /*IN*/ PCO_ADDRESS_FAMILY AddressFamily,
1103 /*IN*/ NDIS_HANDLE NdisAfHandle,
1104 /*OUT*/ PNDIS_HANDLE CallMgrAfContext);
1105
1106typedef NDIS_STATUS DDKAPI
1107(*CM_REG_SAP_HANDLER)(
1108 /*IN*/ NDIS_HANDLE CallMgrAfContext,
1109 /*IN*/ PCO_SAP Sap,
1110 /*IN*/ NDIS_HANDLE NdisSapHandle,
1111 /*OUT*/ PNDIS_HANDLE CallMgrSapContext);
1112
1113typedef NDIS_STATUS DDKAPI
1114(*CO_CREATE_VC_HANDLER)(
1115 /*IN*/ NDIS_HANDLE ProtocolAfContext,
1116 /*IN*/ NDIS_HANDLE NdisVcHandle,
1117 /*OUT*/ PNDIS_HANDLE ProtocolVcContext);
1118
1119typedef NDIS_STATUS DDKAPI
1120(*CO_DELETE_VC_HANDLER)(
1121 /*IN*/ NDIS_HANDLE ProtocolVcContext);
1122
1123typedef VOID DDKAPI
1124(*CO_REQUEST_COMPLETE_HANDLER)(
1125 /*IN*/ NDIS_STATUS Status,
1126 /*IN*/ NDIS_HANDLE ProtocolAfContext /*OPTIONAL*/,
1127 /*IN*/ NDIS_HANDLE ProtocolVcContext /*OPTIONAL*/,
1128 /*IN*/ NDIS_HANDLE ProtocolPartyContext /*OPTIONAL*/,
1129 /*IN*/ PNDIS_REQUEST NdisRequest);
1130
1131typedef NDIS_STATUS DDKAPI
1132(*CO_REQUEST_HANDLER)(
1133 /*IN*/ NDIS_HANDLE ProtocolAfContext,
1134 /*IN*/ NDIS_HANDLE ProtocolVcContext /*OPTIONAL*/,
1135 /*IN*/ NDIS_HANDLE ProtocolPartyContext /*OPTIONAL*/,
1136 /*IN OUT*/ PNDIS_REQUEST NdisRequest);
1137
1138typedef struct _NDIS_CALL_MANAGER_CHARACTERISTICS {
1139 UCHAR MajorVersion;
1140 UCHAR MinorVersion;
1141 USHORT Filler;
1142 UINT Reserved;
1143 CO_CREATE_VC_HANDLER CmCreateVcHandler;
1144 CO_DELETE_VC_HANDLER CmDeleteVcHandler;
1145 CM_OPEN_AF_HANDLER CmOpenAfHandler;
1146 CM_CLOSE_AF_HANDLER CmCloseAfHandler;
1147 CM_REG_SAP_HANDLER CmRegisterSapHandler;
1148 CM_DEREG_SAP_HANDLER CmDeregisterSapHandler;
1149 CM_MAKE_CALL_HANDLER CmMakeCallHandler;
1150 CM_CLOSE_CALL_HANDLER CmCloseCallHandler;
1151 CM_INCOMING_CALL_COMPLETE_HANDLER CmIncomingCallCompleteHandler;
1152 CM_ADD_PARTY_HANDLER CmAddPartyHandler;
1153 CM_DROP_PARTY_HANDLER CmDropPartyHandler;
1154 CM_ACTIVATE_VC_COMPLETE_HANDLER CmActivateVcCompleteHandler;
1155 CM_DEACTIVATE_VC_COMPLETE_HANDLER CmDeactivateVcCompleteHandler;
1156 CM_MODIFY_CALL_QOS_HANDLER CmModifyCallQoSHandler;
1157 CO_REQUEST_HANDLER CmRequestHandler;
1158 CO_REQUEST_COMPLETE_HANDLER CmRequestCompleteHandler;
1159} NDIS_CALL_MANAGER_CHARACTERISTICS, *PNDIS_CALL_MANAGER_CHARACTERISTICS;
1160
1161
1162
1163/* Call Manager clients */
1164
1165typedef VOID (*CL_OPEN_AF_COMPLETE_HANDLER)(
1166 /*IN*/ NDIS_STATUS Status,
1167 /*IN*/ NDIS_HANDLE ProtocolAfContext,
1168 /*IN*/ NDIS_HANDLE NdisAfHandle);
1169
1170typedef VOID DDKAPI
1171(*CL_CLOSE_AF_COMPLETE_HANDLER)(
1172 /*IN*/ NDIS_STATUS Status,
1173 /*IN*/ NDIS_HANDLE ProtocolAfContext);
1174
1175typedef VOID DDKAPI
1176(*CL_REG_SAP_COMPLETE_HANDLER)(
1177 /*IN*/ NDIS_STATUS Status,
1178 /*IN*/ NDIS_HANDLE ProtocolSapContext,
1179 /*IN*/ PCO_SAP Sap,
1180 /*IN*/ NDIS_HANDLE NdisSapHandle);
1181
1182typedef VOID DDKAPI
1183(*CL_DEREG_SAP_COMPLETE_HANDLER)(
1184 /*IN*/ NDIS_STATUS Status,
1185 /*IN*/ NDIS_HANDLE ProtocolSapContext);
1186
1187typedef VOID DDKAPI
1188(*CL_MAKE_CALL_COMPLETE_HANDLER)(
1189 /*IN*/ NDIS_STATUS Status,
1190 /*IN*/ NDIS_HANDLE ProtocolVcContext,
1191 /*IN*/ NDIS_HANDLE NdisPartyHandle /*OPTIONAL*/,
1192 /*IN*/ PCO_CALL_PARAMETERS CallParameters);
1193
1194typedef VOID DDKAPI
1195(*CL_MODIFY_CALL_QOS_COMPLETE_HANDLER)(
1196 /*IN*/ NDIS_STATUS Status,
1197 /*IN*/ NDIS_HANDLE ProtocolVcContext,
1198 /*IN*/ PCO_CALL_PARAMETERS CallParameters);
1199
1200typedef VOID DDKAPI
1201(*CL_CLOSE_CALL_COMPLETE_HANDLER)(
1202 /*IN*/ NDIS_STATUS Status,
1203 /*IN*/ NDIS_HANDLE ProtocolVcContext,
1204 /*IN*/ NDIS_HANDLE ProtocolPartyContext /*OPTIONAL*/);
1205
1206typedef VOID DDKAPI
1207(*CL_ADD_PARTY_COMPLETE_HANDLER)(
1208 /*IN*/ NDIS_STATUS Status,
1209 /*IN*/ NDIS_HANDLE ProtocolPartyContext,
1210 /*IN*/ NDIS_HANDLE NdisPartyHandle,
1211 /*IN*/ PCO_CALL_PARAMETERS CallParameters);
1212
1213typedef VOID DDKAPI
1214(*CL_DROP_PARTY_COMPLETE_HANDLER)(
1215 /*IN*/ NDIS_STATUS Status,
1216 /*IN*/ NDIS_HANDLE ProtocolPartyContext);
1217
1218typedef NDIS_STATUS DDKAPI
1219(*CL_INCOMING_CALL_HANDLER)(
1220 /*IN*/ NDIS_HANDLE ProtocolSapContext,
1221 /*IN*/ NDIS_HANDLE ProtocolVcContext,
1222 /*IN OUT*/ PCO_CALL_PARAMETERS CallParameters);
1223
1224typedef VOID DDKAPI
1225(*CL_INCOMING_CALL_QOS_CHANGE_HANDLER)(
1226 /*IN*/ NDIS_HANDLE ProtocolVcContext,
1227 /*IN*/ PCO_CALL_PARAMETERS CallParameters);
1228
1229typedef VOID DDKAPI
1230(*CL_INCOMING_CLOSE_CALL_HANDLER)(
1231 /*IN*/ NDIS_STATUS CloseStatus,
1232 /*IN*/ NDIS_HANDLE ProtocolVcContext,
1233 /*IN*/ PVOID CloseData /*OPTIONAL*/,
1234 /*IN*/ UINT Size /*OPTIONAL*/);
1235
1236typedef VOID DDKAPI
1237(*CL_INCOMING_DROP_PARTY_HANDLER)(
1238 /*IN*/ NDIS_STATUS DropStatus,
1239 /*IN*/ NDIS_HANDLE ProtocolPartyContext,
1240 /*IN*/ PVOID CloseData /*OPTIONAL*/,
1241 /*IN*/ UINT Size /*OPTIONAL*/);
1242
1243typedef VOID DDKAPI
1244(*CL_CALL_CONNECTED_HANDLER)(
1245 /*IN*/ NDIS_HANDLE ProtocolVcContext);
1246
1247
1248typedef struct _NDIS_CLIENT_CHARACTERISTICS {
1249 UCHAR MajorVersion;
1250 UCHAR MinorVersion;
1251 USHORT Filler;
1252 UINT Reserved;
1253 CO_CREATE_VC_HANDLER ClCreateVcHandler;
1254 CO_DELETE_VC_HANDLER ClDeleteVcHandler;
1255 CO_REQUEST_HANDLER ClRequestHandler;
1256 CO_REQUEST_COMPLETE_HANDLER ClRequestCompleteHandler;
1257 CL_OPEN_AF_COMPLETE_HANDLER ClOpenAfCompleteHandler;
1258 CL_CLOSE_AF_COMPLETE_HANDLER ClCloseAfCompleteHandler;
1259 CL_REG_SAP_COMPLETE_HANDLER ClRegisterSapCompleteHandler;
1260 CL_DEREG_SAP_COMPLETE_HANDLER ClDeregisterSapCompleteHandler;
1261 CL_MAKE_CALL_COMPLETE_HANDLER ClMakeCallCompleteHandler;
1262 CL_MODIFY_CALL_QOS_COMPLETE_HANDLER ClModifyCallQoSCompleteHandler;
1263 CL_CLOSE_CALL_COMPLETE_HANDLER ClCloseCallCompleteHandler;
1264 CL_ADD_PARTY_COMPLETE_HANDLER ClAddPartyCompleteHandler;
1265 CL_DROP_PARTY_COMPLETE_HANDLER ClDropPartyCompleteHandler;
1266 CL_INCOMING_CALL_HANDLER ClIncomingCallHandler;
1267 CL_INCOMING_CALL_QOS_CHANGE_HANDLER ClIncomingCallQoSChangeHandler;
1268 CL_INCOMING_CLOSE_CALL_HANDLER ClIncomingCloseCallHandler;
1269 CL_INCOMING_DROP_PARTY_HANDLER ClIncomingDropPartyHandler;
1270 CL_CALL_CONNECTED_HANDLER ClCallConnectedHandler;
1271} NDIS_CLIENT_CHARACTERISTICS, *PNDIS_CLIENT_CHARACTERISTICS;
1272
1273
1274/* NDIS protocol structures */
1275
1276/* Prototypes for NDIS 3.0 protocol characteristics */
1277
1278typedef VOID DDKAPI
1279(*OPEN_ADAPTER_COMPLETE_HANDLER)(
1280 /*IN*/ NDIS_HANDLE ProtocolBindingContext,
1281 /*IN*/ NDIS_STATUS Status,
1282 /*IN*/ NDIS_STATUS OpenErrorStatus);
1283
1284typedef VOID DDKAPI
1285(*CLOSE_ADAPTER_COMPLETE_HANDLER)(
1286 /*IN*/ NDIS_HANDLE ProtocolBindingContext,
1287 /*IN*/ NDIS_STATUS Status);
1288
1289typedef VOID DDKAPI
1290(*RESET_COMPLETE_HANDLER)(
1291 /*IN*/ NDIS_HANDLE ProtocolBindingContext,
1292 /*IN*/ NDIS_STATUS Status);
1293
1294typedef VOID DDKAPI
1295(*REQUEST_COMPLETE_HANDLER)(
1296 /*IN*/ NDIS_HANDLE ProtocolBindingContext,
1297 /*IN*/ PNDIS_REQUEST NdisRequest,
1298 /*IN*/ NDIS_STATUS Status);
1299
1300typedef VOID DDKAPI
1301(*STATUS_HANDLER)(
1302 /*IN*/ NDIS_HANDLE ProtocolBindingContext,
1303 /*IN*/ NDIS_STATUS GeneralStatus,
1304 /*IN*/ PVOID StatusBuffer,
1305 /*IN*/ UINT StatusBufferSize);
1306
1307typedef VOID DDKAPI
1308(*STATUS_COMPLETE_HANDLER)(
1309 /*IN*/ NDIS_HANDLE ProtocolBindingContext);
1310
1311typedef VOID DDKAPI
1312(*SEND_COMPLETE_HANDLER)(
1313 /*IN*/ NDIS_HANDLE ProtocolBindingContext,
1314 /*IN*/ PNDIS_PACKET Packet,
1315 /*IN*/ NDIS_STATUS Status);
1316
1317typedef VOID DDKAPI
1318(*WAN_SEND_COMPLETE_HANDLER)(
1319 /*IN*/ NDIS_HANDLE ProtocolBindingContext,
1320 /*IN*/ PNDIS_WAN_PACKET Packet,
1321 /*IN*/ NDIS_STATUS Status);
1322
1323typedef VOID DDKAPI
1324(*TRANSFER_DATA_COMPLETE_HANDLER)(
1325 /*IN*/ NDIS_HANDLE ProtocolBindingContext,
1326 /*IN*/ PNDIS_PACKET Packet,
1327 /*IN*/ NDIS_STATUS Status,
1328 /*IN*/ UINT BytesTransferred);
1329
1330typedef VOID DDKAPI
1331(*WAN_TRANSFER_DATA_COMPLETE_HANDLER)(
1332 VOID);
1333
1334
1335typedef NDIS_STATUS DDKAPI
1336(*RECEIVE_HANDLER)(
1337 /*IN*/ NDIS_HANDLE ProtocolBindingContext,
1338 /*IN*/ NDIS_HANDLE MacReceiveContext,
1339 /*IN*/ PVOID HeaderBuffer,
1340 /*IN*/ UINT HeaderBufferSize,
1341 /*IN*/ PVOID LookAheadBuffer,
1342 /*IN*/ UINT LookaheadBufferSize,
1343 /*IN*/ UINT PacketSize);
1344
1345typedef NDIS_STATUS DDKAPI
1346(*WAN_RECEIVE_HANDLER)(
1347 /*IN*/ NDIS_HANDLE NdisLinkHandle,
1348 /*IN*/ PUCHAR Packet,
1349 /*IN*/ ULONG PacketSize);
1350
1351typedef VOID DDKAPI
1352(*RECEIVE_COMPLETE_HANDLER)(
1353 /*IN*/ NDIS_HANDLE ProtocolBindingContext);
1354
1355
1356/* Protocol characteristics for NDIS 3.0 protocols */
1357
1358#define NDIS30_PROTOCOL_CHARACTERISTICS_S \
1359 UCHAR MajorNdisVersion; \
1360 UCHAR MinorNdisVersion; \
1361 _ANONYMOUS_UNION union { \
1362 UINT Reserved; \
1363 UINT Flags; \
1364 } DUMMYUNIONNAME; \
1365 OPEN_ADAPTER_COMPLETE_HANDLER OpenAdapterCompleteHandler; \
1366 CLOSE_ADAPTER_COMPLETE_HANDLER CloseAdapterCompleteHandler; \
1367 _ANONYMOUS_UNION union { \
1368 SEND_COMPLETE_HANDLER SendCompleteHandler; \
1369 WAN_SEND_COMPLETE_HANDLER WanSendCompleteHandler; \
1370 } DUMMYUNIONNAME2; \
1371 _ANONYMOUS_UNION union { \
1372 TRANSFER_DATA_COMPLETE_HANDLER TransferDataCompleteHandler; \
1373 WAN_TRANSFER_DATA_COMPLETE_HANDLER WanTransferDataCompleteHandler; \
1374 } DUMMYUNIONNAME3; \
1375 RESET_COMPLETE_HANDLER ResetCompleteHandler; \
1376 REQUEST_COMPLETE_HANDLER RequestCompleteHandler; \
1377 _ANONYMOUS_UNION union { \
1378 RECEIVE_HANDLER ReceiveHandler; \
1379 WAN_RECEIVE_HANDLER WanReceiveHandler; \
1380 } DUMMYUNIONNAME4; \
1381 RECEIVE_COMPLETE_HANDLER ReceiveCompleteHandler; \
1382 STATUS_HANDLER StatusHandler; \
1383 STATUS_COMPLETE_HANDLER StatusCompleteHandler; \
1384 NDIS_STRING Name;
1385
1386typedef struct _NDIS30_PROTOCOL_CHARACTERISTICS {
1387 NDIS30_PROTOCOL_CHARACTERISTICS_S
1388} NDIS30_PROTOCOL_CHARACTERISTICS, *PNDIS30_PROTOCOL_CHARACTERISTICS;
1389
1390
1391/* Prototypes for NDIS 4.0 protocol characteristics */
1392
1393typedef INT DDKAPI
1394(*RECEIVE_PACKET_HANDLER)(
1395 /*IN*/ NDIS_HANDLE ProtocolBindingContext,
1396 /*IN*/ PNDIS_PACKET Packet);
1397
1398typedef VOID DDKAPI
1399(*BIND_HANDLER)(
1400 /*OUT*/ PNDIS_STATUS Status,
1401 /*IN*/ NDIS_HANDLE BindContext,
1402 /*IN*/ PNDIS_STRING DeviceName,
1403 /*IN*/ PVOID SystemSpecific1,
1404 /*IN*/ PVOID SystemSpecific2);
1405
1406typedef VOID DDKAPI
1407(*UNBIND_HANDLER)(
1408 /*OUT*/ PNDIS_STATUS Status,
1409 /*IN*/ NDIS_HANDLE ProtocolBindingContext,
1410 /*IN*/ NDIS_HANDLE UnbindContext);
1411
1412typedef NDIS_STATUS DDKAPI
1413(*PNP_EVENT_HANDLER)(
1414 /*IN*/ NDIS_HANDLE ProtocolBindingContext,
1415 /*IN*/ PNET_PNP_EVENT NetPnPEvent);
1416
1417typedef VOID DDKAPI
1418(*UNLOAD_PROTOCOL_HANDLER)(
1419 VOID);
1420
1421
1422/* Protocol characteristics for NDIS 4.0 protocols */
1423
1424#ifdef __cplusplus
1425
1426#define NDIS40_PROTOCOL_CHARACTERISTICS_S \
1427 NDIS30_PROTOCOL_CHARACTERISTICS Ndis30Chars; \
1428 RECEIVE_PACKET_HANDLER ReceivePacketHandler; \
1429 BIND_HANDLER BindAdapterHandler; \
1430 UNBIND_HANDLER UnbindAdapterHandler; \
1431 PNP_EVENT_HANDLER PnPEventHandler; \
1432 UNLOAD_PROTOCOL_HANDLER UnloadHandler;
1433
1434#else /* !__cplusplus */
1435
1436#define NDIS40_PROTOCOL_CHARACTERISTICS_S \
1437 NDIS30_PROTOCOL_CHARACTERISTICS_S \
1438 RECEIVE_PACKET_HANDLER ReceivePacketHandler; \
1439 BIND_HANDLER BindAdapterHandler; \
1440 UNBIND_HANDLER UnbindAdapterHandler; \
1441 PNP_EVENT_HANDLER PnPEventHandler; \
1442 UNLOAD_PROTOCOL_HANDLER UnloadHandler;
1443
1444#endif /* __cplusplus */
1445
1446typedef struct _NDIS40_PROTOCOL_CHARACTERISTICS {
1447 NDIS40_PROTOCOL_CHARACTERISTICS_S
1448} NDIS40_PROTOCOL_CHARACTERISTICS, *PNDIS40_PROTOCOL_CHARACTERISTICS;
1449
1450/* Prototypes for NDIS 5.0 protocol characteristics */
1451
1452typedef VOID DDKAPI
1453(*CO_SEND_COMPLETE_HANDLER)(
1454 /*IN*/ NDIS_STATUS Status,
1455 /*IN*/ NDIS_HANDLE ProtocolVcContext,
1456 /*IN*/ PNDIS_PACKET Packet);
1457
1458typedef VOID DDKAPI
1459(*CO_STATUS_HANDLER)(
1460 /*IN*/ NDIS_HANDLE ProtocolBindingContext,
1461 /*IN*/ NDIS_HANDLE ProtocolVcContext /*OPTIONAL*/,
1462 /*IN*/ NDIS_STATUS GeneralStatus,
1463 /*IN*/ PVOID StatusBuffer,
1464 /*IN*/ UINT StatusBufferSize);
1465
1466typedef UINT DDKAPI
1467(*CO_RECEIVE_PACKET_HANDLER)(
1468 /*IN*/ NDIS_HANDLE ProtocolBindingContext,
1469 /*IN*/ NDIS_HANDLE ProtocolVcContext,
1470 /*IN*/ PNDIS_PACKET Packet);
1471
1472typedef VOID DDKAPI
1473(*CO_AF_REGISTER_NOTIFY_HANDLER)(
1474 /*IN*/ NDIS_HANDLE ProtocolBindingContext,
1475 /*IN*/ PCO_ADDRESS_FAMILY AddressFamily);
1476
1477#ifdef __cplusplus \
1478
1479#define NDIS50_PROTOCOL_CHARACTERISTICS_S \
1480 NDIS40_PROTOCOL_CHARACTERISTICS Ndis40Chars; \
1481 PVOID ReservedHandlers[4]; \
1482 CO_SEND_COMPLETE_HANDLER CoSendCompleteHandler; \
1483 CO_STATUS_HANDLER CoStatusHandler; \
1484 CO_RECEIVE_PACKET_HANDLER CoReceivePacketHandler; \
1485 CO_AF_REGISTER_NOTIFY_HANDLER CoAfRegisterNotifyHandler;
1486
1487#else /* !__cplusplus */
1488
1489#define NDIS50_PROTOCOL_CHARACTERISTICS_S \
1490 NDIS40_PROTOCOL_CHARACTERISTICS_S \
1491 PVOID ReservedHandlers[4]; \
1492 CO_SEND_COMPLETE_HANDLER CoSendCompleteHandler; \
1493 CO_STATUS_HANDLER CoStatusHandler; \
1494 CO_RECEIVE_PACKET_HANDLER CoReceivePacketHandler; \
1495 CO_AF_REGISTER_NOTIFY_HANDLER CoAfRegisterNotifyHandler;
1496
1497#endif /* !__cplusplus */
1498
1499typedef struct _NDIS50_PROTOCOL_CHARACTERISTICS {
1500 NDIS50_PROTOCOL_CHARACTERISTICS_S
1501} NDIS50_PROTOCOL_CHARACTERISTICS, *PNDIS50_PROTOCOL_CHARACTERISTICS;
1502
1503#if defined(NDIS50) || defined(NDIS51)
1504typedef struct _NDIS_PROTOCOL_CHARACTERISTICS {
1505 NDIS50_PROTOCOL_CHARACTERISTICS_S;
1506} NDIS_PROTOCOL_CHARACTERISTICS, *PNDIS_PROTOCOL_CHARACTERISTICS;
1507#elif defined(NDIS40)
1508typedef struct _NDIS_PROTOCOL_CHARACTERISTICS {
1509 NDIS40_PROTOCOL_CHARACTERISTICS_S;
1510} NDIS_PROTOCOL_CHARACTERISTICS, *PNDIS_PROTOCOL_CHARACTERISTICS;
1511#elif defined(NDIS30)
1512typedef struct _NDIS_PROTOCOL_CHARACTERISTICS {
1513 NDIS30_PROTOCOL_CHARACTERISTICS_S
1514} NDIS_PROTOCOL_CHARACTERISTICS, *PNDIS_PROTOCOL_CHARACTERISTICS;
1515#else
1516#error Define an NDIS version
1517#endif /* NDIS30 */
1518
1519
1520
1521/* Buffer management routines */
1522
1523NDISAPI
1524VOID
1525DDKAPI
1526NdisAllocateBuffer(
1527 /*OUT*/ PNDIS_STATUS Status,
1528 /*OUT*/ PNDIS_BUFFER *Buffer,
1529 /*IN*/ NDIS_HANDLE PoolHandle,
1530 /*IN*/ PVOID VirtualAddress,
1531 /*IN*/ UINT Length);
1532
1533
1534NDISAPI
1535VOID
1536DDKAPI
1537NdisAllocateBufferPool(
1538 /*OUT*/ PNDIS_STATUS Status,
1539 /*OUT*/ PNDIS_HANDLE PoolHandle,
1540 /*IN*/ UINT NumberOfDescriptors);
1541
1542NDISAPI
1543VOID
1544DDKAPI
1545NdisAllocatePacket(
1546 /*OUT*/ PNDIS_STATUS Status,
1547 /*OUT*/ PNDIS_PACKET *Packet,
1548 /*IN*/ NDIS_HANDLE PoolHandle);
1549
1550NDISAPI
1551VOID
1552DDKAPI
1553NdisAllocatePacketPool(
1554 /*OUT*/ PNDIS_STATUS Status,
1555 /*OUT*/ PNDIS_HANDLE PoolHandle,
1556 /*IN*/ UINT NumberOfDescriptors,
1557 /*IN*/ UINT ProtocolReservedLength);
1558
1559#define PROTOCOL_RESERVED_SIZE_IN_PACKET (4 * sizeof(PVOID))
1560
1561NDISAPI
1562VOID
1563DDKAPI
1564NdisCopyBuffer(
1565 /*OUT*/ PNDIS_STATUS Status,
1566 /*OUT*/ PNDIS_BUFFER *Buffer,
1567 /*IN*/ NDIS_HANDLE PoolHandle,
1568 /*IN*/ PVOID MemoryDescriptor,
1569 /*IN*/ UINT Offset,
1570 /*IN*/ UINT Length);
1571
1572NDISAPI
1573VOID
1574DDKAPI
1575NdisCopyFromPacketToPacket(
1576 /*IN*/ PNDIS_PACKET Destination,
1577 /*IN*/ UINT DestinationOffset,
1578 /*IN*/ UINT BytesToCopy,
1579 /*IN*/ PNDIS_PACKET Source,
1580 /*IN*/ UINT SourceOffset,
1581 /*OUT*/ PUINT BytesCopied);
1582
1583NDISAPI
1584VOID
1585DDKAPI
1586NdisDprAllocatePacket(
1587 /*OUT*/ PNDIS_STATUS Status,
1588 /*OUT*/ PNDIS_PACKET *Packet,
1589 /*IN*/ NDIS_HANDLE PoolHandle);
1590
1591NDISAPI
1592VOID
1593DDKAPI
1594NdisDprAllocatePacketNonInterlocked(
1595 /*OUT*/ PNDIS_STATUS Status,
1596 /*OUT*/ PNDIS_PACKET *Packet,
1597 /*IN*/ NDIS_HANDLE PoolHandle);
1598
1599NDISAPI
1600VOID
1601DDKAPI
1602NdisDprFreePacket(
1603 /*IN*/ PNDIS_PACKET Packet);
1604
1605NDISAPI
1606VOID
1607DDKAPI
1608NdisDprFreePacketNonInterlocked(
1609 /*IN*/ PNDIS_PACKET Packet);
1610
1611NDISAPI
1612VOID
1613DDKAPI
1614NdisFreeBufferPool(
1615 /*IN*/ NDIS_HANDLE PoolHandle);
1616
1617NDISAPI
1618VOID
1619DDKAPI
1620NdisFreePacket(
1621 /*IN*/ PNDIS_PACKET Packet);
1622
1623NDISAPI
1624VOID
1625DDKAPI
1626NdisFreePacketPool(
1627 /*IN*/ NDIS_HANDLE PoolHandle);
1628
1629NDISAPI
1630VOID
1631DDKAPI
1632NdisReturnPackets(
1633 /*IN*/ PNDIS_PACKET *PacketsToReturn,
1634 /*IN*/ UINT NumberOfPackets);
1635
1636NDISAPI
1637VOID
1638DDKAPI
1639NdisUnchainBufferAtBack(
1640 /*IN OUT*/ PNDIS_PACKET Packet,
1641 /*OUT*/ PNDIS_BUFFER *Buffer);
1642
1643NDISAPI
1644VOID
1645DDKAPI
1646NdisUnchainBufferAtFront(
1647 /*IN OUT*/ PNDIS_PACKET Packet,
1648 /*OUT*/ PNDIS_BUFFER *Buffer);
1649
1650NDISAPI
1651VOID
1652DDKAPI
1653NdisAdjustBufferLength(
1654 /*IN*/ PNDIS_BUFFER Buffer,
1655 /*IN*/ UINT Length);
1656
1657NDISAPI
1658ULONG
1659DDKAPI
1660NdisBufferLength(
1661 /*IN*/ PNDIS_BUFFER Buffer);
1662
1663NDISAPI
1664PVOID
1665DDKAPI
1666NdisBufferVirtualAddress(
1667 /*IN*/ PNDIS_BUFFER Buffer);
1668
1669NDISAPI
1670ULONG
1671DDKAPI
1672NDIS_BUFFER_TO_SPAN_PAGES(
1673 /*IN*/ PNDIS_BUFFER Buffer);
1674
1675NDISAPI
1676VOID
1677DDKAPI
1678NdisFreeBuffer(
1679 /*IN*/ PNDIS_BUFFER Buffer);
1680
1681NDISAPI
1682VOID
1683DDKAPI
1684NdisGetBufferPhysicalArraySize(
1685 /*IN*/ PNDIS_BUFFER Buffer,
1686 /*OUT*/ PUINT ArraySize);
1687
1688NDISAPI
1689VOID
1690DDKAPI
1691NdisGetFirstBufferFromPacket(
1692 /*IN*/ PNDIS_PACKET _Packet,
1693 /*OUT*/ PNDIS_BUFFER *_FirstBuffer,
1694 /*OUT*/ PVOID *_FirstBufferVA,
1695 /*OUT*/ PUINT _FirstBufferLength,
1696 /*OUT*/ PUINT _TotalBufferLength);
1697
1698NDISAPI
1699VOID
1700DDKAPI
1701NdisQueryBuffer(
1702 /*IN*/ PNDIS_BUFFER Buffer,
1703 /*OUT*/ PVOID *VirtualAddress /*OPTIONAL*/,
1704 /*OUT*/ PUINT Length);
1705
1706NDISAPI
1707VOID
1708DDKAPI
1709NdisQueryBufferOffset(
1710 /*IN*/ PNDIS_BUFFER Buffer,
1711 /*OUT*/ PUINT Offset,
1712 /*OUT*/ PUINT Length);
1713
1714NDISAPI
1715VOID
1716DDKAPI
1717NdisFreeBuffer(
1718 /*IN*/ PNDIS_BUFFER Buffer);
1719
1720
1721/*
1722 * VOID
1723 * NdisGetBufferPhysicalArraySize(
1724 * IN PNDIS_BUFFER Buffer,
1725 * OUT PUINT ArraySize);
1726 */
1727#define NdisGetBufferPhysicalArraySize(Buffer, \
1728 ArraySize) \
1729{ \
1730 (*(ArraySize) = NDIS_BUFFER_TO_SPAN_PAGES(Buffer)) \
1731}
1732
1733
1734/*
1735 * VOID
1736 * NdisGetFirstBufferFromPacket(
1737 * IN PNDIS_PACKET _Packet,
1738 * OUT PNDIS_BUFFER * _FirstBuffer,
1739 * OUT PVOID * _FirstBufferVA,
1740 * OUT PUINT _FirstBufferLength,
1741 * OUT PUINT _TotalBufferLength)
1742 */
1743#define NdisGetFirstBufferFromPacket(_Packet, \
1744 _FirstBuffer, \
1745 _FirstBufferVA, \
1746 _FirstBufferLength, \
1747 _TotalBufferLength) \
1748{ \
1749 PNDIS_BUFFER _Buffer; \
1750 \
1751 _Buffer = (_Packet)->Private.Head; \
1752 *(_FirstBuffer) = _Buffer; \
1753 if (_Buffer != NULL) \
1754 { \
1755 *(_FirstBufferVA) = MmGetSystemAddressForMdl(_Buffer); \
1756 *(_FirstBufferLength) = MmGetMdlByteCount(_Buffer); \
1757 _Buffer = _Buffer->Next; \
1758 *(_TotalBufferLength) = *(_FirstBufferLength); \
1759 while (_Buffer != NULL) { \
1760 *(_TotalBufferLength) += MmGetMdlByteCount(_Buffer); \
1761 _Buffer = _Buffer->Next; \
1762 } \
1763 } \
1764 else \
1765 { \
1766 *(_FirstBufferVA) = 0; \
1767 *(_FirstBufferLength) = 0; \
1768 *(_TotalBufferLength) = 0; \
1769 } \
1770}
1771
1772/*
1773 * VOID
1774 * NdisGetFirstBufferFromPacketSafe(
1775 * IN PNDIS_PACKET _Packet,
1776 * OUT PNDIS_BUFFER * _FirstBuffer,
1777 * OUT PVOID * _FirstBufferVA,
1778 * OUT PUINT _FirstBufferLength,
1779 * OUT PUINT _TotalBufferLength),
1780 * IN MM_PAGE_PRIORITY _Priority)
1781 */
1782#define NdisGetFirstBufferFromPacketSafe(_Packet, \
1783 _FirstBuffer, \
1784 _FirstBufferVA, \
1785 _FirstBufferLength, \
1786 _TotalBufferLength, \
1787 _Priority) \
1788{ \
1789 PNDIS_BUFFER _Buffer; \
1790 \
1791 _Buffer = (_Packet)->Private.Head; \
1792 *(_FirstBuffer) = _Buffer; \
1793 if (_Buffer != NULL) \
1794 { \
1795 *(_FirstBufferVA) = MmGetSystemAddressForMdlSafe(_Buffer, _Priority); \
1796 *(_FirstBufferLength) = MmGetMdlByteCount(_Buffer); \
1797 _Buffer = _Buffer->Next; \
1798 *(_TotalBufferLength) = *(_FirstBufferLength); \
1799 while (_Buffer != NULL) { \
1800 *(_TotalBufferLength) += MmGetMdlByteCount(_Buffer); \
1801 _Buffer = _Buffer->Next; \
1802 } \
1803 } \
1804 else \
1805 { \
1806 *(_FirstBufferVA) = 0; \
1807 *(_FirstBufferLength) = 0; \
1808 *(_TotalBufferLength) = 0; \
1809 } \
1810}
1811
1812/*
1813 * VOID
1814 * NdisQueryBuffer(
1815 * IN PNDIS_BUFFER Buffer,
1816 * OUT PVOID *VirtualAddress OPTIONAL,
1817 * OUT PUINT Length)
1818 */
1819#define NdisQueryBuffer(Buffer, \
1820 VirtualAddress, \
1821 Length) \
1822{ \
1823 if (VirtualAddress) \
1824 *((PVOID*)VirtualAddress) = MmGetSystemAddressForMdl(Buffer); \
1825 \
1826 *((PUINT)Length) = MmGetMdlByteCount(Buffer); \
1827}
1828
1829
1830/*
1831 * VOID
1832 * NdisQueryBufferOffset(
1833 * IN PNDIS_BUFFER Buffer,
1834 * OUT PUINT Offset,
1835 * OUT PUINT Length);
1836 */
1837#define NdisQueryBufferOffset(Buffer, \
1838 Offset, \
1839 Length) \
1840{ \
1841 *((PUINT)Offset) = MmGetMdlByteOffset(Buffer); \
1842 *((PUINT)Length) = MmGetMdlByteCount(Buffer); \
1843}
1844
1845
1846/*
1847 * PVOID
1848 * NDIS_BUFFER_LINKAGE(
1849 * IN PNDIS_BUFFER Buffer);
1850 */
1851#define NDIS_BUFFER_LINKAGE(Buffer)(Buffer)->Next;
1852
1853
1854/*
1855 * VOID
1856 * NdisChainBufferAtBack(
1857 * IN OUT PNDIS_PACKET Packet,
1858 * IN OUT PNDIS_BUFFER Buffer)
1859 */
1860#define NdisChainBufferAtBack(Packet, \
1861 Buffer) \
1862{ \
1863 PNDIS_BUFFER NdisBuffer = (Buffer); \
1864 \
1865 while (NdisBuffer->Next != NULL) \
1866 NdisBuffer = NdisBuffer->Next; \
1867 \
1868 NdisBuffer->Next = NULL; \
1869 \
1870 if ((Packet)->Private.Head != NULL) \
1871 (Packet)->Private.Tail->Next = (Buffer); \
1872 else \
1873 (Packet)->Private.Head = (Buffer); \
1874 \
1875 (Packet)->Private.Tail = NdisBuffer; \
1876 (Packet)->Private.ValidCounts = FALSE; \
1877}
1878
1879
1880/*
1881 * VOID
1882 * NdisChainBufferAtFront(
1883 * IN OUT PNDIS_PACKET Packet,
1884 * IN OUT PNDIS_BUFFER Buffer)
1885 */
1886#define NdisChainBufferAtFront(Packet, \
1887 Buffer) \
1888{ \
1889 PNDIS_BUFFER _NdisBuffer = (Buffer); \
1890 \
1891 while (_NdisBuffer->Next != NULL) \
1892 _NdisBuffer = _NdisBuffer->Next; \
1893 \
1894 if ((Packet)->Private.Head == NULL) \
1895 (Packet)->Private.Tail = _NdisBuffer; \
1896 \
1897 _NdisBuffer->Next = (Packet)->Private.Head; \
1898 (Packet)->Private.Head = (Buffer); \
1899 (Packet)->Private.ValidCounts = FALSE; \
1900}
1901
1902
1903/*
1904 * VOID
1905 * NdisGetNextBuffer(
1906 * IN PNDIS_BUFFER CurrentBuffer,
1907 * OUT PNDIS_BUFFER * NextBuffer)
1908 */
1909#define NdisGetNextBuffer(CurrentBuffer, \
1910 NextBuffer) \
1911{ \
1912 *(NextBuffer) = (CurrentBuffer)->Next; \
1913}
1914
1915
1916/*
1917 * UINT
1918 * NdisGetPacketFlags(
1919 * IN PNDIS_PACKET Packet);
1920 */
1921#define NdisGetPacketFlags(Packet)(Packet)->Private.Flags;
1922
1923
1924/*
1925 * VOID
1926 * NdisClearPacketFlags(
1927 * IN PNDIS_PACKET Packet,
1928 * IN UINT Flags);
1929 */
1930#define NdisClearPacketFlags(Packet, Flags) \
1931 (Packet)->Private.Flags &= ~(Flags)
1932
1933
1934/*
1935 * VOID
1936 * NDIS_GET_PACKET_MEDIA_SPECIFIC_INFO(
1937 * IN PNDIS_PACKET Packet,
1938 * IN PPVOID pMediaSpecificInfo,
1939 * IN PUINT pSizeMediaSpecificInfo);
1940 */
1941#define NDIS_GET_PACKET_MEDIA_SPECIFIC_INFO(_Packet, \
1942 _pMediaSpecificInfo, \
1943 _pSizeMediaSpecificInfo) \
1944{ \
1945 if (!((_Packet)->Private.NdisPacketFlags & fPACKET_ALLOCATED_BY_NDIS) || \
1946 !((_Packet)->Private.NdisPacketFlags & fPACKET_CONTAINS_MEDIA_SPECIFIC_INFO)) \
1947 { \
1948 *(_pMediaSpecificInfo) = NULL; \
1949 *(_pSizeMediaSpecificInfo) = 0; \
1950 } \
1951 else \
1952 { \
1953 *(_pMediaSpecificInfo) = ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
1954 (_Packet)->Private.NdisPacketOobOffset))->MediaSpecificInformation; \
1955 *(_pSizeMediaSpecificInfo) = ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
1956 (_Packet)->Private.NdisPacketOobOffset))->SizeMediaSpecificInfo; \
1957 } \
1958}
1959
1960
1961/*
1962 * ULONG
1963 * NDIS_GET_PACKET_PROTOCOL_TYPE(
1964 * IN PNDIS_PACKET Packet);
1965 */
1966#define NDIS_GET_PACKET_PROTOCOL_TYPE(_Packet) \
1967 ((_Packet)->Private.Flags & NDIS_PROTOCOL_ID_MASK)
1968
1969/*
1970 * ULONG
1971 * NDIS_GET_PACKET_HEADER_SIZE(
1972 * IN PNDIS_PACKET Packet);
1973 */
1974#define NDIS_GET_PACKET_HEADER_SIZE(_Packet) \
1975 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
1976 (_Packet)->Private.NdisPacketOobOffset))->HeaderSize
1977
1978
1979/*
1980 * NDIS_STATUS
1981 * NDIS_GET_PACKET_STATUS(
1982 * IN PNDIS_PACKET Packet);
1983 */
1984#define NDIS_GET_PACKET_STATUS(_Packet) \
1985 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
1986 (_Packet)->Private.NdisPacketOobOffset))->Status
1987
1988
1989/*
1990 * ULONGLONG
1991 * NDIS_GET_PACKET_TIME_RECEIVED(
1992 * IN PNDIS_PACKET Packet);
1993 */
1994#define NDIS_GET_PACKET_TIME_RECEIVED(_Packet) \
1995 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
1996 (_Packet)->Private.NdisPacketOobOffset))->TimeReceived
1997
1998
1999/*
2000 * ULONGLONG
2001 * NDIS_GET_PACKET_TIME_SENT(
2002 * IN PNDIS_PACKET Packet);
2003 */
2004#define NDIS_GET_PACKET_TIME_SENT(_Packet) \
2005 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
2006 (_Packet)->Private.NdisPacketOobOffset))->TimeSent
2007
2008
2009/*
2010 * ULONGLONG
2011 * NDIS_GET_PACKET_TIME_TO_SEND(
2012 * IN PNDIS_PACKET Packet);
2013 */
2014#define NDIS_GET_PACKET_TIME_TO_SEND(_Packet) \
2015 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
2016 (_Packet)->Private.NdisPacketOobOffset))->TimeToSend
2017
2018
2019/*
2020 * PNDIS_PACKET_OOB_DATA
2021 * NDIS_OOB_DATA_FROM_PACKET(
2022 * IN PNDIS_PACKET Packet);
2023 */
2024#define NDIS_OOB_DATA_FROM_PACKET(_Packet) \
2025 (PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
2026 (_Packet)->Private.NdisPacketOobOffset)
2027
2028
2029/*
2030 * VOID
2031 * NdisQueryPacket(
2032 * IN PNDIS_PACKET Packet,
2033 * OUT PUINT PhysicalBufferCount OPTIONAL,
2034 * OUT PUINT BufferCount OPTIONAL,
2035 * OUT PNDIS_BUFFER *FirstBuffer OPTIONAL,
2036 * OUT PUINT TotalPacketLength OPTIONAL);
2037 */
2038#define NdisQueryPacket(Packet, \
2039 PhysicalBufferCount, \
2040 BufferCount, \
2041 FirstBuffer, \
2042 TotalPacketLength) \
2043{ \
2044 if (FirstBuffer) \
2045 *((PNDIS_BUFFER*)FirstBuffer) = (Packet)->Private.Head; \
2046 if ((TotalPacketLength) || (BufferCount) || (PhysicalBufferCount)) \
2047 { \
2048 if (!(Packet)->Private.ValidCounts) { \
2049 UINT _Offset; \
2050 UINT _PacketLength; \
2051 PNDIS_BUFFER _NdisBuffer; \
2052 UINT _PhysicalBufferCount = 0; \
2053 UINT _TotalPacketLength = 0; \
2054 UINT _Count = 0; \
2055 \
2056 for (_NdisBuffer = (Packet)->Private.Head; \
2057 _NdisBuffer != (PNDIS_BUFFER)NULL; \
2058 _NdisBuffer = _NdisBuffer->Next) \
2059 { \
2060 _PhysicalBufferCount += NDIS_BUFFER_TO_SPAN_PAGES(_NdisBuffer); \
2061 NdisQueryBufferOffset(_NdisBuffer, &_Offset, &_PacketLength); \
2062 _TotalPacketLength += _PacketLength; \
2063 _Count++; \
2064 } \
2065 (Packet)->Private.PhysicalCount = _PhysicalBufferCount; \
2066 (Packet)->Private.TotalLength = _TotalPacketLength; \
2067 (Packet)->Private.Count = _Count; \
2068 (Packet)->Private.ValidCounts = TRUE; \
2069 } \
2070 \
2071 if (PhysicalBufferCount) \
2072 *((PUINT)PhysicalBufferCount) = (Packet)->Private.PhysicalCount; \
2073 \
2074 if (BufferCount) \
2075 *((PUINT)BufferCount) = (Packet)->Private.Count; \
2076 \
2077 if (TotalPacketLength) \
2078 *((PUINT)TotalPacketLength) = (Packet)->Private.TotalLength; \
2079 } \
2080}
2081
2082/*
2083 * VOID
2084 * NdisQueryPacketLength(
2085 * IN PNDIS_PACKET Packet,
2086 * OUT PUINT PhysicalBufferCount OPTIONAL,
2087 * OUT PUINT BufferCount OPTIONAL,
2088 * OUT PNDIS_BUFFER *FirstBuffer OPTIONAL,
2089 * OUT PUINT TotalPacketLength OPTIONAL);
2090 */
2091#define NdisQueryPacketLength(Packet, \
2092 TotalPacketLength) \
2093{ \
2094 if ((TotalPacketLength)) \
2095 { \
2096 if (!(Packet)->Private.ValidCounts) { \
2097 UINT _Offset; \
2098 UINT _PacketLength; \
2099 PNDIS_BUFFER _NdisBuffer; \
2100 UINT _PhysicalBufferCount = 0; \
2101 UINT _TotalPacketLength = 0; \
2102 UINT _Count = 0; \
2103 \
2104 for (_NdisBuffer = (Packet)->Private.Head; \
2105 _NdisBuffer != (PNDIS_BUFFER)NULL; \
2106 _NdisBuffer = _NdisBuffer->Next) \
2107 { \
2108 _PhysicalBufferCount += NDIS_BUFFER_TO_SPAN_PAGES(_NdisBuffer); \
2109 NdisQueryBufferOffset(_NdisBuffer, &_Offset, &_PacketLength); \
2110 _TotalPacketLength += _PacketLength; \
2111 _Count++; \
2112 } \
2113 (Packet)->Private.PhysicalCount = _PhysicalBufferCount; \
2114 (Packet)->Private.TotalLength = _TotalPacketLength; \
2115 (Packet)->Private.Count = _Count; \
2116 (Packet)->Private.ValidCounts = TRUE; \
2117 } \
2118 \
2119 if (TotalPacketLength) \
2120 *((PUINT)TotalPacketLength) = (Packet)->Private.TotalLength; \
2121 } \
2122}
2123
2124
2125/*
2126 * VOID
2127 * NdisRecalculatePacketCounts(
2128 * IN OUT PNDIS_PACKET Packet);
2129 */
2130#define NdisRecalculatePacketCounts(Packet) \
2131{ \
2132 PNDIS_BUFFER _Buffer = (Packet)->Private.Head; \
2133 if (_Buffer != NULL) \
2134 { \
2135 while (_Buffer->Next != NULL) \
2136 { \
2137 ´_Buffer = _Buffer->Next; \
2138 } \
2139 (Packet)->Private.Tail = _Buffer; \
2140 } \
2141 (Packet)->Private.ValidCounts = FALSE; \
2142}
2143
2144
2145/*
2146 * VOID
2147 * NdisReinitializePacket(
2148 * IN OUT PNDIS_PACKET Packet);
2149 */
2150#define NdisReinitializePacket(Packet) \
2151{ \
2152 (Packet)->Private.Head = (PNDIS_BUFFER)NULL; \
2153 (Packet)->Private.ValidCounts = FALSE; \
2154}
2155
2156
2157/*
2158 * VOID
2159 * NdisSetPacketFlags(
2160 * IN PNDIS_PACKET Packet,
2161 * IN UINT Flags);
2162 */
2163#define NdisSetPacketFlags(Packet, Flags) \
2164 (Packet)->Private.Flags |= (Flags);
2165
2166
2167/*
2168 * VOID
2169 * NDIS_SET_PACKET_HEADER_SIZE(
2170 * IN PNDIS_PACKET Packet,
2171 * IN UINT HdrSize);
2172 */
2173#define NDIS_SET_PACKET_HEADER_SIZE(_Packet, _HdrSize) \
2174 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
2175 (_Packet)->Private.NdisPacketOobOffset))->HeaderSize = (_HdrSize)
2176
2177
2178/*
2179 * VOID
2180 * NDIS_SET_PACKET_MEDIA_SPECIFIC_INFO(
2181 * IN PNDIS_PACKET Packet,
2182 * IN PVOID MediaSpecificInfo,
2183 * IN UINT SizeMediaSpecificInfo);
2184 */
2185#define NDIS_SET_PACKET_MEDIA_SPECIFIC_INFO(_Packet, \
2186 _MediaSpecificInfo, \
2187 _SizeMediaSpecificInfo) \
2188{ \
2189 if ((_Packet)->Private.NdisPacketFlags & fPACKET_ALLOCATED_BY_NDIS) \
2190 { \
2191 (_Packet)->Private.NdisPacketFlags |= fPACKET_CONTAINS_MEDIA_SPECIFIC_INFO; \
2192 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
2193 (_Packet)->Private.NdisPacketOobOffset))->MediaSpecificInformation = \
2194 (_MediaSpecificInfo); \
2195 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
2196 (_Packet)->Private.NdisPacketOobOffset))->SizeMediaSpecificInfo = \
2197 (_SizeMediaSpecificInfo); \
2198 } \
2199}
2200
2201
2202/*
2203 * VOID
2204 * NDIS_SET_PACKET_STATUS(
2205 * IN PNDIS_PACKET Packet,
2206 * IN NDIS_STATUS Status);
2207 */
2208#define NDIS_SET_PACKET_STATUS(_Packet, _Status) \
2209 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
2210 (_Packet)->Private.NdisPacketOobOffset))->Status = (_Status)
2211
2212
2213/*
2214 * VOID
2215 * NDIS_SET_PACKET_TIME_RECEIVED(
2216 * IN PNDIS_PACKET Packet,
2217 * IN ULONGLONG TimeReceived);
2218 */
2219#define NDIS_SET_PACKET_TIME_RECEIVED(_Packet, _TimeReceived) \
2220 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
2221 (_Packet)->Private.NdisPacketOobOffset))->TimeReceived = (_TimeReceived)
2222
2223
2224/*
2225 * VOID
2226 * NDIS_SET_PACKET_TIME_SENT(
2227 * IN PNDIS_PACKET Packet,
2228 * IN ULONGLONG TimeSent);
2229 */
2230#define NDIS_SET_PACKET_TIME_SENT(_Packet, _TimeSent) \
2231 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
2232 (_Packet)->Private.NdisPacketOobOffset))->TimeSent = (_TimeSent)
2233
2234
2235/*
2236 * VOID
2237 * NDIS_SET_PACKET_TIME_TO_SEND(
2238 * IN PNDIS_PACKET Packet,
2239 * IN ULONGLONG TimeToSend);
2240 */
2241#define NDIS_SET_PACKET_TIME_TO_SEND(_Packet, _TimeToSend) \
2242 ((PNDIS_PACKET_OOB_DATA)((PUCHAR)(_Packet) + \
2243 (_Packet)->Private.NdisPacketOobOffset))->TimeToSend = (_TimeToSend)
2244
2245
2246/*
2247 * VOID
2248 * NdisSetSendFlags(
2249 * IN PNDIS_PACKET Packet,
2250 * IN UINT Flags);
2251 */
2252#define NdisSetSendFlags(_Packet,_Flags)(_Packet)->Private.Flags = (_Flags)
2253
2254
2255
2256/* Memory management routines */
2257
2258/*
2259 * VOID
2260 * NdisCreateLookaheadBufferFromSharedMemory(
2261 * IN PVOID pSharedMemory,
2262 * IN UINT LookaheadLength,
2263 * OUT PVOID *pLookaheadBuffer)
2264 */
2265#define NdisCreateLookaheadBufferFromSharedMemory(_pSharedMemory, \
2266 _LookaheadLength, \
2267 _pLookaheadBuffer) \
2268 ((*(_pLookaheadBuffer)) = (_pSharedMemory))
2269
2270/*
2271 * VOID
2272 * NdisDestroyLookaheadBufferFromSharedMemory(
2273 * IN PVOID pLookaheadBuffer)
2274 */
2275#define NdisDestroyLookaheadBufferFromSharedMemory(_pLookaheadBuffer)
2276
2277#if defined(i386)
2278
2279/*
2280 * VOID
2281 * NdisMoveFromMappedMemory(
2282 * OUT PVOID Destination,
2283 * IN PVOID Source,
2284 * IN ULONG Length);
2285 */
2286#define NdisMoveFromMappedMemory(Destination, Source, Length) \
2287 NdisMoveMappedMemory(Destination, Source, Length)
2288
2289/*
2290 * VOID
2291 * NdisMoveMappedMemory(
2292 * OUT PVOID Destination,
2293 * IN PVOID Source,
2294 * IN ULONG Length);
2295 */
2296#define NdisMoveMappedMemory(Destination, Source, Length) \
2297 RtlCopyMemory(Destination, Source, Length)
2298
2299/*
2300 * VOID
2301 * NdisMoveToMappedMemory(
2302 * OUT PVOID Destination,
2303 * IN PVOID Source,
2304 * IN ULONG Length);
2305 */
2306#define NdisMoveToMappedMemory(Destination, Source, Length) \
2307 NdisMoveMappedMemory(Destination, Source, Length)
2308
2309#endif /* i386 */
2310
2311/*
2312 * VOID
2313 * NdisMUpdateSharedMemory(
2314 * IN NDIS_HANDLE MiniportAdapterHandle,
2315 * IN ULONG Length,
2316 * IN PVOID VirtualAddress,
2317 * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress);
2318 */
2319#define NdisMUpdateSharedMemory(_H, _L, _V, _P) \
2320 NdisUpdateSharedMemory(_H, _L, _V, _P)
2321
2322NDISAPI
2323NDIS_STATUS
2324DDKAPI
2325NdisAllocateMemory(
2326 /*OUT*/ PVOID *VirtualAddress,
2327 /*IN*/ UINT Length,
2328 /*IN*/ UINT MemoryFlags,
2329 /*IN*/ NDIS_PHYSICAL_ADDRESS HighestAcceptableAddress);
2330
2331NDISAPI
2332VOID
2333DDKAPI
2334NdisFreeMemory(
2335 /*IN*/ PVOID VirtualAddress,
2336 /*IN*/ UINT Length,
2337 /*IN*/ UINT MemoryFlags);
2338
2339NDISAPI
2340VOID
2341DDKAPI
2342NdisImmediateReadSharedMemory(
2343 /*IN*/ NDIS_HANDLE WrapperConfigurationContext,
2344 /*IN*/ ULONG SharedMemoryAddress,
2345 /*OUT*/ PUCHAR Buffer,
2346 /*IN*/ ULONG Length);
2347
2348NDISAPI
2349VOID
2350DDKAPI
2351NdisImmediateWriteSharedMemory(
2352 /*IN*/ NDIS_HANDLE WrapperConfigurationContext,
2353 /*IN*/ ULONG SharedMemoryAddress,
2354 /*IN*/ PUCHAR Buffer,
2355 /*IN*/ ULONG Length);
2356
2357NDISAPI
2358VOID
2359DDKAPI
2360NdisMAllocateSharedMemory(
2361 /*IN*/ NDIS_HANDLE MiniportAdapterHandle,
2362 /*IN*/ ULONG Length,
2363 /*IN*/ BOOLEAN Cached,
2364 /*OUT*/ PVOID *VirtualAddress,
2365 /*OUT*/ PNDIS_PHYSICAL_ADDRESS PhysicalAddress);
2366
2367NDISAPI
2368NDIS_STATUS
2369DDKAPI
2370NdisMAllocateSharedMemoryAsync(
2371 /*IN*/ NDIS_HANDLE MiniportAdapterHandle,
2372 /*IN*/ ULONG Length,
2373 /*IN*/ BOOLEAN Cached,
2374 /*IN*/ PVOID Context);
2375
2376#if defined(NDIS50)
2377
2378#define NdisUpdateSharedMemory(NdisAdapterHandle, \
2379 Length, \
2380 VirtualAddress, \
2381 PhysicalAddress)
2382
2383#else
2384
2385NDISAPI
2386VOID
2387DDKAPI
2388NdisUpdateSharedMemory(
2389 /*IN*/ NDIS_HANDLE NdisAdapterHandle,
2390 /*IN*/ ULONG Length,
2391 /*IN*/ PVOID VirtualAddress,
2392 /*IN*/ NDIS_PHYSICAL_ADDRESS PhysicalAddress);
2393
2394#endif /* defined(NDIS50) */
2395
2396/*
2397 * ULONG
2398 * NdisGetPhysicalAddressHigh(
2399 * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress);
2400 */
2401#define NdisGetPhysicalAddressHigh(PhysicalAddress) \
2402 ((PhysicalAddress).HighPart)
2403
2404/*
2405 * VOID
2406 * NdisSetPhysicalAddressHigh(
2407 * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress,
2408 * IN ULONG Value);
2409 */
2410#define NdisSetPhysicalAddressHigh(PhysicalAddress, Value) \
2411 ((PhysicalAddress).HighPart) = (Value)
2412
2413/*
2414 * ULONG
2415 * NdisGetPhysicalAddressLow(
2416 * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress);
2417 */
2418#define NdisGetPhysicalAddressLow(PhysicalAddress) \
2419 ((PhysicalAddress).LowPart)
2420
2421
2422/*
2423 * VOID
2424 * NdisSetPhysicalAddressLow(
2425 * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress,
2426 * IN ULONG Value);
2427 */
2428#define NdisSetPhysicalAddressLow(PhysicalAddress, Value) \
2429 ((PhysicalAddress).LowPart) = (Value)
2430
2431/*
2432 * VOID
2433 * NDIS_PHYSICAL_ADDRESS_CONST(
2434 * IN ULONG Low,
2435 * IN LONG High);
2436 */
2437#define NDIS_PHYSICAL_ADDRESS_CONST(Low, High) \
2438 { {(ULONG)(Low), (LONG)(High)} }
2439
2440/*
2441 * ULONG
2442 * NdisEqualMemory(
2443 * IN CONST VOID *Source1,
2444 * IN CONST VOID *Source2,
2445 * IN ULONG Length);
2446 */
2447#define NdisEqualMemory(Source1, Source2, Length) \
2448 RtlEqualMemory(Source1, Source2, Length)
2449
2450/*
2451 * VOID
2452 * NdisFillMemory(
2453 * IN PVOID Destination,
2454 * IN ULONG Length,
2455 * IN UCHAR Fill);
2456 */
2457#define NdisFillMemory(Destination, Length, Fill) \
2458 RtlFillMemory(Destination, Length, Fill)
2459
2460/*
2461 * VOID
2462 * NdisZeroMappedMemory(
2463 * IN PVOID Destination,
2464 * IN ULONG Length);
2465 */
2466#define NdisZeroMappedMemory(Destination, Length) \
2467 RtlZeroMemory(Destination, Length)
2468
2469/*
2470 * VOID
2471 * NdisMoveMemory(
2472 * OUT PVOID Destination,
2473 * IN PVOID Source,
2474 * IN ULONG Length);
2475 */
2476#define NdisMoveMemory(Destination, Source, Length) \
2477 RtlCopyMemory(Destination, Source, Length)
2478
2479
2480/*
2481 * VOID
2482 * NdisRetrieveUlong(
2483 * IN PULONG DestinationAddress,
2484 * IN PULONG SourceAddress);
2485 */
2486#define NdisRetrieveUlong(DestinationAddress, SourceAddress) \
2487 RtlRetrieveUlong(DestinationAddress, SourceAddress)
2488
2489
2490/*
2491 * VOID
2492 * NdisStoreUlong(
2493 * IN PULONG DestinationAddress,
2494 * IN ULONG Value);
2495 */
2496#define NdisStoreUlong(DestinationAddress, Value) \
2497 RtlStoreUlong(DestinationAddress, Value)
2498
2499
2500/*
2501 * VOID
2502 * NdisZeroMemory(
2503 * IN PVOID Destination,
2504 * IN ULONG Length)
2505 */
2506#define NdisZeroMemory(Destination, Length) \
2507 RtlZeroMemory(Destination, Length)
2508
2509
2510
2511/* Configuration routines */
2512
2513NDISAPI
2514VOID
2515DDKAPI
2516NdisOpenConfiguration(
2517 /*OUT*/ PNDIS_STATUS Status,
2518 /*OUT*/ PNDIS_HANDLE ConfigurationHandle,
2519 /*IN*/ NDIS_HANDLE WrapperConfigurationContext);
2520
2521NDISAPI
2522VOID
2523DDKAPI
2524NdisReadNetworkAddress(
2525 /*OUT*/ PNDIS_STATUS Status,
2526 /*OUT*/ PVOID *NetworkAddress,
2527 /*OUT*/ PUINT NetworkAddressLength,
2528 /*IN*/ NDIS_HANDLE ConfigurationHandle);
2529
2530NDISAPI
2531VOID
2532DDKAPI
2533NdisReadEisaSlotInformation(
2534 /*OUT*/ PNDIS_STATUS Status,
2535 /*IN*/ NDIS_HANDLE WrapperConfigurationContext,
2536 /*OUT*/ PUINT SlotNumber,
2537 /*OUT*/ PNDIS_EISA_FUNCTION_INFORMATION EisaData);
2538
2539NDISAPI
2540VOID
2541DDKAPI
2542NdisReadEisaSlotInformationEx(
2543 /*OUT*/ PNDIS_STATUS Status,
2544 /*IN*/ NDIS_HANDLE WrapperConfigurationContext,
2545 /*OUT*/ PUINT SlotNumber,
2546 /*OUT*/ PNDIS_EISA_FUNCTION_INFORMATION *EisaData,
2547 /*OUT*/ PUINT NumberOfFunctions);
2548
2549NDISAPI
2550ULONG
2551DDKAPI
2552NdisReadPciSlotInformation(
2553 /*IN*/ NDIS_HANDLE NdisAdapterHandle,
2554 /*IN*/ ULONG SlotNumber,
2555 /*IN*/ ULONG Offset,
2556 /*IN*/ PVOID Buffer,
2557 /*IN*/ ULONG Length);
2558
2559NDISAPI
2560ULONG
2561DDKAPI
2562NdisWritePciSlotInformation(
2563 /*IN*/ NDIS_HANDLE NdisAdapterHandle,
2564 /*IN*/ ULONG SlotNumber,
2565 /*IN*/ ULONG Offset,
2566 /*IN*/ PVOID Buffer,
2567 /*IN*/ ULONG Length);
2568
2569
2570
2571/* String management routines */
2572
2573NDISAPI
2574NDIS_STATUS
2575DDKAPI
2576NdisAnsiStringToUnicodeString(
2577 /*IN OUT*/ PNDIS_STRING DestinationString,
2578 /*IN*/ PNDIS_ANSI_STRING SourceString);
2579
2580/*
2581 * BOOLEAN
2582 * NdisEqualString(
2583 * IN PNDIS_STRING String1,
2584 * IN PNDIS_STRING String2,
2585 * IN BOOLEAN CaseInsensitive);
2586 */
2587#define NdisEqualString(_String1, _String2, _CaseInsensitive) \
2588 RtlEqualUnicodeString(_String1, _String2, _CaseInsensitive)
2589
2590NDISAPI
2591VOID
2592DDKAPI
2593NdisInitAnsiString(
2594 /*IN OUT*/ PNDIS_ANSI_STRING DestinationString,
2595 /*IN*/ PCSTR SourceString);
2596
2597NDISAPI
2598VOID
2599DDKAPI
2600NdisInitUnicodeString(
2601 /*IN OUT*/ PNDIS_STRING DestinationString,
2602 /*IN*/ PCWSTR SourceString);
2603
2604NDISAPI
2605NDIS_STATUS
2606DDKAPI
2607NdisUnicodeStringToAnsiString(
2608 /*IN OUT*/ PNDIS_ANSI_STRING DestinationString,
2609 /*IN*/ PNDIS_STRING SourceString);
2610
2611#define NdisFreeString(_s) NdisFreeMemory((_s).Buffer, (_s).MaximumLength, 0)
2612#define NdisPrintString(_s) DbgPrint("%ls", (_s).Buffer)
2613
2614
2615/* Spin lock reoutines */
2616
2617/*
2618 * VOID
2619 * NdisAllocateSpinLock(
2620 * IN PNDIS_SPIN_LOCK SpinLock);
2621 */
2622#define NdisAllocateSpinLock(_SpinLock) \
2623 KeInitializeSpinLock(&(_SpinLock)->SpinLock)
2624
2625/*
2626 * VOID
2627 * NdisFreeSpinLock(
2628 * IN PNDIS_SPIN_LOCK SpinLock);
2629 */
2630#define NdisFreeSpinLock(_SpinLock)
2631
2632/*
2633 * VOID
2634 * NdisAcquireSpinLock(
2635 * IN PNDIS_SPIN_LOCK SpinLock);
2636 */
2637#define NdisAcquireSpinLock(_SpinLock) \
2638 KeAcquireSpinLock(&(_SpinLock)->SpinLock, &(_SpinLock)->OldIrql)
2639
2640/*
2641 * VOID
2642 * NdisReleaseSpinLock(
2643 * IN PNDIS_SPIN_LOCK SpinLock);
2644 */
2645#define NdisReleaseSpinLock(_SpinLock) \
2646 KeReleaseSpinLock(&(_SpinLock)->SpinLock, (_SpinLock)->OldIrql)
2647
2648/*
2649 * VOID
2650 * NdisDprAcquireSpinLock(
2651 * IN PNDIS_SPIN_LOCK SpinLock);
2652 */
2653#define NdisDprAcquireSpinLock(_SpinLock) \
2654{ \
2655 KeAcquireSpinLockAtDpcLevel(&(_SpinLock)->SpinLock); \
2656 (_SpinLock)->OldIrql = DISPATCH_LEVEL; \
2657}
2658
2659/*
2660 * VOID
2661 * NdisDprReleaseSpinLock(
2662 * IN PNDIS_SPIN_LOCK SpinLock);
2663 */
2664#define NdisDprReleaseSpinLock(_SpinLock) \
2665 KeReleaseSpinLockFromDpcLevel(&(_SpinLock)->SpinLock)
2666
2667
2668
2669/* I/O routines */
2670
2671/*
2672 * VOID
2673 * NdisRawReadPortBufferUchar(
2674 * IN ULONG Port,
2675 * OUT PUCHAR Buffer,
2676 * IN ULONG Length);
2677 */
2678#define NdisRawReadPortBufferUchar(Port, Buffer, Length) \
2679 READ_PORT_BUFFER_UCHAR((PUCHAR)(Port), (PUCHAR)(Buffer), (Length))
2680
2681/*
2682 * VOID
2683 * NdisRawReadPortBufferUlong(
2684 * IN ULONG Port,
2685 * OUT PULONG Buffer,
2686 * IN ULONG Length);
2687 */
2688#define NdisRawReadPortBufferUlong(Port, Buffer, Length) \
2689 READ_PORT_BUFFER_ULONG((PULONG)(Port), (PULONG)(Buffer), (Length))
2690
2691/*
2692 * VOID
2693 * NdisRawReadPortBufferUshort(
2694 * IN ULONG Port,
2695 * OUT PUSHORT Buffer,
2696 * IN ULONG Length);
2697 */
2698#define NdisRawReadPortBufferUshort(Port, Buffer, Length) \
2699 READ_PORT_BUFFER_USHORT((PUSHORT)(Port), (PUSHORT)(Buffer), (Length))
2700
2701
2702/*
2703 * VOID
2704 * NdisRawReadPortUchar(
2705 * IN ULONG Port,
2706 * OUT PUCHAR Data);
2707 */
2708#define NdisRawReadPortUchar(Port, Data) \
2709 *(Data) = READ_PORT_UCHAR((PUCHAR)(Port))
2710
2711/*
2712 * VOID
2713 * NdisRawReadPortUlong(
2714 * IN ULONG Port,
2715 * OUT PULONG Data);
2716 */
2717#define NdisRawReadPortUlong(Port, Data) \
2718 *(Data) = READ_PORT_ULONG((PULONG)(Port))
2719
2720/*
2721 * VOID
2722 * NdisRawReadPortUshort(
2723 * IN ULONG Port,
2724 * OUT PUSHORT Data);
2725 */
2726#define NdisRawReadPortUshort(Port, Data) \
2727 *(Data) = READ_PORT_USHORT((PUSHORT)(Port))
2728
2729
2730/*
2731 * VOID
2732 * NdisRawWritePortBufferUchar(
2733 * IN ULONG Port,
2734 * IN PUCHAR Buffer,
2735 * IN ULONG Length);
2736 */
2737#define NdisRawWritePortBufferUchar(Port, Buffer, Length) \
2738 WRITE_PORT_BUFFER_UCHAR((PUCHAR)(Port), (PUCHAR)(Buffer), (Length))
2739
2740/*
2741 * VOID
2742 * NdisRawWritePortBufferUlong(
2743 * IN ULONG Port,
2744 * IN PULONG Buffer,
2745 * IN ULONG Length);
2746 */
2747#define NdisRawWritePortBufferUlong(Port, Buffer, Length) \
2748 WRITE_PORT_BUFFER_ULONG((PULONG)(Port), (PULONG)(Buffer), (Length))
2749
2750/*
2751 * VOID
2752 * NdisRawWritePortBufferUshort(
2753 * IN ULONG Port,
2754 * IN PUSHORT Buffer,
2755 * IN ULONG Length);
2756 */
2757#define NdisRawWritePortBufferUshort(Port, Buffer, Length) \
2758 WRITE_PORT_BUFFER_USHORT((PUSHORT)(Port), (PUSHORT)(Buffer), (Length))
2759
2760
2761/*
2762 * VOID
2763 * NdisRawWritePortUchar(
2764 * IN ULONG Port,
2765 * IN UCHAR Data);
2766 */
2767#define NdisRawWritePortUchar(Port, Data) \
2768 WRITE_PORT_UCHAR((PUCHAR)(Port), (UCHAR)(Data))
2769
2770/*
2771 * VOID
2772 * NdisRawWritePortUlong(
2773 * IN ULONG Port,
2774 * IN ULONG Data);
2775 */
2776#define NdisRawWritePortUlong(Port, Data) \
2777 WRITE_PORT_ULONG((PULONG)(Port), (ULONG)(Data))
2778
2779/*
2780 * VOID
2781 * NdisRawWritePortUshort(
2782 * IN ULONG Port,
2783 * IN USHORT Data);
2784 */
2785#define NdisRawWritePortUshort(Port, Data) \
2786 WRITE_PORT_USHORT((PUSHORT)(Port), (USHORT)(Data))
2787
2788
2789/*
2790 * VOID
2791 * NdisReadRegisterUchar(
2792 * IN PUCHAR Register,
2793 * OUT PUCHAR Data);
2794 */
2795#define NdisReadRegisterUchar(Register, Data) \
2796 *(Data) = *(Register)
2797
2798/*
2799 * VOID
2800 * NdisReadRegisterUlong(
2801 * IN PULONG Register,
2802 * OUT PULONG Data);
2803 */
2804#define NdisReadRegisterUlong(Register, Data) \
2805 *(Data) = *(Register)
2806
2807/*
2808 * VOID
2809 * NdisReadRegisterUshort(
2810 * IN PUSHORT Register,
2811 * OUT PUSHORT Data);
2812 */
2813#define NdisReadRegisterUshort(Register, Data) \
2814 *(Data) = *(Register)
2815
2816/*
2817 * VOID
2818 * NdisReadRegisterUchar(
2819 * IN PUCHAR Register,
2820 * IN UCHAR Data);
2821 */
2822#define NdisWriteRegisterUchar(Register, Data) \
2823 WRITE_REGISTER_UCHAR((Register), (Data))
2824
2825/*
2826 * VOID
2827 * NdisReadRegisterUlong(
2828 * IN PULONG Register,
2829 * IN ULONG Data);
2830 */
2831#define NdisWriteRegisterUlong(Register, Data) \
2832 WRITE_REGISTER_ULONG((Register), (Data))
2833
2834/*
2835 * VOID
2836 * NdisReadRegisterUshort(
2837 * IN PUSHORT Register,
2838 * IN USHORT Data);
2839 */
2840#define NdisWriteRegisterUshort(Register, Data) \
2841 WRITE_REGISTER_USHORT((Register), (Data))
2842
2843
2844/* Linked lists */
2845
2846/*
2847 * VOID
2848 * NdisInitializeListHead(
2849 * IN PLIST_ENTRY ListHead);
2850 */
2851#define NdisInitializeListHead(_ListHead) \
2852 InitializeListHead(_ListHead)
2853
2854/*
2855 * PLIST_ENTRY
2856 * NdisInterlockedInsertHeadList(
2857 * IN PLIST_ENTRY ListHead,
2858 * IN PLIST_ENTRY ListEntry,
2859 * IN PNDIS_SPIN_LOCK SpinLock);
2860 */
2861#define NdisInterlockedInsertHeadList(_ListHead, _ListEntry, _SpinLock) \
2862 ExInterlockedInsertHeadList(_ListHead, _ListEntry, &(_SpinLock)->SpinLock)
2863
2864/*
2865 * PLIST_ENTRY
2866 * NdisInterlockedInsertTailList(
2867 * IN PLIST_ENTRY ListHead,
2868 * IN PLIST_ENTRY ListEntry,
2869 * IN PNDIS_SPIN_LOCK SpinLock);
2870 */
2871#define NdisInterlockedInsertTailList(_ListHead, _ListEntry, _SpinLock) \
2872 ExInterlockedInsertTailList(_ListHead, _ListEntry, &(_SpinLock)->SpinLock)
2873
2874/*
2875 * PLIST_ENTRY
2876 * NdisInterlockedRemoveHeadList(
2877 * IN PLIST_ENTRY ListHead,
2878 * IN PNDIS_SPIN_LOCK SpinLock);
2879*/
2880#define NdisInterlockedRemoveHeadList(_ListHead, _SpinLock) \
2881 ExInterlockedRemoveHeadList(_ListHead, &(_SpinLock)->SpinLock)
2882
2883/*
2884 * VOID
2885 * NdisInitializeSListHead(
2886 * IN PSLIST_HEADER SListHead);
2887 */
2888#define NdisInitializeSListHead(SListHead) ExInitializeSListHead(SListHead)
2889
2890/*
2891 * USHORT NdisQueryDepthSList(
2892 * IN PSLIST_HEADER SListHead);
2893 */
2894#define NdisQueryDepthSList(SListHead) ExQueryDepthSList(SListHead)
2895
2896
2897
2898/* Interlocked routines */
2899
2900/*
2901 * LONG
2902 * NdisInterlockedDecrement(
2903 * IN PLONG Addend);
2904 */
2905#define NdisInterlockedDecrement(Addend) InterlockedDecrement(Addend)
2906
2907/*
2908 * LONG
2909 * NdisInterlockedIncrement(
2910 * IN PLONG Addend);
2911 */
2912#define NdisInterlockedIncrement(Addend) InterlockedIncrement(Addend)
2913
2914/*
2915 * VOID
2916 * NdisInterlockedAddUlong(
2917 * IN PULONG Addend,
2918 * IN ULONG Increment,
2919 * IN PNDIS_SPIN_LOCK SpinLock);
2920 */
2921#define NdisInterlockedAddUlong(_Addend, _Increment, _SpinLock) \
2922 ExInterlockedAddUlong(_Addend, _Increment, &(_SpinLock)->SpinLock)
2923
2924
2925
2926/* Miscellaneous routines */
2927
2928NDISAPI
2929VOID
2930DDKAPI
2931NdisCloseConfiguration(
2932 /*IN*/ NDIS_HANDLE ConfigurationHandle);
2933
2934NDISAPI
2935VOID
2936DDKAPI
2937NdisReadConfiguration(
2938 /*OUT*/ PNDIS_STATUS Status,
2939 /*OUT*/ PNDIS_CONFIGURATION_PARAMETER *ParameterValue,
2940 /*IN*/ NDIS_HANDLE ConfigurationHandle,
2941 /*IN*/ PNDIS_STRING Keyword,
2942 /*IN*/ NDIS_PARAMETER_TYPE ParameterType);
2943
2944NDISAPI
2945VOID
2946DDKAPI
2947NdisWriteConfiguration(
2948 /*OUT*/ PNDIS_STATUS Status,
2949 /*IN*/ NDIS_HANDLE WrapperConfigurationContext,
2950 /*IN*/ PNDIS_STRING Keyword,
2951 /*IN*/ PNDIS_CONFIGURATION_PARAMETER *ParameterValue);
2952
2953NDISAPI
2954VOID
2955DDKCDECLAPI
2956NdisWriteErrorLogEntry(
2957 /*IN*/ NDIS_HANDLE NdisAdapterHandle,
2958 /*IN*/ NDIS_ERROR_CODE ErrorCode,
2959 /*IN*/ ULONG NumberOfErrorValues,
2960 /*IN*/ ...);
2961
2962/*
2963 * VOID
2964 * NdisStallExecution(
2965 * IN UINT MicrosecondsToStall)
2966 */
2967#define NdisStallExecution KeStallExecutionProcessor
2968
2969/*
2970 * VOID
2971 * NdisGetCurrentSystemTime(
2972 * IN PLARGE_INTEGER pSystemTime);
2973 */
2974#define NdisGetCurrentSystemTime KeQuerySystemTime
2975
2976NDISAPI
2977VOID
2978DDKAPI
2979NdisGetCurrentProcessorCpuUsage(
2980 /*OUT*/ PULONG pCpuUsage);
2981
2982
2983
2984/* NDIS helper macros */
2985
2986/*
2987 * VOID
2988 * NDIS_INIT_FUNCTION(FunctionName)
2989 */
2990#define NDIS_INIT_FUNCTION(FunctionName) \
2991 alloc_text(init, FunctionName)
2992
2993/*
2994 * VOID
2995 * NDIS_PAGABLE_FUNCTION(FunctionName)
2996 */
2997#define NDIS_PAGEABLE_FUNCTION(FunctionName) \
2998 alloc_text(page, FunctionName)
2999
3000#define NDIS_PAGABLE_FUNCTION NDIS_PAGEABLE_FUNCTION
3001
3002
3003/* NDIS 4.0 extensions */
3004
3005NDISAPI
3006VOID
3007DDKAPI
3008NdisMFreeSharedMemory(
3009 /*IN*/ NDIS_HANDLE MiniportAdapterHandle,
3010 /*IN*/ ULONG Length,
3011 /*IN*/ BOOLEAN Cached,
3012 /*IN*/ PVOID VirtualAddress,
3013 /*IN*/ NDIS_PHYSICAL_ADDRESS PhysicalAddress);
3014
3015NDISAPI
3016VOID
3017DDKAPI
3018NdisMWanIndicateReceive(
3019 /*OUT*/ PNDIS_STATUS Status,
3020 /*IN*/ NDIS_HANDLE MiniportAdapterHandle,
3021 /*IN*/ NDIS_HANDLE NdisLinkContext,
3022 /*IN*/ PUCHAR PacketBuffer,
3023 /*IN*/ UINT PacketSize);
3024
3025#define NdisMIndicateReceivePacket(_handle, _packets, _number) \
3026{ \
3027 (*((PNDIS_MINIPORT_BLOCK)(_handle))->PacketIndicateHandler)(_handle, _packets, _number); \
3028}
3029
3030NDISAPI
3031VOID
3032DDKAPI
3033NdisMWanIndicateReceiveComplete(
3034 /*IN*/ NDIS_HANDLE MiniportAdapterHandle);
3035
3036NDISAPI
3037VOID
3038DDKAPI
3039NdisMWanSendComplete(
3040 /*IN*/ NDIS_HANDLE MiniportAdapterHandle,
3041 /*IN*/ PNDIS_WAN_PACKET Packet,
3042 /*IN*/ NDIS_STATUS Status);
3043
3044NDISAPI
3045NDIS_STATUS
3046DDKAPI
3047NdisPciAssignResources(
3048 /*IN*/ NDIS_HANDLE NdisMacHandle,
3049 /*IN*/ NDIS_HANDLE NdisWrapperHandle,
3050 /*IN*/ NDIS_HANDLE WrapperConfigurationContext,
3051 /*IN*/ ULONG SlotNumber,
3052 /*OUT*/ PNDIS_RESOURCE_LIST *AssignedResources);
3053
3054
3055/* NDIS 5.0 extensions */
3056
3057NDISAPI
3058VOID
3059DDKAPI
3060NdisAcquireReadWriteLock(
3061 /*IN*/ PNDIS_RW_LOCK Lock,
3062 /*IN*/ BOOLEAN fWrite,
3063 /*IN*/ PLOCK_STATE LockState);
3064
3065NDISAPI
3066NDIS_STATUS
3067DDKAPI
3068NdisAllocateMemoryWithTag(
3069 /*OUT*/ PVOID *VirtualAddress,
3070 /*IN*/ UINT Length,
3071 /*IN*/ ULONG Tag);
3072
3073NDISAPI
3074VOID
3075DDKAPI
3076NdisAllocatePacketPoolEx(
3077 /*OUT*/ PNDIS_STATUS Status,
3078 /*OUT*/ PNDIS_HANDLE PoolHandle,
3079 /*IN*/ UINT NumberOfDescriptors,
3080 /*IN*/ UINT NumberOfOverflowDescriptors,
3081 /*IN*/ UINT ProtocolReservedLength);
3082
3083NDISAPI
3084VOID
3085DDKAPI
3086NdisCompletePnPEvent(
3087 /*IN*/ NDIS_STATUS Status,
3088 /*IN*/ NDIS_HANDLE NdisBindingHandle,
3089 /*IN*/ PNET_PNP_EVENT NetPnPEvent);
3090
3091NDISAPI
3092VOID
3093DDKAPI
3094NdisGetCurrentProcessorCounts(
3095 /*OUT*/ PULONG pIdleCount,
3096 /*OUT*/ PULONG pKernelAndUser,
3097 /*OUT*/ PULONG pIndex);
3098
3099NDISAPI
3100VOID
3101DDKAPI
3102NdisGetDriverHandle(
3103 /*IN*/ PNDIS_HANDLE NdisBindingHandle,
3104 /*OUT*/ PNDIS_HANDLE NdisDriverHandle);
3105
3106NDISAPI
3107PNDIS_PACKET
3108DDKAPI
3109NdisGetReceivedPacket(
3110 /*IN*/ PNDIS_HANDLE NdisBindingHandle,
3111 /*IN*/ PNDIS_HANDLE MacContext);
3112
3113NDISAPI
3114VOID
3115DDKAPI
3116NdisGetSystemUptime(
3117 /*OUT*/ PULONG pSystemUpTime);
3118
3119NDISAPI
3120VOID
3121DDKAPI
3122NdisInitializeReadWriteLock(
3123 /*IN*/ PNDIS_RW_LOCK Lock);
3124
3125NDISAPI
3126NDIS_STATUS
3127DDKAPI
3128NdisMDeregisterDevice(
3129 /*IN*/ NDIS_HANDLE NdisDeviceHandle);
3130
3131NDISAPI
3132VOID
3133DDKAPI
3134NdisMGetDeviceProperty(
3135 /*IN*/ NDIS_HANDLE MiniportAdapterHandle,
3136 /*IN OUT*/ PDEVICE_OBJECT *PhysicalDeviceObject /*OPTIONAL*/,
3137 /*IN OUT*/ PDEVICE_OBJECT *FunctionalDeviceObject /*OPTIONAL*/,
3138 /*IN OUT*/ PDEVICE_OBJECT *NextDeviceObject /*OPTIONAL*/,
3139 /*IN OUT*/ PCM_RESOURCE_LIST *AllocatedResources /*OPTIONAL*/,
3140 /*IN OUT*/ PCM_RESOURCE_LIST *AllocatedResourcesTranslated /*OPTIONAL*/);
3141
3142NDISAPI
3143NDIS_STATUS
3144DDKAPI
3145NdisMInitializeScatterGatherDma(
3146 /*IN*/ NDIS_HANDLE MiniportAdapterHandle,
3147 /*IN*/ BOOLEAN Dma64BitAddresses,
3148 /*IN*/ ULONG MaximumPhysicalMapping);
3149
3150NDISAPI
3151NDIS_STATUS
3152DDKAPI
3153NdisMPromoteMiniport(
3154 /*IN*/ NDIS_HANDLE MiniportAdapterHandle);
3155
3156NDISAPI
3157NDIS_STATUS
3158DDKAPI
3159NdisMQueryAdapterInstanceName(
3160 /*OUT*/ PNDIS_STRING AdapterInstanceName,
3161 /*IN*/ NDIS_HANDLE MiniportAdapterHandle);
3162
3163NDISAPI
3164NDIS_STATUS
3165DDKAPI
3166NdisMRegisterDevice(
3167 /*IN*/ NDIS_HANDLE NdisWrapperHandle,
3168 /*IN*/ PNDIS_STRING DeviceName,
3169 /*IN*/ PNDIS_STRING SymbolicName,
3170 /*IN*/ PDRIVER_DISPATCH MajorFunctions[],
3171 /*OUT*/ PDEVICE_OBJECT *pDeviceObject,
3172 /*OUT*/ NDIS_HANDLE *NdisDeviceHandle);
3173
3174NDISAPI
3175VOID
3176DDKAPI
3177NdisMRegisterUnloadHandler(
3178 /*IN*/ NDIS_HANDLE NdisWrapperHandle,
3179 /*IN*/ PDRIVER_UNLOAD UnloadHandler);
3180
3181NDISAPI
3182NDIS_STATUS
3183DDKAPI
3184NdisMRemoveMiniport(
3185 /*IN*/ NDIS_HANDLE MiniportAdapterHandle);
3186
3187NDISAPI
3188NDIS_STATUS
3189DDKAPI
3190NdisMSetMiniportSecondary(
3191 /*IN*/ NDIS_HANDLE MiniportAdapterHandle,
3192 /*IN*/ NDIS_HANDLE PrimaryMiniportAdapterHandle);
3193
3194NDISAPI
3195VOID
3196DDKAPI
3197NdisOpenConfigurationKeyByIndex(
3198 /*OUT*/ PNDIS_STATUS Status,
3199 /*IN*/ NDIS_HANDLE ConfigurationHandle,
3200 /*IN*/ ULONG Index,
3201 /*OUT*/ PNDIS_STRING KeyName,
3202 /*OUT*/ PNDIS_HANDLE KeyHandle);
3203
3204NDISAPI
3205VOID
3206DDKAPI
3207NdisOpenConfigurationKeyByName(
3208 /*OUT*/ PNDIS_STATUS Status,
3209 /*IN*/ NDIS_HANDLE ConfigurationHandle,
3210 /*IN*/ PNDIS_STRING SubKeyName,
3211 /*OUT*/ PNDIS_HANDLE SubKeyHandle);
3212
3213NDISAPI
3214UINT
3215DDKAPI
3216NdisPacketPoolUsage(
3217 /*IN*/ NDIS_HANDLE PoolHandle);
3218
3219NTOSAPI
3220VOID
3221DDKAPI
3222NdisSetPacketPoolProtocolId(
3223 /*IN*/ NDIS_HANDLE PacketPoolHandle,
3224 /*IN*/ UINT ProtocolId);
3225
3226NDISAPI
3227NDIS_STATUS
3228DDKAPI
3229NdisQueryAdapterInstanceName(
3230 /*OUT*/ PNDIS_STRING AdapterInstanceName,
3231 /*IN*/ NDIS_HANDLE NdisBindingHandle);
3232
3233NDISAPI
3234ULONG
3235DDKAPI
3236NdisReadPcmciaAttributeMemory(
3237 /*IN*/ NDIS_HANDLE NdisAdapterHandle,
3238 /*IN*/ ULONG Offset,
3239 /*IN*/ PVOID Buffer,
3240 /*IN*/ ULONG Length);
3241
3242NDISAPI
3243VOID
3244DDKAPI
3245NdisReleaseReadWriteLock(
3246 /*IN*/ PNDIS_RW_LOCK Lock,
3247 /*IN*/ PLOCK_STATE LockState);
3248
3249NDISAPI
3250NDIS_STATUS
3251DDKAPI
3252NdisWriteEventLogEntry(
3253 /*IN*/ PVOID LogHandle,
3254 /*IN*/ NDIS_STATUS EventCode,
3255 /*IN*/ ULONG UniqueEventValue,
3256 /*IN*/ USHORT NumStrings,
3257 /*IN*/ PVOID StringsList /*OPTIONAL*/,
3258 /*IN*/ ULONG DataSize,
3259 /*IN*/ PVOID Data /*OPTIONAL*/);
3260
3261NDISAPI
3262ULONG
3263DDKAPI
3264NdisWritePcmciaAttributeMemory(
3265 /*IN*/ NDIS_HANDLE NdisAdapterHandle,
3266 /*IN*/ ULONG Offset,
3267 /*IN*/ PVOID Buffer,
3268 /*IN*/ ULONG Length);
3269
3270
3271/* Connectionless services */
3272
3273NDISAPI
3274NDIS_STATUS
3275DDKAPI
3276NdisClAddParty(
3277 /*IN*/ NDIS_HANDLE NdisVcHandle,
3278 /*IN*/ NDIS_HANDLE ProtocolPartyContext,
3279 /*IN OUT*/ PCO_CALL_PARAMETERS CallParameters,
3280 /*OUT*/ PNDIS_HANDLE NdisPartyHandle);
3281
3282NDISAPI
3283NDIS_STATUS
3284DDKAPI
3285NdisClCloseAddressFamily(
3286 /*IN*/ NDIS_HANDLE NdisAfHandle);
3287
3288NDISAPI
3289NDIS_STATUS
3290DDKAPI
3291NdisClCloseCall(
3292 /*IN*/ NDIS_HANDLE NdisVcHandle,
3293 /*IN*/ NDIS_HANDLE NdisPartyHandle /*OPTIONAL*/,
3294 /*IN*/ PVOID Buffer /*OPTIONAL*/,
3295 /*IN*/ UINT Size);
3296
3297NDISAPI
3298NDIS_STATUS
3299DDKAPI
3300NdisClDeregisterSap(
3301 /*IN*/ NDIS_HANDLE NdisSapHandle);
3302
3303NDISAPI
3304NDIS_STATUS
3305DDKAPI
3306NdisClDropParty(
3307 /*IN*/ NDIS_HANDLE NdisPartyHandle,
3308 /*IN*/ PVOID Buffer /*OPTIONAL*/,
3309 /*IN*/ UINT Size);
3310
3311NDISAPI
3312VOID
3313DDKAPI
3314NdisClIncomingCallComplete(
3315 /*IN*/ NDIS_STATUS Status,
3316 /*IN*/ NDIS_HANDLE NdisVcHandle,
3317 /*IN*/ PCO_CALL_PARAMETERS CallParameters);
3318
3319NDISAPI
3320NDIS_STATUS
3321DDKAPI
3322NdisClMakeCall(
3323 /*IN*/ NDIS_HANDLE NdisVcHandle,
3324 /*IN OUT*/ PCO_CALL_PARAMETERS CallParameters,
3325 /*IN*/ NDIS_HANDLE ProtocolPartyContext /*OPTIONAL*/,
3326 /*OUT*/ PNDIS_HANDLE NdisPartyHandle /*OPTIONAL*/);
3327
3328NDISAPI
3329NDIS_STATUS
3330DDKAPI
3331NdisClModifyCallQoS(
3332 /*IN*/ NDIS_HANDLE NdisVcHandle,
3333 /*IN*/ PCO_CALL_PARAMETERS CallParameters);
3334
3335
3336NDISAPI
3337NDIS_STATUS
3338DDKAPI
3339NdisClOpenAddressFamily(
3340 /*IN*/ NDIS_HANDLE NdisBindingHandle,
3341 /*IN*/ PCO_ADDRESS_FAMILY AddressFamily,
3342 /*IN*/ NDIS_HANDLE ProtocolAfContext,
3343 /*IN*/ PNDIS_CLIENT_CHARACTERISTICS ClCharacteristics,
3344 /*IN*/ UINT SizeOfClCharacteristics,
3345 /*OUT*/ PNDIS_HANDLE NdisAfHandle);
3346
3347NDISAPI
3348NDIS_STATUS
3349DDKAPI
3350NdisClRegisterSap(
3351 /*IN*/ NDIS_HANDLE NdisAfHandle,
3352 /*IN*/ NDIS_HANDLE ProtocolSapContext,
3353 /*IN*/ PCO_SAP Sap,
3354 /*OUT*/ PNDIS_HANDLE NdisSapHandle);
3355
3356
3357/* Call Manager services */
3358
3359NDISAPI
3360NDIS_STATUS
3361DDKAPI
3362NdisCmActivateVc(
3363 /*IN*/ NDIS_HANDLE NdisVcHandle,
3364 /*IN OUT*/ PCO_CALL_PARAMETERS CallParameters);
3365
3366NDISAPI
3367VOID
3368DDKAPI
3369NdisCmAddPartyComplete(
3370 /*IN*/ NDIS_STATUS Status,
3371 /*IN*/ NDIS_HANDLE NdisPartyHandle,
3372 /*IN*/ NDIS_HANDLE CallMgrPartyContext /*OPTIONAL*/,
3373 /*IN*/ PCO_CALL_PARAMETERS CallParameters);
3374
3375NDISAPI
3376VOID
3377DDKAPI
3378NdisCmCloseAddressFamilyComplete(
3379 /*IN*/ NDIS_STATUS Status,
3380 /*IN*/ NDIS_HANDLE NdisAfHandle);
3381
3382NDISAPI
3383VOID
3384DDKAPI
3385NdisCmCloseCallComplete(
3386 /*IN*/ NDIS_STATUS Status,
3387 /*IN*/ NDIS_HANDLE NdisVcHandle,
3388 /*IN*/ NDIS_HANDLE NdisPartyHandle /*OPTIONAL*/);
3389
3390NDISAPI
3391NDIS_STATUS
3392DDKAPI
3393NdisCmDeactivateVc(
3394 /*IN*/ NDIS_HANDLE NdisVcHandle);
3395
3396NDISAPI
3397VOID
3398DDKAPI
3399NdisCmDeregisterSapComplete(
3400 /*IN*/ NDIS_STATUS Status,
3401 /*IN*/ NDIS_HANDLE NdisSapHandle);
3402
3403NDISAPI
3404VOID
3405DDKAPI
3406NdisCmDispatchCallConnected(
3407 /*IN*/ NDIS_HANDLE NdisVcHandle);
3408
3409NDISAPI
3410NDIS_STATUS
3411DDKAPI
3412NdisCmDispatchIncomingCall(
3413 /*IN*/ NDIS_HANDLE NdisSapHandle,
3414 /*IN*/ NDIS_HANDLE NdisVcHandle,
3415 /*IN*/ PCO_CALL_PARAMETERS CallParameters);
3416
3417NDISAPI
3418VOID
3419DDKAPI
3420NdisCmDispatchIncomingCallQoSChange(
3421 /*IN*/ NDIS_HANDLE NdisVcHandle,
3422 /*IN*/ PCO_CALL_PARAMETERS CallParameters);
3423
3424NDISAPI
3425VOID
3426DDKAPI
3427NdisCmDispatchIncomingCloseCall(
3428 /*IN*/ NDIS_STATUS CloseStatus,
3429 /*IN*/ NDIS_HANDLE NdisVcHandle,
3430 /*IN*/ PVOID Buffer /*OPTIONAL*/,
3431 /*IN*/ UINT Size);
3432
3433NDISAPI
3434VOID
3435DDKAPI
3436NdisCmDispatchIncomingDropParty(
3437 /*IN*/ NDIS_STATUS DropStatus,
3438 /*IN*/ NDIS_HANDLE NdisPartyHandle,
3439 /*IN*/ PVOID Buffer /*OPTIONAL*/,
3440 /*IN*/ UINT Size);
3441
3442NDISAPI
3443VOID
3444DDKAPI
3445NdisCmDropPartyComplete(
3446 /*IN*/ NDIS_STATUS Status,
3447 /*IN*/ NDIS_HANDLE NdisPartyHandle);
3448
3449NDISAPI
3450VOID
3451DDKAPI
3452NdisCmMakeCallComplete(
3453 /*IN*/ NDIS_STATUS Status,
3454 /*IN*/ NDIS_HANDLE NdisVcHandle,
3455 /*IN*/ NDIS_HANDLE NdisPartyHandle /*OPTIONAL*/,
3456 /*IN*/ NDIS_HANDLE CallMgrPartyContext /*OPTIONAL*/,
3457 /*IN*/ PCO_CALL_PARAMETERS CallParameters);
3458
3459NDISAPI
3460VOID
3461DDKAPI
3462NdisCmModifyCallQoSComplete(
3463 /*IN*/ NDIS_STATUS Status,
3464 /*IN*/ NDIS_HANDLE NdisVcHandle,
3465 /*IN*/ PCO_CALL_PARAMETERS CallParameters);
3466
3467NDISAPI
3468VOID
3469DDKAPI
3470NdisCmOpenAddressFamilyComplete(
3471 /*IN*/ NDIS_STATUS Status,
3472 /*IN*/ NDIS_HANDLE NdisAfHandle,
3473 /*IN*/ NDIS_HANDLE CallMgrAfContext);
3474
3475NDISAPI
3476NDIS_STATUS
3477DDKAPI
3478NdisCmRegisterAddressFamily(
3479 /*IN*/ NDIS_HANDLE NdisBindingHandle,
3480 /*IN*/ PCO_ADDRESS_FAMILY AddressFamily,
3481 /*IN*/ PNDIS_CALL_MANAGER_CHARACTERISTICS CmCharacteristics,
3482 /*IN*/ UINT SizeOfCmCharacteristics);
3483
3484NDISAPI
3485VOID
3486DDKAPI
3487NdisCmRegisterSapComplete(
3488 /*IN*/ NDIS_STATUS Status,
3489 /*IN*/ NDIS_HANDLE NdisSapHandle,
3490 /*IN*/ NDIS_HANDLE CallMgrSapContext);
3491
3492
3493NDISAPI
3494NDIS_STATUS
3495DDKAPI
3496NdisMCmActivateVc(
3497 /*IN*/ NDIS_HANDLE NdisVcHandle,
3498 /*IN*/ PCO_CALL_PARAMETERS CallParameters);
3499
3500NDISAPI
3501NDIS_STATUS
3502DDKAPI
3503NdisMCmCreateVc(
3504 /*IN*/ NDIS_HANDLE MiniportAdapterHandle,
3505 /*IN*/ NDIS_HANDLE NdisAfHandle,
3506 /*IN*/ NDIS_HANDLE MiniportVcContext,
3507 /*OUT*/ PNDIS_HANDLE NdisVcHandle);
3508
3509NDISAPI
3510NDIS_STATUS
3511DDKAPI
3512NdisMCmDeactivateVc(
3513 /*IN*/ NDIS_HANDLE NdisVcHandle);
3514
3515NDISAPI
3516NDIS_STATUS
3517DDKAPI
3518NdisMCmDeleteVc(
3519 /*IN*/ NDIS_HANDLE NdisVcHandle);
3520
3521NDISAPI
3522NDIS_STATUS
3523DDKAPI
3524NdisMCmRegisterAddressFamily(
3525 /*IN*/ NDIS_HANDLE MiniportAdapterHandle,
3526 /*IN*/ PCO_ADDRESS_FAMILY AddressFamily,
3527 /*IN*/ PNDIS_CALL_MANAGER_CHARACTERISTICS CmCharacteristics,
3528 /*IN*/ UINT SizeOfCmCharacteristics);
3529
3530NDISAPI
3531NDIS_STATUS
3532DDKAPI
3533NdisMCmRequest(
3534 /*IN*/ NDIS_HANDLE NdisAfHandle,
3535 /*IN*/ NDIS_HANDLE NdisVcHandle /*OPTIONAL*/,
3536 /*IN*/ NDIS_HANDLE NdisPartyHandle /*OPTIONAL*/,
3537 /*IN OUT*/ PNDIS_REQUEST NdisRequest);
3538
3539
3540/* Connection-oriented services */
3541
3542NDISAPI
3543NDIS_STATUS
3544DDKAPI
3545NdisCoCreateVc(
3546 /*IN*/ NDIS_HANDLE NdisBindingHandle,
3547 /*IN*/ NDIS_HANDLE NdisAfHandle /*OPTIONAL*/,
3548 /*IN*/ NDIS_HANDLE ProtocolVcContext,
3549 /*IN OUT*/ PNDIS_HANDLE NdisVcHandle);
3550
3551NDISAPI
3552NDIS_STATUS
3553DDKAPI
3554NdisCoDeleteVc(
3555 /*IN*/ NDIS_HANDLE NdisVcHandle);
3556
3557NDISAPI
3558NDIS_STATUS
3559DDKAPI
3560NdisCoRequest(
3561 /*IN*/ NDIS_HANDLE NdisBindingHandle,
3562 /*IN*/ NDIS_HANDLE NdisAfHandle /*OPTIONAL*/,
3563 /*IN*/ NDIS_HANDLE NdisVcHandle /*OPTIONAL*/,
3564 /*IN*/ NDIS_HANDLE NdisPartyHandle /*OPTIONAL*/,
3565 /*IN OUT*/ PNDIS_REQUEST NdisRequest);
3566
3567NDISAPI
3568VOID
3569DDKAPI
3570NdisCoRequestComplete(
3571 /*IN*/ NDIS_STATUS Status,
3572 /*IN*/ NDIS_HANDLE NdisAfHandle,
3573 /*IN*/ NDIS_HANDLE NdisVcHandle /*OPTIONAL*/,
3574 /*IN*/ NDIS_HANDLE NdisPartyHandle /*OPTIONAL*/,
3575 /*IN*/ PNDIS_REQUEST NdisRequest);
3576
3577NDISAPI
3578VOID
3579DDKAPI
3580NdisCoSendPackets(
3581 /*IN*/ NDIS_HANDLE NdisVcHandle,
3582 /*IN*/ PPNDIS_PACKET PacketArray,
3583 /*IN*/ UINT NumberOfPackets);
3584
3585NDISAPI
3586VOID
3587DDKAPI
3588NdisMCoActivateVcComplete(
3589 /*IN*/ NDIS_STATUS Status,
3590 /*IN*/ NDIS_HANDLE NdisVcHandle,
3591 /*IN*/ PCO_CALL_PARAMETERS CallParameters);
3592
3593NDISAPI
3594VOID
3595DDKAPI
3596NdisMCoDeactivateVcComplete(
3597 /*IN*/ NDIS_STATUS Status,
3598 /*IN*/ NDIS_HANDLE NdisVcHandle);
3599
3600NDISAPI
3601VOID
3602DDKAPI
3603NdisMCoIndicateReceivePacket(
3604 /*IN*/ NDIS_HANDLE NdisVcHandle,
3605 /*IN*/ PPNDIS_PACKET PacketArray,
3606 /*IN*/ UINT NumberOfPackets);
3607
3608NDISAPI
3609VOID
3610DDKAPI
3611NdisMCoIndicateStatus(
3612 /*IN*/ NDIS_HANDLE MiniportAdapterHandle,
3613 /*IN*/ NDIS_HANDLE NdisVcHandle /*OPTIONAL*/,
3614 /*IN*/ NDIS_STATUS GeneralStatus,
3615 /*IN*/ PVOID StatusBuffer /*OPTIONAL*/,
3616 /*IN*/ ULONG StatusBufferSize);
3617
3618NDISAPI
3619VOID
3620DDKAPI
3621NdisMCoReceiveComplete(
3622 /*IN*/ NDIS_HANDLE MiniportAdapterHandle);
3623
3624NDISAPI
3625VOID
3626DDKAPI
3627NdisMCoRequestComplete(
3628 /*IN*/ NDIS_STATUS Status,
3629 /*IN*/ NDIS_HANDLE MiniportAdapterHandle,
3630 /*IN*/ PNDIS_REQUEST Request);
3631
3632NDISAPI
3633VOID
3634DDKAPI
3635NdisMCoSendComplete(
3636 /*IN*/ NDIS_STATUS Status,
3637 /*IN*/ NDIS_HANDLE NdisVcHandle,
3638 /*IN*/ PNDIS_PACKET Packet);
3639
3640
3641/* NDIS 5.0 extensions for intermediate drivers */
3642
3643NDISAPI
3644VOID
3645DDKAPI
3646NdisIMAssociateMiniport(
3647 /*IN*/ NDIS_HANDLE DriverHandle,
3648 /*IN*/ NDIS_HANDLE ProtocolHandle);
3649
3650NDISAPI
3651NDIS_STATUS
3652DDKAPI
3653NdisIMCancelInitializeDeviceInstance(
3654 /*IN*/ NDIS_HANDLE DriverHandle,
3655 /*IN*/ PNDIS_STRING DeviceInstance);
3656
3657NDISAPI
3658VOID
3659DDKAPI
3660NdisIMCopySendCompletePerPacketInfo(
3661 /*IN*/ PNDIS_PACKET DstPacket,
3662 /*IN*/ PNDIS_PACKET SrcPacket);
3663
3664NDISAPI
3665VOID
3666DDKAPI
3667NdisIMCopySendPerPacketInfo(
3668 /*IN*/ PNDIS_PACKET DstPacket,
3669 /*IN*/ PNDIS_PACKET SrcPacket);
3670
3671NDISAPI
3672VOID
3673DDKAPI
3674NdisIMDeregisterLayeredMiniport(
3675 /*IN*/ NDIS_HANDLE DriverHandle);
3676
3677NDISAPI
3678NDIS_HANDLE
3679DDKAPI
3680NdisIMGetBindingContext(
3681 /*IN*/ NDIS_HANDLE NdisBindingHandle);
3682
3683NDISAPI
3684NDIS_HANDLE
3685DDKAPI
3686NdisIMGetDeviceContext(
3687 /*IN*/ NDIS_HANDLE MiniportAdapterHandle);
3688
3689NDISAPI
3690NDIS_STATUS
3691DDKAPI
3692NdisIMInitializeDeviceInstanceEx(
3693 /*IN*/ NDIS_HANDLE DriverHandle,
3694 /*IN*/ PNDIS_STRING DriverInstance,
3695 /*IN*/ NDIS_HANDLE DeviceContext /*OPTIONAL*/);
3696
3697NDISAPI
3698PSINGLE_LIST_ENTRY
3699DDKAPI
3700NdisInterlockedPopEntrySList(
3701 /*IN*/ PSLIST_HEADER ListHead,
3702 /*IN*/ PKSPIN_LOCK Lock);
3703
3704NDISAPI
3705PSINGLE_LIST_ENTRY
3706DDKAPI
3707NdisInterlockedPushEntrySList(
3708 /*IN*/ PSLIST_HEADER ListHead,
3709 /*IN*/ PSINGLE_LIST_ENTRY ListEntry,
3710 /*IN*/ PKSPIN_LOCK Lock);
3711
3712NDISAPI
3713VOID
3714DDKAPI
3715NdisQueryBufferSafe(
3716 /*IN*/ PNDIS_BUFFER Buffer,
3717 /*OUT*/ PVOID *VirtualAddress /*OPTIONAL*/,
3718 /*OUT*/ PUINT Length,
3719 /*IN*/ UINT Priority);
3720
3721
3722/* Prototypes for NDIS_MINIPORT_CHARACTERISTICS */
3723
3724typedef BOOLEAN DDKAPI
3725(*W_CHECK_FOR_HANG_HANDLER)(
3726 /*IN*/ NDIS_HANDLE MiniportAdapterContext);
3727
3728typedef VOID DDKAPI
3729(*W_DISABLE_INTERRUPT_HANDLER)(
3730 /*IN*/ NDIS_HANDLE MiniportAdapterContext);
3731
3732typedef VOID DDKAPI
3733(*W_ENABLE_INTERRUPT_HANDLER)(
3734 /*IN*/ NDIS_HANDLE MiniportAdapterContext);
3735
3736typedef VOID DDKAPI
3737(*W_HALT_HANDLER)(
3738 /*IN*/ NDIS_HANDLE MiniportAdapterContext);
3739
3740typedef VOID DDKAPI
3741(*W_HANDLE_INTERRUPT_HANDLER)(
3742 /*IN*/ NDIS_HANDLE MiniportAdapterContext);
3743
3744typedef NDIS_STATUS DDKAPI
3745(*W_INITIALIZE_HANDLER)(
3746 /*OUT*/ PNDIS_STATUS OpenErrorStatus,
3747 /*OUT*/ PUINT SelectedMediumIndex,
3748 /*IN*/ PNDIS_MEDIUM MediumArray,
3749 /*IN*/ UINT MediumArraySize,
3750 /*IN*/ NDIS_HANDLE MiniportAdapterContext,
3751 /*IN*/ NDIS_HANDLE WrapperConfigurationContext);
3752
3753typedef VOID DDKAPI
3754(*W_ISR_HANDLER)(
3755 /*OUT*/ PBOOLEAN InterruptRecognized,
3756 /*OUT*/ PBOOLEAN QueueMiniportHandleInterrupt,
3757 /*IN*/ NDIS_HANDLE MiniportAdapterContext);
3758
3759typedef NDIS_STATUS DDKAPI
3760(*W_QUERY_INFORMATION_HANDLER)(
3761 /*IN*/ NDIS_HANDLE MiniportAdapterContext,
3762 /*IN*/ NDIS_OID Oid,
3763 /*IN*/ PVOID InformationBuffer,
3764 /*IN*/ ULONG InformationBufferLength,
3765 /*OUT*/ PULONG BytesWritten,
3766 /*OUT*/ PULONG BytesNeeded);
3767
3768typedef NDIS_STATUS DDKAPI
3769(*W_RECONFIGURE_HANDLER)(
3770 /*OUT*/ PNDIS_STATUS OpenErrorStatus,
3771 /*IN*/ NDIS_HANDLE MiniportAdapterContext,
3772 /*IN*/ NDIS_HANDLE WrapperConfigurationContext);
3773
3774typedef NDIS_STATUS DDKAPI
3775(*W_RESET_HANDLER)(
3776 /*OUT*/ PBOOLEAN AddressingReset,
3777 /*IN*/ NDIS_HANDLE MiniportAdapterContext);
3778
3779typedef NDIS_STATUS DDKAPI
3780(*W_SEND_HANDLER)(
3781 /*IN*/ NDIS_HANDLE MiniportAdapterContext,
3782 /*IN*/ PNDIS_PACKET Packet,
3783 /*IN*/ UINT Flags);
3784
3785typedef NDIS_STATUS DDKAPI
3786(*WM_SEND_HANDLER)(
3787 /*IN*/ NDIS_HANDLE MiniportAdapterContext,
3788 /*IN*/ NDIS_HANDLE NdisLinkHandle,
3789 /*IN*/ PNDIS_WAN_PACKET Packet);
3790
3791typedef NDIS_STATUS DDKAPI
3792(*W_SET_INFORMATION_HANDLER)(
3793 /*IN*/ NDIS_HANDLE MiniportAdapterContext,
3794 /*IN*/ NDIS_OID Oid,
3795 /*IN*/ PVOID InformationBuffer,
3796 /*IN*/ ULONG InformationBufferLength,
3797 /*OUT*/ PULONG BytesRead,
3798 /*OUT*/ PULONG BytesNeeded);
3799
3800typedef NDIS_STATUS DDKAPI
3801(*W_TRANSFER_DATA_HANDLER)(
3802 /*OUT*/ PNDIS_PACKET Packet,
3803 /*OUT*/ PUINT BytesTransferred,
3804 /*IN*/ NDIS_HANDLE MiniportAdapterContext,
3805 /*IN*/ NDIS_HANDLE MiniportReceiveContext,
3806 /*IN*/ UINT ByteOffset,
3807 /*IN*/ UINT BytesToTransfer);
3808
3809typedef NDIS_STATUS DDKAPI
3810(*WM_TRANSFER_DATA_HANDLER)(
3811 VOID);
3812
3813
3814/* NDIS structures available only to miniport drivers */
3815
3816#define NDIS30_MINIPORT_CHARACTERISTICS_S \
3817 UCHAR MajorNdisVersion; \
3818 UCHAR MinorNdisVersion; \
3819 UINT Reserved; \
3820 W_CHECK_FOR_HANG_HANDLER CheckForHangHandler; \
3821 W_DISABLE_INTERRUPT_HANDLER DisableInterruptHandler; \
3822 W_ENABLE_INTERRUPT_HANDLER EnableInterruptHandler; \
3823 W_HALT_HANDLER HaltHandler; \
3824 W_HANDLE_INTERRUPT_HANDLER HandleInterruptHandler; \
3825 W_INITIALIZE_HANDLER InitializeHandler; \
3826 W_ISR_HANDLER ISRHandler; \
3827 W_QUERY_INFORMATION_HANDLER QueryInformationHandler; \
3828 W_RECONFIGURE_HANDLER ReconfigureHandler; \
3829 W_RESET_HANDLER ResetHandler; \
3830 _ANONYMOUS_UNION union { \
3831 W_SEND_HANDLER SendHandler; \
3832 WM_SEND_HANDLER WanSendHandler; \
3833 } _UNION_NAME(u1); \
3834 W_SET_INFORMATION_HANDLER SetInformationHandler; \
3835 _ANONYMOUS_UNION union { \
3836 W_TRANSFER_DATA_HANDLER TransferDataHandler; \
3837 WM_TRANSFER_DATA_HANDLER WanTransferDataHandler; \
3838 } _UNION_NAME(u2);
3839
3840typedef struct _NDIS30_MINIPORT_CHARACTERISTICS {
3841 NDIS30_MINIPORT_CHARACTERISTICS_S
3842} NDIS30_MINIPORT_CHARACTERISTICS, *PSNDIS30_MINIPORT_CHARACTERISTICS;
3843
3844
3845/* Extensions for NDIS 4.0 miniports */
3846
3847typedef VOID DDKAPI
3848(*W_SEND_PACKETS_HANDLER)(
3849 /*IN*/ NDIS_HANDLE MiniportAdapterContext,
3850 /*IN*/ PPNDIS_PACKET PacketArray,
3851 /*IN*/ UINT NumberOfPackets);
3852
3853typedef VOID DDKAPI
3854(*W_RETURN_PACKET_HANDLER)(
3855 /*IN*/ NDIS_HANDLE MiniportAdapterContext,
3856 /*IN*/ PNDIS_PACKET Packet);
3857
3858typedef VOID DDKAPI
3859(*W_ALLOCATE_COMPLETE_HANDLER)(
3860 /*IN*/ NDIS_HANDLE MiniportAdapterContext,
3861 /*IN*/ PVOID VirtualAddress,
3862 /*IN*/ PNDIS_PHYSICAL_ADDRESS PhysicalAddress,
3863 /*IN*/ ULONG Length,
3864 /*IN*/ PVOID Context);
3865
3866#ifdef __cplusplus
3867
3868#define NDIS40_MINIPORT_CHARACTERISTICS_S \
3869 NDIS30_MINIPORT_CHARACTERISTICS Ndis30Chars; \
3870 W_RETURN_PACKET_HANDLER ReturnPacketHandler; \
3871 W_SEND_PACKETS_HANDLER SendPacketsHandler; \
3872 W_ALLOCATE_COMPLETE_HANDLER AllocateCompleteHandler;
3873
3874#else /* !__cplusplus */
3875
3876#define NDIS40_MINIPORT_CHARACTERISTICS_S \
3877 NDIS30_MINIPORT_CHARACTERISTICS_S \
3878 W_RETURN_PACKET_HANDLER ReturnPacketHandler; \
3879 W_SEND_PACKETS_HANDLER SendPacketsHandler; \
3880 W_ALLOCATE_COMPLETE_HANDLER AllocateCompleteHandler;
3881
3882#endif /* !__cplusplus */
3883
3884typedef struct _NDIS40_MINIPORT_CHARACTERISTICS {
3885 NDIS40_MINIPORT_CHARACTERISTICS_S
3886} NDIS40_MINIPORT_CHARACTERISTICS, *PNDIS40_MINIPORT_CHARACTERISTICS;
3887
3888
3889/* Extensions for NDIS 5.0 miniports */
3890
3891typedef NDIS_STATUS DDKAPI
3892(*W_CO_CREATE_VC_HANDLER)(
3893 /*IN*/ NDIS_HANDLE MiniportAdapterContext,
3894 /*IN*/ NDIS_HANDLE NdisVcHandle,
3895 /*OUT*/ PNDIS_HANDLE MiniportVcContext);
3896
3897typedef NDIS_STATUS DDKAPI
3898(*W_CO_DELETE_VC_HANDLER)(
3899 /*IN*/ NDIS_HANDLE MiniportVcContext);
3900
3901typedef NDIS_STATUS DDKAPI
3902(*W_CO_ACTIVATE_VC_HANDLER)(
3903 /*IN*/ NDIS_HANDLE MiniportVcContext,
3904 /*IN OUT*/ PCO_CALL_PARAMETERS CallParameters);
3905
3906typedef NDIS_STATUS DDKAPI
3907(*W_CO_DEACTIVATE_VC_HANDLER)(
3908 /*IN*/ NDIS_HANDLE MiniportVcContext);
3909
3910typedef VOID DDKAPI
3911(*W_CO_SEND_PACKETS_HANDLER)(
3912 /*IN*/ NDIS_HANDLE MiniportVcContext,
3913 /*IN*/ PPNDIS_PACKET PacketArray,
3914 /*IN*/ UINT NumberOfPackets);
3915
3916typedef NDIS_STATUS DDKAPI
3917(*W_CO_REQUEST_HANDLER)(
3918 /*IN*/ NDIS_HANDLE MiniportAdapterContext,
3919 /*IN*/ NDIS_HANDLE MiniportVcContext /*OPTIONAL*/,
3920 /*IN OUT*/ PNDIS_REQUEST NdisRequest);
3921
3922#ifdef __cplusplus
3923
3924#define NDIS50_MINIPORT_CHARACTERISTICS_S \
3925 NDIS40_MINIPORT_CHARACTERISTICS Ndis40Chars; \
3926 W_CO_CREATE_VC_HANDLER CoCreateVcHandler; \
3927 W_CO_DELETE_VC_HANDLER CoDeleteVcHandler; \
3928 W_CO_ACTIVATE_VC_HANDLER CoActivateVcHandler; \
3929 W_CO_DEACTIVATE_VC_HANDLER CoDeactivateVcHandler; \
3930 W_CO_SEND_PACKETS_HANDLER CoSendPacketsHandler; \
3931 W_CO_REQUEST_HANDLER CoRequestHandler;
3932
3933#else /* !__cplusplus */
3934
3935#define NDIS50_MINIPORT_CHARACTERISTICS_S \
3936 NDIS40_MINIPORT_CHARACTERISTICS_S \
3937 W_CO_CREATE_VC_HANDLER CoCreateVcHandler; \
3938 W_CO_DELETE_VC_HANDLER CoDeleteVcHandler; \
3939 W_CO_ACTIVATE_VC_HANDLER CoActivateVcHandler; \
3940 W_CO_DEACTIVATE_VC_HANDLER CoDeactivateVcHandler; \
3941 W_CO_SEND_PACKETS_HANDLER CoSendPacketsHandler; \
3942 W_CO_REQUEST_HANDLER CoRequestHandler;
3943
3944#endif /* !__cplusplus */
3945
3946typedef struct _NDIS50_MINIPORT_CHARACTERISTICS {
3947 NDIS50_MINIPORT_CHARACTERISTICS_S
3948} NDIS50_MINIPORT_CHARACTERISTICS, *PSNDIS50_MINIPORT_CHARACTERISTICS;
3949
3950
3951/* Extensions for NDIS 5.1 miniports */
3952
3953typedef VOID DDKAPI
3954(*W_CANCEL_SEND_PACKETS_HANDLER)(
3955 /*IN*/ NDIS_HANDLE MiniportAdapterContext,
3956 /*IN*/ PVOID CancelId);
3957
3958
3959#if defined(NDIS51)
3960typedef struct _NDIS_MINIPORT_CHARACTERISTICS {
3961 NDIS50_MINIPORT_CHARACTERISTICS_S
3962} NDIS_MINIPORT_CHARACTERISTICS, *PNDIS_MINIPORT_CHARACTERISTICS;
3963#elif defined(NDIS50)
3964typedef struct _NDIS_MINIPORT_CHARACTERISTICS {
3965 NDIS50_MINIPORT_CHARACTERISTICS_S
3966} NDIS_MINIPORT_CHARACTERISTICS, *PNDIS_MINIPORT_CHARACTERISTICS;
3967#elif defined(NDIS40)
3968typedef struct _NDIS_MINIPORT_CHARACTERISTICS {
3969 NDIS40_MINIPORT_CHARACTERISTICS_S
3970} NDIS_MINIPORT_CHARACTERISTICS, *PNDIS_MINIPORT_CHARACTERISTICS;
3971#elif defined(NDIS30)
3972typedef struct _NDIS_MINIPORT_CHARACTERISTICS {
3973 NDIS30_MINIPORT_CHARACTERISTICS_S
3974} NDIS_MINIPORT_CHARACTERISTICS, *PNDIS_MINIPORT_CHARACTERISTICS;
3975#endif /* NDIS30 */
3976
3977
3978typedef NDIS_STATUS DDKAPI
3979(*SEND_HANDLER)(
3980 /*IN*/ NDIS_HANDLE MacBindingHandle,
3981 /*IN*/ PNDIS_PACKET Packet);
3982
3983typedef NDIS_STATUS DDKAPI
3984(*TRANSFER_DATA_HANDLER)(
3985 /*IN*/ NDIS_HANDLE MacBindingHandle,
3986 /*IN*/ NDIS_HANDLE MacReceiveContext,
3987 /*IN*/ UINT ByteOffset,
3988 /*IN*/ UINT BytesToTransfer,
3989 /*OUT*/ PNDIS_PACKET Packet,
3990 /*OUT*/ PUINT BytesTransferred);
3991
3992typedef NDIS_STATUS DDKAPI
3993(*RESET_HANDLER)(
3994 /*IN*/ NDIS_HANDLE MacBindingHandle);
3995
3996typedef NDIS_STATUS DDKAPI
3997(*REQUEST_HANDLER)(
3998 /*IN*/ NDIS_HANDLE MacBindingHandle,
3999 /*IN*/ PNDIS_REQUEST NdisRequest);
4000
4001
4002
4003/* Structures available only to full MAC drivers */
4004
4005typedef BOOLEAN DDKAPI
4006(*PNDIS_INTERRUPT_SERVICE)(
4007 /*IN*/ PVOID InterruptContext);
4008
4009typedef VOID DDKAPI
4010(*PNDIS_DEFERRED_PROCESSING)(
4011 /*IN*/ PVOID SystemSpecific1,
4012 /*IN*/ PVOID InterruptContext,
4013 /*IN*/ PVOID SystemSpecific2,
4014 /*IN*/ PVOID SystemSpecific3);
4015
4016
4017
4018typedef struct _NDIS_MINIPORT_BLOCK NDIS_MINIPORT_BLOCK, *PNDIS_MINIPORT_BLOCK;
4019typedef struct _NDIS_PROTOCOL_BLOCK NDIS_PROTOCOL_BLOCK, *PNDIS_PROTOCOL_BLOCK;
4020typedef struct _NDIS_OPEN_BLOCK NDIS_OPEN_BLOCK, *PNDIS_OPEN_BLOCK;
4021typedef struct _NDIS_M_DRIVER_BLOCK NDIS_M_DRIVER_BLOCK, *PNDIS_M_DRIVER_BLOCK;
4022typedef struct _NDIS_AF_LIST NDIS_AF_LIST, *PNDIS_AF_LIST;
4023
4024
4025typedef struct _NDIS_MINIPORT_INTERRUPT {
4026 PKINTERRUPT InterruptObject;
4027 KSPIN_LOCK DpcCountLock;
4028 PVOID MiniportIdField;
4029 W_ISR_HANDLER MiniportIsr;
4030 W_HANDLE_INTERRUPT_HANDLER MiniportDpc;
4031 KDPC InterruptDpc;
4032 PNDIS_MINIPORT_BLOCK Miniport;
4033 UCHAR DpcCount;
4034 BOOLEAN Filler1;
4035 KEVENT DpcsCompletedEvent;
4036 BOOLEAN SharedInterrupt;
4037 BOOLEAN IsrRequested;
4038} NDIS_MINIPORT_INTERRUPT, *PNDIS_MINIPORT_INTERRUPT;
4039
4040typedef struct _NDIS_MINIPORT_TIMER {
4041 KTIMER Timer;
4042 KDPC Dpc;
4043 PNDIS_TIMER_FUNCTION MiniportTimerFunction;
4044 PVOID MiniportTimerContext;
4045 PNDIS_MINIPORT_BLOCK Miniport;
4046 struct _NDIS_MINIPORT_TIMER *NextDeferredTimer;
4047} NDIS_MINIPORT_TIMER, *PNDIS_MINIPORT_TIMER;
4048
4049typedef struct _NDIS_INTERRUPT {
4050 PKINTERRUPT InterruptObject;
4051 KSPIN_LOCK DpcCountLock;
4052 PNDIS_INTERRUPT_SERVICE MacIsr;
4053 PNDIS_DEFERRED_PROCESSING MacDpc;
4054 KDPC InterruptDpc;
4055 PVOID InterruptContext;
4056 UCHAR DpcCount;
4057 BOOLEAN Removing;
4058 KEVENT DpcsCompletedEvent;
4059} NDIS_INTERRUPT, *PNDIS_INTERRUPT;
4060
4061
4062typedef struct _MAP_REGISTER_ENTRY {
4063 PVOID MapRegister;
4064 BOOLEAN WriteToDevice;
4065} MAP_REGISTER_ENTRY, *PMAP_REGISTER_ENTRY;
4066
4067
4068typedef enum _NDIS_WORK_ITEM_TYPE {
4069 NdisWorkItemRequest,
4070 NdisWorkItemSend,
4071 NdisWorkItemReturnPackets,
4072 NdisWorkItemResetRequested,
4073 NdisWorkItemResetInProgress,
4074 NdisWorkItemHalt,
4075 NdisWorkItemSendLoopback,
4076 NdisWorkItemMiniportCallback,
4077 NdisMaxWorkItems
4078} NDIS_WORK_ITEM_TYPE, *PNDIS_WORK_ITEM_TYPE;
4079
4080#define NUMBER_OF_WORK_ITEM_TYPES NdisMaxWorkItems
4081#define NUMBER_OF_SINGLE_WORK_ITEMS 6
4082
4083typedef struct _NDIS_MINIPORT_WORK_ITEM {
4084 SINGLE_LIST_ENTRY Link;
4085 NDIS_WORK_ITEM_TYPE WorkItemType;
4086 PVOID WorkItemContext;
4087} NDIS_MINIPORT_WORK_ITEM, *PNDIS_MINIPORT_WORK_ITEM;
4088
4089
4090typedef struct _NDIS_BIND_PATHS {
4091 UINT Number;
4092 NDIS_STRING Paths[1];
4093} NDIS_BIND_PATHS, *PNDIS_BIND_PATHS;
4094
4095#define DECLARE_UNKNOWN_STRUCT(BaseName) \
4096 typedef struct _##BaseName BaseName, *P##BaseName;
4097
4098#define DECLARE_UNKNOWN_PROTOTYPE(Name) \
4099 typedef VOID (*(Name))(VOID);
4100
4101#define ETH_LENGTH_OF_ADDRESS 6
4102
4103DECLARE_UNKNOWN_STRUCT(ETH_BINDING_INFO)
4104
4105DECLARE_UNKNOWN_PROTOTYPE(ETH_ADDRESS_CHANGE)
4106DECLARE_UNKNOWN_PROTOTYPE(ETH_FILTER_CHANGE)
4107DECLARE_UNKNOWN_PROTOTYPE(ETH_DEFERRED_CLOSE)
4108
4109typedef struct _ETH_FILTER {
4110 PNDIS_SPIN_LOCK Lock;
4111 CHAR (*MCastAddressBuf)[ETH_LENGTH_OF_ADDRESS];
4112 struct _NDIS_MINIPORT_BLOCK *Miniport;
4113 UINT CombinedPacketFilter;
4114 PETH_BINDING_INFO OpenList;
4115 ETH_ADDRESS_CHANGE AddressChangeAction;
4116 ETH_FILTER_CHANGE FilterChangeAction;
4117 ETH_DEFERRED_CLOSE CloseAction;
4118 UINT MaxMulticastAddresses;
4119 UINT NumAddresses;
4120 UCHAR AdapterAddress[ETH_LENGTH_OF_ADDRESS];
4121 UINT OldCombinedPacketFilter;
4122 CHAR (*OldMCastAddressBuf)[ETH_LENGTH_OF_ADDRESS];
4123 UINT OldNumAddresses;
4124 PETH_BINDING_INFO DirectedList;
4125 PETH_BINDING_INFO BMList;
4126 PETH_BINDING_INFO MCastSet;
4127#if defined(_NDIS_)
4128 UINT NumOpens;
4129 PVOID BindListLock;
4130#endif
4131} ETH_FILTER, *PETH_FILTER;
4132
4133typedef VOID DDKAPI
4134(*ETH_RCV_COMPLETE_HANDLER)(
4135 /*IN*/ PETH_FILTER Filter);
4136
4137typedef VOID DDKAPI
4138(*ETH_RCV_INDICATE_HANDLER)(
4139 /*IN*/ PETH_FILTER Filter,
4140 /*IN*/ NDIS_HANDLE MacReceiveContext,
4141 /*IN*/ PCHAR Address,
4142 /*IN*/ PVOID HeaderBuffer,
4143 /*IN*/ UINT HeaderBufferSize,
4144 /*IN*/ PVOID LookaheadBuffer,
4145 /*IN*/ UINT LookaheadBufferSize,
4146 /*IN*/ UINT PacketSize);
4147
4148typedef VOID DDKAPI
4149(*FDDI_RCV_COMPLETE_HANDLER)(
4150 /*IN*/ PFDDI_FILTER Filter);
4151
4152typedef VOID DDKAPI
4153(*FDDI_RCV_INDICATE_HANDLER)(
4154 /*IN*/ PFDDI_FILTER Filter,
4155 /*IN*/ NDIS_HANDLE MacReceiveContext,
4156 /*IN*/ PCHAR Address,
4157 /*IN*/ UINT AddressLength,
4158 /*IN*/ PVOID HeaderBuffer,
4159 /*IN*/ UINT HeaderBufferSize,
4160 /*IN*/ PVOID LookaheadBuffer,
4161 /*IN*/ UINT LookaheadBufferSize,
4162 /*IN*/ UINT PacketSize);
4163
4164typedef VOID DDKAPI
4165(*FILTER_PACKET_INDICATION_HANDLER)(
4166 /*IN*/ NDIS_HANDLE Miniport,
4167 /*IN*/ PPNDIS_PACKET PacketArray,
4168 /*IN*/ UINT NumberOfPackets);
4169
4170typedef VOID DDKAPI
4171(*TR_RCV_COMPLETE_HANDLER)(
4172 /*IN*/ PTR_FILTER Filter);
4173
4174typedef VOID DDKAPI
4175(*TR_RCV_INDICATE_HANDLER)(
4176 /*IN*/ PTR_FILTER Filter,
4177 /*IN*/ NDIS_HANDLE MacReceiveContext,
4178 /*IN*/ PVOID HeaderBuffer,
4179 /*IN*/ UINT HeaderBufferSize,
4180 /*IN*/ PVOID LookaheadBuffer,
4181 /*IN*/ UINT LookaheadBufferSize,
4182 /*IN*/ UINT PacketSize);
4183
4184typedef VOID DDKAPI
4185(*WAN_RCV_COMPLETE_HANDLER)(
4186 /*IN*/ NDIS_HANDLE MiniportAdapterHandle,
4187 /*IN*/ NDIS_HANDLE NdisLinkContext);
4188
4189typedef VOID DDKAPI
4190(*WAN_RCV_HANDLER)(
4191 /*OUT*/ PNDIS_STATUS Status,
4192 /*IN*/ NDIS_HANDLE MiniportAdapterHandle,
4193 /*IN*/ NDIS_HANDLE NdisLinkContext,
4194 /*IN*/ PUCHAR Packet,
4195 /*IN*/ ULONG PacketSize);
4196
4197typedef VOID DDKFASTAPI
4198(*NDIS_M_DEQUEUE_WORK_ITEM)(
4199 /*IN*/ PNDIS_MINIPORT_BLOCK Miniport,
4200 /*IN*/ NDIS_WORK_ITEM_TYPE WorkItemType,
4201 /*OUT*/ PVOID *WorkItemContext);
4202
4203typedef NDIS_STATUS DDKFASTAPI
4204(*NDIS_M_QUEUE_NEW_WORK_ITEM)(
4205 /*IN*/ PNDIS_MINIPORT_BLOCK Miniport,
4206 /*IN*/ NDIS_WORK_ITEM_TYPE WorkItemType,
4207 /*IN*/ PVOID WorkItemContext);
4208
4209typedef NDIS_STATUS DDKFASTAPI
4210(*NDIS_M_QUEUE_WORK_ITEM)(
4211 /*IN*/ PNDIS_MINIPORT_BLOCK Miniport,
4212 /*IN*/ NDIS_WORK_ITEM_TYPE WorkItemType,
4213 /*IN*/ PVOID WorkItemContext);
4214
4215typedef VOID DDKAPI
4216(*NDIS_M_REQ_COMPLETE_HANDLER)(
4217 /*IN*/ NDIS_HANDLE MiniportAdapterHandle,
4218 /*IN*/ NDIS_STATUS Status);
4219
4220typedef VOID DDKAPI
4221(*NDIS_M_RESET_COMPLETE_HANDLER)(
4222 /*IN*/ NDIS_HANDLE MiniportAdapterHandle,
4223 /*IN*/ NDIS_STATUS Status,
4224 /*IN*/ BOOLEAN AddressingReset);
4225
4226typedef VOID DDKAPI
4227(*NDIS_M_SEND_COMPLETE_HANDLER)(
4228 /*IN*/ NDIS_HANDLE MiniportAdapterHandle,
4229 /*IN*/ PNDIS_PACKET Packet,
4230 /*IN*/ NDIS_STATUS Status);
4231
4232typedef VOID DDKAPI
4233(*NDIS_M_SEND_RESOURCES_HANDLER)(
4234 /*IN*/ NDIS_HANDLE MiniportAdapterHandle);
4235
4236typedef BOOLEAN DDKFASTAPI
4237(*NDIS_M_START_SENDS)(
4238 /*IN*/ PNDIS_MINIPORT_BLOCK Miniport);
4239
4240typedef VOID DDKAPI
4241(*NDIS_M_STATUS_HANDLER)(
4242 /*IN*/ NDIS_HANDLE MiniportHandle,
4243 /*IN*/ NDIS_STATUS GeneralStatus,
4244 /*IN*/ PVOID StatusBuffer,
4245 /*IN*/ UINT StatusBufferSize);
4246
4247typedef VOID DDKAPI
4248(*NDIS_M_STS_COMPLETE_HANDLER)(
4249 /*IN*/ NDIS_HANDLE MiniportAdapterHandle);
4250
4251typedef VOID DDKAPI
4252(*NDIS_M_TD_COMPLETE_HANDLER)(
4253 /*IN*/ NDIS_HANDLE MiniportAdapterHandle,
4254 /*IN*/ PNDIS_PACKET Packet,
4255 /*IN*/ NDIS_STATUS Status,
4256 /*IN*/ UINT BytesTransferred);
4257
4258typedef VOID (DDKAPI *NDIS_WM_SEND_COMPLETE_HANDLER)(
4259 /*IN*/ NDIS_HANDLE MiniportAdapterHandle,
4260 /*IN*/ PVOID Packet,
4261 /*IN*/ NDIS_STATUS Status);
4262
4263
4264#if ARCNET
4265
4266#define ARC_SEND_BUFFERS 8
4267#define ARC_HEADER_SIZE 4
4268
4269typedef struct _NDIS_ARC_BUF {
4270 NDIS_HANDLE ArcnetBufferPool;
4271 PUCHAR ArcnetLookaheadBuffer;
4272 UINT NumFree;
4273 ARC_BUFFER_LIST ArcnetBuffers[ARC_SEND_BUFFERS];
4274} NDIS_ARC_BUF, *PNDIS_ARC_BUF;
4275
4276#endif /* ARCNET */
4277
4278#define NDIS_MINIPORT_WORK_QUEUE_SIZE 10
4279
4280typedef struct _NDIS_LOG {
4281 PNDIS_MINIPORT_BLOCK Miniport;
4282 KSPIN_LOCK LogLock;
4283 PIRP Irp;
4284 UINT TotalSize;
4285 UINT CurrentSize;
4286 UINT InPtr;
4287 UINT OutPtr;
4288 UCHAR LogBuf[1];
4289} NDIS_LOG, *PNDIS_LOG;
4290
4291typedef struct _FILTERDBS {
4292 _ANONYMOUS_UNION union {
4293 PETH_FILTER EthDB;
4294 PNULL_FILTER NullDB;
4295 } DUMMYUNIONNAME;
4296 PTR_FILTER TrDB;
4297 PFDDI_FILTER FddiDB;
4298#if ARCNET
4299 PARC_FILTER ArcDB;
4300#else /* !ARCNET */
4301 PVOID XXXDB;
4302#endif /* !ARCNET */
4303} FILTERDBS, *PFILTERDBS;
4304
4305
4306struct _NDIS_MINIPORT_BLOCK {
4307 PVOID Signature;
4308 PNDIS_MINIPORT_BLOCK NextMiniport;
4309 PNDIS_M_DRIVER_BLOCK DriverHandle;
4310 NDIS_HANDLE MiniportAdapterContext;
4311 UNICODE_STRING MiniportName;
4312 PNDIS_BIND_PATHS BindPaths;
4313 NDIS_HANDLE OpenQueue;
4314 REFERENCE Ref;
4315 NDIS_HANDLE DeviceContext;
4316 UCHAR Padding1;
4317 UCHAR LockAcquired;
4318 UCHAR PmodeOpens;
4319 UCHAR AssignedProcessor;
4320 KSPIN_LOCK Lock;
4321 PNDIS_REQUEST MediaRequest;
4322 PNDIS_MINIPORT_INTERRUPT Interrupt;
4323 ULONG Flags;
4324 ULONG PnPFlags;
4325 LIST_ENTRY PacketList;
4326 PNDIS_PACKET FirstPendingPacket;
4327 PNDIS_PACKET ReturnPacketsQueue;
4328 ULONG RequestBuffer;
4329 PVOID SetMCastBuffer;
4330 PNDIS_MINIPORT_BLOCK PrimaryMiniport;
4331 PVOID WrapperContext;
4332 PVOID BusDataContext;
4333 ULONG PnPCapabilities;
4334 PCM_RESOURCE_LIST Resources;
4335 NDIS_TIMER WakeUpDpcTimer;
4336 UNICODE_STRING BaseName;
4337 UNICODE_STRING SymbolicLinkName;
4338 ULONG CheckForHangSeconds;
4339 USHORT CFHangTicks;
4340 USHORT CFHangCurrentTick;
4341 NDIS_STATUS ResetStatus;
4342 NDIS_HANDLE ResetOpen;
4343 FILTERDBS FilterDbs;
4344 FILTER_PACKET_INDICATION_HANDLER PacketIndicateHandler;
4345 NDIS_M_SEND_COMPLETE_HANDLER SendCompleteHandler;
4346 NDIS_M_SEND_RESOURCES_HANDLER SendResourcesHandler;
4347 NDIS_M_RESET_COMPLETE_HANDLER ResetCompleteHandler;
4348 NDIS_MEDIUM MediaType;
4349 ULONG BusNumber;
4350 NDIS_INTERFACE_TYPE BusType;
4351 NDIS_INTERFACE_TYPE AdapterType;
4352 PDEVICE_OBJECT DeviceObject;
4353 PDEVICE_OBJECT PhysicalDeviceObject;
4354 PDEVICE_OBJECT NextDeviceObject;
4355 PMAP_REGISTER_ENTRY MapRegisters;
4356 PNDIS_AF_LIST CallMgrAfList;
4357 PVOID MiniportThread;
4358 PVOID SetInfoBuf;
4359 USHORT SetInfoBufLen;
4360 USHORT MaxSendPackets;
4361 NDIS_STATUS FakeStatus;
4362 PVOID LockHandler;
4363 PUNICODE_STRING pAdapterInstanceName;
4364 PNDIS_MINIPORT_TIMER TimerQueue;
4365 UINT MacOptions;
4366 PNDIS_REQUEST PendingRequest;
4367 UINT MaximumLongAddresses;
4368 UINT MaximumShortAddresses;
4369 UINT CurrentLookahead;
4370 UINT MaximumLookahead;
4371 W_HANDLE_INTERRUPT_HANDLER HandleInterruptHandler;
4372 W_DISABLE_INTERRUPT_HANDLER DisableInterruptHandler;
4373 W_ENABLE_INTERRUPT_HANDLER EnableInterruptHandler;
4374 W_SEND_PACKETS_HANDLER SendPacketsHandler;
4375 NDIS_M_START_SENDS DeferredSendHandler;
4376 ETH_RCV_INDICATE_HANDLER EthRxIndicateHandler;
4377 TR_RCV_INDICATE_HANDLER TrRxIndicateHandler;
4378 FDDI_RCV_INDICATE_HANDLER FddiRxIndicateHandler;
4379 ETH_RCV_COMPLETE_HANDLER EthRxCompleteHandler;
4380 TR_RCV_COMPLETE_HANDLER TrRxCompleteHandler;
4381 FDDI_RCV_COMPLETE_HANDLER FddiRxCompleteHandler;
4382 NDIS_M_STATUS_HANDLER StatusHandler;
4383 NDIS_M_STS_COMPLETE_HANDLER StatusCompleteHandler;
4384 NDIS_M_TD_COMPLETE_HANDLER TDCompleteHandler;
4385 NDIS_M_REQ_COMPLETE_HANDLER QueryCompleteHandler;
4386 NDIS_M_REQ_COMPLETE_HANDLER SetCompleteHandler;
4387 NDIS_WM_SEND_COMPLETE_HANDLER WanSendCompleteHandler;
4388 WAN_RCV_HANDLER WanRcvHandler;
4389 WAN_RCV_COMPLETE_HANDLER WanRcvCompleteHandler;
4390#if defined(_NDIS_)
4391 PNDIS_MINIPORT_BLOCK NextGlobalMiniport;
4392 SINGLE_LIST_ENTRY WorkQueue[NUMBER_OF_WORK_ITEM_TYPES];
4393 SINGLE_LIST_ENTRY SingleWorkItems[NUMBER_OF_SINGLE_WORK_ITEMS];
4394 UCHAR SendFlags;
4395 UCHAR TrResetRing;
4396 UCHAR ArcnetAddress;
4397 UCHAR XState;
4398 _ANONYMOUS_UNION union {
4399#if ARCNET
4400 PNDIS_ARC_BUF ArcBuf;
4401#endif
4402 PVOID BusInterface;
4403 } DUMMYUNIONNAME;
4404 PNDIS_LOG Log;
4405 ULONG SlotNumber;
4406 PCM_RESOURCE_LIST AllocatedResources;
4407 PCM_RESOURCE_LIST AllocatedResourcesTranslated;
4408 SINGLE_LIST_ENTRY PatternList;
4409 NDIS_PNP_CAPABILITIES PMCapabilities;
4410 DEVICE_CAPABILITIES DeviceCaps;
4411 ULONG WakeUpEnable;
4412 DEVICE_POWER_STATE CurrentDevicePowerState;
4413 PIRP pIrpWaitWake;
4414 SYSTEM_POWER_STATE WaitWakeSystemState;
4415 LARGE_INTEGER VcIndex;
4416 KSPIN_LOCK VcCountLock;
4417 LIST_ENTRY WmiEnabledVcs;
4418 PNDIS_GUID pNdisGuidMap;
4419 PNDIS_GUID pCustomGuidMap;
4420 USHORT VcCount;
4421 USHORT cNdisGuidMap;
4422 USHORT cCustomGuidMap;
4423 USHORT CurrentMapRegister;
4424 PKEVENT AllocationEvent;
4425 USHORT BaseMapRegistersNeeded;
4426 USHORT SGMapRegistersNeeded;
4427 ULONG MaximumPhysicalMapping;
4428 NDIS_TIMER MediaDisconnectTimer;
4429 USHORT MediaDisconnectTimeOut;
4430 USHORT InstanceNumber;
4431 NDIS_EVENT OpenReadyEvent;
4432 NDIS_PNP_DEVICE_STATE PnPDeviceState;
4433 NDIS_PNP_DEVICE_STATE OldPnPDeviceState;
4434 PGET_SET_DEVICE_DATA SetBusData;
4435 PGET_SET_DEVICE_DATA GetBusData;
4436 KDPC DeferredDpc;
4437#if 0
4438 /* FIXME: */
4439 NDIS_STATS NdisStats;
4440#else
4441 ULONG NdisStats;
4442#endif
4443 PNDIS_PACKET IndicatedPacket[MAXIMUM_PROCESSORS];
4444 PKEVENT RemoveReadyEvent;
4445 PKEVENT AllOpensClosedEvent;
4446 PKEVENT AllRequestsCompletedEvent;
4447 ULONG InitTimeMs;
4448 NDIS_MINIPORT_WORK_ITEM WorkItemBuffer[NUMBER_OF_SINGLE_WORK_ITEMS];
4449 PDMA_ADAPTER SystemAdapterObject;
4450 ULONG DriverVerifyFlags;
4451 POID_LIST OidList;
4452 USHORT InternalResetCount;
4453 USHORT MiniportResetCount;
4454 USHORT MediaSenseConnectCount;
4455 USHORT MediaSenseDisconnectCount;
4456 PNDIS_PACKET *xPackets;
4457 ULONG UserModeOpenReferences;
4458 _ANONYMOUS_UNION union {
4459 PVOID SavedSendHandler;
4460 PVOID SavedWanSendHandler;
4461 } DUMMYUNIONNAME2;
4462 PVOID SavedSendPacketsHandler;
4463 PVOID SavedCancelSendPacketsHandler;
4464 W_SEND_PACKETS_HANDLER WSendPacketsHandler;
4465 ULONG MiniportAttributes;
4466 PDMA_ADAPTER SavedSystemAdapterObject;
4467 USHORT NumOpens;
4468 USHORT CFHangXTicks;
4469 ULONG RequestCount;
4470 ULONG IndicatedPacketsCount;
4471 ULONG PhysicalMediumType;
4472 PNDIS_REQUEST LastRequest;
4473 LONG DmaAdapterRefCount;
4474 PVOID FakeMac;
4475 ULONG LockDbg;
4476 ULONG LockDbgX;
4477 PVOID LockThread;
4478 ULONG InfoFlags;
4479 KSPIN_LOCK TimerQueueLock;
4480 PKEVENT ResetCompletedEvent;
4481 PKEVENT QueuedBindingCompletedEvent;
4482 PKEVENT DmaResourcesReleasedEvent;
4483 FILTER_PACKET_INDICATION_HANDLER SavedPacketIndicateHandler;
4484 ULONG RegisteredInterrupts;
4485 PNPAGED_LOOKASIDE_LIST SGListLookasideList;
4486 ULONG ScatterGatherListSize;
4487#endif /* _NDIS_ */
4488};
4489
4490
4491/* Handler prototypes for NDIS_OPEN_BLOCK */
4492
4493typedef NDIS_STATUS (DDKAPI *WAN_SEND_HANDLER)(
4494 /*IN*/ NDIS_HANDLE MacBindingHandle,
4495 /*IN*/ NDIS_HANDLE LinkHandle,
4496 /*IN*/ PVOID Packet);
4497
4498/* NDIS 4.0 extension */
4499
4500typedef VOID (DDKAPI *SEND_PACKETS_HANDLER)(
4501 /*IN*/ NDIS_HANDLE MiniportAdapterContext,
4502 /*IN*/ PPNDIS_PACKET PacketArray,
4503 /*IN*/ UINT NumberOfPackets);
4504
4505
4506typedef struct _NDIS_COMMON_OPEN_BLOCK {
4507 PVOID MacHandle;
4508 NDIS_HANDLE BindingHandle;
4509 PNDIS_MINIPORT_BLOCK MiniportHandle;
4510 PNDIS_PROTOCOL_BLOCK ProtocolHandle;
4511 NDIS_HANDLE ProtocolBindingContext;
4512 PNDIS_OPEN_BLOCK MiniportNextOpen;
4513 PNDIS_OPEN_BLOCK ProtocolNextOpen;
4514 NDIS_HANDLE MiniportAdapterContext;
4515 BOOLEAN Reserved1;
4516 BOOLEAN Reserved2;
4517 BOOLEAN Reserved3;
4518 BOOLEAN Reserved4;
4519 PNDIS_STRING BindDeviceName;
4520 KSPIN_LOCK Reserved5;
4521 PNDIS_STRING RootDeviceName;
4522 _ANONYMOUS_UNION union {
4523 SEND_HANDLER SendHandler;
4524 WAN_SEND_HANDLER WanSendHandler;
4525 } DUMMYUNIONNAME;
4526 TRANSFER_DATA_HANDLER TransferDataHandler;
4527 SEND_COMPLETE_HANDLER SendCompleteHandler;
4528 TRANSFER_DATA_COMPLETE_HANDLER TransferDataCompleteHandler;
4529 RECEIVE_HANDLER ReceiveHandler;
4530 RECEIVE_COMPLETE_HANDLER ReceiveCompleteHandler;
4531 WAN_RECEIVE_HANDLER WanReceiveHandler;
4532 REQUEST_COMPLETE_HANDLER RequestCompleteHandler;
4533 RECEIVE_PACKET_HANDLER ReceivePacketHandler;
4534 SEND_PACKETS_HANDLER SendPacketsHandler;
4535 RESET_HANDLER ResetHandler;
4536 REQUEST_HANDLER RequestHandler;
4537 RESET_COMPLETE_HANDLER ResetCompleteHandler;
4538 STATUS_HANDLER StatusHandler;
4539 STATUS_COMPLETE_HANDLER StatusCompleteHandler;
4540#if defined(_NDIS_)
4541 ULONG Flags;
4542 ULONG References;
4543 KSPIN_LOCK SpinLock;
4544 NDIS_HANDLE FilterHandle;
4545 ULONG ProtocolOptions;
4546 USHORT CurrentLookahead;
4547 USHORT ConnectDampTicks;
4548 USHORT DisconnectDampTicks;
4549 W_SEND_HANDLER WSendHandler;
4550 W_TRANSFER_DATA_HANDLER WTransferDataHandler;
4551 W_SEND_PACKETS_HANDLER WSendPacketsHandler;
4552 W_CANCEL_SEND_PACKETS_HANDLER CancelSendPacketsHandler;
4553 ULONG WakeUpEnable;
4554 PKEVENT CloseCompleteEvent;
4555 QUEUED_CLOSE QC;
4556 ULONG AfReferences;
4557 PNDIS_OPEN_BLOCK NextGlobalOpen;
4558#endif /* _NDIS_ */
4559} NDIS_COMMON_OPEN_BLOCK;
4560
4561struct _NDIS_OPEN_BLOCK
4562{
4563 NDIS_COMMON_OPEN_BLOCK NdisCommonOpenBlock;
4564#if defined(_NDIS_)
4565 struct _NDIS_OPEN_CO
4566 {
4567 struct _NDIS_CO_AF_BLOCK * NextAf;
4568 W_CO_CREATE_VC_HANDLER MiniportCoCreateVcHandler;
4569 W_CO_REQUEST_HANDLER MiniportCoRequestHandler;
4570 CO_CREATE_VC_HANDLER CoCreateVcHandler;
4571 CO_DELETE_VC_HANDLER CoDeleteVcHandler;
4572 PVOID CmActivateVcCompleteHandler;
4573 PVOID CmDeactivateVcCompleteHandler;
4574 PVOID CoRequestCompleteHandler;
4575 LIST_ENTRY ActiveVcHead;
4576 LIST_ENTRY InactiveVcHead;
4577 LONG PendingAfNotifications;
4578 PKEVENT AfNotifyCompleteEvent;
4579 };
4580#endif /* _NDIS_ */
4581};
4582
4583
4584
4585/* Routines for NDIS miniport drivers */
4586
4587NTOSAPI
4588VOID
4589DDKAPI
4590NdisMInitializeTimer(
4591 /*IN*/ /*OUT*/ PNDIS_MINIPORT_TIMER Timer,
4592 /*IN*/ NDIS_HANDLE MiniportAdapterHandle,
4593 /*IN*/ PNDIS_TIMER_FUNCTION TimerFunction,
4594 /*IN*/ PVOID FunctionContext);
4595
4596NTOSAPI
4597VOID
4598DDKAPI
4599NdisMSetPeriodicTimer(
4600 /*IN*/ PNDIS_MINIPORT_TIMER Timer,
4601 /*IN*/ UINT MillisecondsPeriod);
4602
4603NTOSAPI
4604VOID
4605DDKAPI
4606NdisMCancelTimer(
4607 /*IN*/ PNDIS_MINIPORT_TIMER Timer,
4608 /*OUT*/ PBOOLEAN TimerCancelled);
4609
4610NDISAPI
4611VOID
4612DDKAPI
4613NdisInitializeWrapper(
4614 /*OUT*/ PNDIS_HANDLE NdisWrapperHandle,
4615 /*IN*/ PVOID SystemSpecific1,
4616 /*IN*/ PVOID SystemSpecific2,
4617 /*IN*/ PVOID SystemSpecific3);
4618
4619NDISAPI
4620NDIS_STATUS
4621DDKAPI
4622NdisMAllocateMapRegisters(
4623 /*IN*/ NDIS_HANDLE MiniportAdapterHandle,
4624 /*IN*/ UINT DmaChannel,
4625 /*IN*/ BOOLEAN Dma32BitAddresses,
4626 /*IN*/ ULONG PhysicalMapRegistersNeeded,
4627 /*IN*/ ULONG MaximumPhysicalMapping);
4628
4629/*
4630 * VOID
4631 * NdisMArcIndicateReceive(
4632 * IN NDIS_HANDLE MiniportAdapterHandle,
4633 * IN PUCHAR HeaderBuffer,
4634 * IN PUCHAR DataBuffer,
4635 * IN UINT Length);
4636 */
4637#define NdisMArcIndicateReceive(MiniportAdapterHandle, \
4638 HeaderBuffer, \
4639 DataBuffer, \
4640 Length) \
4641{ \
4642 ArcFilterDprIndicateReceive( \
4643 (((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->FilterDbs.ArcDB), \
4644 (HeaderBuffer), \
4645 (DataBuffer), \
4646 (Length)); \
4647}
4648
4649/*
4650 * VOID
4651 * NdisMArcIndicateReceiveComplete(
4652 * IN NDIS_HANDLE MiniportAdapterHandle);
4653 */
4654#define NdisMArcIndicateReceiveComplete(MiniportAdapterHandle) \
4655{ \
4656 if (((PNDIS_MINIPORT_BLOCK)MiniportAdapterHandle)->EthDB) \
4657 { \
4658 NdisMEthIndicateReceiveComplete(_H); \
4659 } \
4660 \
4661 ArcFilterDprIndicateReceiveComplete( \
4662 ((PNDIS_MINIPORT_BLOCK)MiniportAdapterHandle)->ArcDB); \
4663}
4664
4665NDISAPI
4666VOID
4667DDKAPI
4668NdisMCloseLog(
4669 /*IN*/ NDIS_HANDLE LogHandle);
4670
4671NDISAPI
4672NDIS_STATUS
4673DDKAPI
4674NdisMCreateLog(
4675 /*IN*/ NDIS_HANDLE MiniportAdapterHandle,
4676 /*IN*/ UINT Size,
4677 /*OUT*/ PNDIS_HANDLE LogHandle);
4678
4679NDISAPI
4680VOID
4681DDKAPI
4682NdisMDeregisterAdapterShutdownHandler(
4683 /*IN*/ NDIS_HANDLE MiniportHandle);
4684
4685NDISAPI
4686VOID
4687DDKAPI
4688NdisMDeregisterInterrupt(
4689 /*IN*/ PNDIS_MINIPORT_INTERRUPT Interrupt);
4690
4691NDISAPI
4692VOID
4693DDKAPI
4694NdisMDeregisterIoPortRange(
4695 /*IN*/ NDIS_HANDLE MiniportAdapterHandle,
4696 /*IN*/ UINT InitialPort,
4697 /*IN*/ UINT NumberOfPorts,
4698 /*IN*/ PVOID PortOffset);
4699
4700/*
4701 * VOID
4702 * NdisMEthIndicateReceive(
4703 * IN NDIS_HANDLE MiniportAdapterHandle,
4704 * IN NDIS_HANDLE MiniportReceiveContext,
4705 * IN PVOID HeaderBuffer,
4706 * IN UINT HeaderBufferSize,
4707 * IN PVOID LookaheadBuffer,
4708 * IN UINT LookaheadBufferSize,
4709 * IN UINT PacketSize);
4710 */
4711#define NdisMEthIndicateReceive(MiniportAdapterHandle, \
4712 MiniportReceiveContext, \
4713 HeaderBuffer, \
4714 HeaderBufferSize, \
4715 LookaheadBuffer, \
4716 LookaheadBufferSize, \
4717 PacketSize) \
4718{ \
4719 (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->EthRxIndicateHandler)( \
4720 (((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->FilterDbs.EthDB), \
4721 (MiniportReceiveContext), \
4722 (HeaderBuffer), \
4723 (HeaderBuffer), \
4724 (HeaderBufferSize), \
4725 (LookaheadBuffer), \
4726 (LookaheadBufferSize), \
4727 (PacketSize)); \
4728}
4729
4730/*
4731 * VOID
4732 * NdisMEthIndicateReceiveComplete(
4733 * IN NDIS_HANDLE MiniportAdapterHandle);
4734 */
4735#define NdisMEthIndicateReceiveComplete(MiniportAdapterHandle) \
4736{ \
4737 (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->EthRxCompleteHandler)( \
4738 ((PNDIS_MINIPORT_BLOCK)MiniportAdapterHandle)->FilterDbs.EthDB); \
4739}
4740
4741/*
4742 * VOID
4743 * NdisMFddiIndicateReceive(
4744 * IN NDIS_HANDLE MiniportAdapterHandle,
4745 * IN NDIS_HANDLE MiniportReceiveContext,
4746 * IN PVOID HeaderBuffer,
4747 * IN UINT HeaderBufferSize,
4748 * IN PVOID LookaheadBuffer,
4749 * IN UINT LookaheadBufferSize,
4750 * IN UINT PacketSize);
4751 */
4752#define NdisMFddiIndicateReceive(MiniportAdapterHandle, \
4753 MiniportReceiveContext, \
4754 HeaderBuffer, \
4755 HeaderBufferSize, \
4756 LookaheadBuffer, \
4757 LookaheadBufferSize, \
4758 PacketSize) \
4759{ \
4760 (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->FddiRxIndicateHandler)( \
4761 (((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->FilterDbs.FddiDB), \
4762 (MiniportReceiveContext), \
4763 (PUCHAR)(HeaderBuffer) + 1, \
4764 (((*(PUCHAR*)(HeaderBuffer)) & 0x40) ? \
4765 FDDI_LENGTH_OF_LONG_ADDRESS : \
4766 FDDI_LENGTH_OF_SHORT_ADDRESS), \
4767 (HeaderBuffer), \
4768 (HeaderBufferSize), \
4769 (LookaheadBuffer), \
4770 (LookaheadBufferSize), \
4771 (PacketSize)); \
4772}
4773
4774
4775
4776/*
4777 * VOID
4778 * NdisMFddiIndicateReceiveComplete(
4779 * IN NDIS_HANDLE MiniportAdapterHandle);
4780 */
4781#define NdisMFddiIndicateReceiveComplete(MiniportAdapterHandle) \
4782{ \
4783 (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->FddiRxCompleteHandler)( \
4784 ((PNDIS_MINIPORT_BLOCK)MiniportAdapterHandle)->FilterDbs.FddiDB); \
4785}
4786
4787NDISAPI
4788VOID
4789DDKAPI
4790NdisMFlushLog(
4791 /*IN*/ NDIS_HANDLE LogHandle);
4792
4793NDISAPI
4794VOID
4795DDKAPI
4796NdisMFreeMapRegisters(
4797 /*IN*/ NDIS_HANDLE MiniportAdapterHandle);
4798
4799/*
4800 * VOID
4801 * NdisMIndicateStatus(
4802 * IN NDIS_HANDLE MiniportAdapterHandle,
4803 * IN NDIS_STATUS GeneralStatus,
4804 * IN PVOID StatusBuffer,
4805 * IN UINT StatusBufferSize);
4806 */
4807
4808#define NdisMIndicateStatus(MiniportAdapterHandle, \
4809 GeneralStatus, StatusBuffer, StatusBufferSize) \
4810 (*((PNDIS_MINIPORT_BLOCK)(_M))->StatusHandler)( \
4811 MiniportAdapterHandle, GeneralStatus, StatusBuffer, StatusBufferSize)
4812
4813/*
4814 * VOID
4815 * NdisMIndicateStatusComplete(
4816 * IN NDIS_HANDLE MiniportAdapterHandle);
4817 */
4818#define NdisMIndicateStatusComplete(MiniportAdapterHandle) \
4819 (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->StatusCompleteHandler)( \
4820 MiniportAdapterHandle)
4821
4822/*
4823 * VOID
4824 * NdisMInitializeWrapper(
4825 * OUT PNDIS_HANDLE NdisWrapperHandle,
4826 * IN PVOID SystemSpecific1,
4827 * IN PVOID SystemSpecific2,
4828 * IN PVOID SystemSpecific3);
4829 */
4830#define NdisMInitializeWrapper(NdisWrapperHandle, \
4831 SystemSpecific1, \
4832 SystemSpecific2, \
4833 SystemSpecific3) \
4834 NdisInitializeWrapper((NdisWrapperHandle), \
4835 (SystemSpecific1), \
4836 (SystemSpecific2), \
4837 (SystemSpecific3))
4838
4839NDISAPI
4840NDIS_STATUS
4841DDKAPI
4842NdisMMapIoSpace(
4843 /*OUT*/ PVOID *VirtualAddress,
4844 /*IN*/ NDIS_HANDLE MiniportAdapterHandle,
4845 /*IN*/ NDIS_PHYSICAL_ADDRESS PhysicalAddress,
4846 /*IN*/ UINT Length);
4847
4848/*
4849 * VOID
4850 * NdisMQueryInformationComplete(
4851 * IN NDIS_HANDLE MiniportAdapterHandle,
4852 * IN NDIS_STATUS Status);
4853 */
4854#define NdisMQueryInformationComplete(MiniportAdapterHandle, Status) \
4855 (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->QueryCompleteHandler)(MiniportAdapterHandle, Status)
4856
4857NDISAPI
4858VOID
4859DDKAPI
4860NdisMRegisterAdapterShutdownHandler(
4861 /*IN*/ NDIS_HANDLE MiniportHandle,
4862 /*IN*/ PVOID ShutdownContext,
4863 /*IN*/ ADAPTER_SHUTDOWN_HANDLER ShutdownHandler);
4864
4865NDISAPI
4866NDIS_STATUS
4867DDKAPI
4868NdisMRegisterInterrupt(
4869 /*OUT*/ PNDIS_MINIPORT_INTERRUPT Interrupt,
4870 /*IN*/ NDIS_HANDLE MiniportAdapterHandle,
4871 /*IN*/ UINT InterruptVector,
4872 /*IN*/ UINT InterruptLevel,
4873 /*IN*/ BOOLEAN RequestIsr,
4874 /*IN*/ BOOLEAN SharedInterrupt,
4875 /*IN*/ NDIS_INTERRUPT_MODE InterruptMode);
4876
4877NDISAPI
4878NDIS_STATUS
4879DDKAPI
4880NdisMRegisterIoPortRange(
4881 /*OUT*/ PVOID *PortOffset,
4882 /*IN*/ NDIS_HANDLE MiniportAdapterHandle,
4883 /*IN*/ UINT InitialPort,
4884 /*IN*/ UINT NumberOfPorts);
4885
4886NDISAPI
4887NDIS_STATUS
4888DDKAPI
4889NdisMRegisterMiniport(
4890 /*IN*/ NDIS_HANDLE NdisWrapperHandle,
4891 /*IN*/ PNDIS_MINIPORT_CHARACTERISTICS MiniportCharacteristics,
4892 /*IN*/ UINT CharacteristicsLength);
4893
4894
4895#if !defined(_NDIS_)
4896
4897/*
4898 * VOID
4899 * NdisMResetComplete(
4900 * IN NDIS_HANDLE MiniportAdapterHandle,
4901 * IN NDIS_STATUS Status,
4902 * IN BOOLEAN AddressingReset);
4903 */
4904#define NdisMResetComplete(MiniportAdapterHandle, \
4905 Status, \
4906 AddressingReset) \
4907{ \
4908 (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->ResetCompleteHandler)( \
4909 MiniportAdapterHandle, Status, AddressingReset); \
4910}
4911
4912/*
4913 * VOID
4914 * NdisMSendComplete(
4915 * IN NDIS_HANDLE MiniportAdapterHandle,
4916 * IN PNDIS_PACKET Packet,
4917 * IN NDIS_STATUS Status);
4918 */
4919#define NdisMSendComplete(MiniportAdapterHandle, \
4920 Packet, \
4921 Status) \
4922{ \
4923 (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->SendCompleteHandler)( \
4924 MiniportAdapterHandle, Packet, Status); \
4925}
4926
4927/*
4928 * VOID
4929 * NdisMSendResourcesAvailable(
4930 * IN NDIS_HANDLE MiniportAdapterHandle);
4931 */
4932#define NdisMSendResourcesAvailable(MiniportAdapterHandle) \
4933{ \
4934 (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->SendResourcesHandler)( \
4935 MiniportAdapterHandle); \
4936}
4937
4938/*
4939 * VOID
4940 * NdisMTransferDataComplete(
4941 * IN NDIS_HANDLE MiniportAdapterHandle,
4942 * IN PNDIS_PACKET Packet,
4943 * IN NDIS_STATUS Status,
4944 * IN UINT BytesTransferred);
4945 */
4946#define NdisMTransferDataComplete(MiniportAdapterHandle, \
4947 Packet, \
4948 Status, \
4949 BytesTransferred) \
4950{ \
4951 (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->TDCompleteHandler)( \
4952 MiniportAdapterHandle, Packet, Status, BytesTransferred) \
4953}
4954
4955#endif /* !_NDIS_ */
4956
4957
4958/*
4959 * VOID
4960 * NdisMSetAttributes(
4961 * IN NDIS_HANDLE MiniportAdapterHandle,
4962 * IN NDIS_HANDLE MiniportAdapterContext,
4963 * IN BOOLEAN BusMaster,
4964 * IN NDIS_INTERFACE_TYPE AdapterType);
4965 */
4966#define NdisMSetAttributes(MiniportAdapterHandle, \
4967 MiniportAdapterContext, \
4968 BusMaster, \
4969 AdapterType) \
4970 NdisMSetAttributesEx(MiniportAdapterHandle, \
4971 MiniportAdapterContext, \
4972 0, \
4973 (BusMaster) ? NDIS_ATTRIBUTE_BUS_MASTER : 0, \
4974 AdapterType)
4975
4976NDISAPI
4977VOID
4978DDKAPI
4979NdisMSetAttributesEx(
4980 /*IN*/ NDIS_HANDLE MiniportAdapterHandle,
4981 /*IN*/ NDIS_HANDLE MiniportAdapterContext,
4982 /*IN*/ UINT CheckForHangTimeInSeconds /*OPTIONAL*/,
4983 /*IN*/ ULONG AttributeFlags,
4984 /*IN*/ NDIS_INTERFACE_TYPE AdapterType);
4985
4986/*
4987 * VOID
4988 * NdisMSetInformationComplete(
4989 * IN NDIS_HANDLE MiniportAdapterHandle,
4990 * IN NDIS_STATUS Status);
4991 */
4992#define NdisMSetInformationComplete(MiniportAdapterHandle, \
4993 Status) \
4994 (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->SetCompleteHandler)( \
4995 MiniportAdapterHandle, Status)
4996
4997NDISAPI
4998VOID
4999DDKAPI
5000NdisMSleep(
5001 /*IN*/ ULONG MicrosecondsToSleep);
5002
5003NDISAPI
5004BOOLEAN
5005DDKAPI
5006NdisMSynchronizeWithInterrupt(
5007 /*IN*/ PNDIS_MINIPORT_INTERRUPT Interrupt,
5008 /*IN*/ PVOID SynchronizeFunction,
5009 /*IN*/ PVOID SynchronizeContext);
5010
5011/*
5012 * VOID
5013 * NdisMTrIndicateReceive(
5014 * IN NDIS_HANDLE MiniportAdapterHandle,
5015 * IN NDIS_HANDLE MiniportReceiveContext,
5016 * IN PVOID HeaderBuffer,
5017 * IN UINT HeaderBufferSize,
5018 * IN PVOID LookaheadBuffer,
5019 * IN UINT LookaheadBufferSize,
5020 * IN UINT PacketSize);
5021 */
5022#define NdisMTrIndicateReceive(MiniportAdapterHandle, \
5023 MiniportReceiveContext, \
5024 HeaderBuffer, \
5025 HeaderBufferSize, \
5026 LookaheadBuffer, \
5027 LookaheadBufferSize, \
5028 PacketSize) \
5029{ \
5030 (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->TrRxIndicateHandler)( \
5031 (((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->FilterDbs.TrDB), \
5032 (MiniportReceiveContext), \
5033 (HeaderBuffer), \
5034 (HeaderBuffer), \
5035 (HeaderBufferSize), \
5036 (LookaheadBuffer), \
5037 (LookaheadBufferSize), \
5038 (PacketSize)); \
5039}
5040
5041/*
5042 * VOID
5043 * NdisMTrIndicateReceiveComplete(
5044 * IN NDIS_HANDLE MiniportAdapterHandle);
5045 */
5046#define NdisMTrIndicateReceiveComplete(MiniportAdapterHandle) \
5047{ \
5048 (*((PNDIS_MINIPORT_BLOCK)(MiniportAdapterHandle))->TrRxCompleteHandler)( \
5049 ((PNDIS_MINIPORT_BLOCK)MiniportAdapterHandle)->FilterDbs.TrDB); \
5050}
5051
5052NDISAPI
5053NDIS_STATUS
5054DDKAPI
5055NdisMWriteLogData(
5056 /*IN*/ NDIS_HANDLE LogHandle,
5057 /*IN*/ PVOID LogBuffer,
5058 /*IN*/ UINT LogBufferSize);
5059
5060NDISAPI
5061VOID
5062DDKAPI
5063NdisMQueryAdapterResources(
5064 /*OUT*/ PNDIS_STATUS Status,
5065 /*IN*/ NDIS_HANDLE WrapperConfigurationContext,
5066 /*OUT*/ PNDIS_RESOURCE_LIST ResourceList,
5067 /*IN OUT*/ PUINT BufferSize);
5068
5069NDISAPI
5070VOID
5071DDKAPI
5072NdisTerminateWrapper(
5073 /*IN*/ NDIS_HANDLE NdisWrapperHandle,
5074 /*IN*/ PVOID SystemSpecific);
5075
5076NDISAPI
5077VOID
5078DDKAPI
5079NdisMUnmapIoSpace(
5080 /*IN*/ NDIS_HANDLE MiniportAdapterHandle,
5081 /*IN*/ PVOID VirtualAddress,
5082 /*IN*/ UINT Length);
5083
5084
5085
5086/* NDIS intermediate miniport structures */
5087
5088typedef VOID (DDKAPI *W_MINIPORT_CALLBACK)(
5089 /*IN*/ NDIS_HANDLE MiniportAdapterContext,
5090 /*IN*/ PVOID CallbackContext);
5091
5092
5093
5094/* Routines for intermediate miniport drivers */
5095
5096NDISAPI
5097NDIS_STATUS
5098DDKAPI
5099NdisIMDeInitializeDeviceInstance(
5100 /*IN*/ NDIS_HANDLE NdisMiniportHandle);
5101
5102/*
5103 * NDIS_STATUS
5104 * NdisIMInitializeDeviceInstance(
5105 * IN NDIS_HANDLE DriverHandle,
5106 * IN PNDIS_STRING DeviceInstance);
5107 */
5108#define NdisIMInitializeDeviceInstance(DriverHandle, DeviceInstance) \
5109 NdisIMInitializeDeviceInstanceEx(DriverHandle, DeviceInstance, NULL)
5110
5111NDISAPI
5112NDIS_STATUS
5113DDKAPI
5114NdisIMRegisterLayeredMiniport(
5115 /*IN*/ NDIS_HANDLE NdisWrapperHandle,
5116 /*IN*/ PNDIS_MINIPORT_CHARACTERISTICS MiniportCharacteristics,
5117 /*IN*/ UINT CharacteristicsLength,
5118 /*OUT*/ PNDIS_HANDLE DriverHandle);
5119
5120
5121/* Functions obsoleted by NDIS 5.0 */
5122
5123NDISAPI
5124VOID
5125DDKAPI
5126NdisFreeDmaChannel(
5127 /*IN*/ PNDIS_HANDLE NdisDmaHandle);
5128
5129NDISAPI
5130VOID
5131DDKAPI
5132NdisSetupDmaTransfer(
5133 /*OUT*/ PNDIS_STATUS Status,
5134 /*IN*/ PNDIS_HANDLE NdisDmaHandle,
5135 /*IN*/ PNDIS_BUFFER Buffer,
5136 /*IN*/ ULONG Offset,
5137 /*IN*/ ULONG Length,
5138 /*IN*/ BOOLEAN WriteToDevice);
5139
5140NDISAPI
5141NTSTATUS
5142DDKAPI
5143NdisUpcaseUnicodeString(
5144 /*OUT*/ PUNICODE_STRING DestinationString,
5145 /*IN*/ PUNICODE_STRING SourceString);
5146
5147
5148/* Routines for NDIS protocol drivers */
5149
5150NDISAPI
5151VOID
5152DDKAPI
5153NdisRequest(
5154 /*OUT*/ PNDIS_STATUS Status,
5155 /*IN*/ NDIS_HANDLE NdisBindingHandle,
5156 /*IN*/ PNDIS_REQUEST NdisRequest);
5157
5158NDISAPI
5159VOID
5160DDKAPI
5161NdisReset(
5162 /*OUT*/ PNDIS_STATUS Status,
5163 /*IN*/ NDIS_HANDLE NdisBindingHandle);
5164
5165NDISAPI
5166VOID
5167DDKAPI
5168NdisSend(
5169 /*OUT*/ PNDIS_STATUS Status,
5170 /*IN*/ NDIS_HANDLE NdisBindingHandle,
5171 /*IN*/ PNDIS_PACKET Packet);
5172
5173NDISAPI
5174VOID
5175DDKAPI
5176NdisSendPackets(
5177 /*IN*/ NDIS_HANDLE NdisBindingHandle,
5178 /*IN*/ PPNDIS_PACKET PacketArray,
5179 /*IN*/ UINT NumberOfPackets);
5180
5181NDISAPI
5182VOID
5183DDKAPI
5184NdisTransferData(
5185 /*OUT*/ PNDIS_STATUS Status,
5186 /*IN*/ NDIS_HANDLE NdisBindingHandle,
5187 /*IN*/ NDIS_HANDLE MacReceiveContext,
5188 /*IN*/ UINT ByteOffset,
5189 /*IN*/ UINT BytesToTransfer,
5190 /*IN OUT*/ PNDIS_PACKET Packet,
5191 /*OUT*/ PUINT BytesTransferred);
5192
5193NDISAPI
5194VOID
5195DDKAPI
5196NdisCloseAdapter(
5197 /*OUT*/ PNDIS_STATUS Status,
5198 /*IN*/ NDIS_HANDLE NdisBindingHandle);
5199
5200NDISAPI
5201VOID
5202DDKAPI
5203NdisCompleteBindAdapter(
5204 /*IN*/ NDIS_HANDLE BindAdapterContext,
5205 /*IN*/ NDIS_STATUS Status,
5206 /*IN*/ NDIS_STATUS OpenStatus);
5207
5208NDISAPI
5209VOID
5210DDKAPI
5211NdisCompleteUnbindAdapter(
5212 /*IN*/ NDIS_HANDLE UnbindAdapterContext,
5213 /*IN*/ NDIS_STATUS Status);
5214
5215NDISAPI
5216VOID
5217DDKAPI
5218NdisDeregisterProtocol(
5219 /*OUT*/ PNDIS_STATUS Status,
5220 /*IN*/ NDIS_HANDLE NdisProtocolHandle);
5221
5222NDISAPI
5223VOID
5224DDKAPI
5225NdisOpenAdapter(
5226 /*OUT*/ PNDIS_STATUS Status,
5227 /*OUT*/ PNDIS_STATUS OpenErrorStatus,
5228 /*OUT*/ PNDIS_HANDLE NdisBindingHandle,
5229 /*OUT*/ PUINT SelectedMediumIndex,
5230 /*IN*/ PNDIS_MEDIUM MediumArray,
5231 /*IN*/ UINT MediumArraySize,
5232 /*IN*/ NDIS_HANDLE NdisProtocolHandle,
5233 /*IN*/ NDIS_HANDLE ProtocolBindingContext,
5234 /*IN*/ PNDIS_STRING AdapterName,
5235 /*IN*/ UINT OpenOptions,
5236 /*IN*/ PSTRING AddressingInformation);
5237
5238NDISAPI
5239VOID
5240DDKAPI
5241NdisOpenProtocolConfiguration(
5242 /*OUT*/ PNDIS_STATUS Status,
5243 /*OUT*/ PNDIS_HANDLE ConfigurationHandle,
5244 /*IN*/ PNDIS_STRING ProtocolSection);
5245
5246NDISAPI
5247VOID
5248DDKAPI
5249NdisRegisterProtocol(
5250 /*OUT*/ PNDIS_STATUS Status,
5251 /*OUT*/ PNDIS_HANDLE NdisProtocolHandle,
5252 /*IN*/ PNDIS_PROTOCOL_CHARACTERISTICS ProtocolCharacteristics,
5253 /*IN*/ UINT CharacteristicsLength);
5254
5255/* Obsoleted in Windows XP */
5256
5257/* Prototypes for NDIS_MAC_CHARACTERISTICS */
5258
5259typedef NDIS_STATUS (*OPEN_ADAPTER_HANDLER)(
5260 /*OUT*/ PNDIS_STATUS OpenErrorStatus,
5261 /*OUT*/ NDIS_HANDLE *MacBindingHandle,
5262 /*OUT*/ PUINT SelectedMediumIndex,
5263 /*IN*/ PNDIS_MEDIUM MediumArray,
5264 /*IN*/ UINT MediumArraySize,
5265 /*IN*/ NDIS_HANDLE NdisBindingContext,
5266 /*IN*/ NDIS_HANDLE MacAdapterContext,
5267 /*IN*/ UINT OpenOptions,
5268 /*IN*/ PSTRING AddressingInformation /*OPTIONAL*/);
5269
5270typedef NDIS_STATUS (DDKAPI *CLOSE_ADAPTER_HANDLER)(
5271 /*IN*/ NDIS_HANDLE MacBindingHandle);
5272
5273typedef NDIS_STATUS (DDKAPI *WAN_TRANSFER_DATA_HANDLER)(
5274 VOID);
5275
5276typedef NDIS_STATUS (DDKAPI *QUERY_GLOBAL_STATISTICS_HANDLER)(
5277 /*IN*/ NDIS_HANDLE MacAdapterContext,
5278 /*IN*/ PNDIS_REQUEST NdisRequest);
5279
5280typedef VOID (DDKAPI *UNLOAD_MAC_HANDLER)(
5281 /*IN*/ NDIS_HANDLE MacMacContext);
5282
5283typedef NDIS_STATUS (DDKAPI *ADD_ADAPTER_HANDLER)(
5284 /*IN*/ NDIS_HANDLE MacMacContext,
5285 /*IN*/ NDIS_HANDLE WrapperConfigurationContext,
5286 /*IN*/ PNDIS_STRING AdapterName);
5287
5288typedef VOID (*REMOVE_ADAPTER_HANDLER)(
5289 /*IN*/ NDIS_HANDLE MacAdapterContext);
5290
5291typedef struct _NDIS_MAC_CHARACTERISTICS {
5292 UCHAR MajorNdisVersion;
5293 UCHAR MinorNdisVersion;
5294 UINT Reserved;
5295 OPEN_ADAPTER_HANDLER OpenAdapterHandler;
5296 CLOSE_ADAPTER_HANDLER CloseAdapterHandler;
5297 SEND_HANDLER SendHandler;
5298 TRANSFER_DATA_HANDLER TransferDataHandler;
5299 RESET_HANDLER ResetHandler;
5300 REQUEST_HANDLER RequestHandler;
5301 QUERY_GLOBAL_STATISTICS_HANDLER QueryGlobalStatisticsHandler;
5302 UNLOAD_MAC_HANDLER UnloadMacHandler;
5303 ADD_ADAPTER_HANDLER AddAdapterHandler;
5304 REMOVE_ADAPTER_HANDLER RemoveAdapterHandler;
5305 NDIS_STRING Name;
5306} NDIS_MAC_CHARACTERISTICS, *PNDIS_MAC_CHARACTERISTICS;
5307
5308typedef NDIS_MAC_CHARACTERISTICS NDIS_WAN_MAC_CHARACTERISTICS;
5309typedef NDIS_WAN_MAC_CHARACTERISTICS *PNDIS_WAN_MAC_CHARACTERISTICS;
5310
5311#ifdef __cplusplus
5312}
5313#endif
5314
5315#endif /* __NDIS_H */
5316
5317/* EOF */
Note: See TracBrowser for help on using the repository browser.