blob: bd5e557760793073418450712cc5575061eefc83 [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,
29 public ManagerAdaptorInterface {
30 public:
Chris Masoned7732e42011-05-20 11:08:56 -070031 static const char kPath[];
32
Chris Masoned0ceb8c2011-06-02 10:05:39 -070033 ManagerDBusAdaptor(DBus::Connection *conn, Manager *manager);
Chris Masoned7732e42011-05-20 11:08:56 -070034 virtual ~ManagerDBusAdaptor();
Chris Masoned0ceb8c2011-06-02 10:05:39 -070035
36 // Implementation of ManagerAdaptorInterface.
Chris Masone95207da2011-06-29 16:50:49 -070037 virtual const std::string &GetRpcIdentifier() { return path(); }
Chris Masoned7732e42011-05-20 11:08:56 -070038 void UpdateRunning();
Chris Masone8fe2c7e2011-06-09 15:51:19 -070039 void EmitBoolChanged(const std::string &name, bool value);
40 void EmitUintChanged(const std::string &name, uint32 value);
41 void EmitIntChanged(const std::string &name, int value);
42 void EmitStringChanged(const std::string &name, const std::string &value);
Gaurav Shah435de2c2011-11-17 19:01:07 -080043 void EmitStringsChanged(const std::string &name,
44 const std::vector<std::string> &value);
mukesh agrawal32399322011-09-01 10:53:43 -070045 void EmitRpcIdentifierArrayChanged(
46 const std::string &name, const std::vector<std::string> &value);
Chris Masone8fe2c7e2011-06-09 15:51:19 -070047 void EmitStateChanged(const std::string &new_state);
Chris Masoned7732e42011-05-20 11:08:56 -070048
49 // Implementation of Manager_adaptor
50 std::map<std::string, ::DBus::Variant> GetProperties(::DBus::Error &error);
Chris Masone8fe2c7e2011-06-09 15:51:19 -070051 void SetProperty(const std::string &name,
52 const ::DBus::Variant &value,
Chris Masoned7732e42011-05-20 11:08:56 -070053 ::DBus::Error &error);
54 std::string GetState(::DBus::Error &error);
Chris Masone8fe2c7e2011-06-09 15:51:19 -070055 ::DBus::Path CreateProfile(const std::string &name, ::DBus::Error &error);
56 void RemoveProfile(const std::string &name, ::DBus::Error &error);
57 ::DBus::Path PushProfile(const std::string &, ::DBus::Error &error);
58 void PopProfile(const std::string &, ::DBus::Error &error);
Chris Masoneccc88812011-06-08 18:00:10 -070059 void PopAnyProfile(::DBus::Error &error);
Paul Stewartc681fa02012-03-02 19:40:04 -080060 void RecheckPortal(::DBus::Error &error);
Chris Masone8fe2c7e2011-06-09 15:51:19 -070061 void RequestScan(const std::string &, ::DBus::Error &error);
Chris Masoned7732e42011-05-20 11:08:56 -070062
Chris Masone8fe2c7e2011-06-09 15:51:19 -070063 void EnableTechnology(const std::string &, ::DBus::Error &error);
64 void DisableTechnology(const std::string &, ::DBus::Error &error);
Chris Masoned7732e42011-05-20 11:08:56 -070065
Darin Petkovb65c2452012-02-23 15:17:06 +010066 ::DBus::Path GetService(const std::map<std::string, ::DBus::Variant> &args,
Chris Masoned7732e42011-05-20 11:08:56 -070067 ::DBus::Error &error);
Darin Petkovb65c2452012-02-23 15:17:06 +010068 ::DBus::Path GetVPNService(const std::map<std::string, ::DBus::Variant> &args,
69 ::DBus::Error &error);
70 ::DBus::Path GetWifiService(
71 const std::map<std::string, ::DBus::Variant> &args,
72 ::DBus::Error &error);
Paul Stewart7f61e522012-03-22 11:13:45 -070073 void ConfigureService(const std::map<std::string, ::DBus::Variant> &args,
74 ::DBus::Error &error);
Chris Masoned7732e42011-05-20 11:08:56 -070075
Chris Masone7ccc8192011-05-24 14:54:49 -070076 int32_t GetDebugLevel(::DBus::Error &error);
Chris Masone8fe2c7e2011-06-09 15:51:19 -070077 void SetDebugLevel(const int32_t &level, ::DBus::Error &error);
Chris Masoned7732e42011-05-20 11:08:56 -070078
79 std::string GetServiceOrder(::DBus::Error &error);
Chris Masone8fe2c7e2011-06-09 15:51:19 -070080 void SetServiceOrder(const std::string &, ::DBus::Error &error);
Chris Masoned7732e42011-05-20 11:08:56 -070081
Elly Jones16227d32012-02-09 14:17:25 -050082 std::string GetDebugTags(::DBus::Error &error);
83 void SetDebugTags(const std::string &tags, ::DBus::Error &error);
84 std::string ListDebugTags(::DBus::Error &error);
85
Chris Masoned7732e42011-05-20 11:08:56 -070086 private:
87 Manager *manager_;
88 DISALLOW_COPY_AND_ASSIGN(ManagerDBusAdaptor);
89};
90
91} // namespace shill
92#endif // SHILL_MANAGER_DBUS_ADAPTOR_H_