net80211.h 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409
  1. /*++
  2. Copyright (c) 2015 Minoca Corp. All Rights Reserved
  3. Module Name:
  4. net80211.h
  5. Abstract:
  6. This header contains definitions for the IEEE 802.11 Network Layer.
  7. Author:
  8. Chris Stevens 8-Oct-2015
  9. --*/
  10. //
  11. // ------------------------------------------------------------------- Includes
  12. //
  13. //
  14. // --------------------------------------------------------------------- Macros
  15. //
  16. //
  17. // This macros determines if the 802.11 packet is a multicast packet based on
  18. // header.
  19. //
  20. #define NET80211_IS_MULTICAST_BROADCAST(_Header) \
  21. (((_Header)->Address1[0] & 0x01) != 0)
  22. //
  23. // This macros returns the sequences number for the given 802.11 header.
  24. //
  25. #define NET80211_GET_SEQUENCE_NUMBER(_Header) \
  26. (((_Header)->SequenceControl & \
  27. NET80211_SEQUENCE_CONTROL_SEQUENCE_NUMBER_MASK) >> \
  28. NET80211_SEQUENCE_CONTROL_SEQUENCE_NUMBER_SHIFT)
  29. //
  30. // This macro returns the 802.11 packet's type.
  31. //
  32. #define NET80211_GET_FRAME_TYPE(_Header) \
  33. (((_Header)->FrameControl & NET80211_FRAME_CONTROL_TYPE_MASK) >> \
  34. NET80211_FRAME_CONTROL_TYPE_SHIFT)
  35. //
  36. // This macro returns the 802.11 packet's subtype.
  37. //
  38. #define NET80211_GET_FRAME_SUBTYPE(_Header) \
  39. (((_Header)->FrameControl & NET80211_FRAME_CONTROL_SUBTYPE_MASK) >> \
  40. NET80211_FRAME_CONTROL_SUBTYPE_SHIFT)
  41. //
  42. // This macro gets the packet number from a CCMP header.
  43. //
  44. #define NET80211_GET_CCMP_HEADER_PACKET_NUMBER(_Header, _PacketNumber) \
  45. (_PacketNumber) = (_Header)->PacketNumberLow; \
  46. (_PacketNumber) |= (_Header)->PacketNumberHigh << 16; \
  47. //
  48. // This macro sets the packet number for a CCMP header.
  49. //
  50. #define NET80211_SET_CCMP_HEADER_PACKET_NUMBER(_Header, _PacketNumber) \
  51. (_Header)->PacketNumberLow = (_PacketNumber) & 0xFFFF; \
  52. (_Header)->PacketNumberHigh = ((_PacketNumber) & 0xFFFFFFFF0000) >> 16; \
  53. //
  54. // This macro gets the ID from the given information element.
  55. //
  56. #define NET80211_GET_ELEMENT_ID(_Element) \
  57. ((PUCHAR)(_Element))[NET80211_ELEMENT_ID_OFFSET]
  58. //
  59. // This macro gets the length from the given information element.
  60. //
  61. #define NET80211_GET_ELEMENT_LENGTH(_Element) \
  62. ((PUCHAR)(_Element))[NET80211_ELEMENT_LENGTH_OFFSET]
  63. //
  64. // This macro returns a pointer to the first byte of the element data array.
  65. //
  66. #define NET80211_GET_ELEMENT_DATA(_Element) \
  67. ((PUCHAR)(_Element) + NET80211_ELEMENT_DATA_OFFSET)
  68. //
  69. // ---------------------------------------------------------------- Definitions
  70. //
  71. #ifndef NET80211_API
  72. #define NET80211_API __DLLIMPORT
  73. #endif
  74. //
  75. // Define the current version number of the 802.11 net link properties
  76. // structure.
  77. //
  78. #define NET80211_LINK_PROPERTIES_VERSION 1
  79. //
  80. // Define the current version number of the 802.11 BSS information structure.
  81. //
  82. #define NET80211_BSS_VERSION 1
  83. //
  84. // Define the current version number of the 802.11 received packet structure.
  85. //
  86. #define NET80211_RECEIVE_PACKET_VERSION 1
  87. //
  88. // Define the size of an 802.11 MAC address.
  89. //
  90. #define NET80211_ADDRESS_SIZE 6
  91. //
  92. // Define the frame control bits for an 802.11 frame header.
  93. //
  94. #define NET80211_FRAME_CONTROL_ORDER 0x8000
  95. #define NET80211_FRAME_CONTROL_PROTECTED_FRAME 0x4000
  96. #define NET80211_FRAME_CONTROL_MORE_DATA 0x2000
  97. #define NET80211_FRAME_CONTROL_POWER_MANAGEMENT 0x1000
  98. #define NET80211_FRAME_CONTROL_RETRY 0x0800
  99. #define NET80211_FRAME_CONTROL_MORE_FRAGMENTS 0x0400
  100. #define NET80211_FRAME_CONTROL_FROM_DS 0x0200
  101. #define NET80211_FRAME_CONTROL_TO_DS 0x0100
  102. #define NET80211_FRAME_CONTROL_SUBTYPE_MASK 0x00F0
  103. #define NET80211_FRAME_CONTROL_SUBTYPE_SHIFT 4
  104. #define NET80211_FRAME_CONTROL_TYPE_MASK 0x000C
  105. #define NET80211_FRAME_CONTROL_TYPE_SHIFT 2
  106. #define NET80211_FRAME_CONTROL_PROTOCOL_VERSION_MASK 0x0003
  107. #define NET80211_FRAME_CONTROL_PROTOCOL_VERSION_SHIFT 0
  108. #define NET80211_FRAME_CONTROL_PROTOCOL_VERSION 0
  109. //
  110. // Define the 802.11 frame types.
  111. //
  112. #define NET80211_FRAME_TYPE_MANAGEMENT 0
  113. #define NET80211_FRAME_TYPE_CONTROL 1
  114. #define NET80211_FRAME_TYPE_DATA 2
  115. //
  116. // Define the management frame subtypes for the 802.11 header.
  117. //
  118. #define NET80211_MANAGEMENT_FRAME_SUBTYPE_ASSOCIATION_REQUEST 0x0
  119. #define NET80211_MANAGEMENT_FRAME_SUBTYPE_ASSOCIATION_RESPONSE 0x1
  120. #define NET80211_MANAGEMENT_FRAME_SUBTYPE_REASSOCIATION_REQUEST 0x2
  121. #define NET80211_MANAGEMENT_FRAME_SUBTYPE_REASSOCIATION_RESPONSE 0x3
  122. #define NET80211_MANAGEMENT_FRAME_SUBTYPE_PROBE_REQUEST 0x4
  123. #define NET80211_MANAGEMENT_FRAME_SUBTYPE_PROBE_RESPONSE 0x5
  124. #define NET80211_MANAGEMENT_FRAME_SUBTYPE_TIMING_ADVERTISEMENT 0x6
  125. #define NET80211_MANAGEMENT_FRAME_SUBTYPE_BEACON 0x8
  126. #define NET80211_MANAGEMENT_FRAME_SUBTYPE_ATIM 0x9
  127. #define NET80211_MANAGEMENT_FRAME_SUBTYPE_DISASSOCIATION 0xA
  128. #define NET80211_MANAGEMENT_FRAME_SUBTYPE_AUTHENTICATION 0xB
  129. #define NET80211_MANAGEMENT_FRAME_SUBTYPE_DEAUTHENTICATION 0xC
  130. #define NET80211_MANAGEMENT_FRAME_SUBTYPE_ACTION 0xD
  131. #define NET80211_MANAGEMENT_FRAME_SUBTYPE_ACTION_NO_ACK 0xE
  132. //
  133. // Define the control frame subtypes for the 802.11 header.
  134. //
  135. #define NET80211_CONTROL_FRAME_SUBTYPE_CONTROL_WRAPPER 0x7
  136. #define NET80211_CONTROL_FRAME_SUBTYPE_BLOCK_ACK_REQUEST 0x8
  137. #define NET80211_CONTROL_FRAME_SUBTYPE_BLOCK_ACK 0x9
  138. #define NET80211_CONTROL_FRAME_SUBTYPE_PS_POLL 0xA
  139. #define NET80211_CONTROL_FRAME_SUBTYPE_RTS 0xB
  140. #define NET80211_CONTROL_FRAME_SUBTYPE_CTS 0xC
  141. #define NET80211_CONTROL_FRAME_SUBTYPE_ACK 0xD
  142. #define NET80211_CONTROL_FRAME_SUBTYPE_CF_END 0xE
  143. #define NET80211_CONTROL_FRAME_SUBTYPE_CF_END_ACK 0xF
  144. //
  145. // Define the data frame subtypes for the 802.11 header.
  146. //
  147. #define NET80211_DATA_FRAME_SUBTYPE_DATA 0x0
  148. #define NET80211_DATA_FRAME_SUBTYPE_DATA_CF_ACK 0x1
  149. #define NET80211_DATA_FRAME_SUBTYPE_DATA_CF_POLL 0x2
  150. #define NET80211_DATA_FRAME_SUBTYPE_DATA_CF_ACK_POLL 0x3
  151. #define NET80211_DATA_FRAME_SUBTYPE_NO_DATA 0x4
  152. #define NET80211_DATA_FRAME_SUBTYPE_NO_DATA_CF_ACK 0x5
  153. #define NET80211_DATA_FRAME_SUBTYPE_NO_DATA_CF_POLL 0x6
  154. #define NET80211_DATA_FRAME_SUBTYPE_NO_DATA_CF_ACK_POLL 0x7
  155. #define NET80211_DATA_FRAME_SUBTYPE_QOS_DATA 0x8
  156. #define NET80211_DATA_FRAME_SUBTYPE_QOS_DATA_CF_ACK 0x9
  157. #define NET80211_DATA_FRAME_SUBTYPE_QOS_DATA_CF_POLL 0xA
  158. #define NET80211_DATA_FRAME_SUBTYPE_QOS_DATA_CF_ACK_POLL 0xB
  159. #define NET80211_DATA_FRAME_SUBTYPE_QOS_NO_DATA 0xC
  160. #define NET80211_DATA_FRAME_SUBTYPE_QOS_NO_DATA_CF_POLL 0xE
  161. #define NET80211_DATA_FRAME_SUBTYPE_QOS_NO_DATA_CF_ACK_POLL 0xF
  162. //
  163. // Define the sequence control bits for an 802.11 frame header.
  164. //
  165. #define NET80211_SEQUENCE_CONTROL_SEQUENCE_NUMBER_MASK 0xFFF0
  166. #define NET80211_SEQUENCE_CONTROL_SEQUENCE_NUMBER_SHIFT 4
  167. #define NET80211_SEQUENCE_CONTROL_FRAGMENT_NUMBER_MASK 0x000F
  168. #define NET80211_SEQUENCE_CONTROL_FRAGMENT_NUMBER_SHIFT 0
  169. //
  170. // Define the quality of service control bits for an 802.11 frame header.
  171. //
  172. #define NET80211_QOS_CONTROL_QUEUE_SIZE_MASK 0xFF00
  173. #define NET80211_QOS_CONTROL_QUEUE_SIZE_SHIFT 8
  174. #define NET80211_QOS_CONTROL_TXOP_DURATION_REQUESTED_MASK 0xFF00
  175. #define NET80211_QOS_CONTROL_TXOP_DURATION_REQUESTED_SHIFT 8
  176. #define NET80211_QOS_CONTROL_AP_PS_BUFFER_STATE_MASK 0xFF00
  177. #define NET80211_QOS_CONTROL_AP_PS_BUFFER_STATE_SHIFT 8
  178. #define NET80211_QOS_CONTROL_TXOP_LIMIT_MASK 0xFF00
  179. #define NET80211_QOS_CONTROL_TXOP_LIMIT_SHIFT 8
  180. #define NET80211_QOS_CONTROL_RSPI 0x0400
  181. #define NET80211_QOS_CONTROL_MESH_POWER_SAVE_LEVEL 0x0200
  182. #define NET80211_QOS_CONTROL_MESH_CONTROL_PRESENT 0x0100
  183. #define NET80211_QOS_CONTROL_AMSDU_PRESENT 0x0080
  184. #define NET80211_QOS_CONTROL_ACK_POLICY_MASK 0x0060
  185. #define NET80211_QOS_CONTROL_ACK_POLICY_SHIFT 5
  186. #define NET80211_QOS_CONTROL_EOSP 0x0010
  187. #define NET80211_QOS_CONTROL_TID_MASK 0x000F
  188. #define NET80211_QOS_CONTROL_TID_SHIFT 0
  189. //
  190. // Define the HT control bits for an 802.11 frame header.
  191. //
  192. #define NET80211_HT_CONTROL_RDG_MORE_PPDU 0x80000000
  193. #define NET80211_HT_CONTROL_AC_CONSTRAINT 0x40000000
  194. #define NET80211_HT_CONTROL_NDP_ANNOUCEMENT 0x01000000
  195. #define NET80211_HT_CONTROL_CSI_STEERING_MASK 0x00C00000
  196. #define NET80211_HT_CONTROL_CSI_STEERING_SHIFT 22
  197. #define NET80211_HT_CONTROL_CALIBRATION_SEQUENCE_MASK 0x000C0000
  198. #define NET80211_HT_CONTROL_CALIBRATION_SEQUENCE_SHIFT 18
  199. #define NET80211_HT_CONTROL_CALIBRATION_POSITION_MASK 0x00030000
  200. #define NET80211_HT_CONTROL_CALIBRATION_POSITION_SHIFT 16
  201. #define NET80211_HT_CONTROL_LINK_ADAPTATION_CONTROL_MASK 0x0000FFFF
  202. #define NET80211_HT_CONTROL_LINK_ADAPTATION_CONTROL_SHIFT 0
  203. //
  204. // Define the size, in bytes, for each of the fixed size non-information
  205. // element 802.11 fields.
  206. //
  207. #define NET80211_AUTHENTICATION_ALGORITHM_SIZE 2
  208. #define NET80211_AUTHENTICATION_TRANSACTION_SEQUENCE_SIZE 2
  209. #define NET80211_BEACON_INTERVAL_SIZE 2
  210. #define NET80211_CAPABILITY_SIZE 2
  211. #define NET80211_CURRENT_AP_ADDRESS_SIZE 6
  212. #define NET80211_LISTEN_INTERVAL_SIZE 2
  213. #define NET80211_REASON_CODE_SIZE 2
  214. #define NET80211_ASSOCIATION_ID_SIZE 2
  215. #define NET80211_STATUS_CODE_SIZE 2
  216. #define NET80211_TIMESTAMP_SIZE 8
  217. #define NET80211_DIALOG_TOKEN_SIZE 1
  218. #define NET80211_DLS_TIMEOUT_VALUE_SIZE 2
  219. #define NET80211_BLOCK_ACK_PARAMETER_SET_SIZE 2
  220. #define NET80211_BLOCK_ACK_TIMEOUT_SIZE 2
  221. #define NET80211_DELBA_PARAMETER_SET_SIZE 2
  222. #define NET80211_QOS_INFORMATION_SIZE 1
  223. #define NET80211_MEASUREMENT_PILOT_INTERVAL_SIZE 1
  224. #define NET80211_MAX_TRANSMIT_POWER_SIZE 1
  225. #define NET80211_TRANSMIT_POWER_USED_SIZE 1
  226. #define NET80211_CHANNEL_WIDTH_SIZE 1
  227. #define NET80211_SM_POWER_CONTROL_SIZE 1
  228. #define NET80211_PCO_PHASE_CONTROL_SIZE 1
  229. #define NET80211_PSMP_PARAMETER_SET_SIZE 2
  230. #define NET80211_PSMP_STATION_INFORMATION_SIZE 8
  231. #define NET80211_MIMO_CONTROL_SIZE 6
  232. #define NET80211_ANTENNA_SELECTION_INDICES_SIZE 1
  233. #define NET80211_RATE_IDENTIFICATION_SIZE 4
  234. #define NET80211_GAS_QUERY_RESPONSE_FRAGMENT_ID_SIZE 1
  235. #define NET80211_VENUE_INFORMATION_SIZE 2
  236. #define NET80211_TARGET_CHANNEL_SIZE 1
  237. #define NET80211_OPERATING_CLASS_SIZE 1
  238. #define NET80211_SEND_CONFIRM_SIZE 2
  239. #define NET80211_FINITE_CYCLIC_GROUP_SIZE 2
  240. //
  241. // Define the bits for the 802.11 capability information field.
  242. //
  243. #define NET80211_CAPABILITY_FLAG_IMMEDIATE_BLOCK_ACK 0x8000
  244. #define NET80211_CAPABILITY_FLAG_DELAYED_BLOCK_ACK 0x4000
  245. #define NET80211_CAPABILITY_FLAG_DSSS_OFDM 0x2000
  246. #define NET80211_CAPABILITY_FLAG_RADIO_MEASUREMENT 0x1000
  247. #define NET80211_CAPABILITY_FLAG_APSD 0x0800
  248. #define NET80211_CAPABILITY_FLAG_SHORT_SLOT_TIME 0x0400
  249. #define NET80211_CAPABILITY_FLAG_QOS 0x0200
  250. #define NET80211_CAPABILITY_FLAG_SPECTRUM_MGMT 0x0100
  251. #define NET80211_CAPABILITY_FLAG_CHANNEL_AGILITY 0x0080
  252. #define NET80211_CAPABILITY_FLAG_PBCC 0x0040
  253. #define NET80211_CAPABILITY_FLAG_SHORT_PREAMBLE 0x0020
  254. #define NET80211_CAPABILITY_FLAG_PRIVACY 0x0010
  255. #define NET80211_CAPABILITY_FLAG_CF_POLL_REQUEST 0x0008
  256. #define NET80211_CAPABILITY_FLAG_CF_POLLABLE 0x0004
  257. #define NET80211_CAPABILITY_FLAG_IBSS 0x0002
  258. #define NET80211_CAPABILITY_FLAG_ESS 0x0001
  259. //
  260. // Define the mask for the association ID. The upper 2 bits are always set.
  261. //
  262. #define NET80211_ASSOCIATION_ID_MASK 0x3FFF
  263. //
  264. // Define the 802.11 reason codes.
  265. //
  266. #define NET80211_REASON_CODE_RESERVED 0
  267. #define NET80211_REASON_CODE_UNSPECIFIED 1
  268. #define NET80211_REASON_CODE_AUTHENTICATION_EXPIRED 2
  269. #define NET80211_REASON_CODE_DEAUTHENTICATION_LEAVING 3
  270. #define NET80211_REASON_CODE_DISASSOCIATION_INACTIVE 4
  271. #define NET80211_REASON_CODE_DISASSOCIATION_FULL 5
  272. #define NET80211_REASON_CODE_CLASS_2_NOT_AUTHORIZED 6
  273. #define NET80211_REASON_CODE_CLASS_3_NOT_ASSOCIATED 7
  274. #define NET80211_REASON_CODE_DISASSOCIATION_LEAVING 8
  275. #define NET80211_REASON_CODE_ASSOCIATION_NOT_AUTHORIZED 9
  276. #define NET80211_REASON_CODE_DISASSOCIATION_INVALID_POWER_CAPABILITY 10
  277. //
  278. // Define the set of 802.11 information element IDs.
  279. //
  280. #define NET80211_ELEMENT_SSID 0x00
  281. #define NET80211_ELEMENT_SUPPORTED_RATES 0x01
  282. #define NET80211_ELEMENT_FH 0x02
  283. #define NET80211_ELEMENT_DSSS 0x03
  284. #define NET80211_ELEMENT_EDCA 0x0C
  285. #define NET80211_ELEMENT_RSN 0x30
  286. #define NET80211_ELEMENT_EXTENDED_SUPPORTED_RATES 0x32
  287. //
  288. // Define the base size that is common to all elements.
  289. //
  290. #define NET80211_ELEMENT_HEADER_SIZE 2
  291. #define NET80211_ELEMENT_ID_OFFSET 0
  292. #define NET80211_ELEMENT_LENGTH_OFFSET 1
  293. #define NET80211_ELEMENT_DATA_OFFSET 2
  294. //
  295. // Define the sizes for the fixed-size 802.11 information element fields.
  296. //
  297. #define NET80211_DSSS_SIZE 3
  298. //
  299. // Define the bits for 802.11 rates.
  300. //
  301. #define NET80211_RATE_BASIC 0x80
  302. #define NET80211_RATE_VALUE_MASK 0x7F
  303. #define NET80211_RATE_VALUE_SHIFT 0
  304. //
  305. // Define the BSS membership selector values encoded into the suppored rates
  306. // element.
  307. //
  308. #define NET80211_MEMBERSHIP_SELECTOR_HT_PHY 127
  309. //
  310. // Define the 802.11 authentication management frame algorithm numbers.
  311. //
  312. #define NET80211_AUTHENTICATION_ALGORITHM_OPEN 0
  313. #define NET80211_AUTHENTICATION_ALGORITHM_SHARED_KEY 1
  314. #define NET80211_AUTHENTICATION_ALGORITHM_FAST_BSS_TRANSITION 2
  315. #define NET80211_AUTHENTICATION_ALGORITHM_SAE 3
  316. //
  317. // Define the 802.11 authentication transaction sequence numbers.
  318. //
  319. #define NET80211_AUTHENTICATION_REQUEST_SEQUENCE_NUMBER 0x0001
  320. #define NET80211_AUTHENTICATION_RESPONSE_SEQUENCE_NUMBER 0x0002
  321. //
  322. // Define the 802.11 management frame status codes.
  323. //
  324. #define NET80211_STATUS_CODE_SUCCESS 0
  325. #define NET80211_STATUS_CODE_REFUSED 1
  326. //
  327. // Define the maximum SSID supported in the 802.11 SSID element.
  328. //
  329. #define NET80211_MAX_SSID_LENGTH 32
  330. //
  331. // Define the maximum number of rates allowed in the 802.11 supported rates
  332. // element.
  333. //
  334. #define NET80211_MAX_SUPPORTED_RATES 8
  335. //
  336. // Define the maximum number of rates allowed in the 802.11 extended supported
  337. // rates element.
  338. //
  339. #define NET80211_MAX_EXTENDED_SUPPORTED_RATES 255
  340. //
  341. // Define the current version for the RSN element.
  342. //
  343. #define NET80211_RSN_VERSION 1
  344. //
  345. // Define the RSN cipher suite types.
  346. //
  347. #define NET80211_CIPHER_SUITE_USE_GROUP_CIPHER 0x000FAC00
  348. #define NET80211_CIPHER_SUITE_WEP_40 0x000FAC01
  349. #define NET80211_CIPHER_SUITE_TKIP 0x000FAC02
  350. #define NET80211_CIPHER_SUITE_CCMP 0x000FAC04
  351. #define NET80211_CIPHER_SUITE_WEP_104 0x000FAC05
  352. #define NET80211_CIPHER_SUITE_BIP 0x000FAC06
  353. #define NET80211_CIPHER_SUITE_GROUP_NOT_ALLOWED 0x000FAC07
  354. //
  355. // Define the RSN AKM suite types.
  356. //
  357. #define NET80211_AKM_SUITE_8021X 0x000FAC01
  358. #define NET80211_AKM_SUITE_PSK 0x000FAC02
  359. #define NET80211_AKM_SUITE_FT_8021X 0x000FAC03
  360. #define NET80211_AKM_SUITE_FT_PSK 0x000FAC04
  361. #define NET80211_AKM_SUITE_8021X_SHA256 0x000FAC05
  362. #define NET80211_AKM_SUITE_PSK_SHA256 0x000FAC06
  363. #define NET80211_AKM_SUITE_TDLS_TPK 0x000FAC07
  364. #define NET80211_AKM_SUITE_SAE_SHA256 0x000FAC08
  365. #define NET80211_AKM_SUITE_FT_SAE_SHA256 0x000FAC09
  366. //
  367. // Define the bits for the RSN capabilities.
  368. //
  369. #define NET80211_RSN_CAPABILITY_EXTENDED_KEY_ID 0x2000
  370. #define NET80211_RSN_CAPABILITY_PBAC 0x1000
  371. #define NET80211_RSN_CAPABILITY_SPP_AMSDU_REQUIRED 0x0800
  372. #define NET80211_RSN_CAPABILITY_SPP_AMSDU_CAPABLE 0x0400
  373. #define NET80211_RSN_CAPABILITY_PEERKEY_ENABLED 0x0200
  374. #define NET80211_RSN_CAPABILITY_MFPC 0x0080
  375. #define NET80211_RSN_CAPABILITY_MFPR 0x0040
  376. #define NET80211_RSN_CAPABILITY_GTKSA_REPLAY_COUNTER_MASK 0x0030
  377. #define NET80211_RSN_CAPABILITY_GTKSA_REPLAY_COUNTER_SHIFT 4
  378. #define NET80211_RSN_CAPABILITY_PTKSA_REPLAY_COUNTER_MASK 0x000C
  379. #define NET80211_RNS_CAPABILITY_PTKSA_REPLAY_COUNTER_SHIFT 2
  380. #define NET80211_RSN_CAPABILITY_NO_PAIRWISE 0x0002
  381. #define NET80211_RSN_CAPABILITY_PREAUTHENTICATION 0x0001
  382. //
  383. // Define the length, in bytes, of an pairwise master key identifier (PMKID).
  384. //
  385. #define NET80211_RSN_PMKID_LENGTH 16
  386. //
  387. // Define the values for the RSN capability replay counter fields.
  388. //
  389. #define NET80211_RSN_REPLAY_COUNTER_1 0
  390. #define NET80211_RSN_REPLAY_COUNTER_2 1
  391. #define NET80211_RSN_REPLAY_COUNTER_4 2
  392. #define NET80211_RSN_REPLAY_COUNTER_16 3
  393. //
  394. // Define the maximum data frame body size, in bytes.
  395. //
  396. #define NET80211_MAX_DATA_FRAME_BODY_SIZE 2304
  397. //
  398. // The 802.11 rates are defined in 500Kb/s units.
  399. //
  400. #define NET80211_RATE_UNIT 500000ULL
  401. //
  402. // 802.11 times are defined in units of 1024 microseconds.
  403. //
  404. #define NET80211_TIME_UNIT 1024
  405. //
  406. // Define the flags for the CCMP header.
  407. //
  408. #define NET80211_CCMP_FLAG_KEY_ID_MASK 0xC0
  409. #define NET80211_CCMP_FLAG_KEY_ID_SHIFT 6
  410. #define NET80211_CCMP_FLAG_EXT_IV 0x20
  411. //
  412. // Define the maximum number of keys that can be in use by CCMP.
  413. //
  414. #define NET80211_CCMP_MAX_KEY_COUNT 4
  415. //
  416. // Define the size, in bytes, of the MIC appended to the end of the PDU for
  417. // CCMP encryption.
  418. //
  419. #define NET80211_CCMP_MIC_SIZE 8
  420. //
  421. // Define the size, in bytes, of the CCM length field used by CCMP encryption.
  422. //
  423. #define NET80211_CCMP_LENGTH_FIELD_SIZE 2
  424. //
  425. // Define the size of the packet number used in CCMP.
  426. //
  427. #define NET80211_CCMP_PACKET_NUMBER_SIZE 6
  428. //
  429. // Define the set of frame control bits that are carried over from the MPDU
  430. // header to the AAD. The mask is different for QoS frames.
  431. //
  432. #define NET80211_AAD_FRAME_CONTROL_DEFAULT_MASK \
  433. ~(NET80211_FRAME_CONTROL_SUBTYPE_MASK | \
  434. NET80211_FRAME_CONTROL_RETRY | \
  435. NET80211_FRAME_CONTROL_POWER_MANAGEMENT | \
  436. NET80211_FRAME_CONTROL_MORE_DATA)
  437. #define NET80211_AAD_FRAME_CONTROL_QOS_MASK \
  438. ~(NET80211_FRAME_CONTROL_SUBTYPE_MASK | \
  439. NET80211_FRAME_CONTROL_RETRY | \
  440. NET80211_FRAME_CONTROL_POWER_MANAGEMENT | \
  441. NET80211_FRAME_CONTROL_MORE_DATA | \
  442. NET80211_FRAME_CONTROL_ORDER)
  443. //
  444. // Define the portion of the sequence control field that is carried over from
  445. // the MPDU header to the AAD.
  446. //
  447. #define NET80211_AAD_SEQUENCE_CONTROL_MASK \
  448. ~(NET80211_SEQUENCE_CONTROL_SEQUENCE_NUMBER_MASK)
  449. //
  450. // Define the flags for the CCM nonce.
  451. //
  452. #define NET80211_CCM_NONCE_FLAG_MANAGEMENT 0x10
  453. #define NET80211_CCM_NONCE_FLAG_PRIORITY_MASK 0x0F
  454. #define NET80211_CCM_NONCE_FLAG_PRIORITY_SHIFT 0
  455. //
  456. // Define the maximum number of bytes supported for the CCM authentication
  457. // field.
  458. //
  459. #define NET80211_CCM_MAX_AUTHENTICATION_FIELD_SIZE 16
  460. //
  461. // Define the minimum and maximum allowed CCM length field sizes.
  462. //
  463. #define NET80211_CCM_MAX_LENGTH_FIELD_SIZE 8
  464. #define NET80211_CCM_MIN_LENGTH_FIELD_SIZE 2
  465. //
  466. // Define the bitmask of CCM flags used in the first byte of the first
  467. // encryption block.
  468. //
  469. #define NET80211_CCM_FLAG_AAD 0x40
  470. #define NET80211_CCM_FLAG_AUTHENTICATION_FIELD_MASK 0x38
  471. #define NET80211_CCM_FLAG_AUTHENTICATION_FIELD_SHIFT 3
  472. #define NET80211_CCM_FLAG_LENGTH_MASK 0x07
  473. #define NET80211_CCM_FLAG_LENGTH_SHIFT 0
  474. //
  475. // Define necessary encoding values for the CCM AAD length.
  476. //
  477. #define NET80211_CCM_AAD_MAX_SHORT_LENGTH 0xFEFF
  478. #define NET80211_CCM_AAD_LONG_ENCODING 0xFEFF
  479. //
  480. // Define the bits that describe the 802.11 networking core key flags.
  481. //
  482. #define NET80211_KEY_FLAG_CCMP 0x00000001
  483. #define NET80211_KEY_FLAG_GLOBAL 0x00000002
  484. #define NET80211_KEY_FLAG_TRANSMIT 0x00000004
  485. //
  486. // Define the data rates that define the different 802.11 modes in bits per
  487. // second.
  488. //
  489. #define NET80211_MODE_B_MAX_RATE 11000000ULL
  490. #define NET80211_MODE_G_MAX_RATE 54000000ULL
  491. //
  492. // ------------------------------------------------------ Data Type Definitions
  493. //
  494. typedef struct _NET80211_LINK NET80211_LINK, *PNET80211_LINK;
  495. /*++
  496. Structure Description:
  497. This structure defines the maximum 802.11 header that may come with a
  498. packet. Depending on the packet type, not all of this data may be present
  499. in the header.
  500. Members:
  501. FrameControl - Stores frame control bits for the packet. See
  502. NET80211_FRAME_CONTROL_* for definitions.
  503. DurationId - Stores packet duration and ID information.
  504. Address1 - Stores the destination address of the packet.
  505. Address2 - Stores the source address of the packet.
  506. Address3 - Stores a third address whose meaning depends on the packet
  507. type.
  508. SequenceControl - Stores the sequence and fragment numbers.
  509. Address4 - Stores a fourth address whose meaning depends on the packet
  510. type.
  511. QosControl - Stores quality of service information for the packet.
  512. HtControl - Stores high throughput information for the packet.
  513. --*/
  514. typedef struct _NET80211_FRAME_HEADER {
  515. USHORT FrameControl;
  516. USHORT DurationId;
  517. UCHAR Address1[NET80211_ADDRESS_SIZE];
  518. UCHAR Address2[NET80211_ADDRESS_SIZE];
  519. UCHAR Address3[NET80211_ADDRESS_SIZE];
  520. USHORT SequenceControl;
  521. UCHAR Address4[NET80211_ADDRESS_SIZE];
  522. USHORT QosControl;
  523. ULONG HtControl;
  524. } PACKED NET80211_FRAME_HEADER, *PNET80211_FRAME_HEADER;
  525. /*++
  526. Structure Description:
  527. This structure defines the header for the 802.11 data frames that a station
  528. needs to handle. In these cases, only one of the "To DS" and "From DS" bits
  529. are set. That is, it does not account for AP to AP communication or station
  530. to station communication in an ad hoc network.
  531. Members:
  532. FrameControl - Stores frame control bits for the packet. See
  533. NET80211_FRAME_CONTROL_* for definitions.
  534. DurationId - Stores packet duration and ID information.
  535. ReceiverAddress - Stores the physical address of the receiving node, which
  536. is either the station or the access point.
  537. TransmitterAddress - Stores the physical address of the transmitting node,
  538. which is either the station or the access point.
  539. SourceDestinationAddress - Stores the physical address of either the source
  540. node (if coming from the DS) or the destination node (if being sent to
  541. the DS).
  542. SequenceControl - Stores the sequence and fragment numbers.
  543. --*/
  544. typedef struct _NET80211_DATA_FRAME_HEADER {
  545. USHORT FrameControl;
  546. USHORT DurationId;
  547. UCHAR ReceiverAddress[NET80211_ADDRESS_SIZE];
  548. UCHAR TransmitterAddress[NET80211_ADDRESS_SIZE];
  549. UCHAR SourceDestinationAddress[NET80211_ADDRESS_SIZE];
  550. USHORT SequenceControl;
  551. } PACKED NET80211_DATA_FRAME_HEADER, *PNET80211_DATA_FRAME_HEADER;
  552. /*++
  553. Structure Description:
  554. This structure defines the header for 802.11 management frames.
  555. Members:
  556. FrameControl - Stores frame control bits for the packet. See
  557. NET80211_FRAME_CONTROL_* for definitions.
  558. Duration - Stores packet duration information.
  559. DestinationAddress - Stores the destination address of the packet.
  560. SourceAddressAddress - Stores the source address of the packet.
  561. Bssid - Stores a third address whose meaning depends on the packet type.
  562. SequenceControl - Stores the sequence and fragment numbers.
  563. --*/
  564. typedef struct _NET80211_MANAGEMENT_FRAME_HEADER {
  565. USHORT FrameControl;
  566. USHORT Duration;
  567. UCHAR DestinationAddress[NET80211_ADDRESS_SIZE];
  568. UCHAR SourceAddress[NET80211_ADDRESS_SIZE];
  569. UCHAR Bssid[NET80211_ADDRESS_SIZE];
  570. USHORT SequenceControl;
  571. } PACKED NET80211_MANAGEMENT_FRAME_HEADER, *PNET80211_MANAGEMENT_FRAME_HEADER;
  572. /*++
  573. Structure Description:
  574. This structure defines the 802.11 CTR with CBC-MAC Protocol (CCMP) header
  575. used on encrypted data packets.
  576. Members:
  577. PacketNumberLow - Stores the lowest two bytes of the 48-bit packet number.
  578. Reserved - Stores a reserved field.
  579. Flags - Stores a bitmask of CCMP flags. See NET80211_CCMP_FLAG_* for
  580. definitions;
  581. PacketNumberHigh - Stores the highest four bytes of the 48-bit packet
  582. number.
  583. --*/
  584. typedef struct _NET80211_CCMP_HEADER {
  585. USHORT PacketNumberLow;
  586. UCHAR Reserved;
  587. UCHAR Flags;
  588. ULONG PacketNumberHigh;
  589. } PACKED NET80211_CCMP_HEADER, *PNET80211_CCMP_HEADER;
  590. /*++
  591. Structure Description:
  592. This structure defines the base additional authentication data (AAD) used
  593. for CCMP encryption.
  594. Members:
  595. FrameControl - Stores a masked version of the frame control field from the
  596. MPDU frame control field. See NET80211_AAD_FRAME_CONTROL_MASK.
  597. Address1 - Stores the first address from the MPDU header.
  598. Address2 - Stores the second address from the MPDU header.
  599. Address3 - Stores the third address from the MPDU header.
  600. SequenceControl - Stores a masked version of the sequence control field
  601. from the MPDU frame. See NET80211_AAD_SEQUENCE_CONTROL_MASK.
  602. --*/
  603. typedef struct _NET80211_AAD {
  604. USHORT FrameControl;
  605. UCHAR Address1[NET80211_ADDRESS_SIZE];
  606. UCHAR Address2[NET80211_ADDRESS_SIZE];
  607. UCHAR Address3[NET80211_ADDRESS_SIZE];
  608. USHORT SequenceControl;
  609. } PACKED NET80211_AAD, *PNET80211_AAD;
  610. /*++
  611. Structure Description:
  612. This structure defines the CCM nonce value used during CCMP encryption.
  613. Members:
  614. Flags - Stores a bitmask of flags. See NET80211_CCM_NONCE_FLAG_* for
  615. definitions.
  616. Address2 - Stores the second address from the MPDU header.
  617. PacketNumber - Stores the packet number from the CCMP header.
  618. --*/
  619. typedef struct _NET80211_CCM_NONCE {
  620. UCHAR Flags;
  621. UCHAR Address2[NET80211_ADDRESS_SIZE];
  622. UCHAR PacketNumber[NET80211_CCMP_PACKET_NUMBER_SIZE];
  623. } PACKED NET80211_CCM_NONCE, *PNET80211_CCM_NONCE;
  624. typedef enum _NET80211_STATE {
  625. Net80211StateInvalid,
  626. Net80211StateUninitialized,
  627. Net80211StateInitialized,
  628. Net80211StateProbing,
  629. Net80211StateAuthenticating,
  630. Net80211StateAssociating,
  631. Net80211StateReassociating,
  632. Net80211StateAssociated,
  633. Net80211StateEncrypted
  634. } NET80211_STATE, *PNET80211_STATE;
  635. typedef enum _NET80211_MODE {
  636. Net80211ModeB,
  637. Net80211ModeG,
  638. Net80211ModeN
  639. } NET80211_MODE, *PNET80211_MODE;
  640. /*++
  641. Structure Description:
  642. This structure defines the set of supported 802.11 rates.
  643. Members:
  644. Count - Stores the number of valid rates in the array.
  645. Rate - Stores an array of rates supported by the device.
  646. --*/
  647. typedef struct _NET80211_RATE_INFORMATION {
  648. UCHAR Count;
  649. PUCHAR Rate;
  650. } NET80211_RATE_INFORMATION, *PNET80211_RATE_INFORMATION;
  651. /*++
  652. Structure Description:
  653. This structure defines the information required for an 802.11 device to
  654. transition to a new state.
  655. Members:
  656. Version - Stores the version number of the structure. Set this to
  657. NET80211_BSS_VERSION.
  658. Bssid - Stores the MAC address of the BSS's access point (a.k.a. the BSSID).
  659. BeaconInterval - Stores the beacon interval for the BSS to which the
  660. station is associated.
  661. Capabilities - Stores the bitmask of 802.11 capabilities for the BSS. See
  662. NET80211_CAPABILTY_FLAG_* for definitions.
  663. AssociationId - Stores the ID of the local station's association with the
  664. BSS.
  665. Timestamp - Stores the timestamp taken from the BSS access point when
  666. probing.
  667. Channel - Stores the current channel to which the device is set.
  668. Rssi - Stores the received signal strength indication value for the BSS.
  669. Mode - Stores the maximum available mode for the BSS, based on the
  670. AP and local station's rates.
  671. MaxRate - Stores the maximum supported rate shared between the BSS's AP and
  672. the local station.
  673. Rates - Stores the rates supported by the BSS.
  674. --*/
  675. typedef struct _NET80211_BSS {
  676. ULONG Version;
  677. UCHAR Bssid[NET80211_ADDRESS_SIZE];
  678. USHORT BeaconInterval;
  679. USHORT Capabilities;
  680. USHORT AssociationId;
  681. ULONGLONG Timestamp;
  682. ULONG Channel;
  683. LONG Rssi;
  684. NET80211_MODE Mode;
  685. UCHAR MaxRate;
  686. NET80211_RATE_INFORMATION Rates;
  687. } NET80211_BSS, *PNET80211_BSS;
  688. /*++
  689. Structure Description:
  690. This structure defines information about a received 802.11 packet.
  691. Members:
  692. Version - Stores the version number of the structure. SEt this to
  693. NET80211_RECEIVE_PACKET_VERSION.
  694. NetPacket - Stores a pointer to the network packet that holds the actual
  695. data.
  696. Rssi - Stores the received signal strength indication for the packet.
  697. --*/
  698. typedef struct _NET80211_RECEIVE_PACKET {
  699. ULONG Version;
  700. PNET_PACKET_BUFFER NetPacket;
  701. LONG Rssi;
  702. } NET80211_RECEIVE_PACKET, *PNET80211_RECEIVE_PACKET;
  703. typedef
  704. KSTATUS
  705. (*PNET80211_DEVICE_LINK_SEND) (
  706. PVOID DeviceContext,
  707. PNET_PACKET_LIST PacketList
  708. );
  709. /*++
  710. Routine Description:
  711. This routine sends data through the network.
  712. Arguments:
  713. DeviceContext - Supplies a pointer to the device context associated with
  714. the link down which this data is to be sent.
  715. PacketList - Supplies a pointer to a list of network packets to send. Data
  716. in these packets may be modified by this routine, but must not be used
  717. once this routine returns.
  718. Return Value:
  719. STATUS_SUCCESS if all packets were sent.
  720. STATUS_RESOURCE_IN_USE if some or all of the packets were dropped due to
  721. the hardware being backed up with too many packets to send.
  722. Other failure codes indicate that none of the packets were sent.
  723. --*/
  724. typedef
  725. KSTATUS
  726. (*PNET80211_DEVICE_LINK_GET_SET_INFORMATION) (
  727. PVOID DeviceContext,
  728. NET_LINK_INFORMATION_TYPE InformationType,
  729. PVOID Data,
  730. PUINTN DataSize,
  731. BOOL Set
  732. );
  733. /*++
  734. Routine Description:
  735. This routine gets or sets the network device layer's link information.
  736. Arguments:
  737. DeviceContext - Supplies a pointer to the device context associated with
  738. the link for which information is being set or queried.
  739. InformationType - Supplies the type of information being queried or set.
  740. Data - Supplies a pointer to the data buffer where the data is either
  741. returned for a get operation or given for a set operation.
  742. DataSize - Supplies a pointer that on input contains the size of the data
  743. buffer. On output, contains the required size of the data buffer.
  744. Set - Supplies a boolean indicating if this is a get operation (FALSE) or a
  745. set operation (TRUE).
  746. Return Value:
  747. Status code.
  748. --*/
  749. typedef
  750. VOID
  751. (*PNET80211_DEVICE_LINK_DESTROY_LINK) (
  752. PVOID DeviceContext
  753. );
  754. /*++
  755. Routine Description:
  756. This routine notifies the device layer that the 802.11 core is in the
  757. process of destroying the link and will no longer call into the device for
  758. this link. This allows the device layer to release any context that was
  759. supporting the device link interface.
  760. Arguments:
  761. DeviceContext - Supplies a pointer to the device context associated with
  762. the link being destroyed.
  763. Return Value:
  764. None.
  765. --*/
  766. typedef
  767. KSTATUS
  768. (*PNET80211_DEVICE_LINK_SET_CHANNEL) (
  769. PVOID DeviceContext,
  770. ULONG Channel
  771. );
  772. /*++
  773. Routine Description:
  774. This routine sets the 802.11 link's channel to the given value.
  775. Arguments:
  776. DeviceContext - Supplies a pointer to the device context associated with
  777. the 802.11 link whose channel is to be set.
  778. Channel - Supplies the channel to which the device should be set.
  779. Return Value:
  780. Status code.
  781. --*/
  782. typedef
  783. KSTATUS
  784. (*PNET80211_DEVICE_LINK_SET_STATE) (
  785. PVOID DeviceContext,
  786. NET80211_STATE State,
  787. PNET80211_BSS Bss
  788. );
  789. /*++
  790. Routine Description:
  791. This routine sets the 802.11 link to the given state. State information is
  792. provided to communicate the details of the 802.11 core's current state.
  793. Arguments:
  794. DeviceContext - Supplies a pointer to the device context associated with
  795. the 802.11 link whose state is to be set.
  796. State - Supplies the state to which the link is being set.
  797. Bss - Supplies an optional pointer to information on the BSS with which the
  798. link is authenticating or associating.
  799. Return Value:
  800. Status code.
  801. --*/
  802. /*++
  803. Structure Description:
  804. This structure defines the interface to a device link from the 802.11
  805. networking library.
  806. Members:
  807. Send - Stores a pointer to a function used to transmit data to the network.
  808. GetSetInformation - Supplies a pointer to a function used to get or set
  809. network link information.
  810. DestroyLink - Supplies a pointer to a function used to notify the device
  811. that the 802.11 link is no longer in use by the 802.11 core and any
  812. link interface context can be destroyed.
  813. SetChannel - Stores a pointer to a function used to set the channel.
  814. SetState - Stores a pointer to a function used to set the state.
  815. --*/
  816. typedef struct _NET80211_DEVICE_LINK_INTERFACE {
  817. PNET80211_DEVICE_LINK_SEND Send;
  818. PNET80211_DEVICE_LINK_GET_SET_INFORMATION GetSetInformation;
  819. PNET80211_DEVICE_LINK_DESTROY_LINK DestroyLink;
  820. PNET80211_DEVICE_LINK_SET_CHANNEL SetChannel;
  821. PNET80211_DEVICE_LINK_SET_STATE SetState;
  822. } NET80211_DEVICE_LINK_INTERFACE, *PNET80211_DEVICE_LINK_INTERFACE;
  823. /*++
  824. Structure Description:
  825. This structure defines characteristics about an 802.11 network link.
  826. Members:
  827. Version - Stores the version number of the structure. Set this to
  828. NET80211_LINK_PROPERTIES_VERSION.
  829. TransmitAlignment - Stores the alignment requirement for transmit buffers.
  830. Device - Stores a pointer to the physical layer device backing the link.
  831. DeviceContext - Stores a pointer to device-specific context on this link.
  832. ChecksumFlags - Stores a bitmask of flags indicating whether certain
  833. checksum features are enabled. See NET_LINK_CHECKSUM_FLAG_* for
  834. definitions.
  835. MaxChannel - Stores the maximum supported channel the 802.11 device
  836. supports.
  837. Capabilities - Stores a bitmask of 802.11 capabilities for the link. See
  838. NET80211_CAPABILITY_FLAG_* for definitions.
  839. PacketSizeInformation - Stores the packet size information that includes
  840. the maximum number of bytes that can be sent over the physical link and
  841. the header and footer sizes.
  842. MaxPhysicalAddress - Stores the maximum physical address that the network
  843. controller can access.
  844. PhysicalAddress - Stores the original primary physical address of the link.
  845. SupportedRates - Stores a pointer to the set of rates supported by the
  846. 802.11 device.
  847. Interface - Stores the list of functions used by the 802.11 networking
  848. library to call into the link.
  849. --*/
  850. typedef struct _NET80211_LINK_PROPERTIES {
  851. ULONG Version;
  852. ULONG TransmitAlignment;
  853. PDEVICE Device;
  854. PVOID DeviceContext;
  855. ULONG ChecksumFlags;
  856. ULONG MaxChannel;
  857. USHORT Capabilities;
  858. NET_PACKET_SIZE_INFORMATION PacketSizeInformation;
  859. PHYSICAL_ADDRESS MaxPhysicalAddress;
  860. NETWORK_ADDRESS PhysicalAddress;
  861. PNET80211_RATE_INFORMATION SupportedRates;
  862. NET80211_DEVICE_LINK_INTERFACE Interface;
  863. } NET80211_LINK_PROPERTIES, *PNET80211_LINK_PROPERTIES;
  864. //
  865. // -------------------------------------------------------------------- Globals
  866. //
  867. //
  868. // -------------------------------------------------------- Function Prototypes
  869. //
  870. NET80211_API
  871. KSTATUS
  872. Net80211AddLink (
  873. PNET80211_LINK_PROPERTIES Properties,
  874. PNET80211_LINK *NewLink
  875. );
  876. /*++
  877. Routine Description:
  878. This routine adds the device link to the 802.11 networking core. The device
  879. must be ready to start sending and receiving 802.11 management frames in
  880. order to establish a BSS connection.
  881. Arguments:
  882. Link - Supplies a pointer to the network link that was created for the
  883. 802.11 device by the networking core.
  884. Properties - Supplies a pointer describing the properties and interface of
  885. the 802.11 link. This memory will not be referenced after the function
  886. returns, so this may be a stack allocated structure.
  887. Return Value:
  888. Status code.
  889. --*/
  890. NET80211_API
  891. VOID
  892. Net80211RemoveLink (
  893. PNET80211_LINK Link
  894. );
  895. /*++
  896. Routine Description:
  897. This routine removes a link from the 802.11 core after its device has been
  898. removed. There may be outstanding references on the link, so the 802.11
  899. core will invoke the link destruction callback when all the references are
  900. released.
  901. Arguments:
  902. Link - Supplies a pointer to the link to destroy. The link must be all
  903. cleaned up before this routine can be called.
  904. Return Value:
  905. None.
  906. --*/
  907. NET80211_API
  908. VOID
  909. Net80211LinkAddReference (
  910. PNET80211_LINK Link
  911. );
  912. /*++
  913. Routine Description:
  914. This routine increases the reference count on a 802.11 link.
  915. Arguments:
  916. Link - Supplies a pointer to the 802.11 link whose reference count
  917. should be incremented.
  918. Return Value:
  919. None.
  920. --*/
  921. NET80211_API
  922. VOID
  923. Net80211LinkReleaseReference (
  924. PNET80211_LINK Link
  925. );
  926. /*++
  927. Routine Description:
  928. This routine decreases the reference count of a 802.11 link, and destroys
  929. the link if the reference count drops to zero.
  930. Arguments:
  931. Link - Supplies a pointer to the 802.11 link whose reference count
  932. should be decremented.
  933. Return Value:
  934. None.
  935. --*/
  936. NET80211_API
  937. VOID
  938. Net80211ProcessReceivedPacket (
  939. PNET80211_LINK Link,
  940. PNET80211_RECEIVE_PACKET Packet
  941. );
  942. /*++
  943. Routine Description:
  944. This routine is called by the low level WiFi driver to pass received
  945. packets onto the 802.11 core networking library for dispatching.
  946. Arguments:
  947. Link - Supplies a pointer to the 802.11 link that received the packet.
  948. Packet - Supplies a pointer to a structure describing the incoming packet.
  949. This structure and the network packet it contains may be used as a
  950. scratch space while this routine executes and the packet travels up the
  951. stack, but will not be accessed after this routine returns.
  952. Return Value:
  953. None. When the function returns, the memory associated with the packet may
  954. be reclaimed and reused.
  955. --*/
  956. NET80211_API
  957. KSTATUS
  958. Net80211GetSetLinkDeviceInformation (
  959. PNET80211_LINK Link,
  960. PUUID Uuid,
  961. PVOID Data,
  962. PUINTN DataSize,
  963. BOOL Set
  964. );
  965. /*++
  966. Routine Description:
  967. This routine gets or sets device information for an 802.11 link.
  968. Arguments:
  969. Link - Supplies a pointer to the 802.11 link whose device information is
  970. being retrieved or set.
  971. Uuid - Supplies a pointer to the information identifier.
  972. Data - Supplies a pointer to the data buffer.
  973. DataSize - Supplies a pointer that on input contains the size of the data
  974. buffer in bytes. On output, returns the needed size of the data buffer,
  975. even if the supplied buffer was nonexistant or too small.
  976. Set - Supplies a boolean indicating whether to get the information (FALSE)
  977. or set the information (TRUE).
  978. Return Value:
  979. STATUS_SUCCESS on success.
  980. STATUS_BUFFER_TOO_SMALL if the supplied buffer was too small.
  981. STATUS_NOT_HANDLED if the given UUID was not recognized.
  982. --*/
  983. NET80211_API
  984. KSTATUS
  985. Net80211SetKey (
  986. PNET80211_LINK Link,
  987. PUCHAR KeyValue,
  988. ULONG KeyLength,
  989. ULONG KeyFlags,
  990. ULONG KeyId
  991. );
  992. /*++
  993. Routine Description:
  994. This routine sets the given key into the given network link. The 802.11
  995. networking library makes a local copy of all parameters.
  996. Arguments:
  997. Link - Supplies a pointer to the networking link to which the keys should
  998. be added.
  999. KeyValue - Supplies a pointer to the key value.
  1000. KeyLength - Supplies the length of the key value, in bytes.
  1001. KeyFlags - Supplies a bitmask of flags to describe the key. See
  1002. NET80211_KEY_FLAG_* for definitions.
  1003. KeyId - Supplies the ID of the key negotiated between this station and its
  1004. peers and/or access point.
  1005. Return Value:
  1006. Status code.
  1007. --*/