diff options
Diffstat (limited to 'service/lib/common.h')
-rw-r--r-- | service/lib/common.h | 131 |
1 files changed, 0 insertions, 131 deletions
diff --git a/service/lib/common.h b/service/lib/common.h deleted file mode 100644 index 88062cf..0000000 --- a/service/lib/common.h +++ /dev/null @@ -1,131 +0,0 @@ - -#include "wifi_hal.h" - -#ifndef __WIFI_HAL_COMMON_H__ -#define __WIFI_HAL_COMMON_H__ - -#define LOG_TAG "WifiHAL" - -#include <utils/Log.h> -#include "nl80211_copy.h" - -#define SOCKET_BUFFER_SIZE (32768U) -#define RECV_BUF_SIZE (4096) -#define DEFAULT_EVENT_CB_SIZE (64) -#define DEFAULT_CMD_SIZE (64) - -/* - Vendor OUI - This is a unique identifier that identifies organization. Lets - code Android specific functions with Google OUI; although vendors can do more - with their own OUI's as well. - */ - -const uint32_t GOOGLE_OUI = 0x001A11; -/* TODO: define vendor OUI here */ - - -/* - This enum defines ranges for various commands; commands themselves - can be defined in respective feature headers; i.e. find gscan command - definitions in gscan.cpp - */ - -typedef enum { - /* don't use 0 as a valid subcommand */ - VENDOR_NL80211_SUBCMD_UNSPECIFIED, - - /* define all vendor startup commands between 0x0 and 0x0FFF */ - VENDOR_NL80211_SUBCMD_RANGE_START = 0x0001, - VENDOR_NL80211_SUBCMD_RANGE_END = 0x0FFF, - - /* define all GScan related commands between 0x1000 and 0x10FF */ - ANDROID_NL80211_SUBCMD_GSCAN_RANGE_START = 0x1000, - ANDROID_NL80211_SUBCMD_GSCAN_RANGE_END = 0x10FF, - - /* define all NearbyDiscovery related commands between 0x1100 and 0x11FF */ - ANDROID_NL80211_SUBCMD_NBD_RANGE_START = 0x1100, - ANDROID_NL80211_SUBCMD_NBD_RANGE_END = 0x11FF, - - /* define all RTT related commands between 0x1100 and 0x11FF */ - ANDROID_NL80211_SUBCMD_RTT_RANGE_START = 0x1100, - ANDROID_NL80211_SUBCMD_RTT_RANGE_END = 0x11FF, - - /* This is reserved for future usage */ - -} ANDROID_VENDOR_SUB_COMMAND; - -typedef void (*wifi_internal_event_handler) (wifi_handle handle, int events); - -class WifiCommand; - -typedef struct { - int nl_cmd; - uint32_t vendor_id; - int vendor_subcmd; - nl_recvmsg_msg_cb_t cb_func; - void *cb_arg; -} cb_info; - -typedef struct { - wifi_request_id id; - WifiCommand *cmd; -} cmd_info; - -typedef struct { - wifi_handle handle; // handle to wifi data - char name[8+1]; // interface name + trailing null - int id; // id to use when talking to driver -} interface_info; - -typedef struct { - - struct nl_sock *cmd_sock; // command socket object - struct nl_sock *event_sock; // event socket object - int nl80211_family_id; // family id for 80211 driver - - bool in_event_loop; // Indicates that event loop is active - bool clean_up; // Indication to clean up the socket - - wifi_internal_event_handler event_handler; // default event handler - wifi_cleaned_up_handler cleaned_up_handler; // socket cleaned up handler - - cb_info *event_cb; // event callbacks - int num_event_cb; // number of event callbacks - int alloc_event_cb; // number of allocated callback objects - - cmd_info *cmd; // Outstanding commands - int num_cmd; // number of commands - int alloc_cmd; // number of commands allocated - - interface_info **interfaces; // array of interfaces - int num_interfaces; // number of interfaces - - // add other details -} hal_info; - -wifi_error wifi_register_handler(wifi_handle handle, int cmd, nl_recvmsg_msg_cb_t func, void *arg); -wifi_error wifi_register_vendor_handler(wifi_handle handle, - uint32_t id, int subcmd, nl_recvmsg_msg_cb_t func, void *arg); - -void wifi_unregister_handler(wifi_handle handle, int cmd); -void wifi_unregister_vendor_handler(wifi_handle handle, uint32_t id, int subcmd); - -wifi_error wifi_register_cmd(wifi_handle handle, int id, WifiCommand *cmd); -WifiCommand *wifi_unregister_cmd(wifi_handle handle, int id); -void wifi_unregister_cmd(wifi_handle handle, WifiCommand *cmd); - -interface_info *getIfaceInfo(wifi_interface_handle); -wifi_handle getWifiHandle(wifi_interface_handle handle); -hal_info *getHalInfo(wifi_handle handle); -hal_info *getHalInfo(wifi_interface_handle handle); -wifi_handle getWifiHandle(hal_info *info); -wifi_interface_handle getIfaceHandle(interface_info *info); - - -// some common macros - -#define min(x, y) ((x) < (y) ? (x) : (y)) -#define max(x, y) ((x) > (y) ? (x) : (y)) - -#endif - |