Darin Petkov | a9b1fed | 2012-02-29 11:49:05 +0100 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS 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 SHILL_RPC_TASK_DBUS_ADAPTOR_H_ |
| 6 | #define SHILL_RPC_TASK_DBUS_ADAPTOR_H_ |
| 7 | |
| 8 | #include <base/basictypes.h> |
| 9 | |
| 10 | #include "shill/adaptor_interfaces.h" |
| 11 | #include "shill/dbus_adaptor.h" |
| 12 | #include "shill/dbus_bindings/flimflam-task.h" |
| 13 | |
| 14 | namespace shill { |
| 15 | |
| 16 | class RPCTask; |
| 17 | |
| 18 | // Subclass of DBusAdaptor for RPCTask objects. There is a 1:1 mapping between |
| 19 | // RPCTask and RPCTaskDBusAdaptor instances. Furthermore, the RPCTask owns the |
| 20 | // RPCTaskDBusAdaptor and manages its lifetime, so we're OK with |
| 21 | // RPCTaskDBusAdaptor having a bare pointer to its owner task. |
| 22 | class RPCTaskDBusAdaptor : public org::chromium::flimflam::Task_adaptor, |
| 23 | public DBusAdaptor, |
| 24 | public RPCTaskAdaptorInterface { |
| 25 | public: |
Darin Petkov | a9b1fed | 2012-02-29 11:49:05 +0100 | [diff] [blame] | 26 | static const char kPath[]; |
| 27 | |
| 28 | RPCTaskDBusAdaptor(DBus::Connection *conn, RPCTask *task); |
| 29 | virtual ~RPCTaskDBusAdaptor(); |
| 30 | |
| 31 | // Implementation of RPCTaskAdaptorInterface. |
| 32 | virtual const std::string &GetRpcIdentifier(); |
| 33 | virtual const std::string &GetRpcInterfaceIdentifier(); |
| 34 | virtual const std::string &GetRpcConnectionIdentifier(); |
| 35 | |
| 36 | // Implementation of Task_adaptor |
Darin Petkov | 209e629 | 2012-04-20 11:33:32 +0200 | [diff] [blame] | 37 | virtual void getsec( |
| 38 | std::string &user, std::string &password, DBus::Error &error); |
Darin Petkov | a9b1fed | 2012-02-29 11:49:05 +0100 | [diff] [blame] | 39 | virtual void notify(const std::string &reason, |
| 40 | const std::map<std::string, std::string> &dict, |
| 41 | DBus::Error &error); |
| 42 | |
| 43 | private: |
| 44 | RPCTask *task_; |
| 45 | const std::string interface_name_; |
| 46 | const std::string connection_name_; |
| 47 | |
| 48 | DISALLOW_COPY_AND_ASSIGN(RPCTaskDBusAdaptor); |
| 49 | }; |
| 50 | |
| 51 | } // namespace shill |
| 52 | |
| 53 | #endif // SHILL_RPC_TASK_DBUS_ADAPTOR_H_ |