040f4595fbdf9efb70d8e0a51aa11266bf3925f9
[reactos.git] / reactos / include / net / ndis.h
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS NDIS library
4 * FILE: include/net/ndis.h
5 * PURPOSE: Structures used by NDIS drivers
6 * DEFINES: i386 - Target platform is i386
7 * NDIS_WRAPPER - Define only for NDIS wrapper library
8 * NDIS_MINIPORT_DRIVER - Define only for NDIS miniport drivers
9 * NDIS40 - Use NDIS 4.0 structures by default
10 * NDIS50 - Use NDIS 5.0 structures by default
11 * NDIS_WDM - Include wdm.h (currently just pulls in ntddk.h)
12 *
13 * NOTES: If NDIS_WDM is not defined, ntddk.h is included instead
14 *
15 * I have removed the following standard flag, used for building binary-compatible
16 * drivers for windows 98 and windows me:
17 *
18 * BINARY_COMPATIBLE - 0 = Use macros for some features
19 * - 1 = Use imports for features not available
20 *
21 * rationale: you're never going to use *this* ndis.h to build a driver for win9x. You'll
22 * use the MS ddk. This assumption drammatically simplifies ndis.h.
23 */
24
25 // TODO: finish sanitizing NDIS40 and NDIS50; think about NDIS51
26
27 #ifndef __NDIS_H
28 #define __NDIS_H
29
30 #ifdef __cplusplus
31 extern "C"
32 {
33 #endif /* __cplusplus */
34
35 #ifdef NDIS50
36 #undef NDIS40
37 #define NDIS40
38 #endif
39
40 #ifndef UNALIGNED
41 #define UNALIGNED
42 #endif
43
44 #ifndef FASTCALL
45 #define FASTCALL __attribute__((fastcall))
46 #endif
47
48 /* The NDIS library exports functions. NDIS miniport drivers import functions */
49 #ifdef NDIS_WRAPPER
50
51 #ifdef _MSC_VER
52 #define EXPIMP __declspec(dllexport)
53 #else
54 #define EXPIMP STDCALL /* MS ndis.h is 100% stdcall due to compiler flag /Gz */
55 #endif
56
57 #else /* NDIS_WRAPPER */
58
59 #ifdef _MSC_VER
60 #define EXPIMP __declspec(dllimport)
61 #else
62 #define EXPIMP STDCALL
63 #endif
64
65 #endif /* NDIS_WRAPPER */
66
67 /* support NDIS_WDM and MAC drivers */
68 #if defined (NDIS_WDM)
69 #include <wdm.h>
70 #else
71 #include <ntddk.h>
72 #endif
73
74 /* Assert stuff */
75 #ifdef DBG
76 VOID
77 STDCALL
78 RtlAssert (
79 PVOID FailedAssertion,
80 PVOID FileName,
81 ULONG LineNumber,
82 PCHAR Message
83 );
84
85 #define ASSERT( exp ) if (!(exp)) RtlAssert( #exp, __FILE__, __LINE__, NULL )
86 #define ASSERTMSG( msg, exp ) if (!(exp)) RtlAssert( #exp, __FILE__, __LINE__, msg )
87
88 #else
89 #define ASSERT( exp )
90 #define ASSERTMSG( msg, exp )
91 #endif /* DBG */
92
93 /* Base types */
94
95 #define IN
96 #define OUT
97 #define OPTIONAL
98
99 typedef CONST CHAR *PCSTR;
100
101 typedef struct _DMA_CONFIGURATION_BYTE0
102 {
103 UCHAR Channel:3;
104 UCHAR Reserved:3;
105 UCHAR Shared:1;
106 UCHAR MoreEntries:1;
107 } DMA_CONFIGURATION_BYTE0;
108
109 typedef struct _DMA_CONFIGURATION_BYTE1
110 {
111 UCHAR Reserved0:2;
112 UCHAR TransferSize:2;
113 UCHAR Timing:2;
114 UCHAR Reserved1:2;
115 } DMA_CONFIGURATION_BYTE1;
116
117
118 typedef struct _EISA_MEMORY_TYPE
119 {
120 UCHAR ReadWrite:1;
121 UCHAR Cached:1;
122 UCHAR Reserved0:1;
123 UCHAR Type:2;
124 UCHAR Shared:1;
125 UCHAR Reserved1:1;
126 UCHAR MoreEntries:1;
127 } EISA_MEMORY_TYPE, *PEISA_MEMORY_TYPE;
128
129 typedef struct _EISA_MEMORY_CONFIGURATION
130 {
131 EISA_MEMORY_TYPE ConfigurationByte;
132 UCHAR DataSize;
133 USHORT AddressLowWord;
134 UCHAR AddressHighByte;
135 USHORT MemorySize;
136 } EISA_MEMORY_CONFIGURATION, *PEISA_MEMORY_CONFIGURATION;
137
138
139 typedef struct _EISA_IRQ_DESCRIPTOR
140 {
141 UCHAR Interrupt:4;
142 UCHAR Reserved:1;
143 UCHAR LevelTriggered:1;
144 UCHAR Shared:1;
145 UCHAR MoreEntries:1;
146 } EISA_IRQ_DESCRIPTOR, *PEISA_IRQ_DESCRIPTOR;
147
148 typedef struct _EISA_IRQ_CONFIGURATION
149 {
150 EISA_IRQ_DESCRIPTOR ConfigurationByte;
151 UCHAR Reserved;
152 } EISA_IRQ_CONFIGURATION, *PEISA_IRQ_CONFIGURATION;
153
154 typedef struct _EISA_DMA_CONFIGURATION
155 {
156 DMA_CONFIGURATION_BYTE0 ConfigurationByte0;
157 DMA_CONFIGURATION_BYTE1 ConfigurationByte1;
158 } EISA_DMA_CONFIGURATION, *PEISA_DMA_CONFIGURATION;
159
160
161 typedef struct _EISA_PORT_DESCRIPTOR
162 {
163 UCHAR NumberPorts:5;
164 UCHAR Reserved:1;
165 UCHAR Shared:1;
166 UCHAR MoreEntries:1;
167 } EISA_PORT_DESCRIPTOR, *PEISA_PORT_DESCRIPTOR;
168
169 typedef struct _EISA_PORT_CONFIGURATION
170 {
171 EISA_PORT_DESCRIPTOR Configuration;
172 USHORT PortAddress;
173 } EISA_PORT_CONFIGURATION, *PEISA_PORT_CONFIGURATION;
174
175 typedef struct _CM_EISA_SLOT_INFORMATION
176 {
177 UCHAR ReturnCode;
178 UCHAR ReturnFlags;
179 UCHAR MajorRevision;
180 UCHAR MinorRevision;
181 USHORT Checksum;
182 UCHAR NumberFunctions;
183 UCHAR FunctionInformation;
184 ULONG CompressedId;
185 } CM_EISA_SLOT_INFORMATION, *PCM_EISA_SLOT_INFORMATION;
186
187 typedef struct _CM_EISA_FUNCTION_INFORMATION
188 {
189 ULONG CompressedId;
190 UCHAR IdSlotFlags1;
191 UCHAR IdSlotFlags2;
192 UCHAR MinorRevision;
193 UCHAR MajorRevision;
194 UCHAR Selections[26];
195 UCHAR FunctionFlags;
196 UCHAR TypeString[80];
197 EISA_MEMORY_CONFIGURATION EisaMemory[9];
198 EISA_IRQ_CONFIGURATION EisaIrq[7];
199 EISA_DMA_CONFIGURATION EisaDma[4];
200 EISA_PORT_CONFIGURATION EisaPort[20];
201 UCHAR InitializationData[60];
202 } CM_EISA_FUNCTION_INFORMATION, *PCM_EISA_FUNCTION_INFORMATION;
203
204 ULONG CDECL DbgPrint(
205 PCH Format,
206 ...);
207
208
209 /* Core kernel functions */
210
211 VOID
212 STDCALL
213 KeStallExecutionProcessor(
214 ULONG MicroSeconds);
215
216
217 #include "netevent.h"
218 #include "ndisoid.h"
219 #include "ntddndis.h"
220
221
222 #if !defined(_MSC_VER)
223 #ifndef _GUID_DEFINED
224 #define _GUID_DEFINED
225 typedef struct _GUID {
226 ULONG Data1;
227 USHORT Data2;
228 USHORT Data3;
229 UCHAR Data4[8];
230 } GUID;
231 #endif /* _GUID_DEFINED */
232 #endif /* _MSC_VER */
233
234
235 /* NDIS base types */
236
237 typedef struct _NDIS_SPIN_LOCK
238 {
239 KSPIN_LOCK SpinLock;
240 KIRQL OldIrql;
241 } NDIS_SPIN_LOCK, * PNDIS_SPIN_LOCK;
242
243 typedef struct _NDIS_EVENT
244 {
245 KEVENT Event;
246 } NDIS_EVENT, *PNDIS_EVENT;
247
248 typedef PVOID NDIS_HANDLE, *PNDIS_HANDLE;
249 typedef int NDIS_STATUS, *PNDIS_STATUS;
250
251 typedef UNICODE_STRING NDIS_STRING, *PNDIS_STRING;
252
253 typedef MDL NDIS_BUFFER, *PNDIS_BUFFER;
254
255 /* NDIS_STATUS constants */
256 #define NDIS_STATUS_SUCCESS ((NDIS_STATUS)STATUS_SUCCESS)
257 #define NDIS_STATUS_PENDING ((NDIS_STATUS)STATUS_PENDING)
258 #define NDIS_STATUS_NOT_RECOGNIZED ((NDIS_STATUS)0x00010001L)
259 #define NDIS_STATUS_NOT_COPIED ((NDIS_STATUS)0x00010002L)
260 #define NDIS_STATUS_NOT_ACCEPTED ((NDIS_STATUS)0x00010003L)
261 #define NDIS_STATUS_CALL_ACTIVE ((NDIS_STATUS)0x00010007L)
262
263 #define NDIS_STATUS_ONLINE ((NDIS_STATUS)0x40010003L)
264 #define NDIS_STATUS_RESET_START ((NDIS_STATUS)0x40010004L)
265 #define NDIS_STATUS_RESET_END ((NDIS_STATUS)0x40010005L)
266 #define NDIS_STATUS_RING_STATUS ((NDIS_STATUS)0x40010006L)
267 #define NDIS_STATUS_CLOSED ((NDIS_STATUS)0x40010007L)
268 #define NDIS_STATUS_WAN_LINE_UP ((NDIS_STATUS)0x40010008L)
269 #define NDIS_STATUS_WAN_LINE_DOWN ((NDIS_STATUS)0x40010009L)
270 #define NDIS_STATUS_WAN_FRAGMENT ((NDIS_STATUS)0x4001000AL)
271 #define NDIS_STATUS_MEDIA_CONNECT ((NDIS_STATUS)0x4001000BL)
272 #define NDIS_STATUS_MEDIA_DISCONNECT ((NDIS_STATUS)0x4001000CL)
273 #define NDIS_STATUS_HARDWARE_LINE_UP ((NDIS_STATUS)0x4001000DL)
274 #define NDIS_STATUS_HARDWARE_LINE_DOWN ((NDIS_STATUS)0x4001000EL)
275 #define NDIS_STATUS_INTERFACE_UP ((NDIS_STATUS)0x4001000FL)
276 #define NDIS_STATUS_INTERFACE_DOWN ((NDIS_STATUS)0x40010010L)
277 #define NDIS_STATUS_MEDIA_BUSY ((NDIS_STATUS)0x40010011L)
278 #define NDIS_STATUS_WW_INDICATION ((NDIS_STATUS)0x40010012L)
279 #define NDIS_STATUS_TAPI_INDICATION ((NDIS_STATUS)0x40010080L)
280
281 #define NDIS_STATUS_NOT_RESETTABLE ((NDIS_STATUS)0x80010001L)
282 #define NDIS_STATUS_SOFT_ERRORS ((NDIS_STATUS)0x80010003L)
283 #define NDIS_STATUS_HARD_ERRORS ((NDIS_STATUS)0x80010004L)
284 #define NDIS_STATUS_BUFFER_OVERFLOW ((NDIS_STATUS)STATUS_BUFFER_OVERFLOW)
285
286 #define NDIS_STATUS_FAILURE ((NDIS_STATUS)STATUS_UNSUCCESSFUL)
287 #define NDIS_STATUS_RESOURCES ((NDIS_STATUS)STATUS_INSUFFICIENT_RESOURCES)
288 #define NDIS_STATUS_CLOSING ((NDIS_STATUS)0xC0010002L)
289 #define NDIS_STATUS_BAD_VERSION ((NDIS_STATUS)0xC0010004L)
290 #define NDIS_STATUS_BAD_CHARACTERISTICS ((NDIS_STATUS)0xC0010005L)
291 #define NDIS_STATUS_ADAPTER_NOT_FOUND ((NDIS_STATUS)0xC0010006L)
292 #define NDIS_STATUS_OPEN_FAILED ((NDIS_STATUS)0xC0010007L)
293 #define NDIS_STATUS_DEVICE_FAILED ((NDIS_STATUS)0xC0010008L)
294 #define NDIS_STATUS_MULTICAST_FULL ((NDIS_STATUS)0xC0010009L)
295 #define NDIS_STATUS_MULTICAST_EXISTS ((NDIS_STATUS)0xC001000AL)
296 #define NDIS_STATUS_MULTICAST_NOT_FOUND ((NDIS_STATUS)0xC001000BL)
297 #define NDIS_STATUS_REQUEST_ABORTED ((NDIS_STATUS)0xC001000CL)
298 #define NDIS_STATUS_RESET_IN_PROGRESS ((NDIS_STATUS)0xC001000DL)
299 #define NDIS_STATUS_CLOSING_INDICATING ((NDIS_STATUS)0xC001000EL)
300 #define NDIS_STATUS_NOT_SUPPORTED ((NDIS_STATUS)STATUS_NOT_SUPPORTED)
301 #define NDIS_STATUS_INVALID_PACKET ((NDIS_STATUS)0xC001000FL)
302 #define NDIS_STATUS_OPEN_LIST_FULL ((NDIS_STATUS)0xC0010010L)
303 #define NDIS_STATUS_ADAPTER_NOT_READY ((NDIS_STATUS)0xC0010011L)
304 #define NDIS_STATUS_ADAPTER_NOT_OPEN ((NDIS_STATUS)0xC0010012L)
305 #define NDIS_STATUS_NOT_INDICATING ((NDIS_STATUS)0xC0010013L)
306 #define NDIS_STATUS_INVALID_LENGTH ((NDIS_STATUS)0xC0010014L)
307 #define NDIS_STATUS_INVALID_DATA ((NDIS_STATUS)0xC0010015L)
308 #define NDIS_STATUS_BUFFER_TOO_SHORT ((NDIS_STATUS)0xC0010016L)
309 #define NDIS_STATUS_INVALID_OID ((NDIS_STATUS)0xC0010017L)
310 #define NDIS_STATUS_ADAPTER_REMOVED ((NDIS_STATUS)0xC0010018L)
311 #define NDIS_STATUS_UNSUPPORTED_MEDIA ((NDIS_STATUS)0xC0010019L)
312 #define NDIS_STATUS_GROUP_ADDRESS_IN_USE ((NDIS_STATUS)0xC001001AL)
313 #define NDIS_STATUS_FILE_NOT_FOUND ((NDIS_STATUS)0xC001001BL)
314 #define NDIS_STATUS_ERROR_READING_FILE ((NDIS_STATUS)0xC001001CL)
315 #define NDIS_STATUS_ALREADY_MAPPED ((NDIS_STATUS)0xC001001DL)
316 #define NDIS_STATUS_RESOURCE_CONFLICT ((NDIS_STATUS)0xC001001EL)
317 #define NDIS_STATUS_NO_CABLE ((NDIS_STATUS)0xC001001FL)
318
319 #define NDIS_STATUS_INVALID_SAP ((NDIS_STATUS)0xC0010020L)
320 #define NDIS_STATUS_SAP_IN_USE ((NDIS_STATUS)0xC0010021L)
321 #define NDIS_STATUS_INVALID_ADDRESS ((NDIS_STATUS)0xC0010022L)
322 #define NDIS_STATUS_VC_NOT_ACTIVATED ((NDIS_STATUS)0xC0010023L)
323 #define NDIS_STATUS_DEST_OUT_OF_ORDER ((NDIS_STATUS)0xC0010024L)
324 #define NDIS_STATUS_VC_NOT_AVAILABLE ((NDIS_STATUS)0xC0010025L)
325 #define NDIS_STATUS_CELLRATE_NOT_AVAILABLE ((NDIS_STATUS)0xC0010026L)
326 #define NDIS_STATUS_INCOMPATABLE_QOS ((NDIS_STATUS)0xC0010027L)
327 #define NDIS_STATUS_AAL_PARAMS_UNSUPPORTED ((NDIS_STATUS)0xC0010028L)
328 #define NDIS_STATUS_NO_ROUTE_TO_DESTINATION ((NDIS_STATUS)0xC0010029L)
329
330 #define NDIS_STATUS_TOKEN_RING_OPEN_ERROR ((NDIS_STATUS)0xC0011000L)
331
332
333 /* NDIS error codes for error logging */
334
335 #define NDIS_ERROR_CODE ULONG
336
337 #define NDIS_ERROR_CODE_RESOURCE_CONFLICT EVENT_NDIS_RESOURCE_CONFLICT
338 #define NDIS_ERROR_CODE_OUT_OF_RESOURCES EVENT_NDIS_OUT_OF_RESOURCE
339 #define NDIS_ERROR_CODE_HARDWARE_FAILURE EVENT_NDIS_HARDWARE_FAILURE
340 #define NDIS_ERROR_CODE_ADAPTER_NOT_FOUND EVENT_NDIS_ADAPTER_NOT_FOUND
341 #define NDIS_ERROR_CODE_INTERRUPT_CONNECT EVENT_NDIS_INTERRUPT_CONNECT
342 #define NDIS_ERROR_CODE_DRIVER_FAILURE EVENT_NDIS_DRIVER_FAILURE
343 #define NDIS_ERROR_CODE_BAD_VERSION EVENT_NDIS_BAD_VERSION
344 #define NDIS_ERROR_CODE_TIMEOUT EVENT_NDIS_TIMEOUT
345 #define NDIS_ERROR_CODE_NETWORK_ADDRESS EVENT_NDIS_NETWORK_ADDRESS
346 #define NDIS_ERROR_CODE_UNSUPPORTED_CONFIGURATION EVENT_NDIS_UNSUPPORTED_CONFIGURATION
347 #define NDIS_ERROR_CODE_INVALID_VALUE_FROM_ADAPTER EVENT_NDIS_INVALID_VALUE_FROM_ADAPTER
348 #define NDIS_ERROR_CODE_MISSING_CONFIGURATION_PARAMETER EVENT_NDIS_MISSING_CONFIGURATION_PARAMETER
349 #define NDIS_ERROR_CODE_BAD_IO_BASE_ADDRESS EVENT_NDIS_BAD_IO_BASE_ADDRESS
350 #define NDIS_ERROR_CODE_RECEIVE_SPACE_SMALL EVENT_NDIS_RECEIVE_SPACE_SMALL
351 #define NDIS_ERROR_CODE_ADAPTER_DISABLED EVENT_NDIS_ADAPTER_DISABLED
352
353
354 /* Memory allocation flags. Used by Ndis(Allocate|Free)Memory */
355 #define NDIS_MEMORY_CONTIGUOUS 0x00000001
356 #define NDIS_MEMORY_NONCACHED 0x00000002
357
358 /* NIC attribute flags. Used by NdisMSetAttributes(Ex) */
359 #define NDIS_ATTRIBUTE_IGNORE_PACKET_TIMEOUT 0x00000001
360 #define NDIS_ATTRIBUTE_IGNORE_REQUEST_TIMEOUT 0x00000002
361 #define NDIS_ATTRIBUTE_IGNORE_TOKEN_RING_ERRORS 0x00000004
362 #define NDIS_ATTRIBUTE_BUS_MASTER 0x00000008
363 #define NDIS_ATTRIBUTE_INTERMEDIATE_DRIVER 0x00000010
364 #define NDIS_ATTRIBUTE_DESERIALIZE 0x00000020
365
366
367
368 #define MAXIMUM_PROCESSORS 32
369
370
371
372 /* Lock */
373
374 typedef union _NDIS_RW_LOCK_REFCOUNT
375 {
376 UINT RefCount;
377 UCHAR cacheLine[16];
378 } NDIS_RW_LOCK_REFCOUNT;
379
380 typedef struct _NDIS_RW_LOCK
381 {
382 union
383 {
384 struct
385 {
386 KSPIN_LOCK SpinLock;
387 PVOID Context;
388 } s;
389 UCHAR Reserved[16];
390 } u;
391
392 NDIS_RW_LOCK_REFCOUNT RefCount[MAXIMUM_PROCESSORS];
393 } NDIS_RW_LOCK, *PNDIS_RW_LOCK;
394
395 typedef struct _LOCK_STATE
396 {
397 USHORT LockState;
398 KIRQL OldIrql;
399 } LOCK_STATE, *PLOCK_STATE;
400
401
402
403 /* Timer */
404
405 typedef VOID (*PNDIS_TIMER_FUNCTION)(
406 IN PVOID SystemSpecific1,
407 IN PVOID FunctionContext,
408 IN PVOID SystemSpecific2,
409 IN PVOID SystemSpecific3);
410
411 typedef struct _NDIS_TIMER
412 {
413 KTIMER Timer;
414 KDPC Dpc;
415 } NDIS_TIMER, *PNDIS_TIMER;
416
417 VOID
418 EXPIMP
419 NdisInitializeTimer(
420 IN OUT PNDIS_TIMER Timer,
421 IN PNDIS_TIMER_FUNCTION TimerFunction,
422 IN PVOID FunctionContext);
423
424 VOID
425 EXPIMP
426 NdisSetTimer(
427 IN PNDIS_TIMER Timer,
428 IN UINT MillisecondsToDelay);
429
430 /* Hardware */
431
432 typedef CM_MCA_POS_DATA NDIS_MCA_POS_DATA, *PNDIS_MCA_POS_DATA;
433 typedef CM_EISA_SLOT_INFORMATION NDIS_EISA_SLOT_INFORMATION, *PNDIS_EISA_SLOT_INFORMATION;
434 typedef CM_EISA_FUNCTION_INFORMATION NDIS_EISA_FUNCTION_INFORMATION, *PNDIS_EISA_FUNCTION_INFORMATION;
435 typedef CM_PARTIAL_RESOURCE_LIST NDIS_RESOURCE_LIST, *PNDIS_RESOURCE_LIST;
436
437 /* Hardware status codes (OID_GEN_HARDWARE_STATUS) */
438 typedef enum _NDIS_HARDWARE_STATUS
439 {
440 NdisHardwareStatusReady,
441 NdisHardwareStatusInitializing,
442 NdisHardwareStatusReset,
443 NdisHardwareStatusClosing,
444 NdisHardwareStatusNotReady
445 } NDIS_HARDWARE_STATUS, *PNDIS_HARDWARE_STATUS;
446
447 /* OID_GEN_GET_TIME_CAPS */
448 typedef struct _GEN_GET_TIME_CAPS
449 {
450 ULONG Flags;
451 ULONG ClockPrecision;
452 } GEN_GET_TIME_CAPS, *PGEN_GET_TIME_CAPS;
453
454 /* Flag bits */
455 #define READABLE_LOCAL_CLOCK 0x00000001
456 #define CLOCK_NETWORK_DERIVED 0x00000002
457 #define CLOCK_PRECISION 0x00000004
458 #define RECEIVE_TIME_INDICATION_CAPABLE 0x00000008
459 #define TIMED_SEND_CAPABLE 0x00000010
460 #define TIME_STAMP_CAPABLE 0x00000020
461
462 /* OID_GEN_GET_NETCARD_TIME */
463 typedef struct _GEN_GET_NETCARD_TIME
464 {
465 ULONGLONG ReadTime;
466 } GEN_GET_NETCARD_TIME, *PGEN_GET_NETCARD_TIME;
467
468 /* NDIS driver medium (OID_GEN_MEDIA_SUPPORTED / OID_GEN_MEDIA_IN_USE) */
469 typedef enum _NDIS_MEDIUM
470 {
471 NdisMedium802_3,
472 NdisMedium802_5,
473 NdisMediumFddi,
474 NdisMediumWan,
475 NdisMediumLocalTalk,
476 NdisMediumDix, /* Defined for convenience, not a real medium */
477 NdisMediumArcnetRaw,
478 NdisMediumArcnet878_2,
479 NdisMediumAtm,
480 NdisMediumWirelessWan,
481 NdisMediumIrda,
482 NdisMediumBpc,
483 NdisMediumCoWan,
484 NdisMedium1394,
485 NdisMediumMax
486 } NDIS_MEDIUM, *PNDIS_MEDIUM;
487
488 /* NDIS packet filter bits (OID_GEN_CURRENT_PACKET_FILTER) */
489 #define NDIS_PACKET_TYPE_DIRECTED 0x00000001
490 #define NDIS_PACKET_TYPE_MULTICAST 0x00000002
491 #define NDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004
492 #define NDIS_PACKET_TYPE_BROADCAST 0x00000008
493 #define NDIS_PACKET_TYPE_SOURCE_ROUTING 0x00000010
494 #define NDIS_PACKET_TYPE_PROMISCUOUS 0x00000020
495 #define NDIS_PACKET_TYPE_SMT 0x00000040
496 #define NDIS_PACKET_TYPE_ALL_LOCAL 0x00000080
497 #define NDIS_PACKET_TYPE_GROUP 0x00001000
498 #define NDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x00002000
499 #define NDIS_PACKET_TYPE_FUNCTIONAL 0x00004000
500 #define NDIS_PACKET_TYPE_MAC_FRAME 0x00008000
501
502 /* NDIS protocol option bits (OID_GEN_PROTOCOL_OPTIONS) */
503 #define NDIS_PROT_OPTION_ESTIMATED_LENGTH 0x00000001
504 #define NDIS_PROT_OPTION_NO_LOOPBACK 0x00000002
505 #define NDIS_PROT_OPTION_NO_RSVD_ON_RCVPKT 0x00000004
506
507 /* NDIS MAC option bits (OID_GEN_MAC_OPTIONS) */
508 #define NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA 0x00000001
509 #define NDIS_MAC_OPTION_RECEIVE_SERIALIZED 0x00000002
510 #define NDIS_MAC_OPTION_TRANSFERS_NOT_PEND 0x00000004
511 #define NDIS_MAC_OPTION_NO_LOOPBACK 0x00000008
512 #define NDIS_MAC_OPTION_FULL_DUPLEX 0x00000010
513 #define NDIS_MAC_OPTION_EOTX_INDICATION 0x00000020
514 #define NDIS_MAC_OPTION_8021P_PRIORITY 0x00000040
515 #define NDIS_MAC_OPTION_RESERVED 0x80000000
516
517 /* State of the LAN media (OID_GEN_MEDIA_CONNECT_STATUS) */
518 typedef enum _NDIS_MEDIA_STATE
519 {
520 NdisMediaStateConnected,
521 NdisMediaStateDisconnected
522 } NDIS_MEDIA_STATE, *PNDIS_MEDIA_STATE;
523
524 /* OID_GEN_SUPPORTED_GUIDS */
525 typedef struct _NDIS_GUID
526 {
527 GUID Guid;
528 union
529 {
530 NDIS_OID Oid;
531 NDIS_STATUS Status;
532 } u;
533 ULONG Size;
534 ULONG Flags;
535 } NDIS_GUID, *PNDIS_GUID;
536
537 #define NDIS_GUID_TO_OID 0x00000001
538 #define NDIS_GUID_TO_STATUS 0x00000002
539 #define NDIS_GUID_ANSI_STRING 0x00000004
540 #define NDIS_GUID_UNICODE_STRING 0x00000008
541 #define NDIS_GUID_ARRAY 0x00000010
542
543
544
545 typedef struct _NDIS_PACKET_POOL
546 {
547 NDIS_SPIN_LOCK SpinLock;
548 struct _NDIS_PACKET *FreeList;
549 UINT PacketLength;
550 UCHAR Buffer[1];
551 } NDIS_PACKET_POOL, * PNDIS_PACKET_POOL;
552
553 typedef struct _NDIS_PACKET_PRIVATE
554 {
555 UINT PhysicalCount;
556 UINT TotalLength;
557 PNDIS_BUFFER Head;
558 PNDIS_BUFFER Tail;
559 PNDIS_PACKET_POOL Pool;
560 UINT Count;
561 ULONG Flags; /* See fPACKET_xxx bits below */
562 BOOLEAN ValidCounts;
563 UCHAR NdisPacketFlags;
564 USHORT NdisPacketOobOffset;
565 } NDIS_PACKET_PRIVATE, * PNDIS_PACKET_PRIVATE;
566
567 #define fPACKET_CONTAINS_MEDIA_SPECIFIC_INFO 0x40
568 #define fPACKET_ALLOCATED_BY_NDIS 0x80
569
570 typedef struct _NDIS_PACKET {
571 NDIS_PACKET_PRIVATE Private;
572 union {
573 struct {
574 UCHAR MiniportReserved[2*sizeof(PVOID)];
575 UCHAR WrapperReserved[2*sizeof(PVOID)];
576 } s1;
577 struct {
578 UCHAR MiniportReservedEx[3*sizeof(PVOID)];
579 UCHAR WrapperReservedEx[sizeof(PVOID)];
580 } s2;
581 struct {
582 UCHAR MacReserved[4*sizeof(PVOID)];
583 } s3;
584 } u;
585 ULONG_PTR Reserved[2];
586 UCHAR ProtocolReserved[1];
587 } NDIS_PACKET, *PNDIS_PACKET, **PPNDIS_PACKET;
588
589 typedef struct _NDIS_PACKET_OOB_DATA {
590 union {
591 ULONGLONG TimeToSend;
592 ULONGLONG TimeSent;
593 } u;
594 ULONGLONG TimeReceived;
595 UINT HeaderSize;
596 UINT SizeMediaSpecificInfo;
597 PVOID MediaSpecificInformation;
598 NDIS_STATUS Status;
599 } NDIS_PACKET_OOB_DATA, *PNDIS_PACKET_OOB_DATA;
600
601 typedef struct _NDIS_PM_PACKET_PATTERN
602 {
603 ULONG Priority;
604 ULONG Reserved;
605 ULONG MaskSize;
606 ULONG PatternOffset;
607 ULONG PatternSize;
608 ULONG PatternFlags;
609 } NDIS_PM_PACKET_PATTERN, *PNDIS_PM_PACKET_PATTERN;
610
611
612 /* Request types used by NdisRequest */
613 typedef enum _NDIS_REQUEST_TYPE
614 {
615 NdisRequestQueryInformation,
616 NdisRequestSetInformation,
617 NdisRequestQueryStatistics,
618 NdisRequestOpen,
619 NdisRequestClose,
620 NdisRequestSend,
621 NdisRequestTransferData,
622 NdisRequestReset,
623 NdisRequestGeneric1,
624 NdisRequestGeneric2,
625 NdisRequestGeneric3,
626 NdisRequestGeneric4
627 } NDIS_REQUEST_TYPE, *PNDIS_REQUEST_TYPE;
628
629 typedef struct _NDIS_REQUEST {
630 UCHAR MacReserved[16];
631 NDIS_REQUEST_TYPE RequestType;
632 union _DATA {
633 struct QUERY_INFORMATION {
634 NDIS_OID Oid;
635 PVOID InformationBuffer;
636 UINT InformationBufferLength;
637 UINT BytesWritten;
638 UINT BytesNeeded;
639 } QUERY_INFORMATION;
640 struct SET_INFORMATION {
641 NDIS_OID Oid;
642 PVOID InformationBuffer;
643 UINT InformationBufferLength;
644 UINT BytesRead;
645 UINT BytesNeeded;
646 } SET_INFORMATION;
647 } DATA;
648 #ifdef NDIS50
649 UCHAR NdisReserved[36];
650 union {
651 UCHAR CallMgrReserved[8];
652 UCHAR ProtocolReserved[8];
653 };
654 UCHAR MiniportReserved[8];
655 #endif
656 } NDIS_REQUEST, *PNDIS_REQUEST;
657
658
659
660 /* Wide Area Networks definitions */
661
662 typedef struct _NDIS_WAN_PACKET
663 {
664 LIST_ENTRY WanPacketQueue;
665 PUCHAR CurrentBuffer;
666 ULONG CurrentLength;
667 PUCHAR StartBuffer;
668 PUCHAR EndBuffer;
669 PVOID ProtocolReserved1;
670 PVOID ProtocolReserved2;
671 PVOID ProtocolReserved3;
672 PVOID ProtocolReserved4;
673 PVOID MacReserved1;
674 PVOID MacReserved2;
675 PVOID MacReserved3;
676 PVOID MacReserved4;
677 } NDIS_WAN_PACKET, *PNDIS_WAN_PACKET;
678
679
680
681 /* DMA channel information */
682
683 typedef struct _NDIS_DMA_DESCRIPTION
684 {
685 BOOLEAN DemandMode;
686 BOOLEAN AutoInitialize;
687 BOOLEAN DmaChannelSpecified;
688 DMA_WIDTH DmaWidth;
689 DMA_SPEED DmaSpeed;
690 ULONG DmaPort;
691 ULONG DmaChannel;
692 } NDIS_DMA_DESCRIPTION, *PNDIS_DMA_DESCRIPTION;
693
694 typedef struct _NDIS_DMA_BLOCK
695 {
696 PVOID MapRegisterBase;
697 KEVENT AllocationEvent;
698 PADAPTER_OBJECT SystemAdapterObject;
699 BOOLEAN InProgress;
700 } NDIS_DMA_BLOCK, *PNDIS_DMA_BLOCK;
701
702 #define NDIS_DMA_24BITS 0
703 #define NDIS_DMA_32BITS 1
704 #define NDIS_DMA_64BITS 2
705
706 /* Possible hardware architecture */
707 typedef enum _NDIS_INTERFACE_TYPE
708 {
709 NdisInterfaceInternal = Internal,
710 NdisInterfaceIsa = Isa,
711 NdisInterfaceEisa = Eisa,
712 NdisInterfaceMca = MicroChannel,
713 NdisInterfaceTurboChannel = TurboChannel,
714 NdisInterfacePci = PCIBus,
715 NdisInterfacePcMcia = PCMCIABus
716 } NDIS_INTERFACE_TYPE, *PNDIS_INTERFACE_TYPE;
717
718 #define NdisInterruptLevelSensitive LevelSensitive
719 #define NdisInterruptLatched Latched
720 typedef KINTERRUPT_MODE NDIS_INTERRUPT_MODE, *PNDIS_INTERRUPT_MODE;
721
722 typedef enum _NDIS_PROCESSOR_TYPE
723 {
724 NdisProcessorX86,
725 NdisProcessorMips,
726 NdisProcessorAlpha,
727 NdisProcessorPpc
728 } NDIS_PROCESSOR_TYPE, *PNDIS_PROCESSOR_TYPE;
729
730 typedef enum _NDIS_ENVIRONMENT_TYPE
731 {
732 NdisEnvironmentWindows,
733 NdisEnvironmentWindowsNt
734 } NDIS_ENVIRONMENT_TYPE, *PNDIS_ENVIRONMENT_TYPE;
735
736 typedef enum _NDIS_PARAMETER_TYPE
737 {
738 NdisParameterInteger,
739 NdisParameterHexInteger,
740 NdisParameterString,
741 NdisParameterMultiString,
742 NdisParameterBinary
743 } NDIS_PARAMETER_TYPE, *PNDIS_PARAMETER_TYPE;
744
745 typedef struct
746 {
747 USHORT Length;
748 PVOID Buffer;
749 } BINARY_DATA;
750
751 typedef struct _NDIS_CONFIGURATION_PARAMETER
752 {
753 NDIS_PARAMETER_TYPE ParameterType;
754 union
755 {
756 ULONG IntegerData;
757 NDIS_STRING StringData;
758 BINARY_DATA BinaryData;
759 } ParameterData;
760 } NDIS_CONFIGURATION_PARAMETER, *PNDIS_CONFIGURATION_PARAMETER;
761
762 typedef PHYSICAL_ADDRESS NDIS_PHYSICAL_ADDRESS, *PNDIS_PHYSICAL_ADDRESS;
763
764 typedef struct _NDIS_PHYSICAL_ADDRESS_UNIT
765 {
766 NDIS_PHYSICAL_ADDRESS PhysicalAddress;
767 UINT Length;
768 } NDIS_PHYSICAL_ADDRESS_UNIT, *PNDIS_PHYSICAL_ADDRESS_UNIT;
769
770
771 typedef VOID (*ADAPTER_SHUTDOWN_HANDLER)(
772 IN PVOID ShutdownContext);
773
774
775
776 #ifdef NDIS_WRAPPER
777
778 typedef struct _OID_LIST OID_LIST, *POID_LIST;
779
780 /* PnP state */
781
782 typedef enum _NDIS_PNP_DEVICE_STATE
783 {
784 NdisPnPDeviceAdded,
785 NdisPnPDeviceStarted,
786 NdisPnPDeviceQueryStopped,
787 NdisPnPDeviceStopped,
788 NdisPnPDeviceQueryRemoved,
789 NdisPnPDeviceRemoved,
790 NdisPnPDeviceSurpriseRemoved
791 } NDIS_PNP_DEVICE_STATE;
792
793 #define NDIS_DEVICE_NOT_STOPPABLE 0x00000001
794 #define NDIS_DEVICE_NOT_REMOVEABLE 0x00000002
795 #define NDIS_DEVICE_NOT_SUSPENDABLE 0x00000004
796 #define NDIS_DEVICE_DISABLE_PM 0x00000008
797 #define NDIS_DEVICE_DISABLE_WAKE_UP 0x00000010
798 #define NDIS_DEVICE_DISABLE_WAKE_ON_RECONNECT 0x00000020
799
800 #endif /* NDIS_WRAPPER */
801
802
803 typedef struct _ATM_ADDRESS ATM_ADDRESS, *PATM_ADDRESS;
804
805
806 /* OID_GEN_NETWORK_LAYER_ADDRESSES */
807 typedef struct _NETWORK_ADDRESS
808 {
809 USHORT AddressLength;
810 USHORT AddressType;
811 UCHAR Address[1];
812 } NETWORK_ADDRESS, *PNETWORK_ADDRESS;
813
814 typedef struct _NETWORK_ADDRESS_LIST
815 {
816 LONG AddressCount;
817 USHORT AddressType;
818 NETWORK_ADDRESS Address[1];
819 } NETWORK_ADDRESS_LIST, *PNETWORK_ADDRESS_LIST;
820
821 /* Protocol types supported by NDIS */
822 #define NDIS_PROTOCOL_ID_DEFAULT 0x00
823 #define NDIS_PROTOCOL_ID_TCP_IP 0x02
824 #define NDIS_PROTOCOL_ID_IPX 0x06
825 #define NDIS_PROTOCOL_ID_NBF 0x07
826 #define NDIS_PROTOCOL_ID_MAX 0x0F
827 #define NDIS_PROTOCOL_ID_MASK 0x0F
828
829 /* OID_GEN_TRANSPORT_HEADER_OFFSET */
830 typedef struct _TRANSPORT_HEADER_OFFSET
831 {
832 USHORT ProtocolType;
833 USHORT HeaderOffset;
834 } TRANSPORT_HEADER_OFFSET, *PTRANSPORT_HEADER_OFFSET;
835
836
837 /* OID_GEN_CO_LINK_SPEED / OID_GEN_CO_MINIMUM_LINK_SPEED */
838 typedef struct _NDIS_CO_LINK_SPEED
839 {
840 ULONG Outbound;
841 ULONG Inbound;
842 } NDIS_CO_LINK_SPEED, *PNDIS_CO_LINK_SPEED;
843
844
845 typedef enum _NDIS_AF
846 {
847 CO_ADDRESS_FAMILY_Q2931 = 1,
848 CO_ADDRESS_FAMILY_SPANS,
849 } NDIS_AF, *PNDIS_AF;
850
851 typedef struct
852 {
853 NDIS_AF AddressFamily;
854 ULONG MajorVersion;
855 ULONG MinorVersion;
856 } CO_ADDRESS_FAMILY, *PCO_ADDRESS_FAMILY;
857
858 typedef enum
859 {
860 BestEffortService,
861 PredictiveService,
862 GuaranteedService
863 } GUARANTEE;
864
865 typedef struct _CO_FLOW_PARAMETERS
866 {
867 ULONG TokenRate; /* In Bytes/sec */
868 ULONG TokenBucketSize; /* In Bytes */
869 ULONG PeakBandwidth; /* In Bytes/sec */
870 ULONG Latency; /* In microseconds */
871 ULONG DelayVariation; /* In microseconds */
872 GUARANTEE LevelOfGuarantee; /* Guaranteed, Predictive or Best Effort */
873 ULONG CostOfCall; /* Reserved for future use, */
874 /* must be set to 0 now */
875 ULONG NetworkAvailability; /* read-only: 1 if accessible, 0 if not */
876 ULONG MaxSduSize; /* In Bytes */
877 } CO_FLOW_PARAMETERS, *PCO_FLOW_PARAMETERS;
878
879 typedef struct _CO_SPECIFIC_PARAMETERS
880 {
881 ULONG ParamType;
882 ULONG Length;
883 UCHAR Parameters[1];
884 } CO_SPECIFIC_PARAMETERS, *PCO_SPECIFIC_PARAMETERS;
885
886 typedef struct _CO_CALL_MANAGER_PARAMETERS {
887 CO_FLOW_PARAMETERS Transmit;
888 CO_FLOW_PARAMETERS Receive;
889 CO_SPECIFIC_PARAMETERS CallMgrSpecific;
890 } CO_CALL_MANAGER_PARAMETERS, *PCO_CALL_MANAGER_PARAMETERS;
891
892 typedef struct _CO_MEDIA_PARAMETERS
893 {
894 ULONG Flags;
895 ULONG ReceivePriority;
896 ULONG ReceiveSizeHint;
897 CO_SPECIFIC_PARAMETERS MediaSpecific;
898 } CO_MEDIA_PARAMETERS, *PCO_MEDIA_PARAMETERS;
899
900 /* Definitions for the flags in CO_MEDIA_PARAMETERS */
901 #define RECEIVE_TIME_INDICATION 0x00000001
902 #define USE_TIME_STAMPS 0x00000002
903 #define TRANSMIT_VC 0x00000004
904 #define RECEIVE_VC 0x00000008
905 #define INDICATE_ERRED_PACKETS 0x00000010
906 #define INDICATE_END_OF_TX 0x00000020
907 #define RESERVE_RESOURCES_VC 0x00000040
908 #define ROUND_DOWN_FLOW 0x00000080
909 #define ROUND_UP_FLOW 0x00000100
910
911 typedef struct _CO_CALL_PARAMETERS
912 {
913 ULONG Flags;
914 PCO_CALL_MANAGER_PARAMETERS CallMgrParameters;
915 PCO_MEDIA_PARAMETERS MediaParameters;
916 } CO_CALL_PARAMETERS, *PCO_CALL_PARAMETERS;
917
918 typedef struct _CO_SAP {
919 ULONG SapType;
920 ULONG SapLength;
921 UCHAR Sap[1];
922 } CO_SAP, *PCO_SAP;
923
924 typedef struct _NDIS_IPSEC_PACKET_INFO
925 {
926 union
927 {
928 struct
929 {
930 NDIS_HANDLE OffloadHandle;
931 NDIS_HANDLE NextOffloadHandle;
932 } Transmit;
933
934 struct
935 {
936 ULONG SA_DELETE_REQ:1;
937 ULONG CRYPTO_DONE:1;
938 ULONG NEXT_CRYPTO_DONE:1;
939 ULONG CryptoStatus;
940 } Receive;
941 } u;
942 } NDIS_IPSEC_PACKET_INFO, *PNDIS_IPSEC_PACKET_INFO;
943
944
945 /* Plug and play and power management */
946
947 /* PnP and PM event codes */
948 typedef enum _NET_PNP_EVENT_CODE
949 {
950 NetEventSetPower,
951 NetEventQueryPower,
952 NetEventQueryRemoveDevice,
953 NetEventCancelRemoveDevice,
954 NetEventReconfigure,
955 NetEventBindList,
956 NetEventBindsComplete,
957 NetEventPnPCapabilities,
958 NetEventMaximum
959 } NET_PNP_EVENT_CODE, *PNET_PNP_EVENT_CODE;
960
961 /* Networking PnP event indication structure */
962 typedef struct _NET_PNP_EVENT
963 {
964 /* Event code */
965 NET_PNP_EVENT_CODE NetEvent;
966 /* Event specific data */
967 PVOID Buffer;
968 /* Length of event specific data */
969 ULONG BufferLength;
970
971 /* Reserved areas */
972 ULONG_PTR NdisReserved[4];
973 ULONG_PTR TransportReserved[4];
974 ULONG_PTR TdiReserved[4];
975 ULONG_PTR TdiClientReserved[4];
976 } NET_PNP_EVENT, *PNET_PNP_EVENT;
977
978 /* Device power state structure */
979 typedef enum _NET_DEVICE_POWER_STATE
980 {
981 NetDeviceStateUnspecified = 0,
982 NetDeviceStateD0,
983 NetDeviceStateD1,
984 NetDeviceStateD2,
985 NetDeviceStateD3,
986 NetDeviceStateMaximum
987 } NET_DEVICE_POWER_STATE, *PNET_DEVICE_POWER_STATE;
988
989
990
991 /* Call Manager */
992
993 typedef NDIS_STATUS (*CO_CREATE_VC_HANDLER)(
994 IN NDIS_HANDLE ProtocolAfContext,
995 IN NDIS_HANDLE NdisVcHandle,
996 OUT PNDIS_HANDLE ProtocolVcContext);
997
998 typedef NDIS_STATUS (*CO_DELETE_VC_HANDLER)(
999 IN NDIS_HANDLE ProtocolVcContext);
1000
1001 typedef NDIS_STATUS (*CO_REQUEST_HANDLER)(
1002 IN NDIS_HANDLE ProtocolAfContext,
1003 IN NDIS_HANDLE ProtocolVcContext OPTIONAL,
1004 IN NDIS_HANDLE ProtocolPartyContext OPTIONAL,
1005 IN OUT PNDIS_REQUEST NdisRequest);
1006
1007 typedef VOID (*CO_REQUEST_COMPLETE_HANDLER)(
1008 IN NDIS_STATUS Status,
1009 IN NDIS_HANDLE ProtocolAfContext OPTIONAL,
1010 IN NDIS_HANDLE ProtocolVcContext OPTIONAL,
1011 IN NDIS_HANDLE ProtocolPartyContext OPTIONAL,
1012 IN PNDIS_REQUEST NdisRequest);
1013
1014
1015 typedef NDIS_STATUS (*CM_OPEN_AF_HANDLER)(
1016 IN NDIS_HANDLE CallMgrBindingContext,
1017 IN PCO_ADDRESS_FAMILY AddressFamily,
1018 IN NDIS_HANDLE NdisAfHandle,
1019 OUT PNDIS_HANDLE CallMgrAfContext
1020 );
1021
1022 typedef
1023 NDIS_STATUS
1024 (*CM_CLOSE_AF_HANDLER)(
1025 IN NDIS_HANDLE CallMgrAfContext
1026 );
1027
1028 typedef
1029 NDIS_STATUS
1030 (*CM_REG_SAP_HANDLER)(
1031 IN NDIS_HANDLE CallMgrAfContext,
1032 IN PCO_SAP Sap,
1033 IN NDIS_HANDLE NdisSapHandle,
1034 OUT PNDIS_HANDLE CallMgrSapContext
1035 );
1036
1037 typedef
1038 NDIS_STATUS
1039 (*CM_DEREG_SAP_HANDLER)(
1040 IN NDIS_HANDLE CallMgrSapContext
1041 );
1042
1043 typedef
1044 NDIS_STATUS
1045 (*CM_MAKE_CALL_HANDLER)(
1046 IN NDIS_HANDLE CallMgrVcContext,
1047 IN OUT PCO_CALL_PARAMETERS CallParameters,
1048 IN NDIS_HANDLE NdisPartyHandle OPTIONAL,
1049 OUT PNDIS_HANDLE CallMgrPartyContext OPTIONAL
1050 );
1051
1052 typedef
1053 NDIS_STATUS
1054 (*CM_CLOSE_CALL_HANDLER)(
1055 IN NDIS_HANDLE CallMgrVcContext,
1056 IN NDIS_HANDLE CallMgrPartyContext OPTIONAL,
1057 IN PVOID CloseData OPTIONAL,
1058 IN UINT Size OPTIONAL
1059 );
1060
1061 typedef
1062 VOID
1063 (*CM_INCOMING_CALL_COMPLETE_HANDLER)(
1064 IN NDIS_STATUS Status,
1065 IN NDIS_HANDLE CallMgrVcContext,
1066 IN PCO_CALL_PARAMETERS CallParameters
1067 );
1068
1069 typedef
1070 NDIS_STATUS
1071 (*CM_ADD_PARTY_HANDLER)(
1072 IN NDIS_HANDLE CallMgrVcContext,
1073 IN OUT PCO_CALL_PARAMETERS CallParameters,
1074 IN NDIS_HANDLE NdisPartyHandle,
1075 OUT PNDIS_HANDLE CallMgrPartyContext
1076 );
1077
1078 typedef
1079 NDIS_STATUS
1080 (*CM_DROP_PARTY_HANDLER)(
1081 IN NDIS_HANDLE CallMgrPartyContext,
1082 IN PVOID CloseData OPTIONAL,
1083 IN UINT Size OPTIONAL
1084 );
1085
1086 typedef
1087 VOID
1088 (*CM_ACTIVATE_VC_COMPLETE_HANDLER)(
1089 IN NDIS_STATUS Status,
1090 IN NDIS_HANDLE CallMgrVcContext,
1091 IN PCO_CALL_PARAMETERS CallParameters
1092 );
1093
1094 typedef
1095 VOID
1096 (*CM_DEACTIVATE_VC_COMPLETE_HANDLER)(
1097 IN NDIS_STATUS Status,
1098 IN NDIS_HANDLE CallMgrVcContext
1099 );
1100
1101 typedef
1102 NDIS_STATUS
1103 (*CM_MODIFY_CALL_QOS_HANDLER)(
1104 IN NDIS_HANDLE CallMgrVcContext,
1105 IN PCO_CALL_PARAMETERS CallParameters
1106 );
1107
1108 typedef struct _NDIS_CALL_MANAGER_CHARACTERISTICS
1109 {
1110 UCHAR MajorVersion;
1111 UCHAR MinorVersion;
1112
1113 USHORT Filler;
1114 UINT Reserved;
1115
1116 CO_CREATE_VC_HANDLER CmCreateVcHandler;
1117 CO_DELETE_VC_HANDLER CmDeleteVcHandler;
1118 CM_OPEN_AF_HANDLER CmOpenAfHandler;
1119 CM_CLOSE_AF_HANDLER CmCloseAfHandler;
1120 CM_REG_SAP_HANDLER CmRegisterSapHandler;
1121 CM_DEREG_SAP_HANDLER CmDeregisterSapHandler;
1122 CM_MAKE_CALL_HANDLER CmMakeCallHandler;
1123 CM_CLOSE_CALL_HANDLER CmCloseCallHandler;
1124 CM_INCOMING_CALL_COMPLETE_HANDLER CmIncomingCallCompleteHandler;
1125 CM_ADD_PARTY_HANDLER CmAddPartyHandler;
1126 CM_DROP_PARTY_HANDLER CmDropPartyHandler;
1127 CM_ACTIVATE_VC_COMPLETE_HANDLER CmActivateVcCompleteHandler;
1128 CM_DEACTIVATE_VC_COMPLETE_HANDLER CmDeactivateVcCompleteHandler;
1129 CM_MODIFY_CALL_QOS_HANDLER CmModifyCallQoSHandler;
1130 CO_REQUEST_HANDLER CmRequestHandler;
1131 CO_REQUEST_COMPLETE_HANDLER CmRequestCompleteHandler;
1132 } NDIS_CALL_MANAGER_CHARACTERISTICS, *PNDIS_CALL_MANAGER_CHARACTERISTICS;
1133
1134
1135
1136 /* Call Manager clients */
1137
1138 typedef VOID (*CL_OPEN_AF_COMPLETE_HANDLER)(
1139 IN NDIS_STATUS Status,
1140 IN NDIS_HANDLE ProtocolAfContext,
1141 IN NDIS_HANDLE NdisAfHandle);
1142
1143 typedef VOID (*CL_CLOSE_AF_COMPLETE_HANDLER)(
1144 IN NDIS_STATUS Status,
1145 IN NDIS_HANDLE ProtocolAfContext);
1146
1147 typedef VOID (*CL_REG_SAP_COMPLETE_HANDLER)(
1148 IN NDIS_STATUS Status,
1149 IN NDIS_HANDLE ProtocolSapContext,
1150 IN PCO_SAP Sap,
1151 IN NDIS_HANDLE NdisSapHandle);
1152
1153 typedef VOID (*CL_DEREG_SAP_COMPLETE_HANDLER)(
1154 IN NDIS_STATUS Status,
1155 IN NDIS_HANDLE ProtocolSapContext);
1156
1157 typedef VOID (*CL_MAKE_CALL_COMPLETE_HANDLER)(
1158 IN NDIS_STATUS Status,
1159 IN NDIS_HANDLE ProtocolVcContext,
1160 IN NDIS_HANDLE NdisPartyHandle OPTIONAL,
1161 IN PCO_CALL_PARAMETERS CallParameters);
1162
1163 typedef VOID (*CL_MODIFY_CALL_QOS_COMPLETE_HANDLER)(
1164 IN NDIS_STATUS Status,
1165 IN NDIS_HANDLE ProtocolVcContext,
1166 IN PCO_CALL_PARAMETERS CallParameters);
1167
1168 typedef VOID (*CL_CLOSE_CALL_COMPLETE_HANDLER)(
1169 IN NDIS_STATUS Status,
1170 IN NDIS_HANDLE ProtocolVcContext,
1171 IN NDIS_HANDLE ProtocolPartyContext OPTIONAL);
1172
1173 typedef VOID (*CL_ADD_PARTY_COMPLETE_HANDLER)(
1174 IN NDIS_STATUS Status,
1175 IN NDIS_HANDLE ProtocolPartyContext,
1176 IN NDIS_HANDLE NdisPartyHandle,
1177 IN PCO_CALL_PARAMETERS CallParameters);
1178
1179 typedef VOID (*CL_DROP_PARTY_COMPLETE_HANDLER)(
1180 IN NDIS_STATUS Status,
1181 IN NDIS_HANDLE ProtocolPartyContext);
1182
1183 typedef NDIS_STATUS (*CL_INCOMING_CALL_HANDLER)(
1184 IN NDIS_HANDLE ProtocolSapContext,
1185 IN NDIS_HANDLE ProtocolVcContext,
1186 IN OUT PCO_CALL_PARAMETERS CallParameters);
1187
1188 typedef VOID (*CL_INCOMING_CALL_QOS_CHANGE_HANDLER)(
1189 IN NDIS_HANDLE ProtocolVcContext,
1190 IN PCO_CALL_PARAMETERS CallParameters);
1191
1192 typedef VOID (*CL_INCOMING_CLOSE_CALL_HANDLER)(
1193 IN NDIS_STATUS CloseStatus,
1194 IN NDIS_HANDLE ProtocolVcContext,
1195 IN PVOID CloseData OPTIONAL,
1196 IN UINT Size OPTIONAL);
1197
1198 typedef VOID (*CL_INCOMING_DROP_PARTY_HANDLER)(
1199 IN NDIS_STATUS DropStatus,
1200 IN NDIS_HANDLE ProtocolPartyContext,
1201 IN PVOID CloseData OPTIONAL,
1202 IN UINT Size OPTIONAL);
1203
1204 typedef VOID (*CL_CALL_CONNECTED_HANDLER)(
1205 IN NDIS_HANDLE ProtocolVcContext);
1206
1207
1208 typedef struct _NDIS_CLIENT_CHARACTERISTICS
1209 {
1210 UCHAR MajorVersion;
1211 UCHAR MinorVersion;
1212
1213 USHORT Filler;
1214 UINT Reserved;
1215
1216 CO_CREATE_VC_HANDLER ClCreateVcHandler;
1217 CO_DELETE_VC_HANDLER ClDeleteVcHandler;
1218 CO_REQUEST_HANDLER ClRequestHandler;
1219 CO_REQUEST_COMPLETE_HANDLER ClRequestCompleteHandler;
1220 CL_OPEN_AF_COMPLETE_HANDLER ClOpenAfCompleteHandler;
1221 CL_CLOSE_AF_COMPLETE_HANDLER ClCloseAfCompleteHandler;
1222 CL_REG_SAP_COMPLETE_HANDLER ClRegisterSapCompleteHandler;
1223 CL_DEREG_SAP_COMPLETE_HANDLER ClDeregisterSapCompleteHandler;
1224 CL_MAKE_CALL_COMPLETE_HANDLER ClMakeCallCompleteHandler;
1225 CL_MODIFY_CALL_QOS_COMPLETE_HANDLER ClModifyCallQoSCompleteHandler;
1226 CL_CLOSE_CALL_COMPLETE_HANDLER ClCloseCallCompleteHandler;
1227 CL_ADD_PARTY_COMPLETE_HANDLER ClAddPartyCompleteHandler;
1228 CL_DROP_PARTY_COMPLETE_HANDLER ClDropPartyCompleteHandler;
1229 CL_INCOMING_CALL_HANDLER ClIncomingCallHandler;
1230 CL_INCOMING_CALL_QOS_CHANGE_HANDLER ClIncomingCallQoSChangeHandler;
1231 CL_INCOMING_CLOSE_CALL_HANDLER ClIncomingCloseCallHandler;
1232 CL_INCOMING_DROP_PARTY_HANDLER ClIncomingDropPartyHandler;
1233 CL_CALL_CONNECTED_HANDLER ClCallConnectedHandler;
1234 } NDIS_CLIENT_CHARACTERISTICS, *PNDIS_CLIENT_CHARACTERISTICS;
1235
1236
1237
1238 /* NDIS protocol structures */
1239
1240 /* Prototypes for NDIS 3.0 protocol characteristics */
1241
1242 typedef VOID (*OPEN_ADAPTER_COMPLETE_HANDLER)(
1243 IN NDIS_HANDLE ProtocolBindingContext,
1244 IN NDIS_STATUS Status,
1245 IN NDIS_STATUS OpenErrorStatus);
1246
1247 typedef VOID (*CLOSE_ADAPTER_COMPLETE_HANDLER)(
1248 IN NDIS_HANDLE ProtocolBindingContext,
1249 IN NDIS_STATUS Status);
1250
1251 typedef VOID (*RESET_COMPLETE_HANDLER)(
1252 IN NDIS_HANDLE ProtocolBindingContext,
1253 IN NDIS_STATUS Status);
1254
1255 typedef VOID (*REQUEST_COMPLETE_HANDLER)(
1256 IN NDIS_HANDLE ProtocolBindingContext,
1257 IN PNDIS_REQUEST NdisRequest,
1258 IN NDIS_STATUS Status);
1259
1260 typedef VOID (*STATUS_HANDLER)(
1261 IN NDIS_HANDLE ProtocolBindingContext,
1262 IN NDIS_STATUS GeneralStatus,
1263 IN PVOID StatusBuffer,
1264 IN UINT StatusBufferSize);
1265
1266 typedef VOID (*STATUS_COMPLETE_HANDLER)(
1267 IN NDIS_HANDLE ProtocolBindingContext);
1268
1269 typedef VOID (*SEND_COMPLETE_HANDLER)(
1270 IN NDIS_HANDLE ProtocolBindingContext,
1271 IN PNDIS_PACKET Packet,
1272 IN NDIS_STATUS Status);
1273
1274 typedef VOID (*WAN_SEND_COMPLETE_HANDLER)(
1275 IN NDIS_HANDLE ProtocolBindingContext,
1276 IN PNDIS_WAN_PACKET Packet,
1277 IN NDIS_STATUS Status);
1278
1279 typedef VOID (*TRANSFER_DATA_COMPLETE_HANDLER)(
1280 IN NDIS_HANDLE ProtocolBindingContext,
1281 IN PNDIS_PACKET Packet,
1282 IN NDIS_STATUS Status,
1283 IN UINT BytesTransferred);
1284
1285 typedef VOID (*WAN_TRANSFER_DATA_COMPLETE_HANDLER)(
1286 VOID);
1287
1288 typedef NDIS_STATUS (*RECEIVE_HANDLER)(
1289 IN NDIS_HANDLE ProtocolBindingContext,
1290 IN NDIS_HANDLE MacReceiveContext,
1291 IN PVOID HeaderBuffer,
1292 IN UINT HeaderBufferSize,
1293 IN PVOID LookAheadBuffer,
1294 IN UINT LookaheadBufferSize,
1295 IN UINT PacketSize);
1296
1297 typedef NDIS_STATUS (*WAN_RECEIVE_HANDLER)(
1298 IN NDIS_HANDLE NdisLinkHandle,
1299 IN PUCHAR Packet,
1300 IN ULONG PacketSize);
1301
1302 typedef VOID (*RECEIVE_COMPLETE_HANDLER)(
1303 IN NDIS_HANDLE ProtocolBindingContext);
1304
1305
1306 /* Protocol characteristics for NDIS 3.0 protocols */
1307 #ifdef _MSC_VER
1308 typedef struct _NDIS30_PROTOCOL_CHARACTERISTICS
1309 {
1310 UCHAR MajorNdisVersion;
1311 UCHAR MinorNdisVersion;
1312 union
1313 {
1314 UINT Reserved;
1315 UINT Flags;
1316 } u1;
1317 OPEN_ADAPTER_COMPLETE_HANDLER OpenAdapterCompleteHandler;
1318 CLOSE_ADAPTER_COMPLETE_HANDLER CloseAdapterCompleteHandler;
1319 union
1320 {
1321 SEND_COMPLETE_HANDLER SendCompleteHandler;
1322 WAN_SEND_COMPLETE_HANDLER WanSendCompleteHandler;
1323 } u2;
1324 union
1325 {
1326 TRANSFER_DATA_COMPLETE_HANDLER TransferDataCompleteHandler;
1327 WAN_TRANSFER_DATA_COMPLETE_HANDLER WanTransferDataCompleteHandler;
1328 } u3;
1329
1330 RESET_COMPLETE_HANDLER ResetCompleteHandler;
1331 REQUEST_COMPLETE_HANDLER RequestCompleteHandler;
1332 union
1333 {
1334 RECEIVE_HANDLER ReceiveHandler;
1335 WAN_RECEIVE_HANDLER WanReceiveHandler;
1336 } u4;
1337 RECEIVE_COMPLETE_HANDLER ReceiveCompleteHandler;
1338 STATUS_HANDLER StatusHandler;
1339 STATUS_COMPLETE_HANDLER StatusCompleteHandler;
1340 NDIS_STRING Name;
1341 } NDIS30_PROTOCOL_CHARACTERISTICS;
1342 typedef NDIS30_PROTOCOL_CHARACTERISTICS NDIS30_PROTOCOL_CHARACTERISTICS_S;
1343 #else
1344 #define NDIS30_PROTOCOL_CHARACTERISTICS \
1345 UCHAR MajorNdisVersion; \
1346 UCHAR MinorNdisVersion; \
1347 union \
1348 { \
1349 UINT Reserved; \
1350 UINT Flags; \
1351 } u1; \
1352 OPEN_ADAPTER_COMPLETE_HANDLER OpenAdapterCompleteHandler; \
1353 CLOSE_ADAPTER_COMPLETE_HANDLER CloseAdapterCompleteHandler; \
1354 union \
1355 { \
1356 SEND_COMPLETE_HANDLER SendCompleteHandler; \
1357 WAN_SEND_COMPLETE_HANDLER WanSendCompleteHandler; \
1358 } u2; \
1359 union \
1360 { \
1361 TRANSFER_DATA_COMPLETE_HANDLER TransferDataCompleteHandler; \
1362 WAN_TRANSFER_DATA_COMPLETE_HANDLER WanTransferDataCompleteHandler; \
1363 } u3; \
1364 RESET_COMPLETE_HANDLER ResetCompleteHandler; \
1365 REQUEST_COMPLETE_HANDLER RequestCompleteHandler; \
1366 union \
1367 { \
1368 RECEIVE_HANDLER ReceiveHandler; \
1369 WAN_RECEIVE_HANDLER WanReceiveHandler; \
1370 } u4; \
1371 RECEIVE_COMPLETE_HANDLER ReceiveCompleteHandler; \
1372 STATUS_HANDLER StatusHandler; \
1373 STATUS_COMPLETE_HANDLER StatusCompleteHandler; \
1374 NDIS_STRING Name;
1375 typedef struct _NDIS30_PROTOCOL_CHARACTERISTICS_S
1376 {
1377 NDIS30_PROTOCOL_CHARACTERISTICS;
1378 } NDIS30_PROTOCOL_CHARACTERISTICS_S, *PNDIS30_PROTOCOL_CHARACTERISTICS_S;
1379 #endif
1380
1381 /* Prototypes for NDIS 4.0 protocol characteristics */
1382
1383 typedef INT (*RECEIVE_PACKET_HANDLER)(
1384 IN NDIS_HANDLE ProtocolBindingContext,
1385 IN PNDIS_PACKET Packet);
1386
1387 typedef VOID (*BIND_HANDLER)(
1388 OUT PNDIS_STATUS Status,
1389 IN NDIS_HANDLE BindContext,
1390 IN PNDIS_STRING DeviceName,
1391 IN PVOID SystemSpecific1,
1392 IN PVOID SystemSpecific2);
1393
1394 typedef VOID (*UNBIND_HANDLER)(
1395 OUT PNDIS_STATUS Status,
1396 IN NDIS_HANDLE ProtocolBindingContext,
1397 IN NDIS_HANDLE UnbindContext);
1398
1399 typedef VOID (*TRANSLATE_HANDLER)(
1400 OUT PNDIS_STATUS Status,
1401 IN NDIS_HANDLE ProtocolBindingContext,
1402 OUT PNET_PNP_ID IdList,
1403 IN ULONG IdListLength,
1404 OUT PULONG BytesReturned);
1405
1406 typedef VOID (*UNLOAD_PROTOCOL_HANDLER)(
1407 VOID);
1408
1409
1410 /* Protocol characteristics for NDIS 4.0 protocols */
1411 #ifdef _MSC_VER
1412 typedef struct _NDIS40_PROTOCOL_CHARACTERISTICS
1413 {
1414 NDIS30_PROTOCOL_CHARACTERISTICS;
1415
1416 RECEIVE_PACKET_HANDLER ReceivePacketHandler;
1417 BIND_HANDLER BindAdapterHandler;
1418 UNBIND_HANDLER UnbindAdapterHandler;
1419 TRANSLATE_HANDLER TranslateHandler;
1420 UNLOAD_PROTOCOL_HANDLER UnloadHandler;
1421 } NDIS40_PROTOCOL_CHARACTERISTICS;
1422 typedef NDIS40_PROTOCOL_CHARACTERISTICS NDIS40_PROTOCOL_CHARACTERISTICS_S;
1423 #else
1424 #define NDIS40_PROTOCOL_CHARACTERISTICS \
1425 NDIS30_PROTOCOL_CHARACTERISTICS; \
1426 RECEIVE_PACKET_HANDLER ReceivePacketHandler; \
1427 BIND_HANDLER BindAdapterHandler; \
1428 UNBIND_HANDLER UnbindAdapterHandler; \
1429 TRANSLATE_HANDLER TranslateHandler; \
1430 UNLOAD_PROTOCOL_HANDLER UnloadHandler;
1431 typedef struct _NDIS40_PROTOCOL_CHARACTERISTICS_S
1432 {
1433 NDIS40_PROTOCOL_CHARACTERISTICS;
1434 } NDIS40_PROTOCOL_CHARACTERISTICS_S, *PNDIS40_PROTOCOL_CHARACTERISTICS_S;
1435 #endif
1436
1437
1438 /* Prototypes for NDIS 5.0 protocol characteristics */
1439
1440 #ifdef NDIS50
1441
1442 typedef VOID (*CO_SEND_COMPLETE_HANDLER)(
1443 IN NDIS_STATUS Status,
1444 IN NDIS_HANDLE ProtocolVcContext,
1445 IN PNDIS_PACKET Packet);
1446
1447 typedef VOID (*CO_STATUS_HANDLER)(
1448 IN NDIS_HANDLE ProtocolBindingContext,
1449 IN NDIS_HANDLE ProtocolVcContext OPTIONAL,
1450 IN NDIS_STATUS GeneralStatus,
1451 IN PVOID StatusBuffer,
1452 IN UINT StatusBufferSize);
1453
1454 typedef UINT (*CO_RECEIVE_PACKET_HANDLER)(
1455 IN NDIS_HANDLE ProtocolBindingContext,
1456 IN NDIS_HANDLE ProtocolVcContext,
1457 IN PNDIS_PACKET Packet);
1458
1459 typedef VOID (*CO_AF_REGISTER_NOTIFY_HANDLER)(
1460 IN NDIS_HANDLE ProtocolBindingContext,
1461 IN PCO_ADDRESS_FAMILY AddressFamily);
1462
1463 #ifdef _MSC_VER
1464 typedef struct _NDIS50_PROTOCOL_CHARACTERISTICS
1465 {
1466 NDIS40_PROTOCOL_CHARACTERISTICS;
1467
1468 PVOID ReservedHandlers[4];
1469
1470 CO_SEND_COMPLETE_HANDLER CoSendCompleteHandler;
1471 CO_STATUS_HANDLER CoStatusHandler;
1472 CO_RECEIVE_PACKET_HANDLER CoReceivePacketHandler;
1473 CO_AF_REGISTER_NOTIFY_HANDLER CoAfRegisterNotifyHandler;
1474 } NDIS50_PROTOCOL_CHARACTERISTICS;
1475 typedef NDIS50_PROTOCOL_CHARACTERISTICS NDIS50_PROTOCOL_CHARACTERISTICS_S;
1476 #else
1477 #define NDIS50_PROTOCOL_CHARACTERISTICS \
1478 NDIS40_PROTOCOL_CHARACTERISTICS; \
1479 PVOID ReservedHandlers[4]; \
1480 CO_SEND_COMPLETE_HANDLER CoSendCompleteHandler; \
1481 CO_STATUS_HANDLER CoStatusHandler; \
1482 CO_RECEIVE_PACKET_HANDLER CoReceivePacketHandler; \
1483 CO_AF_REGISTER_NOTIFY_HANDLER CoAfRegisterNotifyHandler;
1484 typedef struct _NDIS50_PROTOCOL_CHARACTERISTICS_S
1485 {
1486 NDIS50_PROTOCOL_CHARACTERISTICS;
1487 } NDIS50_PROTOCOL_CHARACTERISTICS_S, *PNDIS50_PROTOCOL_CHARACTERISTICS_S;
1488 #endif
1489 #endif /* NDIS50 */
1490
1491
1492 #ifndef NDIS50
1493 #ifndef NDIS40
1494 typedef struct _NDIS_PROTOCOL_CHARACTERISTICS
1495 {
1496 NDIS30_PROTOCOL_CHARACTERISTICS;
1497 } NDIS_PROTOCOL_CHARACTERISTICS;
1498 #else /* NDIS40 */
1499 typedef struct _NDIS_PROTOCOL_CHARACTERISTICS
1500 {
1501 NDIS40_PROTOCOL_CHARACTERISTICS;
1502 } NDIS_PROTOCOL_CHARACTERISTICS;
1503 #endif /* NDIS40 */
1504 #else /* NDIS50 */
1505 typedef struct _NDIS_PROTOCOL_CHARACTERISTICS
1506 {
1507 NDIS50_PROTOCOL_CHARACTERISTICS;
1508 } NDIS_PROTOCOL_CHARACTERISTICS;
1509 #endif /* NDIS50 */
1510
1511 typedef NDIS_PROTOCOL_CHARACTERISTICS *PNDIS_PROTOCOL_CHARACTERISTICS;
1512
1513
1514
1515 /* Buffer management routines */
1516
1517 VOID
1518 EXPIMP
1519 NdisAllocateBuffer(
1520 OUT PNDIS_STATUS Status,
1521 OUT PNDIS_BUFFER *Buffer,
1522 IN NDIS_HANDLE PoolHandle,
1523 IN PVOID VirtualAddress,
1524 IN UINT Length);
1525
1526 VOID
1527 EXPIMP
1528 NdisAllocateBufferPool(
1529 OUT PNDIS_STATUS Status,
1530 OUT PNDIS_HANDLE PoolHandle,
1531 IN UINT NumberOfDescriptors);
1532
1533 VOID
1534 EXPIMP
1535 NdisAllocatePacket(
1536 OUT PNDIS_STATUS Status,
1537 OUT PNDIS_PACKET *Packet,
1538 IN NDIS_HANDLE PoolHandle);
1539
1540 VOID
1541 EXPIMP
1542 NdisAllocatePacketPool(
1543 OUT PNDIS_STATUS Status,
1544 OUT PNDIS_HANDLE PoolHandle,
1545 IN UINT NumberOfDescriptors,
1546 IN UINT ProtocolReservedLength);
1547
1548 VOID
1549 EXPIMP
1550 NdisCopyBuffer(
1551 OUT PNDIS_STATUS Status,
1552 OUT PNDIS_BUFFER *Buffer,
1553 IN NDIS_HANDLE PoolHandle,
1554 IN PVOID MemoryDescriptor,
1555 IN UINT Offset,
1556 IN UINT Length);
1557
1558 VOID
1559 EXPIMP
1560 NdisCopyFromPacketToPacket(
1561 IN PNDIS_PACKET Destination,
1562 IN UINT DestinationOffset,
1563 IN UINT BytesToCopy,
1564 IN PNDIS_PACKET Source,
1565 IN UINT SourceOffset,
1566 OUT PUINT BytesCopied);
1567
1568 VOID
1569 EXPIMP
1570 NdisDprAllocatePacket(
1571 OUT PNDIS_STATUS Status,
1572 OUT PNDIS_PACKET *Packet,
1573 IN NDIS_HANDLE PoolHandle);
1574
1575 VOID
1576 EXPIMP
1577 NdisDprAllocatePacketNonInterlocked(
1578 OUT PNDIS_STATUS Status,
1579 OUT PNDIS_PACKET *Packet,
1580 IN NDIS_HANDLE PoolHandle);
1581
1582 VOID
1583 EXPIMP
1584 NdisDprFreePacket(
1585 IN PNDIS_PACKET Packet);
1586
1587 VOID
1588 EXPIMP
1589 NdisDprFreePacketNonInterlocked(
1590 IN PNDIS_PACKET Packet);
1591
1592 VOID
1593 EXPIMP
1594 NdisFreeBufferPool(
1595 IN NDIS_HANDLE PoolHandle);
1596
1597 VOID
1598 EXPIMP
1599 NdisFreePacket(
1600 IN PNDIS_PACKET Packet);
1601
1602 VOID
1603 EXPIMP
1604 NdisFreePacketPool(
1605 IN NDIS_HANDLE PoolHandle);
1606
1607 VOID
1608 EXPIMP
1609 NdisReturnPackets(
1610 IN PNDIS_PACKET *PacketsToReturn,
1611 IN UINT NumberOfPackets);
1612
1613 VOID
1614 EXPIMP
1615 NdisUnchainBufferAtBack(
1616 IN OUT PNDIS_PACKET Packet,
1617 OUT PNDIS_BUFFER *Buffer);
1618
1619 VOID
1620 EXPIMP
1621 NdisUnchainBufferAtFront(
1622 IN OUT PNDIS_PACKET Packet,
1623 OUT PNDIS_BUFFER *Buffer);
1624
1625 /*
1626 * PVOID NdisAdjustBufferLength(
1627 * IN PNDIS_BUFFER Buffer,
1628 * IN UINT Length);
1629 */
1630 VOID
1631 EXPIMP
1632 NdisAdjustBufferLength(
1633 IN PNDIS_BUFFER Buffer,
1634 IN UINT Length);
1635
1636 /*
1637 * ULONG NDIS_BUFFER_TO_SPAN_PAGES(
1638 * IN PNDIS_BUFFER Buffer);
1639 */
1640 ULONG
1641 EXPIMP
1642 NDIS_BUFFER_TO_SPAN_PAGES(
1643 IN PNDIS_BUFFER Buffer);
1644
1645 VOID
1646 EXPIMP
1647 NdisFreeBuffer(
1648 IN PNDIS_BUFFER Buffer);
1649
1650
1651
1652 /*
1653 * VOID NdisGetBufferPhysicalArraySize(
1654 * IN PNDIS_BUFFER Buffer,
1655 * OUT PUINT ArraySize);
1656 */
1657 VOID
1658 EXPIMP
1659 NdisGetBufferPhysicalArraySize(
1660 IN PNDIS_BUFFER Buffer,
1661 OUT PUINT ArraySize);
1662
1663 /*
1664 * VOID NdisGetFirstBufferFromPacket(
1665 * IN PNDIS_PACKET _Packet,
1666 * OUT PNDIS_BUFFER * _FirstBuffer,
1667 * OUT PVOID * _FirstBufferVA,
1668 * OUT PUINT _FirstBufferLength,
1669 * OUT PUINT _TotalBufferLength)
1670 */
1671 VOID
1672 EXPIMP
1673 NdisGetFirstBufferFromPacket(
1674 IN PNDIS_PACKET _Packet,
1675 OUT PNDIS_BUFFER * _FirstBuffer,
1676 OUT PVOID * _FirstBufferVA,
1677 OUT PUINT _FirstBufferLength,
1678 OUT PUINT _TotalBufferLength);
1679
1680 VOID
1681 EXPIMP
1682 NdisQueryBuffer(
1683 IN PNDIS_BUFFER Buffer,
1684 OUT PVOID *VirtualAddress OPTIONAL,
1685 OUT PUINT Length);
1686
1687 VOID
1688 EXPIMP
1689 NdisQueryBufferOffset(
1690 IN PNDIS_BUFFER Buffer,
1691 OUT PUINT Offset,
1692 OUT PUINT Length);
1693
1694 /*
1695 * PVOID NDIS_BUFFER_LINKAGE(
1696 * IN PNDIS_BUFFER Buffer);
1697 */
1698 #define NDIS_BUFFER_LINKAGE(Buffer) \
1699 { \
1700 (Buffer)->Next; \
1701 }
1702
1703
1704 /*
1705 * VOID NdisChainBufferAtBack(
1706 * IN OUT PNDIS_PACKET Packet,
1707 * IN OUT PNDIS_BUFFER Buffer)
1708 */
1709 #define NdisChainBufferAtBack(Packet, \
1710 Buffer) \
1711 { \
1712 PNDIS_BUFFER NdisBuffer = (Buffer); \
1713 \
1714 while (NdisBuffer->Next != NULL) \
1715 NdisBuffer = NdisBuffer->Next; \
1716 \
1717 NdisBuffer->Next = NULL; \
1718 \
1719 if ((Packet)->Private.Head != NULL) \
1720 (Packet)->Private.Tail->Next = (Buffer); \
1721 else \
1722 (Packet)->Private.Head = (Buffer); \
1723 \
1724 (Packet)->Private.Tail = NdisBuffer; \
1725 (Packet)->Private.ValidCounts = FALSE; \
1726 }
1727
1728
1729 /*
1730 * VOID NdisChainBufferAtFront(
1731 * IN OUT PNDIS_PACKET Packet,
1732 * IN OUT PNDIS_BUFFER Buffer)
1733 */
1734 #define NdisChainBufferAtFront(Packet, \
1735 Buffer) \
1736 { \
1737 PNDIS_BUFFER _NdisBuffer = (Buffer); \
1738 \
1739 while (_NdisBuffer->Next != NULL) \
1740 _NdisBuffer = _NdisBuffer->Next; \
1741 \
1742 if ((Packet)->Private.Head == NULL) \
1743 (Packet)->Private.Tail = _NdisBuffer; \
1744 \
1745 _NdisBuffer->Next = (Packet)->Private.Head; \
1746 (Packet)->Private.Head = (Buffer); \
1747 (Packet)->Private.ValidCounts = FALSE; \
1748 }
1749
1750
1751 /*
1752 * VOID NdisGetNextBuffer(
1753 * IN PNDIS_BUFFER CurrentBuffer,
1754 * OUT PNDIS_BUFFER * NextBuffer)
1755 */
1756 #define NdisGetNextBuffer(CurrentBuffer, \
1757 NextBuffer) \
1758 { \
1759 *(NextBuffer) = (CurrentBuffer)->Next; \
1760 }
1761
1762 /*
1763 * UINT NdisGetPacketFlags(
1764 * IN PNDIS_PACKET Packet);
1765 */
1766 #define NdisGetPacketFlags(Packet) \
1767 { \
1768 (Packet)->Private.Flags; \
1769 }
1770
1771
1772 /*
1773 * UINT NDIS_GET_PACKET_HEADER_SIZE(
1774 * IN PNDIS_PACKET Packet);
1775 */
1776 #define NDIS_GET_PACKET_HEADER_SIZE(Packet) \
1777 { \
1778 }
1779
1780
1781 /*
1782 * VOID NDIS_GET_PACKET_MEDIA_SPECIFIC_INFO(
1783 * IN PNDIS_PACKET Packet,
1784 * IN PPVOID pMediaSpecificInfo,
1785 * IN PUINT pSizeMediaSpecificInfo);
1786 */
1787 #define NDIS_GET_PACKET_MEDIA_SPECIFIC_INFO(Packet, \
1788 pMediaSpecificInfo, \
1789 pSizeMediaSpecificInfo) \
1790 { \
1791 }
1792
1793
1794 /*
1795 * VOID NDIS_STATUS NDIS_GET_PACKET_STATUS(
1796 * IN PNDIS_PACKET Packet);
1797 */
1798 #define NDIS_GET_PACKET_STATUS (Packet) \
1799 { \
1800 }
1801
1802
1803 /*
1804 * ULONGLONG NDIS_GET_PACKET_TIME_RECEIVED(
1805 * IN PNDIS_PACKET Packet);
1806 */
1807 #define NDIS_GET_PACKET_TIME_RECEIVED(Packet) \
1808 { \
1809 }
1810
1811
1812 /*
1813 * ULONGLONG NDIS_GET_PACKET_TIME_SENT(
1814 * IN PNDIS_PACKET Packet);
1815 */
1816 #define NDIS_GET_PACKET_TIME_SENT(Packet) \
1817 { \
1818 }
1819
1820
1821 /*
1822 * ULONGLONG NDIS_GET_PACKET_TIME_TO_SEND(
1823 * IN PNDIS_PACKET Packet);
1824 */
1825 #define NDIS_GET_PACKET_TIME_TO_SEND(Packet) \
1826 { \
1827 }
1828
1829
1830 /*
1831 * PNDIS_PACKET_OOB_DATA NDIS_OOB_DATA_FROM_PACKET(
1832 * IN PNDIS_PACKET _Packet);
1833 */
1834 #define NDIS_OOB_DATA_FROM_PACKET(_Packet) \
1835 { \
1836 }
1837
1838
1839 /*
1840 * VOID NdisQueryPacket(
1841 * IN PNDIS_PACKET Packet,
1842 * OUT PUINT PhysicalBufferCount OPTIONAL,
1843 * OUT PUINT BufferCount OPTIONAL,
1844 * OUT PNDIS_BUFFER *FirstBuffer OPTIONAL,
1845 * OUT PUINT TotalPacketLength OPTIONAL);
1846 */
1847 #define NdisQueryPacket(Packet, \
1848 PhysicalBufferCount, \
1849 BufferCount, \
1850 FirstBuffer, \
1851 TotalPacketLength) \
1852 { \
1853 if (FirstBuffer) \
1854 *((PNDIS_BUFFER*)FirstBuffer) = (Packet)->Private.Head; \
1855 if ((TotalPacketLength) || (BufferCount) || (PhysicalBufferCount)) { \
1856 if (!(Packet)->Private.ValidCounts) { \
1857 UINT _Offset; \
1858 UINT _PacketLength; \
1859 PNDIS_BUFFER _NdisBuffer; \
1860 UINT _PhysicalBufferCount = 0; \
1861 UINT _TotalPacketLength = 0; \
1862 UINT _Count = 0; \
1863 \
1864 for (_NdisBuffer = (Packet)->Private.Head; \
1865 _NdisBuffer != (PNDIS_BUFFER)NULL; \
1866 _NdisBuffer = _NdisBuffer->Next) { \
1867 _PhysicalBufferCount += NDIS_BUFFER_TO_SPAN_PAGES(_NdisBuffer); \
1868 NdisQueryBufferOffset(_NdisBuffer, &_Offset, &_PacketLength); \
1869 _TotalPacketLength += _PacketLength; \
1870 _Count++; \
1871 } \
1872 (Packet)->Private.PhysicalCount = _PhysicalBufferCount; \
1873 (Packet)->Private.TotalLength = _TotalPacketLength; \
1874 (Packet)->Private.Count = _Count; \
1875 (Packet)->Private.ValidCounts = TRUE; \
1876 } \
1877 \
1878 if (PhysicalBufferCount) \
1879 *((PUINT)PhysicalBufferCount) = (Packet)->Private.PhysicalCount; \
1880 \
1881 if (BufferCount) \
1882 *((PUINT)BufferCount) = (Packet)->Private.Count; \
1883 \
1884 if (TotalPacketLength) \
1885 *((PUINT)TotalPacketLength) = (Packet)->Private.TotalLength; \
1886 } \
1887 }
1888
1889
1890 /*
1891 * VOID NdisRecalculatePacketCounts(
1892 * IN OUT PNDIS_PACKET Packet);
1893 */
1894 #define NdisRecalculatePacketCounts(Packet) \
1895 { \
1896 }
1897
1898 VOID
1899 EXPIMP
1900 NdisReinitializePacket(
1901 IN OUT PNDIS_PACKET Packet);
1902
1903
1904 /*
1905 * VOID NdisSetPacketFlags(
1906 * IN PNDIS_PACKET Packet,
1907 * IN UINT Flags);
1908 */
1909 #define NdisSetPacketFlags(Packet, Flags) \
1910 (Packet)->Private.Flags = (Flags);
1911
1912
1913 /*
1914 * NDIS_SET_PACKET_HEADER_SIZE(
1915 * IN PNDIS_PACKET Packet,
1916 * IN UINT HdrSize);
1917 */
1918 #define NDIS_SET_PACKET_HEADER_SIZE(Packet, \
1919 HdrSize) \
1920 { \
1921 }
1922
1923
1924 /*
1925 * NDIS_SET_PACKET_MEDIA_SPECIFIC_INFO(
1926 * IN PNDIS_PACKET Packet,
1927 * IN PVOID MediaSpecificInfo,
1928 * IN UINT SizeMediaSpecificInfo);
1929 */
1930 #define NDIS_SET_PACKET_MEDIA_SPECIFIC_INFO(Packet, \
1931 MediaSpecificInfo, \
1932 SizeMediaSpecificInfo) \
1933 { \
1934 }
1935
1936
1937 /*
1938 * NDIS_SET_PACKET_STATUS(
1939 * IN PNDIS_PACKET Packet,
1940 * IN NDIS_STATUS Status);
1941 */
1942 #define NDIS_SET_PACKET_STATUS(Packet, \
1943 Status) \
1944 { \
1945 }
1946
1947
1948 /*
1949 * NDIS_SET_PACKET_TIME_RECEIVED(
1950 * IN PNDIS_PACKET Packet,
1951 * IN ULONGLONG TimeReceived);
1952 */
1953 #define NDIS_SET_PACKET_TIME_RECEIVED(Packet) \
1954 TimeReceived) \
1955 { \
1956 }
1957
1958
1959 /*
1960 * NDIS_SET_PACKET_TIME_SENT(
1961 * IN PNDIS_PACKET Packet,
1962 * IN ULONGLONG TimeSent);
1963 */
1964 #define NDIS_SET_PACKET_TIME_SENT(Packet, \
1965 TimeSent) \
1966 { \
1967 }
1968
1969
1970 /*
1971 *
1972 * NDIS_SET_PACKET_TIME_TO_SEND(
1973 * IN PNDIS_PACKET Packet,
1974 * IN ULONGLONG TimeToSend);
1975 */
1976 #define NDIS_SET_PACKET_TIME_TO_SEND(Packet, \
1977 TimeToSend) \
1978 { \
1979 }
1980
1981
1982 /*
1983 * VOID NdisSetSendFlags(
1984 * IN PNDIS_PACKET Packet,
1985 * IN UINT Flags);
1986 */
1987 #define NdisSetSendFlags(Packet, Flags)( \
1988 NdisSetPacketFlags((Packet), (Flags)))
1989
1990
1991
1992 /* Memory management routines */
1993
1994 VOID
1995 EXPIMP
1996 NdisCreateLookaheadBufferFromSharedMemory(
1997 IN PVOID pSharedMemory,
1998 IN UINT LookaheadLength,
1999 OUT PVOID *pLookaheadBuffer);
2000
2001 VOID
2002 EXPIMP
2003 NdisDestroyLookaheadBufferFromSharedMemory(
2004 IN PVOID pLookaheadBuffer);
2005
2006 VOID
2007 EXPIMP
2008 NdisMoveFromMappedMemory(
2009 OUT PVOID Destination,
2010 IN PVOID Source,
2011 IN ULONG Length);
2012
2013 VOID
2014 EXPIMP
2015 NdisMoveMappedMemory(
2016 OUT PVOID Destination,
2017 IN PVOID Source,
2018 IN ULONG Length);
2019
2020 VOID
2021 EXPIMP
2022 NdisMoveToMappedMemory(
2023 OUT PVOID Destination,
2024 IN PVOID Source,
2025 IN ULONG Length);
2026
2027 VOID
2028 EXPIMP
2029 NdisMUpdateSharedMemory(
2030 IN NDIS_HANDLE MiniportAdapterHandle,
2031 IN ULONG Length,
2032 IN PVOID VirtualAddress,
2033 IN NDIS_PHYSICAL_ADDRESS PhysicalAddress);
2034
2035 NDIS_STATUS
2036 EXPIMP
2037 NdisAllocateMemory(
2038 OUT PVOID *VirtualAddress,
2039 IN UINT Length,
2040 IN UINT MemoryFlags,
2041 IN NDIS_PHYSICAL_ADDRESS HighestAcceptableAddress);
2042
2043 VOID
2044 EXPIMP
2045 NdisFreeMemory(
2046 IN PVOID VirtualAddress,
2047 IN UINT Length,
2048 IN UINT MemoryFlags);
2049
2050 VOID
2051 EXPIMP
2052 NdisImmediateReadSharedMemory(
2053 IN NDIS_HANDLE WrapperConfigurationContext,
2054 IN ULONG SharedMemoryAddress,
2055 OUT PUCHAR Buffer,
2056 IN ULONG Length);
2057
2058 VOID
2059 EXPIMP
2060 NdisImmediateWriteSharedMemory(
2061 IN NDIS_HANDLE WrapperConfigurationContext,
2062 IN ULONG SharedMemoryAddress,
2063 IN PUCHAR Buffer,
2064 IN ULONG Length);
2065
2066 VOID
2067 EXPIMP
2068 NdisMAllocateSharedMemory(
2069 IN NDIS_HANDLE MiniportAdapterHandle,
2070 IN ULONG Length,
2071 IN BOOLEAN Cached,
2072 OUT PVOID *VirtualAddress,
2073 OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress);
2074
2075 NDIS_STATUS
2076 EXPIMP
2077 NdisMAllocateSharedMemoryAsync(
2078 IN NDIS_HANDLE MiniportAdapterHandle,
2079 IN ULONG Length,
2080 IN BOOLEAN Cached,
2081 IN PVOID Context);
2082
2083 VOID
2084 EXPIMP
2085 NdisMFreeSharedMemory(
2086 IN NDIS_HANDLE MiniportAdapterHandle,
2087 IN ULONG Length,
2088 IN BOOLEAN Cached,
2089 IN PVOID VirtualAddress,
2090 IN NDIS_PHYSICAL_ADDRESS PhysicalAddress);
2091
2092 VOID
2093 EXPIMP
2094 NdisUpdateSharedMemory(
2095 IN NDIS_HANDLE NdisAdapterHandle,
2096 IN ULONG Length,
2097 IN PVOID VirtualAddress,
2098 IN NDIS_PHYSICAL_ADDRESS PhysicalAddress);
2099
2100
2101 /*
2102 * ULONG NdisGetPhysicalAddressHigh(
2103 * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress);
2104 */
2105 #define NdisGetPhysicalAddressHigh(PhysicalAddress) \
2106 ((PhysicalAddress).HighPart)
2107
2108 /*
2109 * VOID NdisSetPhysicalAddressHigh(
2110 * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress,
2111 * IN ULONG Value);
2112 */
2113 #define NdisSetPhysicalAddressHigh(PhysicalAddress, Value) \
2114 ((PhysicalAddress).HighPart) = (Value)
2115
2116 /*
2117 * ULONG NdisGetPhysicalAddressLow(
2118 * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress);
2119 */
2120 #define NdisGetPhysicalAddressLow(PhysicalAddress) \
2121 ((PhysicalAddress).LowPart)
2122
2123
2124 /*
2125 * VOID NdisSetPhysicalAddressLow(
2126 * IN NDIS_PHYSICAL_ADDRESS PhysicalAddress,
2127 * IN ULONG Value);
2128 */
2129 #define NdisSetPhysicalAddressLow(PhysicalAddress, Value) \
2130 ((PhysicalAddress).LowPart) = (Value)
2131
2132 /*
2133 * VOID NDIS_PHYSICAL_ADDRESS_CONST(
2134 * IN ULONG Low,
2135 * IN LONG High);
2136 */
2137 #define NDIS_PHYSICAL_ADDRESS_CONST(Low, High) \
2138 { {(ULONG)(Low), (LONG)(High)} }
2139
2140
2141 /*
2142 * VOID NdisMoveMemory(
2143 * OUT PVOID Destination,
2144 * IN PVOID Source,
2145 * IN ULONG Length);
2146 */
2147 #define NdisMoveMemory(Destination, Source, Length) \
2148 RtlCopyMemory(Destination, Source, Length)
2149
2150
2151 /*
2152 * VOID NdisRetrieveUlong(
2153 * IN PULONG DestinationAddress,
2154 * IN PULONG SourceAddress);
2155 */
2156 #define NdisRetrieveUlong(DestinationAddress, SourceAddress) \
2157 RtlRetrieveUlong(DestinationAddress, SourceAddress)
2158
2159
2160 /*
2161 * VOID NdisStoreUlong(
2162 * IN PULONG DestinationAddress,
2163 * IN ULONG Value);
2164 */
2165 #define NdisStoreUlong(DestinationAddress, Value) \
2166 RtlStoreUlong(DestinationAddress, Value)
2167
2168
2169 /*
2170 * VOID NdisZeroMemory(
2171 * IN PVOID Destination,
2172 * IN ULONG Length)
2173 */
2174 #define NdisZeroMemory(Destination, Length) \
2175 RtlZeroMemory(Destination, Length)
2176
2177
2178
2179 //
2180 // System processor count
2181 //
2182
2183 CCHAR
2184 EXPIMP
2185 NdisSystemProcessorCount(
2186 VOID
2187 );
2188
2189 VOID
2190 EXPIMP
2191 NdisImmediateReadPortUchar(
2192 IN NDIS_HANDLE WrapperConfigurationContext,
2193 IN ULONG Port,
2194 OUT PUCHAR Data
2195 );
2196
2197 VOID
2198 EXPIMP
2199 NdisImmediateReadPortUshort(
2200 IN NDIS_HANDLE WrapperConfigurationContext,
2201 IN ULONG Port,
2202 OUT PUSHORT Data
2203 );
2204
2205 VOID
2206 EXPIMP
2207 NdisImmediateReadPortUlong(
2208 IN NDIS_HANDLE WrapperConfigurationContext,
2209 IN ULONG Port,
2210 OUT PULONG Data
2211 );
2212
2213 VOID
2214 EXPIMP
2215 NdisImmediateWritePortUchar(
2216 IN NDIS_HANDLE WrapperConfigurationContext,
2217 IN ULONG Port,
2218 IN UCHAR Data
2219 );
2220
2221 VOID
2222 EXPIMP
2223 NdisImmediateWritePortUshort(
2224 IN NDIS_HANDLE WrapperConfigurationContext,
2225 IN ULONG Port,
2226 IN USHORT Data
2227 );
2228
2229 VOID
2230 EXPIMP
2231 NdisImmediateWritePortUlong(
2232 IN NDIS_HANDLE WrapperConfigurationContext,
2233 IN ULONG Port,
2234 IN ULONG Data
2235 );
2236
2237 VOID
2238 EXPIMP
2239 NdisImmediateReadSharedMemory(
2240 IN NDIS_HANDLE WrapperConfigurationContext,
2241 IN ULONG SharedMemoryAddress,
2242 IN PUCHAR Buffer,
2243 IN ULONG Length
2244 );
2245
2246 VOID
2247 EXPIMP
2248 NdisImmediateWriteSharedMemory(
2249 IN NDIS_HANDLE WrapperConfigurationContext,
2250 IN ULONG SharedMemoryAddress,
2251 IN PUCHAR Buffer,
2252 IN ULONG Length
2253 );
2254
2255 ULONG
2256 EXPIMP
2257 NdisImmediateReadPciSlotInformation(
2258 IN NDIS_HANDLE WrapperConfigurationContext,
2259 IN ULONG SlotNumber,
2260 IN ULONG Offset,
2261 IN PVOID Buffer,
2262 IN ULONG Length
2263 );
2264
2265 ULONG
2266 EXPIMP
2267 NdisImmediateWritePciSlotInformation(
2268 IN NDIS_HANDLE WrapperConfigurationContext,
2269 IN ULONG SlotNumber,
2270 IN ULONG Offset,
2271 IN PVOID Buffer,
2272 IN ULONG Length
2273 );
2274
2275 ULONG
2276 EXPIMP
2277 NdisReadPciSlotInformation(
2278 IN NDIS_HANDLE NdisAdapterHandle,
2279 IN ULONG SlotNumber,
2280 IN ULONG Offset,
2281 IN PVOID Buffer,
2282 IN ULONG Length);
2283
2284 ULONG
2285 EXPIMP
2286 NdisWritePciSlotInformation(
2287 IN NDIS_HANDLE NdisAdapterHandle,
2288 IN ULONG SlotNumber,
2289 IN ULONG Offset,
2290 IN PVOID Buffer,
2291 IN ULONG Length);
2292
2293 /* String management routines */
2294
2295 /*
2296 * NDIS_STATUS NdisAnsiStringToUnicodeString(
2297 * IN OUT PNDIS_STRING DestinationString,
2298 * IN PNDIS_ANSI_STRING SourceString);
2299 */
2300 NDIS_STATUS
2301 EXPIMP
2302 NdisAnsiStringToUnicodeString(
2303 IN OUT PNDIS_STRING DestinationString,
2304 IN PANSI_STRING SourceString);
2305
2306 /*
2307 * BOOLEAN NdisEqualString(
2308 * IN PNDIS_STRING String1,
2309 * IN PNDIS_STRING String2,
2310 * IN BOOLEAN CaseInsensitive)
2311 */
2312 BOOLEAN
2313 EXPIMP
2314 NdisEqualString(
2315 IN PNDIS_STRING String1,
2316 IN PNDIS_STRING String2,
2317 IN BOOLEAN CaseInsensitive);
2318
2319 /*
2320 * VOID NdisInitAnsiString(
2321 * IN OUT PNDIS_ANSI_STRING DestinationString,
2322 * IN PCSTR SourceString)
2323 */
2324 VOID
2325 EXPIMP
2326 NdisInitAnsiString(
2327 IN OUT PANSI_STRING DestinationString,
2328 IN PCSTR SourceString);
2329
2330 /*
2331 * VOID NdisInitUnicodeString(
2332 * IN OUT PNDIS_STRING DestinationString,
2333 * IN PCWSTR SourceString)
2334 */
2335 VOID
2336 EXPIMP
2337 NdisInitUnicodeString(
2338 IN OUT PNDIS_STRING DestinationString,
2339 IN PCWSTR SourceString);
2340
2341 /*
2342 * NDIS_STATUS NdisUnicodeStringToAnsiString(
2343 * IN OUT PNDIS_ANSI_STRING DestinationString,
2344 * IN PNDIS_STRING SourceString)
2345 */
2346 NDIS_STATUS
2347 EXPIMP
2348 NdisUnicodeStringToAnsiString(
2349 IN OUT PANSI_STRING DestinationString,
2350 IN PNDIS_STRING SourceString);
2351
2352 #define NdisFreeString(_s) NdisFreeMemory((s).Buffer, (s).MaximumLength, 0)
2353 #define NdisPrintString(_s) DbgPrint("%ls", (s).Buffer)
2354
2355
2356
2357 /* I/O routines */
2358
2359 /*
2360 * VOID NdisRawReadPortBufferUchar(
2361 * IN ULONG Port,
2362 * OUT PUCHAR Buffer,
2363 * IN ULONG Length);
2364 */
2365 #define NdisRawReadPortBufferUchar(Port, Buffer, Length) \
2366 READ_PORT_BUFFER_UCHAR((PUCHAR)(Port), (PUCHAR)(Buffer), (Length))
2367
2368 /*
2369 * VOID NdisRawReadPortBufferUlong(
2370 * IN ULONG Port,
2371 * OUT PULONG Buffer,
2372 * IN ULONG Length);
2373 */
2374 #define NdisRawReadPortBufferUlong(Port, Buffer, Length) \
2375 READ_PORT_BUFFER_ULONG((PULONG)(Port), (PULONG)(Buffer), (Length))
2376
2377 /*
2378 * VOID NdisRawReadPortBufferUshort(
2379 * IN ULONG Port,
2380 * OUT PUSHORT Buffer,
2381 * IN ULONG Length);
2382 */
2383 #define NdisRawReadPortBufferUshort(Port, Buffer, Length) \
2384 READ_PORT_BUFFER_USHORT((PUSHORT)(Port), (PUSHORT)(Buffer), (Length))
2385
2386
2387 /*
2388 * VOID NdisRawReadPortUchar(
2389 * IN ULONG Port,
2390 * OUT PUCHAR Data);
2391 */
2392 #define NdisRawReadPortUchar(Port, Data) \
2393 *(Data) = READ_PORT_UCHAR((PUCHAR)(Port))
2394
2395 /*
2396 * VOID NdisRawReadPortUlong(
2397 * IN ULONG Port,
2398 * OUT PULONG Data);
2399 */
2400 #define NdisRawReadPortUlong(Port, Data) \
2401 *(Data) = READ_PORT_ULONG((PULONG)(Port))
2402
2403 /*
2404 * VOID NdisRawReadPortUshort(
2405 * IN ULONG Port,
2406 * OUT PUSHORT Data);
2407 */
2408 #define NdisRawReadPortUshort(Port, Data) \
2409 *(Data) = READ_PORT_USHORT((PUSHORT)(Port))
2410
2411
2412 /*
2413 * VOID NdisRawWritePortBufferUchar(
2414 * IN ULONG Port,
2415 * IN PUCHAR Buffer,
2416 * IN ULONG Length);
2417 */
2418 #define NdisRawWritePortBufferUchar(Port, Buffer, Length) \
2419 WRITE_PORT_BUFFER_UCHAR((PUCHAR)(Port), (PUCHAR)(Buffer), (Length))
2420
2421 /*
2422 * VOID NdisRawWritePortBufferUlong(
2423 * IN ULONG Port,
2424 * IN PULONG Buffer,
2425 * IN ULONG Length);
2426 */
2427 #define NdisRawWritePortBufferUlong(Port, Buffer, Length) \
2428 WRITE_PORT_BUFFER_ULONG((PULONG)(Port), (PULONG)(Buffer), (Length))
2429
2430 /*
2431 * VOID NdisRawWritePortBufferUshort(
2432 * IN ULONG Port,
2433 * IN PUSHORT Buffer,
2434 * IN ULONG Length);
2435 */
2436 #define NdisRawWritePortBufferUshort(Port, Buffer, Length) \
2437 WRITE_PORT_BUFFER_USHORT((PUSHORT)(Port), (PUSHORT)(Buffer), (Length))
2438
2439
2440 /*
2441 * VOID NdisRawWritePortUchar(
2442 * IN ULONG Port,
2443 * IN UCHAR Data);
2444 */
2445 #define NdisRawWritePortUchar(Port, Data) \
2446 WRITE_PORT_UCHAR((PUCHAR)(Port), (UCHAR)(Data))
2447
2448 /*
2449 * VOID NdisRawWritePortUlong(
2450 * IN ULONG Port,
2451 * IN ULONG Data);
2452 */
2453 #define NdisRawWritePortUlong(Port, Data) \
2454 WRITE_PORT_ULONG((PULONG)(Port), (ULONG)(Data))
2455
2456 /*
2457 * VOID NdisRawWritePortUshort(
2458 * IN ULONG Port,
2459 * IN USHORT Data);
2460 */
2461 #define NdisRawWritePortUshort(Port, Data) \
2462 WRITE_PORT_USHORT((PUSHORT)(Port), (USHORT)(Data))
2463
2464
2465 /*
2466 * VOID NdisReadRegisterUchar(
2467 * IN PUCHAR Register,
2468 * OUT PUCHAR Data);
2469 */
2470 #define NdisReadRegisterUchar(Register, Data) \
2471 *((PUCHAR)(Data)) = *(Register)
2472
2473 /*
2474 * VOID NdisReadRegisterUlong(
2475 * IN PULONG Register,
2476 * OUT PULONG Data);
2477 */
2478 #define NdisReadRegisterUlong(Register, Data) \
2479 *((PULONG)(Data)) = *(Register)
2480
2481 /*
2482 * VOID NdisReadRegisterUshort(
2483 * IN PUSHORT Register,
2484 * OUT PUSHORT Data);
2485 */
2486 #define NdisReadRegisterUshort(Register, Data) \
2487 *((PUSHORT)(Data)) = *(Register)
2488
2489
2490 /*
2491 * VOID NdisReadRegisterUchar(
2492 * IN PUCHAR Register,
2493 * IN UCHAR Data);
2494 */
2495 #define NdisWriteRegisterUchar(Register, Data) \
2496 WRITE_REGISTER_UCHAR((Register), (Data))
2497
2498 /*
2499 * VOID NdisReadRegisterUlong(
2500 * IN PULONG Register,
2501 * IN ULONG Data);
2502 */
2503 #define NdisWriteRegisterUlong(Register, Data) \
2504 WRITE_REGISTER_ULONG((Register), (Data))
2505
2506 /*
2507 * VOID NdisReadRegisterUshort(
2508 * IN PUSHORT Register,
2509 * IN USHORT Data);
2510 */
2511 #define NdisWriteRegisterUshort(Register, Data) \
2512 WRITE_REGISTER_USHORT((Register), (Data))
2513
2514
2515 /* Linked lists */
2516
2517 VOID
2518 EXPIMP
2519 NdisInitializeListHead(
2520 IN PLIST_ENTRY ListHead);
2521
2522 VOID
2523 EXPIMP
2524 NdisInterlockedAddUlong(
2525 IN PULONG Addend,
2526 IN ULONG Increment,
2527 IN PNDIS_SPIN_LOCK SpinLock);
2528
2529 PLIST_ENTRY
2530 EXPIMP
2531 NdisInterlockedInsertHeadList(
2532 IN PLIST_ENTRY ListHead,
2533 IN PLIST_ENTRY ListEntry,
2534 IN PNDIS_SPIN_LOCK SpinLock);
2535
2536 PLIST_ENTRY
2537 EXPIMP
2538 NdisInterlockedInsertTailList(
2539 IN PLIST_ENTRY ListHead,
2540 IN PLIST_ENTRY ListEntry,
2541 IN PNDIS_SPIN_LOCK SpinLock);
2542
2543 PLIST_ENTRY
2544 EXPIMP
2545 NdisInterlockedRemoveHeadList(
2546 IN PLIST_ENTRY ListHead,
2547 IN PNDIS_SPIN_LOCK SpinLock);
2548
2549
2550 VOID
2551 EXPIMP
2552 NdisCloseConfiguration(
2553 IN NDIS_HANDLE ConfigurationHandle);
2554
2555 VOID
2556 EXPIMP
2557 NdisReadConfiguration(
2558 OUT PNDIS_STATUS Status,
2559 OUT PNDIS_CONFIGURATION_PARAMETER *ParameterValue,
2560 IN NDIS_HANDLE ConfigurationHandle,
2561 IN PNDIS_STRING Keyword,
2562 IN NDIS_PARAMETER_TYPE ParameterType);
2563
2564 VOID
2565 EXPIMP
2566 NdisReadNetworkAddress(
2567 OUT PNDIS_STATUS Status,
2568 OUT PVOID *NetworkAddress,
2569 OUT PUINT NetworkAddressLength,
2570 IN NDIS_HANDLE ConfigurationHandle);
2571
2572 VOID
2573 EXPIMP
2574 NdisWriteConfiguration(
2575 OUT PNDIS_STATUS Status,
2576 IN NDIS_HANDLE ConfigurationHandle,
2577 IN PNDIS_STRING Keyword,
2578 IN PNDIS_CONFIGURATION_PARAMETER ParameterValue);
2579
2580 VOID
2581 EXPIMP
2582 NdisOpenConfiguration(
2583 OUT PNDIS_STATUS Status,
2584 OUT PNDIS_HANDLE ConfigurationHandle,
2585 IN NDIS_HANDLE WrapperConfigurationContext);
2586
2587 VOID
2588 EXPIMP
2589 NdisOpenConfigurationKeyByIndex(
2590 OUT PNDIS_STATUS Status,
2591 IN NDIS_HANDLE ConfigurationHandle,
2592 IN ULONG Index,
2593 OUT PNDIS_STRING KeyName,
2594 OUT PNDIS_HANDLE KeyHandle);
2595
2596 VOID
2597 EXPIMP
2598 NdisOpenConfigurationKeyByName(
2599 OUT PNDIS_STATUS Status,
2600 IN NDIS_HANDLE ConfigurationHandle,
2601 IN PNDIS_STRING SubKeyName,
2602 OUT PNDIS_HANDLE SubKeyHandle);
2603
2604
2605 VOID
2606 /*EXPIMP*/
2607 NdisWriteErrorLogEntry(
2608 IN NDIS_HANDLE NdisAdapterHandle,
2609 IN NDIS_ERROR_CODE ErrorCode,
2610 IN ULONG NumberOfErrorValues,
2611 IN ULONG ERROR_LOG_MAXIMUM_SIZE);
2612 /* IN ULONG ...);
2613 * ERROR_LOG_MAXIMUM_SIZE = ... in MSDN
2614 */
2615
2616 /*
2617 * VOID NdisStallExecution(
2618 * IN UINT MicrosecondsToStall)
2619 */
2620 #define NdisStallExecution(MicroSecondsToStall) \
2621 KeStallExecutionProcessor(MicroSecondsToStall)
2622
2623
2624 #define NdisZeroMappedMemory(Destination,Length) RtlZeroMemory(Destination,Length)
2625 /* moved to ndis/memory.c by robd
2626 #define NdisMoveMappedMemory(Destination,Source,Length) RtlCopyMemory(Destination,Source,Length)
2627 */
2628 /* moved to ndis/control.c by robd
2629 #define NdisReinitializePacket(Packet) \
2630 { \
2631 (Packet)->Private.Head = (PNDIS_BUFFER)NULL; \
2632 (Packet)->Private.ValidCounts = FALSE; \
2633 }
2634 */
2635 VOID
2636 EXPIMP
2637 NdisInitializeEvent(
2638 IN PNDIS_EVENT Event
2639 );
2640
2641 VOID
2642 EXPIMP
2643 NdisSetEvent(
2644 IN PNDIS_EVENT Event
2645 );
2646
2647 VOID
2648 EXPIMP
2649 NdisResetEvent(
2650 IN PNDIS_EVENT Event
2651 );
2652
2653 BOOLEAN
2654 EXPIMP
2655 NdisWaitEvent(
2656 IN PNDIS_EVENT Event,
2657 IN UINT msToWait
2658 );
2659
2660
2661 /* NDIS helper macros */
2662
2663 /*
2664 * NDIS_INIT_FUNCTION(FunctionName)
2665 */
2666 #define NDIS_INIT_FUNCTION(FunctionName) \
2667 alloc_text(init, FunctionName)
2668
2669 /*
2670 * NDIS_PAGABLE_FUNCTION(FunctionName)
2671 */
2672 #define NDIS_PAGABLE_FUNCTION(FunctionName) \
2673 alloc_text(page, FunctionName)
2674
2675
2676
2677 /* NDIS 4.0 extensions */
2678
2679 #ifdef NDIS40
2680
2681 VOID
2682 EXPIMP
2683 NdisMFreeSharedMemory(
2684 IN NDIS_HANDLE MiniportAdapterHandle,
2685 IN ULONG Length,
2686 IN BOOLEAN Cached,
2687 IN PVOID VirtualAddress,
2688 IN NDIS_PHYSICAL_ADDRESS PhysicalAddress);
2689
2690 VOID
2691 EXPIMP
2692 NdisMWanIndicateReceive(
2693 OUT PNDIS_STATUS Status,
2694 IN NDIS_HANDLE MiniportAdapterHandle,
2695 IN NDIS_HANDLE NdisLinkContext,
2696 IN PUCHAR PacketBuffer,
2697 IN UINT PacketSize);
2698
2699 VOID
2700 EXPIMP
2701 NdisMWanIndicateReceiveComplete(
2702 IN NDIS_HANDLE MiniportAdapterHandle);
2703
2704 VOID
2705 EXPIMP
2706 NdisMWanSendComplete(
2707 IN NDIS_HANDLE MiniportAdapterHandle,
2708 IN PNDIS_WAN_PACKET Packet,
2709 IN NDIS_STATUS Status);
2710
2711 NDIS_STATUS
2712 EXPIMP
2713 NdisPciAssignResources(
2714 IN NDIS_HANDLE NdisMacHandle,
2715 IN NDIS_HANDLE NdisWrapperHandle,
2716 IN NDIS_HANDLE WrapperConfigurationContext,
2717 IN ULONG SlotNumber,
2718 OUT PNDIS_RESOURCE_LIST *AssignedResources);
2719
2720 VOID
2721 EXPIMP
2722 NdisReadEisaSlotInformationEx(
2723 OUT PNDIS_STATUS Status,
2724 IN NDIS_HANDLE WrapperConfigurationContext,
2725 OUT PUINT SlotNumber,
2726 OUT PNDIS_EISA_FUNCTION_INFORMATION *EisaData,
2727 OUT PUINT NumberOfFunctions);
2728
2729 VOID
2730 EXPIMP
2731 NdisReadMcaPosInformation(
2732 OUT PNDIS_STATUS Status,
2733 IN NDIS_HANDLE WrapperConfigurationContext,
2734 IN PUINT ChannelNumber,
2735 OUT PNDIS_MCA_POS_DATA McaData);
2736
2737 #endif /* NDIS40 */
2738
2739
2740 #if USE_KLOCKS
2741
2742 #define DISPATCH_LEVEL 2
2743
2744 #define NdisAllocateSpinLock(_SpinLock) KeInitializeSpinLock(&(_SpinLock)->SpinLock)
2745
2746 #define NdisFreeSpinLock(_SpinLock)
2747
2748 #define NdisAcquireSpinLock(_SpinLock) KeAcquireSpinLock(&(_SpinLock)->SpinLock, &(_SpinLock)->OldIrql)
2749
2750 #define NdisReleaseSpinLock(_SpinLock) KeReleaseSpinLock(&(_SpinLock)->SpinLock,(_SpinLock)->OldIrql)
2751
2752 #define NdisDprAcquireSpinLock(_SpinLock) \
2753 { \
2754 KeAcquireSpinLockAtDpcLevel(&(_SpinLock)->SpinLock); \
2755 (_SpinLock)->OldIrql = DISPATCH_LEVEL; \
2756 }
2757
2758 #define NdisDprReleaseSpinLock(_SpinLock) KeReleaseSpinLockFromDpcLevel(&(_SpinLock)->SpinLock)
2759
2760 #else
2761
2762 //
2763 // Ndis Spin Locks
2764 //
2765
2766 VOID
2767 EXPIMP
2768 NdisAllocateSpinLock(
2769 IN PNDIS_SPIN_LOCK SpinLock
2770 );
2771
2772
2773 VOID
2774 EXPIMP
2775 NdisFreeSpinLock(
2776 IN PNDIS_SPIN_LOCK SpinLock
2777 );
2778
2779
2780 VOID
2781 EXPIMP
2782 NdisAcquireSpinLock(
2783 IN PNDIS_SPIN_LOCK SpinLock
2784 );
2785
2786
2787 VOID
2788 EXPIMP
2789 NdisReleaseSpinLock(
2790 IN PNDIS_SPIN_LOCK SpinLock
2791 );
2792
2793
2794 VOID
2795 EXPIMP
2796 NdisDprAcquireSpinLock(
2797 IN PNDIS_SPIN_LOCK SpinLock
2798 );
2799
2800
2801 VOID
2802 EXPIMP
2803 NdisDprReleaseSpinLock(
2804 IN PNDIS_SPIN_LOCK SpinLock
2805 );
2806
2807 #endif
2808
2809 VOID
2810 EXPIMP
2811 NdisGetCurrentSystemTime(
2812 PLARGE_INTEGER pSystemTime
2813 );
2814
2815
2816 VOID
2817 EXPIMP
2818 NdisAcquireReadWriteLock(
2819 IN PNDIS_RW_LOCK Lock,
2820 IN BOOLEAN fWrite,
2821 IN PLOCK_STATE LockState);
2822
2823 NDIS_STATUS
2824 EXPIMP
2825 NdisAllocateMemoryWithTag(
2826 OUT PVOID *VirtualAddress,
2827 IN UINT Length,
2828 IN ULONG Tag);
2829
2830 VOID
2831 EXPIMP
2832 NdisAllocatePacketPoolEx(
2833 OUT PNDIS_STATUS Status,
2834 OUT PNDIS_HANDLE PoolHandle,
2835 IN UINT NumberOfDescriptors,
2836 IN UINT NumberOfOverflowDescriptors,
2837 IN UINT ProtocolReservedLength);
2838
2839 ULONG
2840 EXPIMP
2841 NdisBufferLength(
2842 IN PNDIS_BUFFER Buffer);
2843
2844 PVOID
2845 EXPIMP
2846 NdisBufferVirtualAddress(
2847 IN PNDIS_BUFFER Buffer);
2848
2849 VOID
2850 EXPIMP
2851 NdisCompletePnPEvent(
2852 IN NDIS_STATUS Status,
2853 IN NDIS_HANDLE NdisBindingHandle,
2854 IN PNET_PNP_EVENT NetPnPEvent);
2855
2856 VOID
2857 EXPIMP
2858 NdisConvertStringToAtmAddress(
2859 OUT PNDIS_STATUS Status,
2860 IN PNDIS_STRING String,
2861 OUT PATM_ADDRESS AtmAddress);
2862
2863 VOID
2864 EXPIMP
2865 NdisGetCurrentProcessorCounts(
2866 OUT PULONG pIdleCount,
2867 OUT PULONG pKernelAndUser,
2868 OUT PULONG pIndex);
2869
2870 VOID
2871 EXPIMP
2872 NdisGetDriverHandle(
2873 IN PNDIS_HANDLE NdisBindingHandle,
2874 OUT PNDIS_HANDLE NdisDriverHandle);
2875
2876 PNDIS_PACKET
2877 EXPIMP
2878 NdisGetReceivedPacket(
2879 IN PNDIS_HANDLE NdisBindingHandle,
2880 IN PNDIS_HANDLE MacContext);
2881
2882 VOID
2883 EXPIMP
2884 NdisGetSystemUptime(
2885 OUT PULONG pSystemUpTime);
2886
2887 VOID
2888 EXPIMP
2889 NdisInitializeReadWriteLock(
2890 IN PNDIS_RW_LOCK Lock);
2891
2892 LONG
2893 EXPIMP
2894 NdisInterlockedDecrement(
2895 IN PLONG Addend);
2896
2897 LONG
2898 EXPIMP
2899 NdisInterlockedIncrement(
2900 IN PLONG Addend);
2901
2902 PSINGLE_LIST_ENTRY
2903 EXPIMP
2904 NdisInterlockedPopEntrySList(
2905 IN PSLIST_HEADER ListHead,
2906 IN PKSPIN_LOCK Lock);
2907
2908 PSINGLE_LIST_ENTRY
2909 EXPIMP
2910 NdisInterlockedPushEntrySList(
2911 IN PSLIST_HEADER ListHead,
2912 IN PSINGLE_LIST_ENTRY ListEntry,
2913 IN PKSPIN_LOCK Lock);
2914
2915
2916 NDIS_STATUS
2917 EXPIMP
2918 NdisMDeregisterDevice(
2919 IN NDIS_HANDLE NdisDeviceHandle);
2920
2921 VOID
2922 EXPIMP
2923 NdisMGetDeviceProperty(
2924 IN NDIS_HANDLE MiniportAdapterHandle,
2925 IN OUT PDEVICE_OBJECT *PhysicalDeviceObject OPTIONAL,
2926 IN OUT PDEVICE_OBJECT *FunctionalDeviceObject OPTIONAL,
2927 IN OUT PDEVICE_OBJECT *NextDeviceObject OPTIONAL,
2928 IN OUT PCM_RESOURCE_LIST *AllocatedResources OPTIONAL,
2929 IN OUT PCM_RESOURCE_LIST *AllocatedResourcesTranslated OPTIONAL);
2930
2931 NDIS_STATUS
2932 EXPIMP
2933 NdisMInitializeScatterGatherDma(
2934 IN NDIS_HANDLE MiniportAdapterHandle,
2935 IN BOOLEAN Dma64BitAddresses,
2936 IN ULONG MaximumPhysicalMapping);
2937
2938 NDIS_STATUS
2939 EXPIMP
2940 NdisMPromoteMiniport(
2941 IN NDIS_HANDLE MiniportAdapterHandle);
2942
2943 NDIS_STATUS
2944 EXPIMP
2945 NdisMQueryAdapterInstanceName(
2946 OUT PNDIS_STRING AdapterInstanceName,
2947 IN NDIS_HANDLE MiniportAdapterHandle);
2948
2949 NDIS_STATUS
2950 EXPIMP
2951 NdisMRegisterDevice(
2952 IN NDIS_HANDLE NdisWrapperHandle,
2953 IN PNDIS_STRING DeviceName,
2954 IN PNDIS_STRING SymbolicName,
2955 IN PDRIVER_DISPATCH MajorFunctions[],
2956 OUT PDEVICE_OBJECT *pDeviceObject,
2957 OUT NDIS_HANDLE *NdisDeviceHandle);
2958
2959 VOID
2960 EXPIMP
2961 NdisMRegisterUnloadHandler(
2962 IN NDIS_HANDLE NdisWrapperHandle,
2963 IN PDRIVER_UNLOAD UnloadHandler);
2964
2965 NDIS_STATUS
2966 EXPIMP
2967 NdisMRemoveMiniport(
2968 IN NDIS_HANDLE MiniportAdapterHandle);
2969
2970 NDIS_STATUS
2971 EXPIMP
2972 NdisMSetMiniportSecondary(
2973 IN NDIS_HANDLE MiniportAdapterHandle,
2974 IN NDIS_HANDLE PrimaryMiniportAdapterHandle);
2975
2976 UINT
2977 EXPIMP
2978 NdisPacketPoolUsage(
2979 IN NDIS_HANDLE PoolHandle);
2980
2981 NDIS_STATUS
2982 EXPIMP
2983 NdisQueryAdapterInstanceName(
2984 OUT PNDIS_STRING AdapterInstanceName,
2985 IN NDIS_HANDLE NdisBindingHandle);
2986
2987 VOID
2988 EXPIMP
2989 NdisQueryBufferSafe(
2990 IN PNDIS_BUFFER Buffer,
2991 OUT PVOID *VirtualAddress OPTIONAL,
2992 OUT PUINT Length,
2993 IN UINT Priority);
2994
2995 ULONG
2996 EXPIMP
2997 NdisReadPcmciaAttributeMemory(
2998 IN NDIS_HANDLE NdisAdapterHandle,
2999 IN ULONG Offset,
3000 IN PVOID Buffer,
3001 IN ULONG Length);
3002
3003 VOID
3004 EXPIMP
3005 NdisReleaseReadWriteLock(
3006 IN PNDIS_RW_LOCK Lock,
3007 IN PLOCK_STATE LockState);
3008
3009
3010 NDIS_STATUS
3011 EXPIMP
3012 NdisWriteEventLogEntry(
3013 IN PVOID LogHandle,
3014 IN NDIS_STATUS EventCode,
3015 IN ULONG UniqueEventValue,
3016 IN USHORT NumStrings,
3017 IN PVOID StringsList OPTIONAL,
3018 IN ULONG DataSize,
3019 IN PVOID Data OPTIONAL);
3020
3021 ULONG
3022 EXPIMP
3023 NdisWritePcmciaAttributeMemory(
3024 IN NDIS_HANDLE NdisAdapterHandle,
3025 IN ULONG Offset,
3026 IN PVOID Buffer,
3027 IN ULONG Length);
3028
3029
3030 /* Connectionless services */
3031
3032 NDIS_STATUS
3033 EXPIMP
3034 NdisClAddParty(
3035 IN NDIS_HANDLE NdisVcHandle,
3036 IN NDIS_HANDLE ProtocolPartyContext,
3037 IN OUT PCO_CALL_PARAMETERS CallParameters,
3038 OUT PNDIS_HANDLE NdisPartyHandle);
3039
3040 NDIS_STATUS
3041 EXPIMP
3042 NdisClCloseAddressFamily(
3043 IN NDIS_HANDLE NdisAfHandle);
3044
3045 NDIS_STATUS
3046 EXPIMP
3047 NdisClCloseCall(
3048 IN NDIS_HANDLE NdisVcHandle,
3049 IN NDIS_HANDLE NdisPartyHandle OPTIONAL,
3050 IN PVOID Buffer OPTIONAL,
3051 IN UINT Size);
3052
3053 NDIS_STATUS
3054 EXPIMP
3055 NdisClDeregisterSap(
3056 IN NDIS_HANDLE NdisSapHandle);
3057
3058 NDIS_STATUS
3059 EXPIMP
3060 NdisClDropParty(
3061 IN NDIS_HANDLE NdisPartyHandle,
3062 IN PVOID Buffer OPTIONAL,
3063 IN UINT Size);
3064
3065 VOID
3066 EXPIMP
3067 NdisClIncomingCallComplete(
3068 IN NDIS_STATUS Status,
3069 IN NDIS_HANDLE NdisVcHandle,
3070 IN PCO_CALL_PARAMETERS CallParameters);
3071
3072 NDIS_STATUS
3073 EXPIMP
3074 NdisClMakeCall(
3075 IN NDIS_HANDLE NdisVcHandle,
3076 IN OUT PCO_CALL_PARAMETERS CallParameters,
3077 IN NDIS_HANDLE ProtocolPartyContext OPTIONAL,
3078 OUT PNDIS_HANDLE NdisPartyHandle OPTIONAL);
3079
3080 NDIS_STATUS
3081 EXPIMP
3082 NdisClModifyCallQoS(
3083 IN NDIS_HANDLE NdisVcHandle,
3084 IN PCO_CALL_PARAMETERS CallParameters);
3085
3086
3087 NDIS_STATUS
3088 EXPIMP
3089 NdisClOpenAddressFamily(
3090 IN NDIS_HANDLE NdisBindingHandle,
3091 IN PCO_ADDRESS_FAMILY AddressFamily,
3092 IN NDIS_HANDLE ProtocolAfContext,
3093 IN PNDIS_CLIENT_CHARACTERISTICS ClCharacteristics,
3094 IN UINT SizeOfClCharacteristics,
3095 OUT PNDIS_HANDLE NdisAfHandle);
3096
3097 NDIS_STATUS
3098 EXPIMP
3099 NdisClRegisterSap(
3100 IN NDIS_HANDLE NdisAfHandle,
3101 IN NDIS_HANDLE ProtocolSapContext,
3102 IN PCO_SAP Sap,
3103 OUT PNDIS_HANDLE NdisSapHandle);
3104
3105
3106 /* Call Manager services */
3107
3108 NDIS_STATUS
3109 EXPIMP
3110 NdisCmActivateVc(
3111 IN NDIS_HANDLE NdisVcHandle,
3112 IN OUT PCO_CALL_PARAMETERS CallParameters);
3113
3114 VOID
3115 EXPIMP
3116 NdisCmAddPartyComplete(
3117 IN NDIS_STATUS Status,
3118 IN NDIS_HANDLE NdisPartyHandle,
3119 IN NDIS_HANDLE CallMgrPartyContext OPTIONAL,
3120 IN PCO_CALL_PARAMETERS CallParameters);
3121
3122 VOID
3123 EXPIMP
3124 NdisCmCloseAddressFamilyComplete(
3125 IN NDIS_STATUS Status,
3126 IN NDIS_HANDLE NdisAfHandle);
3127
3128 VOID
3129 EXPIMP
3130 NdisCmCloseCallComplete(
3131 IN NDIS_STATUS Status,
3132 IN NDIS_HANDLE NdisVcHandle,
3133 IN NDIS_HANDLE NdisPartyHandle OPTIONAL);
3134
3135 NDIS_STATUS
3136 EXPIMP
3137 NdisCmDeactivateVc(
3138 IN NDIS_HANDLE NdisVcHandle);
3139
3140 VOID
3141 EXPIMP
3142 NdisCmDeregisterSapComplete(
3143 IN NDIS_STATUS Status,
3144 IN NDIS_HANDLE NdisSapHandle);
3145
3146 VOID
3147 EXPIMP
3148 NdisCmDispatchCallConnected(
3149 IN NDIS_HANDLE NdisVcHandle);
3150
3151 NDIS_STATUS
3152 EXPIMP
3153 NdisCmDispatchIncomingCall(
3154 IN NDIS_HANDLE NdisSapHandle,
3155 IN NDIS_HANDLE NdisVcHandle,
3156 IN PCO_CALL_PARAMETERS CallParameters);
3157
3158 VOID
3159 EXPIMP
3160 NdisCmDispatchIncomingCallQoSChange(
3161 IN NDIS_HANDLE NdisVcHandle,
3162 IN PCO_CALL_PARAMETERS CallParameters);
3163
3164 VOID
3165 EXPIMP
3166 NdisCmDispatchIncomingCloseCall(
3167 IN NDIS_STATUS CloseStatus,
3168 IN NDIS_HANDLE NdisVcHandle,
3169 IN PVOID Buffer OPTIONAL,
3170 IN UINT Size);
3171
3172 VOID
3173 EXPIMP
3174 NdisCmDispatchIncomingDropParty(
3175 IN NDIS_STATUS DropStatus,
3176 IN NDIS_HANDLE NdisPartyHandle,
3177 IN PVOID Buffer OPTIONAL,
3178 IN UINT Size);
3179
3180 VOID
3181 EXPIMP
3182 NdisCmDropPartyComplete(
3183 IN NDIS_STATUS Status,
3184 IN NDIS_HANDLE NdisPartyHandle);
3185
3186 VOID
3187 EXPIMP
3188 NdisCmMakeCallComplete(
3189 IN NDIS_STATUS Status,
3190 IN NDIS_HANDLE NdisVcHandle,
3191 IN NDIS_HANDLE NdisPartyHandle OPTIONAL,
3192 IN NDIS_HANDLE CallMgrPartyContext OPTIONAL,
3193 IN PCO_CALL_PARAMETERS CallParameters);
3194
3195 VOID
3196 EXPIMP
3197 NdisCmModifyCallQoSComplete(
3198 IN NDIS_STATUS Status,
3199 IN NDIS_HANDLE NdisVcHandle,
3200 IN PCO_CALL_PARAMETERS CallParameters);
3201
3202 VOID
3203 EXPIMP
3204 NdisCmOpenAddressFamilyComplete(
3205 IN NDIS_STATUS Status,
3206 IN NDIS_HANDLE NdisAfHandle,
3207 IN NDIS_HANDLE CallMgrAfContext);
3208
3209 NDIS_STATUS
3210 EXPIMP
3211 NdisCmRegisterAddressFamily(
3212 IN NDIS_HANDLE NdisBindingHandle,
3213 IN PCO_ADDRESS_FAMILY AddressFamily,
3214 IN PNDIS_CALL_MANAGER_CHARACTERISTICS CmCharacteristics,
3215 IN UINT SizeOfCmCharacteristics);
3216
3217 VOID
3218 EXPIMP
3219 NdisCmRegisterSapComplete(
3220 IN NDIS_STATUS Status,
3221 IN NDIS_HANDLE NdisSapHandle,
3222 IN NDIS_HANDLE CallMgrSapContext);
3223
3224
3225 NDIS_STATUS
3226 EXPIMP
3227 NdisMCmActivateVc(
3228 IN NDIS_HANDLE NdisVcHandle,
3229 IN PCO_CALL_PARAMETERS CallParameters);
3230
3231 NDIS_STATUS
3232 EXPIMP
3233 NdisMCmCreateVc(
3234 IN NDIS_HANDLE MiniportAdapterHandle,
3235 IN NDIS_HANDLE NdisAfHandle,
3236 IN NDIS_HANDLE MiniportVcContext,
3237 OUT PNDIS_HANDLE NdisVcHandle);
3238
3239 NDIS_STATUS
3240 EXPIMP
3241 NdisMCmDeactivateVc(
3242 IN NDIS_HANDLE NdisVcHandle);
3243
3244 NDIS_STATUS
3245 EXPIMP
3246 NdisMCmDeleteVc(
3247 IN NDIS_HANDLE NdisVcHandle);
3248
3249 NDIS_STATUS
3250 EXPIMP
3251 NdisMCmRegisterAddressFamily(
3252 IN NDIS_HANDLE MiniportAdapterHandle,
3253 IN PCO_ADDRESS_FAMILY AddressFamily,
3254 IN PNDIS_CALL_MANAGER_CHARACTERISTICS CmCharacteristics,
3255 IN UINT SizeOfCmCharacteristics);
3256
3257 NDIS_STATUS
3258 EXPIMP
3259 NdisMCmRequest(
3260 IN NDIS_HANDLE NdisAfHandle,
3261 IN NDIS_HANDLE NdisVcHandle OPTIONAL,
3262 IN NDIS_HANDLE NdisPartyHandle OPTIONAL,
3263 IN OUT PNDIS_REQUEST NdisRequest);
3264
3265
3266 /* Connection-oriented services */
3267
3268 NDIS_STATUS
3269 EXPIMP
3270 NdisCoCreateVc(
3271 IN NDIS_HANDLE NdisBindingHandle,
3272 IN NDIS_HANDLE NdisAfHandle OPTIONAL,
3273 IN NDIS_HANDLE ProtocolVcContext,
3274 IN OUT PNDIS_HANDLE NdisVcHandle);
3275
3276 NDIS_STATUS
3277 EXPIMP
3278 NdisCoDeleteVc(
3279 IN NDIS_HANDLE NdisVcHandle);
3280
3281 NDIS_STATUS
3282 EXPIMP
3283 NdisCoRequest(
3284 IN NDIS_HANDLE NdisBindingHandle,
3285 IN NDIS_HANDLE NdisAfHandle OPTIONAL,
3286 IN NDIS_HANDLE NdisVcHandle OPTIONAL,
3287 IN NDIS_HANDLE NdisPartyHandle OPTIONAL,
3288 IN OUT PNDIS_REQUEST NdisRequest);
3289
3290 VOID
3291 EXPIMP
3292 NdisCoRequestComplete(
3293 IN NDIS_STATUS Status,
3294 IN NDIS_HANDLE NdisAfHandle,
3295 IN NDIS_HANDLE NdisVcHandle OPTIONAL,
3296 IN NDIS_HANDLE NdisPartyHandle OPTIONAL,
3297 IN PNDIS_REQUEST NdisRequest);
3298
3299 VOID
3300 EXPIMP
3301 NdisCoSendPackets(
3302 IN NDIS_HANDLE NdisVcHandle,
3303 IN PPNDIS_PACKET PacketArray,
3304 IN UINT NumberOfPackets);
3305
3306
3307 VOID
3308 EXPIMP
3309 NdisMCoActivateVcComplete(
3310 IN NDIS_STATUS Status,
3311 IN NDIS_HANDLE NdisVcHandle,
3312 IN PCO_CALL_PARAMETERS CallParameters);
3313
3314 VOID
3315 EXPIMP
3316 NdisMCoDeactivateVcComplete(
3317 IN NDIS_STATUS Status,
3318 IN NDIS_HANDLE NdisVcHandle);
3319
3320 VOID
3321 EXPIMP
3322 NdisMCoIndicateReceivePacket(
3323 IN NDIS_HANDLE NdisVcHandle,
3324 IN PPNDIS_PACKET PacketArray,
3325 IN UINT NumberOfPackets);
3326
3327 VOID
3328 EXPIMP
3329 NdisMCoIndicateStatus(
3330 IN NDIS_HANDLE MiniportAdapterHandle,
3331 IN NDIS_HANDLE NdisVcHandle OPTIONAL,
3332 IN NDIS_STATUS GeneralStatus,
3333 IN PVOID StatusBuffer OPTIONAL,
3334 IN ULONG StatusBufferSize);
3335
3336 VOID
3337 EXPIMP
3338 NdisMCoReceiveComplete(
3339 IN NDIS_HANDLE MiniportAdapterHandle);
3340
3341 VOID
3342 EXPIMP
3343 NdisMCoRequestComplete(
3344 IN NDIS_STATUS Status,
3345 IN NDIS_HANDLE MiniportAdapterHandle,
3346 IN PNDIS_REQUEST Request);
3347
3348 VOID
3349 EXPIMP
3350 NdisMCoSendComplete(
3351 IN NDIS_STATUS Status,
3352 IN NDIS_HANDLE NdisVcHandle,
3353 IN PNDIS_PACKET Packet);
3354
3355
3356 /* NDIS 5.0 extensions for intermediate drivers */
3357
3358 VOID
3359 EXPIMP
3360 NdisIMAssociateMiniport(
3361 IN NDIS_HANDLE DriverHandle,
3362 IN NDIS_HANDLE ProtocolHandle);
3363
3364 NDIS_STATUS
3365 EXPIMP
3366 NdisIMCancelInitializeDeviceInstance(
3367 IN NDIS_HANDLE DriverHandle,
3368 IN PNDIS_STRING DeviceInstance);
3369
3370 VOID
3371 EXPIMP
3372 NdisIMCopySendCompletePerPacketInfo(
3373 IN PNDIS_PACKET DstPacket,
3374 IN PNDIS_PACKET SrcPacket);
3375
3376 VOID
3377 EXPIMP
3378 NdisIMCopySendPerPacketInfo(
3379 IN PNDIS_PACKET DstPacket,
3380 IN PNDIS_PACKET SrcPacket);
3381
3382 VOID
3383 EXPIMP
3384 NdisIMDeregisterLayeredMiniport(
3385 IN NDIS_HANDLE DriverHandle);
3386
3387 NDIS_HANDLE
3388 EXPIMP
3389 NdisIMGetBindingContext(
3390 IN NDIS_HANDLE NdisBindingHandle);
3391
3392 NDIS_HANDLE
3393 EXPIMP
3394 NdisIMGetDeviceContext(
3395 IN NDIS_HANDLE MiniportAdapterHandle);
3396
3397 NDIS_STATUS
3398 EXPIMP
3399 NdisIMInitializeDeviceInstanceEx(
3400 IN NDIS_HANDLE DriverHandle,
3401 IN PNDIS_STRING DriverInstance,
3402 IN NDIS_HANDLE DeviceContext OPTIONAL);
3403
3404 //#endif /* NDIS50 */
3405
3406
3407
3408 /* Prototypes for NDIS_MINIPORT_CHARACTERISTICS */
3409
3410 typedef BOOLEAN STDCALL (*W_CHECK_FOR_HANG_HANDLER)(
3411 IN NDIS_HANDLE MiniportAdapterContext);
3412
3413 typedef VOID STDCALL (*W_DISABLE_INTERRUPT_HANDLER)(
3414 IN NDIS_HANDLE MiniportAdapterContext);
3415
3416 typedef VOID STDCALL (*W_ENABLE_INTERRUPT_HANDLER)(
3417 IN NDIS_HANDLE MiniportAdapterContext);
3418
3419 typedef VOID STDCALL (*W_HALT_HANDLER)(
3420 IN NDIS_HANDLE MiniportAdapterContext);
3421
3422 typedef VOID STDCALL (*W_HANDLE_INTERRUPT_HANDLER)(
3423 IN NDIS_HANDLE MiniportAdapterContext);
3424
3425 typedef NDIS_STATUS STDCALL (*W_INITIALIZE_HANDLER)(
3426 OUT PNDIS_STATUS OpenErrorStatus,
3427 OUT PUINT SelectedMediumIndex,
3428 IN PNDIS_MEDIUM MediumArray,
3429 IN UINT MediumArraySize,
3430 IN NDIS_HANDLE MiniportAdapterContext,
3431 IN NDIS_HANDLE WrapperConfigurationContext);
3432
3433 typedef VOID STDCALL STDCALL (*W_ISR_HANDLER)(
3434 OUT PBOOLEAN InterruptRecognized,
3435 OUT PBOOLEAN QueueMiniportHandleInterrupt,
3436 IN NDIS_HANDLE MiniportAdapterContext);
3437
3438 typedef NDIS_STATUS STDCALL (*W_QUERY_INFORMATION_HANDLER)(
3439 IN NDIS_HANDLE MiniportAdapterContext,
3440 IN NDIS_OID Oid,
3441 IN PVOID InformationBuffer,
3442 IN ULONG InformationBufferLength,
3443 OUT PULONG BytesWritten,
3444 OUT PULONG BytesNeeded);
3445
3446 typedef NDIS_STATUS STDCALL (*W_RECONFIGURE_HANDLER)(
3447 OUT PNDIS_STATUS OpenErrorStatus,
3448 IN NDIS_HANDLE MiniportAdapterContext,
3449 IN NDIS_HANDLE WrapperConfigurationContext);
3450
3451 typedef NDIS_STATUS STDCALL (*W_RESET_HANDLER)(
3452 OUT PBOOLEAN AddressingReset,
3453 IN NDIS_HANDLE MiniportAdapterContext);
3454
3455 typedef NDIS_STATUS STDCALL (*W_SEND_HANDLER)(
3456 IN NDIS_HANDLE MiniportAdapterContext,
3457 IN PNDIS_PACKET Packet,
3458 IN UINT Flags);
3459
3460 typedef NDIS_STATUS STDCALL (*WM_SEND_HANDLER)(
3461 IN NDIS_HANDLE MiniportAdapterContext,
3462 IN NDIS_HANDLE NdisLinkHandle,
3463 IN PNDIS_WAN_PACKET Packet);
3464
3465 typedef NDIS_STATUS STDCALL (*W_SET_INFORMATION_HANDLER)(
3466 IN NDIS_HANDLE MiniportAdapterContext,
3467 IN NDIS_OID Oid,
3468 IN PVOID InformationBuffer,
3469 IN ULONG InformationBufferLength,
3470 OUT PULONG BytesRead,
3471 OUT PULONG BytesNeeded);
3472
3473 typedef NDIS_STATUS STDCALL (*W_TRANSFER_DATA_HANDLER)(
3474 OUT PNDIS_PACKET Packet,
3475 OUT PUINT BytesTransferred,
3476 IN NDIS_HANDLE MiniportAdapterContext,
3477 IN NDIS_HANDLE MiniportReceiveContext,
3478 IN UINT ByteOffset,
3479 IN UINT BytesToTransfer);
3480
3481 typedef NDIS_STATUS STDCALL (*WM_TRANSFER_DATA_HANDLER)(
3482 VOID);
3483
3484
3485
3486 /* NDIS structures available only to miniport drivers */
3487
3488 /* Technology specific defines */
3489
3490 #define DECLARE_UNKNOWN_STRUCT(BaseName) \
3491 typedef struct _##BaseName BaseName, *P##BaseName;
3492
3493
3494 /* ARCnet */
3495
3496 typedef struct _ARC_BUFFER_LIST
3497 {
3498 PVOID Buffer;
3499 UINT Size;
3500 UINT BytesLeft;
3501 struct _ARC_BUFFER_LIST *Next;
3502 } ARC_BUFFER_LIST, *PARC_BUFFER_LIST;
3503
3504 DECLARE_UNKNOWN_STRUCT(ARC_FILTER)
3505
3506
3507 VOID
3508 EXPIMP
3509 ArcFilterDprIndicateReceive(
3510 IN PARC_FILTER Filter,
3511 IN PUCHAR pRawHeader,
3512 IN PUCHAR pData,
3513 IN UINT Length);
3514
3515 VOID
3516 EXPIMP
3517 ArcFilterDprIndicateReceiveComplete(
3518 IN PARC_FILTER Filter);
3519
3520
3521 /* Ethernet */
3522
3523 #define ETH_LENGTH_OF_ADDRESS 6
3524
3525 DECLARE_UNKNOWN_STRUCT(ETH_BINDING_INFO);
3526
3527 typedef VOID (*ETH_ADDRESS_CHANGE)(VOID);
3528 typedef VOID (*ETH_FILTER_CHANGE)(VOID);
3529 typedef VOID (*ETH_DEFERRED_CLOSE)(VOID);
3530
3531 typedef struct _ETH_FILTER
3532 {
3533 PNDIS_SPIN_LOCK Lock;
3534 CHAR (*MCastAddressBuf)[ETH_LENGTH_OF_ADDRESS];
3535 struct _NDIS_MINIPORT_BLOCK *Miniport;
3536 UINT CombinedPacketFilter;
3537 PETH_BINDING_INFO OpenList;
3538 ETH_ADDRESS_CHANGE AddressChangeAction;
3539 ETH_FILTER_CHANGE FilterChangeAction;
3540 ETH_DEFERRED_CLOSE CloseAction;
3541 UINT MaxMulticastAddresses;
3542 UINT NumAddresses;
3543 UCHAR AdapterAddress[ETH_LENGTH_OF_ADDRESS];
3544 UINT OldCombinedPacketFilter;
3545 CHAR (*OldMCastAddressBuf)[ETH_LENGTH_OF_ADDRESS];
3546 UINT OldNumAddresses;
3547 PETH_BINDING_INFO DirectedList;
3548 PETH_BINDING_INFO BMList;
3549 PETH_BINDING_INFO MCastSet;
3550 #if 0
3551 #ifdef NDIS_WRAPPER
3552 UINT NumOpens;
3553 NDIS_RW_LOCK BindListLock;
3554 #endif
3555 #endif
3556 } ETH_FILTER, *PETH_FILTER;
3557
3558
3559 NDIS_STATUS
3560 EXPIMP
3561 EthChangeFilterAddresses(
3562 IN PETH_FILTER Filter,
3563 IN NDIS_HANDLE NdisFilterHandle,
3564 IN PNDIS_REQUEST NdisRequest,
3565 IN UINT AddressCount,
3566 IN CHAR Addresses[] [ETH_LENGTH_OF_ADDRESS],
3567 IN BOOLEAN Set);
3568
3569 BOOLEAN
3570 EXPIMP
3571 EthCreateFilter(
3572 IN UINT MaximumMulticastAddresses,
3573 IN ETH_ADDRESS_CHANGE AddressChangeAction,
3574 IN ETH_FILTER_CHANGE FilterChangeAction,
3575 IN ETH_DEFERRED_CLOSE CloseAction,
3576 IN PUCHAR AdapterAddress,
3577 IN PNDIS_SPIN_LOCK Lock,
3578 OUT PETH_FILTER *Filter);
3579
3580 VOID
3581 EXPIMP
3582 EthDeleteFilter(
3583 IN PETH_FILTER Filter);
3584
3585 NDIS_STATUS
3586 EXPIMP
3587 EthDeleteFilterOpenAdapter(
3588 IN PETH_FILTER Filter,
3589 IN NDIS_HANDLE NdisFilterHandle,
3590 IN PNDIS_REQUEST NdisRequest);
3591
3592 NDIS_STATUS
3593 EXPIMP
3594 EthFilterAdjust(
3595 IN PETH_FILTER Filter,
3596 IN NDIS_HANDLE NdisFilterHandle,
3597 IN PNDIS_REQUEST NdisRequest,
3598 IN UINT FilterClasses,
3599 IN BOOLEAN Set);
3600
3601 VOID
3602 EXPIMP
3603 EthFilterIndicateReceive(
3604 IN PETH_FILTER Filter,
3605 IN NDIS_HANDLE MacReceiveContext,
3606 IN PCHAR Address,
3607 IN PVOID HeaderBuffer,
3608 IN UINT HeaderBufferSize,
3609 IN PVOID LookaheadBuffer,
3610 IN UINT LookaheadBufferSize,
3611 IN UINT PacketSize);
3612
3613 VOID
3614 EXPIMP
3615 EthFilterIndicateReceiveComplete(
3616 IN PETH_FILTER Filter);
3617
3618 BOOLEAN
3619 EXPIMP
3620 EthNoteFilterOpenAdapter(
3621 IN PETH_FILTER Filter,
3622 IN NDIS_HANDLE MacBindingHandle,
3623 IN NDIS_HANDLE NdisBindingContext,
3624 OUT PNDIS_HANDLE NdisFilterHandle);
3625
3626 UINT
3627 EXPIMP
3628 EthNumberOfOpenFilterAddresses(
3629 IN PETH_FILTER Filter,
3630 IN NDIS_HANDLE NdisFilterHandle);
3631
3632 VOID
3633 EXPIMP
3634 EthQueryGlobalFilterAddresses (
3635 OUT PNDIS_STATUS Status,
3636 IN PETH_FILTER Filter,
3637 IN UINT SizeOfArray,
3638 OUT PUINT NumberOfAddresses,
3639 IN OUT CHAR AddressArray[] [ETH_LENGTH_OF_ADDRESS]);
3640
3641 VOID
3642 EXPIMP
3643 EthQueryOpenFilterAddresses(
3644 OUT PNDIS_STATUS Status,
3645 IN PETH_FILTER Filter,
3646 IN NDIS_HANDLE NdisFilterHandle,
3647 IN UINT SizeOfArray,
3648 OUT PUINT NumberOfAddresses,
3649 IN OUT CHAR AddressArray[] [ETH_LENGTH_OF_ADDRESS]);
3650
3651 BOOLEAN
3652 EXPIMP
3653 EthShouldAddressLoopBack(
3654 IN PETH_FILTER Filter,
3655 IN CHAR Address[ETH_LENGTH_OF_ADDRESS]);
3656
3657
3658 /* FDDI */
3659
3660 #define FDDI_LENGTH_OF_LONG_ADDRESS 6
3661 #define FDDI_LENGTH_OF_SHORT_ADDRESS 2
3662
3663 DECLARE_UNKNOWN_STRUCT(FDDI_FILTER)
3664
3665 typedef VOID (*FDDI_ADDRESS_CHANGE)(VOID);
3666 typedef VOID (*FDDI_FILTER_CHANGE)(VOID);
3667 typedef VOID (*FDDI_DEFERRED_CLOSE)(VOID);
3668
3669
3670 NDIS_STATUS
3671 EXPIMP
3672 FddiChangeFilterLongAddresses(
3673 IN PFDDI_FILTER Filter,
3674 IN NDIS_HANDLE NdisFilterHandle,
3675 IN PNDIS_REQUEST NdisRequest,
3676 IN UINT AddressCount,
3677 IN CHAR Addresses[] [FDDI_LENGTH_OF_LONG_ADDRESS],
3678 IN BOOLEAN Set);
3679
3680 NDIS_STATUS
3681 EXPIMP
3682 FddiChangeFilterShortAddresses(
3683 IN PFDDI_FILTER Filter,
3684 IN NDIS_HANDLE NdisFilterHandle,
3685 IN PNDIS_REQUEST NdisRequest,
3686 IN UINT AddressCount,
3687 IN CHAR Addresses[] [FDDI_LENGTH_OF_SHORT_ADDRESS],
3688 IN BOOLEAN Set);
3689
3690 BOOLEAN
3691 EXPIMP
3692 FddiCreateFilter(
3693 IN UINT MaximumMulticastLongAddresses,
3694 IN UINT MaximumMulticastShortAddresses,
3695 IN FDDI_ADDRESS_CHANGE AddressChangeAction,
3696 IN FDDI_FILTER_CHANGE FilterChangeAction,
3697 IN FDDI_DEFERRED_CLOSE CloseAction,
3698 IN PUCHAR AdapterLongAddress,
3699 IN PUCHAR AdapterShortAddress,
3700 IN PNDIS_SPIN_LOCK Lock,
3701 OUT PFDDI_FILTER *Filter);
3702
3703 VOID
3704 EXPIMP
3705 FddiDeleteFilter(
3706 IN PFDDI_FILTER Filter);
3707
3708 NDIS_STATUS
3709 EXPIMP
3710 FddiDeleteFilterOpenAdapter(
3711 IN PFDDI_FILTER Filter,
3712 IN NDIS_HANDLE NdisFilterHandle,
3713 IN PNDIS_REQUEST NdisRequest);
3714
3715 NDIS_STATUS
3716 EXPIMP
3717 FddiFilterAdjust(
3718 IN PFDDI_FILTER Filter,
3719 IN NDIS_HANDLE NdisFilterHandle,
3720 IN PNDIS_REQUEST NdisRequest,
3721 IN UINT FilterClasses,
3722 IN BOOLEAN Set);
3723
3724 VOID
3725 EXPIMP
3726 FddiFilterIndicateReceive(
3727 IN PFDDI_FILTER Filter,
3728 IN NDIS_HANDLE MacReceiveContext,
3729 IN PCHAR Address,
3730 IN UINT AddressLength,
3731 IN PVOID HeaderBuffer,
3732 IN UINT HeaderBufferSize,
3733 IN PVOID LookaheadBuffer,
3734 IN UINT LookaheadBufferSize,
3735 IN UINT PacketSize);
3736
3737 VOID
3738 EXPIMP
3739 FddiFilterIndicateReceiveComplete(
3740 IN PFDDI_FILTER Filter);
3741
3742 BOOLEAN
3743 EXPIMP
3744 FddiNoteFilterOpenAdapter(
3745 IN PFDDI_FILTER Filter,
3746 IN NDIS_HANDLE MacBindingHandle,
3747 IN NDIS_HANDLE NdisBindingContext,
3748 OUT PNDIS_HANDLE NdisFilterHandle);
3749
3750 UINT
3751 EXPIMP
3752 FddiNumberOfOpenFilterLongAddresses(
3753 IN PFDDI_FILTER Filter,
3754 IN NDIS_HANDLE NdisFilterHandle);
3755
3756 UINT
3757 EXPIMP
3758 FddiNumberOfOpenFilterShortAddresses(
3759 IN PFDDI_FILTER Filter,
3760 IN NDIS_HANDLE NdisFilterHandle);
3761
3762 VOID
3763 EXPIMP
3764 FddiQueryGlobalFilterLongAddresses(
3765 OUT PNDIS_STATUS Status,
3766 IN PFDDI_FILTER Filter,
3767 IN UINT SizeOfArray,
3768 OUT PUINT NumberOfAddresses,
3769 IN OUT CHAR AddressArray[] [FDDI_LENGTH_OF_LONG_ADDRESS]);
3770
3771 VOID
3772 EXPIMP
3773 FddiQueryGlobalFilterShortAddresses(
3774 OUT PNDIS_STATUS Status,
3775 IN PFDDI_FILTER Filter,
3776 IN UINT SizeOfArray,
3777 OUT PUINT NumberOfAddresses,
3778 IN OUT CHAR AddressArray[] [FDDI_LENGTH_OF_SHORT_ADDRESS]);
3779
3780 VOID
3781 EXPIMP
3782 FddiQueryOpenFilterLongAddresses(
3783 OUT PNDIS_STATUS Status,
3784 IN PFDDI_FILTER Filter,
3785 IN NDIS_HANDLE NdisFilterHandle,
3786 IN UINT SizeOfArray,
3787 OUT PUINT NumberOfAddresses,
3788 IN OUT CHAR AddressArray[] [FDDI_LENGTH_OF_LONG_ADDRESS]);
3789
3790 VOID
3791 EXPIMP
3792 FddiQueryOpenFilterShortAddresses(
3793 OUT PNDIS_STATUS Status,
3794 IN PFDDI_FILTER Filter,
3795 IN NDIS_HANDLE NdisFilterHandle,
3796 IN UINT SizeOfArray,
3797 OUT PUINT NumberOfAddresses,
3798 IN OUT CHAR AddressArray[] [FDDI_LENGTH_OF_SHORT_ADDRESS]);
3799
3800 BOOLEAN
3801 EXPIMP
3802 FddiShouldAddressLoopBack(
3803 IN PFDDI_FILTER Filter,
3804 IN CHAR Address[],
3805 IN UINT LengthOfAddress);
3806
3807
3808 /* Token Ring */
3809
3810 #define TR_LENGTH_OF_FUNCTIONAL 4
3811 #define TR_LENGTH_OF_ADDRESS 6
3812
3813 DECLARE_UNKNOWN_STRUCT(TR_FILTER)
3814
3815 typedef VOID (*TR_ADDRESS_CHANGE)(VOID);
3816 typedef VOID (*TR_GROUP_CHANGE)(VOID);
3817 typedef VOID (*TR_FILTER_CHANGE)(VOID);
3818 typedef VOID (*TR_DEFERRED_CLOSE)(VOID);
3819
3820
3821 NDIS_STATUS
3822 EXPIMP
3823 TrChangeFunctionalAddress(
3824 IN PTR_FILTER Filter,
3825 IN NDIS_HANDLE NdisFilterHandle,
3826 IN PNDIS_REQUEST NdisRequest,
3827 IN CHAR FunctionalAddressArray[TR_LENGTH_OF_FUNCTIONAL],
3828 IN BOOLEAN Set);
3829
3830 NDIS_STATUS
3831 EXPIMP
3832 TrChangeGroupAddress(
3833 IN PTR_FILTER Filter,
3834 IN NDIS_HANDLE NdisFilterHandle,
3835 IN PNDIS_REQUEST NdisRequest,
3836 IN CHAR GroupAddressArray[TR_LENGTH_OF_FUNCTIONAL],
3837 IN BOOLEAN Set);
3838
3839 BOOLEAN
3840 EXPIMP
3841 TrCreateFilter(
3842 IN TR_ADDRESS_CHANGE AddressChangeAction,
3843 IN TR_GROUP_CHANGE GroupChangeAction,
3844 IN TR_FILTER_CHANGE FilterChangeAction,
3845 IN TR_DEFERRED_CLOSE CloseAction,
3846 IN PUCHAR AdapterAddress,
3847 IN PNDIS_SPIN_LOCK Lock,
3848 OUT PTR_FILTER *Filter);
3849
3850 VOID
3851 EXPIMP
3852 TrDeleteFilter(
3853 IN PTR_FILTER Filter);
3854
3855 NDIS_STATUS
3856 EXPIMP
3857 TrDeleteFilterOpenAdapter (
3858 IN PTR_FILTER Filter,
3859 IN NDIS_HANDLE NdisFilterHandle,
3860 IN PNDIS_REQUEST NdisRequest);
3861
3862 NDIS_STATUS
3863 EXPIMP
3864 TrFilterAdjust(
3865 IN PTR_FILTER Filter,
3866 IN NDIS_HANDLE NdisFilterHandle,
3867 IN PNDIS_REQUEST NdisRequest,
3868 IN UINT FilterClasses,
3869 IN BOOLEAN Set);
3870
3871 VOID
3872 EXPIMP
3873 TrFilterIndicateReceive(
3874 IN PTR_FILTER Filter,
3875 IN NDIS_HANDLE MacReceiveContext,
3876 IN PVOID HeaderBuffer,
3877 IN UINT HeaderBufferSize,
3878 IN PVOID LookaheadBuffer,
3879 IN UINT LookaheadBufferSize,
3880 IN UINT PacketSize);
3881
3882 VOID
3883 EXPIMP
3884 TrFilterIndicateReceiveComplete(
3885 IN PTR_FILTER Filter);
3886
3887 BOOLEAN
3888 EXPIMP
3889 TrNoteFilterOpenAdapter(
3890 IN PTR_FILTER Filter,
3891 IN NDIS_HANDLE MacBindingHandle,
3892 IN NDIS_HANDLE NdisBindingContext,
3893 OUT PNDIS_HANDLE NdisFilterHandle);
3894
3895 BOOLEAN
3896 EXPIMP
3897 TrShouldAddressLoopBack(
3898 IN PTR_FILTER Filter,
3899 IN CHAR DestinationAddress[TR_LENGTH_OF_ADDRESS],
3900 IN CHAR SourceAddress[TR_LENGTH_OF_ADDRESS]);
3901
3902
3903
3904 #ifdef _MSC_VER
3905 typedef struct _NDIS30_MINIPORT_CHARACTERISTICS
3906 {
3907 UCHAR MajorNdisVersion;
3908 UCHAR MinorNdisVersion;
3909 UINT Reserved;
3910 W_CHECK_FOR_HANG_HANDLER CheckForHangHandler;
3911 W_DISABLE_INTERRUPT_HANDLER DisableInterruptHandler;
3912 W_ENABLE_INTERRUPT_HANDLER EnableInterruptHandler;
3913 W_HALT_HANDLER HaltHandler;
3914 W_HANDLE_INTERRUPT_HANDLER HandleInterruptHandler;
3915 W_INITIALIZE_HANDLER InitializeHandler;
3916 W_ISR_HANDLER ISRHandler;
3917 W_QUERY_INFORMATION_HANDLER QueryInformationHandler;
3918 W_RECONFIGURE_HANDLER ReconfigureHandler;
3919 W_RESET_HANDLER ResetHandler;
3920 union
3921 {
3922 W_SEND_HANDLER SendHandler;
3923 WM_SEND_HANDLER WanSendHandler;
3924 } u1;
3925 W_SET_INFORMATION_HANDLER SetInformationHandler;
3926 union
3927 {
3928 W_TRANSFER_DATA_HANDLER TransferDataHandler;
3929 WM_TRANSFER_DATA_HANDLER WanTransferDataHandler;
3930 } u2;
3931 } NDIS30_MINIPORT_CHARACTERISTICS;
3932 typedef NDIS30_MINIPORT_CHARACTERISTICS NDIS30_MINIPORT_CHARACTERISTICS_S;
3933 #else
3934 #define NDIS30_MINIPORT_CHARACTERISTICS \
3935 UCHAR MajorNdisVersion; \
3936 UCHAR MinorNdisVersion; \
3937 UINT Reserved; \
3938 W_CHECK_FOR_HANG_HANDLER CheckForHangHandler; \
3939 W_DISABLE_INTERRUPT_HANDLER DisableInterruptHandler; \
3940 W_ENABLE_INTERRUPT_HANDLER EnableInterruptHandler; \
3941 W_HALT_HANDLER HaltHandler; \
3942 W_HANDLE_INTERRUPT_HANDLER HandleInterruptHandler; \
3943 W_INITIALIZE_HANDLER InitializeHandler; \
3944 W_ISR_HANDLER ISRHandler; \
3945 W_QUERY_INFORMATION_HANDLER QueryInformationHandler; \
3946 W_RECONFIGURE_HANDLER ReconfigureHandler; \
3947 W_RESET_HANDLER ResetHandler; \
3948 union \
3949 { \
3950 W_SEND_HANDLER SendHandler; \
3951 WM_SEND_HANDLER WanSendHandler; \
3952 } u1; \
3953 W_SET_INFORMATION_HANDLER SetInformationHandler; \
3954 union \
3955 { \
3956 W_TRANSFER_DATA_HANDLER TransferDataHandler; \
3957 WM_TRANSFER_DATA_HANDLER WanTransferDataHandler; \
3958 } u2;
3959 typedef struct _NDIS30_MINIPORT_CHARACTERISTICS_S
3960 {
3961 NDIS30_MINIPORT_CHARACTERISTICS;
3962 } NDIS30_MINIPORT_CHARACTERISTICS_S, *PSNDIS30_MINIPORT_CHARACTERISTICS_S;
3963 #endif
3964
3965 /* Extensions for NDIS 4.0 miniports */
3966
3967 typedef VOID (*W_SEND_PACKETS_HANDLER)(
3968 IN NDIS_HANDLE MiniportAdapterContext,
3969 IN PPNDIS_PACKET PacketArray,
3970 IN UINT NumberOfPackets);
3971
3972 #ifdef NDIS40
3973
3974 typedef VOID (*W_RETURN_PACKET_HANDLER)(
3975 IN NDIS_HANDLE MiniportAdapterContext,
3976 IN PNDIS_PACKET Packet);
3977
3978 typedef VOID (*W_ALLOCATE_COMPLETE_HANDLER)(
3979 IN NDIS_HANDLE MiniportAdapterContext,
3980 IN PVOID VirtualAddress,
3981 IN PNDIS_PHYSICAL_ADDRESS PhysicalAddress,
3982 IN ULONG Length,
3983 IN PVOID Context);
3984
3985 #ifdef _MSC_VER
3986 typedef struct _NDIS40_MINIPORT_CHARACTERISTICS
3987 {
3988 NDIS30_MINIPORT_CHARACTERISTICS;
3989
3990 W_RETURN_PACKET_HANDLER ReturnPacketHandler;
3991 W_SEND_PACKETS_HANDLER SendPacketsHandler;
3992 W_ALLOCATE_COMPLETE_HANDLER AllocateCompleteHandler;
3993 } NDIS40_MINIPORT_CHARACTERISTICS;
3994 typedef NDIS40_MINIPORT_CHARACTERISTICS NDIS40_MINIPORT_CHARACTERISTICS_S;
3995 #else
3996 #define NDIS40_MINIPORT_CHARACTERISTICS \
3997 NDIS30_MINIPORT_CHARACTERISTICS; \
3998 W_RETURN_PACKET_HANDLER ReturnPacketHandler; \
3999 W_SEND_PACKETS_HANDLER SendPacketsHandler; \
4000 W_ALLOCATE_COMPLETE_HANDLER AllocateCompleteHandler;
4001 typedef struct _NDIS40_MINIPORT_CHARACTERISTICS_S
4002 {
4003 NDIS40_MINIPORT_CHARACTERISTICS;
4004 } NDIS40_MINIPORT_CHARACTERISTICS_S, *PSNDIS40_MINIPORT_CHARACTERISTICS_S;
4005 #endif
4006
4007 #endif /* NDIS40 */
4008
4009 /* Extensions for NDIS 5.0 miniports */
4010
4011 #ifdef NDIS50
4012
4013 typedef NDIS_STATUS (*W_CO_CREATE_VC_HANDLER)(
4014 IN NDIS_HANDLE MiniportAdapterContext,
4015 IN NDIS_HANDLE NdisVcHandle,
4016 OUT PNDIS_HANDLE MiniportVcContext);
4017
4018 typedef NDIS_STATUS (*W_CO_DELETE_VC_HANDLER)(
4019 IN NDIS_HANDLE MiniportVcContext);
4020
4021 typedef NDIS_STATUS (*W_CO_ACTIVATE_VC_HANDLER)(
4022 IN NDIS_HANDLE MiniportVcContext,
4023 IN OUT PCO_CALL_PARAMETERS CallParameters);
4024
4025 typedef NDIS_STATUS (*W_CO_DEACTIVATE_VC_HANDLER)(
4026 IN NDIS_HANDLE MiniportVcContext);
4027
4028 typedef VOID (*W_CO_SEND_PACKETS_HANDLER)(
4029 IN NDIS_HANDLE MiniportVcContext,
4030 IN PPNDIS_PACKET PacketArray,
4031 IN UINT NumberOfPackets);
4032
4033 typedef NDIS_STATUS (*W_CO_REQUEST_HANDLER)(
4034 IN NDIS_HANDLE MiniportAdapterContext,
4035 IN NDIS_HANDLE MiniportVcContext OPTIONAL,
4036 IN OUT PNDIS_REQUEST NdisRequest);
4037
4038 #ifdef _MSC_VER
4039 typedef struct _NDIS50_MINIPORT_CHARACTERISTICS
4040 {
4041 NDIS40_MINIPORT_CHARACTERISTICS;
4042
4043 W_CO_CREATE_VC_HANDLER CoCreateVcHandler;
4044 W_CO_DELETE_VC_HANDLER CoDeleteVcHandler;
4045 W_CO_ACTIVATE_VC_HANDLER CoActivateVcHandler;
4046 W_CO_DEACTIVATE_VC_HANDLER CoDeactivateVcHandler;
4047 W_CO_SEND_PACKETS_HANDLER CoSendPacketsHandler;
4048 W_CO_REQUEST_HANDLER CoRequestHandler;
4049 } NDIS50_MINIPORT_CHARACTERISTICS;
4050 typedef NDIS50_MINIPORT_CHARACTERISTICS NDIS50_MINIPORT_CHARACTERISTICS_S;
4051 #else
4052 #define NDIS50_MINIPORT_CHARACTERISTICS \
4053 NDIS40_MINIPORT_CHARACTERISTICS; \
4054 W_CO_CREATE_VC_HANDLER CoCreateVcHandler; \
4055 W_CO_DELETE_VC_HANDLER CoDeleteVcHandler; \
4056 W_CO_ACTIVATE_VC_HANDLER CoActivateVcHandler; \
4057 W_CO_DEACTIVATE_VC_HANDLER CoDeactivateVcHandler; \
4058 W_CO_SEND_PACKETS_HANDLER CoSendPacketsHandler; \
4059 W_CO_REQUEST_HANDLER CoRequestHandler;
4060 typedef struct _NDIS50_MINIPORT_CHARACTERISTICS_S
4061 {
4062 NDIS50_MINIPORT_CHARACTERISTICS;
4063 } NDIS50_MINIPORT_CHARACTERISTICS_S, *PSNDIS50_MINIPORT_CHARACTERISTICS_S;
4064 #endif
4065
4066 #endif /* NDIS50 */
4067
4068
4069 #ifndef NDIS50
4070 #ifndef NDIS40
4071 typedef struct _NDIS_MINIPORT_CHARACTERISTICS
4072 {
4073 NDIS30_MINIPORT_CHARACTERISTICS;
4074 } NDIS_MINIPORT_CHARACTERISTICS;
4075 #else /* NDIS40 */
4076 typedef struct _NDIS_MINIPORT_CHARACTERISTICS
4077 {
4078 NDIS40_MINIPORT_CHARACTERISTICS;
4079 } NDIS_MINIPORT_CHARACTERISTICS;
4080 #endif /* NDIS40 */
4081 #else /* NDIS50 */
4082 typedef struct _NDIS_MINIPORT_CHARACTERISTICS
4083 {
4084 NDIS50_MINIPORT_CHARACTERISTICS;
4085 } NDIS_MINIPORT_CHARACTERISTICS;
4086 #endif /* NDIS50 */
4087
4088 typedef NDIS_MINIPORT_CHARACTERISTICS *PNDIS_MINIPORT_CHARACTERISTICS;
4089
4090
4091
4092 typedef NDIS_STATUS (*SEND_HANDLER)(
4093 IN NDIS_HANDLE MacBindingHandle,
4094 IN PNDIS_PACKET Packet);
4095
4096 typedef NDIS_STATUS (*TRANSFER_DATA_HANDLER)(
4097 IN NDIS_HANDLE MacBindingHandle,
4098 IN NDIS_HANDLE MacReceiveContext,
4099 IN UINT ByteOffset,
4100 IN UINT BytesToTransfer,
4101 OUT PNDIS_PACKET Packet,
4102 OUT PUINT BytesTransferred);
4103
4104 typedef NDIS_STATUS (*RESET_HANDLER)(
4105 IN NDIS_HANDLE MacBindingHandle);
4106
4107 typedef NDIS_STATUS (*REQUEST_HANDLER)(
4108 IN NDIS_HANDLE MacBindingHandle,
4109 IN PNDIS_REQUEST NdisRequest);
4110
4111
4112
4113 /* Structures available only to full MAC drivers */
4114
4115 typedef BOOLEAN (*PNDIS_INTERRUPT_SERVICE)(
4116 IN PVOID InterruptContext);
4117
4118 typedef VOID (*PNDIS_DEFERRED_PROCESSING)(
4119 IN PVOID SystemSpecific1,
4120 IN PVOID InterruptContext,
4121 IN PVOID SystemSpecific2,
4122 IN PVOID SystemSpecific3);
4123
4124
4125 typedef struct _NDIS_INTERRUPT
4126 {
4127 PKINTERRUPT InterruptObject;
4128 KSPIN_LOCK DpcCountLock;
4129 PNDIS_INTERRUPT_SERVICE MacIsr;
4130 PNDIS_DEFERRED_PROCESSING MacDpc;
4131 KDPC InterruptDpc;
4132 PVOID InterruptContext;
4133 UCHAR DpcCount;
4134 BOOLEAN Removing;
4135 /* Used to tell when all DPCs for the adapter are completed */
4136 KEVENT DpcsCompletedEvent;
4137 } NDIS_INTERRUPT, *PNDIS_INTERRUPT;
4138
4139
4140 /* NDIS adapter information */
4141
4142 typedef NDIS_STATUS (*PNDIS_ACTIVATE_CALLBACK)(
4143 IN NDIS_HANDLE NdisAdatperHandle,
4144 IN NDIS_HANDLE MacAdapterContext,
4145 IN ULONG DmaChannel);
4146
4147 typedef struct _NDIS_PORT_DESCRIPTOR
4148 {
4149 ULONG InitialPort;
4150 ULONG NumberOfPorts;
4151 PVOID * PortOffset;
4152 } NDIS_PORT_DESCRIPTOR, *PNDIS_PORT_DESCRIPTOR;
4153
4154 typedef struct _NDIS_ADAPTER_INFORMATION
4155 {
4156 ULONG DmaChannel;
4157 BOOLEAN Master;
4158 BOOLEAN Dma32BitAddresses;
4159 PNDIS_ACTIVATE_CALLBACK ActivateCallback;
4160 NDIS_INTERFACE_TYPE AdapterType;
4161 ULONG PhysicalMapRegistersNeeded;
4162 ULONG MaximumPhysicalMapping;
4163 ULONG NumberOfPortDescriptors;
4164 NDIS_PORT_DESCRIPTOR PortDescriptors[1];
4165 } NDIS_ADAPTER_INFORMATION, *PNDIS_ADAPTER_INFORMATION;
4166
4167
4168 /* Prototypes for NDIS_MAC_CHARACTERISTICS */
4169
4170 typedef NDIS_STATUS (*OPEN_ADAPTER_HANDLER)(
4171 OUT PNDIS_STATUS OpenErrorStatus,
4172 OUT NDIS_HANDLE * MacBindingHandle,
4173 OUT PUINT SelectedMediumIndex,
4174 IN PNDIS_MEDIUM MediumArray,
4175 IN UINT MediumArraySize,
4176 IN NDIS_HANDLE NdisBindingContext,
4177 IN NDIS_HANDLE MacAdapterContext,
4178 IN UINT OpenOptions,
4179 IN PSTRING AddressingInformation OPTIONAL);
4180
4181 typedef NDIS_STATUS (*CLOSE_ADAPTER_HANDLER)(
4182 IN NDIS_HANDLE MacBindingHandle);
4183
4184 typedef NDIS_STATUS (*WAN_TRANSFER_DATA_HANDLER)(
4185 VOID);
4186
4187 typedef NDIS_STATUS (*QUERY_GLOBAL_STATISTICS_HANDLER)(
4188 IN NDIS_HANDLE MacAdapterContext,
4189 IN PNDIS_REQUEST NdisRequest);
4190
4191 typedef VOID (*UNLOAD_MAC_HANDLER)(
4192 IN NDIS_HANDLE MacMacContext);
4193
4194 typedef NDIS_STATUS (*ADD_ADAPTER_HANDLER)(
4195 IN NDIS_HANDLE MacMacContext,
4196 IN NDIS_HANDLE WrapperConfigurationContext,
4197 IN PNDIS_STRING AdapterName);
4198
4199 typedef VOID (*REMOVE_ADAPTER_HANDLER)(
4200 IN NDIS_HANDLE MacAdapterContext);
4201
4202 typedef struct _NDIS_MAC_CHARACTERISTICS
4203 {
4204 UCHAR MajorNdisVersion;
4205 UCHAR MinorNdisVersion;
4206 UINT Reserved;
4207 OPEN_ADAPTER_HANDLER OpenAdapterHandler;
4208 CLOSE_ADAPTER_HANDLER CloseAdapterHandler;
4209 SEND_HANDLER SendHandler;
4210 TRANSFER_DATA_HANDLER TransferDataHandler;
4211 RESET_HANDLER ResetHandler;
4212 REQUEST_HANDLER RequestHandler;
4213 QUERY_GLOBAL_STATISTICS_HANDLER QueryGlobalStatisticsHandler;
4214 UNLOAD_MAC_HANDLER UnloadMacHandler;
4215 ADD_ADAPTER_HANDLER AddAdapterHandler;
4216 REMOVE_ADAPTER_HANDLER RemoveAdapterHandler;
4217 NDIS_STRING Name;
4218 } NDIS_MAC_CHARACTERISTICS, *PNDIS_MAC_CHARACTERISTICS;
4219
4220 typedef NDIS_MAC_CHARACTERISTICS NDIS_WAN_MAC_CHARACTERISTICS;
4221 typedef NDIS_WAN_MAC_CHARACTERISTICS *PNDIS_WAN_MAC_CHARACTERISTICS;
4222
4223
4224
4225 VOID
4226 EXPIMP
4227 NdisAllocateSharedMemory(
4228 IN NDIS_HANDLE NdisAdapterHandle,
4229 IN ULONG Length,
4230 IN BOOLEAN Cached,
4231 OUT PVOID *VirtualAddress,
4232 OUT PNDIS_PHYSICAL_ADDRESS PhysicalAddress);
4233
4234 VOID
4235 EXPIMP
4236 NdisCompleteCloseAdapter(
4237 IN NDIS_HANDLE NdisBindingContext,
4238 IN NDIS_STATUS Status);
4239
4240 VOID
4241 EXPIMP
4242 NdisCompleteOpenAdapter(
4243 IN NDIS_HANDLE NdisBindingContext,
4244 IN NDIS_STATUS Status,
4245 IN NDIS_STATUS OpenErrorStatus);
4246
4247 NDIS_STATUS
4248 EXPIMP
4249 NdisDeregisterAdapter(
4250 IN NDIS_HANDLE NdisAdapterHandle);
4251
4252 VOID
4253 EXPIMP
4254 NdisDeregisterAdapterShutdownHandler(
4255 IN NDIS_HANDLE NdisAdapterHandle);
4256
4257 VOID
4258 EXPIMP
4259 NdisFreeSharedMemory(
4260 IN NDIS_HANDLE NdisAdapterHandle,
4261 IN ULONG Length,
4262 IN BOOLEAN Cached,
4263 IN PVOID VirtualAddress,
4264 IN NDIS_PHYSICAL_ADDRESS PhysicalAddress);
4265
4266 VOID
4267 EXPIMP
4268 NdisInitializeInterrupt(
4269 OUT PNDIS_STATUS Status,
4270 IN OUT PNDIS_INTERRUPT Interrupt,
4271 IN NDIS_HANDLE NdisAdapterHandle,
4272 IN PNDIS_INTERRUPT_SERVICE InterruptServiceRoutine,
4273 IN PVOID InterruptContext,
4274 IN PNDIS_DEFERRED_PROCESSING DeferredProcessingRoutine,
4275 IN UINT InterruptVector,
4276 IN UINT InterruptLevel,
4277 IN BOOLEAN SharedInterrupt,
4278 IN NDIS_INTERRUPT_MODE InterruptMode);
4279
4280 VOID
4281 EXPIMP
4282 NdisMapIoSpace(
4283 OUT PNDIS_STATUS Status,
4284 OUT PVOID *VirtualAddress,
4285 IN NDIS_HANDLE NdisAdapterHandle,
4286 IN NDIS_PHYSICAL_ADDRESS PhysicalAddress,
4287 IN UINT Length);
4288
4289 NDIS_STATUS
4290 EXPIMP
4291 NdisRegisterAdapter(
4292 OUT PNDIS_HANDLE NdisAdapterHandle,
4293 IN NDIS_HANDLE NdisMacHandle,
4294 IN NDIS_HANDLE MacAdapterContext,
4295 IN NDIS_HANDLE WrapperConfigurationContext,
4296 IN PNDIS_STRING AdapterName,
4297 IN PVOID AdapterInformation);
4298
4299 VOID
4300 EXPIMP
4301 NdisRegisterAdapterShutdownHandler(
4302 IN NDIS_HANDLE NdisAdapterHandle,
4303 IN PVOID ShutdownContext,
4304 IN ADAPTER_SHUTDOWN_HANDLER ShutdownHandler);
4305
4306 VOID
4307 EXPIMP
4308 NdisRegisterMac(
4309 OUT PNDIS_STATUS Status,
4310 OUT PNDIS_HANDLE NdisMacHandle,
4311 IN NDIS_HANDLE NdisWrapperHandle,
4312 IN NDIS_HANDLE MacMacContext,
4313 IN PNDIS_MAC_CHARACTERISTICS MacCharacteristics,
4314 IN UINT CharacteristicsLength);
4315
4316 VOID
4317 EXPIMP
4318 NdisReleaseAdapterResources(
4319 IN NDIS_HANDLE NdisAdapterHandle);
4320
4321 VOID
4322 EXPIMP
4323 NdisRemoveInterrupt(
4324 IN PNDIS_INTERRUPT Interrupt);
4325
4326
4327
4328 typedef struct _NDIS_MAC_BLOCK NDIS_MAC_BLOCK, *PNDIS_MAC_BLOCK;
4329 typedef struct _NDIS_ADAPTER_BLOCK NDIS_ADAPTER_BLOCK, *PNDIS_ADAPTER_BLOCK;
4330 typedef struct _NDIS_MINIPORT_BLOCK NDIS_MINIPORT_BLOCK, *PNDIS_MINIPORT_BLOCK;
4331 typedef struct _NDIS_PROTOCOL_BLOCK NDIS_PROTOCOL_BLOCK, *PNDIS_PROTOCOL_BLOCK;
4332 typedef struct _NDIS_OPEN_BLOCK NDIS_OPEN_BLOCK, *PNDIS_OPEN_BLOCK;
4333 typedef struct _NDIS_M_DRIVER_BLOCK NDIS_M_DRIVER_BLOCK, *PNDIS_M_DRIVER_BLOCK;
4334 typedef struct _NDIS_AF_LIST NDIS_AF_LIST, *PNDIS_AF_LIST;
4335 typedef struct _NULL_FILTER NULL_FILTER, *PNULL_FILTER;
4336
4337
4338 typedef struct _REFERENCE
4339 {
4340 KSPIN_LOCK SpinLock;
4341 USHORT ReferenceCount;
4342 BOOLEAN Closing;
4343 } REFERENCE, *PREFERENCE;
4344
4345 typedef struct _NDIS_MINIPORT_INTERRUPT
4346 {
4347 PKINTERRUPT InterruptObject;
4348 KSPIN_LOCK DpcCountLock;
4349 PVOID MiniportIdField;
4350 W_ISR_HANDLER MiniportIsr;
4351 W_HANDLE_INTERRUPT_HANDLER MiniportDpc;
4352 KDPC InterruptDpc;
4353 PNDIS_MINIPORT_BLOCK Miniport;
4354
4355 UCHAR DpcCount;
4356 BOOLEAN Filler1;
4357
4358 KEVENT DpcsCompletedEvent;
4359
4360 BOOLEAN SharedInterrupt;
4361 BOOLEAN IsrRequested;
4362 } NDIS_MINIPORT_INTERRUPT, *PNDIS_MINIPORT_INTERRUPT;
4363
4364 typedef struct _NDIS_MINIPORT_TIMER
4365 {
4366 KTIMER Timer;
4367 KDPC Dpc;
4368 PNDIS_TIMER_FUNCTION MiniportTimerFunction;
4369 PVOID MiniportTimerContext;
4370 PNDIS_MINIPORT_BLOCK Miniport;
4371 struct _NDIS_MINIPORT_TIMER *NextDeferredTimer;
4372 } NDIS_MINIPORT_TIMER, *PNDIS_MINIPORT_TIMER;
4373
4374
4375 typedef struct _MAP_REGISTER_ENTRY
4376 {
4377 PVOID MapRegister;
4378 BOOLEAN WriteToDevice;
4379 } MAP_REGISTER_ENTRY, *PMAP_REGISTER_ENTRY;
4380
4381
4382 typedef enum _NDIS_WORK_ITEM_TYPE
4383 {
4384 NdisWorkItemRequest,
4385 NdisWorkItemSend,
4386 NdisWorkItemReturnPackets,
4387 NdisWorkItemResetRequested,
4388 NdisWorkItemResetInProgress,
4389 NdisWorkItemHalt,
4390 NdisWorkItemSendLoopback,
4391 NdisWorkItemMiniportCallback,
4392 NdisMaxWorkItems
4393 } NDIS_WORK_ITEM_TYPE, *PNDIS_WORK_ITEM_TYPE;
4394
4395 #define NUMBER_OF_WORK_ITEM_TYPES NdisMaxWorkItems
4396 #define NUMBER_OF_SINGLE_WORK_ITEMS 6
4397
4398 typedef struct _NDIS_MINIPORT_WORK_ITEM
4399 {
4400 SINGLE_LIST_ENTRY Link;
4401 NDIS_WORK_ITEM_TYPE WorkItemType;
4402 PVOID WorkItemContext;
4403 BOOLEAN Allocated;
4404 NDIS_HANDLE Initiator;
4405 } NDIS_MINIPORT_WORK_ITEM, *PNDIS_MINIPORT_WORK_ITEM;
4406
4407
4408 typedef struct _NDIS_BIND_PATHS
4409 {
4410 UINT Number;
4411 NDIS_STRING Paths[1];
4412 } NDIS_BIND_PATHS, *PNDIS_BIND_PATHS;
4413
4414 typedef struct _FILTERDBS
4415 {
4416 union
4417 {
4418 PETH_FILTER EthDB;
4419 PNULL_FILTER NullDB;
4420 } u;
4421 PTR_FILTER TrDB;
4422 PFDDI_FILTER FddiDB;
4423 PARC_FILTER ArcDB;
4424 } FILTERDBS, *PFILTERDBS;
4425
4426
4427 typedef VOID (*ETH_RCV_COMPLETE_HANDLER)(
4428 IN PETH_FILTER Filter);
4429
4430 typedef VOID (*ETH_RCV_INDICATE_HANDLER)(
4431 IN PETH_FILTER Filter,
4432 IN NDIS_HANDLE MacReceiveContext,
4433 IN PCHAR Address,
4434 IN PVOID HeaderBuffer,
4435 IN UINT HeaderBufferSize,
4436 IN PVOID LookaheadBuffer,
4437 IN UINT LookaheadBufferSize,
4438 IN UINT PacketSize);
4439
4440 typedef VOID (*FDDI_RCV_COMPLETE_HANDLER)(
4441 IN PFDDI_FILTER Filter);
4442
4443 typedef VOID (*FDDI_RCV_INDICATE_HANDLER)(
4444 IN PFDDI_FILTER Filter,
4445 IN NDIS_HANDLE MacReceiveContext,
4446 IN PCHAR Address,
4447 IN UINT AddressLength,
4448 IN PVOID HeaderBuffer,
4449 IN UINT HeaderBufferSize,
4450 IN PVOID LookaheadBuffer,
4451 IN UINT LookaheadBufferSize,
4452 IN UINT PacketSize);
4453
4454 typedef VOID STDCALL (*FILTER_PACKET_INDICATION_HANDLER)(
4455 IN NDIS_HANDLE Miniport,
4456 IN PPNDIS_PACKET PacketArray,
4457 IN UINT NumberOfPackets);
4458
4459 typedef VOID (*TR_RCV_COMPLETE_HANDLER)(
4460 IN PTR_FILTER Filter);
4461
4462 typedef VOID (*TR_RCV_INDICATE_HANDLER)(
4463 IN PTR_FILTER Filter,
4464 IN NDIS_HANDLE MacReceiveContext,
4465 IN PVOID HeaderBuffer,
4466 IN UINT HeaderBufferSize,
4467 IN PVOID LookaheadBuffer,
4468 IN UINT LookaheadBufferSize,
4469 IN UINT PacketSize);
4470
4471 typedef VOID (*WAN_RCV_COMPLETE_HANDLER)(
4472 IN NDIS_HANDLE MiniportAdapterHandle,
4473 IN NDIS_HANDLE NdisLinkContext);
4474
4475 typedef VOID (*WAN_RCV_HANDLER)(
4476 OUT PNDIS_STATUS Status,
4477 IN NDIS_HANDLE MiniportAdapterHandle,
4478 IN NDIS_HANDLE NdisLinkContext,
4479 IN PUCHAR Packet,
4480 IN ULONG PacketSize);
4481
4482 typedef VOID (FASTCALL *NDIS_M_DEQUEUE_WORK_ITEM)(
4483 IN PNDIS_MINIPORT_BLOCK Miniport,
4484 IN NDIS_WORK_ITEM_TYPE WorkItemType,
4485 OUT PVOID *WorkItemContext);
4486
4487 typedef VOID (FASTCALL *NDIS_M_PROCESS_DEFERRED)(
4488 IN PNDIS_MINIPORT_BLOCK Miniport);
4489
4490 typedef NDIS_STATUS (FASTCALL *NDIS_M_QUEUE_NEW_WORK_ITEM)(
4491 IN PNDIS_MINIPORT_BLOCK Miniport,
4492 IN NDIS_WORK_ITEM_TYPE WorkItemType,
4493 IN PVOID WorkItemContext);
4494
4495 typedef NDIS_STATUS (FASTCALL *NDIS_M_QUEUE_WORK_ITEM)(
4496 IN PNDIS_MINIPORT_BLOCK Miniport,
4497 IN NDIS_WORK_ITEM_TYPE WorkItemType,
4498 IN PVOID WorkItemContext);
4499
4500 typedef VOID (*NDIS_M_REQ_COMPLETE_HANDLER)(
4501 IN NDIS_HANDLE MiniportAdapterHandle,
4502 IN NDIS_STATUS Status);
4503
4504 typedef VOID (*NDIS_M_RESET_COMPLETE_HANDLER)(
4505 IN NDIS_HANDLE MiniportAdapterHandle,
4506 IN NDIS_STATUS Status,
4507 IN BOOLEAN AddressingReset);
4508
4509 typedef VOID (*NDIS_M_SEND_COMPLETE_HANDLER)(
4510 IN NDIS_HANDLE MiniportAdapterHandle,
4511 IN PNDIS_PACKET Packet,
4512 IN NDIS_STATUS Status);
4513
4514 typedef VOID (*NDIS_M_SEND_RESOURCES_HANDLER)(
4515 IN NDIS_HANDLE MiniportAdapterHandle);
4516
4517 typedef BOOLEAN (FASTCALL *NDIS_M_START_SENDS)(
4518 IN PNDIS_MINIPORT_BLOCK Miniport);
4519
4520 typedef VOID (*NDIS_M_STATUS_HANDLER)(
4521 IN NDIS_HANDLE MiniportHandle,
4522 IN NDIS_STATUS GeneralStatus,
4523 IN PVOID StatusBuffer,
4524 IN UINT StatusBufferSize);
4525
4526 typedef VOID (*NDIS_M_STS_COMPLETE_HANDLER)(
4527 IN NDIS_HANDLE MiniportAdapterHandle);
4528
4529 typedef VOID (*NDIS_M_TD_COMPLETE_HANDLER)(
4530 IN NDIS_HANDLE MiniportAdapterHandle,
4531 IN PNDIS_PACKET Packet,
4532 IN NDIS_STATUS Status,
4533 IN UINT BytesTransferred);
4534
4535 typedef VOID (*NDIS_WM_SEND_COMPLETE_HANDLER)(
4536 IN NDIS_HANDLE MiniportAdapterHandle,
4537 IN PVOID Packet,
4538 IN NDIS_STATUS Status);
4539
4540
4541 #ifdef NDIS_WRAPPER
4542
4543 #define ARC_SEND_BUFFERS 8
4544 #define ARC_HEADER_SIZE 4
4545
4546 typedef struct _NDIS_ARC_BUF
4547 {
4548 NDIS_HANDLE ArcnetBufferPool;
4549 PUCHAR ArcnetLookaheadBuffer;
4550 UINT NumFree;
4551 ARC_BUFFER_LIST ArcnetBuffers[ARC_SEND_BUFFERS];
4552 } NDIS_ARC_BUF, *PNDIS_ARC_BUF;
4553
4554 #define NDIS_MINIPORT_WORK_QUEUE_SIZE 10
4555
4556 typedef struct _NDIS_LOG
4557 {
4558 PNDIS_MINIPORT_BLOCK Miniport;
4559 KSPIN_LOCK LogLock;
4560 PIRP Irp;
4561 UINT TotalSize;
4562 UINT CurrentSize;
4563 UINT InPtr;
4564 UINT OutPtr;
4565 UCHAR LogBuf[1];
4566 } NDIS_LOG, *PNDIS_LOG;
4567
4568 #endif /* NDIS_WRAPPER */
4569
4570
4571 struct _NDIS_ADAPTER_BLOCK
4572 {
4573 PDEVICE_OBJECT DeviceObject;
4574 PNDIS_MAC_BLOCK MacHandle;
4575 NDIS_HANDLE MacAdapterContext;
4576 NDIS_STRING AdapterName;
4577 PNDIS_OPEN_BLOCK OpenQueue;
4578 PNDIS_ADAPTER_BLOCK NextAdapter;
4579 REFERENCE Ref;
4580 PVOID BusDataContext;
4581 BOOLEAN BeingRemoved;
4582 UCHAR Flags;
4583 PCM_RESOURCE_LIST Resources;
4584 PNDIS_STRING pAdapterInstanceName;
4585 PVOID WrapperContext;
4586
4587 ULONG BusNumber;
4588 NDIS_INTERFACE_TYPE BusType;
4589 ULONG ChannelNumber;
4590 NDIS_INTERFACE_TYPE AdapterType;
4591 BOOLEAN Master;
4592 UCHAR AssignedProcessor;
4593 ULONG PhysicalMapRegistersNeeded;
4594 ULONG MaximumPhysicalMapping;
4595 ULONG InitialPort;
4596 ULONG NumberOfPorts;
4597 PUCHAR InitialPortMapping;
4598 BOOLEAN InitialPortMapped;
4599 PUCHAR PortOffset;
4600 PMAP_REGISTER_ENTRY MapRegisters;
4601
4602 KEVENT AllocationEvent;
4603 UINT CurrentMapRegister;
4604 PADAPTER_OBJECT SystemAdapterObject;
4605 #if 0
4606 #ifdef NDIS_WRAPPER
4607 ULONG BusId;
4608 ULONG SlotNumber;
4609 NDIS_STRING BaseName;
4610 PDEVICE_OBJECT PhysicalDeviceObject;
4611 PDEVICE_OBJECT NextDeviceObject;
4612 PCM_RESOURCE_LIST AllocatedResources;
4613 PCM_RESOURCE_LIST AllocatedResourcesTranslated;
4614 NDIS_EVENT OpenReadyEvent;
4615 NDIS_PNP_DEVICE_STATE PnPDeviceState;
4616 PGET_SET_DEVICE_DATA SetBusData;
4617 PGET_SET_DEVICE_DATA GetBusData;
4618 POID_LIST OidList;
4619 ULONG PnPCapabilities;
4620 #endif /* NDIS_WRAPPER */
4621 #endif
4622 };
4623
4624
4625 struct _NDIS_MINIPORT_BLOCK
4626 {
4627 ULONG NullValue;
4628 PNDIS_MINIPORT_BLOCK NextMiniport;
4629 PNDIS_M_DRIVER_BLOCK DriverHandle;
4630 NDIS_HANDLE MiniportAdapterContext;
4631 UNICODE_STRING MiniportName;
4632 PNDIS_BIND_PATHS BindPaths;
4633 NDIS_HANDLE OpenQueue;
4634 REFERENCE Ref;
4635 NDIS_HANDLE DeviceContext;
4636 UCHAR Padding1;
4637
4638 UCHAR LockAcquired;
4639 UCHAR PmodeOpens;
4640 UCHAR AssignedProcessor