| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_H_ | 6 #define CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 PROVIDER_TYPE_OPEN_VPN, | 427 PROVIDER_TYPE_OPEN_VPN, |
| 428 // Add new provider types before PROVIDER_TYPE_MAX. | 428 // Add new provider types before PROVIDER_TYPE_MAX. |
| 429 PROVIDER_TYPE_MAX, | 429 PROVIDER_TYPE_MAX, |
| 430 }; | 430 }; |
| 431 | 431 |
| 432 explicit VirtualNetwork(const std::string& service_path); | 432 explicit VirtualNetwork(const std::string& service_path); |
| 433 ~VirtualNetwork(); | 433 ~VirtualNetwork(); |
| 434 | 434 |
| 435 const std::string& server_hostname() const { return server_hostname_; } | 435 const std::string& server_hostname() const { return server_hostname_; } |
| 436 ProviderType provider_type() const { return provider_type_; } | 436 ProviderType provider_type() const { return provider_type_; } |
| 437 const std::string& ca_cert() const { return ca_cert_; } | 437 const std::string& ca_cert_nss() const { return ca_cert_nss_; } |
| 438 const std::string& psk_passphrase() const { return psk_passphrase_; } | 438 const std::string& psk_passphrase() const { return psk_passphrase_; } |
| 439 const std::string& user_cert() const { return user_cert_; } | 439 const std::string& client_cert_id() const { return client_cert_id_; } |
| 440 const std::string& user_cert_key() const { return user_cert_key_; } | |
| 441 const std::string& username() const { return username_; } | 440 const std::string& username() const { return username_; } |
| 442 const std::string& user_passphrase() const { return user_passphrase_; } | 441 const std::string& user_passphrase() const { return user_passphrase_; } |
| 443 | 442 |
| 444 bool NeedMoreInfoToConnect() const; | 443 bool NeedMoreInfoToConnect() const; |
| 445 | 444 |
| 446 // Public setters. | 445 // Public setters. |
| 447 void SetCACert(const std::string& ca_cert); | 446 void SetCACertNSS(const std::string& ca_cert_nss); |
| 448 void SetPSKPassphrase(const std::string& psk_passphrase); | 447 void SetPSKPassphrase(const std::string& psk_passphrase); |
| 449 void SetUserCert(const std::string& user_cert); | 448 void SetClientCertID(const std::string& cert_id); |
| 450 void SetUserCertKey(const std::string& key); | |
| 451 void SetUsername(const std::string& username); | 449 void SetUsername(const std::string& username); |
| 452 void SetUserPassphrase(const std::string& user_passphrase); | 450 void SetUserPassphrase(const std::string& user_passphrase); |
| 453 | 451 |
| 454 std::string GetProviderTypeString() const; | 452 std::string GetProviderTypeString() const; |
| 455 | 453 |
| 456 private: | 454 private: |
| 457 // Network overrides. | 455 // Network overrides. |
| 458 virtual bool ParseValue(int index, const Value* value); | 456 virtual bool ParseValue(int index, const Value* value); |
| 459 virtual void ParseInfo(const DictionaryValue* info); | 457 virtual void ParseInfo(const DictionaryValue* info); |
| 460 | 458 |
| 461 // VirtualNetwork private methods. | 459 // VirtualNetwork private methods. |
| 462 bool ParseProviderValue(int index, const Value* value); | 460 bool ParseProviderValue(int index, const Value* value); |
| 463 | 461 |
| 464 void set_server_hostname(const std::string& server_hostname) { | 462 void set_server_hostname(const std::string& server_hostname) { |
| 465 server_hostname_ = server_hostname; | 463 server_hostname_ = server_hostname; |
| 466 } | 464 } |
| 467 void set_provider_type(ProviderType provider_type) { | 465 void set_provider_type(ProviderType provider_type) { |
| 468 provider_type_ = provider_type; | 466 provider_type_ = provider_type; |
| 469 } | 467 } |
| 470 void set_ca_cert(const std::string& ca_cert) { | 468 void set_ca_cert_nss(const std::string& ca_cert_nss) { |
| 471 ca_cert_ = ca_cert; | 469 ca_cert_nss_ = ca_cert_nss; |
| 472 } | 470 } |
| 473 void set_psk_passphrase(const std::string& psk_passphrase) { | 471 void set_psk_passphrase(const std::string& psk_passphrase) { |
| 474 psk_passphrase_ = psk_passphrase; | 472 psk_passphrase_ = psk_passphrase; |
| 475 } | 473 } |
| 476 void set_user_cert(const std::string& user_cert) { | 474 void set_client_cert_id(const std::string& client_cert_id) { |
| 477 user_cert_ = user_cert; | 475 client_cert_id_ = client_cert_id; |
| 478 } | |
| 479 void set_user_cert_key(const std::string& key) { | |
| 480 user_cert_key_ = key; | |
| 481 } | 476 } |
| 482 void set_username(const std::string& username) { | 477 void set_username(const std::string& username) { |
| 483 username_ = username; | 478 username_ = username; |
| 484 } | 479 } |
| 485 void set_user_passphrase(const std::string& user_passphrase) { | 480 void set_user_passphrase(const std::string& user_passphrase) { |
| 486 user_passphrase_ = user_passphrase; | 481 user_passphrase_ = user_passphrase; |
| 487 } | 482 } |
| 488 | 483 |
| 489 std::string server_hostname_; | 484 std::string server_hostname_; |
| 490 ProviderType provider_type_; | 485 ProviderType provider_type_; |
| 491 std::string ca_cert_; | 486 // NSS nickname for server CA certificate. |
| 487 std::string ca_cert_nss_; |
| 492 std::string psk_passphrase_; | 488 std::string psk_passphrase_; |
| 493 std::string user_cert_; | 489 // PKCS#11 ID for client certificate. |
| 494 std::string user_cert_key_; | 490 std::string client_cert_id_; |
| 495 std::string username_; | 491 std::string username_; |
| 496 std::string user_passphrase_; | 492 std::string user_passphrase_; |
| 497 | 493 |
| 498 friend class NetworkLibraryImpl; | 494 friend class NetworkLibraryImpl; |
| 499 DISALLOW_COPY_AND_ASSIGN(VirtualNetwork); | 495 DISALLOW_COPY_AND_ASSIGN(VirtualNetwork); |
| 500 }; | 496 }; |
| 501 typedef std::vector<VirtualNetwork*> VirtualNetworkVector; | 497 typedef std::vector<VirtualNetwork*> VirtualNetworkVector; |
| 502 | 498 |
| 503 // Base class for networks of TYPE_WIFI or TYPE_CELLULAR. | 499 // Base class for networks of TYPE_WIFI or TYPE_CELLULAR. |
| 504 class WirelessNetwork : public Network { | 500 class WirelessNetwork : public Network { |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1098 | 1094 |
| 1099 // Connect to the specified virtual network with service name, | 1095 // Connect to the specified virtual network with service name, |
| 1100 // server hostname, provider_type, PSK passphrase, username and passphrase. | 1096 // server hostname, provider_type, PSK passphrase, username and passphrase. |
| 1101 virtual void ConnectToVirtualNetworkPSK( | 1097 virtual void ConnectToVirtualNetworkPSK( |
| 1102 const std::string& service_name, | 1098 const std::string& service_name, |
| 1103 const std::string& server_hostname, | 1099 const std::string& server_hostname, |
| 1104 const std::string& psk, | 1100 const std::string& psk, |
| 1105 const std::string& username, | 1101 const std::string& username, |
| 1106 const std::string& user_passphrase) = 0; | 1102 const std::string& user_passphrase) = 0; |
| 1107 | 1103 |
| 1104 // Connect to a virtual network with user certificate information. |
| 1105 // TODO(jamescook): Convert both this and above to take a struct of |
| 1106 // configuration information. |
| 1107 virtual void ConnectToVirtualNetworkCert( |
| 1108 const std::string& service_name, |
| 1109 const std::string& server_hostname, |
| 1110 const std::string& client_cert_id, |
| 1111 const std::string& username, |
| 1112 const std::string& user_passphrase) = 0; |
| 1113 |
| 1108 // Disconnect from the specified network. | 1114 // Disconnect from the specified network. |
| 1109 virtual void DisconnectFromNetwork(const Network* network) = 0; | 1115 virtual void DisconnectFromNetwork(const Network* network) = 0; |
| 1110 | 1116 |
| 1111 // Forget the wifi network corresponding to service_path. | 1117 // Forget the wifi network corresponding to service_path. |
| 1112 virtual void ForgetWifiNetwork(const std::string& service_path) = 0; | 1118 virtual void ForgetWifiNetwork(const std::string& service_path) = 0; |
| 1113 | 1119 |
| 1114 // Returns home carrier ID if available, otherwise empty string is returned. | 1120 // Returns home carrier ID if available, otherwise empty string is returned. |
| 1115 // Carrier ID format: <carrier name> (country). Ex.: "Verizon (us)". | 1121 // Carrier ID format: <carrier name> (country). Ex.: "Verizon (us)". |
| 1116 virtual std::string GetCellularHomeCarrierId() const = 0; | 1122 virtual std::string GetCellularHomeCarrierId() const = 0; |
| 1117 | 1123 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1152 HardwareAddressFormat) = 0; | 1158 HardwareAddressFormat) = 0; |
| 1153 | 1159 |
| 1154 // Factory function, creates a new instance and returns ownership. | 1160 // Factory function, creates a new instance and returns ownership. |
| 1155 // For normal usage, access the singleton via CrosLibrary::Get(). | 1161 // For normal usage, access the singleton via CrosLibrary::Get(). |
| 1156 static NetworkLibrary* GetImpl(bool stub); | 1162 static NetworkLibrary* GetImpl(bool stub); |
| 1157 }; | 1163 }; |
| 1158 | 1164 |
| 1159 } // namespace chromeos | 1165 } // namespace chromeos |
| 1160 | 1166 |
| 1161 #endif // CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_H_ | 1167 #endif // CHROME_BROWSER_CHROMEOS_CROS_NETWORK_LIBRARY_H_ |
| OLD | NEW |