aboutsummaryrefslogtreecommitdiff
path: root/data-ipa-cfg-mgr/hal/inc
diff options
context:
space:
mode:
authorDavide Garberi <dade.garberi@gmail.com>2019-01-19 20:33:01 +0100
committerDavide Garberi <dade.garberi@gmail.com>2019-01-26 13:56:25 +0100
commit53a1ffbf112cf677a1fa6168d34d47b39a59aa1b (patch)
tree80c9ff5fc08f59cb4feb2f11bd0f1c1540cab354 /data-ipa-cfg-mgr/hal/inc
parent5e5938dad03868d1fc1615f809ec1dda2aaf55ee (diff)
msm8996-common: Use common data-ipa-cfg-mgr
* Located at vendor/qcom/opensource/data-ipa-cfg-mgr Signed-off-by: Davide Garberi <dade.garberi@gmail.com> Change-Id: I6b1f1a034b8e4cafe5ae28a16327cc4e2ec6afa3 Signed-off-by: Davide Garberi <dade.garberi@gmail.com>
Diffstat (limited to 'data-ipa-cfg-mgr/hal/inc')
-rw-r--r--data-ipa-cfg-mgr/hal/inc/CtUpdateAmbassador.h62
-rw-r--r--data-ipa-cfg-mgr/hal/inc/HAL.h200
-rw-r--r--data-ipa-cfg-mgr/hal/inc/IOffloadManager.h350
-rw-r--r--data-ipa-cfg-mgr/hal/inc/IpaEventRelay.h55
-rw-r--r--data-ipa-cfg-mgr/hal/inc/LocalLogBuffer.h73
-rw-r--r--data-ipa-cfg-mgr/hal/inc/OffloadStatistics.h49
-rw-r--r--data-ipa-cfg-mgr/hal/inc/PrefixParser.h80
7 files changed, 0 insertions, 869 deletions
diff --git a/data-ipa-cfg-mgr/hal/inc/CtUpdateAmbassador.h b/data-ipa-cfg-mgr/hal/inc/CtUpdateAmbassador.h
deleted file mode 100644
index d4890f3..0000000
--- a/data-ipa-cfg-mgr/hal/inc/CtUpdateAmbassador.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2017, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of The Linux Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef _CT_UPDATE_AMBASSADOR_H_
-#define _CT_UPDATE_AMBASSADOR_H_
-/* External Includes */
-#include <hidl/HidlTransportSupport.h>
-
-/* HIDL Includes */
-#include <android/hardware/tetheroffload/control/1.0/ITetheringOffloadCallback.h>
-
-/* Internal Includes */
-#include "IOffloadManager.h"
-
-/* Namespace pollution avoidance */
-using ::android::hardware::tetheroffload::control::V1_0::ITetheringOffloadCallback;
-using ::android::hardware::tetheroffload::control::V1_0::NetworkProtocol;
-using HALIpAddrPortPair = ::android::hardware::tetheroffload::control::V1_0::IPv4AddrPortPair;
-using HALNatTimeoutUpdate = ::android::hardware::tetheroffload::control::V1_0::NatTimeoutUpdate;
-
-using IpaIpAddrPortPair = ::IOffloadManager::ConntrackTimeoutUpdater::IpAddrPortPair;
-using IpaNatTimeoutUpdate = ::IOffloadManager::ConntrackTimeoutUpdater::NatTimeoutUpdate;
-using IpaL4Protocol = ::IOffloadManager::ConntrackTimeoutUpdater::L4Protocol;
-
-
-class CtUpdateAmbassador : public IOffloadManager::ConntrackTimeoutUpdater {
-public:
- CtUpdateAmbassador(const ::android::sp<ITetheringOffloadCallback>& /* cb */);
- /* ------------------- CONNTRACK TIMEOUT UPDATER ------------------------ */
- void updateTimeout(IpaNatTimeoutUpdate /* update */);
-private:
- static bool translate(IpaNatTimeoutUpdate /* in */, HALNatTimeoutUpdate& /* out */);
- static bool translate(IpaIpAddrPortPair /* in */, HALIpAddrPortPair& /* out */);
- static bool L4ToNetwork(IpaL4Protocol /* in */, NetworkProtocol& /* out */);
- const ::android::sp<ITetheringOffloadCallback>& mFramework;
-}; /* CtUpdateAmbassador */
-#endif /* _CT_UPDATE_AMBASSADOR_H_ */ \ No newline at end of file
diff --git a/data-ipa-cfg-mgr/hal/inc/HAL.h b/data-ipa-cfg-mgr/hal/inc/HAL.h
deleted file mode 100644
index 894438f..0000000
--- a/data-ipa-cfg-mgr/hal/inc/HAL.h
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of The Linux Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef _HAL_H_
-#define _HAL_H_
-
-/* HIDL Includes */
-#include <android/hardware/tetheroffload/config/1.0/IOffloadConfig.h>
-#include <android/hardware/tetheroffload/control/1.0/IOffloadControl.h>
-#include <hidl/HidlTransportSupport.h>
-
-/* External Includes */
-#include <string>
-#include <vector>
-
-/* Internal Includes */
-#include "CtUpdateAmbassador.h"
-#include "IOffloadManager.h"
-#include "IpaEventRelay.h"
-#include "LocalLogBuffer.h"
-
-/* Avoid the namespace litering everywhere */
-using ::android::hardware::configureRpcThreadpool;
-using ::android::hardware::joinRpcThreadpool;
-using ::android::hardware::Return;
-using ::android::hardware::hidl_handle;
-using ::android::hardware::hidl_string;
-using ::android::hardware::hidl_vec;
-
-using RET = ::IOffloadManager::RET;
-using Prefix = ::IOffloadManager::Prefix;
-
-using ::std::map;
-using ::std::string;
-using ::std::vector;
-
-using ::android::hardware::tetheroffload::config::V1_0::IOffloadConfig;
-using ::android::hardware::tetheroffload::control::V1_0::IOffloadControl;
-
-using ::android::hardware::tetheroffload::control::V1_0::ITetheringOffloadCallback;
-
-#define KERNEL_PAGE 4096
-
-class HAL : public IOffloadControl, IOffloadConfig {
-public:
- /* Static Const Definitions */
- static const uint32_t UDP_SUBSCRIPTIONS =
- NF_NETLINK_CONNTRACK_NEW | NF_NETLINK_CONNTRACK_DESTROY;
- static const uint32_t TCP_SUBSCRIPTIONS =
- NF_NETLINK_CONNTRACK_UPDATE | NF_NETLINK_CONNTRACK_DESTROY;
-
- /* Interface to IPACM */
- /**
- * @TODO This will likely need to be extended into a proper FactoryPattern
- * when version bumps are needed.
- *
- * This makeIPAHAL function would move to a HALFactory class. Each HAL could
- * then be versioned (class HAL_V1, class HAL_V2, etc) and inherit from a base class HAL.
- * Then the version number in this function could be used to decide which one to return
- * (if any).
- *
- * IPACM does not need to talk directly back to the returned HAL class. The other methods that
- * IPACM needs to call are covered by registering the event listeners. If IPACM did need to
- * talk directly back to the HAL object, without HAL registering a callback, these methods would
- * need to be defined in the HAL base class.
- *
- * This would slightly break backwards compatibility so it should be discouraged; however, the
- * base class could define a sane default implementation and not require that the child class
- * implement this new method. This "sane default implementation" might only be possible in the
- * case of listening to async events; if IPACM needs to query something, then this would not
- * be backwards compatible and should be done via registering a callback so that IPACM knows
- * this version of HAL supports that functionality.
- *
- * The above statements assume that only one version of the HAL will be instantiated at a time.
- * Yet, it seems possible that a HAL_V1 and HAL_V2 service could both be registered, extending
- * support to both old and new client implementations. It would be difficult to multiplex
- * information from both versions. Additionally, IPACM would be responsible for instantiating
- * two HALs (makeIPAHAL(1, ...); makeIPAHAL(2, ...)) which makes signaling between HAL versions
- * (see next paragraph) slightly more difficult but not impossible.
- *
- * If concurrent versions of HAL are required, there will likely need to only be one master.
- * Whichever version of HAL receives a client first may be allowed to take over control while
- * other versions would be required to return failures (ETRYAGAIN: another version in use) until
- * that version of the client relinquishes control. This should work seemlessly because we
- * currently have an assumption that only one client will be present in system image.
- * Logically, that client will have only a single version (or if it supports multiple, it will
- * always attempt the newest version of HAL before falling back) and therefore no version
- * collisions could possibly occur.
- *
- * Dislaimer:
- * ==========
- * Supporting multiple versions of an interface, in the same code base, at runtime, comes with a
- * significant carrying cost and overhead in the form of developer headaches. This should not
- * be done lightly and should be extensively scoped before committing to the effort.
- *
- * Perhaps the notion of minor version could be introduced to bridge the gaps created above.
- * For example, 1.x and 1.y could be ran concurrently and supported from the same IPACM code.
- * Yet, a major version update, would not be backwards compatible. This means that a 2.x HAL
- * could not linked into the same IPACM code base as a 1.x HAL.
- */
- static HAL* makeIPAHAL(int /* version */, IOffloadManager* /* mgr */);
-
- /* IOffloadConfig */
- Return<void> setHandles(
- const hidl_handle& /* fd1 */,
- const hidl_handle& /* fd2 */,
- setHandles_cb /* hidl_cb */);
-
- /* IOffloadControl */
- Return<void> initOffload(
- const ::android::sp<ITetheringOffloadCallback>& /* cb */,
- initOffload_cb /* hidl_cb */);
- Return<void> stopOffload(
- stopOffload_cb /* hidl_cb */);
- Return<void> setLocalPrefixes(
- const hidl_vec<hidl_string>& /* prefixes */,
- setLocalPrefixes_cb /* hidl_cb */);
- Return<void> getForwardedStats(
- const hidl_string& /* upstream */,
- getForwardedStats_cb /* hidl_cb */);
- Return<void> setDataLimit(
- const hidl_string& /* upstream */,
- uint64_t /* limit */,
- setDataLimit_cb /* hidl_cb */);
- Return<void> setUpstreamParameters(
- const hidl_string& /* iface */,
- const hidl_string& /* v4Addr */,
- const hidl_string& /* v4Gw */,
- const hidl_vec<hidl_string>& /* v6Gws */,
- setUpstreamParameters_cb /* hidl_cb */);
- Return<void> addDownstream(
- const hidl_string& /* iface */,
- const hidl_string& /* prefix */,
- addDownstream_cb /* hidl_cb */);
- Return<void> removeDownstream(
- const hidl_string& /* iface */,
- const hidl_string& /* prefix */,
- removeDownstream_cb /* hidl_cb */);
-
-private:
- typedef struct BoolResult {
- bool success;
- string errMsg;
- } boolResult_t;
-
- HAL(IOffloadManager* /* mgr */);
- void registerAsSystemService(const char* /* name */);
-
- void doLogcatDump();
-
- static BoolResult makeInputCheckFailure(string /* customErr */);
- static BoolResult ipaResultToBoolResult(RET /* in */);
-
- static vector<string> convertHidlStrToStdStr(hidl_vec<hidl_string> /* in */);
-
- void registerEventListeners();
- void registerIpaCb();
- void registerCtCb();
- void unregisterEventListeners();
- void unregisterIpaCb();
- void unregisterCtCb();
-
- void clearHandles();
-
- bool isInitialized();
-
- IOffloadManager* mIPA;
- hidl_handle mHandle1;
- hidl_handle mHandle2;
- LocalLogBuffer mLogs;
- ::android::sp<ITetheringOffloadCallback> mCb;
- IpaEventRelay *mCbIpa;
- CtUpdateAmbassador *mCbCt;
-}; /* HAL */
-#endif /* _HAL_H_ */
diff --git a/data-ipa-cfg-mgr/hal/inc/IOffloadManager.h b/data-ipa-cfg-mgr/hal/inc/IOffloadManager.h
deleted file mode 100644
index 6a357b3..0000000
--- a/data-ipa-cfg-mgr/hal/inc/IOffloadManager.h
+++ /dev/null
@@ -1,350 +0,0 @@
-/*
- * Copyright (c) 2017, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of The Linux Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef _I_OFFLOAD_MANAGER_H_
-#define _I_OFFLOAD_MANAGER_H_
-
-/* External Includes */
-#include <sys/types.h>
-
-/* Internal Includes */
-#include "OffloadStatistics.h"
-
-
-class IOffloadManager {
-public:
- enum RET {
- FAIL_TOO_MANY_PREFIXES = -6,
- FAIL_UNSUPPORTED = -5,
- FAIL_INPUT_CHECK = -4,
- FAIL_HARDWARE = -3,
- FAIL_UNNEEDED = -2,
- FAIL_TRY_AGAIN = -1,
- SUCCESS = 0,
- SUCCESS_DUPLICATE_CONFIG = 1,
- SUCCESS_NO_OP = 2,
- SUCCESS_OPTIMIZED = 3
- }; /* RET */
-
- enum IP_FAM {
- V4 = 0,
- V6 = 1,
- INVALID = 2
- }; /* IP_FAM */
-
- /* Overloading to use for addresses as well */
- typedef struct Prefix {
- IP_FAM fam;
- uint32_t v4Addr;
- uint32_t v4Mask;
- uint32_t v6Addr[4];
- uint32_t v6Mask[4];
- } prefix_t;
-
- /* ---------------------------- LIFECYCLE ------------------------------- */
- virtual ~IOffloadManager(){}
-
- /* ---------------------- ASYNC EVENT CALLBACKS ------------------------- */
- class IpaEventListener {
- public:
- enum StoppedReason {
- /**
- * Offload was stopped due to the configuration being removed via
- * setUpstreamParameters/removeDownstream.
- */
- REQUESTED,
- /**
- * Offload was stopped due to an internal (to IPA or modem) error.
- *
- * Statistics may be temporarily unavailable.
- */
- ERROR,
- /**
- * Offload was stopped because the upstream connection has
- * migrated to unsupported radio access technology.
- *
- * Statistics will still be available.
- */
- UNSUPPORTED
- }; /* StoppedReason */
- virtual ~IpaEventListener(){}
- /**
- * Called when Offload first begins to occur on any upstream and
- * tether interface pair. It should be paired with an onOffloadStopped
- * call.
- */
- virtual void onOffloadStarted(){}
- /**
- * Called when Offload stops occurring on all upstream and tether
- * interface pairs. It comes after a call to onOffloadStarted.
- *
- * @param reason Reason that Offload was stopped
- */
- virtual void onOffloadStopped(StoppedReason /* reason */){}
- /**
- * Called when the hardware can support Offload again.
- *
- * Any statistics that were previously unavailable, may be queried
- * again at this time.
- */
- virtual void onOffloadSupportAvailable(){}
- /**
- * Called when the limit set via setQuota has expired.
- *
- * It is implied that Offload has been stopped on all upstream and
- * tether interface pairs when this callback is called.
- */
- virtual void onLimitReached(){}
- }; /* IpaEventListener */
-
- /**
- * Request notifications about asynchronous events that occur in hardware.
- *
- * The calling client must be able to handle the callback on a separate
- * thread (i.e. their implementation of IpaEventListener must be thread
- * safe).
- *
- * @return SUCCESS iff callback successfully registered
- *
- * Remarks: This can't really be allowed to fail.
- */
- virtual RET registerEventListener(IpaEventListener* /* listener */) = 0;
- /**
- * Unregister a previously registered listener.
- *
- * @return SUCCESS iff callback successfully unregistered
- * FAIL_INPUT_CHECK if callback was never registered
- */
- virtual RET unregisterEventListener(IpaEventListener* /* listener */) = 0;
-
- class ConntrackTimeoutUpdater {
- public:
- enum L4Protocol {
- TCP = 0,
- UDP = 1
- }; /* L4Protocol */
- typedef struct IpAddrPortPair {
- uint32_t ipAddr;
- uint16_t port;
- } ipAddrPortPair_t;
- typedef struct NatTimeoutUpdate {
- IpAddrPortPair src;
- IpAddrPortPair dst;
- L4Protocol proto;
- } natTimeoutUpdate_t;
- virtual ~ConntrackTimeoutUpdater(){}
- virtual void updateTimeout(NatTimeoutUpdate /* update */) {}
- }; /* ConntrackTimeoutUpdater */
-
- /**
- * Register a callback that may be called if the OffloadManager wants to
- * update the timeout value in conntrack of kernel.
- *
- * The calling client must be able to handle the callback on a separate
- * thread (i.e. their implementation of ConntrackTimeoutUpdater must be
- * thread safe)
- *
- * @return SUCCESS iff callback successfully registered
- *
- * Remarks: This can't really be allowed to fail
- */
- virtual RET registerCtTimeoutUpdater(ConntrackTimeoutUpdater* /* cb */) = 0;
- /**
- * Unregister a previously registered callback.
- *
- * @return SUCCESS iff callback successfully unregistered
- * FAIL_INPUT_CHECK if callback was never registered
- */
- virtual RET unregisterCtTimeoutUpdater(ConntrackTimeoutUpdater* /* cb */) = 0;
-
- /* ----------------------------- CONFIG --------------------------------- */
- /**
- * Provide a file descriptor for use with conntrack library
- *
- * @param fd File Descriptor that has been opened and bound to groups
- * @param groups Groups (bit mask) that fd has been bound to
- *
- * @return SUCCESS iff IOffloadManager needed this file descriptor and
- * it was properly bound.
- * FAIL_INPUT_CHECK if IOffloadManager needed this file descriptor
- * but it was found to not be properly bound
- * FAIL_UNNEEDED if IOffloadManager determined that it does not need
- * a file descriptor bound to these groups.
- */
- virtual RET provideFd(int /* fd */, unsigned int /* group */) = 0;
- /**
- * Indicate that IOffloadManager <b>must</b> cease using all file
- * descriptors passed via provideFd API.
- *
- * After this call returns, the file descriptors will likely be closed by
- * the calling client.
- *
- * @return SUCCESS iff IOffloadManager has stopped using all file
- * descriptors
- * FAIL_TRY_AGAIN if IOffloadManager needs more time with these
- * file descriptors before it can release them
- *
- * Remarks: Currently, it would be very difficult to handle a FAIL_TRY_AGAIN
- * because HAL serivce does not own a thread outside of RPC
- * Threadpool to reschedule this call.
- */
- virtual RET clearAllFds() = 0;
- /**
- * Query whether STA+AP offload is supported on this device.
- *
- * @return true if supported, false otherwise
- */
- virtual bool isStaApSupported() = 0;
-
- /* ------------------------------ ROUTE --------------------------------- */
- /**
- * Add a downstream prefix that <i>may</i> be forwarded.
- *
- * The Prefix may be an IPv4 or IPv6 address to signify which family can be
- * offloaded from the specified tether interface. If the given IP family,
- * as determined by the Prefix, has a corresponding upstream configured,
- * then traffic should be forwarded between the two interfaces.
- *
- * Only traffic that has a downstream address within the specified Prefix
- * can be forwarded. Traffic from the same downstream interface that falls
- * outside of the Prefix will be unaffected and can be forwarded iff it was
- * previously configured via a separate addDownstream call.
- *
- * If no upstream has been configured, then this information must be cached
- * so that offload may begin once an upstream is configured.
- *
- * This API does <b>not</b> replace any previously configured downstreams
- * and must be explicitly removed by calling removeDownstream or by clearing
- * the entire configuration by calling stopAllOffload.
- *
- * @return SUCCESS The new information was accepted
- * FAIL_TOO_MANY_PREFIXES The hardware has already accepted the max
- * number of Prefixes that can be supported.
- * If offload is desired on this Prefix then
- * another must be removed first.
- * FAIL_UNSUPPORTED The hardware cannot forward traffic from this
- * downstream interface and will never be able to.
- */
- virtual RET addDownstream(const char* /* downstream */,
- const Prefix& /* prefix */) = 0;
- /**
- * Remove a downstream Prefix that forwarding was previously requested for.
- *
- * The Prefix may be an IPv4 or IPv6 address. Traffic outside of this
- * Prefix is not affected.
- *
- * @return SUCCESS iff forwarding was previously occurring and has been
- * stopped
- * SUCCESS_NO_OP iff forwarding was not previously occurring and
- * therefore no action needed to be taken
- */
- virtual RET removeDownstream(const char* /* downstream */,
- const Prefix& /* prefix */) = 0;
- /**
- * Indicate that hardware should forward traffic from any configured
- * downstreams to the specified upstream.
- *
- * When iface is non-null and non-empty and v4Gw is valid, then any
- * currently configured or future configured IPv4 downstreams should be
- * forwarded to this upstream interface.
- *
- * When iface is non-null and non-empty and v6Gw is valid, then any
- * currently configured or future configured IPv6 downstreams should be
- * forwarded to this upstream interface.
- *
- * @param iface Upstream interface name. Only one is needed because IPv4
- * and IPv6 interface names are required to match.
- * @param v4Gw The address of the IPv4 Gateway on the iface
- * @param v6Gw The address of one of the IPv6 Gateways on the iface
- *
- * @return SUCCESS iff the specified configuration was applied
- * SUCCESS_DUPLICATE_CONFIG if this configuration <i>exactly</i>
- * matches a previously provided
- * configuration. This means that no
- * action has to be taken, but, the
- * configuration was previously accepted
- * and applied.
- * FAIL_UNSUPPORTED if hardware cannot support forwarding to this
- * upstream interface
- *
- * Remarks: This overrides any previously configured parameters
- */
- virtual RET setUpstream(const char* /* iface */, const Prefix& /* v4Gw */,
- const Prefix& /* v6Gw */) = 0;
- /**
- * All traffic must be returned to the software path and all configuration
- * (including provided file descriptors) must be forgotten.
- *
- * @return SUCCESS If all offload was successfully stopped and provided
- * file descriptors were released.
- *
- * Remarks: This can't really fail?
- */
- virtual RET stopAllOffload() = 0;
-
- /* --------------------------- STATS/POLICY ----------------------------- */
- /**
- * Instruct hardware to stop forwarding traffic and send a callback after
- * limit bytes have been transferred in either direction on this upstream
- * interface.
- *
- * @param upstream Upstream interface name that the limit should apply to
- * @param limit Bytes limit that can occur before action should be taken
- *
- * @return SUCCESS If the limit was successfully applied
- * SUCCESS_OPTIMIZED If the limit was sufficiently high to be
- * interpreted as "no quota".
- * FAIL_HARDWARE If the limit was rejected by the hardware
- * FAIL_UNSUPPORTED If metering is not supported on this interface
- * FAIL_TRY_AGAIN If this upstream has not been previously
- * configured to allow offload
- * (via setUpstreamParameters)
- */
- virtual RET setQuota(const char* /* upstream */, uint64_t /* limit */) = 0;
- /**
- * Query for statistics counters in hardware.
- *
- * This returns an aggregate of all hardware accelerated traffic which
- * has occurred on this upstream interface.
- *
- * @param upstream Interface on which traffic entered/exited
- * @param reset Whether hardware counters should reset after returning
- * current statistics
- * @param ret Output variable where statistics are returned
- *
- * @return SUCCESS If the statistics were successfully populated in ret and
- * were successfully reset if requested.
- * FAIL_TRY_AGAIN If the statistics are not currently available but
- * may be available later. This may occur during
- * a subsystem restart.
- * FAIL_UNSUPPORTED If statistics are not supported on this upstream
- */
- virtual RET getStats(const char* /* upstream */, bool /* reset */,
- OffloadStatistics& /* ret */) = 0;
-}; /* IOffloadManager */
-#endif /* _I_OFFLOAD_MANAGER_H_ */
diff --git a/data-ipa-cfg-mgr/hal/inc/IpaEventRelay.h b/data-ipa-cfg-mgr/hal/inc/IpaEventRelay.h
deleted file mode 100644
index 4541510..0000000
--- a/data-ipa-cfg-mgr/hal/inc/IpaEventRelay.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2017, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of The Linux Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef _IPA_EVENT_RELAY_H_
-#define _IPA_EVENT_RELAY_H_
-/* External Includes */
-#include <hidl/HidlTransportSupport.h>
-
-/* HIDL Includes */
-#include <android/hardware/tetheroffload/control/1.0/ITetheringOffloadCallback.h>
-
-/* Internal Includes */
-#include "IOffloadManager.h"
-
-/* Namespace pollution avoidance */
-using ::android::hardware::tetheroffload::control::V1_0::ITetheringOffloadCallback;
-
-
-class IpaEventRelay : public IOffloadManager::IpaEventListener {
-public:
- IpaEventRelay(const ::android::sp<ITetheringOffloadCallback>& /* cb */);
- /* ----------------------- IPA EVENT LISTENER --------------------------- */
- void onOffloadStarted();
- void onOffloadStopped(StoppedReason /* reason */);
- void onOffloadSupportAvailable();
- void onLimitReached();
-private:
- const ::android::sp<ITetheringOffloadCallback>& mFramework;
-}; /* IpaEventRelay */
-#endif /* _IPA_EVENT_RELAY_H_ */ \ No newline at end of file
diff --git a/data-ipa-cfg-mgr/hal/inc/LocalLogBuffer.h b/data-ipa-cfg-mgr/hal/inc/LocalLogBuffer.h
deleted file mode 100644
index c23ef7d..0000000
--- a/data-ipa-cfg-mgr/hal/inc/LocalLogBuffer.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2017, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of The Linux Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef _LOCAL_LOG_BUFFER_H_
-#define _LOCAL_LOG_BUFFER_H_
-/* External Includes */
-#include <deque>
-#include <sstream>
-#include <string>
-#include <sys/types.h>
-#include <vector>
-
-/* Namespace pollution avoidance */
-using ::std::deque;
-using ::std::string;
-using ::std::stringstream;
-using ::std::vector;
-
-
-class LocalLogBuffer {
-public:
- class FunctionLog {
- public:
- FunctionLog(string /* funcName */);
- FunctionLog(const FunctionLog& /* other */);
- void addArg(string /* kw */, string /* arg */);
- void addArg(string /* kw */, vector<string> /* args */);
- void addArg(string /* kw */, uint64_t /* arg */);
- void setResult(bool /* success */, string /* msg */);
- void setResult(vector<unsigned int> /* ret */);
- void setResult(uint64_t /* rx */, uint64_t /* tx */);
- string toString();
- private:
- void maybeAddArgsComma();
- const string mName;
- bool mArgsProvided;
- stringstream mSSArgs;
- stringstream mSSReturn;
- }; /* FunctionLog */
- LocalLogBuffer(string /* name */, int /* maxLogs */);
- void addLog(FunctionLog /* log */);
- void toLogcat();
-private:
- deque<FunctionLog> mLogs;
- const string mName;
- const size_t mMaxLogs;
-}; /* LocalLogBuffer */
-#endif /* _LOCAL_LOG_BUFFER_H_ */ \ No newline at end of file
diff --git a/data-ipa-cfg-mgr/hal/inc/OffloadStatistics.h b/data-ipa-cfg-mgr/hal/inc/OffloadStatistics.h
deleted file mode 100644
index 226ea72..0000000
--- a/data-ipa-cfg-mgr/hal/inc/OffloadStatistics.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2017, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of The Linux Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef _OFFLOAD_STATISTICS_H_
-#define _OFFLOAD_STATISTICS_H_
-
-#include <string>
-#include <sys/types.h>
-
-
-class OffloadStatistics {
-public:
- uint64_t rx;
- uint64_t tx;
-
- OffloadStatistics();
- OffloadStatistics(std::string /* upstream */);
-
- uint64_t getTotalRxBytes();
- uint64_t getTotalTxBytes();
-private:
- std::string upstream;
-}; /* OffloadStatistics */
-#endif /* _OFFLOAD_STATISTICS_H_ */
diff --git a/data-ipa-cfg-mgr/hal/inc/PrefixParser.h b/data-ipa-cfg-mgr/hal/inc/PrefixParser.h
deleted file mode 100644
index 99afbe0..0000000
--- a/data-ipa-cfg-mgr/hal/inc/PrefixParser.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 2017, The Linux Foundation. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of The Linux Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef _PREFIX_PARSER_H_
-#define _PREFIX_PARSER_H_
-
-/* External Includes */
-#include <string.h>
-#include <sys/types.h>
-#include <vector>
-
-/* Internal Includes */
-#include "IOffloadManager.h"
-
-/* Avoiding namespace pollution */
-using IP_FAM = ::IOffloadManager::IP_FAM;
-using Prefix = ::IOffloadManager::Prefix;
-
-using ::std::string;
-using ::std::vector;
-
-
-class PrefixParser {
-public:
- PrefixParser();
- bool add(vector<string> /* in */);
- bool add(string /* in */);
- bool addV4(vector<string> /* in */);
- bool addV4(string /* in */);
- bool addV6(vector<string> /* in */);
- bool addV6(string /* in */);
- int size();
- bool allAreFullyQualified();
- Prefix getFirstPrefix();
- Prefix getFirstPrefix(IP_FAM);
- string getLastErrAsStr();
-private:
- bool add(string /* in */, IP_FAM /* famHint */);
- bool add(vector<string> /* in */, IP_FAM /* famHint */);
- static IP_FAM guessIPFamily(string /* in */);
- static bool splitIntoAddrAndMask(string /* in */, string& /* addr */,
- string& /* mask */);
- static int parseSubnetMask(string /* in */, IP_FAM /* famHint */);
- static bool parseV4Addr(string /* in */, Prefix& /* out */);
- static bool parseV6Addr(string /* in */, Prefix& /* out */);
- static bool populateV4Mask(int /* mask */, Prefix& /* out */);
- static bool populateV6Mask(int /* mask */, Prefix& /* out */);
- static uint32_t createMask(int /* mask */);
- static Prefix makeBlankPrefix(IP_FAM /* famHint */);
- bool isMaskValid(int /* mask */, IP_FAM /* fam */);
- static const uint32_t FULLY_QUALIFIED_MASK = ~0;
- vector<Prefix> mPrefixes;
- string mLastErr;
-}; /* PrefixParser */
-#endif /* _PREFIX_PARSER_H_ */ \ No newline at end of file