Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
mukesh agrawal | 7a4e400 | 2011-09-06 11:26:05 -0700 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef SHILL_IEEE80211_H |
| 6 | #define SHILL_IEEE80211_H |
| 7 | |
| 8 | namespace shill { |
| 9 | |
| 10 | namespace IEEE_80211 { |
Thieu Le | 1df7f4e | 2012-02-10 15:21:45 -0800 | [diff] [blame] | 11 | const uint8_t kElemIdErp = 42; |
| 12 | const uint8_t kElemIdHTCap = 45; |
| 13 | const uint8_t kElemIdHTInfo = 61; |
Paul Stewart | 72b2fdc | 2012-06-02 08:58:51 -0700 | [diff] [blame] | 14 | const uint8_t kElemIdVendor = 221; |
Thieu Le | 1df7f4e | 2012-02-10 15:21:45 -0800 | [diff] [blame] | 15 | |
mukesh agrawal | 7a4e400 | 2011-09-06 11:26:05 -0700 | [diff] [blame] | 16 | const unsigned int kMaxSSIDLen = 32; |
| 17 | |
| 18 | const unsigned int kWEP40AsciiLen = 5; |
| 19 | const unsigned int kWEP40HexLen = 10; |
| 20 | const unsigned int kWEP104AsciiLen = 13; |
| 21 | const unsigned int kWEP104HexLen = 26; |
mukesh agrawal | 8ede052 | 2011-10-03 14:57:44 -0700 | [diff] [blame] | 22 | |
| 23 | const unsigned int kWPAAsciiMinLen = 8; |
| 24 | const unsigned int kWPAAsciiMaxLen = 63; |
| 25 | const unsigned int kWPAHexLen = 64; |
Paul Stewart | 72b2fdc | 2012-06-02 08:58:51 -0700 | [diff] [blame] | 26 | |
| 27 | const uint32_t kOUIVendorEpigram = 0x00904c; |
| 28 | const uint32_t kOUIVendorMicrosoft = 0x0050f2; |
| 29 | |
| 30 | const uint8_t kOUIMicrosoftWPS = 4; |
| 31 | const uint16_t kWPSElementManufacturer = 0x1021; |
| 32 | const uint16_t kWPSElementModelName = 0x1023; |
| 33 | const uint16_t kWPSElementModelNumber = 0x1024; |
| 34 | const uint16_t kWPSElementDeviceName = 0x1011; |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 35 | |
| 36 | // This structure is incomplete. Fields will be added as necessary. |
| 37 | // |
| 38 | // NOTE: the uint16_t stuff is in little-endian format so conversions are |
| 39 | // required. |
| 40 | struct ieee80211_frame { |
| 41 | uint16_t frame_control; |
| 42 | uint16_t duration_usec; |
| 43 | uint8_t destination_mac[6]; |
| 44 | uint8_t source_mac[6]; |
| 45 | uint8_t address[6]; |
| 46 | uint16_t sequence_control; |
| 47 | union { |
| 48 | struct { |
| 49 | uint16_t reserved_1; |
| 50 | uint16_t reserved_2; |
| 51 | uint16_t status_code; |
| 52 | } authentiate_message; |
| 53 | struct { |
| 54 | uint16_t reason_code; |
| 55 | } deauthentiate_message; |
| 56 | struct { |
| 57 | uint16_t reserved_1; |
| 58 | uint16_t status_code; |
| 59 | } associate_response; |
| 60 | } u; |
mukesh agrawal | 7a4e400 | 2011-09-06 11:26:05 -0700 | [diff] [blame] | 61 | }; |
| 62 | |
Wade Guthrie | 64b4c14 | 2012-08-20 15:21:01 -0700 | [diff] [blame] | 63 | // Status/reason code returned by nl80211 messages: Authenticate, |
| 64 | // Deauthenticate, Associate, and Reassociate. |
Wade Guthrie | d4977f2 | 2012-08-22 12:37:54 -0700 | [diff] [blame] | 65 | enum WiFiReasonCode { |
| 66 | // 0 is reserved. |
| 67 | kReasonCodeUnspecified = 1, |
| 68 | kReasonCodePreviousAuthenticationInvalid = 2, |
| 69 | kReasonCodeSenderHasLeft = 3, |
| 70 | kReasonCodeInactivity = 4, |
| 71 | kReasonCodeTooManySTAs = 5, |
| 72 | kReasonCodeNonAuthenticated = 6, |
| 73 | kReasonCodeNonAssociated = 7, |
| 74 | kReasonCodeDisassociatedHasLeft = 8, |
| 75 | kReasonCodeReassociationNotAuthenticated = 9, |
| 76 | kReasonCodeUnacceptablePowerCapability = 10, |
| 77 | kReasonCodeUnacceptableSupportedChannelInfo = 11, |
| 78 | // 12 is reserved. |
| 79 | kReasonCodeInvalidInfoElement = 13, |
| 80 | kReasonCodeMICFailure = 14, |
| 81 | kReasonCode4WayTimeout = 15, |
| 82 | kReasonCodeGroupKeyHandshakeTimeout = 16, |
| 83 | kReasonCodeDifferenIE = 17, |
| 84 | kReasonCodeGroupCipherInvalid = 18, |
| 85 | kReasonCodePairwiseCipherInvalid = 19, |
| 86 | kReasonCodeAkmpInvalid = 20, |
| 87 | kReasonCodeUnsupportedRsnIeVersion = 21, |
| 88 | kReasonCodeInvalidRsnIeCaps = 22, |
| 89 | kReasonCode8021XAuth = 23, |
| 90 | kReasonCodeCipherSuiteRejected = 24, |
| 91 | // 25-31 are reserved. |
| 92 | kReasonCodeUnspecifiedQoS = 32, |
| 93 | kReasonCodeQoSBandwidth = 33, |
| 94 | kReasonCodeiPoorConditions = 34, |
| 95 | kReasonCodeOutsideTxop = 35, |
| 96 | kReasonCodeStaLeaving = 36, |
| 97 | kReasonCodeUnacceptableMechanism = 37, |
| 98 | kReasonCodeSetupRequired = 38, |
| 99 | kReasonCodeTimeout = 39, |
| 100 | kReasonCodeCipherSuiteNotSupported = 45, |
| 101 | kReasonCodeMax, |
| 102 | kReasonCodeInvalid = UINT16_MAX |
Wade Guthrie | 64b4c14 | 2012-08-20 15:21:01 -0700 | [diff] [blame] | 103 | }; |
| 104 | |
Wade Guthrie | d4977f2 | 2012-08-22 12:37:54 -0700 | [diff] [blame] | 105 | enum WiFiStatusCode { |
| 106 | kStatusCodeSuccessful = 0, |
| 107 | kStatusCodeFailure = 1, |
| 108 | // 2-9 are reserved. |
| 109 | kStatusCodeAllCapabilitiesNotSupported = 10, |
| 110 | kStatusCodeCantConfirmAssociation = 11, |
| 111 | kStatusCodeAssociationDenied = 12, |
| 112 | kStatusCodeAuthenticationUnsupported = 13, |
| 113 | kStatusCodeOutOfSequence = 14, |
| 114 | kStatusCodeChallengeFailure = 15, |
| 115 | kStatusCodeFrameTimeout = 16, |
| 116 | kStatusCodeMaxSta = 17, |
| 117 | kStatusCodeDataRateUnsupported = 18, |
| 118 | kStatusCodeShortPreambleUnsupported = 19, |
| 119 | kStatusCodePbccUnsupported = 20, |
| 120 | kStatusCodeChannelAgilityUnsupported = 21, |
| 121 | kStatusCodeNeedSpectrumManagement = 22, |
| 122 | kStatusCodeUnacceptablePowerCapability = 23, |
| 123 | kStatusCodeUnacceptableSupportedChannelInfo = 24, |
| 124 | kStatusCodeShortTimeSlotRequired = 25, |
| 125 | kStatusCodeDssOfdmRequired = 26, |
| 126 | // 27-31 are reserved. |
| 127 | kStatusCodeQosFailure = 32, |
| 128 | kStatusCodeInsufficientBandwithForQsta = 33, |
| 129 | kStatusCodePoorConditions = 34, |
| 130 | kStatusCodeQosNotSupported = 35, |
| 131 | // 36 is reserved. |
| 132 | kStatusCodeDeclined = 37, |
| 133 | kStatusCodeInvalidParameterValues = 38, |
| 134 | kStatusCodeCannotBeHonored = 39, |
| 135 | kStatusCodeInvalidInfoElement = 40, |
| 136 | kStatusCodeGroupCipherInvalid = 41, |
| 137 | kStatusCodePairwiseCipherInvalid = 42, |
| 138 | kStatusCodeAkmpInvalid = 43, |
| 139 | kStatusCodeUnsupportedRsnIeVersion = 44, |
| 140 | kStatusCodeInvalidRsnIeCaps = 45, |
| 141 | kStatusCodeCipherSuiteRejected = 46, |
| 142 | kStatusCodeTsDelayNotMet = 47, |
| 143 | kStatusCodeDirectLinkIllegal = 48, |
| 144 | kStatusCodeStaNotInBss = 49, |
| 145 | kStatusCodeStaNotInQsta = 50, |
| 146 | kStatusCodeExcessiveListenInterval = 51, |
| 147 | kStatusCodeMax, |
| 148 | kStatusCodeInvalid = UINT16_MAX |
| 149 | }; |
| 150 | |
| 151 | } // namespace IEEE_80211 |
Wade Guthrie | 0d43853 | 2012-05-18 14:18:50 -0700 | [diff] [blame] | 152 | |
mukesh agrawal | 7a4e400 | 2011-09-06 11:26:05 -0700 | [diff] [blame] | 153 | } // namespace shill |
| 154 | |
| 155 | #endif // SHILL_IEEE_80211_H |