blob: 158695f9f6d8b07f7e328ff3a5912c3e9c61ab5a [file] [log] [blame]
Paul Stewart75897df2011-04-27 09:05:53 -07001// 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 Masone5dec5f42011-07-22 14:07:55 -07008#include <algorithm>
9#include <string>
10
11#include <base/logging.h>
12
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;
Paul Stewart75897df2011-04-27 09:05:53 -070023class Service;
Chris Masoned7732e42011-05-20 11:08:56 -070024class ServiceAdaptorInterface;
Paul Stewart75897df2011-04-27 09:05:53 -070025
Chris Masone413a3192011-05-09 17:10:05 -070026// This is the Interface for an object factory that creates adaptor objects
Paul Stewart75897df2011-04-27 09:05:53 -070027class ControlInterface {
28 public:
Chris Masone52cd19b2011-06-29 17:23:04 -070029 virtual ~ControlInterface() {}
Chris Masone413a3192011-05-09 17:10:05 -070030 virtual DeviceAdaptorInterface *CreateDeviceAdaptor(Device *device) = 0;
Chris Masonec6c6c132011-06-30 11:29:52 -070031 virtual IPConfigAdaptorInterface *CreateIPConfigAdaptor(
32 IPConfig *ipconfig) = 0;
33 virtual ManagerAdaptorInterface *CreateManagerAdaptor(Manager *manager) = 0;
Chris Masone52cd19b2011-06-29 17:23:04 -070034 virtual ProfileAdaptorInterface *CreateProfileAdaptor(Profile *profile) = 0;
Chris Masonec6c6c132011-06-30 11:29:52 -070035 virtual ServiceAdaptorInterface *CreateServiceAdaptor(Service *service) = 0;
Chris Masone5dec5f42011-07-22 14:07:55 -070036
37 static void RpcIdToStorageId(std::string *rpc_id) {
38 CHECK(rpc_id);
Chris Masone34af2182011-08-22 11:59:36 -070039 DCHECK(rpc_id->at(0) == '/');
40 rpc_id->erase(0, 1);
Chris Masone5dec5f42011-07-22 14:07:55 -070041 std::replace(rpc_id->begin(), rpc_id->end(), '/', '_');
42 }
Paul Stewart75897df2011-04-27 09:05:53 -070043};
44
45} // namespace shill
46#endif // SHILL_CONTROL_INTERFACE_