4 * Copyright 2015 Austin English
5 * Copyright 2016 André Hentschel
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 typedef ULONG NDIS_AF
, *PNDIS_AF
;
25 typedef MDL NDIS_BUFFER
, *PNDIS_BUFFER
;
26 typedef void *NDIS_HANDLE
, **PNDIS_HANDLE
, *PNDIS_PACKET_POOL
;
27 typedef ULONG NDIS_OID
, *PNDIS_OID
;
28 typedef int NDIS_STATUS
, *PNDIS_STATUS
;
29 typedef UNICODE_STRING NDIS_STRING
, *PNDIS_STRING
;
33 typedef enum _NDIS_REQUEST_TYPE
35 NdisRequestQueryInformation
,
36 NdisRequestSetInformation
,
37 NdisRequestQueryStatistics
,
41 NdisRequestTransferData
,
48 } NDIS_REQUEST_TYPE
, *PNDIS_REQUEST_TYPE
;
50 typedef enum _NET_PNP_EVENT_CODE
54 NetEventQueryRemoveDevice
,
55 NetEventCancelRemoveDevice
,
58 NetEventBindsComplete
,
59 NetEventPnPCapabilities
,
62 NetEventPortActivation
,
63 NetEventPortDeactivation
,
64 NetEventIMReEnableDevice
,
66 } NET_PNP_EVENT_CODE
, *PNET_PNP_EVENT_CODE
;
69 typedef struct _NET_PNP_EVENT
71 NET_PNP_EVENT_CODE NetEvent
;
74 ULONG_PTR NdisReserved
[4];
75 ULONG_PTR TransportReserved
[4];
76 ULONG_PTR TdiReserved
[4];
77 ULONG_PTR TdiClientReserved
[4];
78 } NET_PNP_EVENT
, *PNET_PNP_EVENT
;
80 typedef struct _NDIS_PACKET_PRIVATE
86 PNDIS_PACKET_POOL Pool
;
90 UCHAR NdisPacketFlags
;
91 USHORT NdisPacketOobOffset
;
92 } NDIS_PACKET_PRIVATE
, *PNDIS_PACKET_PRIVATE
;
94 typedef struct _NDIS_PACKET
96 NDIS_PACKET_PRIVATE Private
;
101 UCHAR MiniportReserved
[2 * sizeof(void*)];
102 UCHAR WrapperReserved
[2 * sizeof(void*)];
106 UCHAR MiniportReservedEx
[3 * sizeof(void*)];
107 UCHAR WrapperReservedEx
[sizeof(void*)];
111 UCHAR MacReserved
[4 * sizeof(void*)];
114 ULONG_PTR Reserved
[2];
115 UCHAR ProtocolReserved
[1];
116 } NDIS_PACKET
, *PNDIS_PACKET
, **PPNDIS_PACKET
;
118 typedef struct _NDIS_SPIN_LOCK
122 } NDIS_SPIN_LOCK
, *PNDIS_SPIN_LOCK
;
125 typedef struct _NDIS_REQUEST
127 UCHAR MacReserved
[4 * sizeof(void*)];
128 NDIS_REQUEST_TYPE RequestType
;
131 struct QUERY_INFORMATION
134 PVOID InformationBuffer
;
135 UINT InformationBufferLength
;
139 struct SET_INFORMATION
142 PVOID InformationBuffer
;
143 UINT InformationBufferLength
;
148 UCHAR NdisReserved
[9 * sizeof(void*)];
151 UCHAR CallMgrReserved
[2 * sizeof(void*)];
152 UCHAR ProtocolReserved
[2 * sizeof(void*)];
154 UCHAR MiniportReserved
[2 * sizeof(void*)];
155 } NDIS_REQUEST
, *PNDIS_REQUEST
;
157 typedef struct _CO_ADDRESS_FAMILY
159 NDIS_AF AddressFamily
;
162 } CO_ADDRESS_FAMILY
, *PCO_ADDRESS_FAMILY
;
165 typedef void (NTAPI
*CO_AF_REGISTER_NOTIFY_HANDLER
)(NDIS_HANDLE
, PCO_ADDRESS_FAMILY
);
166 typedef void (NTAPI
*CO_SEND_COMPLETE_HANDLER
)(NDIS_STATUS
, NDIS_HANDLE
, PNDIS_PACKET
);
167 typedef void (NTAPI
*CO_STATUS_HANDLER
)(NDIS_HANDLE
, NDIS_HANDLE
, NDIS_STATUS
, PVOID
, UINT
);
168 typedef UINT (NTAPI
*CO_RECEIVE_PACKET_HANDLER
)(NDIS_HANDLE
, NDIS_HANDLE
, PNDIS_PACKET
);
169 typedef void (NTAPI
*OPEN_ADAPTER_COMPLETE_HANDLER
)(NDIS_HANDLE
, NDIS_STATUS
, NDIS_STATUS
);
170 typedef void (NTAPI
*CLOSE_ADAPTER_COMPLETE_HANDLER
)(NDIS_HANDLE
, NDIS_STATUS
);
171 typedef void (NTAPI
*RESET_COMPLETE_HANDLER
)(NDIS_HANDLE
, NDIS_STATUS
);
172 typedef void (NTAPI
*REQUEST_COMPLETE_HANDLER
)(NDIS_HANDLE
, PNDIS_REQUEST
, NDIS_STATUS
);
173 typedef void (NTAPI
*STATUS_HANDLER
)(NDIS_HANDLE
, NDIS_STATUS
, PVOID
, UINT
);
174 typedef void (NTAPI
*STATUS_COMPLETE_HANDLER
)(NDIS_HANDLE
);
175 typedef void (NTAPI
*SEND_COMPLETE_HANDLER
)(NDIS_HANDLE
, PNDIS_PACKET
, NDIS_STATUS
);
176 typedef void (NTAPI
*TRANSFER_DATA_COMPLETE_HANDLER
)(NDIS_HANDLE
, PNDIS_PACKET
, NDIS_STATUS
, UINT
);
177 typedef NDIS_STATUS (NTAPI
*RECEIVE_HANDLER
)(NDIS_HANDLE
, NDIS_HANDLE
, PVOID
, UINT
, PVOID
, UINT
, UINT
);
178 typedef void (NTAPI
*RECEIVE_COMPLETE_HANDLER
)(NDIS_HANDLE
);
179 typedef INT (NTAPI
*RECEIVE_PACKET_HANDLER
)(NDIS_HANDLE
, PNDIS_PACKET
);
180 typedef void (NTAPI
*BIND_HANDLER
)(PNDIS_STATUS
, NDIS_HANDLE
, PNDIS_STRING
, PVOID
, PVOID
);
181 typedef void (NTAPI
*UNBIND_HANDLER
)(PNDIS_STATUS
, NDIS_HANDLE
, NDIS_HANDLE
);
182 typedef NDIS_STATUS (NTAPI
*PNP_EVENT_HANDLER
)(NDIS_HANDLE
, PNET_PNP_EVENT
);
183 typedef void (NTAPI
*UNLOAD_PROTOCOL_HANDLER
)(void);
186 typedef struct _NDIS_PROTOCOL_CHARACTERISTICS
188 UCHAR MajorNdisVersion
;
189 UCHAR MinorNdisVersion
;
192 OPEN_ADAPTER_COMPLETE_HANDLER OpenAdapterCompleteHandler
;
193 CLOSE_ADAPTER_COMPLETE_HANDLER CloseAdapterCompleteHandler
;
194 SEND_COMPLETE_HANDLER SendCompleteHandler
;
195 TRANSFER_DATA_COMPLETE_HANDLER TransferDataCompleteHandler
;
196 RESET_COMPLETE_HANDLER ResetCompleteHandler
;
197 REQUEST_COMPLETE_HANDLER RequestCompleteHandler
;
198 RECEIVE_HANDLER ReceiveHandler
;
199 RECEIVE_COMPLETE_HANDLER ReceiveCompleteHandler
;
200 STATUS_HANDLER StatusHandler
;
201 STATUS_COMPLETE_HANDLER StatusCompleteHandler
;
203 RECEIVE_PACKET_HANDLER ReceivePacketHandler
;
204 BIND_HANDLER BindAdapterHandler
;
205 UNBIND_HANDLER UnbindAdapterHandler
;
206 PNP_EVENT_HANDLER PnPEventHandler
;
207 UNLOAD_PROTOCOL_HANDLER UnloadHandler
;
208 CO_SEND_COMPLETE_HANDLER CoSendCompleteHandler
;
209 CO_STATUS_HANDLER CoStatusHandler
;
210 CO_RECEIVE_PACKET_HANDLER CoReceivePacketHandler
;
211 CO_AF_REGISTER_NOTIFY_HANDLER CoAfRegisterNotifyHandler
;
212 } NDIS_PROTOCOL_CHARACTERISTICS
, *PNDIS_PROTOCOL_CHARACTERISTICS
;
214 #define NDIS_STATUS_FAILURE ((NDIS_STATUS) STATUS_UNSUCCESSFUL)
216 NDIS_STATUS WINAPI
NdisAllocateMemoryWithTag(void **, UINT
, ULONG
);
217 void WINAPI
NdisAllocateSpinLock(NDIS_SPIN_LOCK
*);
218 void WINAPI
NdisRegisterProtocol(NDIS_STATUS
*, NDIS_HANDLE
*, NDIS_PROTOCOL_CHARACTERISTICS
*, UINT
);
219 CCHAR WINAPI
NdisSystemProcessorCount(void);