summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTreehugger Robot2017-04-28 00:21:40 -0500
committerGerrit Code Review2017-04-28 00:21:41 -0500
commite9b4ab67239ca550321f7180520dae35bc77dd77 (patch)
tree49a902dfd738716a4d56ad71540f51d0007b191d
parentc3e640c7f07d6ae3dc0eaf6c3006a989fee8a36d (diff)
parent257430b7839535341e76fecad62bf96c1b0026be (diff)
downloadplatform-hardware-interfaces-e9b4ab67239ca550321f7180520dae35bc77dd77.tar.gz
platform-hardware-interfaces-e9b4ab67239ca550321f7180520dae35bc77dd77.tar.xz
platform-hardware-interfaces-e9b4ab67239ca550321f7180520dae35bc77dd77.zip
Merge "Tether Offload HAL"
-rw-r--r--tetheroffload/Android.bp5
-rw-r--r--tetheroffload/config/1.0/Android.bp60
-rw-r--r--tetheroffload/config/1.0/IOffloadConfig.hal36
-rw-r--r--tetheroffload/control/1.0/Android.bp71
-rw-r--r--tetheroffload/control/1.0/Android.mk274
-rw-r--r--tetheroffload/control/1.0/IOffloadControl.hal221
-rw-r--r--tetheroffload/control/1.0/ITetheringOffloadCallback.hal38
-rw-r--r--tetheroffload/control/1.0/types.hal72
8 files changed, 777 insertions, 0 deletions
diff --git a/tetheroffload/Android.bp b/tetheroffload/Android.bp
new file mode 100644
index 00000000..4b50f111
--- /dev/null
+++ b/tetheroffload/Android.bp
@@ -0,0 +1,5 @@
1// This is an autogenerated file, do not edit.
2subdirs = [
3 "config/1.0",
4 "control/1.0",
5]
diff --git a/tetheroffload/config/1.0/Android.bp b/tetheroffload/config/1.0/Android.bp
new file mode 100644
index 00000000..7eac6b00
--- /dev/null
+++ b/tetheroffload/config/1.0/Android.bp
@@ -0,0 +1,60 @@
1// This file is autogenerated by hidl-gen. Do not edit manually.
2
3filegroup {
4 name: "android.hardware.tetheroffload.config@1.0_hal",
5 srcs: [
6 "IOffloadConfig.hal",
7 ],
8}
9
10genrule {
11 name: "android.hardware.tetheroffload.config@1.0_genc++",
12 tools: ["hidl-gen"],
13 cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.tetheroffload.config@1.0",
14 srcs: [
15 ":android.hardware.tetheroffload.config@1.0_hal",
16 ],
17 out: [
18 "android/hardware/tetheroffload/config/1.0/OffloadConfigAll.cpp",
19 ],
20}
21
22genrule {
23 name: "android.hardware.tetheroffload.config@1.0_genc++_headers",
24 tools: ["hidl-gen"],
25 cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.tetheroffload.config@1.0",
26 srcs: [
27 ":android.hardware.tetheroffload.config@1.0_hal",
28 ],
29 out: [
30 "android/hardware/tetheroffload/config/1.0/IOffloadConfig.h",
31 "android/hardware/tetheroffload/config/1.0/IHwOffloadConfig.h",
32 "android/hardware/tetheroffload/config/1.0/BnHwOffloadConfig.h",
33 "android/hardware/tetheroffload/config/1.0/BpHwOffloadConfig.h",
34 "android/hardware/tetheroffload/config/1.0/BsOffloadConfig.h",
35 ],
36}
37
38cc_library_shared {
39 name: "android.hardware.tetheroffload.config@1.0",
40 generated_sources: ["android.hardware.tetheroffload.config@1.0_genc++"],
41 generated_headers: ["android.hardware.tetheroffload.config@1.0_genc++_headers"],
42 export_generated_headers: ["android.hardware.tetheroffload.config@1.0_genc++_headers"],
43 vendor_available: true,
44 shared_libs: [
45 "libhidlbase",
46 "libhidltransport",
47 "libhwbinder",
48 "liblog",
49 "libutils",
50 "libcutils",
51 "android.hidl.base@1.0",
52 ],
53 export_shared_lib_headers: [
54 "libhidlbase",
55 "libhidltransport",
56 "libhwbinder",
57 "libutils",
58 "android.hidl.base@1.0",
59 ],
60}
diff --git a/tetheroffload/config/1.0/IOffloadConfig.hal b/tetheroffload/config/1.0/IOffloadConfig.hal
new file mode 100644
index 00000000..4d285da7
--- /dev/null
+++ b/tetheroffload/config/1.0/IOffloadConfig.hal
@@ -0,0 +1,36 @@
1/*
2 * Copyright (C) 2017 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
17package android.hardware.tetheroffload.config@1.0;
18
19
20/**
21 * Interface used for configuring the hardware management process
22 */
23interface IOffloadConfig {
24 /**
25 * Provides bound netlink file descriptors for use in the management process
26 *
27 * @param fd1 A file descriptor bound to the following netlink groups
28 * (NF_NETLINK_CONNTRACK_NEW | NF_NETLINK_CONNTRACK_DESTROY).
29 * @param fd2 A file descriptor bound to the following netlink groups
30 * (NF_NETLINK_CONNTRACK_UPDATE | NF_NETLINK_CONNTRACK_DESTROY).
31 *
32 * @return success true if successful, false otherwise
33 * @return errMsg a human readable string if eror has occured.
34 */
35 setHandles(handle fd1, handle fd2) generates (bool success, string errMsg);
36};
diff --git a/tetheroffload/control/1.0/Android.bp b/tetheroffload/control/1.0/Android.bp
new file mode 100644
index 00000000..1d94ec8b
--- /dev/null
+++ b/tetheroffload/control/1.0/Android.bp
@@ -0,0 +1,71 @@
1// This file is autogenerated by hidl-gen. Do not edit manually.
2
3filegroup {
4 name: "android.hardware.tetheroffload.control@1.0_hal",
5 srcs: [
6 "types.hal",
7 "IOffloadControl.hal",
8 "ITetheringOffloadCallback.hal",
9 ],
10}
11
12genrule {
13 name: "android.hardware.tetheroffload.control@1.0_genc++",
14 tools: ["hidl-gen"],
15 cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.tetheroffload.control@1.0",
16 srcs: [
17 ":android.hardware.tetheroffload.control@1.0_hal",
18 ],
19 out: [
20 "android/hardware/tetheroffload/control/1.0/types.cpp",
21 "android/hardware/tetheroffload/control/1.0/OffloadControlAll.cpp",
22 "android/hardware/tetheroffload/control/1.0/TetheringOffloadCallbackAll.cpp",
23 ],
24}
25
26genrule {
27 name: "android.hardware.tetheroffload.control@1.0_genc++_headers",
28 tools: ["hidl-gen"],
29 cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.tetheroffload.control@1.0",
30 srcs: [
31 ":android.hardware.tetheroffload.control@1.0_hal",
32 ],
33 out: [
34 "android/hardware/tetheroffload/control/1.0/types.h",
35 "android/hardware/tetheroffload/control/1.0/hwtypes.h",
36 "android/hardware/tetheroffload/control/1.0/IOffloadControl.h",
37 "android/hardware/tetheroffload/control/1.0/IHwOffloadControl.h",
38 "android/hardware/tetheroffload/control/1.0/BnHwOffloadControl.h",
39 "android/hardware/tetheroffload/control/1.0/BpHwOffloadControl.h",
40 "android/hardware/tetheroffload/control/1.0/BsOffloadControl.h",
41 "android/hardware/tetheroffload/control/1.0/ITetheringOffloadCallback.h",
42 "android/hardware/tetheroffload/control/1.0/IHwTetheringOffloadCallback.h",
43 "android/hardware/tetheroffload/control/1.0/BnHwTetheringOffloadCallback.h",
44 "android/hardware/tetheroffload/control/1.0/BpHwTetheringOffloadCallback.h",
45 "android/hardware/tetheroffload/control/1.0/BsTetheringOffloadCallback.h",
46 ],
47}
48
49cc_library_shared {
50 name: "android.hardware.tetheroffload.control@1.0",
51 generated_sources: ["android.hardware.tetheroffload.control@1.0_genc++"],
52 generated_headers: ["android.hardware.tetheroffload.control@1.0_genc++_headers"],
53 export_generated_headers: ["android.hardware.tetheroffload.control@1.0_genc++_headers"],
54 vendor_available: true,
55 shared_libs: [
56 "libhidlbase",
57 "libhidltransport",
58 "libhwbinder",
59 "liblog",
60 "libutils",
61 "libcutils",
62 "android.hidl.base@1.0",
63 ],
64 export_shared_lib_headers: [
65 "libhidlbase",
66 "libhidltransport",
67 "libhwbinder",
68 "libutils",
69 "android.hidl.base@1.0",
70 ],
71}
diff --git a/tetheroffload/control/1.0/Android.mk b/tetheroffload/control/1.0/Android.mk
new file mode 100644
index 00000000..6e52c87e
--- /dev/null
+++ b/tetheroffload/control/1.0/Android.mk
@@ -0,0 +1,274 @@
1# This file is autogenerated by hidl-gen. Do not edit manually.
2
3LOCAL_PATH := $(call my-dir)
4
5################################################################################
6
7include $(CLEAR_VARS)
8LOCAL_MODULE := android.hardware.tetheroffload.control-V1.0-java
9LOCAL_MODULE_CLASS := JAVA_LIBRARIES
10
11intermediates := $(call local-generated-sources-dir, COMMON)
12
13HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
14
15LOCAL_JAVA_LIBRARIES := \
16 android.hidl.base-V1.0-java \
17
18
19#
20# Build types.hal (IPv4AddrPortPair)
21#
22GEN := $(intermediates)/android/hardware/tetheroffload/control/V1_0/IPv4AddrPortPair.java
23$(GEN): $(HIDL)
24$(GEN): PRIVATE_HIDL := $(HIDL)
25$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
26$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
27$(GEN): PRIVATE_CUSTOM_TOOL = \
28 $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
29 -Ljava \
30 -randroid.hardware:hardware/interfaces \
31 -randroid.hidl:system/libhidl/transport \
32 android.hardware.tetheroffload.control@1.0::types.IPv4AddrPortPair
33
34$(GEN): $(LOCAL_PATH)/types.hal
35 $(transform-generated-source)
36LOCAL_GENERATED_SOURCES += $(GEN)
37
38#
39# Build types.hal (NatTimeoutUpdate)
40#
41GEN := $(intermediates)/android/hardware/tetheroffload/control/V1_0/NatTimeoutUpdate.java
42$(GEN): $(HIDL)
43$(GEN): PRIVATE_HIDL := $(HIDL)
44$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
45$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
46$(GEN): PRIVATE_CUSTOM_TOOL = \
47 $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
48 -Ljava \
49 -randroid.hardware:hardware/interfaces \
50 -randroid.hidl:system/libhidl/transport \
51 android.hardware.tetheroffload.control@1.0::types.NatTimeoutUpdate
52
53$(GEN): $(LOCAL_PATH)/types.hal
54 $(transform-generated-source)
55LOCAL_GENERATED_SOURCES += $(GEN)
56
57#
58# Build types.hal (NetworkProtocol)
59#
60GEN := $(intermediates)/android/hardware/tetheroffload/control/V1_0/NetworkProtocol.java
61$(GEN): $(HIDL)
62$(GEN): PRIVATE_HIDL := $(HIDL)
63$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
64$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
65$(GEN): PRIVATE_CUSTOM_TOOL = \
66 $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
67 -Ljava \
68 -randroid.hardware:hardware/interfaces \
69 -randroid.hidl:system/libhidl/transport \
70 android.hardware.tetheroffload.control@1.0::types.NetworkProtocol
71
72$(GEN): $(LOCAL_PATH)/types.hal
73 $(transform-generated-source)
74LOCAL_GENERATED_SOURCES += $(GEN)
75
76#
77# Build types.hal (OffloadCallbackEvent)
78#
79GEN := $(intermediates)/android/hardware/tetheroffload/control/V1_0/OffloadCallbackEvent.java
80$(GEN): $(HIDL)
81$(GEN): PRIVATE_HIDL := $(HIDL)
82$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
83$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
84$(GEN): PRIVATE_CUSTOM_TOOL = \
85 $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
86 -Ljava \
87 -randroid.hardware:hardware/interfaces \
88 -randroid.hidl:system/libhidl/transport \
89 android.hardware.tetheroffload.control@1.0::types.OffloadCallbackEvent
90
91$(GEN): $(LOCAL_PATH)/types.hal
92 $(transform-generated-source)
93LOCAL_GENERATED_SOURCES += $(GEN)
94
95#
96# Build IOffloadControl.hal
97#
98GEN := $(intermediates)/android/hardware/tetheroffload/control/V1_0/IOffloadControl.java
99$(GEN): $(HIDL)
100$(GEN): PRIVATE_HIDL := $(HIDL)
101$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IOffloadControl.hal
102$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/ITetheringOffloadCallback.hal
103$(GEN): $(LOCAL_PATH)/ITetheringOffloadCallback.hal
104$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
105$(GEN): PRIVATE_CUSTOM_TOOL = \
106 $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
107 -Ljava \
108 -randroid.hardware:hardware/interfaces \
109 -randroid.hidl:system/libhidl/transport \
110 android.hardware.tetheroffload.control@1.0::IOffloadControl
111
112$(GEN): $(LOCAL_PATH)/IOffloadControl.hal
113 $(transform-generated-source)
114LOCAL_GENERATED_SOURCES += $(GEN)
115
116#
117# Build ITetheringOffloadCallback.hal
118#
119GEN := $(intermediates)/android/hardware/tetheroffload/control/V1_0/ITetheringOffloadCallback.java
120$(GEN): $(HIDL)
121$(GEN): PRIVATE_HIDL := $(HIDL)
122$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/ITetheringOffloadCallback.hal
123$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
124$(GEN): $(LOCAL_PATH)/types.hal
125$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
126$(GEN): PRIVATE_CUSTOM_TOOL = \
127 $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
128 -Ljava \
129 -randroid.hardware:hardware/interfaces \
130 -randroid.hidl:system/libhidl/transport \
131 android.hardware.tetheroffload.control@1.0::ITetheringOffloadCallback
132
133$(GEN): $(LOCAL_PATH)/ITetheringOffloadCallback.hal
134 $(transform-generated-source)
135LOCAL_GENERATED_SOURCES += $(GEN)
136include $(BUILD_JAVA_LIBRARY)
137
138
139################################################################################
140
141include $(CLEAR_VARS)
142LOCAL_MODULE := android.hardware.tetheroffload.control-V1.0-java-static
143LOCAL_MODULE_CLASS := JAVA_LIBRARIES
144
145intermediates := $(call local-generated-sources-dir, COMMON)
146
147HIDL := $(HOST_OUT_EXECUTABLES)/hidl-gen$(HOST_EXECUTABLE_SUFFIX)
148
149LOCAL_STATIC_JAVA_LIBRARIES := \
150 android.hidl.base-V1.0-java-static \
151
152
153#
154# Build types.hal (IPv4AddrPortPair)
155#
156GEN := $(intermediates)/android/hardware/tetheroffload/control/V1_0/IPv4AddrPortPair.java
157$(GEN): $(HIDL)
158$(GEN): PRIVATE_HIDL := $(HIDL)
159$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
160$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
161$(GEN): PRIVATE_CUSTOM_TOOL = \
162 $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
163 -Ljava \
164 -randroid.hardware:hardware/interfaces \
165 -randroid.hidl:system/libhidl/transport \
166 android.hardware.tetheroffload.control@1.0::types.IPv4AddrPortPair
167
168$(GEN): $(LOCAL_PATH)/types.hal
169 $(transform-generated-source)
170LOCAL_GENERATED_SOURCES += $(GEN)
171
172#
173# Build types.hal (NatTimeoutUpdate)
174#
175GEN := $(intermediates)/android/hardware/tetheroffload/control/V1_0/NatTimeoutUpdate.java
176$(GEN): $(HIDL)
177$(GEN): PRIVATE_HIDL := $(HIDL)
178$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
179$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
180$(GEN): PRIVATE_CUSTOM_TOOL = \
181 $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
182 -Ljava \
183 -randroid.hardware:hardware/interfaces \
184 -randroid.hidl:system/libhidl/transport \
185 android.hardware.tetheroffload.control@1.0::types.NatTimeoutUpdate
186
187$(GEN): $(LOCAL_PATH)/types.hal
188 $(transform-generated-source)
189LOCAL_GENERATED_SOURCES += $(GEN)
190
191#
192# Build types.hal (NetworkProtocol)
193#
194GEN := $(intermediates)/android/hardware/tetheroffload/control/V1_0/NetworkProtocol.java
195$(GEN): $(HIDL)
196$(GEN): PRIVATE_HIDL := $(HIDL)
197$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
198$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
199$(GEN): PRIVATE_CUSTOM_TOOL = \
200 $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
201 -Ljava \
202 -randroid.hardware:hardware/interfaces \
203 -randroid.hidl:system/libhidl/transport \
204 android.hardware.tetheroffload.control@1.0::types.NetworkProtocol
205
206$(GEN): $(LOCAL_PATH)/types.hal
207 $(transform-generated-source)
208LOCAL_GENERATED_SOURCES += $(GEN)
209
210#
211# Build types.hal (OffloadCallbackEvent)
212#
213GEN := $(intermediates)/android/hardware/tetheroffload/control/V1_0/OffloadCallbackEvent.java
214$(GEN): $(HIDL)
215$(GEN): PRIVATE_HIDL := $(HIDL)
216$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
217$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
218$(GEN): PRIVATE_CUSTOM_TOOL = \
219 $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
220 -Ljava \
221 -randroid.hardware:hardware/interfaces \
222 -randroid.hidl:system/libhidl/transport \
223 android.hardware.tetheroffload.control@1.0::types.OffloadCallbackEvent
224
225$(GEN): $(LOCAL_PATH)/types.hal
226 $(transform-generated-source)
227LOCAL_GENERATED_SOURCES += $(GEN)
228
229#
230# Build IOffloadControl.hal
231#
232GEN := $(intermediates)/android/hardware/tetheroffload/control/V1_0/IOffloadControl.java
233$(GEN): $(HIDL)
234$(GEN): PRIVATE_HIDL := $(HIDL)
235$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IOffloadControl.hal
236$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/ITetheringOffloadCallback.hal
237$(GEN): $(LOCAL_PATH)/ITetheringOffloadCallback.hal
238$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
239$(GEN): PRIVATE_CUSTOM_TOOL = \
240 $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
241 -Ljava \
242 -randroid.hardware:hardware/interfaces \
243 -randroid.hidl:system/libhidl/transport \
244 android.hardware.tetheroffload.control@1.0::IOffloadControl
245
246$(GEN): $(LOCAL_PATH)/IOffloadControl.hal
247 $(transform-generated-source)
248LOCAL_GENERATED_SOURCES += $(GEN)
249
250#
251# Build ITetheringOffloadCallback.hal
252#
253GEN := $(intermediates)/android/hardware/tetheroffload/control/V1_0/ITetheringOffloadCallback.java
254$(GEN): $(HIDL)
255$(GEN): PRIVATE_HIDL := $(HIDL)
256$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/ITetheringOffloadCallback.hal
257$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
258$(GEN): $(LOCAL_PATH)/types.hal
259$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
260$(GEN): PRIVATE_CUSTOM_TOOL = \
261 $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
262 -Ljava \
263 -randroid.hardware:hardware/interfaces \
264 -randroid.hidl:system/libhidl/transport \
265 android.hardware.tetheroffload.control@1.0::ITetheringOffloadCallback
266
267$(GEN): $(LOCAL_PATH)/ITetheringOffloadCallback.hal
268 $(transform-generated-source)
269LOCAL_GENERATED_SOURCES += $(GEN)
270include $(BUILD_STATIC_JAVA_LIBRARY)
271
272
273
274include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tetheroffload/control/1.0/IOffloadControl.hal b/tetheroffload/control/1.0/IOffloadControl.hal
new file mode 100644
index 00000000..334f4ca7
--- /dev/null
+++ b/tetheroffload/control/1.0/IOffloadControl.hal
@@ -0,0 +1,221 @@
1/*
2 * Copyright (C) 2017 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
17package android.hardware.tetheroffload.control@1.0;
18
19import ITetheringOffloadCallback;
20
21
22/**
23 * Interface used to control the lifecycle of tethering offload
24 */
25interface IOffloadControl {
26 /**
27 * Indicates intent to start offload for tethering in immediate future.
28 *
29 * This API must be called exactly once the first time that Tethering is requested by
30 * the user.
31 *
32 * If this API is called multiple times without first calling stopOffload, then the subsequent
33 * calls must fail without changing the state of the server.
34 *
35 * If for some reason, the hardware is currently unable to support offload, this call must fail.
36 *
37 * @param cb Assuming success, this callback must provide unsolicited updates of offload status.
38 * It is assumed to be valid until stopOffload is called.
39 *
40 * @return success true if initialization is successful, false otherwise
41 * @return errMsg a human readable string if eror has occured.
42 *
43 * Remarks: Initializing offload does not imply that any upstreams or downstreams have yet been,
44 * or even will be, chosen. This API is symmetrical with stopOffload.
45 */
46 @entry
47 @callflow(next={"*"})
48 initOffload(ITetheringOffloadCallback cb) generates (bool success, string errMsg);
49
50 /**
51 * Indicate desire to tear down all tethering offload.
52 *
53 * Called after tethering is no longer requested by the user. Any remaining offload must
54 * be subsequently torn down by the management process. Upon success, the callback registered
55 * in initOffload must be released, and offload must be stopped.
56 *
57 * @return success true if offload is stopped, false otherwise
58 * @return errMsg a human readable string if eror has occured.
59 *
60 * Remarks: Statistics must be reset by this API.
61 */
62 @exit
63 stopOffload() generates (bool success, string errMsg);
64
65 /**
66 * Instruct management process not to forward traffic destined to or from the specified prefixes.
67 *
68 * This API may only be called after initOffload and before stopOffload.
69 *
70 * @param prefixes List containing fully specified prefixes. For e.g. 192.168.1.12/24
71 or 2001:4860:0684:0:0:0:0:0:1002/64
72 *
73 * @return success true if success, false otherwise
74 * @return errMsg a human readable string if eror has occured.
75 *
76 * Remarks: This list overrides any previously specified list
77 */
78 setLocalPrefixes(vec<string> prefixes) generates (bool success, string errMsg);
79
80 /**
81 * Query offloaded traffic statistics forwarded to an upstream address.
82 *
83 * Return statistics that have transpired since the last query. This would include
84 * statistics from all offloaded downstream tether interfaces that have been forwarded to this
85 * upstream interface. After returning the statistics, the counters are reset to zero.
86 *
87 * Only offloaded statistics must be returned by this API, software stats must not be
88 * returned.
89 *
90 * @param upstream Upstream interface on which traffic exited/entered
91 *
92 * @return rxBytes values depicting the received bytes
93 * @return txBytes values depicting the transmitted bytes
94 */
95 getForwardedStats(string upstream) generates (uint64_t rxBytes, uint64_t txBytes);
96
97 /**
98 * Instruct hardware to stop forwarding traffic and send a callback after limit bytes have been
99 * transferred in either direction on this upstream interface.
100 *
101 * The limit must be applied to all traffic on the given upstream interface. This
102 * includes hardware forwarded traffic, software forwarded traffic, and AP-originated traffic.
103 * IPv4 and IPv6 traffic both count towards the same limit. IP headers are included in the
104 * byte count limit, but, link-layer headers are not.
105 *
106 * This API may only be called while offload is occurring on this upstream. The hardware
107 * management process is not expected to cache the value and apply the quota once offload is
108 * started. This cache is not expected, because the limit value would likely become stale over
109 * time and would not reflect any new traffic that has occurred.
110 *
111 * This limit must replace any previous limit. It may be interpreted as "tell me when
112 * <limit> bytes have been transferred (in either direction) on <upstream>, starting
113 * now and counting from zero."
114 *
115 * Once the limit is reached, the callback registered in initOffload must be called to indicate
116 * this event and all offload must be stopped. If offload is desired again, the hardware
117 * management process must be completely reprogrammed by calling setUpstreamParameters and
118 * addDownstream again. Note that it is not necessary to call initOffload again to resume offload
119 * if stopOffload was not called by the client.
120 *
121 * @param upstream Upstream interface name that limit must apply to
122 * @param limit Bytes limit that can occur before action must be taken
123 *
124 * @return success true if limit is applied, false otherwise
125 * @return errMsg a human readable string if eror has occured.
126 */
127 setDataLimit(string upstream, uint64_t limit) generates (bool success, string errMsg);
128
129 /**
130 * Instruct hardware to start forwarding traffic to the specified upstream.
131 *
132 * When iface, v4Addr, and v4Gw are all non-null, the management process may begin forwarding
133 * any currently configured or future configured IPv4 downstreams to this upstream interface.
134 *
135 * If any of the previously three mentioned parameters are null, then any current IPv4 offload
136 * must be stopped.
137 *
138 * When iface and v6Gws are both non-null, and in the case of v6Gws, are not empty, the
139 * management process may begin forwarding any currently configured or future configured IPv6
140 * downstreams to this upstream interface.
141 *
142 * If either of the two above parameters are null, or no V6 Gateways are provided, then IPv6
143 * offload must be stopped.
144 *
145 * This API may only be called after initOffload and before stopOffload.
146 *
147 * @param iface Upstream interface name. Note that only one is needed because IPv4 and IPv6
148 * interfaces cannot be different (only known that this can occur during software
149 * xlat, which cannot be offloaded through hardware anyways). If the iface is
150 * null, offload must be stopped.
151 * @param v4Addr The local IPv4 address assigned to the provided upstream interface, i.e. the
152 * IPv4 address the packets are NATed to. For e.g. 192.168.1.12.
153 * @param v4Gw The IPv4 address of the IPv4 gateway on the upstream interface.
154 * For e.g. 192.168.1.1
155 * @param v6Gws A list of IPv6 addresses (for e.g. 2001:4860:0684:0:0:0:0:0:1002) for possible
156 * IPv6 gateways on the upstream interface.
157 *
158 * @return success true if success, false otherwise
159 * @return errMsg a human readable string if eror has occured.
160 *
161 * Remarks: This overrides any previously configured parameters.
162 */
163 setUpstreamParameters(string iface, string v4Addr, string v4Gw, vec<string> v6Gws)
164 generates (bool success, string errMsg);
165
166 /**
167 * Configure a downstream interface and prefix in the hardware management process that may be
168 * forwarded.
169 *
170 * The prefix may be an IPv4 or an IPv6 address to signify which family can be offloaded from the
171 * specified tether interface. The list of IPv4 and IPv6 downstreams that are configured may
172 * differ.
173 *
174 * If the given protocol, as determined by the prefix, has an upstream set,
175 * the hardware may begin forwarding traffic between the upstream and any devices on the
176 * downstream interface that have IP addresses within the specified prefix. Traffic from the same
177 * downstream interfaces is unaffected and must be forwarded if and only if it was already
178 * being forwarded.
179 *
180 * If no upstream is currently configured, then these downstream interface and prefixes must be
181 * preserved so that offload may begin in the future when an upstream is set.
182 *
183 * This API does not replace any previously configured downstreams and must be explictly removed
184 * by calling removeDownstream.
185 *
186 * This API may only be called after initOffload and before stopOffload.
187 *
188 * @param iface Tether interface
189 * @param prefix Downstream prefix depicting addresses that may be offloaded.
190 * For e.g. 192.168.1.12/24 or 2001:4860:0684::/64)
191 *
192 * @return success true if success, false otherwise
193 * @return errMsg a human readable string if eror has occured.
194 *
195 * Remarks: The hardware management process may fail this call in a normal situation. This can
196 * happen because the hardware cannot support the current number of prefixes, the
197 * hardware cannot support concurrent offload on multiple interfaces, the hardware
198 * cannot currently support offload on the tether interface for some reason, or any
199 * other dynamic configuration issues which may occur. In this case,
200 * traffic must remain unaffected and must be forwarded if and only if it was already
201 * being forwarded.
202 */
203 addDownstream(string iface, string prefix) generates (bool success, string errMsg);
204
205 /**
206 * Remove a downstream prefix that may be forwarded from the hardware management process.
207 *
208 * The prefix may be an IPv4 or an IPv6 address. If it was not previously configured using
209 * addDownstream, then this must be a no-op.
210 *
211 * This API may only be called after initOffload and before stopOffload.
212 *
213 * @param iface Tether interface
214 * @param prefix Downstream prefix depicting address that must no longer be offloaded
215 * For e.g. 192.168.1.12/24 or 2001:4860:0684::/64)
216 *
217 * @return success true if success, false otherwise
218 * @return errMsg a human readable string if eror has occured.
219 */
220 removeDownstream(string iface, string prefix) generates (bool success, string errMsg);
221};
diff --git a/tetheroffload/control/1.0/ITetheringOffloadCallback.hal b/tetheroffload/control/1.0/ITetheringOffloadCallback.hal
new file mode 100644
index 00000000..397667f3
--- /dev/null
+++ b/tetheroffload/control/1.0/ITetheringOffloadCallback.hal
@@ -0,0 +1,38 @@
1/*
2 * Copyright (C) 2017 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
17package android.hardware.tetheroffload.control@1.0;
18
19/**
20 * Callback providing information about status of hardware management process
21 * as well as providing a way to keep offloaded connections from timing out.
22 */
23interface ITetheringOffloadCallback {
24 /**
25 * Called when an asynchronous event is generated by the hardware management
26 * process.
27 */
28 oneway onEvent(OffloadCallbackEvent event);
29
30 /**
31 * Provide a way for the management process to request that a connections
32 * timeout be updated in kernel.
33 *
34 * This is necessary to ensure that offloaded traffic is not cleaned up
35 * by the kernel connection tracking module for IPv4.
36 */
37 oneway updateTimeout(NatTimeoutUpdate params);
38};
diff --git a/tetheroffload/control/1.0/types.hal b/tetheroffload/control/1.0/types.hal
new file mode 100644
index 00000000..e2576acc
--- /dev/null
+++ b/tetheroffload/control/1.0/types.hal
@@ -0,0 +1,72 @@
1/*
2 * Copyright (C) 2017 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
17package android.hardware.tetheroffload.control@1.0;
18
19enum OffloadCallbackEvent : uint32_t {
20 /**
21 * Indicate that a working configuration has been programmed and the
22 * hardware management process has begun forwarding traffic.
23 */
24 OFFLOAD_STARTED = 1,
25 /**
26 * Indicate that an error has occurred which has disrupted hardware
27 * acceleration. Software routing may still be attempted; however,
28 * statistics may be temporarily unavailable. Statistics may be recovered
29 * after OFFLOAD_SUPPORT_AVAILABLE event is fired.
30 */
31 OFFLOAD_STOPPED_ERROR = 2,
32 /**
33 * Indicate that the device has moved to a RAT on which hardware
34 * acceleration is not supported. Subsequent calls to setUpstreamParameters
35 * and add/removeDownstream will likely fail and cannot be presumed to be
36 * saved inside of the hardware management process. Upon receiving
37 * OFFLOAD_SUPPORT_AVAIALBLE, the client may reprogram the hardware
38 * management process to begin offload again.
39 */
40 OFFLOAD_STOPPED_UNSUPPORTED = 3,
41 /**
42 * Indicate that the hardware management process is willing and able to
43 * provide support for hardware acceleration at this time. If applicable,
44 * the client may query for statistics. If offload is desired, the client
45 * must reprogram the hardware management process.
46 */
47 OFFLOAD_SUPPORT_AVAILABLE = 4,
48 /**
49 * Hardware acceleration is no longer in effect and must be reprogrammed
50 * in order to resume. This event is fired when the limit, applied in
51 * setDataLimit, has expired. It is recommended that the client query for
52 * statistics immediately after receiving this event.
53 */
54 OFFLOAD_STOPPED_LIMIT_REACHED = 5
55};
56
57enum NetworkProtocol : uint32_t {
58 TCP = 6,
59 UDP = 17
60};
61
62struct IPv4AddrPortPair {
63 /** IPv4 Address and Port */
64 string addr; // for e.g. 192.168.1.12
65 uint16_t port; // for e.g. 8080
66};
67
68struct NatTimeoutUpdate {
69 IPv4AddrPortPair src;
70 IPv4AddrPortPair dst;
71 NetworkProtocol proto;
72};