blob: 11bfa12a5948db3e905a5bb70839341c3b0f3804 [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
Ben Chanc45688b2014-07-02 23:50:45 -07005#ifndef SHILL_CONTROL_INTERFACE_H_
6#define SHILL_CONTROL_INTERFACE_H_
Paul Stewart75897df2011-04-27 09:05:53 -07007
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);
Alex Vakulenko8a532292014-06-16 17:18:44 -070042 DCHECK_EQ(rpc_id->at(0), '/');
Chris Masone34af2182011-08-22 11:59:36 -070043 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
Ben Chanc45688b2014-07-02 23:50:45 -070049
50#endif // SHILL_CONTROL_INTERFACE_H_