| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CHROMEOS_DBUS_SHILL_THIRD_PARTY_VPN_DRIVER_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_SHILL_THIRD_PARTY_VPN_DRIVER_CLIENT_H_ |
| 6 #define CHROMEOS_DBUS_SHILL_THIRD_PARTY_VPN_DRIVER_CLIENT_H_ | 6 #define CHROMEOS_DBUS_SHILL_THIRD_PARTY_VPN_DRIVER_CLIENT_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <string> |
| 10 #include <vector> |
| 9 | 11 |
| 10 #include "base/callback.h" | 12 #include "base/callback.h" |
| 11 #include "chromeos/chromeos_export.h" | 13 #include "chromeos/chromeos_export.h" |
| 12 #include "chromeos/dbus/dbus_client.h" | 14 #include "chromeos/dbus/dbus_client.h" |
| 13 #include "chromeos/dbus/shill_client_helper.h" | 15 #include "chromeos/dbus/shill_client_helper.h" |
| 14 | 16 |
| 15 namespace chromeos { | 17 namespace chromeos { |
| 16 | 18 |
| 17 class ShillThirdPartyVpnObserver; | 19 class ShillThirdPartyVpnObserver; |
| 18 | 20 |
| 19 // ShillThirdPartyVpnDriverClient is used to communicate with the Shill | 21 // ShillThirdPartyVpnDriverClient is used to communicate with the Shill |
| 20 // ThirdPartyVpnDriver service. | 22 // ThirdPartyVpnDriver service. |
| 21 // All methods should be called from the origin thread which initializes the | 23 // All methods should be called from the origin thread which initializes the |
| 22 // DBusThreadManager instance. | 24 // DBusThreadManager instance. |
| 23 class CHROMEOS_EXPORT ShillThirdPartyVpnDriverClient : public DBusClient { | 25 class CHROMEOS_EXPORT ShillThirdPartyVpnDriverClient : public DBusClient { |
| 24 public: | 26 public: |
| 25 class TestInterface { | 27 class TestInterface { |
| 26 public: | 28 public: |
| 27 virtual void OnPacketReceived(const std::string& object_path_value, | 29 virtual void OnPacketReceived(const std::string& object_path_value, |
| 28 const std::string& packet) = 0; | 30 const std::vector<char>& packet) = 0; |
| 29 virtual void OnPlatformMessage(const std::string& object_path_value, | 31 virtual void OnPlatformMessage(const std::string& object_path_value, |
| 30 uint32_t message) = 0; | 32 uint32_t message) = 0; |
| 31 | 33 |
| 32 protected: | 34 protected: |
| 33 virtual ~TestInterface() {} | 35 virtual ~TestInterface() {} |
| 34 }; | 36 }; |
| 35 | 37 |
| 36 ~ShillThirdPartyVpnDriverClient() override; | 38 ~ShillThirdPartyVpnDriverClient() override; |
| 37 | 39 |
| 38 // Factory function, creates a new instance which is owned by the caller. | 40 // Factory function, creates a new instance which is owned by the caller. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 62 virtual void UpdateConnectionState( | 64 virtual void UpdateConnectionState( |
| 63 const std::string& object_path_value, | 65 const std::string& object_path_value, |
| 64 const uint32_t connection_state, | 66 const uint32_t connection_state, |
| 65 const base::Closure& callback, | 67 const base::Closure& callback, |
| 66 const ShillClientHelper::ErrorCallback& error_callback) = 0; | 68 const ShillClientHelper::ErrorCallback& error_callback) = 0; |
| 67 | 69 |
| 68 // Calls SendPacket method. | 70 // Calls SendPacket method. |
| 69 // |callback| is called after the method call succeeds. | 71 // |callback| is called after the method call succeeds. |
| 70 virtual void SendPacket( | 72 virtual void SendPacket( |
| 71 const std::string& object_path_value, | 73 const std::string& object_path_value, |
| 72 const std::string& ip_packet, | 74 const std::vector<char>& ip_packet, |
| 73 const base::Closure& callback, | 75 const base::Closure& callback, |
| 74 const ShillClientHelper::ErrorCallback& error_callback) = 0; | 76 const ShillClientHelper::ErrorCallback& error_callback) = 0; |
| 75 | 77 |
| 76 // Returns an interface for testing (stub only), or returns nullptr. | 78 // Returns an interface for testing (stub only), or returns nullptr. |
| 77 virtual ShillThirdPartyVpnDriverClient::TestInterface* GetTestInterface() = 0; | 79 virtual ShillThirdPartyVpnDriverClient::TestInterface* GetTestInterface() = 0; |
| 78 | 80 |
| 79 protected: | 81 protected: |
| 80 friend class ShillThirdPartyVpnDriverClientTest; | 82 friend class ShillThirdPartyVpnDriverClientTest; |
| 81 | 83 |
| 82 // Create() should be used instead. | 84 // Create() should be used instead. |
| 83 ShillThirdPartyVpnDriverClient(); | 85 ShillThirdPartyVpnDriverClient(); |
| 84 | 86 |
| 85 private: | 87 private: |
| 86 DISALLOW_COPY_AND_ASSIGN(ShillThirdPartyVpnDriverClient); | 88 DISALLOW_COPY_AND_ASSIGN(ShillThirdPartyVpnDriverClient); |
| 87 }; | 89 }; |
| 88 | 90 |
| 89 } // namespace chromeos | 91 } // namespace chromeos |
| 90 | 92 |
| 91 #endif // CHROMEOS_DBUS_SHILL_THIRD_PARTY_VPN_DRIVER_CLIENT_H_ | 93 #endif // CHROMEOS_DBUS_SHILL_THIRD_PARTY_VPN_DRIVER_CLIENT_H_ |
| OLD | NEW |