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 shill { | |
| 21 | |
| 22 // TODO(kaliamoorthi): Move these constants to dbus/service_constants.h | |
| 23 const char kFlimflamThirdPartyVpnInterface[] = | |
| 24 "org.chromium.flimflam.ThirdPartyVpn"; | |
| 25 const char kSetParametersFunction[] = "SetParameters"; | |
| 26 const char kSendPacketFunction[] = "SendPacket"; | |
| 27 const char kUpdateConnectionStateFunction[] = "UpdateConnectionState"; | |
| 28 const char kOnPacketReceivedFunction[] = "OnPacketReceived"; | |
| 29 const char kOnPlatformMessageFunction[] = "OnPlatformMessage"; | |
| 30 | |
| 31 const char kAddressParameterThirdPartyVpn[] = "address"; | |
| 32 const char kBroadcastAddressParameterThirdPartyVpn[] = "broadcast_address"; | |
| 33 const char kGatewayParameterThirdPartyVpn[] = "gateway"; | |
| 34 const char kBypassTunnelForIpParameterThirdPartyVpn[] = "bypass_tunnel_for_ip"; | |
| 35 const char kSubnetPrefixParameterThirdPartyVpn[] = "subnet_prefix"; | |
| 36 const char kMtuParameterThirdPartyVpn[] = "mtu"; | |
| 37 const char kDomainSearchParameterThirdPartyVpn[] = "domain_search"; | |
| 38 const char kDnsServersParameterThirdPartyVpn[] = "dns_servers"; | |
| 39 | |
| 40 extern const char* kSetParametersKeyList[]; | |
|
stevenjb
2014/10/31 16:35:42
Don't expose this. See comment in .cc file.
kaliamoorthi
2014/11/03 10:55:38
Done.
| |
| 41 | |
| 42 } // namespace shill | |
| 43 | |
| 44 namespace chromeos { | |
| 45 | |
| 46 class ShillThirdPartyVpnObserver; | |
| 47 | |
| 48 // ShillThirdPartyVpnDriverClient is used to communicate with the Shill | |
| 49 // ThirdPartyVpnDriver service. | |
| 50 // All methods should be called from the origin thread which initializes the | |
| 51 // DBusThreadManager instance. | |
| 52 class CHROMEOS_EXPORT ShillThirdPartyVpnDriverClient : public DBusClient { | |
| 53 public: | |
| 54 class TestInterface { | |
| 55 public: | |
| 56 virtual void OnPacketReceived(const dbus::ObjectPath& object_path, | |
| 57 const uint8* data, | |
| 58 size_t length) = 0; | |
| 59 virtual void OnPlatformMessage(const dbus::ObjectPath& object_path, | |
| 60 uint32 message) = 0; | |
| 61 | |
| 62 protected: | |
| 63 virtual ~TestInterface() {} | |
| 64 }; | |
| 65 | |
| 66 ~ShillThirdPartyVpnDriverClient() override; | |
| 67 | |
| 68 // Factory function, creates a new instance which is owned by the caller. | |
| 69 // For normal usage, access the singleton via DBusThreadManager::Get(). | |
| 70 static ShillThirdPartyVpnDriverClient* Create(); | |
| 71 | |
| 72 // Adds an |observer| for the third party vpn driver at |object_path|. | |
| 73 virtual void AddShillThirdPartyVpnObserver( | |
| 74 const dbus::ObjectPath& object_path, | |
| 75 ShillThirdPartyVpnObserver* observer) = 0; | |
| 76 | |
| 77 // Removes an |observer| for the third party vpn driver at |object_path|. | |
| 78 virtual void RemoveShillThirdPartyVpnObserver( | |
| 79 const dbus::ObjectPath& object_path) = 0; | |
| 80 | |
| 81 // Calls SetParameters method. | |
| 82 // |callback| is called after the method call succeeds. | |
| 83 virtual void SetParameters(const dbus::ObjectPath& object_path, | |
| 84 const base::DictionaryValue& parameters, | |
| 85 const VoidDBusMethodCallback& callback) = 0; | |
| 86 | |
| 87 // Calls UpdateConnectionState method. | |
| 88 // |callback| is called after the method call succeeds. | |
| 89 virtual void UpdateConnectionState( | |
| 90 const dbus::ObjectPath& object_path, | |
| 91 const uint32 connection_state, | |
| 92 const VoidDBusMethodCallback& callback) = 0; | |
| 93 | |
| 94 // Calls SendPacket method. | |
| 95 // |callback| is called after the method call succeeds. | |
| 96 virtual void SendPacket(const dbus::ObjectPath& object_path, | |
| 97 const std::vector<uint8>& ip_packet, | |
| 98 const VoidDBusMethodCallback& callback) = 0; | |
| 99 | |
| 100 // Returns an interface for testing (stub only), or returns NULL. | |
| 101 virtual ShillThirdPartyVpnDriverClient::TestInterface* GetTestInterface() = 0; | |
| 102 | |
| 103 protected: | |
| 104 friend class ShillThirdPartyVpnDriverClientTest; | |
| 105 | |
| 106 // Create() should be used instead. | |
| 107 ShillThirdPartyVpnDriverClient(); | |
| 108 | |
| 109 private: | |
| 110 DISALLOW_COPY_AND_ASSIGN(ShillThirdPartyVpnDriverClient); | |
| 111 }; | |
| 112 | |
| 113 } // namespace chromeos | |
| 114 | |
| 115 #endif // CHROMEOS_DBUS_SHILL_THIRD_PARTY_VPN_DRIVER_CLIENT_H_ | |
| OLD | NEW |