diff options
Diffstat (limited to 'cnd/inc')
-rw-r--r-- | cnd/inc/cnd.h | 70 | ||||
-rw-r--r-- | cnd/inc/cnd_commands.h | 38 | ||||
-rw-r--r-- | cnd/inc/cnd_event.h | 60 | ||||
-rw-r--r-- | cnd/inc/cnd_iproute2.h | 268 | ||||
-rw-r--r-- | cnd/inc/cnd_unsol_messages.h | 31 |
5 files changed, 0 insertions, 467 deletions
diff --git a/cnd/inc/cnd.h b/cnd/inc/cnd.h deleted file mode 100644 index fff057b..0000000 --- a/cnd/inc/cnd.h +++ /dev/null @@ -1,70 +0,0 @@ -/* -** Copyright 2006, The Android Open Source Project -** Copyright (c) 2010, 2011 Code Aurora Forum. All rights reserved. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ -#ifndef CND_H -#define CND_H - -#include <stdlib.h> -#include <sys/time.h> -#include <utils/Log.h> -#include "cne.h" - -#define CNE_DEBUG_LOGGING 0 - -#define CNE_LOGE(...) LOGE(__VA_ARGS__) -#define CNE_LOGW(...) LOGW(__VA_ARGS__) -#define CNE_LOGI(...) \ - ( (CONDITION(CNE_DEBUG_LOGGING)) \ - ? (void)LOG(LOG_INFO, LOCAL_TAG, __VA_ARGS__) \ - : (void)0 ) -#define CNE_LOGD(...) \ - ( (CONDITION(CNE_DEBUG_LOGGING)) \ - ? (void)LOG(LOG_DEBUG, LOCAL_TAG, __VA_ARGS__) \ - : (void)0 ) -#define CNE_LOGV(...) \ - ( (CONDITION(CNE_DEBUG_LOGGING)) \ - ? (void)LOG(LOG_VERBOSE, LOCAL_TAG, __VA_ARGS__) \ - : (void)0 ) - -#ifdef __cplusplus -extern "C" { -#endif - - -typedef void * CND_Token; - -typedef enum { - CND_E_SUCCESS = 0, - CND_E_RADIO_NOT_AVAILABLE = 1, /* If radio did not start or is resetting */ - CND_E_GENERIC_FAILURE = 2, - CND_E_INVALID_RESPONSE - -} CND_Errno; - - - - -void cnd_init(void); -void cnd_startEventLoop(void); - - - -#ifdef __cplusplus -} -#endif - -#endif /* CND_H */ - diff --git a/cnd/inc/cnd_commands.h b/cnd/inc/cnd_commands.h deleted file mode 100644 index 4e8c968..0000000 --- a/cnd/inc/cnd_commands.h +++ /dev/null @@ -1,38 +0,0 @@ -/* -** Copyright 2006, The Android Open Source Project -** Copyright (c) 2010, 2011 Code Aurora Forum. All rights reserved. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ - {0, NULL, NULL}, //none - {CNE_REQUEST_INIT_CMD, dispatchVoid, responseVoid}, - {CNE_REQUEST_REG_ROLE_CMD, dispatchInts, responseInts}, - {CNE_REQUEST_GET_COMPATIBLE_NWS_CMD, dispatchInts, responseInts}, - {CNE_REQUEST_CONFIRM_NW_CMD, dispatchInts, responseInts}, - {CNE_REQUEST_DEREG_ROLE_CMD, dispatchInts, responseInts}, - {CNE_REQUEST_REG_NOTIFICATIONS_CMD, dispatchInts, responseInts}, - {CNE_REQUEST_UPDATE_BATTERY_INFO_CMD, dispatchInts, responseVoid}, - {CNE_REQUEST_UPDATE_WLAN_INFO_CMD, dispatchWlanInfo, responseVoid}, - {CNE_REQUEST_UPDATE_WWAN_INFO_CMD, dispatchWwanInfo, responseVoid}, - {CNE_NOTIFY_RAT_CONNECT_STATUS_CMD, dispatchRatStatus, responseVoid}, - {CNE_NOTIFY_DEFAULT_NW_PREF_CMD, dispatchInts, responseVoid}, - {CNE_REQUEST_UPDATE_WLAN_SCAN_RESULTS_CMD, dispatchWlanScanResults, responseVoid}, - {CNE_NOTIFY_SENSOR_EVENT_CMD, dispatchVoid, responseVoid}, - {CNE_REQUEST_CONFIG_IPROUTE2_CMD, dispatchIproute2Cmd, responseVoid}, - {CNE_NOTIFY_TIMER_EXPIRED_CMD, dispatchVoid, responseVoid}, - {CNE_REQUEST_START_FMC_CMD, dispatchString, responseVoid}, - {CNE_REQUEST_STOP_FMC_CMD, dispatchVoid, responseVoid}, - {CNE_REQUEST_UPDATE_WWAN_DORMANCY_INFO_CMD, dispatchInt, responseVoid}, - {CNE_REQUEST_UPDATE_DEFAULT_NETWORK_INFO_CMD, dispatchInt, responseVoid}, - {CNE_NOTIFY_SOCKET_CLOSED_CMD, dispatchVoid, responseVoid}, - {CNE_REQUEST_VENDOR_CMD, dispatchRaw, responseVoid} diff --git a/cnd/inc/cnd_event.h b/cnd/inc/cnd_event.h deleted file mode 100644 index 07b4fff..0000000 --- a/cnd/inc/cnd_event.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef CNE_EVENT_H -#define CNE_EVENT_H -/* -** Copyright 2006, The Android Open Source Project -** Copyright (c) 2010, 2011 Code Aurora Forum. All rights reserved. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ -#include "cne.h" - -// Max number of fd's we watch at any one time. Increase if necessary. -#define MAX_FD_EVENTS 128 - -typedef void (*cnd_event_cb)(int fd, void *userdata); -typedef int (*cneIntFnType)(void); -typedef void (*cneProcessCmdFnType)(int, int, void*,size_t); -typedef void (*cneRegMsgCbFnType)(cne_messageCbType); - -struct cnd_event { - struct cnd_event *next; - struct cnd_event *prev; - - int fd; - int index; - int persist; - cnd_event_cb func; - void *param; -}; - -// Initialize internal data structs -int cnd_event_init(); - -// Initialize an event -void cnd_event_set(struct cnd_event * ev, int fd, int persist, cnd_event_cb func, void * param); - -// Add event to watch list -void cnd_event_add(struct cnd_event * ev); - - -// Remove event from watch list -void cnd_event_del(struct cnd_event * ev); - -// Event loop -void cnd_event_loop(); - - -// Dump watch table for debugging -void cnd_dump_watch_table(); - -#endif /* CNE_EVENT_H */ diff --git a/cnd/inc/cnd_iproute2.h b/cnd/inc/cnd_iproute2.h deleted file mode 100644 index 24b8080..0000000 --- a/cnd/inc/cnd_iproute2.h +++ /dev/null @@ -1,268 +0,0 @@ -/* Copyright (c) 2010, Code Aurora Forum. 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 Code Aurora 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 BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 CND_IPROUTE2_H -#define CND_IPROUTE2_H - -/**---------------------------------------------------------------------------- - @file cnd_iproute2.h - - cnd_iproute2 is an interface to make the necessary calls to iproute2 - in order to set up and take down routing tables. Defines APIs so that - a routing table associated with a network interface can be added or - deleted. Also allows the user to change the default routing table when - a given source address is not already associated with a network - interface. ------------------------------------------------------------------------------*/ - - -/*---------------------------------------------------------------------------- - * Include Files - * -------------------------------------------------------------------------*/ -#include <sys/types.h> - -/*---------------------------------------------------------------------------- - * Preprocessor Definitions and Constants - * -------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - * Type Declarations - * -------------------------------------------------------------------------*/ - -/*---------------------------------------------------------------------------- - * Class Definitions - * -------------------------------------------------------------------------*/ - -class cnd_iproute2 -{ - public: - /** - * @brief Returns an instance of the Cnd_iproute2 class. - * - * The user of this class will call this function to get an - * instance of the class. All other public functions will be - * called on this instance - * - * @param None - * @see None - * @return An instance of the Cnd_iproute2 class is returned. - */ - static cnd_iproute2* getInstance - ( - void - ); - - /** - * @brief Creates a custom route in the main table using iproute2 - * - * The user of this function passes in the name of the network - * interface that matches the name already defined in the Android - * system. This radio will handle any packets that are sent to - * the inputted destination address of a host. Optionally, a user - * can pass the gateway address of the device. - * - * @param destinationAddress The destination address of the - * custom entry in the main table that - * will be added - * @param deviceName The name of the device that will - * handle packets to the host - * @param gatewayAddress The gateway address of the device - * (optional) - * @return True if function is successful. - * False otherwise. - */ - bool addCustomEntryInMainTable - ( - uint8_t *destinationAddress, - uint8_t *deviceName, - uint8_t *gatewayAddress - ); - - /** - * @brief Create a routing table for a network interface using - * iproute2 - * - * The user of this function passes in the name of the network - * interface that matches the name already defined in the Android - * system. The user also needs to locate the source prefix, and, - * optionally, the gateway address assocated with that radio. If - * a table is added when no another tables exist, it will - * automatically become the default table. - * - * @param deviceName The name of the device whose table - * will be added - * @param sourcePrefix The source network prefix or address - * that will be routed to the device - * (Such as 37.214.21/24 or 10.156.45.1) - * @param gatewayAddress The gateway address of the device - * (optional) - * @return True if function is successful. False - * otherwise. - */ - bool addRoutingTable - ( - uint8_t *deviceName, - uint8_t *sourcePrefix, - uint8_t *gatewayAddress - ); - - /** - * @brief Deletes the custom route to the inputted destination - * address in the main table using iproute2 - * - * The custom route being deleted should have been added via - * addCustomEntryToMainTable() - * - * @param destinationAddress The destination address of the - * custom entry in the main table that - * will be removed - * @return True if function is successful. - * False otherwise. - */ - bool deleteCustomEntryInMainTable - ( - uint8_t *destinationAddress - ); - - /** - * @brief Deletes all custom routes in the main table that route - * through a specific interface name - * - * The custom routes being deleted should have been added via - * addCustomEntryToMainTable() - * - * @param deviceName The name of the device whose custom - * entries in the main table will be - * removed - * @return True if function is successful. False - * otherwise. - */ - bool deleteDeviceCustomEntriesInMainTable - ( - uint8_t *deviceName - ); - - /** - * @brief Deletes a default entry from the main table. - * - * @param deviceName The name of the device whose default - * entry in the main table will be - * deleted - * @return True if function is successful. False - * otherwise. - */ - bool deleteDefaultEntryInMainTable - ( - uint8_t *deviceName - ); - - /** - * @brief Deletes a routing table from the system along with the - * rule corresponding to that table. - * - * The table being deleted should have been added via - * addRoutingTable() - * - * @param deviceName The name of the device whose table will be - * deleted - * @return True if function is successful. False - * otherwise. - */ - bool deleteRoutingTable - ( - uint8_t *deviceName - ); - - /** - * @brief Change the default routing table that is associated - * with any source addresses not bound to another table. - * - * The user of this function passes in the name of the network - * interface that matches the name already defined in the Android - * system. That device will become the new default. If this radio - * is already the default, this function simply returns true. - * - * @param deviceName The name of the device whose table - * will be added - * @return True if function is successful. False - * otherwise. - */ - bool replaceDefaultEntryInMainTable - ( - uint8_t *deviceName, - uint8_t *gatewayAddress - ); - - /** - * Displays the contents of all routing tables for debugging - * purposes. - * - * @return True if function is successful. False - * otherwise. - */ - bool showAllRoutingTables - ( - void - ); - - /** - * Displays the contents of the routing table associated with - * the inputted device name. - * - * @param deviceName The name of the device to be displayed - * @return True if function is successful. False - * otherwise. - */ - bool showRoutingTable - ( - uint8_t *deviceName - ); - - /** - * Displays the rules associated with all tables for debugging - * purposes. - * - * @return True if function is successful. False - * otherwise. - */ - bool showRules - ( - void - ); - - private: - /* constructor */ - cnd_iproute2(){}; - /* destructor */ - ~cnd_iproute2(){}; - - static cnd_iproute2* instancePtr; -}; - - -#endif /* CND_IPROUTE2_H*/ diff --git a/cnd/inc/cnd_unsol_messages.h b/cnd/inc/cnd_unsol_messages.h deleted file mode 100644 index 6d41074..0000000 --- a/cnd/inc/cnd_unsol_messages.h +++ /dev/null @@ -1,31 +0,0 @@ -/* -** Copyright 2006, The Android Open Source Project -** Copyright (c) 2010, 2011 Code Aurora Forum. All rights reserved. -** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at -** -** http://www.apache.org/licenses/LICENSE-2.0 -** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and -** limitations under the License. -*/ - - {0, NULL}, //none - {CNE_RESPONSE_REG_ROLE_MSG, responseInts}, - {CNE_RESPONSE_GET_COMPATIBLE_NWS_MSG, rspCompatibleNws}, - {CNE_RESPONSE_CONFIRM_NW_MSG, responseInts}, - {CNE_RESPONSE_DEREG_ROLE_MSG, responseInts}, - {CNE_REQUEST_BRING_RAT_DOWN_MSG, eventRatChange}, - {CNE_REQUEST_BRING_RAT_UP_MSG, eventRatChange}, - {CNE_NOTIFY_MORE_PREFERED_RAT_AVAIL_MSG, evtMorePrefNw}, - {CNE_NOTIFY_RAT_LOST_MSG, responseInts}, - {CNE_REQUEST_START_SCAN_WLAN_MSG, responseVoid}, - {CNE_NOTIFY_INFLIGHT_STATUS_MSG, responseInts}, - {CNE_NOTIFY_FMC_STATUS_MSG, responseInts}, - {CNE_NOTIFY_HOST_ROUTING_IP_MSG, responseString}, - {CNE_NOTIFY_VENDOR_MSG, responseRaw} |