source: Daodan/MSYS2/mingw32/i686-w64-mingw32/include/ddk/ndis.h@ 1181

Last change on this file since 1181 was 1166, checked in by rossy, 3 years ago

Daodan: Replace MinGW build env with an up-to-date MSYS2 env

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