Deleted Added
full compact
ndis_var.h (124122) ndis_var.h (124165)
1/*
2 * Copyright (c) 2003
3 * Bill Paul <wpaul@windriver.com>. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
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.
19 *
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.
31 *
1/*
2 * Copyright (c) 2003
3 * Bill Paul <wpaul@windriver.com>. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
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.
19 *
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.
31 *
32 * $FreeBSD: head/sys/compat/ndis/ndis_var.h 124122 2004-01-04 07:47:33Z wpaul $
32 * $FreeBSD: head/sys/compat/ndis/ndis_var.h 124165 2004-01-06 07:09:26Z wpaul $
33 */
34
35#ifndef _NDIS_VAR_H_
36#define _NDIS_VAR_H_
37
38/* Forward declarations */
39struct ndis_miniport_block;
40struct ndis_mdriver_block;
41typedef struct ndis_miniport_block ndis_miniport_block;
42typedef struct ndis_mdriver_block ndis_mdriver_block;
43
44/* Base types */
45typedef uint32_t ndis_status;
46typedef void *ndis_handle;
47typedef uint32_t ndis_oid;
48typedef uint32_t ndis_error_code;
49typedef uint32_t ndis_kspin_lock;
50typedef uint8_t ndis_kirql;
51
52/*
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
55 * NT status codes.
56 */
57
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
134
135/*
136 * NDIS event codes. They are usually reported to NdisWriteErrorLogEntry().
137 */
138
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
174
175/*
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.
181 */
182
183/* Required OIDs */
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
212
213/* Optional OIDs. */
214#define OID_GEN_MEDIA_CAPABILITIES 0x00010201
215#define OID_GEN_PHYSICAL_MEDIUM 0x00010202
216
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
223
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
243
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
261
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
270
271/* PnP/PM Statistics (Optional). */
272#define OID_PNP_WAKE_UP_OK 0xFD020200
273#define OID_PNP_WAKE_UP_ERROR 0xFD020201
274
275/* The following bits are defined for OID_PNP_ENABLE_WAKE_UP */
276#define NDIS_PNP_WAKE_UP_MAGIC_PACKET 0x00000001
277#define NDIS_PNP_WAKE_UP_PATTERN_MATCH 0x00000002
278#define NDIS_PNP_WAKE_UP_LINK_CHANGE 0x00000004
279
280/* 802.11 OIDs */
281#define OID_802_11_BSSID 0x0D010101
282#define OID_802_11_SSID 0x0D010102
283#define OID_802_11_NETWORK_TYPES_SUPPORTED 0x0D010203
284#define OID_802_11_NETWORK_TYPE_IN_USE 0x0D010204
285#define OID_802_11_TX_POWER_LEVEL 0x0D010205
286#define OID_802_11_RSSI 0x0D010206
287#define OID_802_11_RSSI_TRIGGER 0x0D010207
288#define OID_802_11_INFRASTRUCTURE_MODE 0x0D010108
289#define OID_802_11_FRAGMENTATION_THRESHOLD 0x0D010209
290#define OID_802_11_RTS_THRESHOLD 0x0D01020A
291#define OID_802_11_NUMBER_OF_ANTENNAS 0x0D01020B
292#define OID_802_11_RX_ANTENNA_SELECTED 0x0D01020C
293#define OID_802_11_TX_ANTENNA_SELECTED 0x0D01020D
294#define OID_802_11_SUPPORTED_RATES 0x0D01020E
295#define OID_802_11_DESIRED_RATES 0x0D010210
296#define OID_802_11_CONFIGURATION 0x0D010211
297#define OID_802_11_STATISTICS 0x0D020212
298#define OID_802_11_ADD_WEP 0x0D010113
299#define OID_802_11_REMOVE_WEP 0x0D010114
300#define OID_802_11_DISASSOCIATE 0x0D010115
301#define OID_802_11_POWER_MODE 0x0D010216
302#define OID_802_11_BSSID_LIST 0x0D010217
303#define OID_802_11_AUTHENTICATION_MODE 0x0D010118
304#define OID_802_11_PRIVACY_FILTER 0x0D010119
305#define OID_802_11_BSSID_LIST_SCAN 0x0D01011A
306#define OID_802_11_WEP_STATUS 0x0D01011B
307#define OID_802_11_ENCRYPTION_STATUS OID_802_11_WEP_STATUS
308#define OID_802_11_RELOAD_DEFAULTS 0x0D01011C
309#define OID_802_11_ADD_KEY 0x0D01011D
310#define OID_802_11_REMOVE_KEY 0x0D01011E
311#define OID_802_11_ASSOCIATION_INFORMATION 0x0D01011F
312#define OID_802_11_TEST 0x0D010120
313
314/* structures/definitions for 802.11 */
315#define NDIS_80211_NETTYPE_11FH 0x00000000
316#define NDIS_80211_NETTYPE_11DS 0x00000001
317#define NDIS_80211_NETTYPE_11OFDM5 0x00000002
318#define NDIS_80211_NETTYPE_11OFDM24 0x00000003
319
320struct ndis_80211_nettype_list {
321 uint32_t ntl_items;
322 uint32_t ntl_type[1];
323};
324
325#define NDIS_80211_POWERMODE_CAM 0x00000000
326#define NDIS_80211_POWERMODE_MAX_PSP 0x00000001
327#define NDIS_80211_POWERMODE_FAST_PSP 0x00000002
328
329typedef uint32_t ndis_80211_power; /* Power in milliwatts */
330typedef uint32_t ndis_80211_rssi; /* Signal strength in dBm */
331
332struct ndis_80211_config_fh {
333 uint32_t ncf_length;
334 uint32_t ncf_hoppatterh;
335 uint32_t ncf_hopset;
336 uint32_t ncf_dwelltime;
337};
338
339typedef struct ndis_80211_config_fh ndis_80211_config_fh;
340
341struct ndis_80211_config {
342 uint32_t nc_length;
343 uint32_t nc_beaconperiod;
344 uint32_t nc_atimwin;
345 uint32_t nc_dsconfig;
346 ndis_80211_config_fh nc_fhconfig;
347};
348
349typedef struct ndis_80211_config ndis_80211_config;
350
351struct ndis_80211_stats {
352 uint32_t ns_length;
353 uint64_t ns_txfragcnt;
354 uint64_t ns_txmcastcnt;
355 uint64_t ns_failedcnt;
356 uint64_t ns_retrycnt;
357 uint64_t ns_multiretrycnt;
358 uint64_t ns_rtssuccesscnt;
359 uint64_t ns_rtsfailcnt;
360 uint64_t ns_ackfailcnt;
361 uint64_t ns_dupeframecnt;
362 uint64_t ns_rxfragcnt;
363 uint64_t ns_rxmcastcnt;
364 uint64_t ns_fcserrcnt;
365};
366
367typedef struct ndis_80211_stats ndis_80211_stats;
368
369typedef uint32_t ndis_80211_key_idx;
370
371struct ndis_80211_wep {
372 uint32_t nw_length;
373 uint32_t nw_keyidx;
374 uint32_t nw_keylen;
375 uint8_t nw_keydata[256];
376};
377
378typedef struct ndis_80211_wep ndis_80211_wep;
379
380#define NDIS_80211_WEPKEY_TX 0x80000000
381#define NDIS_80211_WEPKEY_PERCLIENT 0x40000000
382
383#define NDIS_80211_NET_INFRA_IBSS 0x00000000
384#define NDIS_80211_NET_INFRA_BSS 0x00000001
385#define NDIS_80211_NET_INFRA_AUTO 0x00000002
386
387#define NDIS_80211_AUTHMODE_OPEN 0x00000000
388#define NDIS_80211_AUTHMODE_SHARED 0x00000001
389#define NDIS_80211_AUTHMODE_AUTO 0x00000002
390#define NDIS_80211_AUTHMODE_WPA 0x00000003
391#define NDIS_80211_AUTHMODE_WPAPSK 0x00000004
392#define NDIS_80211_AUTHMODE_WPANONE 0x00000005
393
394typedef uint8_t ndis_80211_rates[8];
395typedef uint8_t ndis_80211_rates_ex[16];
396typedef uint8_t ndis_80211_macaddr[6];
397
398struct ndis_80211_ssid {
399 uint32_t ns_ssidlen;
400 uint8_t ns_ssid[32];
401};
402
403typedef struct ndis_80211_ssid ndis_80211_ssid;
404
405struct ndis_wlan_bssid {
406 uint32_t nwb_length;
407 ndis_80211_macaddr nwb_macaddr;
408 uint8_t nwb_rsvd[2];
409 ndis_80211_ssid nwb_ssid;
410 uint32_t nwb_privacy;
411 ndis_80211_rssi nwb_rssi;
412 uint32_t nwb_nettype;
413 ndis_80211_config nwb_config;
414 uint32_t nwb_netinfra;
415 ndis_80211_rates nwb_supportedrates;
416};
417
418typedef struct ndis_wlan_bssid ndis_wlan_bssid;
419
420struct ndis_80211_bssid_list {
421 uint32_t nbl_items;
422 ndis_wlan_bssid nbl_bssid[1];
423};
424
425typedef struct ndis_80211_bssid_list ndis_80211_bssid_list;
426
427struct ndis_wlan_bssid_ex {
428 uint32_t nwbx_len;
429 ndis_80211_macaddr nwbx_macaddr;
430 uint8_t nwbx_rsvd[2];
431 ndis_80211_ssid nwbx_ssid;
432 uint32_t nwbx_privacy;
433 ndis_80211_rssi nwbx_rssi;
434 uint32_t nwbx_nettype;
435 ndis_80211_config nwbx_config;
436 uint32_t nwbx_netinfra;
437 ndis_80211_rates_ex nwbx_supportedrates;
438 uint32_t nwbx_ielen;
439 uint32_t nwbx_ies[1];
440};
441
442typedef struct ndis_wlan_bssid_ex ndis_wlan_bssid_ex;
443
444struct ndis_80211_bssid_list_ex {
445 uint32_t nblx_items;
446 ndis_wlan_bssid nblx_bssid[1];
447};
448
449typedef struct ndis_80211_bssid_list_ex ndis_80211_bssid_list_ex;
450
451struct ndis_80211_fixed_ies {
452 uint8_t nfi_tstamp[8];
453 uint16_t nfi_beaconint;
454 uint16_t nfi_caps;
455};
456
457struct ndis_80211_variable_ies {
458 uint8_t nvi_elemid;
459 uint8_t nvi_len;
460 uint8_t nvi_data[1];
461};
462
463typedef uint32_t ndis_80211_fragthresh;
464typedef uint32_t ndis_80211_rtsthresh;
465typedef uint32_t ndis_80211_antenna;
466
467#define NDIS_80211_PRIVFILT_ACCEPTALL 0x00000000
468#define NDIS_80211_PRIVFILT_8021XWEP 0x00000001
469
470#define NDIS_80211_WEPSTAT_ENABLED 0x00000000
471#define NDIS_80211_WEPSTAT_ENC1ENABLED NDIS_80211_WEPSTAT_ENABLED
472#define NDIS_80211_WEPSTAT_DISABLED 0x00000001
473#define NDIS_80211_WEPSTAT_ENCDISABLED NDIS_80211_WEPSTAT_DISABLED
474#define NDIS_80211_WEPSTAT_KEYABSENT 0x00000002
475#define NDIS_80211_WEPSTAT_ENC1KEYABSENT NDIS_80211_WEPSTAT_KEYABSENT
476#define NDIS_80211_WEPSTAT_NOTSUPPORTED 0x00000003
477#define NDIS_80211_WEPSTAT_ENCNOTSUPPORTED NDIS_80211_WEPSTAT_NOTSUPPORTED
478#define NDIS_80211_WEPSTAT_ENC2ENABLED 0x00000004
479#define NDIS_80211_WEPSTAT_ENC2KEYABSENT 0x00000005
480#define NDIS_80211_WEPSTAT_ENC3ENABLED 0x00000006
481#define NDIS_80211_WEPSTAT_ENC3KEYABSENT 0x00000007
482
483#define NDIS_80211_RELOADDEFAULT_WEP 0x00000000
484
485#define NDIS_80211_STATUSTYPE_AUTH 0x00000000
486
487struct ndis_80211_status_indication {
488 uint32_t nsi_type;
489};
490
491typedef struct ndis_80211_status_indication ndis_80211_status_indication;
492
493struct ndis_80211_auth_request {
494 uint32_t nar_len;
495 ndis_80211_macaddr nar_bssid;
496 uint32_t nar_flags;
497};
498
499typedef struct ndis_80211_auth_request ndis_80211_auth_request;
500
501struct ndis_80211_key {
502 uint32_t nk_len;
503 uint32_t nk_keyidx;
504 uint32_t nk_keylen;
505 ndis_80211_macaddr nk_bssid;
506 uint64_t nk_keyrsc;
507 uint8_t nk_keydata[256];
508};
509
510typedef struct ndis_80211_key ndis_80211_key;
511
512struct ndis_80211_remove_key {
513 uint32_t nk_len;
514 uint32_t nk_keyidx;
515 ndis_80211_macaddr nk_bssid;
516};
517
518typedef struct ndis_80211_remove_key ndis_80211_remove_key;
519
520#define NDIS_80211_AI_REQFI_CAPABILITIES 0x00000001
521#define NDIS_80211_AI_REQFI_LISTENINTERVAL 0x00000002
522#define NDIS_80211_AI_REQFI_CURRENTAPADDRESS 0x00000004
523
524#define NDIS_80211_AI_RESFI_CAPABILITIES 0x00000001
525#define NDIS_80211_AI_RESFI_STATUSCODE 0x00000002
526#define NDIS_80211_AI_RESFI_ASSOCIATIONID 0x00000004
527
528struct ndis_80211_ai_reqfi {
529 uint16_t naq_caps;
530 uint16_t naq_listentint;
531 ndis_80211_macaddr naq_currentapaddr;
532};
533
534typedef struct ndis_80211_ai_reqfi ndis_80211_ai_reqfi;
535
536struct ndis_80211_ai_resfi {
537 uint16_t nas_caps;
538 uint16_t nas_statuscode;
539 uint16_t nas_associd;
540};
541
542typedef struct ndis_80211_ai_resfi ndis_80211_ai_resfi;
543
544struct ndis_80211_assoc_info {
545 uint32_t nai_len;
546 uint16_t nai_avail_req_fixed_ies;
547 ndis_80211_ai_reqfi nai_req_fixed_ies;
548 uint32_t nai_req_ielen;
549 uint32_t nai_offset_req_ies;
550 uint16_t nai_avail_resp_fixed_ies;
551 ndis_80211_ai_resfi nai_resp_fixed_iex;
552 uint32_t nai_resp_ielen;
553 uint32_t nai_offset_resp_ies;
554};
555
556typedef struct ndis_80211_assoc_info ndis_80211_assoc_info;
557
558struct ndis_80211_auth_event {
559 ndis_80211_status_indication nae_status;
560 ndis_80211_auth_request nae_request[1];
561};
562
563typedef struct ndis_80211_auth_event ndis_80211_auth_event;
564
565struct ndis_80211_test {
566 uint32_t nt_len;
567 uint32_t nt_type;
568 union {
569 ndis_80211_auth_event nt_authevent;
570 uint32_t nt_rssitrigger;
571 } u;
572};
573
574typedef struct ndis_80211_test ndis_80211_test;
575
576/*
577 * Attribures of NDIS drivers. Not all drivers support
578 * all attributes.
579 */
580
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
591enum ndis_media_state {
592 nmc_connected,
593 nmc_disconnected
594};
595
596typedef enum ndis_media_state ndis_media_state;
597
598/* Ndis Packet Filter Bits (OID_GEN_CURRENT_PACKET_FILTER). */
599
600#define NDIS_PACKET_TYPE_DIRECTED 0x00000001
601#define NDIS_PACKET_TYPE_MULTICAST 0x00000002
602#define NDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004
603#define NDIS_PACKET_TYPE_BROADCAST 0x00000008
604#define NDIS_PACKET_TYPE_SOURCE_ROUTING 0x00000010
605#define NDIS_PACKET_TYPE_PROMISCUOUS 0x00000020
606#define NDIS_PACKET_TYPE_SMT 0x00000040
607#define NDIS_PACKET_TYPE_ALL_LOCAL 0x00000080
608#define NDIS_PACKET_TYPE_GROUP 0x00001000
609#define NDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x00002000
610#define NDIS_PACKET_TYPE_FUNCTIONAL 0x00004000
611#define NDIS_PACKET_TYPE_MAC_FRAME 0x00008000
612
613
614/* Ndis MAC option bits (OID_GEN_MAC_OPTIONS). */
615
616#define NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA 0x00000001
617#define NDIS_MAC_OPTION_RECEIVE_SERIALIZED 0x00000002
618#define NDIS_MAC_OPTION_TRANSFERS_NOT_PEND 0x00000004
619#define NDIS_MAC_OPTION_NO_LOOPBACK 0x00000008
620#define NDIS_MAC_OPTION_FULL_DUPLEX 0x00000010
621#define NDIS_MAC_OPTION_EOTX_INDICATION 0x00000020
622#define NDIS_MAC_OPTION_8021P_PRIORITY 0x00000040
623#define NDIS_MAC_OPTION_SUPPORTS_MAC_ADDRESS_OVERWRITE 0x00000080
624#define NDIS_MAC_OPTION_RECEIVE_AT_DPC 0x00000100
625#define NDIS_MAC_OPTION_8021Q_VLAN 0x00000200
626#define NDIS_MAC_OPTION_RESERVED 0x80000000
627
628#define NDIS_DMA_24BITS 0x00
629#define NDIS_DMA_32BITS 0x01
630#define NDIS_DMA_64BITS 0x02
631
632struct ndis_physaddr {
633 uint64_t np_quad;
634#ifdef notdef
635 uint32_t np_low;
636 uint32_t np_high;
637#endif
638};
639
640typedef struct ndis_physaddr ndis_physaddr;
641
642struct ndis_ansi_string {
643 uint16_t nas_len;
644 uint16_t nas_maxlen;
645 char *nas_buf;
646};
647
648typedef struct ndis_ansi_string ndis_ansi_string;
649
650/*
651 * nus_buf is really a wchar_t *, but it's inconvenient to include
652 * all the necessary header goop needed to define it, and it's a
653 * pointer anyway, so for now, just make it a uint16_t *.
654 */
655struct ndis_unicode_string {
656 uint16_t nus_len;
657 uint16_t nus_maxlen;
658 uint16_t *nus_buf;
659};
660
661typedef struct ndis_unicode_string ndis_unicode_string;
662
663
664enum ndis_parm_type {
665 ndis_parm_int,
666 ndis_parm_hexint,
667 ndis_parm_string,
668 ndis_parm_multistring,
669 ndis_parm_binary
670};
671
672typedef enum ndis_parm_type ndis_parm_type;
673
674struct ndis_binary_data {
675 uint16_t nbd_len;
676 void *nbd_buf;
677};
678
679typedef struct ndis_binary_data ndis_binary_data;
680
681struct ndis_config_parm {
682 ndis_parm_type ncp_type;
683 union {
684 uint32_t ncp_intdata;
685 ndis_unicode_string ncp_stringdata;
686 ndis_binary_data ncp_binarydata;
687 } ncp_parmdata;
688};
689
690typedef struct ndis_config_parm ndis_config_parm;
691
692struct ndis_list_entry {
693 struct ndis_list_entry *nle_flink;
694 struct ndis_list_entry *nle_blink;
695};
696
697typedef struct ndis_list_entry ndis_list_entry;
698
699struct ndis_bind_paths {
700 uint32_t nbp_number;
701 ndis_unicode_string nbp_paths[1];
702};
703
704typedef struct ndis_bind_paths ndis_bind_paths;
705
706struct dispatch_header {
707 uint8_t dh_type;
708 uint8_t dh_abs;
709 uint8_t dh_size;
710 uint8_t dh_inserted;
711 uint32_t dh_sigstate;
712 ndis_list_entry dh_waitlisthead;
713};
714
715struct ndis_ktimer {
716 struct dispatch_header nk_header;
717 uint64_t nk_duetime;
718 ndis_list_entry nk_timerlistentry;
719 void *nk_dpc;
720 uint32_t nk_period;
721};
722
723struct ndis_kevent {
724 struct dispatch_header nk_header;
725};
726
727struct ndis_event {
728 struct ndis_kevent ne_event;
729};
730
731typedef struct ndis_event ndis_event;
732
733/* Kernel defered procedure call (i.e. timer callback) */
734
735struct ndis_kdpc;
736typedef void (*ndis_kdpc_func)(struct ndis_kdpc *, void *, void *, void *);
737
738struct ndis_kdpc {
739 uint16_t nk_type;
740 uint8_t nk_num;
741 uint8_t nk_importance;
742 ndis_list_entry nk_dpclistentry;
743 ndis_kdpc_func nk_deferedfunc;
744 void *nk_deferredctx;
745 void *nk_sysarg1;
746 void *nk_sysarg2;
747 uint32_t *nk_lock;
748};
749
750struct ndis_timer {
751 struct ndis_ktimer nt_timer;
752 struct ndis_kdpc nt_dpc;
753};
754
755typedef struct ndis_timer ndis_timer;
756
757typedef void (*ndis_timer_function)(void *, void *, void *, void *);
758
759struct ndis_miniport_timer {
760 struct ndis_ktimer nmt_ktimer;
761 struct ndis_kdpc nmt_dpc;
762 ndis_timer_function nmt_timerfunc;
763 void *nmt_timerctx;
764 struct ndis_miniport_timer *nmt_nexttimer;
765};
766
767typedef struct ndis_miniport_timer ndis_miniport_timer;
768
769struct ndis_spin_lock {
770 ndis_kspin_lock nsl_spinlock;
771 ndis_kirql nsl_kirql;
772};
773
774typedef struct ndis_spin_lock ndis_spin_lock;
775
776struct ndis_request {
777 uint8_t nr_macreserved[4*sizeof(void *)];
778 uint32_t nr_requesttype;
779 union _ndis_data {
780 struct _ndis_query_information {
781 ndis_oid nr_oid;
782 void *nr_infobuf;
783 uint32_t nr_infobuflen;
784 uint32_t nr_byteswritten;
785 uint32_t nr_bytesneeded;
786 } ndis_query_information;
787 struct _ndis_set_information {
788 ndis_oid nr_oid;
789 void *nr_infobuf;
790 uint32_t nr_infobuflen;
791 uint32_t nr_byteswritten;
792 uint32_t nr_bytesneeded;
793 } ndis_set_information;
794 } ndis_data;
795 /* NDIS 5.0 extentions */
796 uint8_t nr_ndis_rsvd[9 * sizeof(void *)];
797 union {
798 uint8_t nr_callmgr_rsvd[2 * sizeof(void *)];
799 uint8_t nr_protocol_rsvd[2 * sizeof(void *)];
800 } u;
801 uint8_t nr_miniport_rsvd[2 * sizeof(void *)];
802};
803
804typedef struct ndis_request ndis_request;
805
806/*
807 * Filler, not used.
808 */
809struct ndis_miniport_interrupt {
810 void *ni_introbj;
811 ndis_spin_lock ni_dpccountlock;
812 void *ni_rsvd;
813 void *ni_isrfunc;
814 void *ni_dpcfunc;
815 struct ndis_kdpc ni_dpc;
816 ndis_miniport_block *ni_block;
817 uint8_t ni_dpccnt;
818 uint8_t ni_filler1;
819 struct ndis_kevent ni_dpcsdoneevent;
820 uint8_t ni_shared;
821 uint8_t ni_isrreq;
822};
823
824typedef struct ndis_miniport_interrupt ndis_miniport_interrupt;
825
826enum ndis_interrupt_mode {
827 nim_level,
828 nim_latched
829};
830
831typedef enum ndis_interrupt_mode ndis_interrupt_mode;
832
833struct ndis_work_item;
834
835typedef void (*ndis_proc)(struct ndis_work_item *, void *);
836
837struct ndis_work_item {
838 void *nwi_ctx;
839 ndis_proc nwi_func;
840 uint8_t nwi_wraprsvd[sizeof(void *) * 8];
841};
842
843typedef struct ndis_work_item ndis_work_item;
844
845struct ndis_buffer {
846 struct ndis_buffer *nb_next;
847 uint16_t nb_size;
848 uint16_t nb_flags;
849 void *nb_process;
850 void *nb_mappedsystemva;
851 void *nb_startva;
852 uint32_t nb_bytecount;
853 uint32_t nb_byteoffset;
854};
855
856typedef struct ndis_buffer ndis_buffer;
857
858struct ndis_sc_element {
859 ndis_physaddr nse_addr;
860 uint32_t nse_len;
861 uint32_t *nse_rsvd;
862};
863
864typedef struct ndis_sc_element ndis_sc_element;
865
866#define NDIS_MAXSEG 32
867struct ndis_sc_list {
868 uint32_t nsl_frags;
869 uint32_t *nsl_rsvd;
870 ndis_sc_element nsl_elements[NDIS_MAXSEG];
871};
872
873typedef struct ndis_sc_list ndis_sc_list;
874
875enum ndis_perpkt_info {
876 ndis_tcpipcsum_info,
877 ndis_ipsec_info,
878 ndis_largesend_info,
879 ndis_classhandle_info,
880 ndis_rsvd,
881 ndis_sclist_info,
882 ndis_ieee8021q_info,
883 ndis_originalpkt_info,
884 ndis_packetcancelid,
885 ndis_maxpkt_info
886};
887
888typedef enum ndis_perpkt_info ndis_perpkt_info;
889
890struct ndis_packet_extension {
891 void *npe_info[ndis_maxpkt_info];
892};
893
894typedef struct ndis_packet_extension ndis_packet_extension;
895
896struct ndis_packet_private {
897 uint32_t npp_physcnt;
898 uint32_t npp_totlen;
899 ndis_buffer *npp_head;
900 ndis_buffer *npp_tail;
901
902 void *npp_pool;
903 uint32_t npp_count;
904 uint32_t npp_flags;
905 uint8_t npp_validcounts;
906 uint8_t npp_ndispktflags;
907 uint16_t npp_packetooboffset;
908};
909
910#define NDIS_FLAGS_PROTOCOL_ID_MASK 0x0000000F
911#define NDIS_FLAGS_MULTICAST_PACKET 0x00000010
912#define NDIS_FLAGS_RESERVED2 0x00000020
913#define NDIS_FLAGS_RESERVED3 0x00000040
914#define NDIS_FLAGS_DONT_LOOPBACK 0x00000080
915#define NDIS_FLAGS_IS_LOOPBACK_PACKET 0x00000100
916#define NDIS_FLAGS_LOOPBACK_ONLY 0x00000200
917#define NDIS_FLAGS_RESERVED4 0x00000400
918#define NDIS_FLAGS_DOUBLE_BUFFERED 0x00000800
919#define NDIS_FLAGS_SENT_AT_DPC 0x00001000
920#define NDIS_FLAGS_USES_SG_BUFFER_LIST 0x00002000
921
922#define NDIS_PROTOCOL_ID_DEFAULT 0x00
923#define NDIS_PROTOCOL_ID_TCP_IP 0x02
924#define NDIS_PROTOCOL_ID_IPX 0x06
925#define NDIS_PROTOCOL_ID_NBF 0x07
926#define NDIS_PROTOCOL_ID_MAX 0x0F
927#define NDIS_PROTOCOL_ID_MASK 0x0F
928
929typedef struct ndis_packet_private ndis_packet_private;
930
931enum ndis_classid {
932 ndis_class_802_3prio,
933 ndis_class_wirelesswan_mbx,
934 ndis_class_irda_packetinfo,
935 ndis_class_atm_aainfo
936};
937
938typedef enum ndis_classid ndis_classid;
939
940struct ndis_mediaspecific_info {
941 uint32_t nmi_nextentoffset;
942 ndis_classid nmi_classid;
943 uint32_t nmi_size;
944 uint8_t nmi_classinfo[1];
945};
946
947typedef struct ndis_mediaspecific_info ndis_mediaspecific_info;
948
949struct ndis_packet_oob {
950 union {
951 uint64_t npo_timetotx;
952 uint64_t npo_timetxed;
953 } u;
954 uint64_t npo_timerxed;
955 uint32_t npo_hdrlen;
956 uint32_t npo_mediaspecific_len;
957 void *npo_mediaspecific;
958 ndis_status npo_status;
959};
960
961typedef struct ndis_packet_oob ndis_packet_oob;
962
963struct ndis_packet {
964 ndis_packet_private np_private;
965 union {
966 /* For connectionless miniports. */
967 struct {
968 uint8_t np_miniport_rsvd[2 * sizeof(void *)];
969 uint8_t np_wrapper_rsvd[2 * sizeof(void *)];
970 } np_clrsvd;
971 /* For de-serialized miniports */
972 struct {
973 uint8_t np_miniport_rsvdex[3 * sizeof(void *)];
974 uint8_t np_wrapper_rsvdex[sizeof(void *)];
975 } np_dsrsvd;
976 struct {
977 uint8_t np_mac_rsvd[4 * sizeof(void *)];
978 } np_macrsvd;
979 } u;
980 uint32_t *np_rsvd[2];
981
982 /*
983 * This next part is probably wrong, but we need some place
984 * to put the out of band data structure...
985 */
986 ndis_packet_oob np_oob;
987 ndis_packet_extension np_ext;
988 ndis_sc_list np_sclist;
989
990 /* BSD-specific stuff which should be invisible to drivers. */
991
992 uint32_t np_refcnt;
993 void *np_softc;
994 void *np_m0;
995 int np_txidx;
996};
997
998typedef struct ndis_packet ndis_packet;
999
1000/* mbuf ext type for NDIS */
1001#define EXT_NDIS 0x999
1002
1003struct ndis_filterdbs {
1004 union {
1005 void *nf_ethdb;
1006 void *nf_nulldb;
1007 } u;
1008 void *nf_trdb;
1009 void *nf_fddidb;
1010 void *nf_arcdb;
1011};
1012
1013typedef struct ndis_filterdbs ndis_filterdbs;
1014
1015enum ndis_medium {
1016 NdisMedium802_3,
1017 NdisMedium802_5,
1018 NdisMediumFddi,
1019 NdisMediumWan,
1020 NdisMediumLocalTalk,
1021 NdisMediumDix, /* defined for convenience, not a real medium */
1022 NdisMediumArcnetRaw,
1023 NdisMediumArcnet878_2,
1024 NdisMediumAtm,
1025 NdisMediumWirelessWan,
1026 NdisMediumIrda,
1027 NdisMediumBpc,
1028 NdisMediumCoWan,
1029 NdisMedium1394,
1030 NdisMediumMax
1031};
1032
1033typedef enum ndis_medium ndis_medium;
1034/*
1035enum interface_type {
1036 InterfaceTypeUndefined = -1,
1037 Internal,
1038 Isa,
1039 Eisa,
1040 MicroChannel,
1041 TurboChannel,
1042 PCIBus,
1043 VMEBus,
1044 NuBus,
1045 PCMCIABus,
1046 CBus,
1047 MPIBus,
1048 MPSABus,
1049 ProcessorInternal,
1050 InternalPowerBus,
1051 PNPISABus,
1052 PNPBus,
1053 MaximumInterfaceType
1054};
1055*/
1056enum ndis_interface_type {
1057 NdisInterfaceInternal = Internal,
1058 NdisInterfaceIsa = Isa,
1059 NdisInterfaceEisa = Eisa,
1060 NdisInterfaceMca = MicroChannel,
1061 NdisInterfaceTurboChannel = TurboChannel,
1062 NdisInterfacePci = PCIBus,
1063 NdisInterfacePcMcia = PCMCIABus
1064};
1065
1066typedef enum ndis_interface_type ndis_interface_type;
1067
1068struct ndis_paddr_unit {
1069 ndis_physaddr npu_physaddr;
1070 uint32_t npu_len;
1071};
1072
1073typedef struct ndis_paddr_unit ndis_paddr_unit;
1074
1075struct ndis_map_arg {
1076 ndis_paddr_unit *nma_fraglist;
1077 int nma_cnt;
1078 int nma_max;
1079};
1080
1081/*
1082 * Miniport characteristics were originally defined in the NDIS 3.0
1083 * spec and then extended twice, in NDIS 4.0 and 5.0.
1084 */
1085
1086struct ndis_miniport_characteristics {
1087
1088 /* NDIS 3.0 */
1089
1090 uint8_t nmc_version_major;
1091 uint8_t nmc_version_minor;
1092 uint16_t nmc_pad;
1093 uint32_t nmc_rsvd;
1094 void * nmc_checkhang_func;
1095 void * nmc_disable_interrupts_func;
1096 void * nmc_enable_interrupts_func;
1097 void * nmc_halt_func;
1098 void * nmc_interrupt_func;
1099 void * nmc_init_func;
1100 void * nmc_isr_func;
1101 void * nmc_queryinfo_func;
1102 void * nmc_reconfig_func;
1103 void * nmc_reset_func;
1104 void * nmc_sendsingle_func;
1105 void * nmc_setinfo_func;
1106 void * nmc_transferdata_func;
1107
1108 /* NDIS 4.0 extentions */
1109
1110 void * nmc_return_packet_func;
1111 void * nmc_sendmulti_func;
1112 void * nmc_allocate_complete_func;
1113
1114 /* NDIS 5.0 extensions */
1115
1116 void * nmc_cocreatevc_func;
1117 void * nmc_codeletevc_func;
1118 void * nmc_coactivatevc_func;
1119 void * nmc_codeactivatevc_func;
1120 void * nmc_comultisend_func;
1121 void * nmc_corequest_func;
1122
1123 /* NDIS 5.1 extentions */
1124
1125 void * nmc_canceltxpkts_handler;
1126 void * nmc_pnpevent_handler;
1127 void * nmc_shutdown_handler;
1128 void * nmc_rsvd0;
1129 void * nmc_rsvd1;
1130 void * nmc_rsvd2;
1131 void * nmc_rsvd3;
1132};
1133
1134typedef struct ndis_miniport_characteristics ndis_miniport_characteristics;
1135
1136struct ndis_driver_object {
1137 char *ndo_ifname;
1138 void *ndo_softc;
1139 ndis_miniport_characteristics ndo_chars;
1140};
1141
1142typedef struct ndis_driver_object ndis_driver_object;
1143
1144struct ndis_reference {
1145 ndis_kspin_lock nr_spinlock;
1146 uint16_t nr_refcnt;
1147 uint8_t nr_closing;
1148};
1149
1150typedef struct ndis_reference ndis_reference;
1151
1152struct ndis_timer_entry {
1153 struct callout nte_ch;
1154 ndis_miniport_timer *nte_timer;
1155 TAILQ_ENTRY(ndis_timer_entry) link;
1156};
1157
1158TAILQ_HEAD(nte_head, ndis_timer_entry);
1159
1160/*
1161 * The miniport block is basically the internal NDIS handle. We need
1162 * to define this because, unfortunately, it is not entirely opaque
1163 * to NDIS drivers. For one thing, it contains the function pointer
1164 * to the NDIS packet receive handler, which is invoked out of the
1165 * NDIS block via a macro rather than a function pointer. (The
1166 * NdisMIndicateReceivePacket() routine is a macro rather than
1167 * a function.) For another, the driver maintains a pointer to the
1168 * miniport block and passes it as a handle to various NDIS functions.
1169 * (The driver never really knows this because it's hidden behind
1170 * an ndis_handle though.)
1171 *
1172 * The miniport block has two parts: the first part contains fields
1173 * that must never change, since they are referenced by driver
1174 * binaries through macros. The second part is ignored by the driver,
1175 * but contains various things used internaly by NDIS.SYS. In our
1176 * case, we define the first 'immutable' part exactly as it appears
1177 * in Windows, but don't bother duplicating the Windows definitions
1178 * for the second part. Instead, we replace them with a few BSD-specific
1179 * things.
1180 */
1181
1182struct ndis_miniport_block {
1183 /*
1184 * Windows-specific portion -- DO NOT MODIFY OR NDIS
1185 * DRIVERS WILL NOT WORK.
1186 */
1187 void *nmb_signature; /* magic number */
1188 ndis_miniport_block *nmb_nextminiport;
1189 ndis_mdriver_block *nmb_driverhandle;
1190 ndis_handle nmb_miniportadapterctx;
1191 ndis_unicode_string nmb_name;
1192 ndis_bind_paths *nmb_bindpaths;
1193 ndis_handle nmb_openqueue;
1194 ndis_reference nmb_ref;
1195 ndis_handle nmb_devicectx;
1196 uint8_t nmb_padding;
1197 uint8_t nmb_lockacquired;
1198 uint8_t nmb_pmodeopens;
1199 uint8_t nmb_assignedcpu;
1200 ndis_kspin_lock nmb_lock;
1201 ndis_request *nmb_mediarequest;
1202 ndis_miniport_interrupt *nmb_interrupt;
1203 uint32_t nmb_flags;
1204 uint32_t nmb_pnpflags;
1205 ndis_list_entry nmb_packetlist;
1206 ndis_packet *nmb_firstpendingtxpacket;
1207 ndis_packet *nmb_returnpacketqueue;
1208 uint32_t nmb_requestbuffer;
1209 void *nmb_setmcastbuf;
1210 ndis_miniport_block *nmb_primaryminiport;
1211 void *nmb_wrapperctx;
1212 void *nmb_busdatactx;
1213 uint32_t nmb_pnpcaps;
1214 cm_resource_list *nmb_resources;
1215 ndis_timer nmb_wkupdpctimer;
1216 ndis_unicode_string nmb_basename;
1217 ndis_unicode_string nmb_symlinkname;
1218 uint32_t nmb_checkforhangsecs;
1219 uint16_t nmb_cfhticks;
1220 uint16_t nmb_cfhcurrticks;
1221 ndis_status nmb_resetstatus;
1222 ndis_handle nmb_resetopen;
1223 ndis_filterdbs nmb_filterdbs;
1224 void *nmb_pktind_func;
1225 void *nmb_senddone_func;
1226 void *nmb_sendrsrc_func;
1227 void *nmb_resetdone_func;
1228 ndis_medium nmb_medium;
1229 uint32_t nmb_busnum;
1230 uint32_t nmb_bustye;
1231 uint32_t nmb_adaptertype;
1232 void *nmb_deviceobj;
1233 void *nmb_physdeviceobj;
1234 void *nmb_nextdeviceobj;
1235 void *nmb_mapreg;
1236 void *nmb_callmgraflist;
1237 void *nmb_miniportthread;
1238 void *nmb_setinfobuf;
1239 uint16_t nmb_setinfobuflen;
1240 uint16_t nmb_maxsendpkts;
1241 ndis_status nmb_fakestatus;
1242 void *nmb_lockhandler;
1243 ndis_unicode_string *nmb_adapterinstancename;
1244 void *nmb_timerqueue;
1245 uint32_t nmb_mactoptions;
1246 ndis_request *nmb_pendingreq;
1247 uint32_t nmb_maxlongaddrs;
1248 uint32_t nmb_maxshortaddrs;
1249 uint32_t nmb_currlookahead;
1250 uint32_t nmb_maxlookahead;
1251 void *nmb_interrupt_func;
1252 void *nmb_disableintr_func;
1253 void *nmb_enableintr_func;
1254 void *nmb_sendpkts_func;
1255 void *nmb_deferredsend_func;
1256 void *nmb_ethrxindicate_func;
1257 void *nmb_txrxindicate_func;
1258 void *nmb_fddirxindicate_func;
1259 void *nmb_ethrxdone_func;
1260 void *nmb_txrxdone_func;
1261 void *nmb_fddirxcond_func;
1262 void *nmb_status_func;
1263 void *nmb_statusdone_func;
1264 void *nmb_tdcond_func;
1265 void *nmb_querydone_func;
1266 void *nmb_setdone_func;
1267 void *nmb_wantxdone_func;
1268 void *nmb_wanrx_func;
1269 void *nmb_wanrxdone_func;
1270 /*
1271 * End of windows-specific portion of miniport block. Everything
1272 * below is BSD-specific.
1273 */
1274 struct ifnet *nmb_ifp;
1275 uint8_t nmb_dummybuf[128];
1276 ndis_config_parm nmb_replyparm;
1277 int nmb_pciidx;
1278 device_t nmb_dev;
1279 ndis_resource_list *nmb_rlist;
1280 ndis_status nmb_getstat;
1281 ndis_status nmb_setstat;
1282 struct nte_head nmb_timerlist;
33 */
34
35#ifndef _NDIS_VAR_H_
36#define _NDIS_VAR_H_
37
38/* Forward declarations */
39struct ndis_miniport_block;
40struct ndis_mdriver_block;
41typedef struct ndis_miniport_block ndis_miniport_block;
42typedef struct ndis_mdriver_block ndis_mdriver_block;
43
44/* Base types */
45typedef uint32_t ndis_status;
46typedef void *ndis_handle;
47typedef uint32_t ndis_oid;
48typedef uint32_t ndis_error_code;
49typedef uint32_t ndis_kspin_lock;
50typedef uint8_t ndis_kirql;
51
52/*
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
55 * NT status codes.
56 */
57
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
134
135/*
136 * NDIS event codes. They are usually reported to NdisWriteErrorLogEntry().
137 */
138
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
174
175/*
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.
181 */
182
183/* Required OIDs */
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
212
213/* Optional OIDs. */
214#define OID_GEN_MEDIA_CAPABILITIES 0x00010201
215#define OID_GEN_PHYSICAL_MEDIUM 0x00010202
216
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
223
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
243
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
261
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
270
271/* PnP/PM Statistics (Optional). */
272#define OID_PNP_WAKE_UP_OK 0xFD020200
273#define OID_PNP_WAKE_UP_ERROR 0xFD020201
274
275/* The following bits are defined for OID_PNP_ENABLE_WAKE_UP */
276#define NDIS_PNP_WAKE_UP_MAGIC_PACKET 0x00000001
277#define NDIS_PNP_WAKE_UP_PATTERN_MATCH 0x00000002
278#define NDIS_PNP_WAKE_UP_LINK_CHANGE 0x00000004
279
280/* 802.11 OIDs */
281#define OID_802_11_BSSID 0x0D010101
282#define OID_802_11_SSID 0x0D010102
283#define OID_802_11_NETWORK_TYPES_SUPPORTED 0x0D010203
284#define OID_802_11_NETWORK_TYPE_IN_USE 0x0D010204
285#define OID_802_11_TX_POWER_LEVEL 0x0D010205
286#define OID_802_11_RSSI 0x0D010206
287#define OID_802_11_RSSI_TRIGGER 0x0D010207
288#define OID_802_11_INFRASTRUCTURE_MODE 0x0D010108
289#define OID_802_11_FRAGMENTATION_THRESHOLD 0x0D010209
290#define OID_802_11_RTS_THRESHOLD 0x0D01020A
291#define OID_802_11_NUMBER_OF_ANTENNAS 0x0D01020B
292#define OID_802_11_RX_ANTENNA_SELECTED 0x0D01020C
293#define OID_802_11_TX_ANTENNA_SELECTED 0x0D01020D
294#define OID_802_11_SUPPORTED_RATES 0x0D01020E
295#define OID_802_11_DESIRED_RATES 0x0D010210
296#define OID_802_11_CONFIGURATION 0x0D010211
297#define OID_802_11_STATISTICS 0x0D020212
298#define OID_802_11_ADD_WEP 0x0D010113
299#define OID_802_11_REMOVE_WEP 0x0D010114
300#define OID_802_11_DISASSOCIATE 0x0D010115
301#define OID_802_11_POWER_MODE 0x0D010216
302#define OID_802_11_BSSID_LIST 0x0D010217
303#define OID_802_11_AUTHENTICATION_MODE 0x0D010118
304#define OID_802_11_PRIVACY_FILTER 0x0D010119
305#define OID_802_11_BSSID_LIST_SCAN 0x0D01011A
306#define OID_802_11_WEP_STATUS 0x0D01011B
307#define OID_802_11_ENCRYPTION_STATUS OID_802_11_WEP_STATUS
308#define OID_802_11_RELOAD_DEFAULTS 0x0D01011C
309#define OID_802_11_ADD_KEY 0x0D01011D
310#define OID_802_11_REMOVE_KEY 0x0D01011E
311#define OID_802_11_ASSOCIATION_INFORMATION 0x0D01011F
312#define OID_802_11_TEST 0x0D010120
313
314/* structures/definitions for 802.11 */
315#define NDIS_80211_NETTYPE_11FH 0x00000000
316#define NDIS_80211_NETTYPE_11DS 0x00000001
317#define NDIS_80211_NETTYPE_11OFDM5 0x00000002
318#define NDIS_80211_NETTYPE_11OFDM24 0x00000003
319
320struct ndis_80211_nettype_list {
321 uint32_t ntl_items;
322 uint32_t ntl_type[1];
323};
324
325#define NDIS_80211_POWERMODE_CAM 0x00000000
326#define NDIS_80211_POWERMODE_MAX_PSP 0x00000001
327#define NDIS_80211_POWERMODE_FAST_PSP 0x00000002
328
329typedef uint32_t ndis_80211_power; /* Power in milliwatts */
330typedef uint32_t ndis_80211_rssi; /* Signal strength in dBm */
331
332struct ndis_80211_config_fh {
333 uint32_t ncf_length;
334 uint32_t ncf_hoppatterh;
335 uint32_t ncf_hopset;
336 uint32_t ncf_dwelltime;
337};
338
339typedef struct ndis_80211_config_fh ndis_80211_config_fh;
340
341struct ndis_80211_config {
342 uint32_t nc_length;
343 uint32_t nc_beaconperiod;
344 uint32_t nc_atimwin;
345 uint32_t nc_dsconfig;
346 ndis_80211_config_fh nc_fhconfig;
347};
348
349typedef struct ndis_80211_config ndis_80211_config;
350
351struct ndis_80211_stats {
352 uint32_t ns_length;
353 uint64_t ns_txfragcnt;
354 uint64_t ns_txmcastcnt;
355 uint64_t ns_failedcnt;
356 uint64_t ns_retrycnt;
357 uint64_t ns_multiretrycnt;
358 uint64_t ns_rtssuccesscnt;
359 uint64_t ns_rtsfailcnt;
360 uint64_t ns_ackfailcnt;
361 uint64_t ns_dupeframecnt;
362 uint64_t ns_rxfragcnt;
363 uint64_t ns_rxmcastcnt;
364 uint64_t ns_fcserrcnt;
365};
366
367typedef struct ndis_80211_stats ndis_80211_stats;
368
369typedef uint32_t ndis_80211_key_idx;
370
371struct ndis_80211_wep {
372 uint32_t nw_length;
373 uint32_t nw_keyidx;
374 uint32_t nw_keylen;
375 uint8_t nw_keydata[256];
376};
377
378typedef struct ndis_80211_wep ndis_80211_wep;
379
380#define NDIS_80211_WEPKEY_TX 0x80000000
381#define NDIS_80211_WEPKEY_PERCLIENT 0x40000000
382
383#define NDIS_80211_NET_INFRA_IBSS 0x00000000
384#define NDIS_80211_NET_INFRA_BSS 0x00000001
385#define NDIS_80211_NET_INFRA_AUTO 0x00000002
386
387#define NDIS_80211_AUTHMODE_OPEN 0x00000000
388#define NDIS_80211_AUTHMODE_SHARED 0x00000001
389#define NDIS_80211_AUTHMODE_AUTO 0x00000002
390#define NDIS_80211_AUTHMODE_WPA 0x00000003
391#define NDIS_80211_AUTHMODE_WPAPSK 0x00000004
392#define NDIS_80211_AUTHMODE_WPANONE 0x00000005
393
394typedef uint8_t ndis_80211_rates[8];
395typedef uint8_t ndis_80211_rates_ex[16];
396typedef uint8_t ndis_80211_macaddr[6];
397
398struct ndis_80211_ssid {
399 uint32_t ns_ssidlen;
400 uint8_t ns_ssid[32];
401};
402
403typedef struct ndis_80211_ssid ndis_80211_ssid;
404
405struct ndis_wlan_bssid {
406 uint32_t nwb_length;
407 ndis_80211_macaddr nwb_macaddr;
408 uint8_t nwb_rsvd[2];
409 ndis_80211_ssid nwb_ssid;
410 uint32_t nwb_privacy;
411 ndis_80211_rssi nwb_rssi;
412 uint32_t nwb_nettype;
413 ndis_80211_config nwb_config;
414 uint32_t nwb_netinfra;
415 ndis_80211_rates nwb_supportedrates;
416};
417
418typedef struct ndis_wlan_bssid ndis_wlan_bssid;
419
420struct ndis_80211_bssid_list {
421 uint32_t nbl_items;
422 ndis_wlan_bssid nbl_bssid[1];
423};
424
425typedef struct ndis_80211_bssid_list ndis_80211_bssid_list;
426
427struct ndis_wlan_bssid_ex {
428 uint32_t nwbx_len;
429 ndis_80211_macaddr nwbx_macaddr;
430 uint8_t nwbx_rsvd[2];
431 ndis_80211_ssid nwbx_ssid;
432 uint32_t nwbx_privacy;
433 ndis_80211_rssi nwbx_rssi;
434 uint32_t nwbx_nettype;
435 ndis_80211_config nwbx_config;
436 uint32_t nwbx_netinfra;
437 ndis_80211_rates_ex nwbx_supportedrates;
438 uint32_t nwbx_ielen;
439 uint32_t nwbx_ies[1];
440};
441
442typedef struct ndis_wlan_bssid_ex ndis_wlan_bssid_ex;
443
444struct ndis_80211_bssid_list_ex {
445 uint32_t nblx_items;
446 ndis_wlan_bssid nblx_bssid[1];
447};
448
449typedef struct ndis_80211_bssid_list_ex ndis_80211_bssid_list_ex;
450
451struct ndis_80211_fixed_ies {
452 uint8_t nfi_tstamp[8];
453 uint16_t nfi_beaconint;
454 uint16_t nfi_caps;
455};
456
457struct ndis_80211_variable_ies {
458 uint8_t nvi_elemid;
459 uint8_t nvi_len;
460 uint8_t nvi_data[1];
461};
462
463typedef uint32_t ndis_80211_fragthresh;
464typedef uint32_t ndis_80211_rtsthresh;
465typedef uint32_t ndis_80211_antenna;
466
467#define NDIS_80211_PRIVFILT_ACCEPTALL 0x00000000
468#define NDIS_80211_PRIVFILT_8021XWEP 0x00000001
469
470#define NDIS_80211_WEPSTAT_ENABLED 0x00000000
471#define NDIS_80211_WEPSTAT_ENC1ENABLED NDIS_80211_WEPSTAT_ENABLED
472#define NDIS_80211_WEPSTAT_DISABLED 0x00000001
473#define NDIS_80211_WEPSTAT_ENCDISABLED NDIS_80211_WEPSTAT_DISABLED
474#define NDIS_80211_WEPSTAT_KEYABSENT 0x00000002
475#define NDIS_80211_WEPSTAT_ENC1KEYABSENT NDIS_80211_WEPSTAT_KEYABSENT
476#define NDIS_80211_WEPSTAT_NOTSUPPORTED 0x00000003
477#define NDIS_80211_WEPSTAT_ENCNOTSUPPORTED NDIS_80211_WEPSTAT_NOTSUPPORTED
478#define NDIS_80211_WEPSTAT_ENC2ENABLED 0x00000004
479#define NDIS_80211_WEPSTAT_ENC2KEYABSENT 0x00000005
480#define NDIS_80211_WEPSTAT_ENC3ENABLED 0x00000006
481#define NDIS_80211_WEPSTAT_ENC3KEYABSENT 0x00000007
482
483#define NDIS_80211_RELOADDEFAULT_WEP 0x00000000
484
485#define NDIS_80211_STATUSTYPE_AUTH 0x00000000
486
487struct ndis_80211_status_indication {
488 uint32_t nsi_type;
489};
490
491typedef struct ndis_80211_status_indication ndis_80211_status_indication;
492
493struct ndis_80211_auth_request {
494 uint32_t nar_len;
495 ndis_80211_macaddr nar_bssid;
496 uint32_t nar_flags;
497};
498
499typedef struct ndis_80211_auth_request ndis_80211_auth_request;
500
501struct ndis_80211_key {
502 uint32_t nk_len;
503 uint32_t nk_keyidx;
504 uint32_t nk_keylen;
505 ndis_80211_macaddr nk_bssid;
506 uint64_t nk_keyrsc;
507 uint8_t nk_keydata[256];
508};
509
510typedef struct ndis_80211_key ndis_80211_key;
511
512struct ndis_80211_remove_key {
513 uint32_t nk_len;
514 uint32_t nk_keyidx;
515 ndis_80211_macaddr nk_bssid;
516};
517
518typedef struct ndis_80211_remove_key ndis_80211_remove_key;
519
520#define NDIS_80211_AI_REQFI_CAPABILITIES 0x00000001
521#define NDIS_80211_AI_REQFI_LISTENINTERVAL 0x00000002
522#define NDIS_80211_AI_REQFI_CURRENTAPADDRESS 0x00000004
523
524#define NDIS_80211_AI_RESFI_CAPABILITIES 0x00000001
525#define NDIS_80211_AI_RESFI_STATUSCODE 0x00000002
526#define NDIS_80211_AI_RESFI_ASSOCIATIONID 0x00000004
527
528struct ndis_80211_ai_reqfi {
529 uint16_t naq_caps;
530 uint16_t naq_listentint;
531 ndis_80211_macaddr naq_currentapaddr;
532};
533
534typedef struct ndis_80211_ai_reqfi ndis_80211_ai_reqfi;
535
536struct ndis_80211_ai_resfi {
537 uint16_t nas_caps;
538 uint16_t nas_statuscode;
539 uint16_t nas_associd;
540};
541
542typedef struct ndis_80211_ai_resfi ndis_80211_ai_resfi;
543
544struct ndis_80211_assoc_info {
545 uint32_t nai_len;
546 uint16_t nai_avail_req_fixed_ies;
547 ndis_80211_ai_reqfi nai_req_fixed_ies;
548 uint32_t nai_req_ielen;
549 uint32_t nai_offset_req_ies;
550 uint16_t nai_avail_resp_fixed_ies;
551 ndis_80211_ai_resfi nai_resp_fixed_iex;
552 uint32_t nai_resp_ielen;
553 uint32_t nai_offset_resp_ies;
554};
555
556typedef struct ndis_80211_assoc_info ndis_80211_assoc_info;
557
558struct ndis_80211_auth_event {
559 ndis_80211_status_indication nae_status;
560 ndis_80211_auth_request nae_request[1];
561};
562
563typedef struct ndis_80211_auth_event ndis_80211_auth_event;
564
565struct ndis_80211_test {
566 uint32_t nt_len;
567 uint32_t nt_type;
568 union {
569 ndis_80211_auth_event nt_authevent;
570 uint32_t nt_rssitrigger;
571 } u;
572};
573
574typedef struct ndis_80211_test ndis_80211_test;
575
576/*
577 * Attribures of NDIS drivers. Not all drivers support
578 * all attributes.
579 */
580
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
591enum ndis_media_state {
592 nmc_connected,
593 nmc_disconnected
594};
595
596typedef enum ndis_media_state ndis_media_state;
597
598/* Ndis Packet Filter Bits (OID_GEN_CURRENT_PACKET_FILTER). */
599
600#define NDIS_PACKET_TYPE_DIRECTED 0x00000001
601#define NDIS_PACKET_TYPE_MULTICAST 0x00000002
602#define NDIS_PACKET_TYPE_ALL_MULTICAST 0x00000004
603#define NDIS_PACKET_TYPE_BROADCAST 0x00000008
604#define NDIS_PACKET_TYPE_SOURCE_ROUTING 0x00000010
605#define NDIS_PACKET_TYPE_PROMISCUOUS 0x00000020
606#define NDIS_PACKET_TYPE_SMT 0x00000040
607#define NDIS_PACKET_TYPE_ALL_LOCAL 0x00000080
608#define NDIS_PACKET_TYPE_GROUP 0x00001000
609#define NDIS_PACKET_TYPE_ALL_FUNCTIONAL 0x00002000
610#define NDIS_PACKET_TYPE_FUNCTIONAL 0x00004000
611#define NDIS_PACKET_TYPE_MAC_FRAME 0x00008000
612
613
614/* Ndis MAC option bits (OID_GEN_MAC_OPTIONS). */
615
616#define NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA 0x00000001
617#define NDIS_MAC_OPTION_RECEIVE_SERIALIZED 0x00000002
618#define NDIS_MAC_OPTION_TRANSFERS_NOT_PEND 0x00000004
619#define NDIS_MAC_OPTION_NO_LOOPBACK 0x00000008
620#define NDIS_MAC_OPTION_FULL_DUPLEX 0x00000010
621#define NDIS_MAC_OPTION_EOTX_INDICATION 0x00000020
622#define NDIS_MAC_OPTION_8021P_PRIORITY 0x00000040
623#define NDIS_MAC_OPTION_SUPPORTS_MAC_ADDRESS_OVERWRITE 0x00000080
624#define NDIS_MAC_OPTION_RECEIVE_AT_DPC 0x00000100
625#define NDIS_MAC_OPTION_8021Q_VLAN 0x00000200
626#define NDIS_MAC_OPTION_RESERVED 0x80000000
627
628#define NDIS_DMA_24BITS 0x00
629#define NDIS_DMA_32BITS 0x01
630#define NDIS_DMA_64BITS 0x02
631
632struct ndis_physaddr {
633 uint64_t np_quad;
634#ifdef notdef
635 uint32_t np_low;
636 uint32_t np_high;
637#endif
638};
639
640typedef struct ndis_physaddr ndis_physaddr;
641
642struct ndis_ansi_string {
643 uint16_t nas_len;
644 uint16_t nas_maxlen;
645 char *nas_buf;
646};
647
648typedef struct ndis_ansi_string ndis_ansi_string;
649
650/*
651 * nus_buf is really a wchar_t *, but it's inconvenient to include
652 * all the necessary header goop needed to define it, and it's a
653 * pointer anyway, so for now, just make it a uint16_t *.
654 */
655struct ndis_unicode_string {
656 uint16_t nus_len;
657 uint16_t nus_maxlen;
658 uint16_t *nus_buf;
659};
660
661typedef struct ndis_unicode_string ndis_unicode_string;
662
663
664enum ndis_parm_type {
665 ndis_parm_int,
666 ndis_parm_hexint,
667 ndis_parm_string,
668 ndis_parm_multistring,
669 ndis_parm_binary
670};
671
672typedef enum ndis_parm_type ndis_parm_type;
673
674struct ndis_binary_data {
675 uint16_t nbd_len;
676 void *nbd_buf;
677};
678
679typedef struct ndis_binary_data ndis_binary_data;
680
681struct ndis_config_parm {
682 ndis_parm_type ncp_type;
683 union {
684 uint32_t ncp_intdata;
685 ndis_unicode_string ncp_stringdata;
686 ndis_binary_data ncp_binarydata;
687 } ncp_parmdata;
688};
689
690typedef struct ndis_config_parm ndis_config_parm;
691
692struct ndis_list_entry {
693 struct ndis_list_entry *nle_flink;
694 struct ndis_list_entry *nle_blink;
695};
696
697typedef struct ndis_list_entry ndis_list_entry;
698
699struct ndis_bind_paths {
700 uint32_t nbp_number;
701 ndis_unicode_string nbp_paths[1];
702};
703
704typedef struct ndis_bind_paths ndis_bind_paths;
705
706struct dispatch_header {
707 uint8_t dh_type;
708 uint8_t dh_abs;
709 uint8_t dh_size;
710 uint8_t dh_inserted;
711 uint32_t dh_sigstate;
712 ndis_list_entry dh_waitlisthead;
713};
714
715struct ndis_ktimer {
716 struct dispatch_header nk_header;
717 uint64_t nk_duetime;
718 ndis_list_entry nk_timerlistentry;
719 void *nk_dpc;
720 uint32_t nk_period;
721};
722
723struct ndis_kevent {
724 struct dispatch_header nk_header;
725};
726
727struct ndis_event {
728 struct ndis_kevent ne_event;
729};
730
731typedef struct ndis_event ndis_event;
732
733/* Kernel defered procedure call (i.e. timer callback) */
734
735struct ndis_kdpc;
736typedef void (*ndis_kdpc_func)(struct ndis_kdpc *, void *, void *, void *);
737
738struct ndis_kdpc {
739 uint16_t nk_type;
740 uint8_t nk_num;
741 uint8_t nk_importance;
742 ndis_list_entry nk_dpclistentry;
743 ndis_kdpc_func nk_deferedfunc;
744 void *nk_deferredctx;
745 void *nk_sysarg1;
746 void *nk_sysarg2;
747 uint32_t *nk_lock;
748};
749
750struct ndis_timer {
751 struct ndis_ktimer nt_timer;
752 struct ndis_kdpc nt_dpc;
753};
754
755typedef struct ndis_timer ndis_timer;
756
757typedef void (*ndis_timer_function)(void *, void *, void *, void *);
758
759struct ndis_miniport_timer {
760 struct ndis_ktimer nmt_ktimer;
761 struct ndis_kdpc nmt_dpc;
762 ndis_timer_function nmt_timerfunc;
763 void *nmt_timerctx;
764 struct ndis_miniport_timer *nmt_nexttimer;
765};
766
767typedef struct ndis_miniport_timer ndis_miniport_timer;
768
769struct ndis_spin_lock {
770 ndis_kspin_lock nsl_spinlock;
771 ndis_kirql nsl_kirql;
772};
773
774typedef struct ndis_spin_lock ndis_spin_lock;
775
776struct ndis_request {
777 uint8_t nr_macreserved[4*sizeof(void *)];
778 uint32_t nr_requesttype;
779 union _ndis_data {
780 struct _ndis_query_information {
781 ndis_oid nr_oid;
782 void *nr_infobuf;
783 uint32_t nr_infobuflen;
784 uint32_t nr_byteswritten;
785 uint32_t nr_bytesneeded;
786 } ndis_query_information;
787 struct _ndis_set_information {
788 ndis_oid nr_oid;
789 void *nr_infobuf;
790 uint32_t nr_infobuflen;
791 uint32_t nr_byteswritten;
792 uint32_t nr_bytesneeded;
793 } ndis_set_information;
794 } ndis_data;
795 /* NDIS 5.0 extentions */
796 uint8_t nr_ndis_rsvd[9 * sizeof(void *)];
797 union {
798 uint8_t nr_callmgr_rsvd[2 * sizeof(void *)];
799 uint8_t nr_protocol_rsvd[2 * sizeof(void *)];
800 } u;
801 uint8_t nr_miniport_rsvd[2 * sizeof(void *)];
802};
803
804typedef struct ndis_request ndis_request;
805
806/*
807 * Filler, not used.
808 */
809struct ndis_miniport_interrupt {
810 void *ni_introbj;
811 ndis_spin_lock ni_dpccountlock;
812 void *ni_rsvd;
813 void *ni_isrfunc;
814 void *ni_dpcfunc;
815 struct ndis_kdpc ni_dpc;
816 ndis_miniport_block *ni_block;
817 uint8_t ni_dpccnt;
818 uint8_t ni_filler1;
819 struct ndis_kevent ni_dpcsdoneevent;
820 uint8_t ni_shared;
821 uint8_t ni_isrreq;
822};
823
824typedef struct ndis_miniport_interrupt ndis_miniport_interrupt;
825
826enum ndis_interrupt_mode {
827 nim_level,
828 nim_latched
829};
830
831typedef enum ndis_interrupt_mode ndis_interrupt_mode;
832
833struct ndis_work_item;
834
835typedef void (*ndis_proc)(struct ndis_work_item *, void *);
836
837struct ndis_work_item {
838 void *nwi_ctx;
839 ndis_proc nwi_func;
840 uint8_t nwi_wraprsvd[sizeof(void *) * 8];
841};
842
843typedef struct ndis_work_item ndis_work_item;
844
845struct ndis_buffer {
846 struct ndis_buffer *nb_next;
847 uint16_t nb_size;
848 uint16_t nb_flags;
849 void *nb_process;
850 void *nb_mappedsystemva;
851 void *nb_startva;
852 uint32_t nb_bytecount;
853 uint32_t nb_byteoffset;
854};
855
856typedef struct ndis_buffer ndis_buffer;
857
858struct ndis_sc_element {
859 ndis_physaddr nse_addr;
860 uint32_t nse_len;
861 uint32_t *nse_rsvd;
862};
863
864typedef struct ndis_sc_element ndis_sc_element;
865
866#define NDIS_MAXSEG 32
867struct ndis_sc_list {
868 uint32_t nsl_frags;
869 uint32_t *nsl_rsvd;
870 ndis_sc_element nsl_elements[NDIS_MAXSEG];
871};
872
873typedef struct ndis_sc_list ndis_sc_list;
874
875enum ndis_perpkt_info {
876 ndis_tcpipcsum_info,
877 ndis_ipsec_info,
878 ndis_largesend_info,
879 ndis_classhandle_info,
880 ndis_rsvd,
881 ndis_sclist_info,
882 ndis_ieee8021q_info,
883 ndis_originalpkt_info,
884 ndis_packetcancelid,
885 ndis_maxpkt_info
886};
887
888typedef enum ndis_perpkt_info ndis_perpkt_info;
889
890struct ndis_packet_extension {
891 void *npe_info[ndis_maxpkt_info];
892};
893
894typedef struct ndis_packet_extension ndis_packet_extension;
895
896struct ndis_packet_private {
897 uint32_t npp_physcnt;
898 uint32_t npp_totlen;
899 ndis_buffer *npp_head;
900 ndis_buffer *npp_tail;
901
902 void *npp_pool;
903 uint32_t npp_count;
904 uint32_t npp_flags;
905 uint8_t npp_validcounts;
906 uint8_t npp_ndispktflags;
907 uint16_t npp_packetooboffset;
908};
909
910#define NDIS_FLAGS_PROTOCOL_ID_MASK 0x0000000F
911#define NDIS_FLAGS_MULTICAST_PACKET 0x00000010
912#define NDIS_FLAGS_RESERVED2 0x00000020
913#define NDIS_FLAGS_RESERVED3 0x00000040
914#define NDIS_FLAGS_DONT_LOOPBACK 0x00000080
915#define NDIS_FLAGS_IS_LOOPBACK_PACKET 0x00000100
916#define NDIS_FLAGS_LOOPBACK_ONLY 0x00000200
917#define NDIS_FLAGS_RESERVED4 0x00000400
918#define NDIS_FLAGS_DOUBLE_BUFFERED 0x00000800
919#define NDIS_FLAGS_SENT_AT_DPC 0x00001000
920#define NDIS_FLAGS_USES_SG_BUFFER_LIST 0x00002000
921
922#define NDIS_PROTOCOL_ID_DEFAULT 0x00
923#define NDIS_PROTOCOL_ID_TCP_IP 0x02
924#define NDIS_PROTOCOL_ID_IPX 0x06
925#define NDIS_PROTOCOL_ID_NBF 0x07
926#define NDIS_PROTOCOL_ID_MAX 0x0F
927#define NDIS_PROTOCOL_ID_MASK 0x0F
928
929typedef struct ndis_packet_private ndis_packet_private;
930
931enum ndis_classid {
932 ndis_class_802_3prio,
933 ndis_class_wirelesswan_mbx,
934 ndis_class_irda_packetinfo,
935 ndis_class_atm_aainfo
936};
937
938typedef enum ndis_classid ndis_classid;
939
940struct ndis_mediaspecific_info {
941 uint32_t nmi_nextentoffset;
942 ndis_classid nmi_classid;
943 uint32_t nmi_size;
944 uint8_t nmi_classinfo[1];
945};
946
947typedef struct ndis_mediaspecific_info ndis_mediaspecific_info;
948
949struct ndis_packet_oob {
950 union {
951 uint64_t npo_timetotx;
952 uint64_t npo_timetxed;
953 } u;
954 uint64_t npo_timerxed;
955 uint32_t npo_hdrlen;
956 uint32_t npo_mediaspecific_len;
957 void *npo_mediaspecific;
958 ndis_status npo_status;
959};
960
961typedef struct ndis_packet_oob ndis_packet_oob;
962
963struct ndis_packet {
964 ndis_packet_private np_private;
965 union {
966 /* For connectionless miniports. */
967 struct {
968 uint8_t np_miniport_rsvd[2 * sizeof(void *)];
969 uint8_t np_wrapper_rsvd[2 * sizeof(void *)];
970 } np_clrsvd;
971 /* For de-serialized miniports */
972 struct {
973 uint8_t np_miniport_rsvdex[3 * sizeof(void *)];
974 uint8_t np_wrapper_rsvdex[sizeof(void *)];
975 } np_dsrsvd;
976 struct {
977 uint8_t np_mac_rsvd[4 * sizeof(void *)];
978 } np_macrsvd;
979 } u;
980 uint32_t *np_rsvd[2];
981
982 /*
983 * This next part is probably wrong, but we need some place
984 * to put the out of band data structure...
985 */
986 ndis_packet_oob np_oob;
987 ndis_packet_extension np_ext;
988 ndis_sc_list np_sclist;
989
990 /* BSD-specific stuff which should be invisible to drivers. */
991
992 uint32_t np_refcnt;
993 void *np_softc;
994 void *np_m0;
995 int np_txidx;
996};
997
998typedef struct ndis_packet ndis_packet;
999
1000/* mbuf ext type for NDIS */
1001#define EXT_NDIS 0x999
1002
1003struct ndis_filterdbs {
1004 union {
1005 void *nf_ethdb;
1006 void *nf_nulldb;
1007 } u;
1008 void *nf_trdb;
1009 void *nf_fddidb;
1010 void *nf_arcdb;
1011};
1012
1013typedef struct ndis_filterdbs ndis_filterdbs;
1014
1015enum ndis_medium {
1016 NdisMedium802_3,
1017 NdisMedium802_5,
1018 NdisMediumFddi,
1019 NdisMediumWan,
1020 NdisMediumLocalTalk,
1021 NdisMediumDix, /* defined for convenience, not a real medium */
1022 NdisMediumArcnetRaw,
1023 NdisMediumArcnet878_2,
1024 NdisMediumAtm,
1025 NdisMediumWirelessWan,
1026 NdisMediumIrda,
1027 NdisMediumBpc,
1028 NdisMediumCoWan,
1029 NdisMedium1394,
1030 NdisMediumMax
1031};
1032
1033typedef enum ndis_medium ndis_medium;
1034/*
1035enum interface_type {
1036 InterfaceTypeUndefined = -1,
1037 Internal,
1038 Isa,
1039 Eisa,
1040 MicroChannel,
1041 TurboChannel,
1042 PCIBus,
1043 VMEBus,
1044 NuBus,
1045 PCMCIABus,
1046 CBus,
1047 MPIBus,
1048 MPSABus,
1049 ProcessorInternal,
1050 InternalPowerBus,
1051 PNPISABus,
1052 PNPBus,
1053 MaximumInterfaceType
1054};
1055*/
1056enum ndis_interface_type {
1057 NdisInterfaceInternal = Internal,
1058 NdisInterfaceIsa = Isa,
1059 NdisInterfaceEisa = Eisa,
1060 NdisInterfaceMca = MicroChannel,
1061 NdisInterfaceTurboChannel = TurboChannel,
1062 NdisInterfacePci = PCIBus,
1063 NdisInterfacePcMcia = PCMCIABus
1064};
1065
1066typedef enum ndis_interface_type ndis_interface_type;
1067
1068struct ndis_paddr_unit {
1069 ndis_physaddr npu_physaddr;
1070 uint32_t npu_len;
1071};
1072
1073typedef struct ndis_paddr_unit ndis_paddr_unit;
1074
1075struct ndis_map_arg {
1076 ndis_paddr_unit *nma_fraglist;
1077 int nma_cnt;
1078 int nma_max;
1079};
1080
1081/*
1082 * Miniport characteristics were originally defined in the NDIS 3.0
1083 * spec and then extended twice, in NDIS 4.0 and 5.0.
1084 */
1085
1086struct ndis_miniport_characteristics {
1087
1088 /* NDIS 3.0 */
1089
1090 uint8_t nmc_version_major;
1091 uint8_t nmc_version_minor;
1092 uint16_t nmc_pad;
1093 uint32_t nmc_rsvd;
1094 void * nmc_checkhang_func;
1095 void * nmc_disable_interrupts_func;
1096 void * nmc_enable_interrupts_func;
1097 void * nmc_halt_func;
1098 void * nmc_interrupt_func;
1099 void * nmc_init_func;
1100 void * nmc_isr_func;
1101 void * nmc_queryinfo_func;
1102 void * nmc_reconfig_func;
1103 void * nmc_reset_func;
1104 void * nmc_sendsingle_func;
1105 void * nmc_setinfo_func;
1106 void * nmc_transferdata_func;
1107
1108 /* NDIS 4.0 extentions */
1109
1110 void * nmc_return_packet_func;
1111 void * nmc_sendmulti_func;
1112 void * nmc_allocate_complete_func;
1113
1114 /* NDIS 5.0 extensions */
1115
1116 void * nmc_cocreatevc_func;
1117 void * nmc_codeletevc_func;
1118 void * nmc_coactivatevc_func;
1119 void * nmc_codeactivatevc_func;
1120 void * nmc_comultisend_func;
1121 void * nmc_corequest_func;
1122
1123 /* NDIS 5.1 extentions */
1124
1125 void * nmc_canceltxpkts_handler;
1126 void * nmc_pnpevent_handler;
1127 void * nmc_shutdown_handler;
1128 void * nmc_rsvd0;
1129 void * nmc_rsvd1;
1130 void * nmc_rsvd2;
1131 void * nmc_rsvd3;
1132};
1133
1134typedef struct ndis_miniport_characteristics ndis_miniport_characteristics;
1135
1136struct ndis_driver_object {
1137 char *ndo_ifname;
1138 void *ndo_softc;
1139 ndis_miniport_characteristics ndo_chars;
1140};
1141
1142typedef struct ndis_driver_object ndis_driver_object;
1143
1144struct ndis_reference {
1145 ndis_kspin_lock nr_spinlock;
1146 uint16_t nr_refcnt;
1147 uint8_t nr_closing;
1148};
1149
1150typedef struct ndis_reference ndis_reference;
1151
1152struct ndis_timer_entry {
1153 struct callout nte_ch;
1154 ndis_miniport_timer *nte_timer;
1155 TAILQ_ENTRY(ndis_timer_entry) link;
1156};
1157
1158TAILQ_HEAD(nte_head, ndis_timer_entry);
1159
1160/*
1161 * The miniport block is basically the internal NDIS handle. We need
1162 * to define this because, unfortunately, it is not entirely opaque
1163 * to NDIS drivers. For one thing, it contains the function pointer
1164 * to the NDIS packet receive handler, which is invoked out of the
1165 * NDIS block via a macro rather than a function pointer. (The
1166 * NdisMIndicateReceivePacket() routine is a macro rather than
1167 * a function.) For another, the driver maintains a pointer to the
1168 * miniport block and passes it as a handle to various NDIS functions.
1169 * (The driver never really knows this because it's hidden behind
1170 * an ndis_handle though.)
1171 *
1172 * The miniport block has two parts: the first part contains fields
1173 * that must never change, since they are referenced by driver
1174 * binaries through macros. The second part is ignored by the driver,
1175 * but contains various things used internaly by NDIS.SYS. In our
1176 * case, we define the first 'immutable' part exactly as it appears
1177 * in Windows, but don't bother duplicating the Windows definitions
1178 * for the second part. Instead, we replace them with a few BSD-specific
1179 * things.
1180 */
1181
1182struct ndis_miniport_block {
1183 /*
1184 * Windows-specific portion -- DO NOT MODIFY OR NDIS
1185 * DRIVERS WILL NOT WORK.
1186 */
1187 void *nmb_signature; /* magic number */
1188 ndis_miniport_block *nmb_nextminiport;
1189 ndis_mdriver_block *nmb_driverhandle;
1190 ndis_handle nmb_miniportadapterctx;
1191 ndis_unicode_string nmb_name;
1192 ndis_bind_paths *nmb_bindpaths;
1193 ndis_handle nmb_openqueue;
1194 ndis_reference nmb_ref;
1195 ndis_handle nmb_devicectx;
1196 uint8_t nmb_padding;
1197 uint8_t nmb_lockacquired;
1198 uint8_t nmb_pmodeopens;
1199 uint8_t nmb_assignedcpu;
1200 ndis_kspin_lock nmb_lock;
1201 ndis_request *nmb_mediarequest;
1202 ndis_miniport_interrupt *nmb_interrupt;
1203 uint32_t nmb_flags;
1204 uint32_t nmb_pnpflags;
1205 ndis_list_entry nmb_packetlist;
1206 ndis_packet *nmb_firstpendingtxpacket;
1207 ndis_packet *nmb_returnpacketqueue;
1208 uint32_t nmb_requestbuffer;
1209 void *nmb_setmcastbuf;
1210 ndis_miniport_block *nmb_primaryminiport;
1211 void *nmb_wrapperctx;
1212 void *nmb_busdatactx;
1213 uint32_t nmb_pnpcaps;
1214 cm_resource_list *nmb_resources;
1215 ndis_timer nmb_wkupdpctimer;
1216 ndis_unicode_string nmb_basename;
1217 ndis_unicode_string nmb_symlinkname;
1218 uint32_t nmb_checkforhangsecs;
1219 uint16_t nmb_cfhticks;
1220 uint16_t nmb_cfhcurrticks;
1221 ndis_status nmb_resetstatus;
1222 ndis_handle nmb_resetopen;
1223 ndis_filterdbs nmb_filterdbs;
1224 void *nmb_pktind_func;
1225 void *nmb_senddone_func;
1226 void *nmb_sendrsrc_func;
1227 void *nmb_resetdone_func;
1228 ndis_medium nmb_medium;
1229 uint32_t nmb_busnum;
1230 uint32_t nmb_bustye;
1231 uint32_t nmb_adaptertype;
1232 void *nmb_deviceobj;
1233 void *nmb_physdeviceobj;
1234 void *nmb_nextdeviceobj;
1235 void *nmb_mapreg;
1236 void *nmb_callmgraflist;
1237 void *nmb_miniportthread;
1238 void *nmb_setinfobuf;
1239 uint16_t nmb_setinfobuflen;
1240 uint16_t nmb_maxsendpkts;
1241 ndis_status nmb_fakestatus;
1242 void *nmb_lockhandler;
1243 ndis_unicode_string *nmb_adapterinstancename;
1244 void *nmb_timerqueue;
1245 uint32_t nmb_mactoptions;
1246 ndis_request *nmb_pendingreq;
1247 uint32_t nmb_maxlongaddrs;
1248 uint32_t nmb_maxshortaddrs;
1249 uint32_t nmb_currlookahead;
1250 uint32_t nmb_maxlookahead;
1251 void *nmb_interrupt_func;
1252 void *nmb_disableintr_func;
1253 void *nmb_enableintr_func;
1254 void *nmb_sendpkts_func;
1255 void *nmb_deferredsend_func;
1256 void *nmb_ethrxindicate_func;
1257 void *nmb_txrxindicate_func;
1258 void *nmb_fddirxindicate_func;
1259 void *nmb_ethrxdone_func;
1260 void *nmb_txrxdone_func;
1261 void *nmb_fddirxcond_func;
1262 void *nmb_status_func;
1263 void *nmb_statusdone_func;
1264 void *nmb_tdcond_func;
1265 void *nmb_querydone_func;
1266 void *nmb_setdone_func;
1267 void *nmb_wantxdone_func;
1268 void *nmb_wanrx_func;
1269 void *nmb_wanrxdone_func;
1270 /*
1271 * End of windows-specific portion of miniport block. Everything
1272 * below is BSD-specific.
1273 */
1274 struct ifnet *nmb_ifp;
1275 uint8_t nmb_dummybuf[128];
1276 ndis_config_parm nmb_replyparm;
1277 int nmb_pciidx;
1278 device_t nmb_dev;
1279 ndis_resource_list *nmb_rlist;
1280 ndis_status nmb_getstat;
1281 ndis_status nmb_setstat;
1282 struct nte_head nmb_timerlist;
1283 vm_offset_t nmb_img;
1283};
1284
1285typedef ndis_status (*ndis_init_handler)(ndis_status *, uint32_t *,
1286 ndis_medium *, uint32_t, ndis_handle, ndis_handle);
1287typedef ndis_status (*ndis_queryinfo_handler)(ndis_handle, ndis_oid,
1288 void *, uint32_t, uint32_t *, uint32_t *);
1289typedef ndis_status (*ndis_setinfo_handler)(ndis_handle, ndis_oid,
1290 void *, uint32_t, uint32_t *, uint32_t *);
1291typedef ndis_status (*ndis_sendsingle_handler)(ndis_handle,
1292 ndis_packet *, uint32_t);
1293typedef ndis_status (*ndis_sendmulti_handler)(ndis_handle,
1294 ndis_packet **, uint32_t);
1295typedef void (*ndis_isr_handler)(uint8_t *, uint8_t *, ndis_handle);
1296typedef void (*ndis_interrupt_handler)(ndis_handle);
1297typedef void (*ndis_reset_handler)(uint8_t *, ndis_handle);
1298typedef void (*ndis_halt_handler)(ndis_handle);
1299typedef void (*ndis_return_handler)(ndis_handle, ndis_packet *);
1300typedef void (*ndis_enable_interrupts_handler)(ndis_handle);
1301typedef void (*ndis_disable_interrupts_handler)(ndis_handle);
1302typedef void (*ndis_shutdown_handler)(void *);
1303typedef void (*ndis_allocdone_handler)(ndis_handle, void *,
1304 ndis_physaddr *, uint32_t, void *);
1305typedef uint8_t (*ndis_checkforhang_handler)(ndis_handle);
1306
1307typedef ndis_status (*driver_entry)(void *, ndis_unicode_string *);
1308
1309extern image_patch_table ndis_functbl[];
1310
1311__BEGIN_DECLS
1312extern int ndis_libinit(void);
1313extern int ndis_libfini(void);
1314extern int ndis_ascii_to_unicode(char *, uint16_t **);
1315extern int ndis_unicode_to_ascii(uint16_t *, int, char **);
1316extern int ndis_load_driver(vm_offset_t, void *);
1317extern int ndis_unload_driver(void *);
1318extern int ndis_mtop(struct mbuf *, ndis_packet **);
1319extern int ndis_ptom(struct mbuf **, ndis_packet *);
1320extern int ndis_get_info(void *, ndis_oid, void *, int *);
1321extern int ndis_set_info(void *, ndis_oid, void *, int *);
1322extern int ndis_get_supported_oids(void *, ndis_oid **, int *);
1323extern int ndis_send_packets(void *, ndis_packet **, int);
1324extern int ndis_send_packet(void *, ndis_packet *);
1325extern int ndis_convert_res(void *);
1326extern int ndis_alloc_amem(void *);
1327extern void ndis_free_packet(ndis_packet *);
1328extern void ndis_free_bufs(ndis_buffer *);
1329extern int ndis_reset_nic(void *);
1330extern int ndis_halt_nic(void *);
1331extern int ndis_shutdown_nic(void *);
1332extern int ndis_init_nic(void *);
1333extern int ndis_isr(void *, int *, int *);
1334extern int ndis_intrhand(void *);
1335extern void ndis_return_packet(void *, void *);
1336extern void ndis_enable_intr(void *);
1337extern void ndis_disable_intr(void *);
1338extern int ndis_init_dma(void *);
1339extern int ndis_destroy_dma(void *);
1340extern int ndis_create_sysctls(void *);
1341extern int ndis_add_sysctl(void *, char *, char *, char *, int);
1342extern int ndis_flush_sysctls(void *);
1343__END_DECLS
1344
1345#endif /* _NDIS_VAR_H_ */
1284};
1285
1286typedef ndis_status (*ndis_init_handler)(ndis_status *, uint32_t *,
1287 ndis_medium *, uint32_t, ndis_handle, ndis_handle);
1288typedef ndis_status (*ndis_queryinfo_handler)(ndis_handle, ndis_oid,
1289 void *, uint32_t, uint32_t *, uint32_t *);
1290typedef ndis_status (*ndis_setinfo_handler)(ndis_handle, ndis_oid,
1291 void *, uint32_t, uint32_t *, uint32_t *);
1292typedef ndis_status (*ndis_sendsingle_handler)(ndis_handle,
1293 ndis_packet *, uint32_t);
1294typedef ndis_status (*ndis_sendmulti_handler)(ndis_handle,
1295 ndis_packet **, uint32_t);
1296typedef void (*ndis_isr_handler)(uint8_t *, uint8_t *, ndis_handle);
1297typedef void (*ndis_interrupt_handler)(ndis_handle);
1298typedef void (*ndis_reset_handler)(uint8_t *, ndis_handle);
1299typedef void (*ndis_halt_handler)(ndis_handle);
1300typedef void (*ndis_return_handler)(ndis_handle, ndis_packet *);
1301typedef void (*ndis_enable_interrupts_handler)(ndis_handle);
1302typedef void (*ndis_disable_interrupts_handler)(ndis_handle);
1303typedef void (*ndis_shutdown_handler)(void *);
1304typedef void (*ndis_allocdone_handler)(ndis_handle, void *,
1305 ndis_physaddr *, uint32_t, void *);
1306typedef uint8_t (*ndis_checkforhang_handler)(ndis_handle);
1307
1308typedef ndis_status (*driver_entry)(void *, ndis_unicode_string *);
1309
1310extern image_patch_table ndis_functbl[];
1311
1312__BEGIN_DECLS
1313extern int ndis_libinit(void);
1314extern int ndis_libfini(void);
1315extern int ndis_ascii_to_unicode(char *, uint16_t **);
1316extern int ndis_unicode_to_ascii(uint16_t *, int, char **);
1317extern int ndis_load_driver(vm_offset_t, void *);
1318extern int ndis_unload_driver(void *);
1319extern int ndis_mtop(struct mbuf *, ndis_packet **);
1320extern int ndis_ptom(struct mbuf **, ndis_packet *);
1321extern int ndis_get_info(void *, ndis_oid, void *, int *);
1322extern int ndis_set_info(void *, ndis_oid, void *, int *);
1323extern int ndis_get_supported_oids(void *, ndis_oid **, int *);
1324extern int ndis_send_packets(void *, ndis_packet **, int);
1325extern int ndis_send_packet(void *, ndis_packet *);
1326extern int ndis_convert_res(void *);
1327extern int ndis_alloc_amem(void *);
1328extern void ndis_free_packet(ndis_packet *);
1329extern void ndis_free_bufs(ndis_buffer *);
1330extern int ndis_reset_nic(void *);
1331extern int ndis_halt_nic(void *);
1332extern int ndis_shutdown_nic(void *);
1333extern int ndis_init_nic(void *);
1334extern int ndis_isr(void *, int *, int *);
1335extern int ndis_intrhand(void *);
1336extern void ndis_return_packet(void *, void *);
1337extern void ndis_enable_intr(void *);
1338extern void ndis_disable_intr(void *);
1339extern int ndis_init_dma(void *);
1340extern int ndis_destroy_dma(void *);
1341extern int ndis_create_sysctls(void *);
1342extern int ndis_add_sysctl(void *, char *, char *, char *, int);
1343extern int ndis_flush_sysctls(void *);
1344__END_DECLS
1345
1346#endif /* _NDIS_VAR_H_ */