diff --git a/Android.mk b/Android.mk
index 8051d5c..d02568e 100755
--- a/Android.mk
+++ b/Android.mk
@@ -30,7 +30,8 @@
 	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
diff --git a/common.h b/common.h
index 2ebf763..eb61e82 100755
--- a/common.h
+++ b/common.h
@@ -167,6 +167,11 @@
     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,
@@ -194,7 +199,8 @@
     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,
@@ -207,7 +213,11 @@
     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;
 
diff --git a/nan_common.h b/nan_common.h
new file mode 100755
index 0000000..44d7f77
--- /dev/null
+++ b/nan_common.h
@@ -0,0 +1,310 @@
+#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,
+    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_ATTR_REQ_INSTANCE_ID,
+    NAN_REQ_ATTR_NDP_INSTANCE_ID,
+    NAN_REQ_ATTR_CHAN_REQ_TYPE,
+    NAN_REQ_ATTR_CHAN,
+    NAN_REQ_ATTR_DATA_INTERFACE_NAME_LEN,
+    NAN_REQ_ATTR_DATA_INTERFACE_NAME,
+    NAN_REQ_ATTR_APP_INFO_LEN,
+    NAN_REQ_ATTR_APP_INFO,
+    NAN_REQ_ATTR_SERVICE_NAME_LEN,
+    NAN_REQ_ATTR_SERVICE_NAME,
+    NAN_REQ_ATTR_NDP_RESPONSE_CODE,
+    NAN_REQ_ATTR_USE_NDPE_ATTR
+} 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_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_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_ATTR_SERVICE_INSTANCE_ID,
+    NAN_EVT_ATTR_NDP_INSTANCE_ID,
+    NAN_EVT_ATTR_NDP_RSP_CODE,
+    NAN_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
diff --git a/nan_data.h b/nan_data.h
new file mode 100755
index 0000000..28d0871
--- /dev/null
+++ b/nan_data.h
@@ -0,0 +1,53 @@
+#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
diff --git a/wifi_nan.cpp b/wifi_nan.cpp
index bec2ddd..3c740ae 100755
--- a/wifi_nan.cpp
+++ b/wifi_nan.cpp
@@ -23,283 +23,11 @@
 #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];
@@ -316,6 +44,7 @@
     transaction_id capabilitiesTid;
     int version;
     NanCapabilities capabilities;
+    NanDataCommand  datacmd;
 
     void registerNanEvents(void) {
         registerVendorHandler(GOOGLE_OUI, SLSI_NAN_EVENT_PUBLISH_TERMINATED);
@@ -325,6 +54,9 @@
         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) {
@@ -335,6 +67,9 @@
         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) {
@@ -359,6 +94,9 @@
             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;
@@ -395,6 +133,31 @@
             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;
@@ -833,41 +596,9 @@
         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;
@@ -1000,9 +731,12 @@
         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();
@@ -1159,6 +893,9 @@
         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);
@@ -1263,7 +1000,7 @@
         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);
@@ -1408,7 +1145,7 @@
         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);
@@ -1568,6 +1305,8 @@
         case SLSI_NAN_EVENT_TRANSMIT_FOLLOWUP_STATUS:
             ret = processNanFollowupStatus(event);
             break;
+        default:
+            return datacmd.handleEvent(event, callbackEventHandler);
         }
 
         return NL_OK;
@@ -1624,12 +1363,35 @@
             /* 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;
@@ -1771,3 +1533,62 @@
     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);
+
+}
+
diff --git a/wifi_nan_data_path.cpp b/wifi_nan_data_path.cpp
new file mode 100755
index 0000000..ada5f26
--- /dev/null
+++ b/wifi_nan_data_path.cpp
@@ -0,0 +1,422 @@
+
+#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
