blob: 243e69700a243beb238be5443969f1ca1c57e6f8 [file] [log] [blame]
Elly Jones16227d32012-02-09 14:17:25 -05001// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
Chris Masoned7732e42011-05-20 11:08:56 -07002// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef SHILL_MANAGER_DBUS_ADAPTOR_H_
6#define SHILL_MANAGER_DBUS_ADAPTOR_H_
7
8#include <map>
9#include <string>
10
11#include <base/basictypes.h>
Chris Masone8fe2c7e2011-06-09 15:51:19 -070012#include <dbus-c++/dbus.h>
Chris Masoned7732e42011-05-20 11:08:56 -070013
14#include "shill/adaptor_interfaces.h"
15#include "shill/dbus_adaptor.h"
Darin Petkov4a09b6b2011-07-19 12:52:06 -070016#include "shill/dbus_bindings/flimflam-manager.h"
Chris Masoned7732e42011-05-20 11:08:56 -070017
18namespace shill {
Chris Masoneec6b18b2011-06-08 14:09:10 -070019
Chris Masoned7732e42011-05-20 11:08:56 -070020class Manager;
21
22// Subclass of DBusAdaptor for Manager objects
Chris Masoneec6b18b2011-06-08 14:09:10 -070023// There is a 1:1 mapping between Manager and ManagerDBusAdaptor
24// instances. Furthermore, the Manager owns the ManagerDBusAdaptor
25// and manages its lifetime, so we're OK with ManagerDBusAdaptor
26// having a bare pointer to its owner manager.
Chris Masoned7732e42011-05-20 11:08:56 -070027class ManagerDBusAdaptor : public org::chromium::flimflam::Manager_adaptor,
28 public DBusAdaptor,
Christopher Wiley0d9cf0c2013-02-19 19:24:57 -080029 public ManagerAdaptorInterface,
30 public base::SupportsWeakPtr<ManagerDBusAdaptor> {
Chris Masoned7732e42011-05-20 11:08:56 -070031 public:
Chris Masoned7732e42011-05-20 11:08:56 -070032 static const char kPath[];
33
Chris Masoned0ceb8c2011-06-02 10:05:39 -070034 ManagerDBusAdaptor(DBus::Connection *conn, Manager *manager);
Chris Masoned7732e42011-05-20 11:08:56 -070035 virtual ~ManagerDBusAdaptor();
Chris Masoned0ceb8c2011-06-02 10:05:39 -070036
37 // Implementation of ManagerAdaptorInterface.
Chris Masone95207da2011-06-29 16:50:49 -070038 virtual const std::string &GetRpcIdentifier() { return path(); }
Chris Masoned7732e42011-05-20 11:08:56 -070039 void UpdateRunning();
Chris Masone8fe2c7e2011-06-09 15:51:19 -070040 void EmitBoolChanged(const std::string &name, bool value);
41 void EmitUintChanged(const std::string &name, uint32 value);
42 void EmitIntChanged(const std::string &name, int value);
43 void EmitStringChanged(const std::string &name, const std::string &value);
Gaurav Shah435de2c2011-11-17 19:01:07 -080044 void EmitStringsChanged(const std::string &name,
45 const std::vector<std::string> &value);
Paul Stewart49739c02012-08-08 17:24:03 -070046 void EmitRpcIdentifierChanged(
47 const std::string &name, const std::string &value);
mukesh agrawal32399322011-09-01 10:53:43 -070048 void EmitRpcIdentifierArrayChanged(
49 const std::string &name, const std::vector<std::string> &value);
Chris Masone8fe2c7e2011-06-09 15:51:19 -070050 void EmitStateChanged(const std::string &new_state);
Chris Masoned7732e42011-05-20 11:08:56 -070051
52 // Implementation of Manager_adaptor
53 std::map<std::string, ::DBus::Variant> GetProperties(::DBus::Error &error);
Chris Masone8fe2c7e2011-06-09 15:51:19 -070054 void SetProperty(const std::string &name,
55 const ::DBus::Variant &value,
Chris Masoned7732e42011-05-20 11:08:56 -070056 ::DBus::Error &error);
57 std::string GetState(::DBus::Error &error);
Chris Masone8fe2c7e2011-06-09 15:51:19 -070058 ::DBus::Path CreateProfile(const std::string &name, ::DBus::Error &error);
59 void RemoveProfile(const std::string &name, ::DBus::Error &error);
60 ::DBus::Path PushProfile(const std::string &, ::DBus::Error &error);
Paul Stewartf3eced92013-04-17 12:18:22 -070061 ::DBus::Path InsertUserProfile(const std::string &,
62 const std::string &,
63 ::DBus::Error &error);
Chris Masone8fe2c7e2011-06-09 15:51:19 -070064 void PopProfile(const std::string &, ::DBus::Error &error);
Chris Masoneccc88812011-06-08 18:00:10 -070065 void PopAnyProfile(::DBus::Error &error);
Paul Stewart307c2502013-03-23 12:32:10 -070066 void PopAllUserProfiles(::DBus::Error &error);
Paul Stewartc681fa02012-03-02 19:40:04 -080067 void RecheckPortal(::DBus::Error &error);
Chris Masone8fe2c7e2011-06-09 15:51:19 -070068 void RequestScan(const std::string &, ::DBus::Error &error);
Chris Masoned7732e42011-05-20 11:08:56 -070069
Chris Masone8fe2c7e2011-06-09 15:51:19 -070070 void EnableTechnology(const std::string &, ::DBus::Error &error);
71 void DisableTechnology(const std::string &, ::DBus::Error &error);
Chris Masoned7732e42011-05-20 11:08:56 -070072
Darin Petkovb65c2452012-02-23 15:17:06 +010073 ::DBus::Path GetService(const std::map<std::string, ::DBus::Variant> &args,
Chris Masoned7732e42011-05-20 11:08:56 -070074 ::DBus::Error &error);
Darin Petkovb65c2452012-02-23 15:17:06 +010075 ::DBus::Path GetVPNService(const std::map<std::string, ::DBus::Variant> &args,
76 ::DBus::Error &error);
77 ::DBus::Path GetWifiService(
78 const std::map<std::string, ::DBus::Variant> &args,
79 ::DBus::Error &error);
Paul Stewartd39d6922012-12-21 08:59:57 -080080 ::DBus::Path ConfigureService(
81 const std::map<std::string, ::DBus::Variant> &args,
82 ::DBus::Error &error);
Paul Stewartd2e1c362013-03-03 19:06:07 -080083 ::DBus::Path ConfigureServiceForProfile(
84 const ::DBus::Path &profile_rpcid,
85 const std::map<std::string, ::DBus::Variant> &args,
86 ::DBus::Error &error);
Paul Stewart7a20aa42013-01-17 12:21:41 -080087 ::DBus::Path FindMatchingService(
88 const std::map<std::string, ::DBus::Variant> &args,
89 ::DBus::Error &error);
Chris Masoned7732e42011-05-20 11:08:56 -070090
Chris Masone7ccc8192011-05-24 14:54:49 -070091 int32_t GetDebugLevel(::DBus::Error &error);
Chris Masone8fe2c7e2011-06-09 15:51:19 -070092 void SetDebugLevel(const int32_t &level, ::DBus::Error &error);
Chris Masoned7732e42011-05-20 11:08:56 -070093
94 std::string GetServiceOrder(::DBus::Error &error);
Chris Masone8fe2c7e2011-06-09 15:51:19 -070095 void SetServiceOrder(const std::string &, ::DBus::Error &error);
Chris Masoned7732e42011-05-20 11:08:56 -070096
Elly Jones16227d32012-02-09 14:17:25 -050097 std::string GetDebugTags(::DBus::Error &error);
98 void SetDebugTags(const std::string &tags, ::DBus::Error &error);
99 std::string ListDebugTags(::DBus::Error &error);
100
Gaurav Shah645bff82012-10-08 14:06:04 -0700101 std::map<std::string, ::DBus::Variant> GetNetworksForGeolocation(
102 ::DBus::Error &error);
103
Christopher Wiley3d5ab402013-02-15 13:25:58 -0800104 bool VerifyDestination(const std::string &certificate,
105 const std::string &public_key,
106 const std::string &nonce,
107 const std::string &signed_data,
108 const std::string &destination_udn,
Christopher Wileycdde79f2013-05-01 14:26:56 -0700109 const std::string &hotspot_ssid,
110 const std::string &hotspot_bssid,
Christopher Wiley3d5ab402013-02-15 13:25:58 -0800111 ::DBus::Error &error);
112
113 std::string VerifyAndEncryptCredentials(const std::string &certificate,
114 const std::string &public_key,
115 const std::string &nonce,
116 const std::string &signed_data,
117 const std::string &destination_udn,
Christopher Wileycdde79f2013-05-01 14:26:56 -0700118 const std::string &hotspot_ssid,
119 const std::string &hotspot_bssid,
Christopher Wiley3d5ab402013-02-15 13:25:58 -0800120 const ::DBus::Path &path,
121 ::DBus::Error &error);
122
123 std::string VerifyAndEncryptData(const std::string &certificate,
124 const std::string &public_key,
125 const std::string &nonce,
126 const std::string &signed_data,
127 const std::string &destination_udn,
Christopher Wileycdde79f2013-05-01 14:26:56 -0700128 const std::string &hotspot_ssid,
129 const std::string &hotspot_bssid,
Christopher Wiley3d5ab402013-02-15 13:25:58 -0800130 const std::string &data,
131 ::DBus::Error &error);
132
Paul Stewart39db5ca2013-03-18 14:15:17 -0700133 void ConnectToBestServices(::DBus::Error &error);
134
Chris Masoned7732e42011-05-20 11:08:56 -0700135 private:
136 Manager *manager_;
137 DISALLOW_COPY_AND_ASSIGN(ManagerDBusAdaptor);
138};
139
140} // namespace shill
141#endif // SHILL_MANAGER_DBUS_ADAPTOR_H_