wifi_offload.cpp \
roam.cpp \
wifi_logger.cpp \
- wifi_nan.cpp
+ wifi_nan.cpp \
+ wifi_nan_data_path.cpp
LOCAL_MODULE := libwifi-hal-slsi
LOCAL_VENDOR_MODULE := true
SLSI_NL80211_VENDOR_SUBCMD_NAN_TXFOLLOWUP,
SLSI_NL80211_VENDOR_SUBCMD_NAN_CONFIG,
SLSI_NL80211_VENDOR_SUBCMD_NAN_CAPABILITIES,
+ SLSI_NL80211_VENDOR_SUBCMD_NAN_DATA_INTERFACE_CREATE,
+ SLSI_NL80211_VENDOR_SUBCMD_NAN_DATA_INTERFACE_DELETE,
+ SLSI_NL80211_VENDOR_SUBCMD_NAN_DATA_REQUEST_INITIATOR,
+ SLSI_NL80211_VENDOR_SUBCMD_NAN_DATA_INDICATION_RESPONSE,
+ SLSI_NL80211_VENDOR_SUBCMD_NAN_DATA_END,
SLSI_NL80211_VENDOR_SUBCMD_RTT_GET_CAPABILITIES = ANDROID_NL80211_SUBCMD_RTT_RANGE_START,
SLSI_NL80211_VENDOR_SUBCMD_RTT_RANGE_START,
SLSI_NL80211_VENDOR_SUBCMD_RTT_RANGE_CANCEL,
WIFI_RSSI_REPORT_EVENT,
ENHANCE_LOGGER_RING_EVENT,
ENHANCE_LOGGER_MEM_DUMP_EVENT,
- SLSI_NAN_EVENT_RESPONSE,
+ /* NAN events start */
+ SLSI_NAN_EVENT_RESPONSE = 13,
SLSI_NAN_EVENT_PUBLISH_TERMINATED,
SLSI_NAN_EVENT_MATCH,
SLSI_NAN_EVENT_MATCH_EXPIRED,
WIFI_ACS_EVENT, /* Handled by supplicant. not in Wifi-HAL */
SLSI_NL80211_VENDOR_FORWARD_BEACON,
SLSI_NL80211_VENDOR_FORWARD_BEACON_ABORT,
- SLSI_NAN_EVENT_TRANSMIT_FOLLOWUP_STATUS
+ SLSI_NAN_EVENT_TRANSMIT_FOLLOWUP_STATUS,
+ /* NAN DATA PATH EVENTS*/
+ SLSI_NAN_EVENT_NDP_REQ = 24,
+ SLSI_NAN_EVENT_NDP_CFM,
+ SLSI_NAN_EVENT_NDP_END
} WIFI_EVENT;
--- /dev/null
+#ifndef NAN_COMMON_H_
+#define NAN_COMMON_H_
+#define SLSI_WIFI_HAL_NAN_VERSION 1
+
+#define CHECK_WIFI_STATUS_RETURN_FAIL(result, LOGSTR) \
+ if (result != WIFI_SUCCESS) {\
+ ALOGE(LOGSTR" [result:%d]", result);\
+ return result;\
+ }
+
+#define CHECK_CONFIG_PUT_8_RETURN_FAIL(config, val, nan_attribute, request, result, FAIL_STR) \
+ if (config) {\
+ result = request.put_u8(nan_attribute, val); \
+ if (result != WIFI_SUCCESS) {\
+ ALOGE(FAIL_STR" [result:%d]", result);\
+ return result;\
+ }\
+ }
+
+#define CHECK_CONFIG_PUT_16_RETURN_FAIL(config, val, nan_attribute, request, result, FAIL_STR) \
+ if (config) {\
+ result = request.put_u16(nan_attribute, val); \
+ if (result != WIFI_SUCCESS) {\
+ ALOGE(FAIL_STR" [result:%d]", result);\
+ return result;\
+ }\
+ }
+
+
+#define CHECK_CONFIG_PUT_32_RETURN_FAIL(config, val, nan_attribute, request, result, FAIL_STR) \
+ if (config) {\
+ result = request.put_u32(nan_attribute, val); \
+ if (result != WIFI_SUCCESS) {\
+ ALOGE(FAIL_STR" [result:%d]", result);\
+ return result;\
+ }\
+ }
+
+#define CHECK_CONFIG_PUT_RETURN_FAIL(config, valptr, len, nan_attribute, request, result, FAIL_STR) \
+ if (config) {\
+ result = request.put(nan_attribute, valptr, len); \
+ if (result != WIFI_SUCCESS) {\
+ ALOGE(FAIL_STR" [result:%d]", result);\
+ return result;\
+ }\
+ }
+
+typedef enum {
+ NAN_REQ_ATTR_MASTER_PREF,
+ NAN_REQ_ATTR_CLUSTER_LOW,
+ NAN_REQ_ATTR_CLUSTER_HIGH,
+ NAN_REQ_ATTR_HOP_COUNT_LIMIT_VAL,
+ NAN_REQ_ATTR_SID_BEACON_VAL,
+
+ NAN_REQ_ATTR_SUPPORT_2G4_VAL,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ATTR_CAP_MAX_NDI_INTERFACES,
+ NAN_REPLY_ATTR_CAP_MAX_NDP_SESSIONS,
+ NAN_REPLY_ATTR_CAP_MAX_APP_INFO_LEN,
+ NAN_REPLY_ATTR_NDP_INSTANCE_ID,
+ NAN_REPLY_ATTR_CAP_MAX_QUEUED_TRANSMIT_FOLLOWUP_MGS,
+ NAN_REPLY_ATTR_CAP_MAX_NDP_SUPPORTED_BANDS,
+ NAN_REPLY_ATTR_CAP_MAX_CIPHER_SUITES_SUPPORTED,
+ NAN_REPLY_ATTR_CAP_MAX_SCID_LEN,
+ NAN_REPLY_ATTR_CAP_NDP_SECURITY_SUPPORTED,
+ NAN_REPLY_ATTR_CAP_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN,
+ NAN_REPLY_ATTR_CAP_MAX_SUBSCRIBE_ADDRESS,
+ NAN_REPLY_ATTR_CAP_NDPE_ATTR_SUPPORTED
+} NAN_RESP_ATTRIBUTES;
+
+typedef enum {
+ NAN_EVT_ATTR_MATCH_PUBLISH_SUBSCRIBE_ID = 0,
+ NAN_EVT_ATTR_MATCH_REQUESTOR_INSTANCE_ID,
+ NAN_EVT_ATTR_MATCH_ADDR,
+ NAN_EVT_ATTR_MATCH_SERVICE_SPECIFIC_INFO_LEN,
+ NAN_EVT_ATTR_MATCH_SERVICE_SPECIFIC_INFO,
+ NAN_EVT_ATTR_MATCH_SDF_MATCH_FILTER_LEN,
+ NAN_EVT_ATTR_MATCH_SDF_MATCH_FILTER,
+ NAN_EVT_ATTR_MATCH_MATCH_OCCURED_FLAG,
+ NAN_EVT_ATTR_MATCH_OUT_OF_RESOURCE_FLAG,
+ NAN_EVT_ATTR_MATCH_RSSI_VALUE,
+/*CONN_CAPABILITY*/
+ NAN_EVT_ATTR_MATCH_CONN_CAPABILITY_IS_WFD_SUPPORTED = 10,
+ NAN_EVT_ATTR_MATCH_CONN_CAPABILITY_IS_WFDS_SUPPORTED,
+ NAN_EVT_ATTR_MATCH_CONN_CAPABILITY_IS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AN_EVT_ATTR_STATUS_CODE,
+ NAN_EVT_ATTR_CHANNEL_INFO,
+ NAN_EVT_ATTR_APP_INFO_LEN = 70,
+ NAN_EVT_ATTR_APP_INFO,
+ NAN_EVT_ATTR_CHANNEL,
+ NAN_EVT_ATTR_CHANNEL_BW,
+ NAN_EVT_ATTR_CHANNEL_NSS
+} NAN_EVT_ATTRIBUTES;
+
+#endif
\ No newline at end of file
--- /dev/null
+#ifndef NAN_DATA_H
+#define NAN_DATA_H
+
+#include <netlink/netlink.h>
+
+#define SLSI_NAN_MAX_NDP 5
+
+class NanDataCommand {
+
+ int m_ndp_count;
+ u32 m_ndp_instance_id[SLSI_NAN_MAX_NDP];
+ int m_max_ndp_sessions;
+ int m_data_iface_count;
+ char m_ifaceName[SLSI_NAN_MAX_NDP][IFNAMSIZ+1];
+ static const int idx_iface_create = 0;
+ static const int idx_iface_delete = 1;
+ static const int idx_ndp_initiator = 2;
+ static const int idx_ndp_responder = 3;
+ static const int idx_ndp_end = 4;
+ static const int idx_max = 5; /* should be the end of idx_* */
+ u16 transaction_id[idx_max]; /* 5 = no of reqs: */
+
+
+ nlattr *newNlVendorMsg(int subcmd, WifiRequest &request);
+
+ void dataInterfaceCreated(char *ifaceName);
+ void dataInterfaceDeleted(char *ifaceName);
+ void dataRequestInitiateSuccess(NanDataPathInitiatorRequest *msg);
+ void dataIndicationResponseSuccess(NanDataPathIndicationResponse *msg);
+ void dataEndSuccess(NanDataPathEndRequest *msg);
+
+ int dataInterfaceCreateDelete(char *ifaceName, int subcmd, WifiRequest &request);
+ int dataRequestInitiate(NanDataPathInitiatorRequest *msg, WifiRequest &request);
+ int dataIndicationResponse(NanDataPathIndicationResponse *msg, WifiRequest &request);
+ int dataEnd(NanDataPathEndRequest *msg, WifiRequest &request);
+
+ void processNdpChannelInfo(nlattr *nl_data, NanChannelInfo &channel_info);
+ int processNdpReqEvent(WifiEvent &event, NanCallbackHandler &callbackEventHandler);
+ int processNdpCfmEvent(WifiEvent &event, NanCallbackHandler &callbackEventHandler);
+ int processNdpEndEvent(WifiEvent &event, NanCallbackHandler &callbackEventHandler);
+
+public:
+ NanDataCommand();
+ int processResponse(WifiEvent &reply, NanResponseMsg *response);
+ void requestSuccess(u16 id, void *data, int subcmd);
+ int getDataPathNLMsg(void *data, int subcmd, WifiRequest &request);
+ void setMaxNdpSessions(int max_ndp);
+ int handleEvent(WifiEvent &event, NanCallbackHandler &callbackEventHandler);
+ int getResponseTransactionId(NanResponseMsg *res);
+ static int putSecurityInfo(u32 cipher, NanSecurityKeyInfo *key_info, u32 scid_len,
+ u8 *scid, WifiRequest *request);
+};
+#endif
#include "wifi_hal.h"
#include "common.h"
#include "cpp_bindings.h"
+#include "nan_data.h"
+#include "nan_common.h"
#define SLSI_WIFI_HAL_NAN_VERSION 1
-#define CHECK_WIFI_STATUS_RETURN_FAIL(result, LOGSTR) \
- if (result != WIFI_SUCCESS) {\
- ALOGE(LOGSTR" [result:%d]", result);\
- return result;\
- }
-
-#define CHECK_CONFIG_PUT_8_RETURN_FAIL(config, val, nan_attribute, request, result, FAIL_STR) \
- if (config) {\
- result = request.put_u8(nan_attribute, val); \
- if (result != WIFI_SUCCESS) {\
- ALOGE(FAIL_STR" [result:%d]", result);\
- return result;\
- }\
- }
-
-#define CHECK_CONFIG_PUT_16_RETURN_FAIL(config, val, nan_attribute, request, result, FAIL_STR) \
- if (config) {\
- result = request.put_u16(nan_attribute, val); \
- if (result != WIFI_SUCCESS) {\
- ALOGE(FAIL_STR" [result:%d]", result);\
- return result;\
- }\
- }
-
-
-#define CHECK_CONFIG_PUT_32_RETURN_FAIL(config, val, nan_attribute, request, result, FAIL_STR) \
- if (config) {\
- result = request.put_u32(nan_attribute, val); \
- if (result != WIFI_SUCCESS) {\
- ALOGE(FAIL_STR" [result:%d]", result);\
- return result;\
- }\
- }
-
-#define CHECK_CONFIG_PUT_RETURN_FAIL(config, valptr, len, nan_attribute, request, result, FAIL_STR) \
- if (config) {\
- result = request.put(nan_attribute, valptr, len); \
- if (result != WIFI_SUCCESS) {\
- ALOGE(FAIL_STR" [result:%d]", result);\
- return result;\
- }\
- }
-
-typedef enum {
- NAN_REQ_ATTR_MASTER_PREF,
- NAN_REQ_ATTR_CLUSTER_LOW,
- NAN_REQ_ATTR_CLUSTER_HIGH,
- NAN_REQ_ATTR_HOP_COUNT_LIMIT_VAL,
- NAN_REQ_ATTR_SID_BEACON_VAL,
-
- NAN_REQ_ATTR_SUPPORT_2G4_VAL,
- NAN_REQ_ATTR_SUPPORT_5G_VAL,
-
- NAN_REQ_ATTR_RSSI_CLOSE_2G4_VAL,
- NAN_REQ_ATTR_RSSI_MIDDLE_2G4_VAL,
- NAN_REQ_ATTR_RSSI_PROXIMITY_2G4_VAL,
- NAN_REQ_ATTR_BEACONS_2G4_VAL,
- NAN_REQ_ATTR_SDF_2G4_VAL,
- NAN_REQ_ATTR_CHANNEL_2G4_MHZ_VAL,
- NAN_REQ_ATTR_RSSI_PROXIMITY_VAL,
-
-
- NAN_REQ_ATTR_RSSI_CLOSE_5G_VAL,
- NAN_REQ_ATTR_RSSI_CLOSE_PROXIMITY_5G_VAL,
- NAN_REQ_ATTR_RSSI_MIDDLE_5G_VAL,
- NAN_REQ_ATTR_RSSI_PROXIMITY_5G_VAL,
- NAN_REQ_ATTR_BEACON_5G_VAL,
- NAN_REQ_ATTR_SDF_5G_VAL,
- NAN_REQ_ATTR_CHANNEL_5G_MHZ_VAL,
-
- NAN_REQ_ATTR_RSSI_WINDOW_SIZE_VAL,
- NAN_REQ_ATTR_OUI_VAL,
- NAN_REQ_ATTR_MAC_ADDR_VAL,
- NAN_REQ_ATTR_CLUSTER_VAL,
- NAN_REQ_ATTR_SOCIAL_CH_SCAN_DWELL_TIME,
- NAN_REQ_ATTR_SOCIAL_CH_SCAN_PERIOD,
- NAN_REQ_ATTR_RANDOM_FACTOR_FORCE_VAL,
- NAN_REQ_ATTR_HOP_COUNT_FORCE_VAL,
- NAN_REQ_ATTR_CONN_CAPABILITY_PAYLOAD_TX,
- NAN_REQ_ATTR_CONN_CAPABILITY_IBSS,
- NAN_REQ_ATTR_CONN_CAPABILITY_WFD,
- NAN_REQ_ATTR_CONN_CAPABILITY_WFDS,
- NAN_REQ_ATTR_CONN_CAPABILITY_TDLS,
- NAN_REQ_ATTR_CONN_CAPABILITY_MESH,
- NAN_REQ_ATTR_CONN_CAPABILITY_WLAN_INFRA,
- NAN_REQ_ATTR_DISCOVERY_ATTR_NUM_ENTRIES,
- NAN_REQ_ATTR_DISCOVERY_ATTR_VAL,
- NAN_REQ_ATTR_CONN_TYPE,
- NAN_REQ_ATTR_NAN_ROLE,
- NAN_REQ_ATTR_TRANSMIT_FREQ,
- NAN_REQ_ATTR_AVAILABILITY_DURATION,
- NAN_REQ_ATTR_AVAILABILITY_INTERVAL,
- NAN_REQ_ATTR_MESH_ID_LEN,
- NAN_REQ_ATTR_MESH_ID,
- NAN_REQ_ATTR_INFRASTRUCTURE_SSID_LEN,
- NAN_REQ_ATTR_INFRASTRUCTURE_SSID,
- NAN_REQ_ATTR_FURTHER_AVAIL_NUM_ENTRIES,
- NAN_REQ_ATTR_FURTHER_AVAIL_VAL,
- NAN_REQ_ATTR_FURTHER_AVAIL_ENTRY_CTRL,
- NAN_REQ_ATTR_FURTHER_AVAIL_CHAN_CLASS,
- NAN_REQ_ATTR_FURTHER_AVAIL_CHAN,
- NAN_REQ_ATTR_FURTHER_AVAIL_CHAN_MAPID,
- NAN_REQ_ATTR_FURTHER_AVAIL_INTERVAL_BITMAP,
- NAN_REQ_ATTR_PUBLISH_ID,
- NAN_REQ_ATTR_PUBLISH_TTL,
- NAN_REQ_ATTR_PUBLISH_PERIOD,
- NAN_REQ_ATTR_PUBLISH_TYPE,
- NAN_REQ_ATTR_PUBLISH_TX_TYPE,
- NAN_REQ_ATTR_PUBLISH_COUNT,
- NAN_REQ_ATTR_PUBLISH_SERVICE_NAME_LEN,
- NAN_REQ_ATTR_PUBLISH_SERVICE_NAME,
- NAN_REQ_ATTR_PUBLISH_MATCH_ALGO,
- NAN_REQ_ATTR_PUBLISH_SERVICE_INFO_LEN,
- NAN_REQ_ATTR_PUBLISH_SERVICE_INFO,
- NAN_REQ_ATTR_PUBLISH_RX_MATCH_FILTER_LEN,
- NAN_REQ_ATTR_PUBLISH_RX_MATCH_FILTER,
- NAN_REQ_ATTR_PUBLISH_TX_MATCH_FILTER_LEN,
- NAN_REQ_ATTR_PUBLISH_TX_MATCH_FILTER,
- NAN_REQ_ATTR_PUBLISH_RSSI_THRESHOLD_FLAG,
- NAN_REQ_ATTR_PUBLISH_CONN_MAP,
- NAN_REQ_ATTR_PUBLISH_RECV_IND_CFG,
- NAN_REQ_ATTR_SUBSCRIBE_ID,
- NAN_REQ_ATTR_SUBSCRIBE_TTL,
- NAN_REQ_ATTR_SUBSCRIBE_PERIOD,
- NAN_REQ_ATTR_SUBSCRIBE_TYPE,
- NAN_REQ_ATTR_SUBSCRIBE_RESP_FILTER_TYPE,
- NAN_REQ_ATTR_SUBSCRIBE_RESP_INCLUDE,
- NAN_REQ_ATTR_SUBSCRIBE_USE_RESP_FILTER,
- NAN_REQ_ATTR_SUBSCRIBE_SSI_REQUIRED,
- NAN_REQ_ATTR_SUBSCRIBE_MATCH_INDICATOR,
- NAN_REQ_ATTR_SUBSCRIBE_COUNT,
- NAN_REQ_ATTR_SUBSCRIBE_SERVICE_NAME_LEN,
- NAN_REQ_ATTR_SUBSCRIBE_SERVICE_NAME,
- NAN_REQ_ATTR_SUBSCRIBE_SERVICE_INFO_LEN,
- NAN_REQ_ATTR_SUBSCRIBE_SERVICE_INFO,
- NAN_REQ_ATTR_SUBSCRIBE_RX_MATCH_FILTER_LEN,
- NAN_REQ_ATTR_SUBSCRIBE_RX_MATCH_FILTER,
- NAN_REQ_ATTR_SUBSCRIBE_TX_MATCH_FILTER_LEN,
- NAN_REQ_ATTR_SUBSCRIBE_TX_MATCH_FILTER,
- NAN_REQ_ATTR_SUBSCRIBE_RSSI_THRESHOLD_FLAG,
- NAN_REQ_ATTR_SUBSCRIBE_CONN_MAP,
- NAN_REQ_ATTR_SUBSCRIBE_NUM_INTF_ADDR_PRESENT,
- NAN_REQ_ATTR_SUBSCRIBE_INTF_ADDR,
- NAN_REQ_ATTR_SUBSCRIBE_RECV_IND_CFG,
- NAN_REQ_ATTR_FOLLOWUP_ID,
- NAN_REQ_ATTR_FOLLOWUP_REQUESTOR_ID,
- NAN_REQ_ATTR_FOLLOWUP_ADDR,
- NAN_REQ_ATTR_FOLLOWUP_PRIORITY,
- NAN_REQ_ATTR_FOLLOWUP_SERVICE_NAME_LEN,
- NAN_REQ_ATTR_FOLLOWUP_SERVICE_NAME,
- NAN_REQ_ATTR_FOLLOWUP_TX_WINDOW,
- NAN_REQ_ATTR_FOLLOWUP_RECV_IND_CFG,
- NAN_REQ_ATTR_SUBSCRIBE_SID_BEACON_VAL,
- NAN_REQ_ATTR_DW_2G4_INTERVAL,
- NAN_REQ_ATTR_DW_5G_INTERVAL,
- NAN_REQ_ATTR_DISC_MAC_ADDR_RANDOM_INTERVAL,
- NAN_REQ_ATTR_PUBLISH_SDEA_LEN,
- NAN_REQ_ATTR_PUBLISH_SDEA,
-
- NAN_REQ_ATTR_RANGING_AUTO_RESPONSE,
- NAN_REQ_ATTR_SDEA_PARAM_NDP_TYPE,
- NAN_REQ_ATTR_SDEA_PARAM_SECURITY_CFG,
- NAN_REQ_ATTR_SDEA_PARAM_RANGING_STATE,
- NAN_REQ_ATTR_SDEA_PARAM_RANGE_REPORT,
- NAN_REQ_ATTR_SDEA_PARAM_QOS_CFG,
- NAN_REQ_ATTR_RANGING_CFG_INTERVAL,
- NAN_REQ_ATTR_RANGING_CFG_INDICATION,
- NAN_REQ_ATTR_RANGING_CFG_INGRESS_MM,
- NAN_REQ_ATTR_RANGING_CFG_EGRESS_MM,
- NAN_REQ_ATTR_CIPHER_TYPE,
- NAN_REQ_ATTR_SCID_LEN,
- NAN_REQ_ATTR_SCID,
- NAN_REQ_ATTR_SECURITY_KEY_TYPE,
- NAN_REQ_ATTR_SECURITY_PMK_LEN,
- NAN_REQ_ATTR_SECURITY_PMK,
- NAN_REQ_ATTR_SECURITY_PASSPHRASE_LEN,
- NAN_REQ_ATTR_SECURITY_PASSPHRASE,
- NAN_REQ_ATTR_RANGE_RESPONSE_CFG_PUBLISH_ID,
- NAN_REQ_ATTR_RANGE_RESPONSE_CFG_REQUESTOR_ID,
- NAN_REQ_ATTR_RANGE_RESPONSE_CFG_PEER_ADDR,
- NAN_REQ_ATTR_RANGE_RESPONSE_CFG_RANGING_RESPONSE
-} NAN_REQ_ATTRIBUTES;
-
-typedef enum {
- NAN_REPLY_ATTR_STATUS_TYPE,
- NAN_REPLY_ATTR_VALUE,
- NAN_REPLY_ATTR_RESPONSE_TYPE,
- NAN_REPLY_ATTR_PUBLISH_SUBSCRIBE_TYPE,
- NAN_REPLY_ATTR_CAP_MAX_CONCURRENT_CLUSTER,
- NAN_REPLY_ATTR_CAP_MAX_PUBLISHES,
- NAN_REPLY_ATTR_CAP_MAX_SUBSCRIBES,
- NAN_REPLY_ATTR_CAP_MAX_SERVICE_NAME_LEN,
- NAN_REPLY_ATTR_CAP_MAX_MATCH_FILTER_LEN,
- NAN_REPLY_ATTR_CAP_MAX_TOTAL_MATCH_FILTER_LEN,
- NAN_REPLY_ATTR_CAP_MAX_SERVICE_SPECIFIC_INFO_LEN,
- NAN_REPLY_ATTR_CAP_MAX_VSA_DATA_LEN,
- NAN_REPLY_ATTR_CAP_MAX_MESH_DATA_LEN,
- NAN_REPLY_ATTR_CAP_MAX_NDI_INTERFACES,
- NAN_REPLY_ATTR_CAP_MAX_NDP_SESSIONS,
- NAN_REPLY_ATTR_CAP_MAX_APP_INFO_LEN,
-} NAN_RESP_ATTRIBUTES;
-
-typedef enum {
- NAN_EVT_ATTR_MATCH_PUBLISH_SUBSCRIBE_ID = 0,
- NAN_EVT_ATTR_MATCH_REQUESTOR_INSTANCE_ID,
- NAN_EVT_ATTR_MATCH_ADDR,
- NAN_EVT_ATTR_MATCH_SERVICE_SPECIFIC_INFO_LEN,
- NAN_EVT_ATTR_MATCH_SERVICE_SPECIFIC_INFO,
- NAN_EVT_ATTR_MATCH_SDF_MATCH_FILTER_LEN,
- NAN_EVT_ATTR_MATCH_SDF_MATCH_FILTER,
- NAN_EVT_ATTR_MATCH_MATCH_OCCURED_FLAG,
- NAN_EVT_ATTR_MATCH_OUT_OF_RESOURCE_FLAG,
- NAN_EVT_ATTR_MATCH_RSSI_VALUE,
-/*CONN_CAPABILITY*/
- NAN_EVT_ATTR_MATCH_CONN_CAPABILITY_IS_WFD_SUPPORTED = 10,
- NAN_EVT_ATTR_MATCH_CONN_CAPABILITY_IS_WFDS_SUPPORTED,
- NAN_EVT_ATTR_MATCH_CONN_CAPABILITY_IS_TDLS_SUPPORTED,
- NAN_EVT_ATTR_MATCH_CONN_CAPABILITY_IS_IBSS_SUPPORTED,
- NAN_EVT_ATTR_MATCH_CONN_CAPABILITY_IS_MESH_SUPPORTED,
- NAN_EVT_ATTR_MATCH_CONN_CAPABILITY_WLAN_INFRA_FIELD,
- NAN_EVT_ATTR_MATCH_NUM_RX_DISCOVERY_ATTR,
- NAN_EVT_ATTR_MATCH_RX_DISCOVERY_ATTR,
-/*NANRECEIVEPOSTDISCOVERY DISCOVERY_ATTR,*/
- NAN_EVT_ATTR_MATCH_DISC_ATTR_TYPE,
- NAN_EVT_ATTR_MATCH_DISC_ATTR_ROLE,
- NAN_EVT_ATTR_MATCH_DISC_ATTR_DURATION = 20,
- NAN_EVT_ATTR_MATCH_DISC_ATTR_AVAIL_INTERVAL_BITMAP,
- NAN_EVT_ATTR_MATCH_DISC_ATTR_MAPID,
- NAN_EVT_ATTR_MATCH_DISC_ATTR_ADDR,
- NAN_EVT_ATTR_MATCH_DISC_ATTR_MESH_ID_LEN,
- NAN_EVT_ATTR_MATCH_DISC_ATTR_MESH_ID,
- NAN_EVT_ATTR_MATCH_DISC_ATTR_INFRASTRUCTURE_SSID_LEN,
- NAN_EVT_ATTR_MATCH_DISC_ATTR_INFRASTRUCTURE_SSID_VAL,
-
- NAN_EVT_ATTR_MATCH_NUM_CHANS,
- NAN_EVT_ATTR_MATCH_FAMCHAN,
-/*FAMCHAN[32],*/
- NAN_EVT_ATTR_MATCH_FAM_ENTRY_CONTROL = 30,
- NAN_EVT_ATTR_MATCH_FAM_CLASS_VAL,
- NAN_EVT_ATTR_MATCH_FAM_CHANNEL,
- NAN_EVT_ATTR_MATCH_FAM_MAPID,
- NAN_EVT_ATTR_MATCH_FAM_AVAIL_INTERVAL_BITMAP,
- NAN_EVT_ATTR_MATCH_CLUSTER_ATTRIBUTE_LEN,
- NAN_EVT_ATTR_MATCH_CLUSTER_ATTRIBUTE,
- NAN_EVT_ATTR_PUBLISH_ID,
- NAN_EVT_ATTR_PUBLISH_REASON,
- NAN_EVT_ATTR_SUBSCRIBE_ID,
- NAN_EVT_ATTR_SUBSCRIBE_REASON = 40,
- NAN_EVT_ATTR_DISABLED_REASON,
- NAN_EVT_ATTR_FOLLOWUP_PUBLISH_SUBSCRIBE_ID,
- NAN_EVT_ATTR_FOLLOWUP_REQUESTOR_INSTANCE_ID,
- NAN_EVT_ATTR_FOLLOWUP_ADDR,
- NAN_EVT_ATTR_FOLLOWUP_DW_OR_FAW,
- NAN_EVT_ATTR_FOLLOWUP_SERVICE_SPECIFIC_INFO_LEN,
- NAN_EVT_ATTR_FOLLOWUP_SERVICE_SPECIFIC_INFO,
- NAN_EVT_ATTR_DISCOVERY_ENGINE_EVT_TYPE ,
- NAN_EVT_ATTR_DISCOVERY_ENGINE_MAC_ADDR,
- NAN_EVT_ATTR_DISCOVERY_ENGINE_CLUSTER = 50,
- NAN_EVT_ATTR_SDEA,
- NAN_EVT_ATTR_SDEA_LEN,
- NAN_EVT_ATTR_SCID,
- NAN_EVT_ATTR_SCID_LEN,
- NAN_EVT_ATTR_SDEA_PARAM_CONFIG_NAN_DATA_PATH,
- NAN_EVT_ATTR_SDEA_PARAM_NDP_TYPE,
- NAN_EVT_ATTR_SDEA_PARAM_SECURITY_CONFIG,
- NAN_EVT_ATTR_SDEA_PARAM_RANGE_STATE,
- NAN_EVT_ATTR_SDEA_PARAM_RANGE_REPORT,
- NAN_EVT_ATTR_SDEA_PARAM_QOS_CFG = 60,
- NAN_EVT_ATTR_RANGE_MEASUREMENT_MM,
- NAN_EVT_ATTR_RANGEING_EVENT_TYPE,
- NAN_EVT_ATTR_SECURITY_CIPHER_TYPE,
- NAN_EVT_ATTR_STATUS
-} NAN_EVT_ATTRIBUTES;
-
class NanCommand : public WifiCommand {
static NanCallbackHandler callbackEventHandler;
int subscribeID[2];
transaction_id capabilitiesTid;
int version;
NanCapabilities capabilities;
+ NanDataCommand datacmd;
void registerNanEvents(void) {
registerVendorHandler(GOOGLE_OUI, SLSI_NAN_EVENT_PUBLISH_TERMINATED);
registerVendorHandler(GOOGLE_OUI, SLSI_NAN_EVENT_FOLLOWUP);
registerVendorHandler(GOOGLE_OUI, SLSI_NAN_EVENT_DISCOVERY_ENGINE);
registerVendorHandler(GOOGLE_OUI, SLSI_NAN_EVENT_TRANSMIT_FOLLOWUP_STATUS);
+ registerVendorHandler(GOOGLE_OUI, SLSI_NAN_EVENT_NDP_REQ);
+ registerVendorHandler(GOOGLE_OUI, SLSI_NAN_EVENT_NDP_CFM);
+ registerVendorHandler(GOOGLE_OUI, SLSI_NAN_EVENT_NDP_END);
}
void unregisterNanEvents(void) {
unregisterVendorHandler(GOOGLE_OUI, SLSI_NAN_EVENT_FOLLOWUP);
unregisterVendorHandler(GOOGLE_OUI, SLSI_NAN_EVENT_DISCOVERY_ENGINE);
unregisterVendorHandler(GOOGLE_OUI, SLSI_NAN_EVENT_TRANSMIT_FOLLOWUP_STATUS);
+ unregisterVendorHandler(GOOGLE_OUI, SLSI_NAN_EVENT_NDP_REQ);
+ unregisterVendorHandler(GOOGLE_OUI, SLSI_NAN_EVENT_NDP_CFM);
+ unregisterVendorHandler(GOOGLE_OUI, SLSI_NAN_EVENT_NDP_END);
}
int processResponse(WifiEvent &reply, NanResponseMsg *response) {
case NAN_REPLY_ATTR_PUBLISH_SUBSCRIBE_TYPE:
response->body.publish_response.publish_id = nl_itr.get_u16();
break;
+ case NAN_REPLY_ATTR_NDP_INSTANCE_ID:
+ response->body.data_request_response.ndp_instance_id = nl_itr.get_u32();
+ break;
case NAN_REPLY_ATTR_CAP_MAX_CONCURRENT_CLUSTER:
capabilities->max_concurrent_nan_clusters = nl_itr.get_u32();
break;
case NAN_REPLY_ATTR_CAP_MAX_APP_INFO_LEN:
capabilities->max_app_info_len = nl_itr.get_u32();
break;
+
+ case NAN_REPLY_ATTR_CAP_MAX_QUEUED_TRANSMIT_FOLLOWUP_MGS:
+ capabilities->max_queued_transmit_followup_msgs = nl_itr.get_u32();
+ break;
+ case NAN_REPLY_ATTR_CAP_MAX_NDP_SUPPORTED_BANDS:
+ capabilities->ndp_supported_bands = nl_itr.get_u32();
+ break;
+ case NAN_REPLY_ATTR_CAP_MAX_CIPHER_SUITES_SUPPORTED:
+ capabilities->cipher_suites_supported = nl_itr.get_u32();
+ break;
+ case NAN_REPLY_ATTR_CAP_MAX_SCID_LEN:
+ capabilities->max_scid_len = nl_itr.get_u32();
+ break;
+ case NAN_REPLY_ATTR_CAP_NDP_SECURITY_SUPPORTED:
+ capabilities->is_ndp_security_supported = (bool)nl_itr.get_u32();
+ break;
+ case NAN_REPLY_ATTR_CAP_MAX_SDEA_SERVICE_SPECIFIC_INFO_LEN:
+ capabilities->max_sdea_service_specific_info_len = nl_itr.get_u32();
+ break;
+ case NAN_REPLY_ATTR_CAP_MAX_SUBSCRIBE_ADDRESS:
+ capabilities->max_subscribe_address = nl_itr.get_u32();
+ break;
+ case NAN_REPLY_ATTR_CAP_NDPE_ATTR_SUPPORTED:
+ capabilities->ndpe_attr_supported = nl_itr.get_u32();
+ break;
default :
ALOGE("received unknown type(%d) in response", nl_itr.get_type());
return NL_SKIP;
return result;
}
- int putSecurityInfo(u32 cipher, NanSecurityKeyInfo *key_info, u32 scid_len, u8 *scid, WifiRequest *request)
- {
- int result;
-
- result = request->put_u32(NAN_REQ_ATTR_CIPHER_TYPE, cipher);
- CHECK_WIFI_STATUS_RETURN_FAIL(result, "enable:Failed to put cipher_type");
-
- result = request->put_u32(NAN_REQ_ATTR_SECURITY_KEY_TYPE, key_info->key_type);
- CHECK_WIFI_STATUS_RETURN_FAIL(result, "enable:Failed to put cipher_type");
-
- if (key_info->key_type == NAN_SECURITY_KEY_INPUT_PMK) {
- result = request->put_u32(NAN_REQ_ATTR_SECURITY_PMK_LEN, key_info->body.pmk_info.pmk_len);
- CHECK_WIFI_STATUS_RETURN_FAIL(result, "enable:Failed to put key_info->body.pmk_info.pmk_len");
- result = request->put(NAN_REQ_ATTR_SECURITY_PMK, key_info->body.pmk_info.pmk, key_info->body.pmk_info.pmk_len);
- CHECK_WIFI_STATUS_RETURN_FAIL(result, "enable:Failed to put key_info->body.pmk_info.pmk");
- } else {
- result = request->put_u32(NAN_REQ_ATTR_SECURITY_PASSPHRASE_LEN, key_info->body.passphrase_info.passphrase_len);
- CHECK_WIFI_STATUS_RETURN_FAIL(result, "enable:Failed to put key_info->body.passphrase_info.passphrase_len");
- result = request->put(NAN_REQ_ATTR_SECURITY_PASSPHRASE, key_info->body.passphrase_info.passphrase,
- key_info->body.passphrase_info.passphrase_len);
- CHECK_WIFI_STATUS_RETURN_FAIL(result, "enable:Failed to put key_info->body.passphrase_info.passphrase");
- }
-
- result = request->put_u32(NAN_REQ_ATTR_SCID_LEN, scid_len);
- CHECK_WIFI_STATUS_RETURN_FAIL(result, "enable:Failed to put scid_len");
- if (scid_len) {
- result = request->put(NAN_REQ_ATTR_SCID, scid, scid_len);
- CHECK_WIFI_STATUS_RETURN_FAIL(result, "enable:Failed to put scid");
- }
- return result;
- }
-
public:
NanCommand(wifi_interface_handle iface, int id)
- : WifiCommand(iface, id)
+ : WifiCommand(iface, id), datacmd()
{
subscribeID[0] = 0;
subscribeID[1] = 0;
CHECK_CONFIG_PUT_8_RETURN_FAIL(msg->config_dw.config_5g_dw_band, msg->config_dw.dw_5g_interval_val,
NAN_REQ_ATTR_DW_5G_INTERVAL, request, result, "enable:Failed to put dw_5g_interval_val");
- CHECK_CONFIG_PUT_8_RETURN_FAIL(msg->config_disc_mac_addr_randomization, msg->disc_mac_addr_rand_interval_sec,
+ CHECK_CONFIG_PUT_32_RETURN_FAIL(msg->config_disc_mac_addr_randomization, msg->disc_mac_addr_rand_interval_sec,
NAN_REQ_ATTR_DISC_MAC_ADDR_RANDOM_INTERVAL, request, result, "enable:Failed to put disc_mac_addr_rand_interval_sec");
+ CHECK_CONFIG_PUT_32_RETURN_FAIL(msg->config_ndpe_attr, msg->use_ndpe_attr,
+ NAN_REQ_ATTR_USE_NDPE_ATTR, request, result, "enable:Failed to put use_ndpe_attr");
+
request.attr_end(data);
registerNanEvents();
CHECK_CONFIG_PUT_8_RETURN_FAIL(msg->config_disc_mac_addr_randomization, msg->disc_mac_addr_rand_interval_sec,
NAN_REQ_ATTR_DISC_MAC_ADDR_RANDOM_INTERVAL, request, result, "config:Failed to put disc_mac_addr_rand_interval_sec");
+ CHECK_CONFIG_PUT_32_RETURN_FAIL(msg->config_ndpe_attr, msg->use_ndpe_attr,
+ NAN_REQ_ATTR_USE_NDPE_ATTR, request, result, "enable:Failed to put use_ndpe_attr");
+
request.attr_end(data);
configTid = id;
result = requestResponse(request);
result = putRangingCfg(&msg->ranging_cfg, &request);
if (result != 0)
return result;
- result = putSecurityInfo(msg->cipher_type, &msg->key_info, msg->scid_len, msg->scid, &request);
+ result = NanDataCommand::putSecurityInfo(msg->cipher_type, &msg->key_info, msg->scid_len, msg->scid, &request);
if (result != 0)
return result;
result = putRangeResponseCfg(&msg->range_response_cfg, &request);
result = putRangingCfg(&msg->ranging_cfg, &request);
if (result != 0)
return result;
- result = putSecurityInfo(msg->cipher_type, &msg->key_info, msg->scid_len, msg->scid, &request);
+ result = NanDataCommand::putSecurityInfo(msg->cipher_type, &msg->key_info, msg->scid_len, msg->scid, &request);
if (result != 0)
return result;
result = putRangeResponseCfg(&msg->range_response_cfg, &request);
case SLSI_NAN_EVENT_TRANSMIT_FOLLOWUP_STATUS:
ret = processNanFollowupStatus(event);
break;
+ default:
+ return datacmd.handleEvent(event, callbackEventHandler);
}
return NL_OK;
/* followupTid is required on receiving followup_up transmit status.
* Do not reset followupTid here*/
break;
+ default:
+ id = datacmd.getResponseTransactionId(&response);
}
ALOGD("NAN %s transId:%d status:%d, response:%d", __func__, id, response.status, response.response_type);
if (callbackEventHandler.NotifyResponse)
callbackEventHandler.NotifyResponse(id, &response);
return NL_OK;
}
+
+ int dataPathReq(u16 id, void *data, int subcmd) {
+ int result;
+ WifiRequest request(familyId(), ifaceId());
+
+ ALOGI("NAN DATA-PATH req subcmd:%d", subcmd);
+
+ result = datacmd.getDataPathNLMsg(data, subcmd, request);
+ if (result != WIFI_SUCCESS) {
+ return result;
+ }
+ result = requestResponse(request);
+ if (result != WIFI_SUCCESS) {
+ ALOGE("failed NDP req; result = %d", result);
+ unregisterNanEvents();
+ } else {
+ datacmd.requestSuccess(id, data, subcmd);
+ ALOGD("NAN DATA-PATH req(subcmd:%d)...success", subcmd);
+ }
+ return result;
+ }
};
NanCallbackHandler NanCommand::callbackEventHandler;
return (wifi_error)nanRequest->getCapabilities(id);
}
+wifi_error nan_data_interface_create(transaction_id id,
+ wifi_interface_handle iface,
+ char* iface_name) {
+ NanCommand *nanRequest = nan_get_object(id, iface);
+ if (!nanRequest) {
+ return WIFI_ERROR_OUT_OF_MEMORY;
+ }
+ return (wifi_error)nanRequest->dataPathReq(id, iface,
+ SLSI_NL80211_VENDOR_SUBCMD_NAN_DATA_INTERFACE_CREATE);
+}
+
+wifi_error nan_data_interface_delete(transaction_id id,
+ wifi_interface_handle iface,
+ char* iface_name) {
+ NanCommand *nanRequest = nan_get_object(id, iface);
+ if (!nanRequest) {
+ return WIFI_ERROR_OUT_OF_MEMORY;
+ }
+ return (wifi_error)nanRequest->dataPathReq(id, iface,
+ SLSI_NL80211_VENDOR_SUBCMD_NAN_DATA_INTERFACE_DELETE);
+
+}
+
+wifi_error nan_data_request_initiator(transaction_id id,
+ wifi_interface_handle iface,
+ NanDataPathInitiatorRequest* msg) {
+ NanCommand *nanRequest = nan_get_object(id, iface);
+ if (!nanRequest) {
+ return WIFI_ERROR_OUT_OF_MEMORY;
+ }
+ return (wifi_error)nanRequest->dataPathReq(id, iface,
+ SLSI_NL80211_VENDOR_SUBCMD_NAN_DATA_REQUEST_INITIATOR);
+
+}
+
+wifi_error nan_data_indication_response(transaction_id id,
+ wifi_interface_handle iface,
+ NanDataPathIndicationResponse* msg) {
+ NanCommand *nanRequest = nan_get_object(id, iface);
+ if (!nanRequest) {
+ return WIFI_ERROR_OUT_OF_MEMORY;
+ }
+ return (wifi_error)nanRequest->dataPathReq(id, iface,
+ SLSI_NL80211_VENDOR_SUBCMD_NAN_DATA_INDICATION_RESPONSE);
+
+}
+
+wifi_error nan_data_end(transaction_id id,
+ wifi_interface_handle iface,
+ NanDataPathEndRequest* msg) {
+ NanCommand *nanRequest = nan_get_object(id, iface);
+ if (!nanRequest) {
+ return WIFI_ERROR_OUT_OF_MEMORY;
+ }
+ return (wifi_error)nanRequest->dataPathReq(id, iface,
+ SLSI_NL80211_VENDOR_SUBCMD_NAN_DATA_END);
+
+}
+
--- /dev/null
+
+#include <stdint.h>
+#include <stddef.h>
+#include <fcntl.h>
+#include <sys/socket.h>
+#include <netlink/genl/genl.h>
+#include <netlink/genl/family.h>
+#include <netlink/genl/ctrl.h>
+#include <linux/rtnetlink.h>
+#include <netpacket/packet.h>
+#include <linux/filter.h>
+#include <linux/errqueue.h>
+#include <linux/pkt_sched.h>
+#include <netlink/object-api.h>
+#include <netlink/netlink.h>
+#include <netlink/socket.h>
+#include <netlink/handlers.h>
+
+#include "sync.h"
+
+#include <utils/Log.h>
+
+#include "wifi_hal.h"
+#include "common.h"
+#include "cpp_bindings.h"
+#include "nan_data.h"
+#include "nan_common.h"
+
+nlattr *NanDataCommand::newNlVendorMsg(int subcmd, WifiRequest &request) {
+ int result = request.create(GOOGLE_OUI, subcmd);
+ if (result != WIFI_SUCCESS) {
+ ALOGE("newNlVendorMsg:Failed to create WifiRequest (%d)", result);
+ return NULL;
+ }
+
+ nlattr *data = request.attr_start(NL80211_ATTR_VENDOR_DATA);
+ if (!data) {
+ ALOGE("newNlVendorMsg: request.attr_start fail");
+ return NULL;
+ }
+ return data;
+}
+
+int NanDataCommand::dataInterfaceCreateDelete(char *ifaceName, int subcmd, WifiRequest &request) {
+ int result;
+ nlattr *data = newNlVendorMsg(subcmd, request);
+ if (!data)
+ return WIFI_ERROR_OUT_OF_MEMORY;
+
+ result = request.put_u8(NAN_REQ_ATTR_DATA_INTERFACE_NAME_LEN, strlen(ifaceName));
+ CHECK_WIFI_STATUS_RETURN_FAIL(result, "Failed to put ifaceName_len");
+ result = request.put(NAN_REQ_ATTR_DATA_INTERFACE_NAME, ifaceName, strlen(ifaceName));
+ CHECK_WIFI_STATUS_RETURN_FAIL(result, "Failed to put ifaceName");
+ request.attr_end(data);
+ return WIFI_SUCCESS;
+}
+
+int NanDataCommand::dataRequestInitiate(NanDataPathInitiatorRequest* msg, WifiRequest &request) {
+ int result;
+ nlattr *data = newNlVendorMsg(SLSI_NL80211_VENDOR_SUBCMD_NAN_DATA_REQUEST_INITIATOR, request);
+ if (!data)
+ return WIFI_ERROR_OUT_OF_MEMORY;
+ result = request.put_u32(NAN_REQ_ATTR_REQ_INSTANCE_ID, msg->requestor_instance_id);
+ CHECK_WIFI_STATUS_RETURN_FAIL(result, "Failed to put req_instance_id");
+ result = request.put_u8(NAN_REQ_ATTR_CHAN_REQ_TYPE, msg->channel_request_type);
+ CHECK_WIFI_STATUS_RETURN_FAIL(result, "Failed to put channel_request_type");
+ result = request.put_u32(NAN_REQ_ATTR_CHAN, msg->channel);
+ CHECK_WIFI_STATUS_RETURN_FAIL(result, "Failed to put channel");
+ result = request.put(NAN_REQ_ATTR_MAC_ADDR_VAL, msg->peer_disc_mac_addr, NAN_MAC_ADDR_LEN);
+ CHECK_WIFI_STATUS_RETURN_FAIL(result, "Failed to put peer_disc_mac_addr");
+ result = request.put_u8(NAN_REQ_ATTR_DATA_INTERFACE_NAME_LEN, IFNAMSIZ+1);
+ CHECK_WIFI_STATUS_RETURN_FAIL(result, "Failed to put ifaceName_len");
+ result = request.put(NAN_REQ_ATTR_DATA_INTERFACE_NAME, msg->ndp_iface, IFNAMSIZ+1);
+ CHECK_WIFI_STATUS_RETURN_FAIL(result, "Failed to put ndp_iface");
+ result = request.put_u8(NAN_REQ_ATTR_SDEA_PARAM_SECURITY_CFG, msg->ndp_cfg.security_cfg);
+ CHECK_WIFI_STATUS_RETURN_FAIL(result, "Failed to put security_cfg");
+ result = request.put_u8(NAN_REQ_ATTR_SDEA_PARAM_QOS_CFG, msg->ndp_cfg.qos_cfg);
+ CHECK_WIFI_STATUS_RETURN_FAIL(result, "Failed to put qos_cfg");
+ if(msg->app_info.ndp_app_info_len){
+ result = request.put_u16(NAN_REQ_ATTR_APP_INFO_LEN, msg->app_info.ndp_app_info_len);
+ CHECK_WIFI_STATUS_RETURN_FAIL(result, "Failed to put ndp_app_info_len");
+ result = request.put(NAN_REQ_ATTR_APP_INFO, msg->app_info.ndp_app_info, msg->app_info.ndp_app_info_len);
+ CHECK_WIFI_STATUS_RETURN_FAIL(result, "Failed to put ndp_app_info");
+ }
+ if (msg->service_name_len) {
+ result = request.put_u32(NAN_REQ_ATTR_SERVICE_NAME_LEN, msg->service_name_len);
+ CHECK_WIFI_STATUS_RETURN_FAIL(result, "Failed to put service_name_len");
+ result = request.put(NAN_REQ_ATTR_SERVICE_NAME, msg->service_name, msg->service_name_len);
+ CHECK_WIFI_STATUS_RETURN_FAIL(result, "Failed to put req_instance_id");
+ }
+ result = putSecurityInfo(msg->cipher_type, &msg->key_info, 0, NULL, &request);
+ request.attr_end(data);
+ return result;
+}
+
+int NanDataCommand::dataIndicationResponse(NanDataPathIndicationResponse* msg, WifiRequest &request) {
+ int result;
+ nlattr *data = newNlVendorMsg(SLSI_NL80211_VENDOR_SUBCMD_NAN_DATA_INDICATION_RESPONSE, request);
+ if (!data)
+ return WIFI_ERROR_OUT_OF_MEMORY;
+ result = request.put_u32(NAN_REQ_ATTR_NDP_INSTANCE_ID, msg->ndp_instance_id);
+ CHECK_WIFI_STATUS_RETURN_FAIL(result, "Failed to put ndp_instance_id");
+ result = request.put_u8(NAN_REQ_ATTR_DATA_INTERFACE_NAME_LEN, IFNAMSIZ+1);
+ CHECK_WIFI_STATUS_RETURN_FAIL(result, "Failed to put ifaceName_len");
+ result = request.put(NAN_REQ_ATTR_DATA_INTERFACE_NAME, msg->ndp_iface, IFNAMSIZ+1);
+ CHECK_WIFI_STATUS_RETURN_FAIL(result, "Failed to put ndp_iface");
+ result = request.put_u8(NAN_REQ_ATTR_SDEA_PARAM_SECURITY_CFG, msg->ndp_cfg.security_cfg);
+ CHECK_WIFI_STATUS_RETURN_FAIL(result, "Failed to put security_cfg");
+ result = request.put_u8(NAN_REQ_ATTR_SDEA_PARAM_QOS_CFG, msg->ndp_cfg.qos_cfg);
+ CHECK_WIFI_STATUS_RETURN_FAIL(result, "Failed to put qos_cfg");
+ if(msg->app_info.ndp_app_info_len){
+ result = request.put_u16(NAN_REQ_ATTR_APP_INFO_LEN, msg->app_info.ndp_app_info_len);
+ CHECK_WIFI_STATUS_RETURN_FAIL(result, "Failed to put ndp_app_info_len");
+ result = request.put(NAN_REQ_ATTR_APP_INFO, msg->app_info.ndp_app_info, msg->app_info.ndp_app_info_len);
+ CHECK_WIFI_STATUS_RETURN_FAIL(result, "Failed to put ndp_app_info");
+ }
+ result = request.put_u8(NAN_REQ_ATTR_NDP_RESPONSE_CODE, msg->rsp_code);
+ CHECK_WIFI_STATUS_RETURN_FAIL(result, "Failed to put rsp_code");
+ if (msg->service_name_len) {
+ result = request.put_u32(NAN_REQ_ATTR_SERVICE_NAME_LEN, msg->service_name_len);
+ CHECK_WIFI_STATUS_RETURN_FAIL(result, "Failed to put service_name_len");
+ result = request.put(NAN_REQ_ATTR_SERVICE_NAME, msg->service_name, msg->service_name_len);
+ CHECK_WIFI_STATUS_RETURN_FAIL(result, "Failed to put req_instance_id");
+ }
+ result = putSecurityInfo(msg->cipher_type, &msg->key_info, 0, NULL, &request);
+ request.attr_end(data);
+ return result;
+}
+
+int NanDataCommand::dataEnd(NanDataPathEndRequest* msg, WifiRequest &request) {
+ int result, i;
+ nlattr *data = newNlVendorMsg(SLSI_NL80211_VENDOR_SUBCMD_NAN_DATA_END, request);
+ if (!data)
+ return WIFI_ERROR_UNKNOWN;
+
+ for(i=0; i<SLSI_NAN_MAX_NDP; i++) {
+ result = request.put_u32(NAN_REQ_ATTR_NDP_INSTANCE_ID, msg->ndp_instance_id[i]);
+ CHECK_WIFI_STATUS_RETURN_FAIL(result, "Failed to put ndp_instance_id");
+ }
+ request.attr_end(data);
+ return result;
+}
+
+void NanDataCommand::dataInterfaceCreated(char *ifaceName) {
+ int i;
+ for(i=0; i<SLSI_NAN_MAX_NDP; i++)
+ if (m_ifaceName[i][0] == 0) {
+ strncpy(ifaceName, m_ifaceName[i], IFNAMSIZ);
+ m_data_iface_count++;
+ return;
+ }
+}
+
+void NanDataCommand::dataInterfaceDeleted(char *ifaceName) {
+ int i;
+ for(i=0; i<SLSI_NAN_MAX_NDP; i++)
+ if (strncmp(m_ifaceName[i], ifaceName, IFNAMSIZ)== 0) {
+ memset(m_ifaceName[i], 0, IFNAMSIZ);
+ m_data_iface_count--;
+ return;
+ }
+}
+
+void NanDataCommand::dataRequestInitiateSuccess(NanDataPathInitiatorRequest *msg) {
+ int i;
+ for(i=0; i<SLSI_NAN_MAX_NDP; i++)
+ if(m_ndp_instance_id[i] == 0) {
+ m_ndp_instance_id[i] = msg->requestor_instance_id;
+ m_ndp_count++;
+ return;
+ }
+}
+
+void NanDataCommand::dataIndicationResponseSuccess(NanDataPathIndicationResponse *msg) {
+ int i;
+ for(i=0; i<SLSI_NAN_MAX_NDP; i++)
+ if(m_ndp_instance_id[i] == 0) {
+ m_ndp_instance_id[i] = msg->ndp_instance_id;
+ m_ndp_count++;
+ return;
+ }
+}
+
+void NanDataCommand::dataEndSuccess(NanDataPathEndRequest *msg) {
+ int i, j;
+ for(i=0; i<msg->num_ndp_instances; i++)
+ for(j=0; j<SLSI_NAN_MAX_NDP; j++)
+ if(m_ndp_instance_id[j] == msg->ndp_instance_id[i]) {
+ m_ndp_instance_id[j] = 0;
+ m_ndp_count--;
+ }
+}
+
+void NanDataCommand::processNdpChannelInfo(nlattr *nl_data, NanChannelInfo &channel_info) {
+ for(nl_iterator nl_itr(nl_data); nl_itr.has_next(); nl_itr.next()) {
+ switch(nl_itr.get_type()) {
+ case NAN_EVT_ATTR_CHANNEL:
+ channel_info.channel = nl_itr.get_u32();
+ break;
+ case NAN_EVT_ATTR_CHANNEL_BW:
+ channel_info.bandwidth = nl_itr.get_u32();
+ break;
+ case NAN_EVT_ATTR_CHANNEL_NSS:
+ channel_info.nss = nl_itr.get_u32();
+ break;
+ }
+ }
+}
+int NanDataCommand::processNdpReqEvent(WifiEvent &event, NanCallbackHandler &callbackEventHandler) {
+ NanDataPathRequestInd ind;
+ memset(&ind,0,sizeof(NanDataPathRequestInd));
+ nlattr *vendor_data = event.get_attribute(NL80211_ATTR_VENDOR_DATA);
+
+ for(nl_iterator nl_itr(vendor_data); nl_itr.has_next(); nl_itr.next()) {
+ switch(nl_itr.get_type()) {
+ case NAN_EVT_ATTR_SERVICE_INSTANCE_ID:
+ ind.service_instance_id = nl_itr.get_u16();
+ break;
+ case NAN_EVT_ATTR_MATCH_ADDR:
+ memcpy(ind.peer_disc_mac_addr, nl_itr.get_data(), ETHER_ADDR_LEN);
+ break;
+ case NAN_EVT_ATTR_NDP_INSTANCE_ID:
+ ind.ndp_instance_id = nl_itr.get_u32();
+ break;
+ case NAN_EVT_ATTR_SDEA_PARAM_SECURITY_CONFIG:
+ ind.ndp_cfg.security_cfg = (NanDataPathSecurityCfgStatus)nl_itr.get_u32();
+ break;
+ case NAN_EVT_ATTR_SDEA_PARAM_QOS_CFG:
+ ind.ndp_cfg.qos_cfg = (NanDataPathQosCfg)nl_itr.get_u32();
+ break;
+ case NAN_EVT_ATTR_APP_INFO_LEN:
+ ind.app_info.ndp_app_info_len = nl_itr.get_u16();
+ break;
+ case NAN_EVT_ATTR_APP_INFO:
+ memcpy(ind.app_info.ndp_app_info, nl_itr.get_data(), ind.app_info.ndp_app_info_len);
+ break;
+ }
+ }
+
+ if(callbackEventHandler.EventDataRequest)
+ callbackEventHandler.EventDataRequest(&ind);
+ return NL_OK;
+}
+
+int NanDataCommand::processNdpCfmEvent(WifiEvent &event, NanCallbackHandler &callbackEventHandler) {
+ NanDataPathConfirmInd ind;
+ memset(&ind,0,sizeof(NanDataPathConfirmInd));
+ nlattr *vendor_data = event.get_attribute(NL80211_ATTR_VENDOR_DATA);
+
+ for(nl_iterator nl_itr(vendor_data); nl_itr.has_next(); nl_itr.next()) {
+ switch(nl_itr.get_type()) {
+ case NAN_EVT_ATTR_NDP_INSTANCE_ID:
+ ind.ndp_instance_id = nl_itr.get_u32();
+ break;
+ case NAN_EVT_ATTR_MATCH_ADDR:
+ memcpy(ind.peer_ndi_mac_addr, nl_itr.get_data(), ETHER_ADDR_LEN);
+ break;
+ case NAN_EVT_ATTR_APP_INFO_LEN:
+ ind.app_info.ndp_app_info_len = nl_itr.get_u16();
+ break;
+ case NAN_EVT_ATTR_APP_INFO:
+ memcpy(ind.app_info.ndp_app_info, nl_itr.get_data(), ind.app_info.ndp_app_info_len);
+ break;
+ case NAN_EVT_ATTR_NDP_RSP_CODE:
+ ind.rsp_code = (NanDataPathResponseCode)nl_itr.get_u32();
+ break;
+ case NAN_EVT_ATTR_STATUS_CODE:
+ ind.reason_code = (NanStatusType)nl_itr.get_u32();
+ break;
+ case NAN_EVT_ATTR_CHANNEL_INFO:
+ if (ind.num_channels < NAN_MAX_CHANNEL_INFO_SUPPORTED)
+ processNdpChannelInfo(nl_itr.get(), ind.channel_info[ind.num_channels++]);
+ break;
+ }
+ }
+ if(callbackEventHandler.EventDataConfirm)
+ callbackEventHandler.EventDataConfirm(&ind);
+ return NL_OK;
+}
+
+int NanDataCommand::processNdpEndEvent(WifiEvent &event, NanCallbackHandler &callbackEventHandler) {
+ NanDataPathEndInd ind;
+ memset(&ind,0,sizeof(NanDataPathEndInd));
+ nlattr *vendor_data = event.get_attribute(NL80211_ATTR_VENDOR_DATA);
+
+ for(nl_iterator nl_itr(vendor_data); nl_itr.has_next(); nl_itr.next()) {
+ if (nl_itr.get_type() == NAN_EVT_ATTR_NDP_INSTANCE_ID) {
+ ind.ndp_instance_id[ind.num_ndp_instances++] = nl_itr.get_u32();
+ }
+ }
+ if(callbackEventHandler.EventDataEnd)
+ callbackEventHandler.EventDataEnd(&ind);
+ return NL_OK;
+}
+
+NanDataCommand::NanDataCommand() {
+ memset(m_ndp_instance_id, 0, sizeof(m_ndp_instance_id));
+ memset(m_ifaceName, 0, sizeof(m_ifaceName));
+ m_ndp_count = 0;
+ m_data_iface_count = 0;
+}
+
+int NanDataCommand::getDataPathNLMsg(void *data, int subcmd, WifiRequest &request) {
+ switch (subcmd) {
+ case SLSI_NL80211_VENDOR_SUBCMD_NAN_DATA_INTERFACE_CREATE:
+ case SLSI_NL80211_VENDOR_SUBCMD_NAN_DATA_INTERFACE_DELETE:
+ return dataInterfaceCreateDelete((char *)data, subcmd, request);
+ case SLSI_NL80211_VENDOR_SUBCMD_NAN_DATA_REQUEST_INITIATOR:
+ return dataRequestInitiate((NanDataPathInitiatorRequest *)data, request);
+ case SLSI_NL80211_VENDOR_SUBCMD_NAN_DATA_INDICATION_RESPONSE:
+ return dataIndicationResponse((NanDataPathIndicationResponse *)data, request);
+ case SLSI_NL80211_VENDOR_SUBCMD_NAN_DATA_END:
+ return dataEnd((NanDataPathEndRequest *)data, request);
+ default:
+ ALOGE("unknown subcmd :%d", subcmd);
+ }
+ return WIFI_ERROR_UNKNOWN;
+}
+
+void NanDataCommand::requestSuccess(u16 id, void *data, int subcmd) {
+ switch (subcmd) {
+ case SLSI_NL80211_VENDOR_SUBCMD_NAN_DATA_INTERFACE_CREATE:
+ transaction_id[idx_iface_create] = id;
+ dataInterfaceCreated((char *)data);
+ break;
+ case SLSI_NL80211_VENDOR_SUBCMD_NAN_DATA_INTERFACE_DELETE:
+ transaction_id[idx_iface_delete] = id;
+ dataInterfaceDeleted((char *)data);
+ break;
+ case SLSI_NL80211_VENDOR_SUBCMD_NAN_DATA_REQUEST_INITIATOR:
+ transaction_id[idx_ndp_initiator] = id;
+ dataRequestInitiateSuccess((NanDataPathInitiatorRequest *)data);
+ break;
+ case SLSI_NL80211_VENDOR_SUBCMD_NAN_DATA_INDICATION_RESPONSE:
+ transaction_id[idx_ndp_responder] = id;
+ dataIndicationResponseSuccess((NanDataPathIndicationResponse *)data);
+ break;
+ case SLSI_NL80211_VENDOR_SUBCMD_NAN_DATA_END:
+ transaction_id[idx_ndp_end] = id;
+ dataEndSuccess((NanDataPathEndRequest *)data);
+ break;
+ }
+}
+
+int NanDataCommand::handleEvent(WifiEvent &event, NanCallbackHandler &callbackEventHandler) {
+ int subcmd = event.get_vendor_subcmd();
+ switch (subcmd) {
+ case SLSI_NAN_EVENT_NDP_REQ:
+ return processNdpReqEvent(event, callbackEventHandler);
+ case SLSI_NAN_EVENT_NDP_CFM:
+ return processNdpCfmEvent(event, callbackEventHandler);
+ case SLSI_NAN_EVENT_NDP_END:
+ return processNdpEndEvent(event, callbackEventHandler);
+ default:
+ return NL_OK;
+ }
+}
+
+int NanDataCommand::getResponseTransactionId(NanResponseMsg *res) {
+ u16 id;
+ switch(res->response_type) {
+ case NAN_DP_INTERFACE_CREATE:
+ id = transaction_id[idx_iface_create];
+ transaction_id[idx_iface_create] = 0;
+ break;
+ case NAN_DP_INTERFACE_DELETE:
+ id = transaction_id[idx_iface_delete];
+ transaction_id[idx_iface_delete] = 0;
+ break;
+ case NAN_DP_INITIATOR_RESPONSE:
+ id = transaction_id[idx_ndp_initiator];
+ transaction_id[idx_ndp_initiator] = 0;
+ break;
+ case NAN_DP_RESPONDER_RESPONSE:
+ id = transaction_id[idx_ndp_responder];
+ transaction_id[idx_ndp_responder] = 0;
+ break;
+ case NAN_DP_END:
+ id = transaction_id[idx_ndp_end];
+ transaction_id[idx_ndp_end] = 0;
+ break;
+ default:
+ id = 0;
+ }
+ return id;
+}
+
+void NanDataCommand::setMaxNdpSessions(int max_ndp) {
+ m_max_ndp_sessions = max_ndp > SLSI_NAN_MAX_NDP ? SLSI_NAN_MAX_NDP : max_ndp;
+}
+
+int NanDataCommand::putSecurityInfo(u32 cipher, NanSecurityKeyInfo *key_info, u32 scid_len, u8 *scid, WifiRequest *request)
+{
+ int result;
+
+ result = request->put_u32(NAN_REQ_ATTR_CIPHER_TYPE, cipher);
+ CHECK_WIFI_STATUS_RETURN_FAIL(result, "enable:Failed to put cipher_type");
+
+ result = request->put_u32(NAN_REQ_ATTR_SECURITY_KEY_TYPE, key_info->key_type);
+ CHECK_WIFI_STATUS_RETURN_FAIL(result, "enable:Failed to put cipher_type");
+
+ if (key_info->key_type == NAN_SECURITY_KEY_INPUT_PMK) {
+ result = request->put_u32(NAN_REQ_ATTR_SECURITY_PMK_LEN, key_info->body.pmk_info.pmk_len);
+ CHECK_WIFI_STATUS_RETURN_FAIL(result, "enable:Failed to put key_info->body.pmk_info.pmk_len");
+ result = request->put(NAN_REQ_ATTR_SECURITY_PMK, key_info->body.pmk_info.pmk, key_info->body.pmk_info.pmk_len);
+ CHECK_WIFI_STATUS_RETURN_FAIL(result, "enable:Failed to put key_info->body.pmk_info.pmk");
+ } else {
+ result = request->put_u32(NAN_REQ_ATTR_SECURITY_PASSPHRASE_LEN, key_info->body.passphrase_info.passphrase_len);
+ CHECK_WIFI_STATUS_RETURN_FAIL(result, "enable:Failed to put key_info->body.passphrase_info.passphrase_len");
+ result = request->put(NAN_REQ_ATTR_SECURITY_PASSPHRASE, key_info->body.passphrase_info.passphrase,
+ key_info->body.passphrase_info.passphrase_len);
+ CHECK_WIFI_STATUS_RETURN_FAIL(result, "enable:Failed to put key_info->body.passphrase_info.passphrase");
+ }
+
+ result = request->put_u32(NAN_REQ_ATTR_SCID_LEN, scid_len);
+ CHECK_WIFI_STATUS_RETURN_FAIL(result, "enable:Failed to put scid_len");
+ if (scid_len) {
+ result = request->put(NAN_REQ_ATTR_SCID, scid, scid_len);
+ CHECK_WIFI_STATUS_RETURN_FAIL(result, "enable:Failed to put scid");
+ }
+ return result;
+}
\ No newline at end of file