1 // 2 // Copyright (C) 2012 The Android Open Source Project 3 // 4 // Licensed under the Apache License, Version 2.0 (the "License"); 5 // you may not use this file except in compliance with the License. 6 // You may obtain a copy of the License at 7 // 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unless required by applicable law or agreed to in writing, software 11 // distributed under the License is distributed on an "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 // 16 17 #ifndef SHILL_SUPPLICANT_WPA_SUPPLICANT_H_ 18 #define SHILL_SUPPLICANT_WPA_SUPPLICANT_H_ 19 20 #include <map> 21 #include <string> 22 #include <vector> 23 24 #include "shill/key_value_store.h" 25 26 namespace shill { 27 28 class WPASupplicant { 29 public: 30 static const char kBSSPropertyBSSID[]; 31 static const char kBSSPropertyFrequency[]; 32 static const char kBSSPropertyIEs[]; 33 static const char kBSSPropertyMode[]; 34 static const char kBSSPropertyRates[]; 35 static const char kBSSPropertySSID[]; 36 static const char kBSSPropertySignal[]; 37 static const char kCaPath[]; 38 static const char kCurrentBSSNull[]; 39 static const char kDBusAddr[]; 40 static const char kDBusPath[]; 41 static const char kDebugLevelDebug[]; 42 static const char kDebugLevelError[]; 43 static const char kDebugLevelExcessive[]; 44 static const char kDebugLevelInfo[]; 45 static const char kDebugLevelMsgDump[]; 46 static const char kDebugLevelWarning[]; 47 static const char kDriverNL80211[]; 48 static const char kDriverWired[]; 49 static const char kEAPParameterAlertUnknownCA[]; 50 static const char kEAPParameterFailure[]; 51 static const char kEAPParameterSuccess[]; 52 static const char kEAPRequestedParameterPIN[]; 53 static const char kEAPStatusAcceptProposedMethod[]; 54 static const char kEAPStatusCompletion[]; 55 static const char kEAPStatusLocalTLSAlert[]; 56 static const char kEAPStatusParameterNeeded[]; 57 static const char kEAPStatusRemoteCertificateVerification[]; 58 static const char kEAPStatusRemoteTLSAlert[]; 59 static const char kEAPStatusStarted[]; 60 static const char kEnginePKCS11[]; 61 static const char kErrorNetworkUnknown[]; 62 static const char kErrorInterfaceExists[]; 63 static const char kInterfacePropertyConfigFile[]; 64 static const char kInterfacePropertyCurrentBSS[]; 65 static const char kInterfacePropertyDepth[]; 66 static const char kInterfacePropertyDisconnectReason[]; 67 static const char kInterfacePropertyDriver[]; 68 static const char kInterfacePropertyName[]; 69 static const char kInterfacePropertyState[]; 70 static const char kInterfacePropertySubject[]; 71 static const char kInterfaceState4WayHandshake[]; 72 static const char kInterfaceStateAssociated[]; 73 static const char kInterfaceStateAssociating[]; 74 static const char kInterfaceStateAuthenticating[]; 75 static const char kInterfaceStateCompleted[]; 76 static const char kInterfaceStateDisconnected[]; 77 static const char kInterfaceStateGroupHandshake[]; 78 static const char kInterfaceStateInactive[]; 79 static const char kInterfaceStateScanning[]; 80 static const char kKeyManagementIeee8021X[]; 81 static const char kKeyManagementMethodSuffixEAP[]; 82 static const char kKeyManagementMethodSuffixPSK[]; 83 static const char kKeyModeNone[]; 84 static const char kNetworkBgscanMethodLearn[]; 85 // None is not a real method name, but we interpret 'none' as a request that 86 // no background scan parameter should be supplied to wpa_supplicant. 87 static const char kNetworkBgscanMethodNone[]; 88 static const char kNetworkBgscanMethodSimple[]; 89 static const char kNetworkModeInfrastructure[]; 90 static const char kNetworkModeAdHoc[]; 91 static const char kNetworkModeAccessPoint[]; 92 static const char kNetworkPropertyBgscan[]; 93 static const char kNetworkPropertyCaPath[]; 94 static const char kNetworkPropertyDisableVHT[]; 95 static const char kNetworkPropertyEapKeyManagement[]; 96 static const char kNetworkPropertyEapIdentity[]; 97 static const char kNetworkPropertyEapEap[]; 98 static const char kNetworkPropertyEapInnerEap[]; 99 static const char kNetworkPropertyEapAnonymousIdentity[]; 100 static const char kNetworkPropertyEapClientCert[]; 101 static const char kNetworkPropertyEapPrivateKey[]; 102 static const char kNetworkPropertyEapPrivateKeyPassword[]; 103 static const char kNetworkPropertyEapCaCert[]; 104 static const char kNetworkPropertyEapCaPassword[]; 105 static const char kNetworkPropertyEapCertId[]; 106 static const char kNetworkPropertyEapKeyId[]; 107 static const char kNetworkPropertyEapCaCertId[]; 108 static const char kNetworkPropertyEapPin[]; 109 static const char kNetworkPropertyEapProactiveKeyCaching[]; 110 static const char kNetworkPropertyEapSubjectMatch[]; 111 static const char kNetworkPropertyEapolFlags[]; 112 static const char kNetworkPropertyEngine[]; 113 static const char kNetworkPropertyEngineId[]; 114 static const char kNetworkPropertyFrequency[]; 115 static const char kNetworkPropertyIeee80211w[]; 116 static const char kNetworkPropertyMode[]; 117 static const char kNetworkPropertySSID[]; 118 static const char kNetworkPropertyScanSSID[]; 119 // TODO(quiche): Make the naming scheme more consistent, by adding the 120 // object type to the property names below. (crbug.com/206642) 121 static const char kPropertyAuthAlg[]; 122 static const char kPropertyBSSID[]; 123 static const char kPropertyMode[]; 124 static const char kPropertyPreSharedKey[]; 125 static const char kPropertyPrivacy[]; 126 static const char kPropertyRSN[]; 127 static const char kPropertyScanSSIDs[]; 128 static const char kPropertyScanType[]; 129 static const char kPropertySecurityProtocol[]; 130 static const char kPropertySignal[]; 131 static const char kPropertyWEPKey[]; 132 static const char kPropertyWEPTxKeyIndex[]; 133 static const char kPropertyWPA[]; 134 static const char kScanTypeActive[]; 135 static const char kSecurityAuthAlg[]; 136 static const char kSecurityMethodPropertyKeyManagement[]; 137 static const char kSecurityModeRSN[]; 138 static const char kSecurityModeWPA[]; 139 static const char kTDLSStateConnected[]; 140 static const char kTDLSStateDisabled[]; 141 static const char kTDLSStatePeerDoesNotExist[]; 142 static const char kTDLSStatePeerNotConnected[]; 143 144 static const uint32_t kDefaultEngine; 145 static const uint32_t kNetworkIeee80211wDisabled; 146 static const uint32_t kNetworkIeee80211wEnabled; 147 static const uint32_t kNetworkIeee80211wRequired; 148 static const uint32_t kNetworkModeInfrastructureInt; 149 static const uint32_t kNetworkModeAdHocInt; 150 static const uint32_t kNetworkModeAccessPointInt; 151 static const uint32_t kScanMaxSSIDsPerScan; 152 153 static const uint32_t kProactiveKeyCachingDisabled; 154 static const uint32_t kProactiveKeyCachingEnabled; 155 156 static const char kSupplicantConfPath[]; 157 158 // Retrieve the |subject| and |depth| of an a remote certifying entity, 159 // as contained the the |properties| to a Certification event from 160 // wpa_supplicant. Returns true if an |subject| and |depth| were 161 // extracted successfully, false otherwise. 162 static bool ExtractRemoteCertification(const KeyValueStore& properties, 163 std::string* subject, 164 uint32_t* depth); 165 }; 166 167 } // namespace shill 168 169 #endif // SHILL_SUPPLICANT_WPA_SUPPLICANT_H_ 170