blob: 7d524cf200c8baebcfe7560f1cdf730577809956 [file] [log] [blame]
Darin Petkova9b1fed2012-02-29 11:49:05 +01001// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
Paul Stewart75897df2011-04-27 09:05:53 -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_CONTROL_INTERFACE_
6#define SHILL_CONTROL_INTERFACE_
7
Chris Masone5dec5f42011-07-22 14:07:55 -07008#include <algorithm>
9#include <string>
10
Christopher Wileyd7783522012-08-10 14:21:47 -070011#include "shill/logging.h"
Chris Masone5dec5f42011-07-22 14:07:55 -070012
Paul Stewart75897df2011-04-27 09:05:53 -070013namespace shill {
14
Chris Masone9be4a9d2011-05-16 15:44:09 -070015class Device;
Chris Masoned7732e42011-05-20 11:08:56 -070016class DeviceAdaptorInterface;
Chris Masonec6c6c132011-06-30 11:29:52 -070017class IPConfig;
18class IPConfigAdaptorInterface;
Paul Stewart75897df2011-04-27 09:05:53 -070019class Manager;
Chris Masoned7732e42011-05-20 11:08:56 -070020class ManagerAdaptorInterface;
Chris Masone52cd19b2011-06-29 17:23:04 -070021class Profile;
22class ProfileAdaptorInterface;
Darin Petkova9b1fed2012-02-29 11:49:05 +010023class RPCTask;
24class RPCTaskAdaptorInterface;
Paul Stewart75897df2011-04-27 09:05:53 -070025class Service;
Chris Masoned7732e42011-05-20 11:08:56 -070026class ServiceAdaptorInterface;
Paul Stewart75897df2011-04-27 09:05:53 -070027
Chris Masone413a3192011-05-09 17:10:05 -070028// This is the Interface for an object factory that creates adaptor objects
Paul Stewart75897df2011-04-27 09:05:53 -070029class ControlInterface {
30 public:
Chris Masone52cd19b2011-06-29 17:23:04 -070031 virtual ~ControlInterface() {}
Chris Masone413a3192011-05-09 17:10:05 -070032 virtual DeviceAdaptorInterface *CreateDeviceAdaptor(Device *device) = 0;
Chris Masonec6c6c132011-06-30 11:29:52 -070033 virtual IPConfigAdaptorInterface *CreateIPConfigAdaptor(
34 IPConfig *ipconfig) = 0;
35 virtual ManagerAdaptorInterface *CreateManagerAdaptor(Manager *manager) = 0;
Chris Masone52cd19b2011-06-29 17:23:04 -070036 virtual ProfileAdaptorInterface *CreateProfileAdaptor(Profile *profile) = 0;
Chris Masonec6c6c132011-06-30 11:29:52 -070037 virtual ServiceAdaptorInterface *CreateServiceAdaptor(Service *service) = 0;
Darin Petkova9b1fed2012-02-29 11:49:05 +010038 virtual RPCTaskAdaptorInterface *CreateRPCTaskAdaptor(RPCTask *task) = 0;
Chris Masone5dec5f42011-07-22 14:07:55 -070039
40 static void RpcIdToStorageId(std::string *rpc_id) {
41 CHECK(rpc_id);
Chris Masone34af2182011-08-22 11:59:36 -070042 DCHECK(rpc_id->at(0) == '/');
43 rpc_id->erase(0, 1);
Chris Masone5dec5f42011-07-22 14:07:55 -070044 std::replace(rpc_id->begin(), rpc_id->end(), '/', '_');
45 }
Paul Stewart75897df2011-04-27 09:05:53 -070046};
47
48} // namespace shill
49#endif // SHILL_CONTROL_INTERFACE_