The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/compat/ndis/ndis_var.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    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: src/sys/compat/ndis/ndis_var.h,v 1.29.2.3 2005/03/31 04:24:35 wpaul Exp $
   33  */
   34 
   35 #ifndef _NDIS_VAR_H_
   36 #define _NDIS_VAR_H_
   37 
   38 /* Forward declarations */
   39 struct ndis_miniport_block;
   40 struct ndis_mdriver_block;
   41 typedef struct ndis_miniport_block ndis_miniport_block;
   42 typedef struct ndis_mdriver_block ndis_mdriver_block;
   43 
   44 /* Base types */
   45 typedef uint32_t ndis_status;
   46 typedef void *ndis_handle;
   47 typedef uint32_t ndis_oid;
   48 typedef uint32_t ndis_error_code;
   49 typedef register_t ndis_kspin_lock;
   50 typedef uint8_t ndis_kirql;
   51 
   52 /* Print out debugging information */
   53 /* #define NDIS_DBG */
   54 
   55 /*
   56  * NDIS status codes (there are lots of them). The ones that
   57  * don't seem to fit the pattern are actually mapped to generic
   58  * NT status codes.
   59  */
   60 
   61 #define NDIS_STATUS_SUCCESS             0
   62 #define NDIS_STATUS_PENDING             0x00000103
   63 #define NDIS_STATUS_NOT_RECOGNIZED      0x00010001
   64 #define NDIS_STATUS_NOT_COPIED          0x00010002
   65 #define NDIS_STATUS_NOT_ACCEPTED        0x00010003
   66 #define NDIS_STATUS_CALL_ACTIVE         0x00010007
   67 #define NDIS_STATUS_ONLINE              0x40010003
   68 #define NDIS_STATUS_RESET_START         0x40010004
   69 #define NDIS_STATUS_RESET_END           0x40010005
   70 #define NDIS_STATUS_RING_STATUS         0x40010006
   71 #define NDIS_STATUS_CLOSED              0x40010007
   72 #define NDIS_STATUS_WAN_LINE_UP         0x40010008
   73 #define NDIS_STATUS_WAN_LINE_DOWN       0x40010009
   74 #define NDIS_STATUS_WAN_FRAGMENT        0x4001000A
   75 #define NDIS_STATUS_MEDIA_CONNECT       0x4001000B
   76 #define NDIS_STATUS_MEDIA_DISCONNECT    0x4001000C
   77 #define NDIS_STATUS_HARDWARE_LINE_UP    0x4001000D
   78 #define NDIS_STATUS_HARDWARE_LINE_DOWN  0x4001000E
   79 #define NDIS_STATUS_INTERFACE_UP        0x4001000F
   80 #define NDIS_STATUS_INTERFACE_DOWN      0x40010010
   81 #define NDIS_STATUS_MEDIA_BUSY          0x40010011
   82 #define NDIS_STATUS_MEDIA_SPECIFIC_INDICATION   0x40010012
   83 #define NDIS_STATUS_WW_INDICATION NDIS_STATUS_MEDIA_SPECIFIC_INDICATION
   84 #define NDIS_STATUS_LINK_SPEED_CHANGE   0x40010013
   85 #define NDIS_STATUS_WAN_GET_STATS       0x40010014
   86 #define NDIS_STATUS_WAN_CO_FRAGMENT     0x40010015
   87 #define NDIS_STATUS_WAN_CO_LINKPARAMS   0x40010016
   88 #define NDIS_STATUS_NOT_RESETTABLE      0x80010001
   89 #define NDIS_STATUS_SOFT_ERRORS         0x80010003
   90 #define NDIS_STATUS_HARD_ERRORS         0x80010004
   91 #define NDIS_STATUS_BUFFER_OVERFLOW     0x80000005
   92 #define NDIS_STATUS_FAILURE             0xC0000001
   93 #define NDIS_STATUS_RESOURCES           0xC000009A
   94 #define NDIS_STATUS_CLOSING             0xC0010002
   95 #define NDIS_STATUS_BAD_VERSION         0xC0010004
   96 #define NDIS_STATUS_BAD_CHARACTERISTICS 0xC0010005
   97 #define NDIS_STATUS_ADAPTER_NOT_FOUND   0xC0010006
   98 #define NDIS_STATUS_OPEN_FAILED         0xC0010007
   99 #define NDIS_STATUS_DEVICE_FAILED       0xC0010008
  100 #define NDIS_STATUS_MULTICAST_FULL      0xC0010009
  101 #define NDIS_STATUS_MULTICAST_EXISTS    0xC001000A
  102 #define NDIS_STATUS_MULTICAST_NOT_FOUND 0xC001000B
  103 #define NDIS_STATUS_REQUEST_ABORTED     0xC001000C
  104 #define NDIS_STATUS_RESET_IN_PROGRESS   0xC001000D
  105 #define NDIS_STATUS_CLOSING_INDICATING  0xC001000E
  106 #define NDIS_STATUS_NOT_SUPPORTED       0xC00000BB
  107 #define NDIS_STATUS_INVALID_PACKET      0xC001000F
  108 #define NDIS_STATUS_OPEN_LIST_FULL      0xC0010010
  109 #define NDIS_STATUS_ADAPTER_NOT_READY   0xC0010011
  110 #define NDIS_STATUS_ADAPTER_NOT_OPEN    0xC0010012
  111 #define NDIS_STATUS_NOT_INDICATING      0xC0010013
  112 #define NDIS_STATUS_INVALID_LENGTH      0xC0010014
  113 #define NDIS_STATUS_INVALID_DATA        0xC0010015
  114 #define NDIS_STATUS_BUFFER_TOO_SHORT    0xC0010016
  115 #define NDIS_STATUS_INVALID_OID         0xC0010017
  116 #define NDIS_STATUS_ADAPTER_REMOVED     0xC0010018
  117 #define NDIS_STATUS_UNSUPPORTED_MEDIA   0xC0010019
  118 #define NDIS_STATUS_GROUP_ADDRESS_IN_USE        0xC001001A
  119 #define NDIS_STATUS_FILE_NOT_FOUND      0xC001001B
  120 #define NDIS_STATUS_ERROR_READING_FILE  0xC001001C
  121 #define NDIS_STATUS_ALREADY_MAPPED      0xC001001D
  122 #define NDIS_STATUS_RESOURCE_CONFLICT   0xC001001E
  123 #define NDIS_STATUS_NO_CABLE            0xC001001F
  124 #define NDIS_STATUS_INVALID_SAP         0xC0010020
  125 #define NDIS_STATUS_SAP_IN_USE          0xC0010021
  126 #define NDIS_STATUS_INVALID_ADDRESS     0xC0010022
  127 #define NDIS_STATUS_VC_NOT_ACTIVATED    0xC0010023
  128 #define NDIS_STATUS_DEST_OUT_OF_ORDER   0xC0010024
  129 #define NDIS_STATUS_VC_NOT_AVAILABLE    0xC0010025
  130 #define NDIS_STATUS_CELLRATE_NOT_AVAILABLE      0xC0010026
  131 #define NDIS_STATUS_INCOMPATABLE_QOS    0xC0010027
  132 #define NDIS_STATUS_AAL_PARAMS_UNSUPPORTED      0xC0010028
  133 #define NDIS_STATUS_NO_ROUTE_TO_DESTINATION     0xC0010029
  134 #define NDIS_STATUS_TOKEN_RING_OPEN_ERROR       0xC0011000
  135 #define NDIS_STATUS_INVALID_DEVICE_REQUEST      0xC0000010
  136 #define NDIS_STATUS_NETWORK_UNREACHABLE         0xC000023C
  137 
  138 /*
  139  * NDIS event codes. They are usually reported to NdisWriteErrorLogEntry().
  140  */
  141 
  142 #define EVENT_NDIS_RESOURCE_CONFLICT    0xC0001388
  143 #define EVENT_NDIS_OUT_OF_RESOURCE      0xC0001389
  144 #define EVENT_NDIS_HARDWARE_FAILURE     0xC000138A
  145 #define EVENT_NDIS_ADAPTER_NOT_FOUND    0xC000138B
  146 #define EVENT_NDIS_INTERRUPT_CONNECT    0xC000138C
  147 #define EVENT_NDIS_DRIVER_FAILURE       0xC000138D
  148 #define EVENT_NDIS_BAD_VERSION          0xC000138E
  149 #define EVENT_NDIS_TIMEOUT              0x8000138F
  150 #define EVENT_NDIS_NETWORK_ADDRESS      0xC0001390
  151 #define EVENT_NDIS_UNSUPPORTED_CONFIGURATION    0xC0001391
  152 #define EVENT_NDIS_INVALID_VALUE_FROM_ADAPTER   0xC0001392
  153 #define EVENT_NDIS_MISSING_CONFIGURATION_PARAMETER      0xC0001393
  154 #define EVENT_NDIS_BAD_IO_BASE_ADDRESS  0xC0001394
  155 #define EVENT_NDIS_RECEIVE_SPACE_SMALL  0x40001395
  156 #define EVENT_NDIS_ADAPTER_DISABLED     0x80001396
  157 #define EVENT_NDIS_IO_PORT_CONFLICT     0x80001397
  158 #define EVENT_NDIS_PORT_OR_DMA_CONFLICT 0x80001398
  159 #define EVENT_NDIS_MEMORY_CONFLICT      0x80001399
  160 #define EVENT_NDIS_INTERRUPT_CONFLICT   0x8000139A
  161 #define EVENT_NDIS_DMA_CONFLICT         0x8000139B
  162 #define EVENT_NDIS_INVALID_DOWNLOAD_FILE_ERROR  0xC000139C
  163 #define EVENT_NDIS_MAXRECEIVES_ERROR    0x8000139D
  164 #define EVENT_NDIS_MAXTRANSMITS_ERROR   0x8000139E
  165 #define EVENT_NDIS_MAXFRAMESIZE_ERROR   0x8000139F
  166 #define EVENT_NDIS_MAXINTERNALBUFS_ERROR        0x800013A0
  167 #define EVENT_NDIS_MAXMULTICAST_ERROR   0x800013A1
  168 #define EVENT_NDIS_PRODUCTID_ERROR      0x800013A2
  169 #define EVENT_NDIS_LOBE_FAILUE_ERROR    0x800013A3
  170 #define EVENT_NDIS_SIGNAL_LOSS_ERROR    0x800013A4
  171 #define EVENT_NDIS_REMOVE_RECEIVED_ERROR        0x800013A5
  172 #define EVENT_NDIS_TOKEN_RING_CORRECTION        0x400013A6
  173 #define EVENT_NDIS_ADAPTER_CHECK_ERROR  0xC00013A7
  174 #define EVENT_NDIS_RESET_FAILURE_ERROR  0x800013A8
  175 #define EVENT_NDIS_CABLE_DISCONNECTED_ERROR     0x800013A9
  176 #define EVENT_NDIS_RESET_FAILURE_CORRECTION     0x800013AA
  177 
  178 /*
  179  * NDIS OIDs used by the queryinfo/setinfo routines.
  180  * Some are required by all NDIS drivers, some are specific to
  181  * a particular type of device, and some are purely optional.
  182  * Unfortunately, one of the purely optional OIDs is the one
  183  * that lets us set the MAC address of the device.
  184  */
  185 
  186 /* Required OIDs */
  187 #define OID_GEN_SUPPORTED_LIST                  0x00010101
  188 #define OID_GEN_HARDWARE_STATUS                 0x00010102
  189 #define OID_GEN_MEDIA_SUPPORTED                 0x00010103
  190 #define OID_GEN_MEDIA_IN_USE                    0x00010104
  191 #define OID_GEN_MAXIMUM_LOOKAHEAD               0x00010105
  192 #define OID_GEN_MAXIMUM_FRAME_SIZE              0x00010106
  193 #define OID_GEN_LINK_SPEED                      0x00010107
  194 #define OID_GEN_TRANSMIT_BUFFER_SPACE           0x00010108
  195 #define OID_GEN_RECEIVE_BUFFER_SPACE            0x00010109
  196 #define OID_GEN_TRANSMIT_BLOCK_SIZE             0x0001010A
  197 #define OID_GEN_RECEIVE_BLOCK_SIZE              0x0001010B
  198 #define OID_GEN_VENDOR_ID                       0x0001010C
  199 #define OID_GEN_VENDOR_DESCRIPTION              0x0001010D
  200 #define OID_GEN_CURRENT_PACKET_FILTER           0x0001010E
  201 #define OID_GEN_CURRENT_LOOKAHEAD               0x0001010F
  202 #define OID_GEN_DRIVER_VERSION                  0x00010110
  203 #define OID_GEN_MAXIMUM_TOTAL_SIZE              0x00010111
  204 #define OID_GEN_PROTOCOL_OPTIONS                0x00010112
  205 #define OID_GEN_MAC_OPTIONS                     0x00010113
  206 #define OID_GEN_MEDIA_CONNECT_STATUS            0x00010114
  207 #define OID_GEN_MAXIMUM_SEND_PACKETS            0x00010115
  208 #define OID_GEN_VENDOR_DRIVER_VERSION           0x00010116
  209 #define OID_GEN_SUPPORTED_GUIDS                 0x00010117
  210 #define OID_GEN_NETWORK_LAYER_ADDRESSES         0x00010118      /* Set only */
  211 #define OID_GEN_TRANSPORT_HEADER_OFFSET         0x00010119      /* Set only */
  212 #define OID_GEN_MACHINE_NAME                    0x0001021A
  213 #define OID_GEN_RNDIS_CONFIG_PARAMETER          0x0001021B      /* Set only */
  214 #define OID_GEN_VLAN_ID                         0x0001021C
  215 
  216 /* Optional OIDs. */
  217 #define OID_GEN_MEDIA_CAPABILITIES              0x00010201
  218 #define OID_GEN_PHYSICAL_MEDIUM                 0x00010202
  219 
  220 /* Required statistics OIDs. */
  221 #define OID_GEN_XMIT_OK                         0x00020101
  222 #define OID_GEN_RCV_OK                          0x00020102
  223 #define OID_GEN_XMIT_ERROR                      0x00020103
  224 #define OID_GEN_RCV_ERROR                       0x00020104
  225 #define OID_GEN_RCV_NO_BUFFER                   0x00020105
  226 
  227 /* Optional OID statistics */
  228 #define OID_GEN_DIRECTED_BYTES_XMIT             0x00020201
  229 #define OID_GEN_DIRECTED_FRAMES_XMIT            0x00020202
  230 #define OID_GEN_MULTICAST_BYTES_XMIT            0x00020203
  231 #define OID_GEN_MULTICAST_FRAMES_XMIT           0x00020204
  232 #define OID_GEN_BROADCAST_BYTES_XMIT            0x00020205
  233 #define OID_GEN_BROADCAST_FRAMES_XMIT           0x00020206
  234 #define OID_GEN_DIRECTED_BYTES_RCV              0x00020207
  235 #define OID_GEN_DIRECTED_FRAMES_RCV             0x00020208
  236 #define OID_GEN_MULTICAST_BYTES_RCV             0x00020209
  237 #define OID_GEN_MULTICAST_FRAMES_RCV            0x0002020A
  238 #define OID_GEN_BROADCAST_BYTES_RCV             0x0002020B
  239 #define OID_GEN_BROADCAST_FRAMES_RCV            0x0002020C
  240 #define OID_GEN_RCV_CRC_ERROR                   0x0002020D
  241 #define OID_GEN_TRANSMIT_QUEUE_LENGTH           0x0002020E
  242 #define OID_GEN_GET_TIME_CAPS                   0x0002020F
  243 #define OID_GEN_GET_NETCARD_TIME                0x00020210
  244 #define OID_GEN_NETCARD_LOAD                    0x00020211
  245 #define OID_GEN_DEVICE_PROFILE                  0x00020212
  246 
  247 /* 802.3 (ethernet) OIDs */
  248 #define OID_802_3_PERMANENT_ADDRESS             0x01010101
  249 #define OID_802_3_CURRENT_ADDRESS               0x01010102
  250 #define OID_802_3_MULTICAST_LIST                0x01010103
  251 #define OID_802_3_MAXIMUM_LIST_SIZE             0x01010104
  252 #define OID_802_3_MAC_OPTIONS                   0x01010105
  253 #define NDIS_802_3_MAC_OPTION_PRIORITY          0x00000001
  254 #define OID_802_3_RCV_ERROR_ALIGNMENT           0x01020101
  255 #define OID_802_3_XMIT_ONE_COLLISION            0x01020102
  256 #define OID_802_3_XMIT_MORE_COLLISIONS          0x01020103
  257 #define OID_802_3_XMIT_DEFERRED                 0x01020201
  258 #define OID_802_3_XMIT_MAX_COLLISIONS           0x01020202
  259 #define OID_802_3_RCV_OVERRUN                   0x01020203
  260 #define OID_802_3_XMIT_UNDERRUN                 0x01020204
  261 #define OID_802_3_XMIT_HEARTBEAT_FAILURE        0x01020205
  262 #define OID_802_3_XMIT_TIMES_CRS_LOST           0x01020206
  263 #define OID_802_3_XMIT_LATE_COLLISIONS          0x01020207
  264 
  265 /* PnP and power management OIDs */
  266 #define OID_PNP_CAPABILITIES                    0xFD010100
  267 #define OID_PNP_SET_POWER                       0xFD010101
  268 #define OID_PNP_QUERY_POWER                     0xFD010102
  269 #define OID_PNP_ADD_WAKE_UP_PATTERN             0xFD010103
  270 #define OID_PNP_REMOVE_WAKE_UP_PATTERN          0xFD010104
  271 #define OID_PNP_WAKE_UP_PATTERN_LIST            0xFD010105
  272 #define OID_PNP_ENABLE_WAKE_UP                  0xFD010106
  273 
  274 /* PnP/PM Statistics (Optional). */
  275 #define OID_PNP_WAKE_UP_OK                      0xFD020200
  276 #define OID_PNP_WAKE_UP_ERROR                   0xFD020201
  277 
  278 /* The following bits are defined for OID_PNP_ENABLE_WAKE_UP */
  279 #define NDIS_PNP_WAKE_UP_MAGIC_PACKET           0x00000001
  280 #define NDIS_PNP_WAKE_UP_PATTERN_MATCH          0x00000002
  281 #define NDIS_PNP_WAKE_UP_LINK_CHANGE            0x00000004
  282 
  283 /* 802.11 OIDs */
  284 #define OID_802_11_BSSID                        0x0D010101
  285 #define OID_802_11_SSID                         0x0D010102
  286 #define OID_802_11_NETWORK_TYPES_SUPPORTED      0x0D010203
  287 #define OID_802_11_NETWORK_TYPE_IN_USE          0x0D010204
  288 #define OID_802_11_TX_POWER_LEVEL               0x0D010205
  289 #define OID_802_11_RSSI                         0x0D010206
  290 #define OID_802_11_RSSI_TRIGGER                 0x0D010207
  291 #define OID_802_11_INFRASTRUCTURE_MODE          0x0D010108
  292 #define OID_802_11_FRAGMENTATION_THRESHOLD      0x0D010209
  293 #define OID_802_11_RTS_THRESHOLD                0x0D01020A
  294 #define OID_802_11_NUMBER_OF_ANTENNAS           0x0D01020B
  295 #define OID_802_11_RX_ANTENNA_SELECTED          0x0D01020C
  296 #define OID_802_11_TX_ANTENNA_SELECTED          0x0D01020D
  297 #define OID_802_11_SUPPORTED_RATES              0x0D01020E
  298 #define OID_802_11_DESIRED_RATES                0x0D010210
  299 #define OID_802_11_CONFIGURATION                0x0D010211
  300 #define OID_802_11_STATISTICS                   0x0D020212
  301 #define OID_802_11_ADD_WEP                      0x0D010113
  302 #define OID_802_11_REMOVE_WEP                   0x0D010114
  303 #define OID_802_11_DISASSOCIATE                 0x0D010115
  304 #define OID_802_11_POWER_MODE                   0x0D010216
  305 #define OID_802_11_BSSID_LIST                   0x0D010217
  306 #define OID_802_11_AUTHENTICATION_MODE          0x0D010118
  307 #define OID_802_11_PRIVACY_FILTER               0x0D010119
  308 #define OID_802_11_BSSID_LIST_SCAN              0x0D01011A
  309 #define OID_802_11_WEP_STATUS                   0x0D01011B
  310 #define OID_802_11_ENCRYPTION_STATUS            OID_802_11_WEP_STATUS
  311 #define OID_802_11_RELOAD_DEFAULTS              0x0D01011C
  312 #define OID_802_11_ADD_KEY                      0x0D01011D
  313 #define OID_802_11_REMOVE_KEY                   0x0D01011E
  314 #define OID_802_11_ASSOCIATION_INFORMATION      0x0D01011F
  315 #define OID_802_11_TEST                         0x0D010120
  316 
  317 /* structures/definitions for 802.11 */
  318 #define NDIS_80211_NETTYPE_11FH         0x00000000
  319 #define NDIS_80211_NETTYPE_11DS         0x00000001
  320 #define NDIS_80211_NETTYPE_11OFDM5      0x00000002
  321 #define NDIS_80211_NETTYPE_11OFDM24     0x00000003
  322 
  323 struct ndis_80211_nettype_list {
  324         uint32_t                ntl_items;
  325         uint32_t                ntl_type[1];
  326 };
  327 
  328 #define NDIS_80211_POWERMODE_CAM        0x00000000
  329 #define NDIS_80211_POWERMODE_MAX_PSP    0x00000001
  330 #define NDIS_80211_POWERMODE_FAST_PSP   0x00000002
  331 
  332 typedef uint32_t ndis_80211_power;      /* Power in milliwatts */
  333 typedef uint32_t ndis_80211_rssi;       /* Signal strength in dBm */
  334 
  335 struct ndis_80211_config_fh {
  336         uint32_t                ncf_length;
  337         uint32_t                ncf_hoppatterh;
  338         uint32_t                ncf_hopset;
  339         uint32_t                ncf_dwelltime;
  340 };
  341 
  342 typedef struct ndis_80211_config_fh ndis_80211_config_fh;
  343 
  344 struct ndis_80211_config {
  345         uint32_t                nc_length;
  346         uint32_t                nc_beaconperiod;
  347         uint32_t                nc_atimwin;
  348         uint32_t                nc_dsconfig;
  349         ndis_80211_config_fh    nc_fhconfig;
  350 };
  351 
  352 typedef struct ndis_80211_config ndis_80211_config;
  353 
  354 struct ndis_80211_stats {
  355         uint32_t                ns_length;
  356         uint64_t                ns_txfragcnt;
  357         uint64_t                ns_txmcastcnt;
  358         uint64_t                ns_failedcnt;
  359         uint64_t                ns_retrycnt;
  360         uint64_t                ns_multiretrycnt;
  361         uint64_t                ns_rtssuccesscnt;
  362         uint64_t                ns_rtsfailcnt;
  363         uint64_t                ns_ackfailcnt;
  364         uint64_t                ns_dupeframecnt;
  365         uint64_t                ns_rxfragcnt;
  366         uint64_t                ns_rxmcastcnt;
  367         uint64_t                ns_fcserrcnt;
  368 };
  369 
  370 typedef struct ndis_80211_stats ndis_80211_stats;
  371 
  372 typedef uint32_t ndis_80211_key_idx;
  373 
  374 struct ndis_80211_wep {
  375         uint32_t                nw_length;
  376         uint32_t                nw_keyidx;
  377         uint32_t                nw_keylen;
  378         uint8_t                 nw_keydata[256];
  379 };
  380 
  381 typedef struct ndis_80211_wep ndis_80211_wep;
  382 
  383 #define NDIS_80211_WEPKEY_TX            0x80000000
  384 #define NDIS_80211_WEPKEY_PERCLIENT     0x40000000
  385 
  386 #define NDIS_80211_NET_INFRA_IBSS       0x00000000
  387 #define NDIS_80211_NET_INFRA_BSS        0x00000001
  388 #define NDIS_80211_NET_INFRA_AUTO       0x00000002
  389 
  390 #define NDIS_80211_AUTHMODE_OPEN        0x00000000
  391 #define NDIS_80211_AUTHMODE_SHARED      0x00000001
  392 #define NDIS_80211_AUTHMODE_AUTO        0x00000002
  393 #define NDIS_80211_AUTHMODE_WPA         0x00000003
  394 #define NDIS_80211_AUTHMODE_WPAPSK      0x00000004
  395 #define NDIS_80211_AUTHMODE_WPANONE     0x00000005
  396 
  397 typedef uint8_t ndis_80211_rates[8];
  398 typedef uint8_t ndis_80211_rates_ex[16];
  399 typedef uint8_t ndis_80211_macaddr[6];
  400 
  401 struct ndis_80211_ssid {
  402         uint32_t                ns_ssidlen;
  403         uint8_t                 ns_ssid[32];
  404 };
  405 
  406 typedef struct ndis_80211_ssid ndis_80211_ssid;
  407 
  408 struct ndis_wlan_bssid {
  409         uint32_t                nwb_length;
  410         ndis_80211_macaddr      nwb_macaddr;
  411         uint8_t                 nwb_rsvd[2];
  412         ndis_80211_ssid         nwb_ssid;
  413         uint32_t                nwb_privacy;
  414         ndis_80211_rssi         nwb_rssi;
  415         uint32_t                nwb_nettype;
  416         ndis_80211_config       nwb_config;
  417         uint32_t                nwb_netinfra;
  418         ndis_80211_rates        nwb_supportedrates;
  419 };
  420 
  421 typedef struct ndis_wlan_bssid ndis_wlan_bssid;
  422 
  423 struct ndis_80211_bssid_list {
  424         uint32_t                nbl_items;
  425         ndis_wlan_bssid         nbl_bssid[1];
  426 };
  427 
  428 typedef struct ndis_80211_bssid_list ndis_80211_bssid_list;
  429 
  430 struct ndis_wlan_bssid_ex {
  431         uint32_t                nwbx_len;
  432         ndis_80211_macaddr      nwbx_macaddr;
  433         uint8_t                 nwbx_rsvd[2];
  434         ndis_80211_ssid         nwbx_ssid;
  435         uint32_t                nwbx_privacy;
  436         ndis_80211_rssi         nwbx_rssi;
  437         uint32_t                nwbx_nettype;
  438         ndis_80211_config       nwbx_config;
  439         uint32_t                nwbx_netinfra;
  440         ndis_80211_rates_ex     nwbx_supportedrates;
  441         uint32_t                nwbx_ielen;
  442         uint32_t                nwbx_ies[1];
  443 };
  444 
  445 typedef struct ndis_wlan_bssid_ex ndis_wlan_bssid_ex;
  446 
  447 struct ndis_80211_bssid_list_ex {
  448         uint32_t                nblx_items;
  449         ndis_wlan_bssid_ex      nblx_bssid[1];
  450 };
  451 
  452 typedef struct ndis_80211_bssid_list_ex ndis_80211_bssid_list_ex;
  453 
  454 struct ndis_80211_fixed_ies {
  455         uint8_t                 nfi_tstamp[8];
  456         uint16_t                nfi_beaconint;
  457         uint16_t                nfi_caps;
  458 };
  459 
  460 struct ndis_80211_variable_ies {
  461         uint8_t                 nvi_elemid;
  462         uint8_t                 nvi_len;
  463         uint8_t                 nvi_data[1];
  464 };
  465 
  466 typedef uint32_t ndis_80211_fragthresh;
  467 typedef uint32_t ndis_80211_rtsthresh;
  468 typedef uint32_t ndis_80211_antenna;
  469 
  470 #define NDIS_80211_PRIVFILT_ACCEPTALL   0x00000000
  471 #define NDIS_80211_PRIVFILT_8021XWEP    0x00000001
  472 
  473 #define NDIS_80211_WEPSTAT_ENABLED      0x00000000
  474 #define NDIS_80211_WEPSTAT_ENC1ENABLED  NDIS_80211_WEPSTAT_ENABLED
  475 #define NDIS_80211_WEPSTAT_DISABLED     0x00000001
  476 #define NDIS_80211_WEPSTAT_ENCDISABLED  NDIS_80211_WEPSTAT_DISABLED
  477 #define NDIS_80211_WEPSTAT_KEYABSENT    0x00000002
  478 #define NDIS_80211_WEPSTAT_ENC1KEYABSENT        NDIS_80211_WEPSTAT_KEYABSENT
  479 #define NDIS_80211_WEPSTAT_NOTSUPPORTED 0x00000003
  480 #define NDIS_80211_WEPSTAT_ENCNOTSUPPORTED      NDIS_80211_WEPSTAT_NOTSUPPORTED
  481 #define NDIS_80211_WEPSTAT_ENC2ENABLED  0x00000004
  482 #define NDIS_80211_WEPSTAT_ENC2KEYABSENT        0x00000005
  483 #define NDIS_80211_WEPSTAT_ENC3ENABLED  0x00000006
  484 #define NDIS_80211_WEPSTAT_ENC3KEYABSENT        0x00000007
  485 
  486 #define NDIS_80211_RELOADDEFAULT_WEP    0x00000000
  487 
  488 #define NDIS_80211_STATUSTYPE_AUTH      0x00000000
  489 
  490 struct ndis_80211_status_indication {
  491         uint32_t                nsi_type;
  492 };
  493 
  494 typedef struct ndis_80211_status_indication ndis_80211_status_indication;
  495 
  496 struct ndis_80211_auth_request {
  497         uint32_t                nar_len;
  498         ndis_80211_macaddr      nar_bssid;
  499         uint32_t                nar_flags;
  500 };
  501 
  502 typedef struct ndis_80211_auth_request ndis_80211_auth_request;
  503 
  504 struct ndis_80211_key {
  505         uint32_t                nk_len;
  506         uint32_t                nk_keyidx;
  507         uint32_t                nk_keylen;
  508         ndis_80211_macaddr      nk_bssid;
  509         uint64_t                nk_keyrsc;
  510         uint8_t                 nk_keydata[256];
  511 };
  512 
  513 typedef struct ndis_80211_key ndis_80211_key;
  514 
  515 struct ndis_80211_remove_key {
  516         uint32_t                nk_len;
  517         uint32_t                nk_keyidx;
  518         ndis_80211_macaddr      nk_bssid;
  519 };
  520 
  521 typedef struct ndis_80211_remove_key ndis_80211_remove_key;
  522 
  523 #define NDIS_80211_AI_REQFI_CAPABILITIES        0x00000001
  524 #define NDIS_80211_AI_REQFI_LISTENINTERVAL      0x00000002
  525 #define NDIS_80211_AI_REQFI_CURRENTAPADDRESS    0x00000004
  526 
  527 #define NDIS_80211_AI_RESFI_CAPABILITIES        0x00000001
  528 #define NDIS_80211_AI_RESFI_STATUSCODE          0x00000002
  529 #define NDIS_80211_AI_RESFI_ASSOCIATIONID       0x00000004
  530 
  531 struct ndis_80211_ai_reqfi {
  532         uint16_t                naq_caps;
  533         uint16_t                naq_listentint;
  534         ndis_80211_macaddr      naq_currentapaddr;
  535 };
  536 
  537 typedef struct ndis_80211_ai_reqfi ndis_80211_ai_reqfi;
  538 
  539 struct ndis_80211_ai_resfi {
  540         uint16_t                nas_caps;
  541         uint16_t                nas_statuscode;
  542         uint16_t                nas_associd;
  543 };
  544 
  545 typedef struct ndis_80211_ai_resfi ndis_80211_ai_resfi;
  546 
  547 struct ndis_80211_assoc_info {
  548         uint32_t                nai_len;
  549         uint16_t                nai_avail_req_fixed_ies;
  550         ndis_80211_ai_reqfi     nai_req_fixed_ies;
  551         uint32_t                nai_req_ielen;
  552         uint32_t                nai_offset_req_ies;
  553         uint16_t                nai_avail_resp_fixed_ies;
  554         ndis_80211_ai_resfi     nai_resp_fixed_iex;
  555         uint32_t                nai_resp_ielen;
  556         uint32_t                nai_offset_resp_ies;
  557 };
  558 
  559 typedef struct ndis_80211_assoc_info ndis_80211_assoc_info;
  560 
  561 struct ndis_80211_auth_event {
  562         ndis_80211_status_indication    nae_status;
  563         ndis_80211_auth_request         nae_request[1];
  564 };
  565 
  566 typedef struct ndis_80211_auth_event ndis_80211_auth_event;
  567 
  568 struct ndis_80211_test {
  569         uint32_t                nt_len;
  570         uint32_t                nt_type;
  571         union {
  572                 ndis_80211_auth_event   nt_authevent;
  573                 uint32_t                nt_rssitrigger;
  574         } u;
  575 };
  576 
  577 typedef struct ndis_80211_test ndis_80211_test;
  578 
  579 /* TCP OIDs. */
  580 
  581 #define OID_TCP_TASK_OFFLOAD                    0xFC010201
  582 #define OID_TCP_TASK_IPSEC_ADD_SA               0xFC010202
  583 #define OID_TCP_TASK_IPSEC_DELETE_SA            0xFC010203
  584 #define OID_TCP_SAN_SUPPORT                     0xFC010204
  585 
  586 
  587 #define NDIS_TASK_OFFLOAD_VERSION 1
  588 
  589 #define NDIS_TASK_TCPIP_CSUM                    0x00000000
  590 #define NDIS_TASK_IPSEC                         0x00000001
  591 #define NDIS_TASK_TCP_LARGESEND                 0x00000002
  592 
  593 #define NDIS_ENCAP_UNSPEC                       0x00000000
  594 #define NDIS_ENCAP_NULL                         0x00000001
  595 #define NDIS_ENCAP_IEEE802_3                    0x00000002
  596 #define NDIS_ENCAP_IEEE802_5                    0x00000003
  597 #define NDIS_ENCAP_SNAP_ROUTED                  0x00000004
  598 #define NDIS_ENCAP_SNAP_BRIDGED                 0x00000005
  599 
  600 #define NDIS_ENCAPFLAG_FIXEDHDRLEN              0x00000001
  601 
  602 struct ndis_encap_fmt {
  603         uint32_t                nef_encap;
  604         uint32_t                nef_flags;
  605         uint32_t                nef_encaphdrlen;
  606 };
  607 
  608 typedef struct ndis_encap_fmt ndis_encap_fmt;
  609 
  610 struct ndis_task_offload_hdr {
  611         uint32_t                ntoh_vers;
  612         uint32_t                ntoh_len;
  613         uint32_t                ntoh_rsvd;
  614         uint32_t                ntoh_offset_firsttask;
  615         ndis_encap_fmt          ntoh_encapfmt;
  616 };
  617 
  618 typedef struct ndis_task_offload_hdr ndis_task_offload_hdr;
  619 
  620 struct ndis_task_offload {
  621         uint32_t                nto_vers;
  622         uint32_t                nto_len;
  623         uint32_t                nto_task;
  624         uint32_t                nto_offset_nexttask;
  625         uint32_t                nto_taskbuflen;
  626         uint8_t                 nto_taskbuf[1];
  627 };
  628 
  629 typedef struct ndis_task_offload ndis_task_offload;
  630 
  631 #define NDIS_TCPSUM_FLAGS_IP_OPTS       0x00000001
  632 #define NDIS_TCPSUM_FLAGS_TCP_OPTS      0x00000002
  633 #define NDIS_TCPSUM_FLAGS_TCP_CSUM      0x00000004
  634 #define NDIS_TCPSUM_FLAGS_UDP_CSUM      0x00000008
  635 #define NDIS_TCPSUM_FLAGS_IP_CSUM       0x00000010
  636 
  637 struct ndis_task_tcpip_csum {
  638         uint32_t                nttc_v4tx;
  639         uint32_t                nttc_v4rx;
  640         uint32_t                nttc_v6tx;
  641         uint32_t                nttc_v6rx;
  642 };
  643 
  644 typedef struct ndis_task_tcpip_csum ndis_task_tcpip_csum;
  645 
  646 struct ndis_task_tcp_largesend {
  647         uint32_t                nttl_vers;
  648         uint32_t                nttl_maxofflen;
  649         uint32_t                nttl_minsegcnt;
  650         uint8_t                 nttl_tcpopt;
  651         uint8_t                 nttl_ipopt;
  652 };
  653 
  654 typedef struct ndis_task_tcp_largesend ndis_task_tcp_largesend;
  655 
  656 #define NDIS_IPSEC_AH_MD5               0x00000001
  657 #define NDIS_IPSEC_AH_SHA1              0x00000002
  658 #define NDIS_IPSEC_AH_TRANSPORT         0x00000004
  659 #define NDIS_IPSEC_AH_TUNNEL            0x00000008
  660 #define NDIS_IPSEC_AH_SEND              0x00000010
  661 #define NDIS_IPSEC_AH_RECEIVE           0x00000020
  662 
  663 #define NDIS_IPSEC_ESP_DES              0x00000001
  664 #define NDIS_IPSEC_ESP_RSVD             0x00000002
  665 #define NDIS_IPSEC_ESP_3DES             0x00000004
  666 #define NDIS_IPSEC_ESP_NULL             0x00000008
  667 #define NDIS_IPSEC_ESP_TRANSPORT        0x00000010
  668 #define NDIS_IPSEC_ESP_TUNNEL           0x00000020
  669 #define NDIS_IPSEC_ESP_SEND             0x00000040
  670 #define NDIS_IPSEC_ESP_RECEIVE          0x00000080
  671 
  672 struct ndis_task_ipsec {
  673         uint32_t                nti_ah_esp_combined;
  674         uint32_t                nti_ah_transport_tunnel_combined;
  675         uint32_t                nti_v4_options;
  676         uint32_t                nti_rsvd;
  677         uint32_t                nti_v4ah;
  678         uint32_t                nti_v4esp;
  679 };
  680 
  681 typedef struct ndis_task_ipsec ndis_task_ipsec;
  682 
  683 /*
  684  * Attribures of NDIS drivers. Not all drivers support
  685  * all attributes.
  686  */
  687 
  688 #define NDIS_ATTRIBUTE_IGNORE_REQUEST_TIMEOUT           0x00000002
  689 #define NDIS_ATTRIBUTE_IGNORE_TOKEN_RING_ERRORS         0x00000004
  690 #define NDIS_ATTRIBUTE_BUS_MASTER                       0x00000008
  691 #define NDIS_ATTRIBUTE_INTERMEDIATE_DRIVER              0x00000010
  692 #define NDIS_ATTRIBUTE_DESERIALIZE                      0x00000020
  693 #define NDIS_ATTRIBUTE_NO_HALT_ON_SUSPEND               0x00000040
  694 #define NDIS_ATTRIBUTE_SURPRISE_REMOVE_OK               0x00000080
  695 #define NDIS_ATTRIBUTE_NOT_CO_NDIS                      0x00000100
  696 #define NDIS_ATTRIBUTE_USES_SAFE_BUFFER_APIS            0x00000200
  697 
  698 #define NDIS_SERIALIZED(block)          \
  699         (((block)->nmb_flags & NDIS_ATTRIBUTE_DESERIALIZE) == 0)
  700 
  701 enum ndis_media_state {
  702         nmc_connected,
  703         nmc_disconnected
  704 };
  705 
  706 typedef enum ndis_media_state ndis_media_state;
  707 
  708 /* Ndis Packet Filter Bits (OID_GEN_CURRENT_PACKET_FILTER). */
  709 
  710 #define NDIS_PACKET_TYPE_DIRECTED               0x00000001
  711 #define NDIS_PACKET_TYPE_MULTICAST              0x00000002
  712 #define NDIS_PACKET_TYPE_ALL_MULTICAST          0x00000004
  713 #define NDIS_PACKET_TYPE_BROADCAST              0x00000008
  714 #define NDIS_PACKET_TYPE_SOURCE_ROUTING         0x00000010
  715 #define NDIS_PACKET_TYPE_PROMISCUOUS            0x00000020
  716 #define NDIS_PACKET_TYPE_SMT                    0x00000040
  717 #define NDIS_PACKET_TYPE_ALL_LOCAL              0x00000080
  718 #define NDIS_PACKET_TYPE_GROUP                  0x00001000
  719 #define NDIS_PACKET_TYPE_ALL_FUNCTIONAL         0x00002000
  720 #define NDIS_PACKET_TYPE_FUNCTIONAL             0x00004000
  721 #define NDIS_PACKET_TYPE_MAC_FRAME              0x00008000
  722 
  723 
  724 /* Ndis MAC option bits (OID_GEN_MAC_OPTIONS). */
  725 
  726 #define NDIS_MAC_OPTION_COPY_LOOKAHEAD_DATA             0x00000001
  727 #define NDIS_MAC_OPTION_RECEIVE_SERIALIZED              0x00000002
  728 #define NDIS_MAC_OPTION_TRANSFERS_NOT_PEND              0x00000004
  729 #define NDIS_MAC_OPTION_NO_LOOPBACK                     0x00000008
  730 #define NDIS_MAC_OPTION_FULL_DUPLEX                     0x00000010
  731 #define NDIS_MAC_OPTION_EOTX_INDICATION                 0x00000020
  732 #define NDIS_MAC_OPTION_8021P_PRIORITY                  0x00000040
  733 #define NDIS_MAC_OPTION_SUPPORTS_MAC_ADDRESS_OVERWRITE  0x00000080
  734 #define NDIS_MAC_OPTION_RECEIVE_AT_DPC                  0x00000100
  735 #define NDIS_MAC_OPTION_8021Q_VLAN                      0x00000200
  736 #define NDIS_MAC_OPTION_RESERVED                        0x80000000
  737 
  738 #define NDIS_DMA_24BITS         0x00
  739 #define NDIS_DMA_32BITS         0x01
  740 #define NDIS_DMA_64BITS         0x02
  741 
  742 /*
  743 struct ndis_physaddr {
  744 #ifdef __i386__
  745         uint64_t                np_quad;
  746 #endif
  747 #ifdef __amd64__
  748         uint32_t                np_low;
  749         uint32_t                np_high;
  750 #define np_quad np_low
  751 #endif
  752 #ifdef notdef
  753         uint32_t                np_low;
  754         uint32_t                np_high;
  755 #endif
  756 };
  757 */
  758 
  759 typedef struct physaddr ndis_physaddr;
  760 
  761 struct ndis_ansi_string {
  762         uint16_t                nas_len;
  763         uint16_t                nas_maxlen;
  764         char                    *nas_buf;
  765 };
  766 
  767 typedef struct ndis_ansi_string ndis_ansi_string;
  768 
  769 #ifdef notdef
  770 /*
  771  * nus_buf is really a wchar_t *, but it's inconvenient to include
  772  * all the necessary header goop needed to define it, and it's a
  773  * pointer anyway, so for now, just make it a uint16_t *.
  774  */
  775 struct ndis_unicode_string {
  776         uint16_t                nus_len;
  777         uint16_t                nus_maxlen;
  778         uint16_t                *nus_buf;
  779 };
  780 typedef struct ndis_unicode_string ndis_unicode_string;
  781 #endif
  782 
  783 typedef unicode_string ndis_unicode_string;
  784 
  785 enum ndis_parm_type {
  786         ndis_parm_int,
  787         ndis_parm_hexint,
  788         ndis_parm_string,
  789         ndis_parm_multistring,
  790         ndis_parm_binary
  791 };
  792 
  793 typedef enum ndis_parm_type ndis_parm_type;
  794 
  795 struct ndis_binary_data {
  796         uint16_t                nbd_len;
  797         void                    *nbd_buf;
  798 };
  799 
  800 typedef struct ndis_binary_data ndis_binary_data;
  801 
  802 struct ndis_config_parm {
  803         ndis_parm_type          ncp_type;
  804         union {
  805                 uint32_t                ncp_intdata;
  806                 ndis_unicode_string     ncp_stringdata;
  807                 ndis_binary_data        ncp_binarydata;
  808         } ncp_parmdata;
  809 };
  810 
  811 typedef struct ndis_config_parm ndis_config_parm;
  812 
  813 #ifdef notdef
  814 struct ndis_list_entry {
  815         struct ndis_list_entry *nle_flink;
  816         struct ndis_list_entry *nle_blink;
  817 };
  818 
  819 typedef struct ndis_list_entry ndis_list_entry;
  820 #endif
  821 
  822 struct ndis_bind_paths {
  823         uint32_t                nbp_number;
  824         ndis_unicode_string     nbp_paths[1];
  825 };
  826 
  827 typedef struct ndis_bind_paths ndis_bind_paths;
  828 
  829 #ifdef notdef
  830 struct dispatch_header {
  831         uint8_t                 dh_type;
  832         uint8_t                 dh_abs;
  833         uint8_t                 dh_size;
  834         uint8_t                 dh_inserted;
  835         uint32_t                dh_sigstate;
  836         list_entry              dh_waitlisthead;
  837 };
  838 #endif
  839 
  840 #define dispatch_header nt_dispatch_header
  841 
  842 struct ndis_ktimer {
  843         struct dispatch_header  nk_header;
  844         uint64_t                nk_duetime;
  845         list_entry              nk_timerlistentry;
  846         void                    *nk_dpc;
  847         uint32_t                nk_period;
  848 };
  849 
  850 struct ndis_kevent {
  851         struct dispatch_header  nk_header;
  852 };
  853 
  854 struct ndis_event {
  855         struct nt_kevent        ne_event;
  856 };
  857 
  858 typedef struct ndis_event ndis_event;
  859 
  860 /* Kernel defered procedure call (i.e. timer callback) */
  861 
  862 struct ndis_kdpc;
  863 typedef void (*ndis_kdpc_func)(struct ndis_kdpc *, void *, void *, void *);
  864 
  865 struct ndis_kdpc {
  866         uint16_t                nk_type;
  867         uint8_t                 nk_num;
  868         uint8_t                 nk_importance;
  869         list_entry              nk_dpclistentry;
  870         ndis_kdpc_func          nk_deferedfunc;
  871         void                    *nk_deferredctx;
  872         void                    *nk_sysarg1;
  873         void                    *nk_sysarg2;
  874         uint32_t                *nk_lock;
  875 };
  876 
  877 struct ndis_timer {
  878         struct ktimer           nt_ktimer;
  879         struct kdpc             nt_kdpc;
  880 };
  881 
  882 typedef struct ndis_timer ndis_timer;
  883 
  884 typedef __stdcall void (*ndis_timer_function)(void *, void *, void *, void *);
  885 
  886 struct ndis_miniport_timer {
  887         struct ktimer           nmt_ktimer;
  888         struct kdpc             nmt_kdpc;
  889         ndis_timer_function     nmt_timerfunc;
  890         void                    *nmt_timerctx;
  891         ndis_miniport_block     *nmt_block;
  892         struct ndis_miniport_timer      *nmt_nexttimer;
  893 };
  894 
  895 typedef struct ndis_miniport_timer ndis_miniport_timer;
  896 
  897 struct ndis_spin_lock {
  898         ndis_kspin_lock         nsl_spinlock;
  899         ndis_kirql              nsl_kirql;
  900 };
  901 
  902 typedef struct ndis_spin_lock ndis_spin_lock;
  903 
  904 struct ndis_request {
  905         uint8_t                 nr_macreserved[4*sizeof(void *)];
  906         uint32_t                nr_requesttype;
  907         union _ndis_data {
  908                 struct _ndis_query_information {
  909                         ndis_oid        nr_oid;
  910                         void            *nr_infobuf;
  911                         uint32_t        nr_infobuflen;
  912                         uint32_t        nr_byteswritten;
  913                         uint32_t        nr_bytesneeded;
  914                 } ndis_query_information;
  915                 struct _ndis_set_information {
  916                         ndis_oid        nr_oid;
  917                         void            *nr_infobuf;
  918                         uint32_t        nr_infobuflen;
  919                         uint32_t        nr_byteswritten;
  920                         uint32_t        nr_bytesneeded;
  921                 } ndis_set_information;
  922         } ndis_data;
  923         /* NDIS 5.0 extentions */
  924         uint8_t                 nr_ndis_rsvd[9 * sizeof(void *)];
  925         union {
  926                 uint8_t         nr_callmgr_rsvd[2 * sizeof(void *)];
  927                 uint8_t         nr_protocol_rsvd[2 * sizeof(void *)];
  928         } u;
  929         uint8_t                 nr_miniport_rsvd[2 * sizeof(void *)];
  930 };
  931 
  932 typedef struct ndis_request ndis_request;
  933 
  934 /*
  935  * Filler, not used.
  936  */
  937 struct ndis_miniport_interrupt {
  938         void                    *ni_introbj;
  939         ndis_kspin_lock         ni_dpccountlock;
  940         void                    *ni_rsvd;
  941         void                    *ni_isrfunc;
  942         void                    *ni_dpcfunc;
  943         struct ndis_kdpc        ni_dpc;
  944         ndis_miniport_block     *ni_block;
  945         uint8_t                 ni_dpccnt;
  946         uint8_t                 ni_filler1;
  947         struct ndis_kevent      ni_dpcsdoneevent;
  948         uint8_t                 ni_shared;
  949         uint8_t                 ni_isrreq;
  950 };
  951 
  952 typedef struct ndis_miniport_interrupt ndis_miniport_interrupt;
  953 
  954 enum ndis_interrupt_mode {
  955         nim_level,
  956         nim_latched
  957 };
  958 
  959 typedef enum ndis_interrupt_mode ndis_interrupt_mode;
  960 
  961 struct ndis_work_item;
  962 
  963 typedef void (*ndis_proc)(struct ndis_work_item *, void *);
  964 
  965 struct ndis_work_item {
  966         void                    *nwi_ctx;
  967         void                    *nwi_func;
  968         uint8_t                 nwi_wraprsvd[sizeof(void *) * 8];
  969 };
  970 
  971 typedef struct ndis_work_item ndis_work_item;
  972 
  973 #ifdef notdef
  974 struct ndis_buffer {
  975         struct ndis_buffer      *nb_next;
  976         uint16_t                nb_size;
  977         uint16_t                nb_flags;
  978         void                    *nb_process;
  979         void                    *nb_mappedsystemva;
  980         void                    *nb_startva;
  981         uint32_t                nb_bytecount;
  982         uint32_t                nb_byteoffset;
  983 };
  984 
  985 typedef struct ndis_buffer ndis_buffer;
  986 #endif
  987 
  988 struct ndis_sc_element {
  989         ndis_physaddr           nse_addr;
  990         uint32_t                nse_len;
  991         uint32_t                *nse_rsvd;
  992 };
  993 
  994 typedef struct ndis_sc_element ndis_sc_element;
  995 
  996 #define NDIS_MAXSEG             32
  997 #define NDIS_BUS_SPACE_SHARED_MAXADDR   0x3E7FFFFF
  998 
  999 struct ndis_sc_list {
 1000         uint32_t                nsl_frags;
 1001         uint32_t                *nsl_rsvd;
 1002         ndis_sc_element         nsl_elements[NDIS_MAXSEG];
 1003 };
 1004 
 1005 typedef struct ndis_sc_list ndis_sc_list;
 1006 
 1007 struct ndis_tcpip_csum {
 1008         union {
 1009                 uint32_t                ntc_txflags;
 1010                 uint32_t                ntc_rxflags;
 1011                 uint32_t                ntc_val;
 1012         } u;
 1013 };
 1014 
 1015 typedef struct ndis_tcpip_csum ndis_tcpip_csum;
 1016 
 1017 #define NDIS_TXCSUM_DO_IPV4             0x00000001
 1018 #define NDIS_TXCSUM_DO_IPV6             0x00000002
 1019 #define NDIS_TXCSUM_DO_TCP              0x00000004
 1020 #define NDIS_TXCSUM_DO_UDP              0x00000008
 1021 #define NDIS_TXCSUM_DO_IP               0x00000010
 1022 
 1023 #define NDIS_RXCSUM_TCP_FAILED          0x00000001
 1024 #define NDIS_RXCSUM_UDP_FAILED          0x00000002
 1025 #define NDIS_RXCSUM_IP_FAILED           0x00000004
 1026 #define NDIS_RXCSUM_TCP_PASSED          0x00000008
 1027 #define NDIS_RXCSUM_UDP_PASSED          0x00000010
 1028 #define NDIS_RXCSUM_IP_PASSED           0x00000020
 1029 #define NDIS_RXCSUM_LOOPBACK            0x00000040
 1030 
 1031 struct ndis_vlan {
 1032         union {
 1033                 struct {
 1034                         uint32_t                        nvt_userprio:3;
 1035                         uint32_t                        nvt_canformatid:1;
 1036                         uint32_t                        nvt_vlanid:12;
 1037                         uint32_t                        nvt_rsvd:16;
 1038                 } nv_taghdr;
 1039         } u;
 1040 };
 1041 
 1042 typedef struct ndis_vlan ndis_vlan;
 1043 
 1044 enum ndis_perpkt_info {
 1045         ndis_tcpipcsum_info,
 1046         ndis_ipsec_info,
 1047         ndis_largesend_info,
 1048         ndis_classhandle_info,
 1049         ndis_rsvd,
 1050         ndis_sclist_info,
 1051         ndis_ieee8021q_info,
 1052         ndis_originalpkt_info,
 1053         ndis_packetcancelid,
 1054         ndis_maxpkt_info
 1055 };
 1056 
 1057 typedef enum ndis_perpkt_info ndis_perpkt_info;
 1058 
 1059 struct ndis_packet_extension {
 1060         void                    *npe_info[ndis_maxpkt_info];
 1061 };
 1062 
 1063 typedef struct ndis_packet_extension ndis_packet_extension;
 1064 
 1065 struct ndis_packet_private {
 1066         uint32_t                npp_physcnt;
 1067         uint32_t                npp_totlen;
 1068         ndis_buffer             *npp_head;
 1069         ndis_buffer             *npp_tail;
 1070 
 1071         void                    *npp_pool;
 1072         uint32_t                npp_count;
 1073         uint32_t                npp_flags;
 1074         uint8_t                 npp_validcounts;
 1075         uint8_t                 npp_ndispktflags;
 1076         uint16_t                npp_packetooboffset;
 1077 };
 1078 
 1079 #define NDIS_FLAGS_PROTOCOL_ID_MASK             0x0000000F
 1080 #define NDIS_FLAGS_MULTICAST_PACKET             0x00000010
 1081 #define NDIS_FLAGS_RESERVED2                    0x00000020
 1082 #define NDIS_FLAGS_RESERVED3                    0x00000040
 1083 #define NDIS_FLAGS_DONT_LOOPBACK                0x00000080
 1084 #define NDIS_FLAGS_IS_LOOPBACK_PACKET           0x00000100
 1085 #define NDIS_FLAGS_LOOPBACK_ONLY                0x00000200
 1086 #define NDIS_FLAGS_RESERVED4                    0x00000400
 1087 #define NDIS_FLAGS_DOUBLE_BUFFERED              0x00000800
 1088 #define NDIS_FLAGS_SENT_AT_DPC                  0x00001000
 1089 #define NDIS_FLAGS_USES_SG_BUFFER_LIST          0x00002000
 1090 
 1091 #define NDIS_PACKET_WRAPPER_RESERVED                    0x3F
 1092 #define NDIS_PACKET_CONTAINS_MEDIA_SPECIFIC_INFO        0x40
 1093 #define NDIS_PACKET_ALLOCATED_BY_NDIS                   0x80
 1094 
 1095 #define NDIS_PROTOCOL_ID_DEFAULT        0x00
 1096 #define NDIS_PROTOCOL_ID_TCP_IP         0x02
 1097 #define NDIS_PROTOCOL_ID_IPX            0x06
 1098 #define NDIS_PROTOCOL_ID_NBF            0x07
 1099 #define NDIS_PROTOCOL_ID_MAX            0x0F
 1100 #define NDIS_PROTOCOL_ID_MASK           0x0F
 1101 
 1102 typedef struct ndis_packet_private ndis_packet_private;
 1103 
 1104 enum ndis_classid {
 1105         ndis_class_802_3prio,
 1106         ndis_class_wirelesswan_mbx,
 1107         ndis_class_irda_packetinfo,
 1108         ndis_class_atm_aainfo
 1109 };
 1110 
 1111 typedef enum ndis_classid ndis_classid;
 1112 
 1113 struct ndis_mediaspecific_info {
 1114         uint32_t                nmi_nextentoffset;
 1115         ndis_classid            nmi_classid;
 1116         uint32_t                nmi_size;
 1117         uint8_t                 nmi_classinfo[1];
 1118 };
 1119 
 1120 typedef struct ndis_mediaspecific_info ndis_mediaspecific_info;
 1121 
 1122 struct ndis_packet_oob {
 1123         union {
 1124                 uint64_t                npo_timetotx;
 1125                 uint64_t                npo_timetxed;
 1126         } u;
 1127         uint64_t                        npo_timerxed;
 1128         uint32_t                        npo_hdrlen;
 1129         uint32_t                        npo_mediaspecific_len;
 1130         void                            *npo_mediaspecific;
 1131         ndis_status                     npo_status;
 1132 };
 1133 
 1134 typedef struct ndis_packet_oob ndis_packet_oob;
 1135 
 1136 struct ndis_packet {
 1137         ndis_packet_private     np_private;
 1138         union {
 1139                 /* For connectionless miniports. */
 1140                 struct {
 1141                         uint8_t         np_miniport_rsvd[2 * sizeof(void *)];
 1142                         uint8_t         np_wrapper_rsvd[2 * sizeof(void *)];
 1143                 } np_clrsvd;
 1144                 /* For de-serialized miniports */
 1145                 struct {
 1146                         uint8_t         np_miniport_rsvdex[3 * sizeof(void *)];
 1147                         uint8_t         np_wrapper_rsvdex[sizeof(void *)];
 1148                 } np_dsrsvd;
 1149                 struct {
 1150                         uint8_t         np_mac_rsvd[4 * sizeof(void *)];
 1151                 } np_macrsvd;
 1152         } u;
 1153         uint32_t                *np_rsvd[2];
 1154         uint8_t                 nm_protocolreserved[1];
 1155 
 1156         /*
 1157          * This next part is probably wrong, but we need some place
 1158          * to put the out of band data structure...
 1159          */
 1160         ndis_packet_oob         np_oob;
 1161         ndis_packet_extension   np_ext;
 1162         ndis_sc_list            np_sclist;
 1163 
 1164         /* BSD-specific stuff which should be invisible to drivers. */
 1165 
 1166         uint32_t                np_refcnt;
 1167         void                    *np_softc;
 1168         void                    *np_m0;
 1169         int                     np_txidx;
 1170         kspin_lock              np_lock;
 1171 };
 1172 
 1173 typedef struct ndis_packet ndis_packet;
 1174 
 1175 #define PROTOCOL_RESERVED_SIZE_IN_PACKET        (4 * sizeof(void *))
 1176 
 1177 /* mbuf ext type for NDIS */
 1178 #define EXT_NDIS                0x999
 1179 
 1180 /* mtx type for NDIS */
 1181 #define MTX_NDIS_LOCK "NDIS lock"
 1182 
 1183 struct ndis_filterdbs {
 1184         union {
 1185                 void                    *nf_ethdb;
 1186                 void                    *nf_nulldb;
 1187         } u;
 1188         void                    *nf_trdb;
 1189         void                    *nf_fddidb;
 1190         void                    *nf_arcdb;
 1191 };
 1192 
 1193 typedef struct ndis_filterdbs ndis_filterdbs;
 1194 
 1195 enum ndis_medium {
 1196     NdisMedium802_3,
 1197     NdisMedium802_5,
 1198     NdisMediumFddi,
 1199     NdisMediumWan,
 1200     NdisMediumLocalTalk,
 1201     NdisMediumDix,              /* defined for convenience, not a real medium */
 1202     NdisMediumArcnetRaw,
 1203     NdisMediumArcnet878_2,
 1204     NdisMediumAtm,
 1205     NdisMediumWirelessWan,
 1206     NdisMediumIrda,
 1207     NdisMediumBpc,
 1208     NdisMediumCoWan,
 1209     NdisMedium1394,
 1210     NdisMediumMax
 1211 };
 1212 
 1213 typedef enum ndis_medium ndis_medium;
 1214 /*
 1215 enum interface_type {
 1216         InterfaceTypeUndefined = -1,
 1217         Internal,
 1218         Isa,
 1219         Eisa,
 1220         MicroChannel,
 1221         TurboChannel,
 1222         PCIBus,
 1223         VMEBus,
 1224         NuBus,
 1225         PCMCIABus,
 1226         CBus,
 1227         MPIBus,
 1228         MPSABus,
 1229         ProcessorInternal,
 1230         InternalPowerBus,
 1231         PNPISABus,
 1232         PNPBus,
 1233         MaximumInterfaceType
 1234 };
 1235 */
 1236 enum ndis_interface_type {
 1237         NdisInterfaceInternal = Internal,
 1238         NdisInterfaceIsa = Isa,
 1239         NdisInterfaceEisa = Eisa,
 1240         NdisInterfaceMca = MicroChannel,
 1241         NdisInterfaceTurboChannel = TurboChannel,
 1242         NdisInterfacePci = PCIBus,
 1243         NdisInterfacePcMcia = PCMCIABus
 1244 };
 1245 
 1246 typedef enum ndis_interface_type ndis_interface_type;
 1247 
 1248 struct ndis_paddr_unit {
 1249         ndis_physaddr           npu_physaddr;
 1250         uint32_t                npu_len;
 1251 };
 1252 
 1253 typedef struct ndis_paddr_unit ndis_paddr_unit;
 1254 
 1255 struct ndis_map_arg {
 1256         ndis_paddr_unit         *nma_fraglist;
 1257         int                     nma_cnt;
 1258         int                     nma_max;
 1259 };
 1260 
 1261 /*
 1262  * Miniport characteristics were originally defined in the NDIS 3.0
 1263  * spec and then extended twice, in NDIS 4.0 and 5.0.
 1264  */
 1265 
 1266 struct ndis_miniport_characteristics {
 1267 
 1268         /* NDIS 3.0 */
 1269 
 1270         uint8_t                 nmc_version_major;
 1271         uint8_t                 nmc_version_minor;
 1272         uint16_t                nmc_pad;
 1273         uint32_t                nmc_rsvd;
 1274         void *                  nmc_checkhang_func;
 1275         void *                  nmc_disable_interrupts_func;
 1276         void *                  nmc_enable_interrupts_func;
 1277         void *                  nmc_halt_func;
 1278         void *                  nmc_interrupt_func;
 1279         void *                  nmc_init_func;
 1280         void *                  nmc_isr_func;
 1281         void *                  nmc_queryinfo_func;
 1282         void *                  nmc_reconfig_func;
 1283         void *                  nmc_reset_func;
 1284         void *                  nmc_sendsingle_func;
 1285         void *                  nmc_setinfo_func;
 1286         void *                  nmc_transferdata_func;
 1287 
 1288         /* NDIS 4.0 extentions */
 1289 
 1290         void *                  nmc_return_packet_func;
 1291         void *                  nmc_sendmulti_func;
 1292         void *                  nmc_allocate_complete_func;
 1293 
 1294         /* NDIS 5.0 extensions */
 1295 
 1296         void *                  nmc_cocreatevc_func;
 1297         void *                  nmc_codeletevc_func;
 1298         void *                  nmc_coactivatevc_func;
 1299         void *                  nmc_codeactivatevc_func;
 1300         void *                  nmc_comultisend_func;
 1301         void *                  nmc_corequest_func;
 1302 
 1303         /* NDIS 5.1 extentions */
 1304 
 1305         void *                  nmc_canceltxpkts_handler;
 1306         void *                  nmc_pnpevent_handler;
 1307         void *                  nmc_shutdown_handler;
 1308         void *                  nmc_rsvd0;
 1309         void *                  nmc_rsvd1;
 1310         void *                  nmc_rsvd2;
 1311         void *                  nmc_rsvd3;
 1312 };
 1313 
 1314 typedef struct ndis_miniport_characteristics ndis_miniport_characteristics;
 1315 
 1316 struct ndis_driver_object {
 1317         char                    *ndo_ifname;
 1318         void                    *ndo_softc;
 1319         ndis_miniport_characteristics ndo_chars;
 1320 };
 1321 
 1322 typedef struct ndis_driver_object ndis_driver_object;
 1323 
 1324 struct ndis_reference {
 1325         ndis_kspin_lock         nr_spinlock;
 1326         uint16_t                nr_refcnt;
 1327         uint8_t                 nr_closing;
 1328 };
 1329 
 1330 typedef struct ndis_reference ndis_reference;
 1331 
 1332 struct ndis_timer_entry {
 1333         struct callout          nte_ch;
 1334         ndis_miniport_timer     *nte_timer;
 1335         TAILQ_ENTRY(ndis_timer_entry)   link;
 1336 };
 1337 
 1338 TAILQ_HEAD(nte_head, ndis_timer_entry);
 1339 
 1340 #define NDIS_FH_TYPE_VFS        0
 1341 #define NDIS_FH_TYPE_MODULE     1
 1342 
 1343 struct ndis_fh {
 1344         int                     nf_type;
 1345         void                    *nf_vp;
 1346         void                    *nf_map;
 1347         uint32_t                nf_maplen; 
 1348 };
 1349 
 1350 typedef struct ndis_fh ndis_fh;
 1351 
 1352 /*
 1353  * The miniport block is basically the internal NDIS handle. We need
 1354  * to define this because, unfortunately, it is not entirely opaque
 1355  * to NDIS drivers. For one thing, it contains the function pointer
 1356  * to the NDIS packet receive handler, which is invoked out of the
 1357  * NDIS block via a macro rather than a function pointer. (The
 1358  * NdisMIndicateReceivePacket() routine is a macro rather than
 1359  * a function.) For another, the driver maintains a pointer to the
 1360  * miniport block and passes it as a handle to various NDIS functions.
 1361  * (The driver never really knows this because it's hidden behind
 1362  * an ndis_handle though.)
 1363  *
 1364  * The miniport block has two parts: the first part contains fields
 1365  * that must never change, since they are referenced by driver
 1366  * binaries through macros. The second part is ignored by the driver,
 1367  * but contains various things used internaly by NDIS.SYS. In our
 1368  * case, we define the first 'immutable' part exactly as it appears
 1369  * in Windows, but don't bother duplicating the Windows definitions
 1370  * for the second part. Instead, we replace them with a few BSD-specific
 1371  * things.
 1372  */
 1373 
 1374 struct ndis_miniport_block {
 1375         /*
 1376          * Windows-specific portion -- DO NOT MODIFY OR NDIS
 1377          * DRIVERS WILL NOT WORK.
 1378          */ 
 1379         void                    *nmb_signature; /* magic number */
 1380         ndis_miniport_block     *nmb_nextminiport;
 1381         ndis_mdriver_block      *nmb_driverhandle;
 1382         ndis_handle             nmb_miniportadapterctx;
 1383         ndis_unicode_string     nmb_name;
 1384         ndis_bind_paths         *nmb_bindpaths;
 1385         ndis_handle             nmb_openqueue;
 1386         ndis_reference          nmb_ref;
 1387         ndis_handle             nmb_devicectx;
 1388         uint8_t                 nmb_padding;
 1389         uint8_t                 nmb_lockacquired;
 1390         uint8_t                 nmb_pmodeopens;
 1391         uint8_t                 nmb_assignedcpu;
 1392         ndis_kspin_lock         nmb_lock;
 1393         ndis_request            *nmb_mediarequest;
 1394         ndis_miniport_interrupt *nmb_interrupt;
 1395         uint32_t                nmb_flags;
 1396         uint32_t                nmb_pnpflags;
 1397         list_entry              nmb_packetlist;
 1398         ndis_packet             *nmb_firstpendingtxpacket;
 1399         ndis_packet             *nmb_returnpacketqueue;
 1400         uint32_t                nmb_requestbuffer;
 1401         void                    *nmb_setmcastbuf;
 1402         ndis_miniport_block     *nmb_primaryminiport;
 1403         void                    *nmb_wrapperctx;
 1404         void                    *nmb_busdatactx;
 1405         uint32_t                nmb_pnpcaps;
 1406         cm_resource_list        *nmb_resources;
 1407         ndis_timer              nmb_wkupdpctimer;
 1408         ndis_unicode_string     nmb_basename;
 1409         ndis_unicode_string     nmb_symlinkname;
 1410         uint32_t                nmb_checkforhangsecs;
 1411         uint16_t                nmb_cfhticks;
 1412         uint16_t                nmb_cfhcurrticks;
 1413         ndis_status             nmb_resetstatus;
 1414         ndis_handle             nmb_resetopen;
 1415         ndis_filterdbs          nmb_filterdbs;
 1416         void                    *nmb_pktind_func;
 1417         void                    *nmb_senddone_func;
 1418         void                    *nmb_sendrsrc_func;
 1419         void                    *nmb_resetdone_func;
 1420         ndis_medium             nmb_medium;
 1421         uint32_t                nmb_busnum;
 1422         uint32_t                nmb_bustype;
 1423         uint32_t                nmb_adaptertype;
 1424         device_object           *nmb_deviceobj; /* Functional device */
 1425         device_object           *nmb_physdeviceobj; /* Physical device */
 1426         device_object           *nmb_nextdeviceobj; /* Next dev in stack */
 1427         void                    *nmb_mapreg;
 1428         void                    *nmb_callmgraflist;
 1429         void                    *nmb_miniportthread;
 1430         void                    *nmb_setinfobuf;
 1431         uint16_t                nmb_setinfobuflen;
 1432         uint16_t                nmb_maxsendpkts;
 1433         ndis_status             nmb_fakestatus;
 1434         void                    *nmb_lockhandler;
 1435         ndis_unicode_string     *nmb_adapterinstancename;
 1436         void                    *nmb_timerqueue;
 1437         uint32_t                nmb_mactoptions;
 1438         ndis_request            *nmb_pendingreq;
 1439         uint32_t                nmb_maxlongaddrs;
 1440         uint32_t                nmb_maxshortaddrs;
 1441         uint32_t                nmb_currlookahead;
 1442         uint32_t                nmb_maxlookahead;
 1443         void                    *nmb_interrupt_func;
 1444         void                    *nmb_disableintr_func;
 1445         void                    *nmb_enableintr_func;
 1446         void                    *nmb_sendpkts_func;
 1447         void                    *nmb_deferredsend_func;
 1448         void                    *nmb_ethrxindicate_func;
 1449         void                    *nmb_txrxindicate_func;
 1450         void                    *nmb_fddirxindicate_func;
 1451         void                    *nmb_ethrxdone_func;
 1452         void                    *nmb_txrxdone_func;
 1453         void                    *nmb_fddirxcond_func;
 1454         void                    *nmb_status_func;
 1455         void                    *nmb_statusdone_func;
 1456         void                    *nmb_tdcond_func;
 1457         void                    *nmb_querydone_func;
 1458         void                    *nmb_setdone_func;
 1459         void                    *nmb_wantxdone_func;
 1460         void                    *nmb_wanrx_func;
 1461         void                    *nmb_wanrxdone_func;
 1462         /*
 1463          * End of windows-specific portion of miniport block. Everything
 1464          * below is BSD-specific.
 1465          */
 1466         struct ifnet            *nmb_ifp;
 1467         uint8_t                 nmb_dummybuf[128];
 1468         device_object           nmb_devobj;
 1469         ndis_config_parm        nmb_replyparm;
 1470         int                     nmb_pciidx;
 1471         device_t                nmb_dev;
 1472         ndis_resource_list      *nmb_rlist;
 1473         ndis_status             nmb_getstat;
 1474         ndis_status             nmb_setstat;
 1475         vm_offset_t             nmb_img;
 1476         TAILQ_ENTRY(ndis_miniport_block)        link;
 1477 };
 1478 
 1479 TAILQ_HEAD(nd_head, ndis_miniport_block);
 1480 
 1481 typedef ndis_status (*ndis_init_handler)(ndis_status *, uint32_t *,
 1482                 ndis_medium *, uint32_t, ndis_handle, ndis_handle);
 1483 typedef ndis_status (*ndis_queryinfo_handler)(ndis_handle, ndis_oid,
 1484                 void *, uint32_t, uint32_t *, uint32_t *);
 1485 typedef ndis_status (*ndis_setinfo_handler)(ndis_handle, ndis_oid,
 1486                 void *, uint32_t, uint32_t *, uint32_t *);
 1487 typedef ndis_status (*ndis_sendsingle_handler)(ndis_handle,
 1488                 ndis_packet *, uint32_t);
 1489 typedef ndis_status (*ndis_sendmulti_handler)(ndis_handle,
 1490                 ndis_packet **, uint32_t);
 1491 typedef void (*ndis_isr_handler)(uint8_t *, uint8_t *, ndis_handle);
 1492 typedef void (*ndis_interrupt_handler)(ndis_handle);
 1493 typedef int (*ndis_reset_handler)(uint8_t *, ndis_handle);
 1494 typedef void (*ndis_halt_handler)(ndis_handle);
 1495 typedef void (*ndis_return_handler)(ndis_handle, ndis_packet *);
 1496 typedef void (*ndis_enable_interrupts_handler)(ndis_handle);
 1497 typedef void (*ndis_disable_interrupts_handler)(ndis_handle);
 1498 typedef void (*ndis_shutdown_handler)(void *);
 1499 typedef void (*ndis_allocdone_handler)(ndis_handle, void *,
 1500                 ndis_physaddr *, uint32_t, void *);
 1501 typedef uint8_t (*ndis_checkforhang_handler)(ndis_handle);
 1502 
 1503 typedef __stdcall ndis_status (*driver_entry)(void *, unicode_string *);
 1504 
 1505 extern image_patch_table ndis_functbl[];
 1506 
 1507 #define NDIS_TASKQUEUE  1
 1508 #define NDIS_SWI        2
 1509 
 1510 #define NDIS_PSTATE_RUNNING     1
 1511 #define NDIS_PSTATE_SLEEPING    2
 1512 
 1513 #define NdisQueryPacket(p, pbufcnt, bufcnt, firstbuf, plen)             \
 1514         do {                                                            \
 1515                 if ((firstbuf) != NULL) {                               \
 1516                         ndis_buffer             **_first;               \
 1517                         _first = firstbuf;                              \
 1518                         *(_first) = (p)->np_private.npp_head;           \
 1519                 }                                                       \
 1520                 if ((plen) || (bufcnt) || (pbufcnt)) {                  \
 1521                         if ((p)->np_private.npp_validcounts == FALSE) { \
 1522                                 ndis_buffer             *tmp;           \
 1523                                 unsigned int            tlen = 0, pcnt = 0; \
 1524                                 unsigned int            add = 0;        \
 1525                                 unsigned int            pktlen, off;    \
 1526                                                                         \
 1527                                 tmp = (p)->np_private.npp_head;         \
 1528                                 while (tmp != NULL) {                   \
 1529                                         off = MmGetMdlByteOffset(tmp);  \
 1530                                         pktlen = MmGetMdlByteCount(tmp);\
 1531                                         tlen += pktlen;                 \
 1532                                         pcnt +=                         \
 1533                                             NDIS_BUFFER_TO_SPAN_PAGES(tmp); \
 1534                                         add++;                          \
 1535                                         tmp = tmp->mdl_next;            \
 1536                                 }                                       \
 1537                                 (p)->np_private.npp_count = add;        \
 1538                                 (p)->np_private.npp_totlen = tlen;      \
 1539                                 (p)->np_private.npp_physcnt = pcnt;     \
 1540                                 (p)->np_private.npp_validcounts = TRUE; \
 1541                         }                                               \
 1542                         if (pbufcnt) {                                  \
 1543                                 unsigned int            *_pbufcnt;      \
 1544                                 _pbufcnt = (pbufcnt);                   \
 1545                                 *(_pbufcnt) = (p)->np_private.npp_physcnt; \
 1546                         }                                               \
 1547                         if (bufcnt) {                                   \
 1548                                 unsigned int            *_bufcnt;       \
 1549                                 _bufcnt = (bufcnt);                     \
 1550                                 *(_bufcnt) = (p)->np_private.npp_count; \
 1551                         }                                               \
 1552                         if (plen) {                                     \
 1553                                 unsigned int            *_plen;         \
 1554                                 _plen = (plen);                         \
 1555                                 *(_plen) = (p)->np_private.npp_totlen;  \
 1556                         }                                               \
 1557                 }                                                       \
 1558         } while (0)
 1559 
 1560 __BEGIN_DECLS
 1561 extern int ndis_libinit(void);
 1562 extern int ndis_libfini(void);
 1563 extern int ndis_ascii_to_unicode(const char *, uint16_t **);
 1564 extern int ndis_unicode_to_ascii(uint16_t *, int, char **);
 1565 extern int ndis_load_driver(vm_offset_t, void *);
 1566 extern int ndis_unload_driver(void *);
 1567 extern int ndis_mtop(struct mbuf *, ndis_packet **);
 1568 extern int ndis_ptom(struct mbuf **, ndis_packet *);
 1569 extern int ndis_get_info(void *, ndis_oid, void *, int *);
 1570 extern int ndis_set_info(void *, ndis_oid, void *, int *);
 1571 extern int ndis_get_supported_oids(void *, ndis_oid **, int *);
 1572 extern int ndis_send_packets(void *, ndis_packet **, int);
 1573 extern int ndis_send_packet(void *, ndis_packet *);
 1574 extern int ndis_convert_res(void *);
 1575 extern int ndis_alloc_amem(void *);
 1576 extern void ndis_free_amem(void *);
 1577 extern void ndis_free_packet(ndis_packet *);
 1578 extern void ndis_free_bufs(ndis_buffer *);
 1579 extern int ndis_reset_nic(void *);
 1580 extern int ndis_halt_nic(void *);
 1581 extern int ndis_shutdown_nic(void *);
 1582 extern int ndis_init_nic(void *);
 1583 extern int ndis_isr(void *, int *, int *);
 1584 #ifdef __FreeBSD__
 1585 extern void ndis_return_packet(void *, void *);
 1586 #else
 1587 extern void ndis_return_packet(struct mbuf *, caddr_t, size_t, void *);
 1588 #endif
 1589 extern void ndis_enable_intr(void *);
 1590 extern void ndis_disable_intr(void *);
 1591 extern int ndis_init_dma(void *);
 1592 extern int ndis_destroy_dma(void *);
 1593 extern int ndis_create_sysctls(void *);
 1594 extern int ndis_add_sysctl(void *, const char *, const char *, const char *, int);
 1595 extern int ndis_flush_sysctls(void *);
 1596 extern int ndis_sched(void (*)(void *), void *, int);
 1597 extern int ndis_unsched(void (*)(void *), void *, int);
 1598 #ifdef __FreeBSD__
 1599 extern int ndis_thsuspend(struct proc *, struct mtx *, int);
 1600 #else /* __NetBSD__ */
 1601 extern int ndis_thsuspend(struct proc *, struct simplelock *, int);
 1602 #endif
 1603 extern void ndis_thresume(struct proc *);
 1604 extern int ndis_strcasecmp(const char *, const char *);
 1605 extern int ndis_strncasecmp(const char *, const char *, size_t);
 1606 
 1607 __stdcall extern uint32_t NdisAddDevice(driver_object *, device_object *);
 1608 __stdcall extern void NdisAllocatePacketPool(ndis_status *,
 1609         ndis_handle *, uint32_t, uint32_t);
 1610 __stdcall extern void NdisAllocatePacketPoolEx(ndis_status *,
 1611         ndis_handle *, uint32_t, uint32_t, uint32_t);
 1612 __stdcall extern uint32_t NdisPacketPoolUsage(ndis_handle);
 1613 __stdcall extern void NdisFreePacketPool(ndis_handle);
 1614 __stdcall extern void NdisAllocatePacket(ndis_status *,
 1615         ndis_packet **, ndis_handle);
 1616 __stdcall extern void NdisFreePacket(ndis_packet *);
 1617 
 1618 __END_DECLS
 1619 
 1620 #endif /* _NDIS_VAR_H_ */

Cache object: 5013fd9442ad492f9261ffd0d75b140c


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.