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_
10 #include "base/callback.h"
11 #include "chromeos/chromeos_export.h"
12 #include "chromeos/dbus/dbus_client.h"
13 #include "chromeos/dbus/shill_client_helper.h"
17 class ShillThirdPartyVpnObserver
;
19 // ShillThirdPartyVpnDriverClient is used to communicate with the Shill
20 // ThirdPartyVpnDriver service.
21 // All methods should be called from the origin thread which initializes the
22 // DBusThreadManager instance.
23 class CHROMEOS_EXPORT ShillThirdPartyVpnDriverClient
: public DBusClient
{
27 virtual void OnPacketReceived(const std::string
& object_path_value
,
28 const std::string
& packet
) = 0;
29 virtual void OnPlatformMessage(const std::string
& object_path_value
,
30 uint32_t message
) = 0;
33 virtual ~TestInterface() {}
36 ~ShillThirdPartyVpnDriverClient() override
;
38 // Factory function, creates a new instance which is owned by the caller.
39 // For normal usage, access the singleton via DBusThreadManager::Get().
40 static ShillThirdPartyVpnDriverClient
* Create();
42 // Adds an |observer| for the third party vpn driver at |object_path_value|.
43 virtual void AddShillThirdPartyVpnObserver(
44 const std::string
& object_path_value
,
45 ShillThirdPartyVpnObserver
* observer
) = 0;
47 // Removes an |observer| for the third party vpn driver at
48 // |object_path_value|.
49 virtual void RemoveShillThirdPartyVpnObserver(
50 const std::string
& object_path_value
) = 0;
52 // Calls SetParameters method.
53 // |callback| is called after the method call succeeds.
54 virtual void SetParameters(
55 const std::string
& object_path_value
,
56 const base::DictionaryValue
& parameters
,
57 const base::Closure
& callback
,
58 const ShillClientHelper::ErrorCallback
& error_callback
) = 0;
60 // Calls UpdateConnectionState method.
61 // |callback| is called after the method call succeeds.
62 virtual void UpdateConnectionState(
63 const std::string
& object_path_value
,
64 const uint32_t connection_state
,
65 const base::Closure
& callback
,
66 const ShillClientHelper::ErrorCallback
& error_callback
) = 0;
68 // Calls SendPacket method.
69 // |callback| is called after the method call succeeds.
70 virtual void SendPacket(
71 const std::string
& object_path_value
,
72 const std::string
& ip_packet
,
73 const base::Closure
& callback
,
74 const ShillClientHelper::ErrorCallback
& error_callback
) = 0;
76 // Returns an interface for testing (stub only), or returns nullptr.
77 virtual ShillThirdPartyVpnDriverClient::TestInterface
* GetTestInterface() = 0;
80 friend class ShillThirdPartyVpnDriverClientTest
;
82 // Create() should be used instead.
83 ShillThirdPartyVpnDriverClient();
86 DISALLOW_COPY_AND_ASSIGN(ShillThirdPartyVpnDriverClient
);
89 } // namespace chromeos
91 #endif // CHROMEOS_DBUS_SHILL_THIRD_PARTY_VPN_DRIVER_CLIENT_H_