| 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 }  // namespace shill | 
|  | 41 | 
|  | 42 namespace chromeos { | 
|  | 43 | 
|  | 44 class ShillThirdPartyVpnObserver; | 
|  | 45 | 
|  | 46 // ShillThirdPartyVpnDriverClient is used to communicate with the Shill | 
|  | 47 // ThirdPartyVpnDriver service. | 
|  | 48 // All methods should be called from the origin thread which initializes the | 
|  | 49 // DBusThreadManager instance. | 
|  | 50 class CHROMEOS_EXPORT ShillThirdPartyVpnDriverClient : public DBusClient { | 
|  | 51  public: | 
|  | 52   class TestInterface { | 
|  | 53    public: | 
|  | 54     virtual void OnPacketReceived(const dbus::ObjectPath& object_path, | 
|  | 55                                   const uint8* data, | 
|  | 56                                   size_t length) = 0; | 
|  | 57     virtual void OnPlatformMessage(const dbus::ObjectPath& object_path, | 
|  | 58                                    uint32 message) = 0; | 
|  | 59 | 
|  | 60    protected: | 
|  | 61     virtual ~TestInterface() {} | 
|  | 62   }; | 
|  | 63 | 
|  | 64   ~ShillThirdPartyVpnDriverClient() override; | 
|  | 65 | 
|  | 66   // Factory function, creates a new instance which is owned by the caller. | 
|  | 67   // For normal usage, access the singleton via DBusThreadManager::Get(). | 
|  | 68   static ShillThirdPartyVpnDriverClient* Create(); | 
|  | 69 | 
|  | 70   // Adds an |observer| for the third party vpn driver at |object_path|. | 
|  | 71   virtual void AddShillThirdPartyVpnObserver( | 
|  | 72       const dbus::ObjectPath& object_path, | 
|  | 73       ShillThirdPartyVpnObserver* observer) = 0; | 
|  | 74 | 
|  | 75   // Removes an |observer| for the third party vpn driver at |object_path|. | 
|  | 76   virtual void RemoveShillThirdPartyVpnObserver( | 
|  | 77       const dbus::ObjectPath& object_path) = 0; | 
|  | 78 | 
|  | 79   // Calls SetParameters method. | 
|  | 80   // |callback| is called after the method call succeeds. | 
|  | 81   virtual void SetParameters(const dbus::ObjectPath& object_path, | 
|  | 82                              const base::DictionaryValue& parameters, | 
|  | 83                              const VoidDBusMethodCallback& callback) = 0; | 
|  | 84 | 
|  | 85   // Calls UpdateConnectionState method. | 
|  | 86   // |callback| is called after the method call succeeds. | 
|  | 87   virtual void UpdateConnectionState( | 
|  | 88       const dbus::ObjectPath& object_path, | 
|  | 89       const uint32 connection_state, | 
|  | 90       const VoidDBusMethodCallback& callback) = 0; | 
|  | 91 | 
|  | 92   // Calls SendPacket method. | 
|  | 93   // |callback| is called after the method call succeeds. | 
|  | 94   virtual void SendPacket(const dbus::ObjectPath& object_path, | 
|  | 95                           const std::vector<uint8>& ip_packet, | 
|  | 96                           const VoidDBusMethodCallback& callback) = 0; | 
|  | 97 | 
|  | 98   // Returns an interface for testing (stub only), or returns NULL. | 
|  | 99   virtual ShillThirdPartyVpnDriverClient::TestInterface* GetTestInterface() = 0; | 
|  | 100 | 
|  | 101  protected: | 
|  | 102   friend class ShillThirdPartyVpnDriverClientTest; | 
|  | 103 | 
|  | 104   // Create() should be used instead. | 
|  | 105   ShillThirdPartyVpnDriverClient(); | 
|  | 106 | 
|  | 107  private: | 
|  | 108   DISALLOW_COPY_AND_ASSIGN(ShillThirdPartyVpnDriverClient); | 
|  | 109 }; | 
|  | 110 | 
|  | 111 }  // namespace chromeos | 
|  | 112 | 
|  | 113 #endif  // CHROMEOS_DBUS_SHILL_THIRD_PARTY_VPN_DRIVER_CLIENT_H_ | 
| OLD | NEW | 
|---|