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
;
31 typedef enum _NDIS_REQUEST_TYPE
33 NdisRequestQueryInformation
,
34 NdisRequestSetInformation
,
35 NdisRequestQueryStatistics
,
39 NdisRequestTransferData
,
46 } NDIS_REQUEST_TYPE
, *PNDIS_REQUEST_TYPE
;
48 typedef enum _NET_PNP_EVENT_CODE
52 NetEventQueryRemoveDevice
,
53 NetEventCancelRemoveDevice
,
56 NetEventBindsComplete
,
57 NetEventPnPCapabilities
,
60 NetEventPortActivation
,
61 NetEventPortDeactivation
,
62 NetEventIMReEnableDevice
,
64 } NET_PNP_EVENT_CODE
, *PNET_PNP_EVENT_CODE
;
67 typedef struct _NET_PNP_EVENT
69 NET_PNP_EVENT_CODE NetEvent
;
72 ULONG_PTR NdisReserved
[4];
73 ULONG_PTR TransportReserved
[4];
74 ULONG_PTR TdiReserved
[4];
75 ULONG_PTR TdiClientReserved
[4];
76 } NET_PNP_EVENT
, *PNET_PNP_EVENT
;
78 typedef struct _NDIS_PACKET_PRIVATE
84 PNDIS_PACKET_POOL Pool
;
88 UCHAR NdisPacketFlags
;
89 USHORT NdisPacketOobOffset
;
90 } NDIS_PACKET_PRIVATE
, *PNDIS_PACKET_PRIVATE
;
92 typedef struct _NDIS_PACKET
94 NDIS_PACKET_PRIVATE Private
;
99 UCHAR MiniportReserved
[2 * sizeof(void*)];
100 UCHAR WrapperReserved
[2 * sizeof(void*)];
104 UCHAR MiniportReservedEx
[3 * sizeof(void*)];
105 UCHAR WrapperReservedEx
[sizeof(void*)];
109 UCHAR MacReserved
[4 * sizeof(void*)];
112 ULONG_PTR Reserved
[2];
113 UCHAR ProtocolReserved
[1];
114 } NDIS_PACKET
, *PNDIS_PACKET
, **PPNDIS_PACKET
;
116 typedef struct _NDIS_SPIN_LOCK
120 } NDIS_SPIN_LOCK
, *PNDIS_SPIN_LOCK
;
123 typedef struct _NDIS_REQUEST
125 UCHAR MacReserved
[4 * sizeof(void*)];
126 NDIS_REQUEST_TYPE RequestType
;
129 struct QUERY_INFORMATION
132 PVOID InformationBuffer
;
133 UINT InformationBufferLength
;
137 struct SET_INFORMATION
140 PVOID InformationBuffer
;
141 UINT InformationBufferLength
;
146 UCHAR NdisReserved
[9 * sizeof(void*)];
149 UCHAR CallMgrReserved
[2 * sizeof(void*)];
150 UCHAR ProtocolReserved
[2 * sizeof(void*)];
152 UCHAR MiniportReserved
[2 * sizeof(void*)];
153 } NDIS_REQUEST
, *PNDIS_REQUEST
;
155 typedef struct _CO_ADDRESS_FAMILY
157 NDIS_AF AddressFamily
;
160 } CO_ADDRESS_FAMILY
, *PCO_ADDRESS_FAMILY
;
163 typedef void (NTAPI
*CO_AF_REGISTER_NOTIFY_HANDLER
)(NDIS_HANDLE
, PCO_ADDRESS_FAMILY
);
164 typedef void (NTAPI
*CO_SEND_COMPLETE_HANDLER
)(NDIS_STATUS
, NDIS_HANDLE
, PNDIS_PACKET
);
165 typedef void (NTAPI
*CO_STATUS_HANDLER
)(NDIS_HANDLE
, NDIS_HANDLE
, NDIS_STATUS
, PVOID
, UINT
);
166 typedef UINT (NTAPI
*CO_RECEIVE_PACKET_HANDLER
)(NDIS_HANDLE
, NDIS_HANDLE
, PNDIS_PACKET
);
167 typedef void (NTAPI
*OPEN_ADAPTER_COMPLETE_HANDLER
)(NDIS_HANDLE
, NDIS_STATUS
, NDIS_STATUS
);
168 typedef void (NTAPI
*CLOSE_ADAPTER_COMPLETE_HANDLER
)(NDIS_HANDLE
, NDIS_STATUS
);
169 typedef void (NTAPI
*RESET_COMPLETE_HANDLER
)(NDIS_HANDLE
, NDIS_STATUS
);
170 typedef void (NTAPI
*REQUEST_COMPLETE_HANDLER
)(NDIS_HANDLE
, PNDIS_REQUEST
, NDIS_STATUS
);
171 typedef void (NTAPI
*STATUS_HANDLER
)(NDIS_HANDLE
, NDIS_STATUS
, PVOID
, UINT
);
172 typedef void (NTAPI
*STATUS_COMPLETE_HANDLER
)(NDIS_HANDLE
);
173 typedef void (NTAPI
*SEND_COMPLETE_HANDLER
)(NDIS_HANDLE
, PNDIS_PACKET
, NDIS_STATUS
);
174 typedef void (NTAPI
*TRANSFER_DATA_COMPLETE_HANDLER
)(NDIS_HANDLE
, PNDIS_PACKET
, NDIS_STATUS
, UINT
);
175 typedef NDIS_STATUS (NTAPI
*RECEIVE_HANDLER
)(NDIS_HANDLE
, NDIS_HANDLE
, PVOID
, UINT
, PVOID
, UINT
, UINT
);
176 typedef void (NTAPI
*RECEIVE_COMPLETE_HANDLER
)(NDIS_HANDLE
);
177 typedef INT (NTAPI
*RECEIVE_PACKET_HANDLER
)(NDIS_HANDLE
, PNDIS_PACKET
);
178 typedef void (NTAPI
*BIND_HANDLER
)(PNDIS_STATUS
, NDIS_HANDLE
, PNDIS_STRING
, PVOID
, PVOID
);
179 typedef void (NTAPI
*UNBIND_HANDLER
)(PNDIS_STATUS
, NDIS_HANDLE
, NDIS_HANDLE
);
180 typedef NDIS_STATUS (NTAPI
*PNP_EVENT_HANDLER
)(NDIS_HANDLE
, PNET_PNP_EVENT
);
181 typedef void (NTAPI
*UNLOAD_PROTOCOL_HANDLER
)(void);
184 typedef struct _NDIS_PROTOCOL_CHARACTERISTICS
186 UCHAR MajorNdisVersion
;
187 UCHAR MinorNdisVersion
;
190 OPEN_ADAPTER_COMPLETE_HANDLER OpenAdapterCompleteHandler
;
191 CLOSE_ADAPTER_COMPLETE_HANDLER CloseAdapterCompleteHandler
;
192 SEND_COMPLETE_HANDLER SendCompleteHandler
;
193 TRANSFER_DATA_COMPLETE_HANDLER TransferDataCompleteHandler
;
194 RESET_COMPLETE_HANDLER ResetCompleteHandler
;
195 REQUEST_COMPLETE_HANDLER RequestCompleteHandler
;
196 RECEIVE_HANDLER ReceiveHandler
;
197 RECEIVE_COMPLETE_HANDLER ReceiveCompleteHandler
;
198 STATUS_HANDLER StatusHandler
;
199 STATUS_COMPLETE_HANDLER StatusCompleteHandler
;
201 RECEIVE_PACKET_HANDLER ReceivePacketHandler
;
202 BIND_HANDLER BindAdapterHandler
;
203 UNBIND_HANDLER UnbindAdapterHandler
;
204 PNP_EVENT_HANDLER PnPEventHandler
;
205 UNLOAD_PROTOCOL_HANDLER UnloadHandler
;
206 CO_SEND_COMPLETE_HANDLER CoSendCompleteHandler
;
207 CO_STATUS_HANDLER CoStatusHandler
;
208 CO_RECEIVE_PACKET_HANDLER CoReceivePacketHandler
;
209 CO_AF_REGISTER_NOTIFY_HANDLER CoAfRegisterNotifyHandler
;
210 } NDIS_PROTOCOL_CHARACTERISTICS
, *PNDIS_PROTOCOL_CHARACTERISTICS
;
212 #define NDIS_STATUS_FAILURE ((NDIS_STATUS) STATUS_UNSUCCESSFUL)
214 NDIS_STATUS WINAPI
NdisAllocateMemoryWithTag(void **, UINT
, ULONG
);
215 void WINAPI
NdisAllocateSpinLock(NDIS_SPIN_LOCK
*);
216 void WINAPI
NdisRegisterProtocol(NDIS_STATUS
*, NDIS_HANDLE
*, NDIS_PROTOCOL_CHARACTERISTICS
*, UINT
);
217 CCHAR WINAPI
NdisSystemProcessorCount(void);