cpp_bindings.cpp \
gscan.cpp \
link_layer_stats.cpp \
- wifi_offload.cpp
+ wifi_offload.cpp \
+ roam.cpp
LOCAL_MODULE := libwifi-hal-slsi
#define DEFAULT_CMD_SIZE (64)
#define DOT11_OUI_LEN 3
+typedef struct {
+ int num_bssid;
+ mac_addr bssids[MAX_BLACKLIST_BSSID];
+} wifi_bssid_params;
+
/*
Vendor OUI - This is a unique identifier that identifies organization. Lets
code Android specific functions with Google OUI; although vendors can do more
const uint32_t GOOGLE_OUI = 0x001A11;
/* TODO: define vendor OUI here */
+typedef enum {
+
+ GSCAN_ATTRIBUTE_NUM_BUCKETS = 10,
+ GSCAN_ATTRIBUTE_BASE_PERIOD,
+ GSCAN_ATTRIBUTE_BUCKETS_BAND,
+ GSCAN_ATTRIBUTE_BUCKET_ID,
+ GSCAN_ATTRIBUTE_BUCKET_PERIOD,
+ GSCAN_ATTRIBUTE_BUCKET_NUM_CHANNELS,
+ GSCAN_ATTRIBUTE_BUCKET_CHANNELS,
+ GSCAN_ATTRIBUTE_NUM_AP_PER_SCAN,
+ GSCAN_ATTRIBUTE_REPORT_THRESHOLD,
+ GSCAN_ATTRIBUTE_NUM_SCANS_TO_CACHE,
+ GSCAN_ATTRIBUTE_REPORT_THRESHOLD_NUM_SCANS,
+ GSCAN_ATTRIBUTE_BAND = GSCAN_ATTRIBUTE_BUCKETS_BAND,
+
+ GSCAN_ATTRIBUTE_ENABLE_FEATURE = 20,
+ GSCAN_ATTRIBUTE_SCAN_RESULTS_COMPLETE, /* indicates no more results */
+ GSCAN_ATTRIBUTE_REPORT_EVENTS,
+
+ /* remaining reserved for additional attributes */
+ GSCAN_ATTRIBUTE_NUM_OF_RESULTS = 30,
+ GSCAN_ATTRIBUTE_SCAN_RESULTS, /* flat array of wifi_scan_result */
+ GSCAN_ATTRIBUTE_NUM_CHANNELS,
+ GSCAN_ATTRIBUTE_CHANNEL_LIST,
+ GSCAN_ATTRIBUTE_SCAN_ID,
+ GSCAN_ATTRIBUTE_SCAN_FLAGS,
+ GSCAN_ATTRIBUTE_SCAN_BUCKET_BIT,
+
+ /* remaining reserved for additional attributes */
+
+ GSCAN_ATTRIBUTE_SSID = 40,
+ GSCAN_ATTRIBUTE_BSSID,
+ GSCAN_ATTRIBUTE_CHANNEL,
+ GSCAN_ATTRIBUTE_RSSI,
+ GSCAN_ATTRIBUTE_TIMESTAMP,
+ GSCAN_ATTRIBUTE_RTT,
+ GSCAN_ATTRIBUTE_RTTSD,
+
+ /* remaining reserved for additional attributes */
+
+ GSCAN_ATTRIBUTE_HOTLIST_BSSIDS = 50,
+ GSCAN_ATTRIBUTE_RSSI_LOW,
+ GSCAN_ATTRIBUTE_RSSI_HIGH,
+ GSCAN_ATTRIBUTE_HOTLIST_ELEM,
+ GSCAN_ATTRIBUTE_HOTLIST_FLUSH,
+ GSCAN_ATTRIBUTE_CHANNEL_NUMBER,
+
+ /* remaining reserved for additional attributes */
+ GSCAN_ATTRIBUTE_RSSI_SAMPLE_SIZE = 60,
+ GSCAN_ATTRIBUTE_LOST_AP_SAMPLE_SIZE,
+ GSCAN_ATTRIBUTE_MIN_BREACHING,
+ GSCAN_ATTRIBUTE_SIGNIFICANT_CHANGE_BSSIDS,
+
+ GSCAN_ATTRIBUTE_BUCKET_STEP_COUNT = 70,
+ GSCAN_ATTRIBUTE_BUCKET_EXPONENT,
+ GSCAN_ATTRIBUTE_BUCKET_MAX_PERIOD,
+
+ GSCAN_ATTRIBUTE_NUM_BSSID,
+ GSCAN_ATTRIBUTE_BLACKLIST_BSSID,
+
+ GSCAN_ATTRIBUTE_MAX
+
+} GSCAN_ATTRIBUTE;
/*
This enum defines ranges for various commands; commands themselves
wifi_unregister_cmd(handle, id);
return result;
}
-
-#if 0 // TODO: (IP) removed to make it build
-
-class BssidBlacklistCommand : public WifiCommand
-{
-private:
- wifi_bssid_params *mParams;
-public:
- BssidBlacklistCommand(wifi_interface_handle handle, int id,
- wifi_bssid_params *params)
- : WifiCommand(handle, id), mParams(params)
- { }
- int createRequest(WifiRequest& request) {
- int result = request.create(GOOGLE_OUI, SLSI_NL80211_VENDOR_SUBCMD_SET_BSSID_BLACKLIST);
- if (result < 0) {
- return result;
- }
-
- nlattr *data = request.attr_start(NL80211_ATTR_VENDOR_DATA);
- result = request.put_u32(GSCAN_ATTRIBUTE_NUM_BSSID, mParams->num_bssid);
- if (result < 0) {
- return result;
- }
-
- for (int i = 0; i < mParams->num_bssid; i++) {
- result = request.put_addr(GSCAN_ATTRIBUTE_BLACKLIST_BSSID, mParams->bssids[i]);
- if (result < 0) {
- return result;
- }
- }
- request.attr_end(data);
- return result;
- }
-
- int start() {
- WifiRequest request(familyId(), ifaceId());
- int result = createRequest(request);
- if (result < 0) {
- return result;
- }
-
- result = requestResponse(request);
- if (result < 0) {
- ALOGE("Failed to execute bssid blacklist request, result = %d", result);
- return result;
- }
-
- return result;
- }
-
-
- virtual int handleResponse(WifiEvent& reply) {
- /* Nothing to do on response! */
- return NL_SKIP;
- }
-};
-
-wifi_error wifi_set_bssid_blacklist(wifi_request_id id, wifi_interface_handle iface,
- wifi_bssid_params params)
-{
- wifi_handle handle = getWifiHandle(iface);
-
- BssidBlacklistCommand *cmd = new BssidBlacklistCommand(iface, id, ¶ms);
- wifi_error result = (wifi_error)cmd->start();
- //release the reference of command as well
- cmd->releaseRef();
- return result;
-}
-#endif
--- /dev/null
+#include <stdint.h>\r
+#include <stddef.h>\r
+#include <fcntl.h>\r
+#include <sys/socket.h>\r
+#include <netlink/genl/genl.h>\r
+#include <netlink/genl/family.h>\r
+#include <netlink/genl/ctrl.h>\r
+#include <linux/rtnetlink.h>\r
+#include <netpacket/packet.h>\r
+#include <linux/filter.h>\r
+#include <linux/errqueue.h>\r
+\r
+#include <linux/pkt_sched.h>\r
+#include <netlink/object-api.h>\r
+#include <netlink/netlink.h>\r
+#include <netlink/socket.h>\r
+#include <netlink/handlers.h>\r
+\r
+#include "sync.h"\r
+\r
+#define LOG_TAG "WifiHAL"\r
+\r
+#include <utils/Log.h>\r
+\r
+#include "wifi_hal.h"\r
+#include "common.h"\r
+#include "cpp_bindings.h"\r
+\r
+#define REQUEST_ID_MAX 1000\r
+#define get_requestid() ((arc4random()%REQUEST_ID_MAX) + 1)\r
+\r
+class BssidBlacklistCommand : public WifiCommand\r
+{\r
+private:\r
+ wifi_bssid_params *mParams;\r
+public:\r
+ BssidBlacklistCommand(wifi_interface_handle handle, int id,\r
+ wifi_bssid_params *params)\r
+ : WifiCommand(handle, id), mParams(params)\r
+ { }\r
+ int createRequest(WifiRequest& request) {\r
+ int result = request.create(GOOGLE_OUI, SLSI_NL80211_VENDOR_SUBCMD_SET_BSSID_BLACKLIST);\r
+ if (result < 0) {\r
+ return result;\r
+ }\r
+\r
+ nlattr *data = request.attr_start(NL80211_ATTR_VENDOR_DATA);\r
+ result = request.put_u32(GSCAN_ATTRIBUTE_NUM_BSSID, mParams->num_bssid);\r
+ if (result < 0) {\r
+ return result;\r
+ }\r
+\r
+ for (int i = 0; i < mParams->num_bssid; i++) {\r
+ result = request.put_addr(GSCAN_ATTRIBUTE_BLACKLIST_BSSID, mParams->bssids[i]);\r
+ if (result < 0) {\r
+ return result;\r
+ }\r
+ }\r
+ request.attr_end(data);\r
+ return result;\r
+ }\r
+\r
+ int start() {\r
+ WifiRequest request(familyId(), ifaceId());\r
+ int result = createRequest(request);\r
+ if (result < 0) {\r
+ return result;\r
+ }\r
+\r
+ result = requestResponse(request);\r
+ if (result < 0) {\r
+ ALOGE("Failed to execute bssid blacklist request, result = %d", result);\r
+ return result;\r
+ }\r
+\r
+ return result;\r
+ }\r
+\r
+\r
+ virtual int handleResponse(WifiEvent& reply) {\r
+ /* Nothing to do on response! */\r
+ return NL_SKIP;\r
+ }\r
+};\r
+\r
+wifi_error wifi_set_bssid_blacklist(wifi_request_id id, wifi_interface_handle iface,\r
+ wifi_bssid_params params)\r
+{\r
+ BssidBlacklistCommand *cmd = new BssidBlacklistCommand(iface, id, ¶ms);\r
+ wifi_error result = (wifi_error)cmd->start();\r
+ //release the reference of command as well\r
+ cmd->releaseRef();\r
+ return result;\r
+}\r
+\r
+/*to be implemented*/\r
+wifi_error wifi_get_roaming_capabilities(wifi_interface_handle iface,\r
+ wifi_roaming_capabilities *caps);\r
+\r
+/*to be implemented*/\r
+wifi_error wifi_enable_firmware_roaming(wifi_interface_handle handle,\r
+ fw_roaming_state_t state);\r
+\r
+wifi_error wifi_configure_roaming(wifi_interface_handle iface, wifi_roaming_config *roaming_config)\r
+{\r
+ wifi_error ret;\r
+ int requestId;\r
+ wifi_bssid_params bssid_params;\r
+ wifi_handle wifiHandle = getWifiHandle(iface);\r
+\r
+ if (!roaming_config) {\r
+ ALOGE("%s: Invalid Buffer provided. Exit", __FUNCTION__);\r
+ return WIFI_ERROR_INVALID_ARGS;\r
+ }\r
+\r
+ /* Generate request id randomly*/\r
+ requestId = get_requestid();\r
+ bssid_params.num_bssid = roaming_config->num_blacklist_bssid;\r
+\r
+ memcpy(bssid_params.bssids, roaming_config->blacklist_bssid,\r
+ (bssid_params.num_bssid * sizeof(mac_addr)));\r
+\r
+ ret = wifi_set_bssid_blacklist(requestId, iface, bssid_params);\r
+ if (ret != WIFI_SUCCESS) {\r
+ ALOGE("%s: Failed to configure blacklist bssids", __FUNCTION__);\r
+ return WIFI_ERROR_UNKNOWN;\r
+ }\r
+\r
+ return ret;\r
+}\r
#include "wifi_hal.h"
#include "common.h"
#include "cpp_bindings.h"
+#include "roam.h"
#define WIFI_HAL_CMD_SOCK_PORT 644
fn->wifi_reset_epno_list = wifi_reset_epno_list;
fn->wifi_set_passpoint_list = wifi_set_passpoint_list;
fn->wifi_reset_passpoint_list = wifi_reset_passpoint_list;
-// fn->wifi_set_bssid_blacklist = wifi_set_bssid_blacklist; // TODO: (IP) make it build
fn->wifi_start_rssi_monitoring = wifi_start_rssi_monitoring;
fn->wifi_stop_rssi_monitoring = wifi_stop_rssi_monitoring;
fn->wifi_set_link_stats = wifi_set_link_stats;
fn->wifi_get_link_stats = wifi_get_link_stats;
fn->wifi_clear_link_stats = wifi_clear_link_stats;
fn->wifi_set_country_code = wifi_set_country_code;
+ fn->wifi_configure_roaming = wifi_configure_roaming;
return WIFI_SUCCESS;
}