• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright (C) 2012 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 SHILL_ADAPTOR_INTERFACES_H_
18 #define SHILL_ADAPTOR_INTERFACES_H_
19 
20 #include <string>
21 #include <vector>
22 
23 #include <base/callback.h>
24 
25 #include "shill/accessor_interface.h"
26 
27 namespace shill {
28 
29 class Error;
30 
31 // These are the functions that a Device adaptor must support
32 class DeviceAdaptorInterface {
33  public:
~DeviceAdaptorInterface()34   virtual ~DeviceAdaptorInterface() {}
35 
36   // Getter for the opaque identifier that represents this object on the
37   // RPC interface to which the implementation is adapting.
38   virtual const std::string& GetRpcIdentifier() = 0;
39 
40   virtual void EmitBoolChanged(const std::string& name, bool value) = 0;
41   virtual void EmitUintChanged(const std::string& name, uint32_t value) = 0;
42   virtual void EmitUint16Changed(const std::string& name, uint16_t value) = 0;
43   virtual void EmitIntChanged(const std::string& name, int value) = 0;
44   virtual void EmitStringChanged(const std::string& name,
45                                  const std::string& value) = 0;
46   virtual void EmitStringmapChanged(const std::string& name,
47                                     const Stringmap& value) = 0;
48   virtual void EmitStringmapsChanged(const std::string& name,
49                                      const Stringmaps& value) = 0;
50   virtual void EmitStringsChanged(const std::string& name,
51                                   const Strings& value) = 0;
52   virtual void EmitKeyValueStoreChanged(const std::string& name,
53                                         const KeyValueStore& value) = 0;
54   virtual void EmitRpcIdentifierChanged(const std::string& name,
55                                         const std::string& value) = 0;
56   virtual void EmitRpcIdentifierArrayChanged(
57       const std::string& name, const std::vector<std::string>& value) = 0;
58 };
59 
60 // These are the functions that an IPConfig adaptor must support
61 class IPConfigAdaptorInterface {
62  public:
~IPConfigAdaptorInterface()63   virtual ~IPConfigAdaptorInterface() {}
64 
65   // Getter for the opaque identifier that represents this object on the
66   // RPC interface to which the implementation is adapting.
67   virtual const std::string& GetRpcIdentifier() = 0;
68 
69   virtual void EmitBoolChanged(const std::string& name, bool value) = 0;
70   virtual void EmitUintChanged(const std::string& name, uint32_t value) = 0;
71   virtual void EmitIntChanged(const std::string& name, int value) = 0;
72   virtual void EmitStringChanged(const std::string& name,
73                                  const std::string& value) = 0;
74   virtual void EmitStringsChanged(const std::string& name,
75                                   const std::vector<std::string>& value) = 0;
76 };
77 
78 // These are the functions that a Manager adaptor must support
79 class ManagerAdaptorInterface {
80  public:
~ManagerAdaptorInterface()81   virtual ~ManagerAdaptorInterface() {}
82 
83   virtual void RegisterAsync(
84       const base::Callback<void(bool)>& completion_callback) = 0;
85 
86   // Getter for the opaque identifier that represents this object on the
87   // RPC interface to which the implementation is adapting.
88   virtual const std::string& GetRpcIdentifier() = 0;
89 
90   virtual void EmitBoolChanged(const std::string& name, bool value) = 0;
91   virtual void EmitUintChanged(const std::string& name, uint32_t value) = 0;
92   virtual void EmitIntChanged(const std::string& name, int value) = 0;
93   virtual void EmitStringChanged(const std::string& name,
94                                  const std::string& value) = 0;
95   virtual void EmitStringsChanged(const std::string& name,
96                                   const std::vector<std::string>& value) = 0;
97   virtual void EmitRpcIdentifierChanged(
98       const std::string& name,
99       const std::string& value) = 0;
100   virtual void EmitRpcIdentifierArrayChanged(
101       const std::string& name,
102       const std::vector<std::string>& value) = 0;
103 };
104 
105 // These are the functions that a Profile adaptor must support
106 class ProfileAdaptorInterface {
107  public:
~ProfileAdaptorInterface()108   virtual ~ProfileAdaptorInterface() {}
109 
110   // Getter for the opaque identifier that represents this object on the
111   // RPC interface to which the implementation is adapting.
112   virtual const std::string& GetRpcIdentifier() = 0;
113 
114   virtual void EmitBoolChanged(const std::string& name, bool value) = 0;
115   virtual void EmitUintChanged(const std::string& name, uint32_t value) = 0;
116   virtual void EmitIntChanged(const std::string& name, int value) = 0;
117   virtual void EmitStringChanged(const std::string& name,
118                                  const std::string& value) = 0;
119 };
120 
121 // These are the functions that a RPCTask adaptor must support.
122 class RPCTaskAdaptorInterface {
123  public:
~RPCTaskAdaptorInterface()124   virtual ~RPCTaskAdaptorInterface() {}
125 
126   // Getter for the opaque identifier that represents this object on the
127   // RPC interface to which the implementation is adapting.
128   virtual const std::string& GetRpcIdentifier() = 0;
129 
130   // Getter for the opaque identifier that represents this object's
131   // connection to the RPC interface to which the implementation is adapting.
132   virtual const std::string& GetRpcConnectionIdentifier() = 0;
133 };
134 
135 // These are the functions that a Service adaptor must support
136 class ServiceAdaptorInterface {
137  public:
~ServiceAdaptorInterface()138   virtual ~ServiceAdaptorInterface() {}
139 
140   // Getter for the opaque identifier that represents this object on the
141   // RPC interface to which the implementation is adapting.
142   virtual const std::string& GetRpcIdentifier() = 0;
143 
144   virtual void EmitBoolChanged(const std::string& name, bool value) = 0;
145   virtual void EmitUint8Changed(const std::string& name, uint8_t value) = 0;
146   virtual void EmitUint16Changed(const std::string& name, uint16_t value) = 0;
147   virtual void EmitUint16sChanged(const std::string& name,
148                                   const Uint16s& value) = 0;
149   virtual void EmitUintChanged(const std::string& name, uint32_t value) = 0;
150   virtual void EmitIntChanged(const std::string& name, int value) = 0;
151   virtual void EmitRpcIdentifierChanged(const std::string& name,
152                                         const std::string& value) = 0;
153   virtual void EmitStringChanged(const std::string& name,
154                                  const std::string& value) = 0;
155   virtual void EmitStringmapChanged(const std::string& name,
156                                     const Stringmap& value) = 0;
157 };
158 
159 class ThirdPartyVpnAdaptorInterface {
160  public:
~ThirdPartyVpnAdaptorInterface()161   virtual ~ThirdPartyVpnAdaptorInterface() {}
162 
163   virtual void EmitPacketReceived(const std::vector<uint8_t>& packet) = 0;
164 
165   virtual void EmitPlatformMessage(uint32_t message) = 0;
166 };
167 
168 }  // namespace shill
169 
170 #endif  // SHILL_ADAPTOR_INTERFACES_H_
171