blob: 78260e94330098f3125f235b763755ab175b068e [file] [log] [blame]
mukesh agrawal4d0401c2012-01-06 16:05:31 -08001// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
mukesh agrawal6e277772011-09-29 15:04:23 -07002// 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_WPA_SUPPLICANT_H
6#define SHILL_WPA_SUPPLICANT_H
7
Paul Stewart0654ece2013-03-26 15:21:26 -07008#include <map>
9#include <string>
10#include <vector>
11
mukesh agrawal6e277772011-09-29 15:04:23 -070012#include <base/basictypes.h>
Paul Stewart0654ece2013-03-26 15:21:26 -070013#include <dbus-c++/dbus.h>
mukesh agrawal6e277772011-09-29 15:04:23 -070014
15namespace shill {
16
Paul Stewart0654ece2013-03-26 15:21:26 -070017class CertificateFile;
18struct EapCredentials;
19class NSS;
20
21class WPASupplicant {
22 public:
23 static const char kBSSPropertyBSSID[];
24 static const char kBSSPropertyFrequency[];
25 static const char kBSSPropertyIEs[];
26 static const char kBSSPropertyMode[];
27 static const char kBSSPropertyRates[];
28 static const char kBSSPropertySSID[];
29 static const char kBSSPropertySignal[];
30 static const char kCaPath[];
31 static const char kCurrentBSSNull[];
32 static const char kDBusAddr[];
33 static const char kDBusPath[];
34 static const char kDebugLevelDebug[];
35 static const char kDebugLevelError[];
36 static const char kDebugLevelExcessive[];
37 static const char kDebugLevelInfo[];
38 static const char kDebugLevelMsgDump[];
39 static const char kDebugLevelWarning[];
40 static const char kDriverNL80211[];
Paul Stewart196f50f2013-03-27 18:02:11 -070041 static const char kDriverWired[];
Paul Stewart0654ece2013-03-26 15:21:26 -070042 static const char kEAPParameterAlertUnknownCA[];
43 static const char kEAPParameterFailure[];
44 static const char kEAPParameterSuccess[];
45 static const char kEAPStatusAcceptProposedMethod[];
46 static const char kEAPStatusCompletion[];
47 static const char kEAPStatusLocalTLSAlert[];
48 static const char kEAPStatusParameterNeeded[];
49 static const char kEAPStatusRemoteCertificateVerification[];
50 static const char kEAPStatusRemoteTLSAlert[];
51 static const char kEAPStatusStarted[];
52 static const char kEnginePKCS11[];
53 static const char kErrorNetworkUnknown[];
54 static const char kErrorInterfaceExists[];
55 static const char kInterfacePropertyConfigFile[];
56 static const char kInterfacePropertyCurrentBSS[];
57 static const char kInterfacePropertyDepth[];
58 static const char kInterfacePropertyDriver[];
59 static const char kInterfacePropertyName[];
60 static const char kInterfacePropertyState[];
61 static const char kInterfacePropertySubject[];
62 static const char kInterfaceState4WayHandshake[];
63 static const char kInterfaceStateAssociated[];
64 static const char kInterfaceStateAssociating[];
65 static const char kInterfaceStateAuthenticating[];
66 static const char kInterfaceStateCompleted[];
67 static const char kInterfaceStateDisconnected[];
68 static const char kInterfaceStateGroupHandshake[];
69 static const char kInterfaceStateInactive[];
70 static const char kInterfaceStateScanning[];
Paul Stewart9413bcc2013-04-04 16:12:43 -070071 static const char kKeyManagementIeee8021X[];
Paul Stewart0654ece2013-03-26 15:21:26 -070072 static const char kKeyManagementMethodSuffixEAP[];
73 static const char kKeyManagementMethodSuffixPSK[];
74 static const char kKeyModeNone[];
75 static const char kNetworkBgscanMethodLearn[];
Christopher Wileya998df22012-07-11 15:14:55 -070076// None is not a real method name, but we interpret 'none' as a request that
77// no background scan parameter should be supplied to wpa_supplicant.
Paul Stewart0654ece2013-03-26 15:21:26 -070078 static const char kNetworkBgscanMethodNone[];
79 static const char kNetworkBgscanMethodSimple[];
80 static const char kNetworkModeInfrastructure[];
81 static const char kNetworkModeAdHoc[];
82 static const char kNetworkModeAccessPoint[];
83 static const char kNetworkPropertyBgscan[];
84 static const char kNetworkPropertyCaPath[];
85 static const char kNetworkPropertyEapKeyManagement[];
86 static const char kNetworkPropertyEapIdentity[];
87 static const char kNetworkPropertyEapEap[];
88 static const char kNetworkPropertyEapInnerEap[];
89 static const char kNetworkPropertyEapAnonymousIdentity[];
90 static const char kNetworkPropertyEapClientCert[];
91 static const char kNetworkPropertyEapPrivateKey[];
92 static const char kNetworkPropertyEapPrivateKeyPassword[];
93 static const char kNetworkPropertyEapCaCert[];
94 static const char kNetworkPropertyEapCaPassword[];
95 static const char kNetworkPropertyEapCertId[];
96 static const char kNetworkPropertyEapKeyId[];
97 static const char kNetworkPropertyEapCaCertId[];
98 static const char kNetworkPropertyEapPin[];
99 static const char kNetworkPropertyEapSubjectMatch[];
Paul Stewart9413bcc2013-04-04 16:12:43 -0700100 static const char kNetworkPropertyEapolFlags[];
Paul Stewart0654ece2013-03-26 15:21:26 -0700101 static const char kNetworkPropertyEngine[];
102 static const char kNetworkPropertyEngineId[];
103 static const char kNetworkPropertyFrequency[];
104 static const char kNetworkPropertyIeee80211w[];
105 static const char kNetworkPropertyMode[];
106 static const char kNetworkPropertySSID[];
107 static const char kNetworkPropertyScanSSID[];
mukesh agrawal64896322011-12-01 01:13:10 +0000108// TODO(quiche): Make the naming scheme more consistent, by adding the
109// object type to the property names below. (crosbug.com/23656)
Paul Stewart0654ece2013-03-26 15:21:26 -0700110 static const char kPropertyAuthAlg[];
111 static const char kPropertyBSSID[];
112 static const char kPropertyMode[];
113 static const char kPropertyPreSharedKey[];
114 static const char kPropertyPrivacy[];
115 static const char kPropertyRSN[];
116 static const char kPropertyScanSSIDs[];
117 static const char kPropertyScanType[];
118 static const char kPropertySecurityProtocol[];
119 static const char kPropertySignal[];
120 static const char kPropertyWEPKey[];
121 static const char kPropertyWEPTxKeyIndex[];
122 static const char kPropertyWPA[];
123 static const char kScanTypeActive[];
124 static const char kSecurityAuthAlg[];
125 static const char kSecurityMethodPropertyKeyManagement[];
126 static const char kSecurityModeRSN[];
127 static const char kSecurityModeWPA[];
mukesh agrawal6e277772011-09-29 15:04:23 -0700128
Paul Stewart0654ece2013-03-26 15:21:26 -0700129 static const uint32_t kDefaultEngine;
130 static const uint32_t kNetworkIeee80211wDisabled;
131 static const uint32_t kNetworkIeee80211wEnabled;
132 static const uint32_t kNetworkIeee80211wRequired;
133 static const uint32_t kNetworkModeInfrastructureInt;
134 static const uint32_t kNetworkModeAdHocInt;
135 static const uint32_t kNetworkModeAccessPointInt;
136 static const uint32_t kScanMaxSSIDsPerScan;
137
Paul Stewart196f50f2013-03-27 18:02:11 -0700138 static const char kSupplicantConfPath[];
139
Paul Stewart0654ece2013-03-26 15:21:26 -0700140 // Populate the wpa_supplicant DBus parameter map |params| with the
141 // credentials in |eap|. To do so, this function may use |certificate_file|
142 // or |nss| to export CA certificates to be passed to wpa_supplicant.
143 static void Populate8021xProperties(
144 const EapCredentials &eap, CertificateFile *certificate_file,
145 NSS *nss, const std::vector<char> nss_identifier,
146 std::map<std::string, DBus::Variant> *params);
Paul Stewart735eab52013-03-29 09:19:23 -0700147
148 // Retrieve the |subject| and |depth| of an a remote certifying entity,
149 // as contained the the |properties| to a Certification event from
150 // wpa_supplicant. Returns true if an |subject| and |depth| were
151 // extracted successfully, false otherwise.
152 static bool ExtractRemoteCertification(
153 const std::map<std::string, DBus::Variant> &properties,
154 std::string *subject, uint32 *depth);
mukesh agrawal6e277772011-09-29 15:04:23 -0700155};
156
157} // namespace shill
158
159#endif // SHILL_WPA_SUPPLICANT_H