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};
73