1 //
2 // Copyright (C) 2015 The Android Open Source Project
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //      http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 
17 #ifndef APMANAGER_CONTROL_INTERFACE_H_
18 #define APMANAGER_CONTROL_INTERFACE_H_
19 
20 #include <base/callback.h>
21 #include <base/macros.h>
22 
23 #include "apmanager/config_adaptor_interface.h"
24 #include "apmanager/device_adaptor_interface.h"
25 #include "apmanager/firewall_proxy_interface.h"
26 #include "apmanager/manager_adaptor_interface.h"
27 #include "apmanager/service_adaptor_interface.h"
28 #include "apmanager/shill_proxy_interface.h"
29 
30 namespace apmanager {
31 
32 class Config;
33 class Device;
34 class Manager;
35 class Service;
36 
37 // This is the Interface for an object factory that creates adaptor/proxy
38 // objects
39 class ControlInterface {
40  public:
~ControlInterface()41   virtual ~ControlInterface() {}
42 
43   virtual void Init() = 0;
44   virtual void Shutdown() = 0;
45 
46   // Adaptor creation APIs.
47   virtual std::unique_ptr<ConfigAdaptorInterface> CreateConfigAdaptor(
48       Config* config, int service_identifier) = 0;
49   virtual std::unique_ptr<DeviceAdaptorInterface> CreateDeviceAdaptor(
50       Device* device) = 0;
51   virtual std::unique_ptr<ManagerAdaptorInterface> CreateManagerAdaptor(
52       Manager* manager) = 0;
53   virtual std::unique_ptr<ServiceAdaptorInterface> CreateServiceAdaptor(
54       Service* service) = 0;
55 
56   // Proxy creation APIs.
57   virtual std::unique_ptr<FirewallProxyInterface> CreateFirewallProxy(
58       const base::Closure& service_appeared_callback,
59       const base::Closure& service_vanished_callback) = 0;
60   virtual std::unique_ptr<ShillProxyInterface> CreateShillProxy(
61       const base::Closure& service_appeared_callback,
62       const base::Closure& service_vanished_callback) = 0;
63 };
64 
65 }  // namespace apmanager
66 
67 #endif  // APMANAGER_CONTROL_INTERFACE_H_
68