ndis_var.h revision 123832
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 123832 2003-12-25 21:34:16Z 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_BAD_VERSION		0xC0010004
104#define NDIS_STATUS_BAD_CHARACTERISTICS	0xC0010005
105#define NDIS_STATUS_ADAPTER_NOT_FOUND	0xC0010006
106#define NDIS_STATUS_OPEN_FAILED		0xC0010007
107#define NDIS_STATUS_DEVICE_FAILED	0xC0010008
108#define NDIS_STATUS_MULTICAST_FULL	0xC0010009
109#define NDIS_STATUS_MULTICAST_EXISTS	0xC001000A
110#define NDIS_STATUS_MULTICAST_NOT_FOUND	0xC001000B
111#define NDIS_STATUS_REQUEST_ABORTED	0xC001000C
112#define NDIS_STATUS_RESET_IN_PROGRESS	0xC001000D
113#define NDIS_STATUS_CLOSING_INDICATING	0xC001000E
114#define NDIS_STATUS_NOT_SUPPORTED	0xC00000BB
115#define NDIS_STATUS_INVALID_PACKET	0xC001000F
116#define NDIS_STATUS_OPEN_LIST_FULL	0xC0010010
117#define NDIS_STATUS_ADAPTER_NOT_READY	0xC0010011
118#define NDIS_STATUS_ADAPTER_NOT_OPEN	0xC0010012
119#define NDIS_STATUS_NOT_INDICATING	0xC0010013
120#define NDIS_STATUS_INVALID_LENGTH	0xC0010014
121#define NDIS_STATUS_INVALID_DATA	0xC0010015
122#define NDIS_STATUS_BUFFER_TOO_SHORT	0xC0010016
123#define NDIS_STATUS_INVALID_OID		0xC0010017
124#define NDIS_STATUS_ADAPTER_REMOVED	0xC0010018
125#define NDIS_STATUS_UNSUPPORTED_MEDIA	0xC0010019
126#define NDIS_STATUS_GROUP_ADDRESS_IN_USE	0xC001001A
127#define NDIS_STATUS_FILE_NOT_FOUND	0xC001001B
128#define NDIS_STATUS_ERROR_READING_FILE	0xC001001C
129#define NDIS_STATUS_ALREADY_MAPPED	0xC001001D
130#define NDIS_STATUS_RESOURCE_CONFLICT	0xC001001E
131#define NDIS_STATUS_NO_CABLE		0xC001001F
132#define NDIS_STATUS_INVALID_SAP		0xC0010020
133#define NDIS_STATUS_SAP_IN_USE		0xC0010021
134#define NDIS_STATUS_INVALID_ADDRESS	0xC0010022
135#define NDIS_STATUS_VC_NOT_ACTIVATED	0xC0010023
136#define NDIS_STATUS_DEST_OUT_OF_ORDER	0xC0010024
137#define NDIS_STATUS_VC_NOT_AVAILABLE	0xC0010025
138#define NDIS_STATUS_CELLRATE_NOT_AVAILABLE	0xC0010026
139#define NDIS_STATUS_INCOMPATABLE_QOS	0xC0010027
140#define NDIS_STATUS_AAL_PARAMS_UNSUPPORTED	0xC0010028
141#define NDIS_STATUS_NO_ROUTE_TO_DESTINATION	0xC0010029
142#define NDIS_STATUS_TOKEN_RING_OPEN_ERROR	0xC0011000
143#define NDIS_STATUS_INVALID_DEVICE_REQUEST	0xC0000010
144#define NDIS_STATUS_NETWORK_UNREACHABLE         0xC000023C
145
146/*
147 * NDIS event codes. They are usually reported to NdisWriteErrorLogEntry().
148 */
149
150#define EVENT_NDIS_RESOURCE_CONFLICT	0xC0001388
151#define EVENT_NDIS_OUT_OF_RESOURCE	0xC0001389
152#define EVENT_NDIS_HARDWARE_FAILURE	0xC000138A
153#define EVENT_NDIS_ADAPTER_NOT_FOUND	0xC000138B
154#define EVENT_NDIS_INTERRUPT_CONNECT	0xC000138C
155#define EVENT_NDIS_DRIVER_FAILURE	0xC000138D
156#define EVENT_NDIS_BAD_VERSION		0xC000138E
157#define EVENT_NDIS_TIMEOUT		0x8000138F
158#define EVENT_NDIS_NETWORK_ADDRESS	0xC0001390
159#define EVENT_NDIS_UNSUPPORTED_CONFIGURATION	0xC0001391
160#define EVENT_NDIS_INVALID_VALUE_FROM_ADAPTER	0xC0001392
161#define EVENT_NDIS_MISSING_CONFIGURATION_PARAMETER	0xC0001393
162#define EVENT_NDIS_BAD_IO_BASE_ADDRESS	0xC0001394
163#define EVENT_NDIS_RECEIVE_SPACE_SMALL	0x40001395
164#define EVENT_NDIS_ADAPTER_DISABLED	0x80001396
165#define EVENT_NDIS_IO_PORT_CONFLICT	0x80001397
166#define EVENT_NDIS_PORT_OR_DMA_CONFLICT	0x80001398
167#define EVENT_NDIS_MEMORY_CONFLICT	0x80001399
168#define EVENT_NDIS_INTERRUPT_CONFLICT	0x8000139A
169#define EVENT_NDIS_DMA_CONFLICT		0x8000139B
170#define EVENT_NDIS_INVALID_DOWNLOAD_FILE_ERROR	0xC000139C
171#define EVENT_NDIS_MAXRECEIVES_ERROR	0x8000139D
172#define EVENT_NDIS_MAXTRANSMITS_ERROR	0x8000139E
173#define EVENT_NDIS_MAXFRAMESIZE_ERROR	0x8000139F
174#define EVENT_NDIS_MAXINTERNALBUFS_ERROR	0x800013A0
175#define EVENT_NDIS_MAXMULTICAST_ERROR	0x800013A1
176#define EVENT_NDIS_PRODUCTID_ERROR	0x800013A2
177#define EVENT_NDIS_LOBE_FAILUE_ERROR	0x800013A3
178#define EVENT_NDIS_SIGNAL_LOSS_ERROR	0x800013A4
179#define EVENT_NDIS_REMOVE_RECEIVED_ERROR	0x800013A5
180#define EVENT_NDIS_TOKEN_RING_CORRECTION	0x400013A6
181#define EVENT_NDIS_ADAPTER_CHECK_ERROR	0xC00013A7
182#define EVENT_NDIS_RESET_FAILURE_ERROR	0x800013A8
183#define EVENT_NDIS_CABLE_DISCONNECTED_ERROR	0x800013A9
184#define EVENT_NDIS_RESET_FAILURE_CORRECTION	0x800013AA
185
186/*
187 * NDIS OIDs used by the queryinfo/setinfo routines.
188 * Some are required by all NDIS drivers, some are specific to
189 * a particular type of device, and some are purely optional.
190 * Unfortunately, one of the purely optional OIDs is the one
191 * that lets us set the MAC address of the device.
192 */
193
194/* Required OIDs */
195#define OID_GEN_SUPPORTED_LIST                  0x00010101
196#define OID_GEN_HARDWARE_STATUS                 0x00010102
197#define OID_GEN_MEDIA_SUPPORTED                 0x00010103
198#define OID_GEN_MEDIA_IN_USE                    0x00010104
199#define OID_GEN_MAXIMUM_LOOKAHEAD               0x00010105
200#define OID_GEN_MAXIMUM_FRAME_SIZE              0x00010106
201#define OID_GEN_LINK_SPEED                      0x00010107
202#define OID_GEN_TRANSMIT_BUFFER_SPACE           0x00010108
203#define OID_GEN_RECEIVE_BUFFER_SPACE            0x00010109
204#define OID_GEN_TRANSMIT_BLOCK_SIZE             0x0001010A
205#define OID_GEN_RECEIVE_BLOCK_SIZE              0x0001010B
206#define OID_GEN_VENDOR_ID                       0x0001010C
207#define OID_GEN_VENDOR_DESCRIPTION              0x0001010D
208#define OID_GEN_CURRENT_PACKET_FILTER           0x0001010E
209#define OID_GEN_CURRENT_LOOKAHEAD               0x0001010F
210#define OID_GEN_DRIVER_VERSION                  0x00010110
211#define OID_GEN_MAXIMUM_TOTAL_SIZE              0x00010111
212#define OID_GEN_PROTOCOL_OPTIONS                0x00010112
213#define OID_GEN_MAC_OPTIONS                     0x00010113
214#define OID_GEN_MEDIA_CONNECT_STATUS            0x00010114
215#define OID_GEN_MAXIMUM_SEND_PACKETS            0x00010115
216#define OID_GEN_VENDOR_DRIVER_VERSION           0x00010116
217#define OID_GEN_SUPPORTED_GUIDS                 0x00010117
218#define OID_GEN_NETWORK_LAYER_ADDRESSES         0x00010118  /* Set only */
219#define OID_GEN_TRANSPORT_HEADER_OFFSET         0x00010119  /* Set only */
220#define OID_GEN_MACHINE_NAME                    0x0001021A
221#define OID_GEN_RNDIS_CONFIG_PARAMETER          0x0001021B  /* Set only */
222#define OID_GEN_VLAN_ID                         0x0001021C
223
224/* Optional OIDs. */
225#define OID_GEN_MEDIA_CAPABILITIES              0x00010201
226#define OID_GEN_PHYSICAL_MEDIUM                 0x00010202
227
228/* Required statistics OIDs. */
229#define OID_GEN_XMIT_OK                         0x00020101
230#define OID_GEN_RCV_OK                          0x00020102
231#define OID_GEN_XMIT_ERROR                      0x00020103
232#define OID_GEN_RCV_ERROR                       0x00020104
233#define OID_GEN_RCV_NO_BUFFER                   0x00020105
234
235/* Optional OID statistics */
236#define OID_GEN_DIRECTED_BYTES_XMIT             0x00020201
237#define OID_GEN_DIRECTED_FRAMES_XMIT            0x00020202
238#define OID_GEN_MULTICAST_BYTES_XMIT            0x00020203
239#define OID_GEN_MULTICAST_FRAMES_XMIT           0x00020204
240#define OID_GEN_BROADCAST_BYTES_XMIT            0x00020205
241#define OID_GEN_BROADCAST_FRAMES_XMIT           0x00020206
242#define OID_GEN_DIRECTED_BYTES_RCV              0x00020207
243#define OID_GEN_DIRECTED_FRAMES_RCV             0x00020208
244#define OID_GEN_MULTICAST_BYTES_RCV             0x00020209
245#define OID_GEN_MULTICAST_FRAMES_RCV            0x0002020A
246#define OID_GEN_BROADCAST_BYTES_RCV             0x0002020B
247#define OID_GEN_BROADCAST_FRAMES_RCV            0x0002020C
248#define OID_GEN_RCV_CRC_ERROR                   0x0002020D
249#define OID_GEN_TRANSMIT_QUEUE_LENGTH           0x0002020E
250#define OID_GEN_GET_TIME_CAPS                   0x0002020F
251#define OID_GEN_GET_NETCARD_TIME                0x00020210
252#define OID_GEN_NETCARD_LOAD                    0x00020211
253#define OID_GEN_DEVICE_PROFILE                  0x00020212
254
255/* 802.3 (ethernet) OIDs */
256#define OID_802_3_PERMANENT_ADDRESS             0x01010101
257#define OID_802_3_CURRENT_ADDRESS               0x01010102
258#define OID_802_3_MULTICAST_LIST                0x01010103
259#define OID_802_3_MAXIMUM_LIST_SIZE             0x01010104
260#define OID_802_3_MAC_OPTIONS                   0x01010105
261#define NDIS_802_3_MAC_OPTION_PRIORITY          0x00000001
262#define OID_802_3_RCV_ERROR_ALIGNMENT           0x01020101
263#define OID_802_3_XMIT_ONE_COLLISION            0x01020102
264#define OID_802_3_XMIT_MORE_COLLISIONS          0x01020103
265#define OID_802_3_XMIT_DEFERRED                 0x01020201
266#define OID_802_3_XMIT_MAX_COLLISIONS           0x01020202
267#define OID_802_3_RCV_OVERRUN                   0x01020203
268#define OID_802_3_XMIT_UNDERRUN                 0x01020204
269#define OID_802_3_XMIT_HEARTBEAT_FAILURE        0x01020205
270#define OID_802_3_XMIT_TIMES_CRS_LOST           0x01020206
271#define OID_802_3_XMIT_LATE_COLLISIONS          0x01020207
272
273/* PnP and power management OIDs */
274#define OID_PNP_CAPABILITIES                    0xFD010100
275#define OID_PNP_SET_POWER                       0xFD010101
276#define OID_PNP_QUERY_POWER                     0xFD010102
277#define OID_PNP_ADD_WAKE_UP_PATTERN             0xFD010103
278#define OID_PNP_REMOVE_WAKE_UP_PATTERN          0xFD010104
279#define OID_PNP_WAKE_UP_PATTERN_LIST            0xFD010105
280#define OID_PNP_ENABLE_WAKE_UP                  0xFD010106
281
282/* PnP/PM Statistics (Optional). */
283#define OID_PNP_WAKE_UP_OK                      0xFD020200
284#define OID_PNP_WAKE_UP_ERROR                   0xFD020201
285
286/* The following bits are defined for OID_PNP_ENABLE_WAKE_UP */
287#define NDIS_PNP_WAKE_UP_MAGIC_PACKET           0x00000001
288#define NDIS_PNP_WAKE_UP_PATTERN_MATCH          0x00000002
289#define NDIS_PNP_WAKE_UP_LINK_CHANGE            0x00000004
290
291/* 802.11 OIDs */
292#define OID_802_11_BSSID                        0x0D010101
293#define OID_802_11_SSID                         0x0D010102
294#define OID_802_11_NETWORK_TYPES_SUPPORTED      0x0D010203
295#define OID_802_11_NETWORK_TYPE_IN_USE          0x0D010204
296#define OID_802_11_TX_POWER_LEVEL               0x0D010205
297#define OID_802_11_RSSI                         0x0D010206
298#define OID_802_11_RSSI_TRIGGER                 0x0D010207
299#define OID_802_11_INFRASTRUCTURE_MODE          0x0D010108
300#define OID_802_11_FRAGMENTATION_THRESHOLD      0x0D010209
301#define OID_802_11_RTS_THRESHOLD                0x0D01020A
302#define OID_802_11_NUMBER_OF_ANTENNAS           0x0D01020B
303#define OID_802_11_RX_ANTENNA_SELECTED          0x0D01020C
304#define OID_802_11_TX_ANTENNA_SELECTED          0x0D01020D
305#define OID_802_11_SUPPORTED_RATES              0x0D01020E
306#define OID_802_11_DESIRED_RATES                0x0D010210
307#define OID_802_11_CONFIGURATION                0x0D010211
308#define OID_802_11_STATISTICS                   0x0D020212
309#define OID_802_11_ADD_WEP                      0x0D010113
310#define OID_802_11_REMOVE_WEP                   0x0D010114
311#define OID_802_11_DISASSOCIATE                 0x0D010115
312#define OID_802_11_POWER_MODE                   0x0D010216
313#define OID_802_11_BSSID_LIST                   0x0D010217
314#define OID_802_11_AUTHENTICATION_MODE          0x0D010118
315#define OID_802_11_PRIVACY_FILTER               0x0D010119
316#define OID_802_11_BSSID_LIST_SCAN              0x0D01011A
317#define OID_802_11_WEP_STATUS                   0x0D01011B
318#define OID_802_11_RELOAD_DEFAULTS              0x0D01011C
319
320/* structures/definitions for 802.11 */
321#define NDIS_80211_NETTYPE_11FH		0x00000000
322#define NDIS_80211_NETTYPE_11DS		0x00000001
323
324struct ndis_80211_nettype_list {
325	uint32_t		ntl_items;
326	uint32_t		ntl_type[1];
327};
328
329#define NDIS_80211_POWERMODE_CAM	0x00000000
330#define NDIS_80211_POWERMODE_MAX_PSP	0x00000001
331#define NDIS_80211_POWERMODE_FAST_PSP	0x00000002
332
333typedef uint32_t ndis_80211_power;	/* Power in milliwatts */
334typedef uint32_t ndis_80211_rssi;	/* Signal strength in dBm */
335
336struct ndis_80211_config_fh {
337	uint32_t		ncf_length;
338	uint32_t		ncf_hoppatterh;
339	uint32_t		ncf_hopset;
340	uint32_t		ncf_dwelltime;
341};
342
343typedef struct ndis_80211_config_fh ndis_80211_config_fh;
344
345struct ndis_80211_config {
346	uint32_t		nc_length;
347	uint32_t		nc_beaconperiod;
348	uint32_t		nc_atimwin;
349	uint32_t		nc_dsconfig;
350	ndis_80211_config_fh	nc_fhconfig;
351};
352
353typedef struct ndis_80211_config ndis_80211_config;
354
355struct ndis_80211_stats {
356	uint32_t		ns_length;
357	uint64_t		ns_txfragcnt;
358	uint64_t		ns_txmcastcnt;
359	uint64_t		ns_failedcnt;
360	uint64_t		ns_retrycnt;
361	uint64_t		ns_multiretrycnt;
362	uint64_t		ns_rtssuccesscnt;
363	uint64_t		ns_rtsfailcnt;
364	uint64_t		ns_ackfailcnt;
365	uint64_t		ns_dupeframecnt;
366	uint64_t		ns_rxfragcnt;
367	uint64_t		ns_rxmcastcnt;
368	uint64_t		ns_fcserrcnt;
369};
370
371typedef struct ndis_80211_stats ndis_80211_stats;
372
373typedef uint32_t ndis_80211_key_idx;
374
375struct ndis_80211_wep {
376	uint32_t		nw_length;
377	uint32_t		nw_keyidx;
378	uint32_t		nw_keylen;
379	uint32_t		nw_keydata[1];
380};
381
382typedef struct ndis_80211_wep ndis_80211_wep;
383
384#define NDIS_80211_NET_INFRA_IBSS	0x00000000
385#define NDIS_80211_NET_INFRA_BSS	0x00000001
386#define NDIS_80211_NET_INFRA_AUTO	0x00000002
387
388#define NDIS_80211_AUTHMODE_OPEN	0x00000000
389#define NDIS_80211_AUTHMODE_SHARED	0x00000001
390#define NDIS_80211_AUTHMODE_AUTO	0x00000002
391
392typedef uint8_t ndis_80211_rates[8];
393typedef uint8_t ndis_80211_macaddr[6];
394
395struct ndis_80211_ssid {
396	uint32_t		ns_ssidlen;
397	uint8_t			ns_ssid[32];
398};
399
400typedef struct ndis_80211_ssid ndis_80211_ssid;
401
402struct ndis_wlan_bssid {
403	uint32_t		nwb_length;
404	ndis_80211_macaddr	nwb_macaddr;
405	uint8_t			nwb_rsvd[2];
406	ndis_80211_ssid		nwb_ssid;
407	uint32_t		nwb_privacy;
408	ndis_80211_rssi		nwb_rssi;
409	uint32_t		nwb_nettype;
410	ndis_80211_config	nwb_config;
411	uint32_t		nwb_netinfra;
412	ndis_80211_rates	nwb_supportedrates;
413};
414
415typedef struct ndis_wlan_bssid ndis_wlan_bssid;
416
417struct ndis_80211_bssid_list {
418	uint32_t		nbl_items;
419	ndis_wlan_bssid		nbl_bssid[1];
420};
421
422typedef struct ndis_80211_bssid_list ndis_80211_bssid_list;
423
424typedef uint32_t ndis_80211_fragthresh;
425typedef uint32_t ndis_80211_rtsthresh;
426typedef uint32_t ndis_80211_antenna;
427
428#define NDIS_80211_PRIVFILT_ACCEPTALL	0x00000000
429#define NDIS_80211_PRIVFILT_8021XWEP	0x00000001
430
431#define NDIS_80211_WEPSTAT_ENABLED	0x00000000
432#define NDIS_80211_WEPSTAT_DISABLED	0x00000001
433#define NDIS_80211_WEPSTAT_KEYABSENT	0x00000002
434#define NDIS_80211_WEPSTAT_NOTSUPPORTED	0x00000003
435
436#define NDIS_80211_RELOADDEFAULT_WEP	0x00000000
437
438/*
439 * Attribures of NDIS drivers. Not all drivers support
440 * all attributes.
441 */
442
443#define NDIS_ATTRIBUTE_IGNORE_REQUEST_TIMEOUT		0x00000002
444#define NDIS_ATTRIBUTE_IGNORE_TOKEN_RING_ERRORS		0x00000004
445#define NDIS_ATTRIBUTE_BUS_MASTER			0x00000008
446#define NDIS_ATTRIBUTE_INTERMEDIATE_DRIVER		0x00000010
447#define NDIS_ATTRIBUTE_DESERIALIZE			0x00000020
448#define NDIS_ATTRIBUTE_NO_HALT_ON_SUSPEND		0x00000040
449#define NDIS_ATTRIBUTE_SURPRISE_REMOVE_OK		0x00000080
450#define NDIS_ATTRIBUTE_NOT_CO_NDIS			0x00000100
451#define NDIS_ATTRIBUTE_USES_SAFE_BUFFER_APIS		0x00000200
452
453enum ndis_media_state {
454	nmc_connected,
455	nmc_disconnected
456};
457
458typedef enum ndis_media_state ndis_media_state;
459
460/* Ndis Packet Filter Bits (OID_GEN_CURRENT_PACKET_FILTER). */
461
462#define NDIS_PACKET_TYPE_DIRECTED               0x00000001
463#define NDIS_PACKET_TYPE_MULTICAST              0x00000002
464#define NDIS_PACKET_TYPE_ALL_MULTICAST          0x00000004
465#define NDIS_PACKET_TYPE_BROADCAST              0x00000008
466#define NDIS_PACKET_TYPE_SOURCE_ROUTING         0x00000010
467#define NDIS_PACKET_TYPE_PROMISCUOUS            0x00000020
468#define NDIS_PACKET_TYPE_SMT                    0x00000040
469#define NDIS_PACKET_TYPE_ALL_LOCAL              0x00000080
470#define NDIS_PACKET_TYPE_GROUP                  0x00001000
471#define NDIS_PACKET_TYPE_ALL_FUNCTIONAL         0x00002000
472#define NDIS_PACKET_TYPE_FUNCTIONAL             0x00004000
473#define NDIS_PACKET_TYPE_MAC_FRAME              0x00008000
474
475
476/* Ndis MAC option bits (OID_GEN_MAC_OPTIONS). */
477
478#define NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA             0x00000001
479#define NDIS_MAC_OPTION_RECEIVE_SERIALIZED              0x00000002
480#define NDIS_MAC_OPTION_TRANSFERS_NOT_PEND              0x00000004
481#define NDIS_MAC_OPTION_NO_LOOPBACK                     0x00000008
482#define NDIS_MAC_OPTION_FULL_DUPLEX                     0x00000010
483#define NDIS_MAC_OPTION_EOTX_INDICATION                 0x00000020
484#define NDIS_MAC_OPTION_8021P_PRIORITY                  0x00000040
485#define NDIS_MAC_OPTION_SUPPORTS_MAC_ADDRESS_OVERWRITE  0x00000080
486#define NDIS_MAC_OPTION_RECEIVE_AT_DPC                  0x00000100
487#define NDIS_MAC_OPTION_8021Q_VLAN                      0x00000200
488#define NDIS_MAC_OPTION_RESERVED                        0x80000000
489
490#define NDIS_DMA_24BITS		0x00
491#define NDIS_DMA_32BITS		0x01
492#define NDIS_DMA_64BITS		0x02
493
494struct ndis_physaddr {
495	uint64_t		np_quad;
496#ifdef notdef
497	uint32_t		np_low;
498	uint32_t		np_high;
499#endif
500};
501
502typedef struct ndis_physaddr ndis_physaddr;
503
504struct ndis_ansi_string {
505	uint16_t		nas_len;
506	uint16_t		nas_maxlen;
507	char			*nas_buf;
508};
509
510typedef struct ndis_ansi_string ndis_ansi_string;
511
512/*
513 * nus_buf is really a wchar_t *, but it's inconvenient to include
514 * all the necessary header goop needed to define it, and it's a
515 * pointer anyway, so for now, just make it a uint16_t *.
516 */
517struct ndis_unicode_string {
518	uint16_t		nus_len;
519	uint16_t		nus_maxlen;
520	uint16_t		*nus_buf;
521};
522
523typedef struct ndis_unicode_string ndis_unicode_string;
524
525
526enum ndis_parm_type {
527	ndis_parm_int,
528	ndis_parm_hexint,
529	ndis_parm_string,
530	ndis_parm_multistring,
531	ndis_parm_binary
532};
533
534typedef enum ndis_parm_type ndis_parm_type;
535
536struct ndis_binary_data {
537	uint16_t		nbd_len;
538	void			*nbd_buf;
539};
540
541typedef struct ndis_binary_data ndis_binary_data;
542
543struct ndis_config_parm {
544	ndis_parm_type		ncp_type;
545	union {
546		uint32_t		ncp_intdata;
547		ndis_unicode_string	ncp_stringdata;
548		ndis_binary_data	ncp_binarydata;
549	} ncp_parmdata;
550};
551
552typedef struct ndis_config_parm ndis_config_parm;
553
554struct ndis_list_entry {
555	struct ndis_list_entry *nle_flink;
556	struct ndis_list_entry *nle_blink;
557};
558
559typedef struct ndis_list_entry ndis_list_entry;
560
561struct ndis_bind_paths {
562	uint32_t		nbp_number;
563	ndis_unicode_string	nbp_paths[1];
564};
565
566typedef struct ndis_bind_paths ndis_bind_paths;
567
568struct dispatch_header {
569	uint8_t			dh_type;
570	uint8_t			dh_abs;
571	uint8_t			dh_size;
572	uint8_t			dh_inserted;
573	uint32_t		dh_sigstate;
574	ndis_list_entry		dh_waitlisthead;
575};
576
577struct ndis_ktimer {
578	struct dispatch_header	nk_header;
579	uint64_t		nk_duetime;
580	ndis_list_entry		nk_timerlistentry;
581	void			*nk_dpc;
582	uint32_t		nk_period;
583};
584
585struct ndis_kevent {
586	struct dispatch_header	nk_header;
587};
588
589struct ndis_event {
590	struct ndis_kevent	ne_event;
591};
592
593typedef struct ndis_event ndis_event;
594
595/* Kernel defered procedure call (i.e. timer callback) */
596
597struct ndis_kdpc;
598typedef void (*ndis_kdpc_func)(struct ndis_kdpc *, void *, void *, void *);
599
600struct ndis_kdpc {
601	uint16_t		nk_type;
602	uint8_t			nk_num;
603	uint8_t			nk_importance;
604	ndis_list_entry		nk_dpclistentry;
605	ndis_kdpc_func		nk_deferedfunc;
606	void			*nk_deferredctx;
607	void			*nk_sysarg1;
608	void			*nk_sysarg2;
609	uint32_t		*nk_lock;
610};
611
612struct ndis_timer {
613	struct ndis_ktimer	nt_timer;
614	struct ndis_kdpc	nt_dpc;
615};
616
617typedef struct ndis_timer ndis_timer;
618
619typedef void (*ndis_timer_function)(void *, void *, void *, void *);
620
621struct ndis_miniport_timer {
622	struct ndis_ktimer	nmt_ktimer;
623	struct ndis_kdpc	nmt_dpc;
624	ndis_timer_function	nmt_timerfunc;
625	void			*nmt_timerctx;
626	struct ndis_miniport_timer	*nmt_nexttimer;
627};
628
629typedef struct ndis_miniport_timer ndis_miniport_timer;
630
631struct ndis_spin_lock {
632	ndis_kspin_lock		nsl_spinlock;
633	ndis_kirql		nsl_kirql;
634};
635
636typedef struct ndis_spin_lock ndis_spin_lock;
637
638struct ndis_request {
639	uint8_t			nr_macreserved[4*sizeof(void *)];
640	uint32_t		nr_requesttype;
641	union _ndis_data {
642		struct _ndis_query_information {
643			ndis_oid	nr_oid;
644			void		*nr_infobuf;
645			uint32_t	nr_infobuflen;
646			uint32_t	nr_byteswritten;
647			uint32_t	nr_bytesneeded;
648		} ndis_query_information;
649		struct _ndis_set_information {
650			ndis_oid	nr_oid;
651			void		*nr_infobuf;
652			uint32_t	nr_infobuflen;
653			uint32_t	nr_byteswritten;
654			uint32_t	nr_bytesneeded;
655		} ndis_set_information;
656	} ndis_data;
657	/* NDIS 5.0 extentions */
658	uint8_t			nr_ndis_rsvd[9 * sizeof(void *)];
659	union {
660		uint8_t		nr_callmgr_rsvd[2 * sizeof(void *)];
661		uint8_t		nr_protocol_rsvd[2 * sizeof(void *)];
662	} u;
663	uint8_t			nr_miniport_rsvd[2 * sizeof(void *)];
664};
665
666typedef struct ndis_request ndis_request;
667
668/*
669 * Filler, not used.
670 */
671struct ndis_miniport_interrupt {
672	void			*ni_introbj;
673	ndis_spin_lock		ni_dpccountlock;
674	void			*ni_rsvd;
675	void			*ni_isrfunc;
676	void			*ni_dpcfunc;
677	struct ndis_kdpc	ni_dpc;
678	ndis_miniport_block	*ni_block;
679	uint8_t			ni_dpccnt;
680	uint8_t			ni_filler1;
681	struct ndis_kevent	ni_dpcsdoneevent;
682	uint8_t			ni_shared;
683	uint8_t			ni_isrreq;
684};
685
686typedef struct ndis_miniport_interrupt ndis_miniport_interrupt;
687
688enum ndis_interrupt_mode {
689	nim_level,
690	nim_latched
691};
692
693typedef enum ndis_interrupt_mode ndis_interrupt_mode;
694
695
696struct ndis_buffer {
697	struct ndis_buffer	*nb_next;
698	uint16_t		nb_size;
699	uint16_t		nb_flags;
700	void			*nb_process;
701	void			*nb_mappedsystemva;
702	void			*nb_startva;
703	uint32_t		nb_bytecount;
704	uint32_t		nb_byteoffset;
705};
706
707typedef struct ndis_buffer ndis_buffer;
708
709struct ndis_sc_element {
710	ndis_physaddr		nse_addr;
711	uint32_t		nse_len;
712	uint32_t		*nse_rsvd;
713};
714
715typedef struct ndis_sc_element ndis_sc_element;
716
717#define NDIS_MAXSEG		32
718struct ndis_sc_list {
719	uint32_t		nsl_frags;
720	uint32_t		*nsl_rsvd;
721	ndis_sc_element		nsl_elements[NDIS_MAXSEG];
722};
723
724typedef struct ndis_sc_list ndis_sc_list;
725
726enum ndis_perpkt_info {
727	ndis_tcpipcsum_info,
728	ndis_ipsec_info,
729	ndis_largesend_info,
730	ndis_classhandle_info,
731	ndis_rsvd,
732	ndis_sclist_info,
733	ndis_ieee8021q_info,
734	ndis_originalpkt_info,
735        ndis_packetcancelid,
736	ndis_maxpkt_info
737};
738
739typedef enum ndis_perpkt_info ndis_perpkt_info;
740
741struct ndis_packet_extension {
742	void			*npe_info[ndis_maxpkt_info];
743};
744
745typedef struct ndis_packet_extension ndis_packet_extension;
746
747struct ndis_packet_private {
748	uint32_t		npp_physcnt;
749	uint32_t		npp_totlen;
750	ndis_buffer		*npp_head;
751	ndis_buffer		*npp_tail;
752
753	void			*npp_pool;
754	uint32_t		npp_count;
755	uint32_t		npp_flags;
756	uint8_t			npp_validcounts;
757	uint8_t			npp_ndispktflags;
758	uint16_t		npp_packetooboffset;
759};
760
761#define NDIS_FLAGS_PROTOCOL_ID_MASK             0x0000000F
762#define NDIS_FLAGS_MULTICAST_PACKET             0x00000010
763#define NDIS_FLAGS_RESERVED2                    0x00000020
764#define NDIS_FLAGS_RESERVED3                    0x00000040
765#define NDIS_FLAGS_DONT_LOOPBACK                0x00000080
766#define NDIS_FLAGS_IS_LOOPBACK_PACKET           0x00000100
767#define NDIS_FLAGS_LOOPBACK_ONLY                0x00000200
768#define NDIS_FLAGS_RESERVED4                    0x00000400
769#define NDIS_FLAGS_DOUBLE_BUFFERED              0x00000800
770#define NDIS_FLAGS_SENT_AT_DPC                  0x00001000
771#define NDIS_FLAGS_USES_SG_BUFFER_LIST          0x00002000
772
773#define NDIS_PROTOCOL_ID_DEFAULT        0x00
774#define NDIS_PROTOCOL_ID_TCP_IP         0x02
775#define NDIS_PROTOCOL_ID_IPX            0x06
776#define NDIS_PROTOCOL_ID_NBF            0x07
777#define NDIS_PROTOCOL_ID_MAX            0x0F
778#define NDIS_PROTOCOL_ID_MASK           0x0F
779
780typedef struct ndis_packet_private ndis_packet_private;
781
782enum ndis_classid {
783	ndis_class_802_3prio,
784	ndis_class_wirelesswan_mbx,
785	ndis_class_irda_packetinfo,
786	ndis_class_atm_aainfo
787};
788
789typedef enum ndis_classid ndis_classid;
790
791struct ndis_mediaspecific_info {
792	uint32_t		nmi_nextentoffset;
793	ndis_classid		nmi_classid;
794	uint32_t		nmi_size;
795	uint8_t			nmi_classinfo[1];
796};
797
798typedef struct ndis_mediaspecific_info ndis_mediaspecific_info;
799
800struct ndis_packet_oob {
801	union {
802		uint64_t		npo_timetotx;
803		uint64_t		npo_timetxed;
804	} u;
805	uint64_t			npo_timerxed;
806	uint32_t			npo_hdrlen;
807	uint32_t			npo_mediaspecific_len;
808	void				*npo_mediaspecific;
809	ndis_status			npo_status;
810};
811
812typedef struct ndis_packet_oob ndis_packet_oob;
813
814struct ndis_packet {
815	ndis_packet_private	np_private;
816	union {
817		/* For connectionless miniports. */
818		struct {
819			uint8_t		np_miniport_rsvd[2 * sizeof(void *)];
820			uint8_t		np_wrapper_rsvd[2 * sizeof(void *)];
821		} np_clrsvd;
822		/* For de-serialized miniports */
823		struct {
824			uint8_t		np_miniport_rsvdex[3 * sizeof(void *)];
825			uint8_t		np_wrapper_rsvdex[sizeof(void *)];
826		} np_dsrsvd;
827		struct {
828			uint8_t		np_mac_rsvd[4 * sizeof(void *)];
829		} np_macrsvd;
830	} u;
831	uint32_t		*np_rsvd[2];
832
833	/*
834	 * This next part is probably wrong, but we need some place
835	 * to put the out of band data structure...
836	 */
837	ndis_packet_oob		np_oob;
838	ndis_packet_extension	np_ext;
839	ndis_sc_list		np_sclist;
840
841	/* BSD-specific stuff which should be invisible to drivers. */
842
843	uint32_t		np_refcnt;
844	void			*np_softc;
845	void			*np_m0;
846	int			np_txidx;
847};
848
849typedef struct ndis_packet ndis_packet;
850
851/* mbuf ext type for NDIS */
852#define EXT_NDIS		0x999
853
854struct ndis_filterdbs {
855	union {
856		void			*nf_ethdb;
857		void			*nf_nulldb;
858	} u;
859	void			*nf_trdb;
860	void			*nf_fddidb;
861	void			*nf_arcdb;
862};
863
864typedef struct ndis_filterdbs ndis_filterdbs;
865
866enum ndis_medium {
867    NdisMedium802_3,
868    NdisMedium802_5,
869    NdisMediumFddi,
870    NdisMediumWan,
871    NdisMediumLocalTalk,
872    NdisMediumDix,              /* defined for convenience, not a real medium */
873    NdisMediumArcnetRaw,
874    NdisMediumArcnet878_2,
875    NdisMediumAtm,
876    NdisMediumWirelessWan,
877    NdisMediumIrda,
878    NdisMediumBpc,
879    NdisMediumCoWan,
880    NdisMedium1394,
881    NdisMediumMax
882};
883
884typedef enum ndis_medium ndis_medium;
885/*
886enum interface_type {
887	InterfaceTypeUndefined = -1,
888	Internal,
889	Isa,
890	Eisa,
891	MicroChannel,
892	TurboChannel,
893	PCIBus,
894	VMEBus,
895	NuBus,
896	PCMCIABus,
897	CBus,
898	MPIBus,
899	MPSABus,
900	ProcessorInternal,
901	InternalPowerBus,
902	PNPISABus,
903	PNPBus,
904	MaximumInterfaceType
905};
906*/
907enum ndis_interface_type {
908	NdisInterfaceInternal = Internal,
909	NdisInterfaceIsa = Isa,
910	NdisInterfaceEisa = Eisa,
911	NdisInterfaceMca = MicroChannel,
912	NdisInterfaceTurboChannel = TurboChannel,
913	NdisInterfacePci = PCIBus,
914	NdisInterfacePcMcia = PCMCIABus
915};
916
917typedef enum ndis_interface_type ndis_interface_type;
918
919struct ndis_paddr_unit {
920	ndis_physaddr		npu_physaddr;
921	uint32_t		npu_len;
922};
923
924typedef struct ndis_paddr_unit ndis_paddr_unit;
925
926struct ndis_map_arg {
927	ndis_paddr_unit		*nma_fraglist;
928	int			nma_cnt;
929	int			nma_max;
930};
931
932/*
933 * Miniport characteristics were originally defined in the NDIS 3.0
934 * spec and then extended twice, in NDIS 4.0 and 5.0.
935 */
936
937struct ndis_miniport_characteristics {
938
939	/* NDIS 3.0 */
940
941	uint8_t			nmc_version_major;
942	uint8_t			nmc_version_minor;
943	uint16_t		nmc_pad;
944	uint32_t		nmc_rsvd;
945	void *			nmc_checkhang_func;
946	void *			nmc_disable_interrupts_func;
947	void *			nmc_enable_interrupts_func;
948	void *			nmc_halt_func;
949	void *			nmc_interrupt_func;
950	void *			nmc_init_func;
951	void *			nmc_isr_func;
952	void *			nmc_queryinfo_func;
953	void *			nmc_reconfig_func;
954	void *			nmc_reset_func;
955	void *			nmc_sendsingle_func;
956	void *			nmc_setinfo_func;
957	void *			nmc_transferdata_func;
958
959	/* NDIS 4.0 extentions */
960
961	void *			nmc_return_packet_func;
962	void *			nmc_sendmulti_func;
963	void *			nmc_allocate_complete_func;
964
965	/* NDIS 5.0 extensions */
966
967	void *			nmc_cocreatevc_func;
968	void *			nmc_codeletevc_func;
969	void *			nmc_coactivatevc_func;
970	void *			nmc_codeactivatevc_func;
971	void *			nmc_comultisend_func;
972	void *			nmc_corequest_func;
973
974	/* NDIS 5.1 extentions */
975
976	void *			nmc_canceltxpkts_handler;
977	void *			nmc_pnpevent_handler;
978	void *			nmc_shutdown_handler;
979	void *			nmc_rsvd0;
980	void *			nmc_rsvd1;
981	void *			nmc_rsvd2;
982	void *			nmc_rsvd3;
983};
984
985typedef struct ndis_miniport_characteristics ndis_miniport_characteristics;
986
987struct ndis_driver_object {
988	char			*ndo_ifname;
989	void			*ndo_softc;
990	ndis_miniport_characteristics ndo_chars;
991};
992
993typedef struct ndis_driver_object ndis_driver_object;
994
995struct ndis_reference {
996	ndis_kspin_lock		nr_spinlock;
997	uint16_t		nr_refcnt;
998	uint8_t			nr_closing;
999};
1000
1001typedef struct ndis_reference ndis_reference;
1002
1003struct ndis_timer_entry {
1004	struct callout		nte_ch;
1005	ndis_miniport_timer	*nte_timer;
1006	TAILQ_ENTRY(ndis_timer_entry)	link;
1007};
1008
1009TAILQ_HEAD(nte_head, ndis_timer_entry);
1010
1011/*
1012 * The miniport block is basically the internal NDIS handle. We need
1013 * to define this because, unfortunately, it is not entirely opaque
1014 * to NDIS drivers. For one thing, it contains the function pointer
1015 * to the NDIS packet receive handler, which is invoked out of the
1016 * NDIS block via a macro rather than a function pointer. (The
1017 * NdisMIndicateReceivePacket() routine is a macro rather than
1018 * a function.) For another, the driver maintains a pointer to the
1019 * miniport block and passes it as a handle to various NDIS functions.
1020 * (The driver never really knows this because it's hidden behind
1021 * an ndis_handle though.)
1022 *
1023 * The miniport block has two parts: the first part contains fields
1024 * that must never change, since they are referenced by driver
1025 * binaries through macros. The second part is ignored by the driver,
1026 * but contains various things used internaly by NDIS.SYS. In our
1027 * case, we define the first 'immutable' part exactly as it appears
1028 * in Windows, but don't bother duplicating the Windows definitions
1029 * for the second part. Instead, we replace them with a few BSD-specific
1030 * things.
1031 */
1032
1033struct ndis_miniport_block {
1034	/*
1035	 * Windows-specific portion -- DO NOT MODIFY OR NDIS
1036	 * DRIVERS WILL NOT WORK.
1037	 */
1038	void			*nmb_signature;	/* magic number */
1039	ndis_miniport_block	*nmb_nextminiport;
1040	ndis_mdriver_block	*nmb_driverhandle;
1041	ndis_handle		nmb_miniportadapterctx;
1042	ndis_unicode_string	nmb_name;
1043	ndis_bind_paths		*nmb_bindpaths;
1044	ndis_handle		nmb_openqueue;
1045	ndis_reference		nmb_ref;
1046	ndis_handle		nmb_devicectx;
1047	uint8_t			nmb_padding;
1048	uint8_t			nmb_lockacquired;
1049	uint8_t			nmb_pmodeopens;
1050	uint8_t			nmb_assignedcpu;
1051	ndis_kspin_lock		nmb_lock;
1052	ndis_request		*nmb_mediarequest;
1053	ndis_miniport_interrupt	*nmb_interrupt;
1054	uint32_t		nmb_flags;
1055	uint32_t		nmb_pnpflags;
1056	ndis_list_entry		nmb_packetlist;
1057	ndis_packet		*nmb_firstpendingtxpacket;
1058	ndis_packet		*nmb_returnpacketqueue;
1059	uint32_t		nmb_requestbuffer;
1060	void			*nmb_setmcastbuf;
1061	ndis_miniport_block	*nmb_primaryminiport;
1062	void			*nmb_wrapperctx;
1063	void			*nmb_busdatactx;
1064	uint32_t		nmb_pnpcaps;
1065	cm_resource_list	*nmb_resources;
1066	ndis_timer		nmb_wkupdpctimer;
1067	ndis_unicode_string	nmb_basename;
1068	ndis_unicode_string	nmb_symlinkname;
1069	uint32_t		nmb_checkforhangsecs;
1070	uint16_t		nmb_cfhticks;
1071	uint16_t		nmb_cfhcurrticks;
1072	ndis_status		nmb_resetstatus;
1073	ndis_handle		nmb_resetopen;
1074	ndis_filterdbs		nmb_filterdbs;
1075	void			*nmb_pktind_func;
1076	void			*nmb_senddone_func;
1077	void			*nmb_sendrsrc_func;
1078	void			*nmb_resetdone_func;
1079	ndis_medium		nmb_medium;
1080	uint32_t		nmb_busnum;
1081	uint32_t		nmb_bustye;
1082	uint32_t		nmb_adaptertype;
1083	void			*nmb_deviceobj;
1084	void			*nmb_physdeviceobj;
1085	void			*nmb_nextdeviceobj;
1086	void			*nmb_mapreg;
1087	void			*nmb_callmgraflist;
1088	void			*nmb_miniportthread;
1089	void			*nmb_setinfobuf;
1090	uint16_t		nmb_setinfobuflen;
1091	uint16_t		nmb_maxsendpkts;
1092	ndis_status		nmb_fakestatus;
1093	void			*nmb_lockhandler;
1094	ndis_unicode_string	*nmb_adapterinstancename;
1095	void			*nmb_timerqueue;
1096	uint32_t		nmb_mactoptions;
1097	ndis_request		*nmb_pendingreq;
1098	uint32_t		nmb_maxlongaddrs;
1099	uint32_t		nmb_maxshortaddrs;
1100	uint32_t		nmb_currlookahead;
1101	uint32_t		nmb_maxlookahead;
1102	void			*nmb_interrupt_func;
1103	void			*nmb_disableintr_func;
1104	void			*nmb_enableintr_func;
1105	void			*nmb_sendpkts_func;
1106	void			*nmb_deferredsend_func;
1107	void			*nmb_ethrxindicate_func;
1108	void			*nmb_txrxindicate_func;
1109	void			*nmb_fddirxindicate_func;
1110	void			*nmb_ethrxdone_func;
1111	void			*nmb_txrxdone_func;
1112	void			*nmb_fddirxcond_func;
1113	void			*nmb_status_func;
1114	void			*nmb_statusdone_func;
1115	void			*nmb_tdcond_func;
1116	void			*nmb_querydone_func;
1117	void			*nmb_setdone_func;
1118	void			*nmb_wantxdone_func;
1119	void			*nmb_wanrx_func;
1120	void			*nmb_wanrxdone_func;
1121	/*
1122	 * End of windows-specific portion of miniport block. Everything
1123	 * below is BSD-specific.
1124	 */
1125	struct ifnet		*nmb_ifp;
1126	uint8_t			nmb_dummybuf[128];
1127	ndis_config_parm	nmb_replyparm;
1128	int			nmb_pciidx;
1129	device_t		nmb_dev;
1130	ndis_resource_list	*nmb_rlist;
1131	ndis_status		nmb_getstat;
1132	ndis_status		nmb_setstat;
1133	struct nte_head		nmb_timerlist;
1134};
1135
1136typedef ndis_status (*ndis_init_handler)(ndis_status *, uint32_t *,
1137		ndis_medium *, uint32_t, ndis_handle, ndis_handle);
1138typedef ndis_status (*ndis_queryinfo_handler)(ndis_handle, ndis_oid,
1139		void *, uint32_t, uint32_t *, uint32_t *);
1140typedef ndis_status (*ndis_setinfo_handler)(ndis_handle, ndis_oid,
1141		void *, uint32_t, uint32_t *, uint32_t *);
1142typedef ndis_status (*ndis_sendsingle_handler)(ndis_handle,
1143		ndis_packet *, uint32_t);
1144typedef ndis_status (*ndis_sendmulti_handler)(ndis_handle,
1145		ndis_packet **, uint32_t);
1146typedef void (*ndis_isr_handler)(uint8_t *, uint8_t *, ndis_handle);
1147typedef void (*ndis_interrupt_handler)(ndis_handle);
1148typedef void (*ndis_reset_handler)(uint8_t *, ndis_handle);
1149typedef void (*ndis_halt_handler)(ndis_handle);
1150typedef void (*ndis_return_handler)(ndis_handle, ndis_packet *);
1151typedef void (*ndis_enable_interrupts_handler)(ndis_handle);
1152typedef void (*ndis_disable_interrupts_handler)(ndis_handle);
1153typedef void (*ndis_shutdown_handler)(void *);
1154typedef void (*ndis_allocdone_handler)(ndis_handle, void *,
1155		ndis_physaddr *, uint32_t, void *);
1156typedef uint8_t (*ndis_checkforhang_handler)(ndis_handle);
1157
1158typedef ndis_status (*driver_entry)(void *, ndis_unicode_string *);
1159
1160extern image_patch_table ndis_functbl[];
1161
1162__BEGIN_DECLS
1163extern int ndis_libinit(void);
1164extern int ndis_libfini(void);
1165extern int ndis_ascii_to_unicode(char *, uint16_t **);
1166extern int ndis_unicode_to_ascii(uint16_t *, int, char **);
1167extern int ndis_load_driver(vm_offset_t, void *);
1168extern int ndis_unload_driver(void *);
1169extern int ndis_mtop(struct mbuf *, ndis_packet **);
1170extern int ndis_ptom(struct mbuf **, ndis_packet *);
1171extern int ndis_get_info(void *, ndis_oid, void *, int *);
1172extern int ndis_set_info(void *, ndis_oid, void *, int *);
1173extern int ndis_get_supported_oids(void *, ndis_oid **, int *);
1174extern int ndis_send_packets(void *, ndis_packet **, int);
1175extern int ndis_send_packet(void *, ndis_packet *);
1176extern int ndis_convert_res(void *);
1177extern int ndis_alloc_amem(void *);
1178extern void ndis_free_packet(ndis_packet *);
1179extern void ndis_free_bufs(ndis_buffer *);
1180extern int ndis_reset_nic(void *);
1181extern int ndis_halt_nic(void *);
1182extern int ndis_shutdown_nic(void *);
1183extern int ndis_init_nic(void *);
1184extern int ndis_isr(void *, int *, int *);
1185extern int ndis_intrhand(void *);
1186extern void ndis_return_packet(void *, void *);
1187extern void ndis_enable_intr(void *);
1188extern void ndis_disable_intr(void *);
1189extern int ndis_init_dma(void *);
1190extern int ndis_destroy_dma(void *);
1191extern int ndis_create_sysctls(void *);
1192extern int ndis_add_sysctl(void *, char *, char *, char *, int);
1193extern int ndis_flush_sysctls(void *);
1194__END_DECLS
1195
1196#endif /* _NDIS_VAR_H_ */
1197