Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Side by Side Diff: chrome/browser/chromeos/cros/native_network_constants.cc

Issue 7453051: This factors out all of the parsing code from the network library (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reducing friends to minimal set. Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/chromeos/cros/native_network_constants.h"
6
7 namespace chromeos {
8 // Format of the Carrier ID: <carrier name> (<carrier country>).
9 const char kCarrierIdFormat[] = "%s (%s)";
10
11 // Path of the default (shared) flimflam profile.
12 const char kSharedProfilePath[] = "/profile/default";
13
14 // D-Bus interface string constants.
15
16 // Flimflam manager properties.
17 const char kAvailableTechnologiesProperty[] = "AvailableTechnologies";
18 const char kEnabledTechnologiesProperty[] = "EnabledTechnologies";
19 const char kConnectedTechnologiesProperty[] = "ConnectedTechnologies";
20 const char kDefaultTechnologyProperty[] = "DefaultTechnology";
21 const char kOfflineModeProperty[] = "OfflineMode";
22 const char kActiveProfileProperty[] = "ActiveProfile";
23 const char kProfilesProperty[] = "Profiles";
24 const char kServicesProperty[] = "Services";
25 const char kServiceWatchListProperty[] = "ServiceWatchList";
26 const char kDevicesProperty[] = "Devices";
27 const char kPortalUrlProperty[] = "PortalURL";
28 const char kCheckPortalListProperty[] = "CheckPortalList";
29 const char kArpGatewayProperty[] = "ArpGateway";
30
31 // Flimflam service properties.
32 const char kSecurityProperty[] = "Security";
33 const char kPassphraseProperty[] = "Passphrase";
34 const char kIdentityProperty[] = "Identity";
35 const char kPassphraseRequiredProperty[] = "PassphraseRequired";
36 const char kSaveCredentialsProperty[] = "SaveCredentials";
37 const char kSignalStrengthProperty[] = "Strength";
38 const char kNameProperty[] = "Name";
39 const char kGuidProperty[] = "GUID";
40 const char kStateProperty[] = "State";
41 const char kTypeProperty[] = "Type";
42 const char kDeviceProperty[] = "Device";
43 const char kProfileProperty[] = "Profile";
44 const char kTechnologyFamilyProperty[] = "Cellular.Family";
45 const char kActivationStateProperty[] = "Cellular.ActivationState";
46 const char kNetworkTechnologyProperty[] = "Cellular.NetworkTechnology";
47 const char kRoamingStateProperty[] = "Cellular.RoamingState";
48 const char kOperatorNameProperty[] = "Cellular.OperatorName";
49 const char kOperatorCodeProperty[] = "Cellular.OperatorCode";
50 const char kServingOperatorProperty[] = "Cellular.ServingOperator";
51 const char kPaymentUrlProperty[] = "Cellular.OlpUrl";
52 const char kUsageUrlProperty[] = "Cellular.UsageUrl";
53 const char kCellularApnProperty[] = "Cellular.APN";
54 const char kCellularLastGoodApnProperty[] = "Cellular.LastGoodAPN";
55 const char kCellularApnListProperty[] = "Cellular.APNList";
56 const char kWifiHexSsid[] = "WiFi.HexSSID";
57 const char kWifiFrequency[] = "WiFi.Frequency";
58 const char kWifiHiddenSsid[] = "WiFi.HiddenSSID";
59 const char kWifiPhyMode[] = "WiFi.PhyMode";
60 const char kWifiAuthMode[] = "WiFi.AuthMode";
61 const char kFavoriteProperty[] = "Favorite";
62 const char kConnectableProperty[] = "Connectable";
63 const char kPriorityProperty[] = "Priority";
64 const char kAutoConnectProperty[] = "AutoConnect";
65 const char kIsActiveProperty[] = "IsActive";
66 const char kModeProperty[] = "Mode";
67 const char kErrorProperty[] = "Error";
68 const char kEntriesProperty[] = "Entries";
69 const char kProviderProperty[] = "Provider";
70 const char kHostProperty[] = "Host";
71 const char kProxyConfigProperty[] = "ProxyConfig";
72
73 // Flimflam property names for SIMLock status.
74 const char kSimLockStatusProperty[] = "Cellular.SIMLockStatus";
75 const char kSimLockTypeProperty[] = "LockType";
76 const char kSimLockRetriesLeftProperty[] = "RetriesLeft";
77
78 // Flimflam property names for Cellular.FoundNetworks.
79 const char kLongNameProperty[] = "long_name";
80 const char kStatusProperty[] = "status";
81 const char kShortNameProperty[] = "short_name";
82 const char kTechnologyProperty[] = "technology";
83 const char kNetworkIdProperty[] = "network_id";
84
85 // Flimflam SIMLock status types.
86 const char kSimLockPin[] = "sim-pin";
87 const char kSimLockPuk[] = "sim-puk";
88
89 // APN info property names.
90 const char kApnProperty[] = "apn";
91 const char kApnNetworkIdProperty[] = "network_id";
92 const char kApnUsernameProperty[] = "username";
93 const char kApnPasswordProperty[] = "password";
94 const char kApnNameProperty[] = "name";
95 const char kApnLocalizedNameProperty[] = "localized_name";
96 const char kApnLanguageProperty[] = "language";
97
98 // Operator info property names.
99 const char kOperatorNameKey[] = "name";
100 const char kOperatorCodeKey[] = "code";
101 const char kOperatorCountryKey[] = "country";
102
103 // Flimflam device info property names.
104 const char kScanningProperty[] = "Scanning";
105 const char kPoweredProperty[] = "Powered";
106 const char kNetworksProperty[] = "Networks";
107 const char kCarrierProperty[] = "Cellular.Carrier";
108 const char kCellularAllowRoamingProperty[] = "Cellular.AllowRoaming";
109 const char kHomeProviderProperty[] = "Cellular.HomeProvider";
110 const char kMeidProperty[] = "Cellular.MEID";
111 const char kImeiProperty[] = "Cellular.IMEI";
112 const char kImsiProperty[] = "Cellular.IMSI";
113 const char kEsnProperty[] = "Cellular.ESN";
114 const char kMdnProperty[] = "Cellular.MDN";
115 const char kMinProperty[] = "Cellular.MIN";
116 const char kModelIdProperty[] = "Cellular.ModelID";
117 const char kManufacturerProperty[] = "Cellular.Manufacturer";
118 const char kFirmwareRevisionProperty[] = "Cellular.FirmwareRevision";
119 const char kHardwareRevisionProperty[] = "Cellular.HardwareRevision";
120 const char kPrlVersionProperty[] = "Cellular.PRLVersion"; // (INT16)
121 const char kSelectedNetworkProperty[] = "Cellular.SelectedNetwork";
122 const char kSupportNetworkScanProperty[] = "Cellular.SupportNetworkScan";
123 const char kFoundNetworksProperty[] = "Cellular.FoundNetworks";
124
125 // Flimflam ip config property names.
126 const char kAddressProperty[] = "Address";
127 const char kPrefixlenProperty[] = "Prefixlen";
128 const char kGatewayProperty[] = "Gateway";
129 const char kNameServersProperty[] = "NameServers";
130
131 // Flimflam type options.
132 const char kTypeEthernet[] = "ethernet";
133 const char kTypeWifi[] = "wifi";
134 const char kTypeWimax[] = "wimax";
135 const char kTypeBluetooth[] = "bluetooth";
136 const char kTypeCellular[] = "cellular";
137 const char kTypeVpn[] = "vpn";
138
139 // Flimflam mode options.
140 const char kModeManaged[] = "managed";
141 const char kModeAdhoc[] = "adhoc";
142
143 // Flimflam security options.
144 const char kSecurityWpa[] = "wpa";
145 const char kSecurityWep[] = "wep";
146 const char kSecurityRsn[] = "rsn";
147 const char kSecurity8021x[] = "802_1x";
148 const char kSecurityPsk[] = "psk";
149 const char kSecurityNone[] = "none";
150
151 // Flimflam L2TPIPsec property names.
152 const char kL2tpIpsecCaCertNssProperty[] = "L2TPIPsec.CACertNSS";
153 const char kL2tpIpsecClientCertIdProperty[] = "L2TPIPsec.ClientCertID";
154 const char kL2tpIpsecClientCertSlotProp[] = "L2TPIPsec.ClientCertSlot";
155 const char kL2tpIpsecPinProperty[] = "L2TPIPsec.PIN";
156 const char kL2tpIpsecPskProperty[] = "L2TPIPsec.PSK";
157 const char kL2tpIpsecUserProperty[] = "L2TPIPsec.User";
158 const char kL2tpIpsecPasswordProperty[] = "L2TPIPsec.Password";
159
160 // Flimflam EAP property names.
161 // See src/third_party/flimflam/doc/service-api.txt.
162 const char kEapIdentityProperty[] = "EAP.Identity";
163 const char kEapMethodProperty[] = "EAP.EAP";
164 const char kEapPhase2AuthProperty[] = "EAP.InnerEAP";
165 const char kEapAnonymousIdentityProperty[] = "EAP.AnonymousIdentity";
166 const char kEapClientCertProperty[] = "EAP.ClientCert"; // path
167 const char kEapCertIdProperty[] = "EAP.CertID"; // PKCS#11 ID
168 const char kEapClientCertNssProperty[] = "EAP.ClientCertNSS"; // NSS nickname
169 const char kEapPrivateKeyProperty[] = "EAP.PrivateKey";
170 const char kEapPrivateKeyPasswordProperty[] = "EAP.PrivateKeyPassword";
171 const char kEapKeyIdProperty[] = "EAP.KeyID";
172 const char kEapCaCertProperty[] = "EAP.CACert"; // server CA cert path
173 const char kEapCaCertIdProperty[] = "EAP.CACertID"; // server CA PKCS#11 ID
174 const char kEapCaCertNssProperty[] = "EAP.CACertNSS"; // server CA NSS nickname
175 const char kEapUseSystemCasProperty[] = "EAP.UseSystemCAs";
176 const char kEapPinProperty[] = "EAP.PIN";
177 const char kEapPasswordProperty[] = "EAP.Password";
178 const char kEapKeyMgmtProperty[] = "EAP.KeyMgmt";
179
180 // Flimflam EAP method options.
181 const char kEapMethodPeap[] = "PEAP";
182 const char kEapMethodTls[] = "TLS";
183 const char kEapMethodTtls[] = "TTLS";
184 const char kEapMethodLeap[] = "LEAP";
185
186 // Flimflam EAP phase 2 auth options.
187 const char kEapPhase2AuthPeapMd5[] = "auth=MD5";
188 const char kEapPhase2AuthPeapMschap2[] = "auth=MSCHAPV2";
189 const char kEapPhase2AuthTtlsMd5[] = "autheap=MD5";
190 const char kEapPhase2AuthTtlsMschapV2[] = "autheap=MSCHAPV2";
191 const char kEapPhase2AuthTtlsMschap[] = "autheap=MSCHAP";
192 const char kEapPhase2AuthTtlsPap[] = "autheap=PAP";
193 const char kEapPhase2AuthTtlsChap[] = "autheap=CHAP";
194
195 // Flimflam VPN provider types.
196 const char kProviderL2tpIpsec[] = "l2tpipsec";
197 const char kProviderOpenVpn[] = "openvpn";
198
199 // Flimflam state options.
200 const char kStateIdle[] = "idle";
201 const char kStateCarrier[] = "carrier";
202 const char kStateAssociation[] = "association";
203 const char kStateConfiguration[] = "configuration";
204 const char kStateReady[] = "ready";
205 const char kStatePortal[] = "portal";
206 const char kStateOnline[] = "online";
207 const char kStateDisconnect[] = "disconnect";
208 const char kStateFailure[] = "failure";
209 const char kStateActivationFailure[] = "activation-failure";
210
211 // Flimflam network technology options.
212 const char kNetworkTechnology1Xrtt[] = "1xRTT";
213 const char kNetworkTechnologyEvdo[] = "EVDO";
214 const char kNetworkTechnologyGprs[] = "GPRS";
215 const char kNetworkTechnologyEdge[] = "EDGE";
216 const char kNetworkTechnologyUmts[] = "UMTS";
217 const char kNetworkTechnologyHspa[] = "HSPA";
218 const char kNetworkTechnologyHspaPlus[] = "HSPA+";
219 const char kNetworkTechnologyLte[] = "LTE";
220 const char kNetworkTechnologyLteAdvanced[] = "LTE Advanced";
221 const char kNetworkTechnologyGsm[] = "GSM";
222
223 // Flimflam roaming state options
224 const char kRoamingStateHome[] = "home";
225 const char kRoamingStateRoaming[] = "roaming";
226 const char kRoamingStateUnknown[] = "unknown";
227
228 // Flimflam activation state options
229 const char kActivationStateActivated[] = "activated";
230 const char kActivationStateActivating[] = "activating";
231 const char kActivationStateNotActivated[] = "not-activated";
232 const char kActivationStatePartiallyActivated[] = "partially-activated";
233 const char kActivationStateUnknown[] = "unknown";
234
235 // FlimFlam technology family options
236 const char kTechnologyFamilyCdma[] = "CDMA";
237 const char kTechnologyFamilyGsm[] = "GSM";
238
239 // Flimflam error options.
240 const char kErrorOutOfRange[] = "out-of-range";
241 const char kErrorPinMissing[] = "pin-missing";
242 const char kErrorDhcpFailed[] = "dhcp-failed";
243 const char kErrorConnectFailed[] = "connect-failed";
244 const char kErrorBadPassphrase[] = "bad-passphrase";
245 const char kErrorBadWepKey[] = "bad-wepkey";
246 const char kErrorActivationFailed[] = "activation-failed";
247 const char kErrorNeedEvdo[] = "need-evdo";
248 const char kErrorNeedHomeNetwork[] = "need-home-network";
249 const char kErrorOtaspFailed[] = "otasp-failed";
250 const char kErrorAaaFailed[] = "aaa-failed";
251 const char kErrorInternal[] = "internal-error";
252 const char kErrorDnsLookupFailed[] = "dns-lookup-failed";
253 const char kErrorHttpGetFailed[] = "http-get-failed";
254
255 // Flimflam error messages.
256 const char kErrorPassphraseRequiredMsg[] = "Passphrase required";
257 const char kErrorIncorrectPinMsg[] = "org.chromium.flimflam.Error.IncorrectPin";
258 const char kErrorPinBlockedMsg[] = "org.chromium.flimflam.Error.PinBlocked";
259 const char kErrorPinRequiredMsg[] = "org.chromium.flimflam.Error.PinRequired";
260
261 const char kUnknownString[] = "UNKNOWN";
262
263 ////////////////////////////////////////////////////////////////////////////
264
265 const char* ConnectionTypeToString(ConnectionType type) {
266 switch (type) {
267 case TYPE_UNKNOWN:
268 break;
269 case TYPE_ETHERNET:
270 return kTypeEthernet;
271 case TYPE_WIFI:
272 return kTypeWifi;
273 case TYPE_WIMAX:
274 return kTypeWimax;
275 case TYPE_BLUETOOTH:
276 return kTypeBluetooth;
277 case TYPE_CELLULAR:
278 return kTypeCellular;
279 case TYPE_VPN:
280 return kTypeVpn;
281 }
282 LOG(ERROR) << "ConnectionTypeToString called with unknown type: " << type;
283 return kUnknownString;
284 }
285
286 const char* SecurityToString(ConnectionSecurity security) {
287 switch (security) {
288 case SECURITY_NONE:
289 return kSecurityNone;
290 case SECURITY_WEP:
291 return kSecurityWep;
292 case SECURITY_WPA:
293 return kSecurityWpa;
294 case SECURITY_RSN:
295 return kSecurityRsn;
296 case SECURITY_8021X:
297 return kSecurity8021x;
298 case SECURITY_PSK:
299 return kSecurityPsk;
300 case SECURITY_UNKNOWN:
301 break;
302 }
303 LOG(ERROR) << "SecurityToString called with unknown type: " << security;
304 return kUnknownString;
305 }
306
307 const char* ProviderTypeToString(ProviderType type) {
308 switch (type) {
309 case PROVIDER_TYPE_L2TP_IPSEC_PSK:
310 case PROVIDER_TYPE_L2TP_IPSEC_USER_CERT:
311 return kProviderL2tpIpsec;
312 case PROVIDER_TYPE_OPEN_VPN:
313 return kProviderOpenVpn;
314 case PROVIDER_TYPE_MAX:
315 break;
316 }
317 LOG(ERROR) << "ProviderTypeToString called with unknown type: " << type;
318 return kUnknownString;
319 }
320
321 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/cros/native_network_constants.h ('k') | chrome/browser/chromeos/cros/native_network_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698