Paul Stewart | 75897df | 2011-04-27 09:05:53 -0700 | [diff] [blame] | 1 | // Copyright (c) 2011 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_CONTROL_INTERFACE_ |
| 6 | #define SHILL_CONTROL_INTERFACE_ |
| 7 | |
Chris Masone | 5dec5f4 | 2011-07-22 14:07:55 -0700 | [diff] [blame] | 8 | #include <algorithm> |
| 9 | #include <string> |
| 10 | |
| 11 | #include <base/logging.h> |
| 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; |
Paul Stewart | 75897df | 2011-04-27 09:05:53 -0700 | [diff] [blame] | 23 | class Service; |
Chris Masone | d7732e4 | 2011-05-20 11:08:56 -0700 | [diff] [blame] | 24 | class ServiceAdaptorInterface; |
Paul Stewart | 75897df | 2011-04-27 09:05:53 -0700 | [diff] [blame] | 25 | |
Chris Masone | 413a319 | 2011-05-09 17:10:05 -0700 | [diff] [blame] | 26 | // This is the Interface for an object factory that creates adaptor objects |
Paul Stewart | 75897df | 2011-04-27 09:05:53 -0700 | [diff] [blame] | 27 | class ControlInterface { |
| 28 | public: |
Chris Masone | 52cd19b | 2011-06-29 17:23:04 -0700 | [diff] [blame] | 29 | virtual ~ControlInterface() {} |
Chris Masone | 413a319 | 2011-05-09 17:10:05 -0700 | [diff] [blame] | 30 | virtual DeviceAdaptorInterface *CreateDeviceAdaptor(Device *device) = 0; |
Chris Masone | c6c6c13 | 2011-06-30 11:29:52 -0700 | [diff] [blame] | 31 | virtual IPConfigAdaptorInterface *CreateIPConfigAdaptor( |
| 32 | IPConfig *ipconfig) = 0; |
| 33 | virtual ManagerAdaptorInterface *CreateManagerAdaptor(Manager *manager) = 0; |
Chris Masone | 52cd19b | 2011-06-29 17:23:04 -0700 | [diff] [blame] | 34 | virtual ProfileAdaptorInterface *CreateProfileAdaptor(Profile *profile) = 0; |
Chris Masone | c6c6c13 | 2011-06-30 11:29:52 -0700 | [diff] [blame] | 35 | virtual ServiceAdaptorInterface *CreateServiceAdaptor(Service *service) = 0; |
Chris Masone | 5dec5f4 | 2011-07-22 14:07:55 -0700 | [diff] [blame] | 36 | |
| 37 | static void RpcIdToStorageId(std::string *rpc_id) { |
| 38 | CHECK(rpc_id); |
Chris Masone | 34af218 | 2011-08-22 11:59:36 -0700 | [diff] [blame] | 39 | DCHECK(rpc_id->at(0) == '/'); |
| 40 | rpc_id->erase(0, 1); |
Chris Masone | 5dec5f4 | 2011-07-22 14:07:55 -0700 | [diff] [blame] | 41 | std::replace(rpc_id->begin(), rpc_id->end(), '/', '_'); |
| 42 | } |
Paul Stewart | 75897df | 2011-04-27 09:05:53 -0700 | [diff] [blame] | 43 | }; |
| 44 | |
| 45 | } // namespace shill |
| 46 | #endif // SHILL_CONTROL_INTERFACE_ |