Darin Petkov | a9b1fed | 2012-02-29 11:49:05 +0100 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
Paul Stewart | 75897df | 2011-04-27 09:05:53 -0700 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
Ben Chan | c45688b | 2014-07-02 23:50:45 -0700 | [diff] [blame] | 5 | #ifndef SHILL_CONTROL_INTERFACE_H_ |
| 6 | #define SHILL_CONTROL_INTERFACE_H_ |
Paul Stewart | 75897df | 2011-04-27 09:05:53 -0700 | [diff] [blame] | 7 | |
Chris Masone | 5dec5f4 | 2011-07-22 14:07:55 -0700 | [diff] [blame] | 8 | #include <algorithm> |
| 9 | #include <string> |
| 10 | |
Christopher Wiley | d778352 | 2012-08-10 14:21:47 -0700 | [diff] [blame] | 11 | #include "shill/logging.h" |
Chris Masone | 5dec5f4 | 2011-07-22 14:07:55 -0700 | [diff] [blame] | 12 | |
Paul Stewart | 75897df | 2011-04-27 09:05:53 -0700 | [diff] [blame] | 13 | namespace shill { |
| 14 | |
Chris Masone | 9be4a9d | 2011-05-16 15:44:09 -0700 | [diff] [blame] | 15 | class Device; |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 16 | class DeviceAdaptorInterface; |
Chris Masone | c6c6c13 | 2011-06-30 11:29:52 -0700 | [diff] [blame] | 17 | class IPConfig; |
| 18 | class IPConfigAdaptorInterface; |
Paul Stewart | 75897df | 2011-04-27 09:05:53 -0700 | [diff] [blame] | 19 | class Manager; |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 20 | class ManagerAdaptorInterface; |
Chris Masone | 52cd19b | 2011-06-29 17:23:04 -0700 | [diff] [blame] | 21 | class Profile; |
| 22 | class ProfileAdaptorInterface; |
Darin Petkov | a9b1fed | 2012-02-29 11:49:05 +0100 | [diff] [blame] | 23 | class RPCTask; |
| 24 | class RPCTaskAdaptorInterface; |
Paul Stewart | 75897df | 2011-04-27 09:05:53 -0700 | [diff] [blame] | 25 | class Service; |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 26 | class ServiceAdaptorInterface; |
Paul Stewart | 75897df | 2011-04-27 09:05:53 -0700 | [diff] [blame] | 27 | |
Chris Masone | 413a319 | 2011-05-09 17:10:05 -0700 | [diff] [blame] | 28 | // This is the Interface for an object factory that creates adaptor objects |
Paul Stewart | 75897df | 2011-04-27 09:05:53 -0700 | [diff] [blame] | 29 | class ControlInterface { |
| 30 | public: |
Chris Masone | 52cd19b | 2011-06-29 17:23:04 -0700 | [diff] [blame] | 31 | virtual ~ControlInterface() {} |
Chris Masone | 413a319 | 2011-05-09 17:10:05 -0700 | [diff] [blame] | 32 | virtual DeviceAdaptorInterface *CreateDeviceAdaptor(Device *device) = 0; |
Chris Masone | c6c6c13 | 2011-06-30 11:29:52 -0700 | [diff] [blame] | 33 | virtual IPConfigAdaptorInterface *CreateIPConfigAdaptor( |
| 34 | IPConfig *ipconfig) = 0; |
| 35 | virtual ManagerAdaptorInterface *CreateManagerAdaptor(Manager *manager) = 0; |
Chris Masone | 52cd19b | 2011-06-29 17:23:04 -0700 | [diff] [blame] | 36 | virtual ProfileAdaptorInterface *CreateProfileAdaptor(Profile *profile) = 0; |
Chris Masone | c6c6c13 | 2011-06-30 11:29:52 -0700 | [diff] [blame] | 37 | virtual ServiceAdaptorInterface *CreateServiceAdaptor(Service *service) = 0; |
Darin Petkov | a9b1fed | 2012-02-29 11:49:05 +0100 | [diff] [blame] | 38 | virtual RPCTaskAdaptorInterface *CreateRPCTaskAdaptor(RPCTask *task) = 0; |
Chris Masone | 5dec5f4 | 2011-07-22 14:07:55 -0700 | [diff] [blame] | 39 | |
| 40 | static void RpcIdToStorageId(std::string *rpc_id) { |
| 41 | CHECK(rpc_id); |
Alex Vakulenko | 8a53229 | 2014-06-16 17:18:44 -0700 | [diff] [blame] | 42 | DCHECK_EQ(rpc_id->at(0), '/'); |
Chris Masone | 34af218 | 2011-08-22 11:59:36 -0700 | [diff] [blame] | 43 | rpc_id->erase(0, 1); |
Chris Masone | 5dec5f4 | 2011-07-22 14:07:55 -0700 | [diff] [blame] | 44 | std::replace(rpc_id->begin(), rpc_id->end(), '/', '_'); |
| 45 | } |
Paul Stewart | 75897df | 2011-04-27 09:05:53 -0700 | [diff] [blame] | 46 | }; |
| 47 | |
| 48 | } // namespace shill |
Ben Chan | c45688b | 2014-07-02 23:50:45 -0700 | [diff] [blame] | 49 | |
| 50 | #endif // SHILL_CONTROL_INTERFACE_H_ |