Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROMEOS_DBUS_SHILL_THIRD_PARTY_VPN_DRIVER_CLIENT_H_ | |
| 6 #define CHROMEOS_DBUS_SHILL_THIRD_PARTY_VPN_DRIVER_CLIENT_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/callback.h" | |
| 10 #include "chromeos/chromeos_export.h" | |
| 11 #include "chromeos/dbus/dbus_client.h" | |
| 12 #include "chromeos/dbus/shill_client_helper.h" | |
| 13 | |
| 14 namespace dbus { | |
| 15 | |
| 16 class ObjectPath; | |
| 17 | |
| 18 } // namespace dbus | |
| 19 | |
| 20 namespace chromeos { | |
| 21 | |
| 22 class ShillThirdPartyVpnObserver; | |
| 23 | |
| 24 // ShillThirdPartyVpnDriverClient is used to communicate with the Shill | |
| 25 // ThirdPartyVpnDriver service. | |
| 26 // All methods should be called from the origin thread which initializes the | |
| 27 // DBusThreadManager instance. | |
| 28 class CHROMEOS_EXPORT ShillThirdPartyVpnDriverClient : public DBusClient { | |
| 29 public: | |
| 30 class TestInterface { | |
| 31 public: | |
| 32 virtual void OnPacketReceived(const dbus::ObjectPath& object_path, | |
| 33 const uint8* data, | |
| 34 size_t length) = 0; | |
| 35 virtual void OnPlatformMessage(const dbus::ObjectPath& object_path, | |
| 36 uint32 connection_state) = 0; | |
| 37 | |
| 38 protected: | |
| 39 virtual ~TestInterface() {} | |
| 40 }; | |
| 41 | |
| 42 virtual ~ShillThirdPartyVpnDriverClient(); | |
|
stevenjb
2014/10/30 20:55:36
~ShillThirdPartyVpnDriverClient() override;
kaliamoorthi
2014/10/31 11:03:48
Done.
| |
| 43 | |
| 44 // Factory function, creates a new instance which is owned by the caller. | |
| 45 // For normal usage, access the singleton via DBusThreadManager::Get(). | |
| 46 static ShillThirdPartyVpnDriverClient* Create(); | |
| 47 | |
| 48 // Adds an |observer| for the third party vpn driver at |object_path|. | |
| 49 virtual void AddShillThirdPartyVpnObserver( | |
| 50 const dbus::ObjectPath& object_path, | |
| 51 ShillThirdPartyVpnObserver* observer) = 0; | |
| 52 | |
| 53 // Removes an |observer| for the third party vpn driver at |object_path|. | |
| 54 virtual void RemoveShillThirdPartyVpnObserver( | |
| 55 const dbus::ObjectPath& object_path) = 0; | |
| 56 | |
| 57 // Calls SetParameters method. | |
| 58 // |callback| is called after the method call succeeds. | |
| 59 virtual void SetParameters(const dbus::ObjectPath& object_path, | |
| 60 const base::DictionaryValue& parameters, | |
| 61 const VoidDBusMethodCallback& callback) = 0; | |
| 62 | |
| 63 // Calls UpdateConnectionState method. | |
| 64 // |callback| is called after the method call succeeds. | |
| 65 virtual void UpdateConnectionState( | |
| 66 const dbus::ObjectPath& object_path, | |
| 67 const uint32 connection_state, | |
| 68 const VoidDBusMethodCallback& callback) = 0; | |
| 69 | |
| 70 // Calls SendPacket method. | |
| 71 // |callback| is called after the method call succeeds. | |
| 72 virtual void SendPacket(const dbus::ObjectPath& object_path, | |
| 73 const std::vector<uint8>& ip_packet, | |
| 74 const VoidDBusMethodCallback& callback) = 0; | |
| 75 | |
| 76 // Returns an interface for testing (stub only), or returns NULL. | |
| 77 virtual ShillThirdPartyVpnDriverClient::TestInterface* GetTestInterface() = 0; | |
| 78 | |
| 79 protected: | |
| 80 // Create() should be used instead. | |
| 81 ShillThirdPartyVpnDriverClient(); | |
| 82 | |
| 83 private: | |
| 84 DISALLOW_COPY_AND_ASSIGN(ShillThirdPartyVpnDriverClient); | |
| 85 }; | |
| 86 | |
| 87 } // namespace chromeos | |
| 88 | |
| 89 #endif // CHROMEOS_DBUS_SHILL_THIRD_PARTY_VPN_DRIVER_CLIENT_H_ | |
| OLD | NEW |