blob: 55830e545166a7118e06d81aee8a102c7ee8d9f6 [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;
Prabhu Kaliamoorthi127b3412014-10-16 13:00:25 +020027class ThirdPartyVpnDriver;
28class ThirdPartyVpnAdaptorInterface;
Paul Stewart75897df2011-04-27 09:05:53 -070029
Chris Masone413a3192011-05-09 17:10:05 -070030// This is the Interface for an object factory that creates adaptor objects
Paul Stewart75897df2011-04-27 09:05:53 -070031class ControlInterface {
32 public:
Chris Masone52cd19b2011-06-29 17:23:04 -070033 virtual ~ControlInterface() {}
Paul Stewarta794cd62015-06-16 13:13:10 -070034 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 Kaliamoorthi127b3412014-10-16 13:00:25 +020041#ifndef DISABLE_VPN
Paul Stewarta794cd62015-06-16 13:13:10 -070042 virtual ThirdPartyVpnAdaptorInterface* CreateThirdPartyVpnAdaptor(
43 ThirdPartyVpnDriver* driver) = 0;
Prabhu Kaliamoorthi127b3412014-10-16 13:00:25 +020044#endif
Chris Masone5dec5f42011-07-22 14:07:55 -070045
Paul Stewarta794cd62015-06-16 13:13:10 -070046 static void RpcIdToStorageId(std::string* rpc_id) {
Chris Masone5dec5f42011-07-22 14:07:55 -070047 CHECK(rpc_id);
Alex Vakulenko8a532292014-06-16 17:18:44 -070048 DCHECK_EQ(rpc_id->at(0), '/');
Chris Masone34af2182011-08-22 11:59:36 -070049 rpc_id->erase(0, 1);
Chris Masone5dec5f42011-07-22 14:07:55 -070050 std::replace(rpc_id->begin(), rpc_id->end(), '/', '_');
51 }
Paul Stewart75897df2011-04-27 09:05:53 -070052};
53
54} // namespace shill
Ben Chanc45688b2014-07-02 23:50:45 -070055
56#endif // SHILL_CONTROL_INTERFACE_H_