3 * Bill Paul <wpaul@windriver.com>. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by Bill Paul.
16 * 4. Neither the name of the author nor the names of any co-contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY Bill Paul AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL Bill Paul OR THE VOICES IN HIS HEAD
24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
30 * THE POSSIBILITY OF SUCH DAMAGE.
32 * $FreeBSD: src/sys/compat/ndis/ndis_var.h,v 1.51 2010/12/06 20:54:53 bschmidt Exp $
38 /* Forward declarations */
39 struct ndis_miniport_block;
40 struct ndis_mdriver_block;
41 typedef struct ndis_miniport_block ndis_miniport_block;
42 typedef struct ndis_mdriver_block ndis_mdriver_block;
45 typedef uint32_t ndis_status;
46 typedef void *ndis_handle;
47 typedef uint32_t ndis_oid;
48 typedef uint32_t ndis_error_code;
49 typedef register_t ndis_kspin_lock;
50 typedef uint8_t ndis_kirql;
53 * NDIS status codes (there are lots of them). The ones that
54 * don't seem to fit the pattern are actually mapped to generic
58 #define NDIS_STATUS_SUCCESS 0
59 #define NDIS_STATUS_PENDING 0x00000103
60 #define NDIS_STATUS_NOT_RECOGNIZED 0x00010001
61 #define NDIS_STATUS_NOT_COPIED 0x00010002
62 #define NDIS_STATUS_NOT_ACCEPTED 0x00010003
63 #define NDIS_STATUS_CALL_ACTIVE 0x00010007
64 #define NDIS_STATUS_ONLINE 0x40010003
65 #define NDIS_STATUS_RESET_START 0x40010004
66 #define NDIS_STATUS_RESET_END 0x40010005
67 #define NDIS_STATUS_RING_STATUS 0x40010006
68 #define NDIS_STATUS_CLOSED 0x40010007
69 #define NDIS_STATUS_WAN_LINE_UP 0x40010008
70 #define NDIS_STATUS_WAN_LINE_DOWN 0x40010009
71 #define NDIS_STATUS_WAN_FRAGMENT 0x4001000A
72 #define NDIS_STATUS_MEDIA_CONNECT 0x4001000B
73 #define NDIS_STATUS_MEDIA_DISCONNECT 0x4001000C
74 #define NDIS_STATUS_HARDWARE_LINE_UP 0x4001000D
75 #define NDIS_STATUS_HARDWARE_LINE_DOWN 0x4001000E
76 #define NDIS_STATUS_INTERFACE_UP 0x4001000F
77 #define NDIS_STATUS_INTERFACE_DOWN 0x40010010
78 #define NDIS_STATUS_MEDIA_BUSY 0x40010011
79 #define NDIS_STATUS_MEDIA_SPECIFIC_INDICATION 0x40010012
80 #define NDIS_STATUS_WW_INDICATION NDIS_STATUS_MEDIA_SPECIFIC_INDICATION
81 #define NDIS_STATUS_LINK_SPEED_CHANGE 0x40010013
82 #define NDIS_STATUS_WAN_GET_STATS 0x40010014
83 #define NDIS_STATUS_WAN_CO_FRAGMENT 0x40010015
84 #define NDIS_STATUS_WAN_CO_LINKPARAMS 0x40010016
85 #define NDIS_STATUS_NOT_RESETTABLE 0x80010001
86 #define NDIS_STATUS_SOFT_ERRORS 0x80010003
87 #define NDIS_STATUS_HARD_ERRORS 0x80010004
88 #define NDIS_STATUS_BUFFER_OVERFLOW 0x80000005
89 #define NDIS_STATUS_FAILURE 0xC0000001
90 #define NDIS_STATUS_RESOURCES 0xC000009A
91 #define NDIS_STATUS_CLOSING 0xC0010002
92 #define NDIS_STATUS_BAD_VERSION 0xC0010004
93 #define NDIS_STATUS_BAD_CHARACTERISTICS 0xC0010005
94 #define NDIS_STATUS_ADAPTER_NOT_FOUND 0xC0010006
95 #define NDIS_STATUS_OPEN_FAILED 0xC0010007
96 #define NDIS_STATUS_DEVICE_FAILED 0xC0010008
97 #define NDIS_STATUS_MULTICAST_FULL 0xC0010009
98 #define NDIS_STATUS_MULTICAST_EXISTS 0xC001000A
99 #define NDIS_STATUS_MULTICAST_NOT_FOUND 0xC001000B
100 #define NDIS_STATUS_REQUEST_ABORTED 0xC001000C
101 #define NDIS_STATUS_RESET_IN_PROGRESS 0xC001000D
102 #define NDIS_STATUS_CLOSING_INDICATING 0xC001000E
103 #define NDIS_STATUS_NOT_SUPPORTED 0xC00000BB
104 #define NDIS_STATUS_INVALID_PACKET 0xC001000F
105 #define NDIS_STATUS_OPEN_LIST_FULL 0xC0010010
106 #define NDIS_STATUS_ADAPTER_NOT_READY 0xC0010011
107 #define NDIS_STATUS_ADAPTER_NOT_OPEN 0xC0010012
108 #define NDIS_STATUS_NOT_INDICATING 0xC0010013
109 #define NDIS_STATUS_INVALID_LENGTH 0xC0010014
110 #define NDIS_STATUS_INVALID_DATA 0xC0010015
111 #define NDIS_STATUS_BUFFER_TOO_SHORT 0xC0010016
112 #define NDIS_STATUS_INVALID_OID 0xC0010017
113 #define NDIS_STATUS_ADAPTER_REMOVED 0xC0010018
114 #define NDIS_STATUS_UNSUPPORTED_MEDIA 0xC0010019
115 #define NDIS_STATUS_GROUP_ADDRESS_IN_USE 0xC001001A
116 #define NDIS_STATUS_FILE_NOT_FOUND 0xC001001B
117 #define NDIS_STATUS_ERROR_READING_FILE 0xC001001C
118 #define NDIS_STATUS_ALREADY_MAPPED 0xC001001D
119 #define NDIS_STATUS_RESOURCE_CONFLICT 0xC001001E
120 #define NDIS_STATUS_NO_CABLE 0xC001001F
121 #define NDIS_STATUS_INVALID_SAP 0xC0010020
122 #define NDIS_STATUS_SAP_IN_USE 0xC0010021
123 #define NDIS_STATUS_INVALID_ADDRESS 0xC0010022
124 #define NDIS_STATUS_VC_NOT_ACTIVATED 0xC0010023
125 #define NDIS_STATUS_DEST_OUT_OF_ORDER 0xC0010024
126 #define NDIS_STATUS_VC_NOT_AVAILABLE 0xC0010025
127 #define NDIS_STATUS_CELLRATE_NOT_AVAILABLE 0xC0010026
128 #define NDIS_STATUS_INCOMPATABLE_QOS 0xC0010027
129 #define NDIS_STATUS_AAL_PARAMS_UNSUPPORTED 0xC0010028
130 #define NDIS_STATUS_NO_ROUTE_TO_DESTINATION 0xC0010029
131 #define NDIS_STATUS_TOKEN_RING_OPEN_ERROR 0xC0011000
132 #define NDIS_STATUS_INVALID_DEVICE_REQUEST 0xC0000010
133 #define NDIS_STATUS_NETWORK_UNREACHABLE 0xC000023C
136 * NDIS event codes. They are usually reported to NdisWriteErrorLogEntry().
139 #define EVENT_NDIS_RESOURCE_CONFLICT 0xC0001388
140 #define EVENT_NDIS_OUT_OF_RESOURCE 0xC0001389
141 #define EVENT_NDIS_HARDWARE_FAILURE 0xC000138A
142 #define EVENT_NDIS_ADAPTER_NOT_FOUND 0xC000138B
143 #define EVENT_NDIS_INTERRUPT_CONNECT 0xC000138C
144 #define EVENT_NDIS_DRIVER_FAILURE 0xC000138D
145 #define EVENT_NDIS_BAD_VERSION 0xC000138E
146 #define EVENT_NDIS_TIMEOUT 0x8000138F
147 #define EVENT_NDIS_NETWORK_ADDRESS 0xC0001390
148 #define EVENT_NDIS_UNSUPPORTED_CONFIGURATION 0xC0001391
149 #define EVENT_NDIS_INVALID_VALUE_FROM_ADAPTER 0xC0001392
150 #define EVENT_NDIS_MISSING_CONFIGURATION_PARAMETER 0xC0001393
151 #define EVENT_NDIS_BAD_IO_BASE_ADDRESS 0xC0001394
152 #define EVENT_NDIS_RECEIVE_SPACE_SMALL 0x40001395
153 #define EVENT_NDIS_ADAPTER_DISABLED 0x80001396
154 #define EVENT_NDIS_IO_PORT_CONFLICT 0x80001397
155 #define EVENT_NDIS_PORT_OR_DMA_CONFLICT 0x80001398
156 #define EVENT_NDIS_MEMORY_CONFLICT 0x80001399
157 #define EVENT_NDIS_INTERRUPT_CONFLICT 0x8000139A
158 #define EVENT_NDIS_DMA_CONFLICT 0x8000139B
159 #define EVENT_NDIS_INVALID_DOWNLOAD_FILE_ERROR 0xC000139C
160 #define EVENT_NDIS_MAXRECEIVES_ERROR 0x8000139D
161 #define EVENT_NDIS_MAXTRANSMITS_ERROR 0x8000139E
162 #define EVENT_NDIS_MAXFRAMESIZE_ERROR 0x8000139F
163 #define EVENT_NDIS_MAXINTERNALBUFS_ERROR 0x800013A0
164 #define EVENT_NDIS_MAXMULTICAST_ERROR 0x800013A1
165 #define EVENT_NDIS_PRODUCTID_ERROR 0x800013A2
166 #define EVENT_NDIS_LOBE_FAILUE_ERROR 0x800013A3
167 #define EVENT_NDIS_SIGNAL_LOSS_ERROR 0x800013A4
168 #define EVENT_NDIS_REMOVE_RECEIVED_ERROR 0x800013A5
169 #define EVENT_NDIS_TOKEN_RING_CORRECTION 0x400013A6
170 #define EVENT_NDIS_ADAPTER_CHECK_ERROR 0xC00013A7
171 #define EVENT_NDIS_RESET_FAILURE_ERROR 0x800013A8
172 #define EVENT_NDIS_CABLE_DISCONNECTED_ERROR 0x800013A9
173 #define EVENT_NDIS_RESET_FAILURE_CORRECTION 0x800013AA
176 * NDIS OIDs used by the queryinfo/setinfo routines.
177 * Some are required by all NDIS drivers, some are specific to
178 * a particular type of device, and some are purely optional.
179 * Unfortunately, one of the purely optional OIDs is the one
180 * that lets us set the MAC address of the device.
184 #define OID_GEN_SUPPORTED_LIST 0x00010101
185 #define OID_GEN_HARDWARE_STATUS 0x00010102
186 #define OID_GEN_MEDIA_SUPPORTED 0x00010103
187 #define OID_GEN_MEDIA_IN_USE 0x00010104
188 #define OID_GEN_MAXIMUM_LOOKAHEAD 0x00010105
189 #define OID_GEN_MAXIMUM_FRAME_SIZE 0x00010106
190 #define OID_GEN_LINK_SPEED 0x00010107
191 #define OID_GEN_TRANSMIT_BUFFER_SPACE 0x00010108
192 #define OID_GEN_RECEIVE_BUFFER_SPACE 0x00010109
193 #define OID_GEN_TRANSMIT_BLOCK_SIZE 0x0001010A
194 #define OID_GEN_RECEIVE_BLOCK_SIZE 0x0001010B
195 #define OID_GEN_VENDOR_ID 0x0001010C
196 #define OID_GEN_VENDOR_DESCRIPTION 0x0001010D
197 #define OID_GEN_CURRENT_PACKET_FILTER 0x0001010E
198 #define OID_GEN_CURRENT_LOOKAHEAD 0x0001010F
199 #define OID_GEN_DRIVER_VERSION 0x00010110
200 #define OID_GEN_MAXIMUM_TOTAL_SIZE 0x00010111
201 #define OID_GEN_PROTOCOL_OPTIONS 0x00010112
202 #define OID_GEN_MAC_OPTIONS 0x00010113
203 #define OID_GEN_MEDIA_CONNECT_STATUS 0x00010114
204 #define OID_GEN_MAXIMUM_SEND_PACKETS 0x00010115
205 #define OID_GEN_VENDOR_DRIVER_VERSION 0x00010116
206 #define OID_GEN_SUPPORTED_GUIDS 0x00010117
207 #define OID_GEN_NETWORK_LAYER_ADDRESSES 0x00010118 /* Set only */
208 #define OID_GEN_TRANSPORT_HEADER_OFFSET 0x00010119 /* Set only */
209 #define OID_GEN_MACHINE_NAME 0x0001021A
210 #define OID_GEN_RNDIS_CONFIG_PARAMETER 0x0001021B /* Set only */
211 #define OID_GEN_VLAN_ID 0x0001021C
214 #define OID_GEN_MEDIA_CAPABILITIES 0x00010201
215 #define OID_GEN_PHYSICAL_MEDIUM 0x00010202
217 /* Required statistics OIDs. */
218 #define OID_GEN_XMIT_OK 0x00020101
219 #define OID_GEN_RCV_OK 0x00020102
220 #define OID_GEN_XMIT_ERROR 0x00020103
221 #define OID_GEN_RCV_ERROR 0x00020104
222 #define OID_GEN_RCV_NO_BUFFER 0x00020105
224 /* Optional OID statistics */
225 #define OID_GEN_DIRECTED_BYTES_XMIT 0x00020201
226 #define OID_GEN_DIRECTED_FRAMES_XMIT 0x00020202
227 #define OID_GEN_MULTICAST_BYTES_XMIT 0x00020203
228 #define OID_GEN_MULTICAST_FRAMES_XMIT 0x00020204
229 #define OID_GEN_BROADCAST_BYTES_XMIT 0x00020205
230 #define OID_GEN_BROADCAST_FRAMES_XMIT 0x00020206
231 #define OID_GEN_DIRECTED_BYTES_RCV 0x00020207
232 #define OID_GEN_DIRECTED_FRAMES_RCV 0x00020208
233 #define OID_GEN_MULTICAST_BYTES_RCV 0x00020209
234 #define OID_GEN_MULTICAST_FRAMES_RCV 0x0002020A
235 #define OID_GEN_BROADCAST_BYTES_RCV 0x0002020B
236 #define OID_GEN_BROADCAST_FRAMES_RCV 0x0002020C
237 #define OID_GEN_RCV_CRC_ERROR 0x0002020D
238 #define OID_GEN_TRANSMIT_QUEUE_LENGTH 0x0002020E
239 #define OID_GEN_GET_TIME_CAPS 0x0002020F
240 #define OID_GEN_GET_NETCARD_TIME 0x00020210
241 #define OID_GEN_NETCARD_LOAD 0x00020211
242 #define OID_GEN_DEVICE_PROFILE 0x00020212
244 /* 802.3 (ethernet) OIDs */
245 #define OID_802_3_PERMANENT_ADDRESS 0x01010101
246 #define OID_802_3_CURRENT_ADDRESS 0x01010102
247 #define OID_802_3_MULTICAST_LIST 0x01010103
248 #define OID_802_3_MAXIMUM_LIST_SIZE 0x01010104
249 #define OID_802_3_MAC_OPTIONS 0x01010105
250 #define NDIS_802_3_MAC_OPTION_PRIORITY 0x00000001
251 #define OID_802_3_RCV_ERROR_ALIGNMENT 0x01020101
252 #define OID_802_3_XMIT_ONE_COLLISION 0x01020102
253 #define OID_802_3_XMIT_MORE_COLLISIONS 0x01020103
254 #define OID_802_3_XMIT_DEFERRED 0x01020201
255 #define OID_802_3_XMIT_MAX_COLLISIONS 0x01020202
256 #define OID_802_3_RCV_OVERRUN 0x01020203
257 #define OID_802_3_XMIT_UNDERRUN 0x01020204
258 #define OID_802_3_XMIT_HEARTBEAT_FAILURE 0x01020205
259 #define OID_802_3_XMIT_TIMES_CRS_LOST 0x01020206
260 #define OID_802_3_XMIT_LATE_COLLISIONS 0x01020207
262 /* PnP and power management OIDs */
263 #define OID_PNP_CAPABILITIES 0xFD010100
264 #define OID_PNP_SET_POWER 0xFD010101
265 #define OID_PNP_QUERY_POWER 0xFD010102
266 #define OID_PNP_ADD_WAKE_UP_PATTERN 0xFD010103
267 #define OID_PNP_REMOVE_WAKE_UP_PATTERN 0xFD010104
268 #define OID_PNP_WAKE_UP_PATTERN_LIST 0xFD010105
269 #define OID_PNP_ENABLE_WAKE_UP 0xFD010106
272 * These are the possible power states for
273 * OID_PNP_SET_POWER and OID_PNP_QUERY_POWER.
275 #define NDIS_POWERSTATE_UNSPEC 0
276 #define NDIS_POWERSTATE_D0 1
277 #define NDIS_POWERSTATE_D1 2
278 #define NDIS_POWERSTATE_D2 3
279 #define NDIS_POWERSTATE_D3 4
282 * These are used with the MiniportPnpEventNotify() method.
285 #define NDIS_POWERPROFILE_BATTERY 0
286 #define NDIS_POWERPROFILE_ACONLINE 1
288 #define NDIS_PNP_EVENT_QUERY_REMOVED 0
289 #define NDIS_PNP_EVENT_REMOVED 1
290 #define NDIS_PNP_EVENT_SURPRISE_REMOVED 2
291 #define NDIS_PNP_EVENT_QUERY_STOPPED 3
292 #define NDIS_PNP_EVENT_STOPPED 4
293 #define NDIS_PNP_EVENT_PROFILECHANGED 5
296 /* PnP/PM Statistics (Optional). */
297 #define OID_PNP_WAKE_UP_OK 0xFD020200
298 #define OID_PNP_WAKE_UP_ERROR 0xFD020201
300 /* The following bits are defined for OID_PNP_ENABLE_WAKE_UP */
301 #define NDIS_PNP_WAKE_UP_MAGIC_PACKET 0x00000001
302 #define NDIS_PNP_WAKE_UP_PATTERN_MATCH 0x00000002
303 #define NDIS_PNP_WAKE_UP_LINK_CHANGE 0x00000004
306 #define OID_802_11_BSSID 0x0D010101
307 #define OID_802_11_SSID 0x0D010102
308 #define OID_802_11_NETWORK_TYPES_SUPPORTED 0x0D010203
309 #define OID_802_11_NETWORK_TYPE_IN_USE 0x0D010204
310 #define OID_802_11_TX_POWER_LEVEL 0x0D010205
311 #define OID_802_11_RSSI 0x0D010206
312 #define OID_802_11_RSSI_TRIGGER 0x0D010207
313 #define OID_802_11_INFRASTRUCTURE_MODE 0x0D010108
314 #define OID_802_11_FRAGMENTATION_THRESHOLD 0x0D010209
315 #define OID_802_11_RTS_THRESHOLD 0x0D01020A
316 #define OID_802_11_NUMBER_OF_ANTENNAS 0x0D01020B
317 #define OID_802_11_RX_ANTENNA_SELECTED 0x0D01020C
318 #define OID_802_11_TX_ANTENNA_SELECTED 0x0D01020D
319 #define OID_802_11_SUPPORTED_RATES 0x0D01020E
320 #define OID_802_11_DESIRED_RATES 0x0D010210
321 #define OID_802_11_CONFIGURATION 0x0D010211
322 #define OID_802_11_STATISTICS 0x0D020212
323 #define OID_802_11_ADD_WEP 0x0D010113
324 #define OID_802_11_REMOVE_WEP 0x0D010114
325 #define OID_802_11_DISASSOCIATE 0x0D010115
326 #define OID_802_11_POWER_MODE 0x0D010216
327 #define OID_802_11_BSSID_LIST 0x0D010217
328 #define OID_802_11_AUTHENTICATION_MODE 0x0D010118
329 #define OID_802_11_PRIVACY_FILTER 0x0D010119
330 #define OID_802_11_BSSID_LIST_SCAN 0x0D01011A
331 #define OID_802_11_WEP_STATUS 0x0D01011B
332 #define OID_802_11_ENCRYPTION_STATUS OID_802_11_WEP_STATUS
333 #define OID_802_11_RELOAD_DEFAULTS 0x0D01011C
334 #define OID_802_11_ADD_KEY 0x0D01011D
335 #define OID_802_11_REMOVE_KEY 0x0D01011E
336 #define OID_802_11_ASSOCIATION_INFORMATION 0x0D01011F
337 #define OID_802_11_TEST 0x0D010120
338 #define OID_802_11_CAPABILITY 0x0D010122
339 #define OID_802_11_PMKID 0x0D010123
341 /* structures/definitions for 802.11 */
342 #define NDIS_80211_NETTYPE_11FH 0x00000000
343 #define NDIS_80211_NETTYPE_11DS 0x00000001
344 #define NDIS_80211_NETTYPE_11OFDM5 0x00000002
345 #define NDIS_80211_NETTYPE_11OFDM24 0x00000003
346 #define NDIS_80211_NETTYPE_AUTO 0x00000004
348 struct ndis_80211_nettype_list {
350 uint32_t ntl_type[1];
353 #define NDIS_80211_POWERMODE_CAM 0x00000000
354 #define NDIS_80211_POWERMODE_MAX_PSP 0x00000001
355 #define NDIS_80211_POWERMODE_FAST_PSP 0x00000002
357 typedef uint32_t ndis_80211_power; /* Power in milliwatts */
358 typedef uint32_t ndis_80211_rssi; /* Signal strength in dBm */
360 struct ndis_80211_config_fh {
362 uint32_t ncf_hoppatterh;
364 uint32_t ncf_dwelltime;
367 typedef struct ndis_80211_config_fh ndis_80211_config_fh;
369 struct ndis_80211_config {
371 uint32_t nc_beaconperiod;
373 uint32_t nc_dsconfig;
374 ndis_80211_config_fh nc_fhconfig;
377 typedef struct ndis_80211_config ndis_80211_config;
379 struct ndis_80211_stats {
381 uint64_t ns_txfragcnt;
382 uint64_t ns_txmcastcnt;
383 uint64_t ns_failedcnt;
384 uint64_t ns_retrycnt;
385 uint64_t ns_multiretrycnt;
386 uint64_t ns_rtssuccesscnt;
387 uint64_t ns_rtsfailcnt;
388 uint64_t ns_ackfailcnt;
389 uint64_t ns_dupeframecnt;
390 uint64_t ns_rxfragcnt;
391 uint64_t ns_rxmcastcnt;
392 uint64_t ns_fcserrcnt;
395 typedef struct ndis_80211_stats ndis_80211_stats;
397 typedef uint32_t ndis_80211_key_idx;
399 struct ndis_80211_wep {
403 uint8_t nw_keydata[256];
406 typedef struct ndis_80211_wep ndis_80211_wep;
408 #define NDIS_80211_WEPKEY_TX 0x80000000
409 #define NDIS_80211_WEPKEY_PERCLIENT 0x40000000
411 #define NDIS_80211_NET_INFRA_IBSS 0x00000000
412 #define NDIS_80211_NET_INFRA_BSS 0x00000001
413 #define NDIS_80211_NET_INFRA_AUTO 0x00000002
415 #define NDIS_80211_AUTHMODE_OPEN 0x00000000
416 #define NDIS_80211_AUTHMODE_SHARED 0x00000001
417 #define NDIS_80211_AUTHMODE_AUTO 0x00000002
418 #define NDIS_80211_AUTHMODE_WPA 0x00000003
419 #define NDIS_80211_AUTHMODE_WPAPSK 0x00000004
420 #define NDIS_80211_AUTHMODE_WPANONE 0x00000005
421 #define NDIS_80211_AUTHMODE_WPA2 0x00000006
422 #define NDIS_80211_AUTHMODE_WPA2PSK 0x00000007
424 typedef uint8_t ndis_80211_rates[8];
425 typedef uint8_t ndis_80211_rates_ex[16];
426 typedef uint8_t ndis_80211_macaddr[6];
428 struct ndis_80211_ssid {
433 typedef struct ndis_80211_ssid ndis_80211_ssid;
435 struct ndis_wlan_bssid {
437 ndis_80211_macaddr nwb_macaddr;
439 ndis_80211_ssid nwb_ssid;
440 uint32_t nwb_privacy;
441 ndis_80211_rssi nwb_rssi;
442 uint32_t nwb_nettype;
443 ndis_80211_config nwb_config;
444 uint32_t nwb_netinfra;
445 ndis_80211_rates nwb_supportedrates;
448 typedef struct ndis_wlan_bssid ndis_wlan_bssid;
450 struct ndis_80211_bssid_list {
452 ndis_wlan_bssid nbl_bssid[1];
455 typedef struct ndis_80211_bssid_list ndis_80211_bssid_list;
457 struct ndis_wlan_bssid_ex {
459 ndis_80211_macaddr nwbx_macaddr;
460 uint8_t nwbx_rsvd[2];
461 ndis_80211_ssid nwbx_ssid;
462 uint32_t nwbx_privacy;
463 ndis_80211_rssi nwbx_rssi;
464 uint32_t nwbx_nettype;
465 ndis_80211_config nwbx_config;
466 uint32_t nwbx_netinfra;
467 ndis_80211_rates_ex nwbx_supportedrates;
472 typedef struct ndis_wlan_bssid_ex ndis_wlan_bssid_ex;
474 struct ndis_80211_bssid_list_ex {
476 ndis_wlan_bssid_ex nblx_bssid[1];
479 typedef struct ndis_80211_bssid_list_ex ndis_80211_bssid_list_ex;
481 struct ndis_80211_fixed_ies {
482 uint8_t nfi_tstamp[8];
483 uint16_t nfi_beaconint;
487 struct ndis_80211_variable_ies {
493 typedef uint32_t ndis_80211_fragthresh;
494 typedef uint32_t ndis_80211_rtsthresh;
495 typedef uint32_t ndis_80211_antenna;
497 #define NDIS_80211_PRIVFILT_ACCEPTALL 0x00000000
498 #define NDIS_80211_PRIVFILT_8021XWEP 0x00000001
500 #define NDIS_80211_WEPSTAT_ENABLED 0x00000000
501 #define NDIS_80211_WEPSTAT_ENC1ENABLED NDIS_80211_WEPSTAT_ENABLED
502 #define NDIS_80211_WEPSTAT_DISABLED 0x00000001
503 #define NDIS_80211_WEPSTAT_ENCDISABLED NDIS_80211_WEPSTAT_DISABLED
504 #define NDIS_80211_WEPSTAT_KEYABSENT 0x00000002
505 #define NDIS_80211_WEPSTAT_ENC1KEYABSENT NDIS_80211_WEPSTAT_KEYABSENT
506 #define NDIS_80211_WEPSTAT_NOTSUPPORTED 0x00000003
507 #define NDIS_80211_WEPSTAT_ENCNOTSUPPORTED NDIS_80211_WEPSTAT_NOTSUPPORTED
508 #define NDIS_80211_WEPSTAT_ENC2ENABLED 0x00000004
509 #define NDIS_80211_WEPSTAT_ENC2KEYABSENT 0x00000005
510 #define NDIS_80211_WEPSTAT_ENC3ENABLED 0x00000006
511 #define NDIS_80211_WEPSTAT_ENC3KEYABSENT 0x00000007
513 #define NDIS_80211_RELOADDEFAULT_WEP 0x00000000
515 #define NDIS_80211_STATUSTYPE_AUTH 0x00000000
516 #define NDIS_80211_STATUSTYPE_PMKIDLIST 0x00000001
518 struct ndis_80211_status_indication {
522 typedef struct ndis_80211_status_indication ndis_80211_status_indication;
524 #define NDIS_802_11_AUTH_REQUEST_REAUTH 0x01
525 #define NDIS_802_11_AUTH_REQUEST_KEYUPDATE 0x02
526 #define NDIS_802_11_AUTH_REQUEST_PAIRWISE_ERROR 0x06
527 #define NDIS_802_11_AUTH_REQUEST_GROUP_ERROR 0x0E
529 struct ndis_80211_auth_request {
531 ndis_80211_macaddr nar_bssid;
535 typedef struct ndis_80211_auth_request ndis_80211_auth_request;
537 struct ndis_80211_key {
541 ndis_80211_macaddr nk_bssid;
544 uint8_t nk_keydata[32];
547 typedef struct ndis_80211_key ndis_80211_key;
549 struct ndis_80211_remove_key {
552 ndis_80211_macaddr nk_bssid;
555 typedef struct ndis_80211_remove_key ndis_80211_remove_key;
557 #define NDIS_80211_AI_REQFI_CAPABILITIES 0x00000001
558 #define NDIS_80211_AI_REQFI_LISTENINTERVAL 0x00000002
559 #define NDIS_80211_AI_REQFI_CURRENTAPADDRESS 0x00000004
561 #define NDIS_80211_AI_RESFI_CAPABILITIES 0x00000001
562 #define NDIS_80211_AI_RESFI_STATUSCODE 0x00000002
563 #define NDIS_80211_AI_RESFI_ASSOCIATIONID 0x00000004
565 struct ndis_80211_ai_reqfi {
567 uint16_t naq_listentint;
568 ndis_80211_macaddr naq_currentapaddr;
571 typedef struct ndis_80211_ai_reqfi ndis_80211_ai_reqfi;
573 struct ndis_80211_ai_resfi {
575 uint16_t nas_statuscode;
576 uint16_t nas_associd;
579 typedef struct ndis_80211_ai_resfi ndis_80211_ai_resfi;
581 struct ndis_80211_assoc_info {
583 uint16_t nai_avail_req_fixed_ies;
584 ndis_80211_ai_reqfi nai_req_fixed_ies;
585 uint32_t nai_req_ielen;
586 uint32_t nai_offset_req_ies;
587 uint16_t nai_avail_resp_fixed_ies;
588 ndis_80211_ai_resfi nai_resp_fixed_iex;
589 uint32_t nai_resp_ielen;
590 uint32_t nai_offset_resp_ies;
593 typedef struct ndis_80211_assoc_info ndis_80211_assoc_info;
595 struct ndis_80211_auth_event {
596 ndis_80211_status_indication nae_status;
597 ndis_80211_auth_request nae_request[1];
600 typedef struct ndis_80211_auth_event ndis_80211_auth_event;
602 struct ndis_80211_test {
606 ndis_80211_auth_event nt_authevent;
607 uint32_t nt_rssitrigger;
611 typedef struct ndis_80211_test ndis_80211_test;
613 struct ndis_80211_auth_encrypt {
614 uint32_t ne_authmode;
615 uint32_t ne_cryptstat;
618 typedef struct ndis_80211_auth_encrypt ndis_80211_auth_encrypt;
620 struct ndis_80211_caps {
623 uint32_t nc_numpmkids;
624 ndis_80211_auth_encrypt nc_authencs[1];
627 typedef struct ndis_80211_caps ndis_80211_caps;
629 struct ndis_80211_bssidinfo {
630 ndis_80211_macaddr nb_bssid;
631 uint8_t nb_pmkid[16];
634 typedef struct ndis_80211_bssidinfo ndis_80211_bssidinfo;
636 struct ndis_80211_pmkid {
638 uint32_t np_bssidcnt;
639 ndis_80211_bssidinfo np_bssidinfo[1];
642 typedef struct ndis_80211_pmkid ndis_80211_pmkid;
644 struct ndis_80211_pmkid_cand {
645 ndis_80211_macaddr npc_bssid;
649 typedef struct ndis_80211_pmkid_cand ndis_80211_pmkid_cand;
651 #define NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED (0x01)
653 struct ndis_80211_pmkid_candidate_list {
654 uint32_t npcl_version;
655 uint32_t npcl_numcandidates;
656 ndis_80211_pmkid_cand npcl_candidatelist[1];
659 typedef struct ndis_80211_pmkid_candidate_list ndis_80211_pmkid_candidate_list;
661 struct ndis_80211_enc_indication {
662 uint32_t nei_statustype;
663 ndis_80211_pmkid_candidate_list nei_pmkidlist;
666 typedef struct ndis_80211_enc_indication ndis_80211_enc_indication;
670 #define OID_TCP_TASK_OFFLOAD 0xFC010201
671 #define OID_TCP_TASK_IPSEC_ADD_SA 0xFC010202
672 #define OID_TCP_TASK_IPSEC_DELETE_SA 0xFC010203
673 #define OID_TCP_SAN_SUPPORT 0xFC010204
676 #define NDIS_TASK_OFFLOAD_VERSION 1
678 #define NDIS_TASK_TCPIP_CSUM 0x00000000
679 #define NDIS_TASK_IPSEC 0x00000001
680 #define NDIS_TASK_TCP_LARGESEND 0x00000002
682 #define NDIS_ENCAP_UNSPEC 0x00000000
683 #define NDIS_ENCAP_NULL 0x00000001
684 #define NDIS_ENCAP_IEEE802_3 0x00000002
685 #define NDIS_ENCAP_IEEE802_5 0x00000003
686 #define NDIS_ENCAP_SNAP_ROUTED 0x00000004
687 #define NDIS_ENCAP_SNAP_BRIDGED 0x00000005
689 #define NDIS_ENCAPFLAG_FIXEDHDRLEN 0x00000001
691 struct ndis_encap_fmt {
694 uint32_t nef_encaphdrlen;
697 typedef struct ndis_encap_fmt ndis_encap_fmt;
699 struct ndis_task_offload_hdr {
703 uint32_t ntoh_offset_firsttask;
704 ndis_encap_fmt ntoh_encapfmt;
707 typedef struct ndis_task_offload_hdr ndis_task_offload_hdr;
709 struct ndis_task_offload {
713 uint32_t nto_offset_nexttask;
714 uint32_t nto_taskbuflen;
715 uint8_t nto_taskbuf[1];
718 typedef struct ndis_task_offload ndis_task_offload;
720 #define NDIS_TCPSUM_FLAGS_IP_OPTS 0x00000001
721 #define NDIS_TCPSUM_FLAGS_TCP_OPTS 0x00000002
722 #define NDIS_TCPSUM_FLAGS_TCP_CSUM 0x00000004
723 #define NDIS_TCPSUM_FLAGS_UDP_CSUM 0x00000008
724 #define NDIS_TCPSUM_FLAGS_IP_CSUM 0x00000010
726 struct ndis_task_tcpip_csum {
733 typedef struct ndis_task_tcpip_csum ndis_task_tcpip_csum;
735 struct ndis_task_tcp_largesend {
737 uint32_t nttl_maxofflen;
738 uint32_t nttl_minsegcnt;
743 typedef struct ndis_task_tcp_largesend ndis_task_tcp_largesend;
745 #define NDIS_IPSEC_AH_MD5 0x00000001
746 #define NDIS_IPSEC_AH_SHA1 0x00000002
747 #define NDIS_IPSEC_AH_TRANSPORT 0x00000004
748 #define NDIS_IPSEC_AH_TUNNEL 0x00000008
749 #define NDIS_IPSEC_AH_SEND 0x00000010
750 #define NDIS_IPSEC_AH_RECEIVE 0x00000020
752 #define NDIS_IPSEC_ESP_DES 0x00000001
753 #define NDIS_IPSEC_ESP_RSVD 0x00000002
754 #define NDIS_IPSEC_ESP_3DES 0x00000004
755 #define NDIS_IPSEC_ESP_NULL 0x00000008
756 #define NDIS_IPSEC_ESP_TRANSPORT 0x00000010
757 #define NDIS_IPSEC_ESP_TUNNEL 0x00000020
758 #define NDIS_IPSEC_ESP_SEND 0x00000040
759 #define NDIS_IPSEC_ESP_RECEIVE 0x00000080
761 struct ndis_task_ipsec {
762 uint32_t nti_ah_esp_combined;
763 uint32_t nti_ah_transport_tunnel_combined;
764 uint32_t nti_v4_options;
770 typedef struct ndis_task_ipsec ndis_task_ipsec;
773 * Attribures of NDIS drivers. Not all drivers support
777 #define NDIS_ATTRIBUTE_IGNORE_PACKET_TIMEOUT 0x00000001
778 #define NDIS_ATTRIBUTE_IGNORE_REQUEST_TIMEOUT 0x00000002
779 #define NDIS_ATTRIBUTE_IGNORE_TOKEN_RING_ERRORS 0x00000004
780 #define NDIS_ATTRIBUTE_BUS_MASTER 0x00000008
781 #define NDIS_ATTRIBUTE_INTERMEDIATE_DRIVER 0x00000010
782 #define NDIS_ATTRIBUTE_DESERIALIZE 0x00000020
783 #define NDIS_ATTRIBUTE_NO_HALT_ON_SUSPEND 0x00000040
784 #define NDIS_ATTRIBUTE_SURPRISE_REMOVE_OK 0x00000080
785 #define NDIS_ATTRIBUTE_NOT_CO_NDIS 0x00000100
786 #define NDIS_ATTRIBUTE_USES_SAFE_BUFFER_APIS 0x00000200
788 #define NDIS_SERIALIZED(block) \
789 (((block)->nmb_flags & NDIS_ATTRIBUTE_DESERIALIZE) == 0)
791 enum ndis_media_state {
796 typedef enum ndis_media_state ndis_media_state;
798 /* Ndis Packet Filter Bits (OID_GEN_CURRENT_PACKET_FILTER). */
800 #define NDIS_PACKET_TYPE_DIRECTED 0x00000001
801 #define NDIS_PACKET_TYPE_MULTICAST 0x00000002
802 #define NDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004
803 #define NDIS_PACKET_TYPE_BROADCAST 0x00000008
804 #define NDIS_PACKET_TYPE_SOURCE_ROUTING 0x00000010
805 #define NDIS_PACKET_TYPE_PROMISCUOUS 0x00000020
806 #define NDIS_PACKET_TYPE_SMT 0x00000040
807 #define NDIS_PACKET_TYPE_ALL_LOCAL 0x00000080
808 #define NDIS_PACKET_TYPE_GROUP 0x00001000
809 #define NDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x00002000
810 #define NDIS_PACKET_TYPE_FUNCTIONAL 0x00004000
811 #define NDIS_PACKET_TYPE_MAC_FRAME 0x00008000
814 /* Ndis MAC option bits (OID_GEN_MAC_OPTIONS). */
816 #define NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA 0x00000001
817 #define NDIS_MAC_OPTION_RECEIVE_SERIALIZED 0x00000002
818 #define NDIS_MAC_OPTION_TRANSFERS_NOT_PEND 0x00000004
819 #define NDIS_MAC_OPTION_NO_LOOPBACK 0x00000008
820 #define NDIS_MAC_OPTION_FULL_DUPLEX 0x00000010
821 #define NDIS_MAC_OPTION_EOTX_INDICATION 0x00000020
822 #define NDIS_MAC_OPTION_8021P_PRIORITY 0x00000040
823 #define NDIS_MAC_OPTION_SUPPORTS_MAC_ADDRESS_OVERWRITE 0x00000080
824 #define NDIS_MAC_OPTION_RECEIVE_AT_DPC 0x00000100
825 #define NDIS_MAC_OPTION_8021Q_VLAN 0x00000200
826 #define NDIS_MAC_OPTION_RESERVED 0x80000000
828 #define NDIS_DMA_24BITS 0x00
829 #define NDIS_DMA_32BITS 0x01
830 #define NDIS_DMA_64BITS 0x02
833 struct ndis_physaddr {
837 #define np_quad np_low
846 typedef struct physaddr ndis_physaddr;
848 struct ndis_ansi_string {
854 typedef struct ndis_ansi_string ndis_ansi_string;
858 * nus_buf is really a wchar_t *, but it's inconvenient to include
859 * all the necessary header goop needed to define it, and it's a
860 * pointer anyway, so for now, just make it a uint16_t *.
862 struct ndis_unicode_string {
867 typedef struct ndis_unicode_string ndis_unicode_string;
870 typedef unicode_string ndis_unicode_string;
872 enum ndis_parm_type {
876 ndis_parm_multistring,
880 typedef enum ndis_parm_type ndis_parm_type;
882 struct ndis_binary_data {
887 typedef struct ndis_binary_data ndis_binary_data;
889 struct ndis_config_parm {
890 ndis_parm_type ncp_type;
892 uint32_t ncp_intdata;
893 ndis_unicode_string ncp_stringdata;
894 ndis_binary_data ncp_binarydata;
899 * Not part of Windows NDIS spec; we uses this to keep a
900 * list of ndis_config_parm structures that we've allocated.
903 typedef struct ndis_config_parm ndis_config_parm;
905 struct ndis_parmlist_entry {
907 ndis_config_parm np_parm;
910 typedef struct ndis_parmlist_entry ndis_parmlist_entry;
913 struct ndis_list_entry {
914 struct ndis_list_entry *nle_flink;
915 struct ndis_list_entry *nle_blink;
918 typedef struct ndis_list_entry ndis_list_entry;
921 struct ndis_bind_paths {
923 ndis_unicode_string nbp_paths[1];
926 typedef struct ndis_bind_paths ndis_bind_paths;
929 struct dispatch_header {
934 uint32_t dh_sigstate;
935 list_entry dh_waitlisthead;
939 #define dispatch_header nt_dispatch_header
942 struct dispatch_header nk_header;
944 list_entry nk_timerlistentry;
950 struct dispatch_header nk_header;
954 struct nt_kevent ne_event;
957 typedef struct ndis_event ndis_event;
959 /* Kernel defered procedure call (i.e. timer callback) */
962 typedef void (*ndis_kdpc_func)(struct ndis_kdpc *, void *, void *, void *);
967 uint8_t nk_importance;
968 list_entry nk_dpclistentry;
969 ndis_kdpc_func nk_deferedfunc;
970 void *nk_deferredctx;
977 struct ktimer nt_ktimer;
981 typedef struct ndis_timer ndis_timer;
983 typedef void (*ndis_timer_function)(void *, void *, void *, void *);
985 struct ndis_miniport_timer {
986 struct ktimer nmt_ktimer;
987 struct kdpc nmt_kdpc;
988 ndis_timer_function nmt_timerfunc;
990 ndis_miniport_block *nmt_block;
991 struct ndis_miniport_timer *nmt_nexttimer;
994 typedef struct ndis_miniport_timer ndis_miniport_timer;
996 struct ndis_spin_lock {
997 ndis_kspin_lock nsl_spinlock;
998 ndis_kirql nsl_kirql;
1001 typedef struct ndis_spin_lock ndis_spin_lock;
1003 struct ndis_rw_lock {
1005 kspin_lock nrl_spinlock;
1008 uint8_t nrl_rsvd[16];
1011 #define nrl_spinlock u.nrl_spinlock
1012 #define nrl_ctx u.nrl_ctx;
1014 typedef struct ndis_rw_lock ndis_rw_lock;
1016 struct ndis_lock_state {
1017 uint16_t nls_lockstate;
1018 ndis_kirql nls_oldirql;
1021 typedef struct ndis_lock_state ndis_lock_state;
1023 struct ndis_request {
1024 uint8_t nr_macreserved[4*sizeof(void *)];
1025 uint32_t nr_requesttype;
1027 struct _ndis_query_information {
1030 uint32_t nr_infobuflen;
1031 uint32_t nr_byteswritten;
1032 uint32_t nr_bytesneeded;
1033 } ndis_query_information;
1034 struct _ndis_set_information {
1037 uint32_t nr_infobuflen;
1038 uint32_t nr_byteswritten;
1039 uint32_t nr_bytesneeded;
1040 } ndis_set_information;
1042 /* NDIS 5.0 extentions */
1043 uint8_t nr_ndis_rsvd[9 * sizeof(void *)];
1045 uint8_t nr_callmgr_rsvd[2 * sizeof(void *)];
1046 uint8_t nr_protocol_rsvd[2 * sizeof(void *)];
1048 uint8_t nr_miniport_rsvd[2 * sizeof(void *)];
1051 typedef struct ndis_request ndis_request;
1056 struct ndis_miniport_interrupt {
1057 kinterrupt *ni_introbj;
1058 ndis_kspin_lock ni_dpccountlock;
1063 ndis_miniport_block *ni_block;
1066 struct nt_kevent ni_dpcevt;
1071 typedef struct ndis_miniport_interrupt ndis_miniport_interrupt;
1073 enum ndis_interrupt_mode {
1078 typedef enum ndis_interrupt_mode ndis_interrupt_mode;
1080 #define NUMBER_OF_SINGLE_WORK_ITEMS 6
1082 struct ndis_work_item;
1084 typedef void (*ndis_proc)(struct ndis_work_item *, void *);
1086 struct ndis_work_item {
1089 uint8_t nwi_wraprsvd[sizeof(void *) * 8];
1092 typedef struct ndis_work_item ndis_work_item;
1094 #define NdisInitializeWorkItem(w, f, c) \
1097 (w)->nwi_func = f; \
1101 struct ndis_buffer {
1102 struct ndis_buffer *nb_next;
1106 void *nb_mappedsystemva;
1108 uint32_t nb_bytecount;
1109 uint32_t nb_byteoffset;
1112 typedef struct ndis_buffer ndis_buffer;
1115 struct ndis_sc_element {
1116 ndis_physaddr nse_addr;
1121 typedef struct ndis_sc_element ndis_sc_element;
1123 #define NDIS_MAXSEG 32
1124 #define NDIS_BUS_SPACE_SHARED_MAXADDR 0x3E7FFFFF
1126 struct ndis_sc_list {
1129 ndis_sc_element nsl_elements[NDIS_MAXSEG];
1132 typedef struct ndis_sc_list ndis_sc_list;
1134 struct ndis_tcpip_csum {
1136 uint32_t ntc_txflags;
1137 uint32_t ntc_rxflags;
1142 typedef struct ndis_tcpip_csum ndis_tcpip_csum;
1144 #define NDIS_TXCSUM_DO_IPV4 0x00000001
1145 #define NDIS_TXCSUM_DO_IPV6 0x00000002
1146 #define NDIS_TXCSUM_DO_TCP 0x00000004
1147 #define NDIS_TXCSUM_DO_UDP 0x00000008
1148 #define NDIS_TXCSUM_DO_IP 0x00000010
1150 #define NDIS_RXCSUM_TCP_FAILED 0x00000001
1151 #define NDIS_RXCSUM_UDP_FAILED 0x00000002
1152 #define NDIS_RXCSUM_IP_FAILED 0x00000004
1153 #define NDIS_RXCSUM_TCP_PASSED 0x00000008
1154 #define NDIS_RXCSUM_UDP_PASSED 0x00000010
1155 #define NDIS_RXCSUM_IP_PASSED 0x00000020
1156 #define NDIS_RXCSUM_LOOPBACK 0x00000040
1161 uint32_t nvt_userprio:3;
1162 uint32_t nvt_canformatid:1;
1163 uint32_t nvt_vlanid:12;
1164 uint32_t nvt_rsvd:16;
1169 typedef struct ndis_vlan ndis_vlan;
1171 enum ndis_perpkt_info {
1172 ndis_tcpipcsum_info,
1174 ndis_largesend_info,
1175 ndis_classhandle_info,
1178 ndis_ieee8021q_info,
1179 ndis_originalpkt_info,
1180 ndis_packetcancelid,
1184 typedef enum ndis_perpkt_info ndis_perpkt_info;
1186 struct ndis_packet_extension {
1187 void *npe_info[ndis_maxpkt_info];
1190 typedef struct ndis_packet_extension ndis_packet_extension;
1192 struct ndis_packet_private {
1193 uint32_t npp_physcnt;
1194 uint32_t npp_totlen;
1195 ndis_buffer *npp_head;
1196 ndis_buffer *npp_tail;
1201 uint8_t npp_validcounts;
1202 uint8_t npp_ndispktflags;
1203 uint16_t npp_packetooboffset;
1206 #define NDIS_FLAGS_PROTOCOL_ID_MASK 0x0000000F
1207 #define NDIS_FLAGS_MULTICAST_PACKET 0x00000010
1208 #define NDIS_FLAGS_RESERVED2 0x00000020
1209 #define NDIS_FLAGS_RESERVED3 0x00000040
1210 #define NDIS_FLAGS_DONT_LOOPBACK 0x00000080
1211 #define NDIS_FLAGS_IS_LOOPBACK_PACKET 0x00000100
1212 #define NDIS_FLAGS_LOOPBACK_ONLY 0x00000200
1213 #define NDIS_FLAGS_RESERVED4 0x00000400
1214 #define NDIS_FLAGS_DOUBLE_BUFFERED 0x00000800
1215 #define NDIS_FLAGS_SENT_AT_DPC 0x00001000
1216 #define NDIS_FLAGS_USES_SG_BUFFER_LIST 0x00002000
1218 #define NDIS_PACKET_WRAPPER_RESERVED 0x3F
1219 #define NDIS_PACKET_CONTAINS_MEDIA_SPECIFIC_INFO 0x40
1220 #define NDIS_PACKET_ALLOCATED_BY_NDIS 0x80
1222 #define NDIS_PROTOCOL_ID_DEFAULT 0x00
1223 #define NDIS_PROTOCOL_ID_TCP_IP 0x02
1224 #define NDIS_PROTOCOL_ID_IPX 0x06
1225 #define NDIS_PROTOCOL_ID_NBF 0x07
1226 #define NDIS_PROTOCOL_ID_MAX 0x0F
1227 #define NDIS_PROTOCOL_ID_MASK 0x0F
1229 typedef struct ndis_packet_private ndis_packet_private;
1232 ndis_class_802_3prio,
1233 ndis_class_wirelesswan_mbx,
1234 ndis_class_irda_packetinfo,
1235 ndis_class_atm_aainfo
1238 typedef enum ndis_classid ndis_classid;
1240 struct ndis_mediaspecific_info {
1241 uint32_t nmi_nextentoffset;
1242 ndis_classid nmi_classid;
1244 uint8_t nmi_classinfo[1];
1247 typedef struct ndis_mediaspecific_info ndis_mediaspecific_info;
1249 struct ndis_packet_oob {
1251 uint64_t npo_timetotx;
1252 uint64_t npo_timetxed;
1254 uint64_t npo_timerxed;
1255 uint32_t npo_hdrlen;
1256 uint32_t npo_mediaspecific_len;
1257 void *npo_mediaspecific;
1258 ndis_status npo_status;
1261 typedef struct ndis_packet_oob ndis_packet_oob;
1264 * Our protocol private region for handling ethernet.
1265 * We need this to stash some of the things returned
1266 * by NdisMEthIndicateReceive().
1269 struct ndis_ethpriv {
1270 void *nep_ctx; /* packet context */
1271 long nep_offset; /* residual data to transfer */
1275 typedef struct ndis_ethpriv ndis_ethpriv;
1277 #define PROTOCOL_RESERVED_SIZE_IN_PACKET (4 * sizeof(void *))
1279 struct ndis_packet {
1280 ndis_packet_private np_private;
1282 /* For connectionless miniports. */
1284 uint8_t np_miniport_rsvd[2 * sizeof(void *)];
1285 uint8_t np_wrapper_rsvd[2 * sizeof(void *)];
1287 /* For de-serialized miniports */
1289 uint8_t np_miniport_rsvdex[3 * sizeof(void *)];
1290 uint8_t np_wrapper_rsvdex[sizeof(void *)];
1293 uint8_t np_mac_rsvd[4 * sizeof(void *)];
1296 uint32_t *np_rsvd[2];
1297 uint8_t np_protocolreserved[PROTOCOL_RESERVED_SIZE_IN_PACKET];
1300 * This next part is probably wrong, but we need some place
1301 * to put the out of band data structure...
1303 ndis_packet_oob np_oob;
1304 ndis_packet_extension np_ext;
1305 ndis_sc_list np_sclist;
1307 /* BSD-specific stuff which should be invisible to drivers. */
1316 typedef struct ndis_packet ndis_packet;
1318 struct ndis_packet_pool {
1319 slist_header np_head;
1329 typedef struct ndis_packet_pool ndis_packet_pool;
1331 /* mbuf ext type for NDIS */
1332 #define EXT_NDIS EXT_NET_DRV
1334 /* mtx type for NDIS */
1335 #define MTX_NDIS_LOCK "NDIS lock"
1337 struct ndis_filterdbs {
1347 typedef struct ndis_filterdbs ndis_filterdbs;
1349 #define nf_ethdb u.nf_ethdb
1356 NdisMediumLocalTalk,
1357 NdisMediumDix, /* defined for convenience, not a real medium */
1358 NdisMediumArcnetRaw,
1359 NdisMediumArcnet878_2,
1361 NdisMediumWirelessWan,
1369 typedef enum ndis_medium ndis_medium;
1371 enum interface_type {
1372 InterfaceTypeUndefined = -1,
1389 MaximumInterfaceType
1392 enum ndis_interface_type {
1393 NdisInterfaceInternal = Internal,
1394 NdisInterfaceIsa = Isa,
1395 NdisInterfaceEisa = Eisa,
1396 NdisInterfaceMca = MicroChannel,
1397 NdisInterfaceTurboChannel = TurboChannel,
1398 NdisInterfacePci = PCIBus,
1399 NdisInterfacePcMcia = PCMCIABus
1402 typedef enum ndis_interface_type ndis_interface_type;
1404 struct ndis_paddr_unit {
1405 ndis_physaddr npu_physaddr;
1409 typedef struct ndis_paddr_unit ndis_paddr_unit;
1411 struct ndis_map_arg {
1412 ndis_paddr_unit *nma_fraglist;
1418 * Miniport characteristics were originally defined in the NDIS 3.0
1419 * spec and then extended twice, in NDIS 4.0 and 5.0.
1422 struct ndis_miniport_characteristics {
1426 uint8_t nmc_version_major;
1427 uint8_t nmc_version_minor;
1430 void * nmc_checkhang_func;
1431 void * nmc_disable_interrupts_func;
1432 void * nmc_enable_interrupts_func;
1433 void * nmc_halt_func;
1434 void * nmc_interrupt_func;
1435 void * nmc_init_func;
1436 void * nmc_isr_func;
1437 void * nmc_queryinfo_func;
1438 void * nmc_reconfig_func;
1439 void * nmc_reset_func;
1440 void * nmc_sendsingle_func;
1441 void * nmc_setinfo_func;
1442 void * nmc_transferdata_func;
1444 /* NDIS 4.0 extentions */
1446 void * nmc_return_packet_func;
1447 void * nmc_sendmulti_func;
1448 void * nmc_allocate_complete_func;
1450 /* NDIS 5.0 extensions */
1452 void * nmc_cocreatevc_func;
1453 void * nmc_codeletevc_func;
1454 void * nmc_coactivatevc_func;
1455 void * nmc_codeactivatevc_func;
1456 void * nmc_comultisend_func;
1457 void * nmc_corequest_func;
1459 /* NDIS 5.1 extentions */
1461 void * nmc_canceltxpkts_handler;
1462 void * nmc_pnpevent_handler;
1463 void * nmc_shutdown_handler;
1470 typedef struct ndis_miniport_characteristics ndis_miniport_characteristics;
1472 struct ndis_driver_object {
1475 ndis_miniport_characteristics ndo_chars;
1478 typedef struct ndis_driver_object ndis_driver_object;
1480 struct ndis_reference {
1481 ndis_kspin_lock nr_spinlock;
1486 typedef struct ndis_reference ndis_reference;
1488 struct ndis_timer_entry {
1489 struct callout nte_ch;
1490 ndis_miniport_timer *nte_timer;
1491 TAILQ_ENTRY(ndis_timer_entry) link;
1494 TAILQ_HEAD(nte_head, ndis_timer_entry);
1496 #define NDIS_FH_TYPE_VFS 0
1497 #define NDIS_FH_TYPE_MODULE 1
1507 typedef struct ndis_fh ndis_fh;
1510 * The miniport block is basically the internal NDIS handle. We need
1511 * to define this because, unfortunately, it is not entirely opaque
1512 * to NDIS drivers. For one thing, it contains the function pointer
1513 * to the NDIS packet receive handler, which is invoked out of the
1514 * NDIS block via a macro rather than a function pointer. (The
1515 * NdisMIndicateReceivePacket() routine is a macro rather than
1516 * a function.) For another, the driver maintains a pointer to the
1517 * miniport block and passes it as a handle to various NDIS functions.
1518 * (The driver never really knows this because it's hidden behind
1519 * an ndis_handle though.)
1521 * The miniport block has two parts: the first part contains fields
1522 * that must never change, since they are referenced by driver
1523 * binaries through macros. The second part is ignored by the driver,
1524 * but contains various things used internaly by NDIS.SYS. In our
1525 * case, we define the first 'immutable' part exactly as it appears
1526 * in Windows, but don't bother duplicating the Windows definitions
1527 * for the second part. Instead, we replace them with a few BSD-specific
1531 struct ndis_miniport_block {
1533 * Windows-specific portion -- DO NOT MODIFY OR NDIS
1534 * DRIVERS WILL NOT WORK.
1536 void *nmb_signature; /* magic number */
1537 ndis_miniport_block *nmb_nextminiport;
1538 ndis_mdriver_block *nmb_driverhandle;
1539 ndis_handle nmb_miniportadapterctx;
1540 ndis_unicode_string nmb_name;
1541 ndis_bind_paths *nmb_bindpaths;
1542 ndis_handle nmb_openqueue;
1543 ndis_reference nmb_ref;
1544 ndis_handle nmb_devicectx;
1545 uint8_t nmb_padding;
1546 uint8_t nmb_lockacquired;
1547 uint8_t nmb_pmodeopens;
1548 uint8_t nmb_assignedcpu;
1549 ndis_kspin_lock nmb_lock;
1550 ndis_request *nmb_mediarequest;
1551 ndis_miniport_interrupt *nmb_interrupt;
1553 uint32_t nmb_pnpflags;
1554 list_entry nmb_packetlist;
1555 ndis_packet *nmb_firstpendingtxpacket;
1556 ndis_packet *nmb_returnpacketqueue;
1557 uint32_t nmb_requestbuffer;
1558 void *nmb_setmcastbuf;
1559 ndis_miniport_block *nmb_primaryminiport;
1560 void *nmb_wrapperctx;
1561 void *nmb_busdatactx;
1562 uint32_t nmb_pnpcaps;
1563 cm_resource_list *nmb_resources;
1564 ndis_timer nmb_wkupdpctimer;
1565 ndis_unicode_string nmb_basename;
1566 ndis_unicode_string nmb_symlinkname;
1567 uint32_t nmb_checkforhangsecs;
1568 uint16_t nmb_cfhticks;
1569 uint16_t nmb_cfhcurrticks;
1570 ndis_status nmb_resetstatus;
1571 ndis_handle nmb_resetopen;
1572 ndis_filterdbs nmb_filterdbs;
1573 void *nmb_pktind_func;
1574 void *nmb_senddone_func;
1575 void *nmb_sendrsrc_func;
1576 void *nmb_resetdone_func;
1577 ndis_medium nmb_medium;
1578 uint32_t nmb_busnum;
1579 uint32_t nmb_bustype;
1580 uint32_t nmb_adaptertype;
1581 device_object *nmb_deviceobj; /* Functional device */
1582 device_object *nmb_physdeviceobj; /* Physical device */
1583 device_object *nmb_nextdeviceobj; /* Next dev in stack */
1585 void *nmb_callmgraflist;
1586 void *nmb_miniportthread;
1587 void *nmb_setinfobuf;
1588 uint16_t nmb_setinfobuflen;
1589 uint16_t nmb_maxsendpkts;
1590 ndis_status nmb_fakestatus;
1591 void *nmb_lockhandler;
1592 ndis_unicode_string *nmb_adapterinstancename;
1593 void *nmb_timerqueue;
1594 uint32_t nmb_mactoptions;
1595 ndis_request *nmb_pendingreq;
1596 uint32_t nmb_maxlongaddrs;
1597 uint32_t nmb_maxshortaddrs;
1598 uint32_t nmb_currlookahead;
1599 uint32_t nmb_maxlookahead;
1600 void *nmb_interrupt_func;
1601 void *nmb_disableintr_func;
1602 void *nmb_enableintr_func;
1603 void *nmb_sendpkts_func;
1604 void *nmb_deferredsend_func;
1605 void *nmb_ethrxindicate_func;
1606 void *nmb_txrxindicate_func;
1607 void *nmb_fddirxindicate_func;
1608 void *nmb_ethrxdone_func;
1609 void *nmb_txrxdone_func;
1610 void *nmb_fddirxcond_func;
1611 void *nmb_status_func;
1612 void *nmb_statusdone_func;
1613 void *nmb_tdcond_func;
1614 void *nmb_querydone_func;
1615 void *nmb_setdone_func;
1616 void *nmb_wantxdone_func;
1617 void *nmb_wanrx_func;
1618 void *nmb_wanrxdone_func;
1620 * End of windows-specific portion of miniport block. Everything
1621 * below is BSD-specific.
1623 list_entry nmb_parmlist;
1624 ndis_resource_list *nmb_rlist;
1625 ndis_status nmb_getstat;
1626 nt_kevent nmb_getevent;
1627 ndis_status nmb_setstat;
1628 nt_kevent nmb_setevent;
1629 nt_kevent nmb_resetevent;
1630 io_workitem *nmb_returnitem;
1631 ndis_miniport_timer *nmb_timerlist;
1632 ndis_handle nmb_rxpool;
1633 list_entry nmb_returnlist;
1634 kspin_lock nmb_returnlock;
1635 TAILQ_ENTRY(ndis_miniport_block) link;
1638 TAILQ_HEAD(nd_head, ndis_miniport_block);
1640 typedef ndis_status (*ndis_init_handler)(ndis_status *, uint32_t *,
1641 ndis_medium *, uint32_t, ndis_handle, ndis_handle);
1642 typedef ndis_status (*ndis_queryinfo_handler)(ndis_handle, ndis_oid,
1643 void *, uint32_t, uint32_t *, uint32_t *);
1644 typedef ndis_status (*ndis_setinfo_handler)(ndis_handle, ndis_oid,
1645 void *, uint32_t, uint32_t *, uint32_t *);
1646 typedef ndis_status (*ndis_sendsingle_handler)(ndis_handle,
1647 ndis_packet *, uint32_t);
1648 typedef ndis_status (*ndis_sendmulti_handler)(ndis_handle,
1649 ndis_packet **, uint32_t);
1650 typedef void (*ndis_isr_handler)(uint8_t *, uint8_t *, ndis_handle);
1651 typedef void (*ndis_interrupt_handler)(ndis_handle);
1652 typedef int (*ndis_reset_handler)(uint8_t *, ndis_handle);
1653 typedef void (*ndis_halt_handler)(ndis_handle);
1654 typedef void (*ndis_return_handler)(ndis_handle, ndis_packet *);
1655 typedef void (*ndis_enable_interrupts_handler)(ndis_handle);
1656 typedef void (*ndis_disable_interrupts_handler)(ndis_handle);
1657 typedef void (*ndis_shutdown_handler)(void *);
1658 typedef void (*ndis_pnpevent_handler)(void *, int, void *, uint32_t);
1659 typedef void (*ndis_allocdone_handler)(ndis_handle, void *,
1660 ndis_physaddr *, uint32_t, void *);
1661 typedef uint8_t (*ndis_checkforhang_handler)(ndis_handle);
1663 typedef ndis_status (*driver_entry)(void *, unicode_string *);
1665 extern image_patch_table ndis_functbl[];
1667 #define NDIS_TASKQUEUE 1
1670 #define NDIS_PSTATE_RUNNING 1
1671 #define NDIS_PSTATE_SLEEPING 2
1673 #define NdisQueryPacket(p, pbufcnt, bufcnt, firstbuf, plen) \
1675 if ((firstbuf) != NULL) { \
1676 ndis_buffer **_first; \
1677 _first = firstbuf; \
1678 *(_first) = (p)->np_private.npp_head; \
1680 if ((plen) || (bufcnt) || (pbufcnt)) { \
1681 if ((p)->np_private.npp_validcounts == FALSE) { \
1683 unsigned int tlen = 0, pcnt = 0; \
1684 unsigned int add = 0; \
1685 unsigned int pktlen, off; \
1687 tmp = (p)->np_private.npp_head; \
1688 while (tmp != NULL) { \
1689 off = MmGetMdlByteOffset(tmp); \
1690 pktlen = MmGetMdlByteCount(tmp);\
1693 NDIS_BUFFER_TO_SPAN_PAGES(tmp); \
1695 tmp = tmp->mdl_next; \
1697 (p)->np_private.npp_count = add; \
1698 (p)->np_private.npp_totlen = tlen; \
1699 (p)->np_private.npp_physcnt = pcnt; \
1700 (p)->np_private.npp_validcounts = TRUE; \
1703 unsigned int *_pbufcnt; \
1704 _pbufcnt = (pbufcnt); \
1705 *(_pbufcnt) = (p)->np_private.npp_physcnt; \
1708 unsigned int *_bufcnt; \
1709 _bufcnt = (bufcnt); \
1710 *(_bufcnt) = (p)->np_private.npp_count; \
1713 unsigned int *_plen; \
1715 *(_plen) = (p)->np_private.npp_totlen; \
1721 extern int ndis_libinit(void);
1722 extern int ndis_libfini(void);
1723 extern int ndis_load_driver(vm_offset_t, void *);
1724 extern int ndis_unload_driver(void *);
1725 extern int ndis_mtop(struct mbuf *, ndis_packet **);
1726 extern int ndis_ptom(struct mbuf **, ndis_packet *);
1727 extern int ndis_get_info(void *, ndis_oid, void *, int *);
1728 extern int ndis_set_info(void *, ndis_oid, void *, int *);
1729 extern void *ndis_get_routine_address(struct image_patch_table *, char *);
1730 extern int ndis_get_supported_oids(void *, ndis_oid **, int *);
1731 extern int ndis_send_packets(void *, ndis_packet **, int);
1732 extern int ndis_send_packet(void *, ndis_packet *);
1733 extern int ndis_convert_res(void *);
1734 extern int ndis_alloc_amem(void *);
1735 extern void ndis_free_amem(void *);
1736 extern void ndis_free_packet(ndis_packet *);
1737 extern void ndis_free_bufs(ndis_buffer *);
1738 extern int ndis_reset_nic(void *);
1739 extern int ndis_halt_nic(void *);
1740 extern int ndis_shutdown_nic(void *);
1741 extern int ndis_pnpevent_nic(void *, int);
1742 extern int ndis_init_nic(void *);
1743 extern void ndis_return_packet(void *);
1744 extern int ndis_init_dma(void *);
1745 extern int ndis_destroy_dma(void *);
1746 extern int ndis_create_sysctls(void *);
1747 extern int ndis_add_sysctl(void *, char *, char *, char *, int);
1748 extern int ndis_flush_sysctls(void *);
1750 extern uint32_t NdisAddDevice(driver_object *, device_object *);
1751 extern void NdisAllocatePacketPool(ndis_status *,
1752 ndis_handle *, uint32_t, uint32_t);
1753 extern void NdisAllocatePacketPoolEx(ndis_status *,
1754 ndis_handle *, uint32_t, uint32_t, uint32_t);
1755 extern uint32_t NdisPacketPoolUsage(ndis_handle);
1756 extern void NdisFreePacketPool(ndis_handle);
1757 extern void NdisAllocatePacket(ndis_status *,
1758 ndis_packet **, ndis_handle);
1759 extern void NdisFreePacket(ndis_packet *);
1760 extern ndis_status NdisScheduleWorkItem(ndis_work_item *);
1761 extern void NdisMSleep(uint32_t);
1764 #endif /* _NDIS_VAR_H_ */