OLD | NEW |
1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROMEOS_NETWORK_H_ | 5 #ifndef CHROMEOS_NETWORK_H_ |
6 #define CHROMEOS_NETWORK_H_ | 6 #define CHROMEOS_NETWORK_H_ |
7 | 7 |
8 #include <base/basictypes.h> | 8 #include <base/basictypes.h> |
9 #include <base/logging.h> | 9 #include <base/logging.h> |
10 | 10 |
11 class Value; | 11 class Value; |
12 | 12 |
13 namespace chromeos { // NOLINT | 13 namespace chromeos { // NOLINT |
14 | 14 |
15 | 15 |
16 // Connection enums (see flimflam/include/service.h) | |
17 enum ConnectionType { | |
18 TYPE_UNKNOWN = 0, | |
19 TYPE_ETHERNET = 1, | |
20 TYPE_WIFI = 2, | |
21 TYPE_WIMAX = 3, | |
22 TYPE_BLUETOOTH = 4, | |
23 TYPE_CELLULAR = 5, | |
24 }; | |
25 | |
26 enum ConnectionMode { | |
27 MODE_UNKNOWN = 0, | |
28 MODE_MANAGED = 1, | |
29 MODE_ADHOC = 2, | |
30 }; | |
31 | |
32 enum ConnectionSecurity { | |
33 SECURITY_UNKNOWN = 0, | |
34 SECURITY_NONE = 1, | |
35 SECURITY_WEP = 2, | |
36 SECURITY_WPA = 3, | |
37 SECURITY_RSN = 4, | |
38 SECURITY_8021X = 5, | |
39 }; | |
40 | |
41 enum ConnectionState { | |
42 STATE_UNKNOWN = 0, | |
43 STATE_IDLE = 1, | |
44 STATE_CARRIER = 2, | |
45 STATE_ASSOCIATION = 3, | |
46 STATE_CONFIGURATION = 4, | |
47 STATE_READY = 5, | |
48 STATE_DISCONNECT = 6, | |
49 STATE_FAILURE = 7, | |
50 STATE_ACTIVATION_FAILURE = 8 | |
51 }; | |
52 | |
53 enum ConnectivityState { | |
54 CONN_STATE_UNKNOWN = 0, | |
55 CONN_STATE_UNRESTRICTED = 1, | |
56 CONN_STATE_RESTRICTED = 2, | |
57 CONN_STATE_NONE = 3 | |
58 }; | |
59 | |
60 // Network enums (see flimflam/include/network.h) | |
61 enum NetworkTechnology { | |
62 NETWORK_TECHNOLOGY_UNKNOWN = 0, | |
63 NETWORK_TECHNOLOGY_1XRTT = 1, | |
64 NETWORK_TECHNOLOGY_EVDO = 2, | |
65 NETWORK_TECHNOLOGY_GPRS = 3, | |
66 NETWORK_TECHNOLOGY_EDGE = 4, | |
67 NETWORK_TECHNOLOGY_UMTS = 5, | |
68 NETWORK_TECHNOLOGY_HSPA = 6, | |
69 NETWORK_TECHNOLOGY_HSPA_PLUS = 7, | |
70 NETWORK_TECHNOLOGY_LTE = 8, | |
71 NETWORK_TECHNOLOGY_LTE_ADVANCED = 9, | |
72 }; | |
73 | |
74 enum ActivationState { | |
75 ACTIVATION_STATE_UNKNOWN = 0, | |
76 ACTIVATION_STATE_ACTIVATED = 1, | |
77 ACTIVATION_STATE_ACTIVATING = 2, | |
78 ACTIVATION_STATE_NOT_ACTIVATED = 3, | |
79 ACTIVATION_STATE_PARTIALLY_ACTIVATED = 4, | |
80 }; | |
81 | |
82 enum NetworkRoamingState { | |
83 ROAMING_STATE_UNKNOWN = 0, | |
84 ROAMING_STATE_HOME = 1, | |
85 ROAMING_STATE_ROAMING = 2, | |
86 }; | |
87 | |
88 // connection errors (see flimflam/include/service.h) | |
89 enum ConnectionError { | |
90 ERROR_UNKNOWN = 0, | |
91 ERROR_OUT_OF_RANGE = 1, | |
92 ERROR_PIN_MISSING = 2, | |
93 ERROR_DHCP_FAILED = 3, | |
94 ERROR_CONNECT_FAILED = 4, | |
95 ERROR_BAD_PASSPHRASE = 5, | |
96 ERROR_BAD_WEPKEY = 6, | |
97 ERROR_ACTIVATION_FAILED = 7, | |
98 ERROR_NEED_EVDO = 8, | |
99 ERROR_NEED_HOME_NETWORK = 9, | |
100 ERROR_OTASP_FAILED = 10, | |
101 ERROR_AAA_FAILED = 11, | |
102 }; | |
103 | |
104 // ipconfig types (see flimflam/files/doc/ipconfig-api.txt) | 16 // ipconfig types (see flimflam/files/doc/ipconfig-api.txt) |
105 enum IPConfigType { | 17 enum IPConfigType { |
106 IPCONFIG_TYPE_UNKNOWN, | 18 IPCONFIG_TYPE_UNKNOWN, |
107 IPCONFIG_TYPE_IPV4, | 19 IPCONFIG_TYPE_IPV4, |
108 IPCONFIG_TYPE_IPV6, | 20 IPCONFIG_TYPE_IPV6, |
109 IPCONFIG_TYPE_DHCP, | 21 IPCONFIG_TYPE_DHCP, |
110 IPCONFIG_TYPE_BOOTP, //Not Used | 22 IPCONFIG_TYPE_BOOTP, //Not Used |
111 IPCONFIG_TYPE_ZEROCONF, | 23 IPCONFIG_TYPE_ZEROCONF, |
112 IPCONFIG_TYPE_DHCP6, | 24 IPCONFIG_TYPE_DHCP6, |
113 IPCONFIG_TYPE_PPP, | 25 IPCONFIG_TYPE_PPP, |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 int channel; // Wifi channel number | 97 int channel; // Wifi channel number |
186 bool connected; // True if this network is connected | 98 bool connected; // True if this network is connected |
187 int age_seconds; // Time in seconds since this network was seen | 99 int age_seconds; // Time in seconds since this network was seen |
188 }; | 100 }; |
189 | 101 |
190 struct DeviceNetworkList { | 102 struct DeviceNetworkList { |
191 size_t network_size; | 103 size_t network_size; |
192 DeviceNetworkInfo* networks; | 104 DeviceNetworkInfo* networks; |
193 }; | 105 }; |
194 | 106 |
195 // Requests a scan of services of |type|. | |
196 // If |type| is TYPE_UNKNOWN (0), it will scan for all types. | |
197 extern void (*RequestScan)(ConnectionType type); | |
198 | |
199 // Activates the cellular modem specified by |service_path| with carrier | 107 // Activates the cellular modem specified by |service_path| with carrier |
200 // specified by |carrier|. | 108 // specified by |carrier|. |
201 // |carrier| is NULL or an empty string, this will activate with the currently | 109 // |carrier| is NULL or an empty string, this will activate with the currently |
202 // active carrier. | 110 // active carrier. |
203 // | 111 // |
204 // Returns false on failure and true on success. | 112 // Returns false on failure and true on success. |
205 extern bool (*ActivateCellularModem)(const char* service_path, | 113 extern bool (*ActivateCellularModem)(const char* service_path, |
206 const char* carrier); | 114 const char* carrier); |
207 | 115 |
208 | 116 |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 extern void (*RequestNetworkProfile)(const char* profile_path, | 278 extern void (*RequestNetworkProfile)(const char* profile_path, |
371 NetworkPropertiesCallback callback, | 279 NetworkPropertiesCallback callback, |
372 void* object); | 280 void* object); |
373 | 281 |
374 // Retrieve the latest info for a profile service entry. | 282 // Retrieve the latest info for a profile service entry. |
375 extern void (*RequestNetworkProfileEntry)(const char* profile_path, | 283 extern void (*RequestNetworkProfileEntry)(const char* profile_path, |
376 const char* profile_entry_path, | 284 const char* profile_entry_path, |
377 NetworkPropertiesCallback callback, | 285 NetworkPropertiesCallback callback, |
378 void* object); | 286 void* object); |
379 | 287 |
380 // Get a service path for a wifi service not in the network list (i.e. hidden). | 288 // Request a wifi service not in the network list (i.e. hidden). |
381 extern void (*RequestWifiServicePath)(const char* ssid, | 289 extern void (*RequestHiddenWifiNetwork)(const char* ssid, |
382 ConnectionSecurity security, | 290 const char* security, |
383 NetworkPropertiesCallback callback, | 291 NetworkPropertiesCallback callback, |
384 void* object); | 292 void* object); |
| 293 |
| 294 // Requests a scan of services of |type|. |
| 295 // |type| should be is a string recognized by flimflam's Manager API. |
| 296 extern void (*RequestNetworkScan)(const char* network_type); |
| 297 |
| 298 // Request enabling or disabling a device. |
| 299 extern void (*RequestNetworkDeviceEnable)(const char* network_type, |
| 300 bool enable); |
385 | 301 |
386 ////////////////////////////////////////////////////////////////////////////// | 302 ////////////////////////////////////////////////////////////////////////////// |
387 // Enable or disable the specific network device for connection. | 303 // Enable or disable the specific network device for connection. |
388 // | 304 // |
389 // Returns false on failure and true on success. | |
390 extern bool (*EnableNetworkDevice)(ConnectionType type, bool enable); | |
391 | |
392 // Set offline mode. This will turn off all radios. | 305 // Set offline mode. This will turn off all radios. |
393 // | 306 // |
394 // Returns false on failure and true on success. | 307 // Returns false on failure and true on success. |
395 extern bool (*SetOfflineMode)(bool offline); | 308 extern bool (*SetOfflineMode)(bool offline); |
396 | 309 |
397 // Set auto_connect for service. | 310 // Set auto_connect for service. |
398 // | 311 // |
399 // Returns true on success. | 312 // Returns true on success. |
400 extern bool (*SetAutoConnect)(const char* service_path, bool auto_connect); | 313 extern bool (*SetAutoConnect)(const char* service_path, bool auto_connect); |
401 | 314 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 // FreeDeviceNetworkList to release it. | 351 // FreeDeviceNetworkList to release it. |
439 extern DeviceNetworkList* (*GetDeviceNetworkList)(); | 352 extern DeviceNetworkList* (*GetDeviceNetworkList)(); |
440 | 353 |
441 // Deletes a DeviceNetworkList type that was allocated in the ChromeOS dll. We | 354 // Deletes a DeviceNetworkList type that was allocated in the ChromeOS dll. We |
442 // need to do this to safely pass data over the dll boundary between our .so | 355 // need to do this to safely pass data over the dll boundary between our .so |
443 // and Chrome. | 356 // and Chrome. |
444 extern void (*FreeDeviceNetworkList)(DeviceNetworkList* network_list); | 357 extern void (*FreeDeviceNetworkList)(DeviceNetworkList* network_list); |
445 | 358 |
446 } // namespace chromeos | 359 } // namespace chromeos |
447 | 360 |
448 // TODO(stevenjb): Remove this after R11 -> stable to force Chrome to use the | |
449 // new interfaces or explicitly include chromeos_network_deprecated.h. | |
450 #include "chromeos_network_deprecated.h" | |
451 | |
452 #endif // CHROMEOS_NETWORK_H_ | 361 #endif // CHROMEOS_NETWORK_H_ |
OLD | NEW |