isl_oid.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  1. /*
  2. * Copyright (C) 2003 Herbert Valerio Riedel <hvr@gnu.org>
  3. * Copyright (C) 2004 Luis R. Rodriguez <mcgrof@ruslug.rutgers.edu>
  4. * Copyright (C) 2004 Aurelien Alleaume <slts@free.fr>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, see <http://www.gnu.org/licenses/>.
  17. *
  18. */
  19. #if !defined(_ISL_OID_H)
  20. #define _ISL_OID_H
  21. /*
  22. * MIB related constant and structure definitions for communicating
  23. * with the device firmware
  24. */
  25. struct obj_ssid {
  26. u8 length;
  27. char octets[33];
  28. } __packed;
  29. struct obj_key {
  30. u8 type; /* dot11_priv_t */
  31. u8 length;
  32. char key[32];
  33. } __packed;
  34. struct obj_mlme {
  35. u8 address[6];
  36. u16 id;
  37. u16 state;
  38. u16 code;
  39. } __packed;
  40. struct obj_mlmeex {
  41. u8 address[6];
  42. u16 id;
  43. u16 state;
  44. u16 code;
  45. u16 size;
  46. u8 data[0];
  47. } __packed;
  48. struct obj_buffer {
  49. u32 size;
  50. u32 addr; /* 32bit bus address */
  51. } __packed;
  52. struct obj_bss {
  53. u8 address[6];
  54. int:16; /* padding */
  55. char state;
  56. char reserved;
  57. short age;
  58. char quality;
  59. char rssi;
  60. struct obj_ssid ssid;
  61. short channel;
  62. char beacon_period;
  63. char dtim_period;
  64. short capinfo;
  65. short rates;
  66. short basic_rates;
  67. int:16; /* padding */
  68. } __packed;
  69. struct obj_bsslist {
  70. u32 nr;
  71. struct obj_bss bsslist[0];
  72. } __packed;
  73. struct obj_frequencies {
  74. u16 nr;
  75. u16 mhz[0];
  76. } __packed;
  77. struct obj_attachment {
  78. char type;
  79. char reserved;
  80. short id;
  81. short size;
  82. char data[0];
  83. } __packed;
  84. /*
  85. * in case everything's ok, the inlined function below will be
  86. * optimized away by the compiler...
  87. */
  88. static inline void
  89. __bug_on_wrong_struct_sizes(void)
  90. {
  91. BUILD_BUG_ON(sizeof (struct obj_ssid) != 34);
  92. BUILD_BUG_ON(sizeof (struct obj_key) != 34);
  93. BUILD_BUG_ON(sizeof (struct obj_mlme) != 12);
  94. BUILD_BUG_ON(sizeof (struct obj_mlmeex) != 14);
  95. BUILD_BUG_ON(sizeof (struct obj_buffer) != 8);
  96. BUILD_BUG_ON(sizeof (struct obj_bss) != 60);
  97. BUILD_BUG_ON(sizeof (struct obj_bsslist) != 4);
  98. BUILD_BUG_ON(sizeof (struct obj_frequencies) != 2);
  99. }
  100. enum dot11_state_t {
  101. DOT11_STATE_NONE = 0,
  102. DOT11_STATE_AUTHING = 1,
  103. DOT11_STATE_AUTH = 2,
  104. DOT11_STATE_ASSOCING = 3,
  105. DOT11_STATE_ASSOC = 5,
  106. DOT11_STATE_IBSS = 6,
  107. DOT11_STATE_WDS = 7
  108. };
  109. enum dot11_bsstype_t {
  110. DOT11_BSSTYPE_NONE = 0,
  111. DOT11_BSSTYPE_INFRA = 1,
  112. DOT11_BSSTYPE_IBSS = 2,
  113. DOT11_BSSTYPE_ANY = 3
  114. };
  115. enum dot11_auth_t {
  116. DOT11_AUTH_NONE = 0,
  117. DOT11_AUTH_OS = 1,
  118. DOT11_AUTH_SK = 2,
  119. DOT11_AUTH_BOTH = 3
  120. };
  121. enum dot11_mlme_t {
  122. DOT11_MLME_AUTO = 0,
  123. DOT11_MLME_INTERMEDIATE = 1,
  124. DOT11_MLME_EXTENDED = 2
  125. };
  126. enum dot11_priv_t {
  127. DOT11_PRIV_WEP = 0,
  128. DOT11_PRIV_TKIP = 1
  129. };
  130. /* Prism "Nitro" / Frameburst / "Packet Frame Grouping"
  131. * Value is in microseconds. Represents the # microseconds
  132. * the firmware will take to group frames before sending out then out
  133. * together with a CSMA contention. Without this all frames are
  134. * sent with a CSMA contention.
  135. * Bibliography:
  136. * http://www.hpl.hp.com/personal/Jean_Tourrilhes/Papers/Packet.Frame.Grouping.html
  137. */
  138. enum dot11_maxframeburst_t {
  139. /* Values for DOT11_OID_MAXFRAMEBURST */
  140. DOT11_MAXFRAMEBURST_OFF = 0, /* Card firmware default */
  141. DOT11_MAXFRAMEBURST_MIXED_SAFE = 650, /* 802.11 a,b,g safe */
  142. DOT11_MAXFRAMEBURST_IDEAL = 1300, /* Theoretical ideal level */
  143. DOT11_MAXFRAMEBURST_MAX = 5000, /* Use this as max,
  144. * Note: firmware allows for greater values. This is a
  145. * recommended max. I'll update this as I find
  146. * out what the real MAX is. Also note that you don't necessarily
  147. * get better results with a greater value here.
  148. */
  149. };
  150. /* Support for 802.11 long and short frame preambles.
  151. * Long preamble uses 128-bit sync field, 8-bit CRC
  152. * Short preamble uses 56-bit sync field, 16-bit CRC
  153. *
  154. * 802.11a -- not sure, both optionally ?
  155. * 802.11b supports long and optionally short
  156. * 802.11g supports both */
  157. enum dot11_preamblesettings_t {
  158. DOT11_PREAMBLESETTING_LONG = 0,
  159. /* Allows *only* long 802.11 preambles */
  160. DOT11_PREAMBLESETTING_SHORT = 1,
  161. /* Allows *only* short 802.11 preambles */
  162. DOT11_PREAMBLESETTING_DYNAMIC = 2
  163. /* AutomatiGically set */
  164. };
  165. /* Support for 802.11 slot timing (time between packets).
  166. *
  167. * Long uses 802.11a slot timing (9 usec ?)
  168. * Short uses 802.11b slot timing (20 use ?) */
  169. enum dot11_slotsettings_t {
  170. DOT11_SLOTSETTINGS_LONG = 0,
  171. /* Allows *only* long 802.11b slot timing */
  172. DOT11_SLOTSETTINGS_SHORT = 1,
  173. /* Allows *only* long 802.11a slot timing */
  174. DOT11_SLOTSETTINGS_DYNAMIC = 2
  175. /* AutomatiGically set */
  176. };
  177. /* All you need to know, ERP is "Extended Rate PHY".
  178. * An Extended Rate PHY (ERP) STA or AP shall support three different
  179. * preamble and header formats:
  180. * Long preamble (refer to above)
  181. * Short preamble (refer to above)
  182. * OFDM preamble ( ? )
  183. *
  184. * I'm assuming here Protection tells the AP
  185. * to be careful, a STA which cannot handle the long pre-amble
  186. * has joined.
  187. */
  188. enum do11_nonerpstatus_t {
  189. DOT11_ERPSTAT_NONEPRESENT = 0,
  190. DOT11_ERPSTAT_USEPROTECTION = 1
  191. };
  192. /* (ERP is "Extended Rate PHY") Way to read NONERP is NON-ERP-*
  193. * The key here is DOT11 NON ERP NEVER protects against
  194. * NON ERP STA's. You *don't* want this unless
  195. * you know what you are doing. It means you will only
  196. * get Extended Rate capabilities */
  197. enum dot11_nonerpprotection_t {
  198. DOT11_NONERP_NEVER = 0,
  199. DOT11_NONERP_ALWAYS = 1,
  200. DOT11_NONERP_DYNAMIC = 2
  201. };
  202. /* Preset OID configuration for 802.11 modes
  203. * Note: DOT11_OID_CW[MIN|MAX] hold the values of the
  204. * DCS MIN|MAX backoff used */
  205. enum dot11_profile_t { /* And set/allowed values */
  206. /* Allowed values for DOT11_OID_PROFILES */
  207. DOT11_PROFILE_B_ONLY = 0,
  208. /* DOT11_OID_RATES: 1, 2, 5.5, 11Mbps
  209. * DOT11_OID_PREAMBLESETTINGS: DOT11_PREAMBLESETTING_DYNAMIC
  210. * DOT11_OID_CWMIN: 31
  211. * DOT11_OID_NONEPROTECTION: DOT11_NOERP_DYNAMIC
  212. * DOT11_OID_SLOTSETTINGS: DOT11_SLOTSETTINGS_LONG
  213. */
  214. DOT11_PROFILE_MIXED_G_WIFI = 1,
  215. /* DOT11_OID_RATES: 1, 2, 5.5, 11, 6, 9, 12, 18, 24, 36, 48, 54Mbs
  216. * DOT11_OID_PREAMBLESETTINGS: DOT11_PREAMBLESETTING_DYNAMIC
  217. * DOT11_OID_CWMIN: 15
  218. * DOT11_OID_NONEPROTECTION: DOT11_NOERP_DYNAMIC
  219. * DOT11_OID_SLOTSETTINGS: DOT11_SLOTSETTINGS_DYNAMIC
  220. */
  221. DOT11_PROFILE_MIXED_LONG = 2, /* "Long range" */
  222. /* Same as Profile MIXED_G_WIFI */
  223. DOT11_PROFILE_G_ONLY = 3,
  224. /* Same as Profile MIXED_G_WIFI */
  225. DOT11_PROFILE_TEST = 4,
  226. /* Same as Profile MIXED_G_WIFI except:
  227. * DOT11_OID_PREAMBLESETTINGS: DOT11_PREAMBLESETTING_SHORT
  228. * DOT11_OID_NONEPROTECTION: DOT11_NOERP_NEVER
  229. * DOT11_OID_SLOTSETTINGS: DOT11_SLOTSETTINGS_SHORT
  230. */
  231. DOT11_PROFILE_B_WIFI = 5,
  232. /* Same as Profile B_ONLY */
  233. DOT11_PROFILE_A_ONLY = 6,
  234. /* Same as Profile MIXED_G_WIFI except:
  235. * DOT11_OID_RATES: 6, 9, 12, 18, 24, 36, 48, 54Mbs
  236. */
  237. DOT11_PROFILE_MIXED_SHORT = 7
  238. /* Same as MIXED_G_WIFI */
  239. };
  240. /* The dot11d conformance level configures the 802.11d conformance levels.
  241. * The following conformance levels exist:*/
  242. enum oid_inl_conformance_t {
  243. OID_INL_CONFORMANCE_NONE = 0, /* Perform active scanning */
  244. OID_INL_CONFORMANCE_STRICT = 1, /* Strictly adhere to 802.11d */
  245. OID_INL_CONFORMANCE_FLEXIBLE = 2, /* Use passed 802.11d info to
  246. * determine channel AND/OR just make assumption that active
  247. * channels are valid channels */
  248. };
  249. enum oid_inl_mode_t {
  250. INL_MODE_NONE = -1,
  251. INL_MODE_PROMISCUOUS = 0,
  252. INL_MODE_CLIENT = 1,
  253. INL_MODE_AP = 2,
  254. INL_MODE_SNIFFER = 3
  255. };
  256. enum oid_inl_config_t {
  257. INL_CONFIG_NOTHING = 0x00,
  258. INL_CONFIG_MANUALRUN = 0x01,
  259. INL_CONFIG_FRAMETRAP = 0x02,
  260. INL_CONFIG_RXANNEX = 0x04,
  261. INL_CONFIG_TXANNEX = 0x08,
  262. INL_CONFIG_WDS = 0x10
  263. };
  264. enum oid_inl_phycap_t {
  265. INL_PHYCAP_2400MHZ = 1,
  266. INL_PHYCAP_5000MHZ = 2,
  267. INL_PHYCAP_FAA = 0x80000000, /* Means card supports the FAA switch */
  268. };
  269. enum oid_num_t {
  270. GEN_OID_MACADDRESS = 0,
  271. GEN_OID_LINKSTATE,
  272. GEN_OID_WATCHDOG,
  273. GEN_OID_MIBOP,
  274. GEN_OID_OPTIONS,
  275. GEN_OID_LEDCONFIG,
  276. /* 802.11 */
  277. DOT11_OID_BSSTYPE,
  278. DOT11_OID_BSSID,
  279. DOT11_OID_SSID,
  280. DOT11_OID_STATE,
  281. DOT11_OID_AID,
  282. DOT11_OID_COUNTRYSTRING,
  283. DOT11_OID_SSIDOVERRIDE,
  284. DOT11_OID_MEDIUMLIMIT,
  285. DOT11_OID_BEACONPERIOD,
  286. DOT11_OID_DTIMPERIOD,
  287. DOT11_OID_ATIMWINDOW,
  288. DOT11_OID_LISTENINTERVAL,
  289. DOT11_OID_CFPPERIOD,
  290. DOT11_OID_CFPDURATION,
  291. DOT11_OID_AUTHENABLE,
  292. DOT11_OID_PRIVACYINVOKED,
  293. DOT11_OID_EXUNENCRYPTED,
  294. DOT11_OID_DEFKEYID,
  295. DOT11_OID_DEFKEYX, /* DOT11_OID_DEFKEY1,...DOT11_OID_DEFKEY4 */
  296. DOT11_OID_STAKEY,
  297. DOT11_OID_REKEYTHRESHOLD,
  298. DOT11_OID_STASC,
  299. DOT11_OID_PRIVTXREJECTED,
  300. DOT11_OID_PRIVRXPLAIN,
  301. DOT11_OID_PRIVRXFAILED,
  302. DOT11_OID_PRIVRXNOKEY,
  303. DOT11_OID_RTSTHRESH,
  304. DOT11_OID_FRAGTHRESH,
  305. DOT11_OID_SHORTRETRIES,
  306. DOT11_OID_LONGRETRIES,
  307. DOT11_OID_MAXTXLIFETIME,
  308. DOT11_OID_MAXRXLIFETIME,
  309. DOT11_OID_AUTHRESPTIMEOUT,
  310. DOT11_OID_ASSOCRESPTIMEOUT,
  311. DOT11_OID_ALOFT_TABLE,
  312. DOT11_OID_ALOFT_CTRL_TABLE,
  313. DOT11_OID_ALOFT_RETREAT,
  314. DOT11_OID_ALOFT_PROGRESS,
  315. DOT11_OID_ALOFT_FIXEDRATE,
  316. DOT11_OID_ALOFT_RSSIGRAPH,
  317. DOT11_OID_ALOFT_CONFIG,
  318. DOT11_OID_VDCFX,
  319. DOT11_OID_MAXFRAMEBURST,
  320. DOT11_OID_PSM,
  321. DOT11_OID_CAMTIMEOUT,
  322. DOT11_OID_RECEIVEDTIMS,
  323. DOT11_OID_ROAMPREFERENCE,
  324. DOT11_OID_BRIDGELOCAL,
  325. DOT11_OID_CLIENTS,
  326. DOT11_OID_CLIENTSASSOCIATED,
  327. DOT11_OID_CLIENTX, /* DOT11_OID_CLIENTX,...DOT11_OID_CLIENT2007 */
  328. DOT11_OID_CLIENTFIND,
  329. DOT11_OID_WDSLINKADD,
  330. DOT11_OID_WDSLINKREMOVE,
  331. DOT11_OID_EAPAUTHSTA,
  332. DOT11_OID_EAPUNAUTHSTA,
  333. DOT11_OID_DOT1XENABLE,
  334. DOT11_OID_MICFAILURE,
  335. DOT11_OID_REKEYINDICATE,
  336. DOT11_OID_MPDUTXSUCCESSFUL,
  337. DOT11_OID_MPDUTXONERETRY,
  338. DOT11_OID_MPDUTXMULTIPLERETRIES,
  339. DOT11_OID_MPDUTXFAILED,
  340. DOT11_OID_MPDURXSUCCESSFUL,
  341. DOT11_OID_MPDURXDUPS,
  342. DOT11_OID_RTSSUCCESSFUL,
  343. DOT11_OID_RTSFAILED,
  344. DOT11_OID_ACKFAILED,
  345. DOT11_OID_FRAMERECEIVES,
  346. DOT11_OID_FRAMEERRORS,
  347. DOT11_OID_FRAMEABORTS,
  348. DOT11_OID_FRAMEABORTSPHY,
  349. DOT11_OID_SLOTTIME,
  350. DOT11_OID_CWMIN, /* MIN DCS backoff */
  351. DOT11_OID_CWMAX, /* MAX DCS backoff */
  352. DOT11_OID_ACKWINDOW,
  353. DOT11_OID_ANTENNARX,
  354. DOT11_OID_ANTENNATX,
  355. DOT11_OID_ANTENNADIVERSITY,
  356. DOT11_OID_CHANNEL,
  357. DOT11_OID_EDTHRESHOLD,
  358. DOT11_OID_PREAMBLESETTINGS,
  359. DOT11_OID_RATES,
  360. DOT11_OID_CCAMODESUPPORTED,
  361. DOT11_OID_CCAMODE,
  362. DOT11_OID_RSSIVECTOR,
  363. DOT11_OID_OUTPUTPOWERTABLE,
  364. DOT11_OID_OUTPUTPOWER,
  365. DOT11_OID_SUPPORTEDRATES,
  366. DOT11_OID_FREQUENCY,
  367. DOT11_OID_SUPPORTEDFREQUENCIES,
  368. DOT11_OID_NOISEFLOOR,
  369. DOT11_OID_FREQUENCYACTIVITY,
  370. DOT11_OID_IQCALIBRATIONTABLE,
  371. DOT11_OID_NONERPPROTECTION,
  372. DOT11_OID_SLOTSETTINGS,
  373. DOT11_OID_NONERPTIMEOUT,
  374. DOT11_OID_PROFILES,
  375. DOT11_OID_EXTENDEDRATES,
  376. DOT11_OID_DEAUTHENTICATE,
  377. DOT11_OID_AUTHENTICATE,
  378. DOT11_OID_DISASSOCIATE,
  379. DOT11_OID_ASSOCIATE,
  380. DOT11_OID_SCAN,
  381. DOT11_OID_BEACON,
  382. DOT11_OID_PROBE,
  383. DOT11_OID_DEAUTHENTICATEEX,
  384. DOT11_OID_AUTHENTICATEEX,
  385. DOT11_OID_DISASSOCIATEEX,
  386. DOT11_OID_ASSOCIATEEX,
  387. DOT11_OID_REASSOCIATE,
  388. DOT11_OID_REASSOCIATEEX,
  389. DOT11_OID_NONERPSTATUS,
  390. DOT11_OID_STATIMEOUT,
  391. DOT11_OID_MLMEAUTOLEVEL,
  392. DOT11_OID_BSSTIMEOUT,
  393. DOT11_OID_ATTACHMENT,
  394. DOT11_OID_PSMBUFFER,
  395. DOT11_OID_BSSS,
  396. DOT11_OID_BSSX, /*DOT11_OID_BSS1,...,DOT11_OID_BSS64 */
  397. DOT11_OID_BSSFIND,
  398. DOT11_OID_BSSLIST,
  399. OID_INL_TUNNEL,
  400. OID_INL_MEMADDR,
  401. OID_INL_MEMORY,
  402. OID_INL_MODE,
  403. OID_INL_COMPONENT_NR,
  404. OID_INL_VERSION,
  405. OID_INL_INTERFACE_ID,
  406. OID_INL_COMPONENT_ID,
  407. OID_INL_CONFIG,
  408. OID_INL_DOT11D_CONFORMANCE,
  409. OID_INL_PHYCAPABILITIES,
  410. OID_INL_OUTPUTPOWER,
  411. OID_NUM_LAST
  412. };
  413. #define OID_FLAG_CACHED 0x80
  414. #define OID_FLAG_TYPE 0x7f
  415. #define OID_TYPE_U32 0x01
  416. #define OID_TYPE_SSID 0x02
  417. #define OID_TYPE_KEY 0x03
  418. #define OID_TYPE_BUFFER 0x04
  419. #define OID_TYPE_BSS 0x05
  420. #define OID_TYPE_BSSLIST 0x06
  421. #define OID_TYPE_FREQUENCIES 0x07
  422. #define OID_TYPE_MLME 0x08
  423. #define OID_TYPE_MLMEEX 0x09
  424. #define OID_TYPE_ADDR 0x0A
  425. #define OID_TYPE_RAW 0x0B
  426. #define OID_TYPE_ATTACH 0x0C
  427. /* OID_TYPE_MLMEEX is special because of a variable size field when sending.
  428. * Not yet implemented (not used in driver anyway).
  429. */
  430. struct oid_t {
  431. enum oid_num_t oid;
  432. short range; /* to define a range of oid */
  433. short size; /* max size of the associated data */
  434. char flags;
  435. };
  436. union oid_res_t {
  437. void *ptr;
  438. u32 u;
  439. };
  440. #define IWMAX_BITRATES 20
  441. #define IWMAX_BSS 24
  442. #define IWMAX_FREQ 30
  443. #define PRIV_STR_SIZE 1024
  444. #endif /* !defined(_ISL_OID_H) */
  445. /* EOF */