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 // This is a base class for observers which handle signals sent by the | |
| 23 // ThirdPartyVpnAdaptor in Shill. | |
| 24 class ShillThirdPartyVpnObserver { | |
| 25 public: | |
| 26 // Ownership of |data| belongs to the caller, hence the contents should be | |
| 27 // consumed before the call returns, i.e., pointer should not dereferenced | |
| 28 // after the function returns. | |
| 29 virtual void OnPacketReceived(const uint8* data, size_t length) = 0; | |
| 30 virtual void OnPlatformMessage(uint32 connection_state) = 0; | |
| 31 }; | |
|
stevenjb
2014/10/29 18:14:56
This should be in a separate file (both for readab
kaliamoorthi
2014/10/30 13:09:05
Done.
| |
| 32 | |
| 33 // ShillThirdPartyVpnDriverClient is used to communicate with the Shill | |
| 34 // ThirdPartyVpnDriver service. | |
| 35 // All methods should be called from the origin thread which initializes the | |
| 36 // DBusThreadManager instance. | |
| 37 class CHROMEOS_EXPORT ShillThirdPartyVpnDriverClient : public DBusClient { | |
| 38 public: | |
| 39 virtual ~ShillThirdPartyVpnDriverClient(); | |
| 40 | |
| 41 // Factory function, creates a new instance which is owned by the caller. | |
| 42 // For normal usage, access the singleton via DBusThreadManager::Get(). | |
| 43 static ShillThirdPartyVpnDriverClient* Create(); | |
| 44 | |
| 45 // Adds an |observer| for the third party vpn driver at |object_path|. | |
| 46 virtual void AddShillThirdPartyVpnObserver( | |
| 47 const dbus::ObjectPath& object_path, | |
| 48 ShillThirdPartyVpnObserver* observer) = 0; | |
| 49 | |
| 50 // Removes an |observer| for the third party vpn driver at |object_path|. | |
| 51 virtual void RemoveShillThirdPartyVpnObserver( | |
| 52 const dbus::ObjectPath& object_path) = 0; | |
| 53 | |
| 54 // Calls SetParameters method. | |
| 55 // |callback| is called after the method call succeeds. | |
| 56 virtual void SetParameters(const dbus::ObjectPath& object_path, | |
| 57 const base::DictionaryValue& parameters, | |
| 58 const VoidDBusMethodCallback& callback) = 0; | |
| 59 | |
| 60 // Calls UpdateConnectionState method. | |
| 61 // |callback| is called after the method call succeeds. | |
| 62 virtual void UpdateConnectionState( | |
| 63 const dbus::ObjectPath& object_path, | |
| 64 const uint32 connection_state, | |
| 65 const VoidDBusMethodCallback& callback) = 0; | |
| 66 | |
| 67 // Calls SendPacket method. | |
| 68 // |callback| is called after the method call succeeds. | |
| 69 virtual void SendPacket(const dbus::ObjectPath& object_path, | |
| 70 const std::vector<uint8>& ip_packet, | |
| 71 const VoidDBusMethodCallback& callback) = 0; | |
| 72 | |
| 73 protected: | |
| 74 // Create() should be used instead. | |
| 75 ShillThirdPartyVpnDriverClient(); | |
| 76 | |
| 77 private: | |
| 78 DISALLOW_COPY_AND_ASSIGN(ShillThirdPartyVpnDriverClient); | |
| 79 }; | |
| 80 | |
| 81 } // namespace chromeos | |
| 82 | |
| 83 #endif // CHROMEOS_DBUS_SHILL_THIRD_PARTY_VPN_DRIVER_CLIENT_H_ | |
| OLD | NEW |