Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Side by Side Diff: chromeos/dbus/shill_third_party_vpn_driver_client.h

Issue 681723003: Add new shill client for VPN (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated the interface to better suit the upper layer Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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"
pneubeck (no reviews) 2014/11/10 16:44:08 should be base/macros.h if it's for DISALLOW_COPY_
kaliamoorthi 2014/11/11 14:58:34 This is included for uint32 etc.
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 #include "dbus/object_path.h"
pneubeck (no reviews) 2014/11/10 16:44:08 nit: forward declare ObjectPath instead of includi
kaliamoorthi 2014/11/11 14:58:34 This is necessary for a kind of dependency injecti
pneubeck (no reviews) 2014/11/12 14:21:07 This doesn't sound right to me. You should only us
14
15 namespace shill {
16
17 // TODO(kaliamoorthi): Move these constants to dbus/service_constants.h
pneubeck (no reviews) 2014/11/10 16:44:08 please roll the cros_system dependency at first, i
kaliamoorthi 2014/11/11 14:58:34 Done.
18 const char kFlimflamThirdPartyVpnInterface[] =
19 "org.chromium.flimflam.ThirdPartyVpn";
20 const char kSetParametersFunction[] = "SetParameters";
21 const char kSendPacketFunction[] = "SendPacket";
22 const char kUpdateConnectionStateFunction[] = "UpdateConnectionState";
23 const char kOnPacketReceivedFunction[] = "OnPacketReceived";
24 const char kOnPlatformMessageFunction[] = "OnPlatformMessage";
25
26 const char kAddressParameterThirdPartyVpn[] = "address";
27 const char kBroadcastAddressParameterThirdPartyVpn[] = "broadcast_address";
28 const char kGatewayParameterThirdPartyVpn[] = "gateway";
29 const char kBypassTunnelForIpParameterThirdPartyVpn[] = "bypass_tunnel_for_ip";
30 const char kSubnetPrefixParameterThirdPartyVpn[] = "subnet_prefix";
31 const char kMtuParameterThirdPartyVpn[] = "mtu";
32 const char kDomainSearchParameterThirdPartyVpn[] = "domain_search";
33 const char kDnsServersParameterThirdPartyVpn[] = "dns_servers";
34
35 } // namespace shill
36
37 namespace chromeos {
38
39 class ShillThirdPartyVpnObserver;
40
41 // ShillThirdPartyVpnDriverClient is used to communicate with the Shill
42 // ThirdPartyVpnDriver service.
43 // All methods should be called from the origin thread which initializes the
44 // DBusThreadManager instance.
45 class CHROMEOS_EXPORT ShillThirdPartyVpnDriverClient : public DBusClient {
46 public:
47 class TestInterface {
48 public:
49 virtual void OnPacketReceived(const dbus::ObjectPath& object_path,
50 const uint8* data,
pneubeck (no reviews) 2014/11/11 13:17:16 like for the observer, you should consider using s
kaliamoorthi 2014/11/11 14:58:34 Done.
51 size_t length) = 0;
52 virtual void OnPlatformMessage(const dbus::ObjectPath& object_path,
53 uint32 message) = 0;
54
55 protected:
56 virtual ~TestInterface() {}
57 };
58
59 ~ShillThirdPartyVpnDriverClient() override;
60
61 // Factory function, creates a new instance which is owned by the caller.
62 // For normal usage, access the singleton via DBusThreadManager::Get().
63 static ShillThirdPartyVpnDriverClient* Create();
64
65 // Adds an |observer| for the third party vpn driver at |object_path|.
66 virtual void AddShillThirdPartyVpnObserver(
67 const dbus::ObjectPath& object_path,
68 ShillThirdPartyVpnObserver* observer) = 0;
69
70 // Removes an |observer| for the third party vpn driver at |object_path|.
71 virtual void RemoveShillThirdPartyVpnObserver(
72 const dbus::ObjectPath& object_path) = 0;
73
74 // Calls SetParameters method.
75 // |callback| is called after the method call succeeds.
76 virtual void SetParameters(
77 const dbus::ObjectPath& object_path,
78 const base::DictionaryValue& parameters,
79 const base::Closure& callback,
80 const ShillClientHelper::ErrorCallback& error_callback) = 0;
81
82 // Calls UpdateConnectionState method.
83 // |callback| is called after the method call succeeds.
84 virtual void UpdateConnectionState(
85 const dbus::ObjectPath& object_path,
86 const uint32 connection_state,
87 const base::Closure& callback,
88 const ShillClientHelper::ErrorCallback& error_callback) = 0;
89
90 // Calls SendPacket method.
91 // |callback| is called after the method call succeeds.
92 virtual void SendPacket(
93 const dbus::ObjectPath& object_path,
94 const std::string& ip_packet,
95 const base::Closure& callback,
96 const ShillClientHelper::ErrorCallback& error_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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698