"Fossies" - the Fresh Open Source Software Archive

Member "ndiswrapper-1.63/driver/ndiswrapper.h" (3 May 2020, 5978 Bytes) of package /linux/misc/ndiswrapper-1.63.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "ndiswrapper.h" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 1.62_vs_1.63.

    1 /*
    2  *  Copyright (C) 2003-2005 Pontus Fuchs, Giridhar Pemmasani
    3  *
    4  *  This program is free software; you can redistribute it and/or modify
    5  *  it under the terms of the GNU General Public License as published by
    6  *  the Free Software Foundation; either version 2 of the License, or
    7  *  (at your option) any later version.
    8  *
    9  *  This program is distributed in the hope that it will be useful,
   10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
   11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   12  *  GNU General Public License for more details.
   13  *
   14  */
   15 
   16 #ifndef _NDISWRAPPER_H_
   17 #define _NDISWRAPPER_H_
   18 
   19 #define DRIVER_VERSION "1.63"
   20 #define UTILS_VERSION "1.9"
   21 
   22 #define DRIVER_NAME "ndiswrapper"
   23 #define DRIVER_CONFIG_DIR "/etc/ndiswrapper"
   24 
   25 #define NDIS_ESSID_MAX_SIZE 32
   26 #define NDIS_ENCODING_TOKEN_MAX 32
   27 #define MAX_ENCR_KEYS 4
   28 #define TX_RING_SIZE 16
   29 #define NDIS_MAX_RATES 8
   30 #define NDIS_MAX_RATES_EX 16
   31 
   32 #define WRAP_PCI_BUS 5
   33 #define WRAP_PCMCIA_BUS 8
   34 /* some USB devices, e.g., DWL-G120 have BusType as 0 */
   35 #define WRAP_INTERNAL_BUS 0
   36 /* documentation at msdn says 15 is PNP bus, but inf files from all
   37  * vendors say 15 is USB; which is correct? */
   38 #define WRAP_USB_BUS 15
   39 
   40 /* NDIS device must be 0, for compatibility with old versions of
   41  * ndiswrapper where device type for NDIS drivers is 0 */
   42 #define WRAP_NDIS_DEVICE 0
   43 #define WRAP_USB_DEVICE 1
   44 #define WRAP_BLUETOOTH_DEVICE1 2
   45 #define WRAP_BLUETOOTH_DEVICE2 3
   46 
   47 #define WRAP_DEVICE_BUS(dev, bus) ((dev) << 8 | (bus))
   48 #define WRAP_BUS(dev_bus) ((dev_bus) & 0x000FF)
   49 #define WRAP_DEVICE(dev_bus) ((dev_bus) >> 8)
   50 
   51 #define MAX_DRIVER_NAME_LEN 32
   52 #define MAX_VERSION_STRING_LEN 64
   53 #define MAX_SETTING_NAME_LEN 128
   54 #define MAX_SETTING_VALUE_LEN 256
   55 
   56 #define MAX_DRIVER_PE_IMAGES 4
   57 #define MAX_DRIVER_BIN_FILES 5
   58 #define MAX_DEVICE_SETTINGS 512
   59 
   60 #define MAX_ALLOCATED_URBS 15
   61 
   62 #define DEV_ANY_ID -1
   63 
   64 #define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
   65 #define MACSTRSEP "%02x:%02x:%02x:%02x:%02x:%02x"
   66 #define MACSTR "%02x%02x%02x%02x%02x%02x"
   67 #define MACINTADR(a) (int*)&((a)[0]), (int*)&((a)[1]), (int*)&((a)[2]), \
   68         (int*)&((a)[3]), (int*)&((a)[4]), (int*)&((a)[5])
   69 
   70 #ifdef __KERNEL__
   71 /* DEBUG macros */
   72 
   73 #define MSG(level, fmt, ...)                \
   74     printk(level DRIVER_NAME " (%s:%d): " fmt "\n", \
   75            __func__, __LINE__ , ## __VA_ARGS__)
   76 
   77 #define WARNING(fmt, ...) MSG(KERN_WARNING, fmt, ## __VA_ARGS__)
   78 #define ERROR(fmt, ...) MSG(KERN_ERR, fmt , ## __VA_ARGS__)
   79 #define INFO(fmt, ...) MSG(KERN_INFO, fmt , ## __VA_ARGS__)
   80 #define TODO() WARNING("not fully implemented (yet)")
   81 
   82 #define TRACE(level, fmt, ...)                      \
   83 do {                                    \
   84     if (debug >= level)                     \
   85         printk(KERN_INFO "%s (%s:%d): " fmt "\n", DRIVER_NAME,  \
   86                __func__, __LINE__ , ## __VA_ARGS__);        \
   87 } while (0)
   88 #define TRACE0(fmt, ...) TRACE(0, fmt , ## __VA_ARGS__)
   89 
   90 extern int debug;
   91 
   92 #ifndef DEBUG
   93 #define DEBUG 0
   94 #endif
   95 
   96 /* for a block of code */
   97 #if DEBUG >= 1
   98 #define DBG_BLOCK(level) if (debug >= level)
   99 #else
  100 #define DBG_BLOCK(level) while (0)
  101 #endif
  102 
  103 #if DEBUG >= 1
  104 #define TRACE1(fmt, ...) TRACE(1, fmt , ## __VA_ARGS__)
  105 #else
  106 #define TRACE1(fmt, ...) do { } while (0)
  107 #endif
  108 
  109 #if DEBUG >= 2
  110 #define TRACE2(fmt, ...) TRACE(2, fmt , ## __VA_ARGS__)
  111 #else
  112 #define TRACE2(fmt, ...) do { } while (0)
  113 #endif
  114 
  115 #if DEBUG >= 3
  116 #define TRACE3(fmt, ...) TRACE(3, fmt , ## __VA_ARGS__)
  117 #else
  118 #define TRACE3(fmt, ...) do { } while (0)
  119 #endif
  120 
  121 #if DEBUG >= 4
  122 #define TRACE4(fmt, ...) TRACE(4, fmt , ## __VA_ARGS__)
  123 #else
  124 #define TRACE4(fmt, ...) do { } while (0)
  125 #endif
  126 
  127 #if DEBUG >= 5
  128 #define TRACE5(fmt, ...) TRACE(5, fmt , ## __VA_ARGS__)
  129 #else
  130 #define TRACE5(fmt, ...) do { } while (0)
  131 #endif
  132 
  133 #if DEBUG >= 6
  134 #define TRACE6(fmt, ...) TRACE(6, fmt , ## __VA_ARGS__)
  135 #else
  136 #define TRACE6(fmt, ...) do { } while (0)
  137 #endif
  138 
  139 #define ENTER0(fmt, ...) TRACE0("Enter " fmt , ## __VA_ARGS__)
  140 #define ENTER1(fmt, ...) TRACE1("Enter " fmt , ## __VA_ARGS__)
  141 #define ENTER2(fmt, ...) TRACE2("Enter " fmt , ## __VA_ARGS__)
  142 #define ENTER3(fmt, ...) TRACE3("Enter " fmt , ## __VA_ARGS__)
  143 #define ENTER4(fmt, ...) TRACE4("Enter " fmt , ## __VA_ARGS__)
  144 #define ENTER5(fmt, ...) TRACE5("Enter " fmt , ## __VA_ARGS__)
  145 #define ENTER6(fmt, ...) TRACE6("Enter " fmt , ## __VA_ARGS__)
  146 
  147 #define EXIT0(stmt) do { TRACE0("Exit"); stmt; } while (0)
  148 #define EXIT1(stmt) do { TRACE1("Exit"); stmt; } while (0)
  149 #define EXIT2(stmt) do { TRACE2("Exit"); stmt; } while (0)
  150 #define EXIT3(stmt) do { TRACE3("Exit"); stmt; } while (0)
  151 #define EXIT4(stmt) do { TRACE4("Exit"); stmt; } while (0)
  152 #define EXIT5(stmt) do { TRACE5("Exit"); stmt; } while (0)
  153 #define EXIT6(stmt) do { TRACE6("Exit"); stmt; } while (0)
  154 
  155 #if defined(USB_DEBUG)
  156 #define USBTRACE TRACE0
  157 #define USBENTER ENTER0
  158 #define USBEXIT EXIT0
  159 #else
  160 #define USBTRACE(fmt, ...) do { } while (0)
  161 #define USBENTER(fmt, ...)
  162 #define USBEXIT(stmt) stmt
  163 #endif
  164 
  165 #if defined(EVENT_DEBUG)
  166 #define EVENTTRACE TRACE0
  167 #define EVENTENTER ENTER0
  168 #define EVENTEXIT EXIT0
  169 #else
  170 #define EVENTTRACE(fmt, ...) do { } while (0)
  171 #define EVENTENTER(fmt, ...)
  172 #define EVENTEXIT(stmt) stmt
  173 #endif
  174 
  175 #if defined(TIMER_DEBUG)
  176 #define TIMERTRACE TRACE0
  177 #define TIMERENTER ENTER0
  178 #define TIMEREXIT EXIT0
  179 #else
  180 #define TIMERTRACE(fmt, ...) do { } while (0)
  181 #define TIMERENTER(fmt, ...)
  182 #define TIMEREXIT(stmt) stmt
  183 #endif
  184 
  185 #if defined(IO_DEBUG)
  186 #define IOTRACE TRACE0
  187 #define IOENTER ENTER0
  188 #define IOEXIT EXIT0
  189 #else
  190 #define IOTRACE(fmt, ...) do { } while (0)
  191 #define IOENTER(fmt, ...)
  192 #define IOEXIT(stmt) stmt
  193 #endif
  194 
  195 #if defined(WORK_DEBUG)
  196 #define WORKTRACE TRACE0
  197 #define WORKENTER ENTER0
  198 #define WORKEXIT EXIT0
  199 #else
  200 #define WORKTRACE(fmt, ...) do { } while (0)
  201 #define WORKENTER(fmt, ...)
  202 #define WORKEXIT(stmt) stmt
  203 #endif
  204 
  205 #if DEBUG >= 1
  206 #define assert(expr)                            \
  207 do {                                    \
  208     if (!(expr)) {                          \
  209         ERROR("assertion '%s' failed", #expr);          \
  210         dump_stack();                       \
  211     }                               \
  212 } while (0)
  213 #else
  214 #define assert(expr) do { } while (0)
  215 #endif
  216 
  217 #endif // __KERNEL__
  218 
  219 #endif // NDISWRAPPER_H