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; |
Prabhu Kaliamoorthi | 127b341 | 2014-10-16 13:00:25 +0200 | [diff] [blame] | 27 | class ThirdPartyVpnDriver; |
| 28 | class ThirdPartyVpnAdaptorInterface; |
Paul Stewart | 75897df | 2011-04-27 09:05:53 -0700 | [diff] [blame] | 29 | |
Chris Masone | 413a319 | 2011-05-09 17:10:05 -0700 | [diff] [blame] | 30 | // This is the Interface for an object factory that creates adaptor objects |
Paul Stewart | 75897df | 2011-04-27 09:05:53 -0700 | [diff] [blame] | 31 | class ControlInterface { |
| 32 | public: |
Chris Masone | 52cd19b | 2011-06-29 17:23:04 -0700 | [diff] [blame] | 33 | virtual ~ControlInterface() {} |
Paul Stewart | a794cd6 | 2015-06-16 13:13:10 -0700 | [diff] [blame] | 34 | virtual DeviceAdaptorInterface* CreateDeviceAdaptor(Device* device) = 0; |
| 35 | virtual IPConfigAdaptorInterface* CreateIPConfigAdaptor( |
| 36 | IPConfig* ipconfig) = 0; |
| 37 | virtual ManagerAdaptorInterface* CreateManagerAdaptor(Manager* manager) = 0; |
| 38 | virtual ProfileAdaptorInterface* CreateProfileAdaptor(Profile* profile) = 0; |
| 39 | virtual ServiceAdaptorInterface* CreateServiceAdaptor(Service* service) = 0; |
| 40 | virtual RPCTaskAdaptorInterface* CreateRPCTaskAdaptor(RPCTask* task) = 0; |
Prabhu Kaliamoorthi | 127b341 | 2014-10-16 13:00:25 +0200 | [diff] [blame] | 41 | #ifndef DISABLE_VPN |
Paul Stewart | a794cd6 | 2015-06-16 13:13:10 -0700 | [diff] [blame] | 42 | virtual ThirdPartyVpnAdaptorInterface* CreateThirdPartyVpnAdaptor( |
| 43 | ThirdPartyVpnDriver* driver) = 0; |
Prabhu Kaliamoorthi | 127b341 | 2014-10-16 13:00:25 +0200 | [diff] [blame] | 44 | #endif |
Chris Masone | 5dec5f4 | 2011-07-22 14:07:55 -0700 | [diff] [blame] | 45 | |
Paul Stewart | a794cd6 | 2015-06-16 13:13:10 -0700 | [diff] [blame] | 46 | static void RpcIdToStorageId(std::string* rpc_id) { |
Chris Masone | 5dec5f4 | 2011-07-22 14:07:55 -0700 | [diff] [blame] | 47 | CHECK(rpc_id); |
Alex Vakulenko | 8a53229 | 2014-06-16 17:18:44 -0700 | [diff] [blame] | 48 | DCHECK_EQ(rpc_id->at(0), '/'); |
Chris Masone | 34af218 | 2011-08-22 11:59:36 -0700 | [diff] [blame] | 49 | rpc_id->erase(0, 1); |
Chris Masone | 5dec5f4 | 2011-07-22 14:07:55 -0700 | [diff] [blame] | 50 | std::replace(rpc_id->begin(), rpc_id->end(), '/', '_'); |
| 51 | } |
Paul Stewart | 75897df | 2011-04-27 09:05:53 -0700 | [diff] [blame] | 52 | }; |
| 53 | |
| 54 | } // namespace shill |
Ben Chan | c45688b | 2014-07-02 23:50:45 -0700 | [diff] [blame] | 55 | |
| 56 | #endif // SHILL_CONTROL_INTERFACE_H_ |