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.
5 #ifndef CHROMEOS_DBUS_SHILL_THIRD_PARTY_VPN_DRIVER_CLIENT_H_
6 #define CHROMEOS_DBUS_SHILL_THIRD_PARTY_VPN_DRIVER_CLIENT_H_
12 #include "base/callback.h"
13 #include "chromeos/chromeos_export.h"
14 #include "chromeos/dbus/dbus_client.h"
15 #include "chromeos/dbus/shill_client_helper.h"
19 class ShillThirdPartyVpnObserver
;
21 // ShillThirdPartyVpnDriverClient is used to communicate with the Shill
22 // ThirdPartyVpnDriver service.
23 // All methods should be called from the origin thread which initializes the
24 // DBusThreadManager instance.
25 class CHROMEOS_EXPORT ShillThirdPartyVpnDriverClient
: public DBusClient
{
29 virtual void OnPacketReceived(const std::string
& object_path_value
,
30 const std::vector
<char>& packet
) = 0;
31 virtual void OnPlatformMessage(const std::string
& object_path_value
,
32 uint32_t message
) = 0;
35 virtual ~TestInterface() {}
38 ~ShillThirdPartyVpnDriverClient() override
;
40 // Factory function, creates a new instance which is owned by the caller.
41 // For normal usage, access the singleton via DBusThreadManager::Get().
42 static ShillThirdPartyVpnDriverClient
* Create();
44 // Adds an |observer| for the third party vpn driver at |object_path_value|.
45 virtual void AddShillThirdPartyVpnObserver(
46 const std::string
& object_path_value
,
47 ShillThirdPartyVpnObserver
* observer
) = 0;
49 // Removes an |observer| for the third party vpn driver at
50 // |object_path_value|.
51 virtual void RemoveShillThirdPartyVpnObserver(
52 const std::string
& object_path_value
) = 0;
54 // Calls SetParameters method.
55 // |callback| is called after the method call succeeds.
56 virtual void SetParameters(
57 const std::string
& object_path_value
,
58 const base::DictionaryValue
& parameters
,
59 const ShillClientHelper::StringCallback
& callback
,
60 const ShillClientHelper::ErrorCallback
& error_callback
) = 0;
62 // Calls UpdateConnectionState method.
63 // |callback| is called after the method call succeeds.
64 virtual void UpdateConnectionState(
65 const std::string
& object_path_value
,
66 const uint32_t connection_state
,
67 const base::Closure
& callback
,
68 const ShillClientHelper::ErrorCallback
& error_callback
) = 0;
70 // Calls SendPacket method.
71 // |callback| is called after the method call succeeds.
72 virtual void SendPacket(
73 const std::string
& object_path_value
,
74 const std::vector
<char>& ip_packet
,
75 const base::Closure
& callback
,
76 const ShillClientHelper::ErrorCallback
& error_callback
) = 0;
78 // Returns an interface for testing (stub only), or returns nullptr.
79 virtual ShillThirdPartyVpnDriverClient::TestInterface
* GetTestInterface() = 0;
82 friend class ShillThirdPartyVpnDriverClientTest
;
84 // Create() should be used instead.
85 ShillThirdPartyVpnDriverClient();
88 DISALLOW_COPY_AND_ASSIGN(ShillThirdPartyVpnDriverClient
);
91 } // namespace chromeos
93 #endif // CHROMEOS_DBUS_SHILL_THIRD_PARTY_VPN_DRIVER_CLIENT_H_