[v7 2/2] dbus: Add API for USD

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



USD had a control interface commands and events defined for it. Extend
this by providing similar USD APIs through the dbus control interface.

Signed-off-by: Lo,Chin-Ran <chin-ran.lo@xxxxxxx>
---
 doc/dbus.doxygen                        |  71 ++++
 src/common/nan_de.h                     |   2 +-
 wpa_supplicant/dbus/dbus_new.c          | 339 +++++++++++++++
 wpa_supplicant/dbus/dbus_new.h          |  56 +++
 wpa_supplicant/dbus/dbus_new_handlers.c | 533 ++++++++++++++++++++++++
 wpa_supplicant/dbus/dbus_new_handlers.h |  14 +
 wpa_supplicant/dbus/dbus_new_helpers.h  |  24 ++
 wpa_supplicant/notify.c                 |  16 +
 8 files changed, 1054 insertions(+), 1 deletion(-)

diff --git a/doc/dbus.doxygen b/doc/dbus.doxygen
index 4c5f5f9e9..a1f075a25 100644
--- a/doc/dbus.doxygen
+++ b/doc/dbus.doxygen
@@ -412,6 +412,77 @@ fi.w1.wpa_supplicant1.CreateInterface.
 	  <dd>Invalid entries were found in the passed argument.</dd>
 	</dl>
       </li>
+      <li>
+	<h3>NANPublish ( (sybbbqbbbqqqqvv) : nan_args ) --> nothing</h3>
+	<p>Set the parameters of nan-publish for the interface.</p>
+	<h4>Arguments</h4>
+	<dl>
+	  <dt>(sybbbqbbbqqqqvv) : nan_args</dt>
+	  <dd>Structure of publish parameters.</dd>
+	</dl>
+	<h4>Possible errors</h4>
+	<dl>
+	  <dt>fi.w1.wpa_supplicant1.NoMemory</dt>
+	  <dd>Needed memory was not possible to get allocated.</dd>
+	  <dt>fi.w1.wpa_supplicant1.InvalidArgs</dt>
+	  <dd>Invalid entries were found in the passed argument.</dd>
+	</dl>
+      </li>
+      <li>
+	<h3>NANCancelPublish ( i : nan_args ) --> nothing</h3>
+	<p>Cancel the previous nan-publish for the interface.</p>
+	<h4>Arguments</h4>
+	<dl>
+	  <dt>i : nan_args</dt>
+	  <dd>publish id.</dd>
+	</dl>
+      </li>
+      <li>
+	<h3>NANUpdatePublish ( (iqv) : nan_args ) --> nothing</h3>
+	<p>Update the SSI of the previous nan-publish for the interface.</p>
+	<h4>Arguments</h4>
+	<dl>
+	  <dt>(iqv) : nan_args</dt>
+	  <dd>publish id and SSI.</dd>
+	</dl>
+      </li>
+      <li>
+	<h3>NANSubscribe ( (syyqqqv) : nan_args ) --> nothing</h3>
+	<p>Set the parameters of the nan-usd subscription for the interface.</p>
+	<h4>Arguments</h4>
+	<dl>
+	  <dt>(syyqqqv) : nan_args</dt>
+	  <dd>Structure of subscribe parameters.</dd>
+	</dl>
+	<h4>Possible errors</h4>
+	<dl>
+	  <dt>fi.w1.wpa_supplicant1.InvalidArgs</dt>
+	  <dd>Invalid entries were found in the passed argument.</dd>
+	</dl>
+      </li>
+      <li>
+	<h3>NANCancelSubscribe ( i : nan_args ) --> nothing</h3>
+	<p>Cancel the previous subscription for the interface.</p>
+	<h4>Arguments</h4>
+	<dl>
+	  <dt>i : nan_args</dt>
+	  <dd>Subscription id.</dd>
+	</dl>
+      </li>
+      <li>
+	<h3>NANTransmit ( (yysqv) : nan_args ) --> nothing</h3>
+	<p>Send the follow-up packet for the interface.</p>
+	<h4>Arguments</h4>
+	<dl>
+	  <dt>(yysqv) : nan_args</dt>
+	  <dd>Parameters of the follow-up packet.</dd>
+	</dl>
+	<h4>Possible errors</h4>
+	<dl>
+	  <dt>fi.w1.wpa_supplicant1.InvalidArgs</dt>
+	  <dd>Invalid entries were found in the passed argument.</dd>
+	</dl>
+      </li>
       <li>
 	<h3>TDLSDiscover ( s : peer_address ) --> nothing</h3>
 	<p>Initiate a TDLS discovery for a peer.</p>
diff --git a/src/common/nan_de.h b/src/common/nan_de.h
index 359c8a541..5db6d3f1b 100644
--- a/src/common/nan_de.h
+++ b/src/common/nan_de.h
@@ -96,7 +96,7 @@ struct nan_publish_params {
 	unsigned int freq;
 
 	/* Multi-channel frequencies (publishChannelList) */
-	const int *freq_list;
+	int *freq_list;
 
 	/* Announcement period in ms; 0 = use default */
 	unsigned int announcement_period;
diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c
index 00b38edf5..98abf196a 100644
--- a/wpa_supplicant/dbus/dbus_new.c
+++ b/wpa_supplicant/dbus/dbus_new.c
@@ -3605,6 +3605,52 @@ static const struct wpa_dbus_method_desc wpas_dbus_interface_methods[] = {
 	  }
 	},
 #endif /* CONFIG_AUTOSCAN */
+#ifdef CONFIG_NAN_USD
+	{ "NANPublish", WPAS_DBUS_NEW_IFACE_INTERFACE,
+	  (WPADBusMethodHandler) wpas_dbus_handler_nan_publish,
+	  {
+		  { "nan_args", "(sybbbqbbbqqqqvv)", ARG_IN },
+		  { "publish_id", "i", ARG_OUT },
+		  END_ARGS
+	  }
+	},
+	{ "NANCancelPublish", WPAS_DBUS_NEW_IFACE_INTERFACE,
+	  (WPADBusMethodHandler) wpas_dbus_handler_nan_cancel_publish,
+	  {
+		  { "nan_args", "i", ARG_IN },
+		  END_ARGS
+	  }
+	},
+	{ "NANUpdatePublish", WPAS_DBUS_NEW_IFACE_INTERFACE,
+	  (WPADBusMethodHandler) wpas_dbus_handler_nan_update_publish,
+	  {
+		  { "nan_args", "(iqv)", ARG_IN },
+		  END_ARGS
+	  }
+	},
+	{ "NANSubscribe", WPAS_DBUS_NEW_IFACE_INTERFACE,
+	  (WPADBusMethodHandler) wpas_dbus_handler_nan_subscribe,
+	  {
+		  { "nan_args", "(syyqqqv)", ARG_IN },
+		  { "subscribe_id", "i", ARG_OUT },
+		  END_ARGS
+	  }
+	},
+	{ "NANCancelSubscribe", WPAS_DBUS_NEW_IFACE_INTERFACE,
+	  (WPADBusMethodHandler) wpas_dbus_handler_nan_cancel_subscribe,
+	  {
+		  { "nan_args", "i", ARG_IN },
+		  END_ARGS
+	  }
+	},
+	{ "NANTransmit", WPAS_DBUS_NEW_IFACE_INTERFACE,
+	  (WPADBusMethodHandler) wpas_dbus_handler_nan_transmit,
+	  {
+		  { "nan_args", "(yysqv)", ARG_IN },
+		  END_ARGS
+	  }
+	},
+#endif /* CONFIG_NAN_USD */
 #ifdef CONFIG_TDLS
 	{ "TDLSDiscover", WPAS_DBUS_NEW_IFACE_INTERFACE,
 	  (WPADBusMethodHandler) wpas_dbus_handler_tdls_discover,
@@ -3983,6 +4029,38 @@ static const struct wpa_dbus_signal_desc wpas_dbus_interface_signals[] = {
 		  END_ARGS
 	  }
 	},
+#ifdef CONFIG_NAN_USD
+	{ "NANDiscoveryresult", WPAS_DBUS_NEW_IFACE_INTERFACE,
+	  {
+		  { "success", "b", ARG_OUT },
+		  { "discov_info", "a{sv}", ARG_OUT },
+		  { "ssi", "a{sv}", ARG_OUT },
+		  END_ARGS
+	  }
+	},
+	{ "NANReceive", WPAS_DBUS_NEW_IFACE_INTERFACE,
+	  {
+		  { "nanrx_info", "a{sv}", ARG_OUT },
+		  { "ssi", "a{sv}", ARG_OUT },
+		  END_ARGS
+	  }
+	},
+	{ "NanPublishterminated", WPAS_DBUS_NEW_IFACE_INTERFACE,
+	  {
+		  { "publish_id", "i", ARG_OUT },
+		  { "reason", "i", ARG_OUT },
+		  END_ARGS
+	  }
+	},
+	{ "NanSubscribeterminated", WPAS_DBUS_NEW_IFACE_INTERFACE,
+	  {
+		  { "term_subscribe_id", "i", ARG_OUT },
+		  { "reason", "i", ARG_OUT },
+		  END_ARGS
+	  }
+	},
+
+#endif /* CONFIG_NAN_USD */
 	{ "BSSAdded", WPAS_DBUS_NEW_IFACE_INTERFACE,
 	  {
 		  { "path", "o", ARG_OUT },
@@ -5186,3 +5264,264 @@ void wpas_dbus_signal_hs20_t_c_acceptance(struct wpa_supplicant *wpa_s,
 	dbus_message_unref(msg);
 }
 #endif /* CONFIG_HS20 */
+
+
+#ifdef CONFIG_NAN_USD
+
+/**
+ * wpas_dbus_signal_nan_discoveryresult - Send NAN discovery result signal
+ * @wpa_s: %wpa_supplicant network interface data
+ * @subscribe_id: Subscribe id of the session
+ * @peer_publish_id: Publish id of the sender
+ * @peer_addr: MAC address of the peer device
+ * @ssi: Service specific information payload
+ * @ssi_len: Length of the SSI field
+ *
+ * Notify the discovery-result
+ */
+void wpas_dbus_signal_nan_discovery_result(struct wpa_supplicant *wpa_s,
+					   int subscribe_id,
+					   int peer_publish_id,
+					   const u8 *peer_addr,
+					   bool fsd, bool fsd_gas,
+					   const u8 *ssi, size_t ssi_len)
+{
+	struct wpas_dbus_priv *iface;
+	DBusMessage *msg;
+	DBusMessageIter iter, dict_iter;
+	dbus_bool_t succ;
+	struct wpa_dbus_discov_info disc_info;
+
+	iface = wpa_s->global->dbus;
+
+	/* Do nothing if the interface is not turned on */
+	if (!iface || !wpa_s->dbus_new_path)
+		return;
+
+	msg = dbus_message_new_signal(wpa_s->dbus_new_path,
+				      WPAS_DBUS_NEW_IFACE_INTERFACE,
+				      "NanDiscoveryresult");
+	if (!msg)
+		return;
+
+	dbus_message_iter_init_append(msg, &iter);
+	succ = TRUE;
+	disc_info.subscribe_id = subscribe_id;
+	disc_info.peer_publish_id = peer_publish_id;
+	memcpy(disc_info.peer_addr, peer_addr, ETH_ALEN);
+	disc_info.fsd = fsd;
+	disc_info.fsd_gas = fsd_gas;
+	disc_info.ssi_len = ssi_len;
+
+	if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_BOOLEAN, &succ) ||
+		!wpa_dbus_dict_open_write(&iter, &dict_iter) ||
+		!wpa_dbus_dict_append_byte_array(&dict_iter, "discov_info",
+						 (const char *) &disc_info,
+						 sizeof(disc_info)) ||
+		!wpa_dbus_dict_append_byte_array(&dict_iter, "ssi",
+						 (const char *) ssi,
+						 ssi_len) ||
+		!wpa_dbus_dict_close_write(&iter, &dict_iter))
+		wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
+	else
+		dbus_connection_send(iface->con, msg, NULL);
+	dbus_message_unref(msg);
+}
+
+/**
+ * wpas_dbus_signal_nan_replied - Send NAN Replied signal
+ * @wpa_s: %wpa_supplicant network interface data
+ * @publish_id: Publish id of the session
+ * @peer_subscribe_id: Subscribe id of the sender
+ * @peer_addr: MAC address of the peer device
+ * @ssi: Service specific information payload
+ * @ssi_len: Length of the SSI field
+ *
+ * Notify the discovery-result
+ */
+void wpas_dbus_signal_nan_replied(struct wpa_supplicant *wpa_s,
+					   int publish_id,
+					   int peer_subscribe_id,
+					   const u8 *peer_addr,
+					   const u8 *ssi, size_t ssi_len)
+{
+	struct wpas_dbus_priv *iface;
+	DBusMessage *msg;
+	DBusMessageIter iter, dict_iter;
+	dbus_bool_t succ;
+	struct wpa_dbus_reply_info reply_info;
+	wpa_printf(MSG_INFO, "DBUS NanReplied");
+
+	iface = wpa_s->global->dbus;
+
+	/* Do nothing if the interface is not turned on */
+	if (!iface || !wpa_s->dbus_new_path)
+		return;
+
+	msg = dbus_message_new_signal(wpa_s->dbus_new_path,
+				      WPAS_DBUS_NEW_IFACE_INTERFACE,
+				      "NanReplied");
+	if (!msg)
+		return;
+
+	dbus_message_iter_init_append(msg, &iter);
+	succ = TRUE;
+	reply_info.publish_id = publish_id;
+	reply_info.peer_subscribe_id = peer_subscribe_id;
+	memcpy(reply_info.peer_addr, peer_addr, ETH_ALEN);
+	reply_info.ssi_len = ssi_len;
+
+	if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_BOOLEAN, &succ) ||
+		!wpa_dbus_dict_open_write(&iter, &dict_iter) ||
+		!wpa_dbus_dict_append_byte_array(&dict_iter, "reply_info",
+						 (const char *) &reply_info,
+						 sizeof(reply_info)) ||
+		!wpa_dbus_dict_append_byte_array(&dict_iter, "ssi",
+						 (const char *) ssi,
+						 ssi_len) ||
+		!wpa_dbus_dict_close_write(&iter, &dict_iter))
+		wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
+	else
+		dbus_connection_send(iface->con, msg, NULL);
+	dbus_message_unref(msg);
+}
+
+
+/**
+ * wpas_dbus_signal_nan_receive - Send receive NAN USD packet signal
+ * @wpa_s: %wpa_supplicant network interface data
+ * @id: Subscribe id
+ * @peer_id: Id of the sender
+ * @peer_addr: address of the sender
+ * @ssi: Service specific information payload
+ * @ssi_len: Length of the SSID
+ *
+ * Notify while getting the follow-up packet
+ */
+void wpas_dbus_signal_nan_receive(struct wpa_supplicant *wpa_s,
+				  int id, int peer_id, const u8 *peer_addr,
+				  const u8 *ssi, size_t ssi_len)
+{
+	struct wpas_dbus_priv *iface;
+	DBusMessage *msg;
+	DBusMessageIter iter, dict_iter;
+	struct wpa_dbus_nanrx_info nanrx_info;
+
+	iface = wpa_s->global->dbus;
+
+	/* Do nothing if the interface is not turned on */
+	if (!iface || !wpa_s->dbus_new_path)
+		return;
+
+	msg = dbus_message_new_signal(wpa_s->dbus_new_path,
+				      WPAS_DBUS_NEW_IFACE_INTERFACE,
+				      "NanReceive");
+	if (!msg)
+		return;
+
+	dbus_message_iter_init_append(msg, &iter);
+	nanrx_info.id = id;
+	nanrx_info.peer_id = peer_id;
+	memcpy(nanrx_info.peer_addr, peer_addr, ETH_ALEN);
+	nanrx_info.ssi_len = ssi_len;
+
+	if (!wpa_dbus_dict_open_write(&iter, &dict_iter) ||
+		!wpa_dbus_dict_append_byte_array(&dict_iter, "nanrx_info",
+					     (const char *) &nanrx_info,
+					     sizeof(nanrx_info)) ||
+		!wpa_dbus_dict_append_byte_array(&dict_iter, "ssi",
+					     (const char *) ssi,
+					     ssi_len) ||
+		!wpa_dbus_dict_close_write(&iter, &dict_iter))
+		wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
+	else
+		dbus_connection_send(iface->con, msg, NULL);
+	dbus_message_unref(msg);
+}
+
+
+/**
+ * wpas_dbus_signal_nan_publish_terminated - Send publish-terminated signal
+ * @wpa_s: %wpa_supplicant network interface data
+ * @publish_id: The publish_id of the session
+ * @reason: The reason of the termination
+ *
+ * Notify while the session is expired
+ */
+void wpas_dbus_signal_nan_publish_terminated(struct wpa_supplicant *wpa_s,
+					     int publish_id, int reason)
+{
+	struct wpas_dbus_priv *iface;
+	DBusMessage *msg;
+	dbus_int32_t dpub_id = publish_id;
+	dbus_int32_t dreason = reason;
+
+	iface = wpa_s->global->dbus;
+
+	/* Do nothing if the interface is not turned on */
+	if (!iface || !wpa_s->dbus_new_path)
+		return;
+
+	msg = dbus_message_new_signal(wpa_s->dbus_new_path,
+				      WPAS_DBUS_NEW_IFACE_INTERFACE,
+				      "NanPublishterminated");
+	if (!msg)
+		return;
+
+	if (!dbus_message_append_args(msg, DBUS_TYPE_INT32, &dpub_id,
+				     DBUS_TYPE_INVALID) ||
+		!dbus_message_append_args(msg, DBUS_TYPE_INT32, &dreason,
+				     DBUS_TYPE_INVALID))
+		wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
+	else {
+		dbus_connection_send(iface->con, msg, NULL);
+		wpa_msg(wpa_s, MSG_INFO, NAN_SUBSCRIBE_TERMINATED
+			"wpas_dbus_signal_nan_subscribe_terminated() dbus_connection_send (int)");
+	}
+	dbus_message_unref(msg);
+}
+
+
+/**
+ * wpas_dbus_signal_nan_subscribe_terminated - Send subscribe-terminated signal
+ * @wpa_s: %wpa_supplicant network interface data
+ * @subscribe_id: The subscribe_id of the session
+ * @reason: The reason of the termination
+ *
+ * Notify while the session is expired.
+ */
+void wpas_dbus_signal_nan_subscribe_terminated(struct wpa_supplicant *wpa_s,
+					       int subscribe_id, int reason)
+{
+	struct wpas_dbus_priv *iface;
+	DBusMessage *msg;
+	dbus_int32_t dsub_id = subscribe_id;
+	dbus_int32_t dreason = reason;
+
+	iface = wpa_s->global->dbus;
+
+	/* Do nothing if the interface is not turned on */
+	if (!iface || !wpa_s->dbus_new_path)
+		return;
+
+	msg = dbus_message_new_signal(wpa_s->dbus_new_path,
+				      WPAS_DBUS_NEW_IFACE_INTERFACE,
+				      "NanSubscribeterminated");
+	if (!msg)
+		return;
+
+	if (!dbus_message_append_args(msg, DBUS_TYPE_INT32, &dsub_id,
+				     DBUS_TYPE_INVALID) ||
+		!dbus_message_append_args(msg, DBUS_TYPE_INT32, &dreason,
+				     DBUS_TYPE_INVALID))
+		wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
+	else {
+		dbus_connection_send(iface->con, msg, NULL);
+		wpa_msg(wpa_s, MSG_INFO, NAN_SUBSCRIBE_TERMINATED
+			"wpas_dbus_signal_nan_subscribe_terminated() dbus_connection_send (int)");
+	}
+
+	dbus_message_unref(msg);
+}
+
+#endif /* CONFIG_NAN_USD */
diff --git a/wpa_supplicant/dbus/dbus_new.h b/wpa_supplicant/dbus/dbus_new.h
index b653f10f9..7a222c01c 100644
--- a/wpa_supplicant/dbus/dbus_new.h
+++ b/wpa_supplicant/dbus/dbus_new.h
@@ -21,6 +21,7 @@ struct wpa_bss;
 struct wps_event_m2d;
 struct wps_event_fail;
 struct wps_credential;
+struct wpa_dbus_discov_info;
 
 enum wpas_dbus_prop {
 	WPAS_DBUS_PROP_AP_SCAN,
@@ -281,6 +282,24 @@ void wpas_dbus_signal_interworking_ap_added(struct wpa_supplicant *wpa_s,
 void wpas_dbus_signal_interworking_select_done(struct wpa_supplicant *wpa_s);
 void wpas_dbus_signal_hs20_t_c_acceptance(struct wpa_supplicant *wpa_s,
 					  const char *url);
+void wpas_dbus_signal_nan_discovery_result(struct wpa_supplicant *wpa_s,
+                                          int subscribe_id,
+                                          int peer_publish_id,
+                                          const u8 *peer_addr,
+                                          bool fsd, bool fsd_gas,
+                                          const u8 *ssi, size_t ssi_len);
+void wpas_dbus_signal_nan_replied(struct wpa_supplicant *wpa_s,
+                                          int publish_id,
+                                          int peer_subscribe_id,
+                                          const u8 *peer_addr,
+                                          const u8 *ssi, size_t ssi_len);
+void wpas_dbus_signal_nan_receive(struct wpa_supplicant *wpa_s,
+                                 int id, int peer_id, const u8 *peer_addr,
+                                 const u8 *ssi, size_t ssi_len);
+void wpas_dbus_signal_nan_publish_terminated(struct wpa_supplicant *wpa_s,
+                                            int publish_id, int reason);
+void wpas_dbus_signal_nan_subscribe_terminated(struct wpa_supplicant *wpa_s,
+                                              int subscribe_id, int reason);
 
 #else /* CONFIG_CTRL_IFACE_DBUS_NEW */
 
@@ -658,6 +677,43 @@ void wpas_dbus_signal_hs20_t_c_acceptance(struct wpa_supplicant *wpa_s,
 {
 }
 
+static inline void
+wpas_dbus_signal_nan_discovery_result(struct wpa_supplicant *wpa_s,
+				      int subscribe_id,
+				      int peer_publish_id, const u8 *peer_addr,
+				      bool fsd, bool fsd_gas,
+				      const u8 *ssi, size_t ssi_len)
+{
+}
+
+static inline void
+wpas_dbus_signal_nan_replied(struct wpa_supplicant *wpa_s,
+				      int publish_id,
+				      int peer_subscribe_id, const u8 *peer_addr,
+				      const u8 *ssi, size_t ssi_len)
+{
+}
+
+
+static inline void
+wpas_dbus_signal_nan_receive(struct wpa_supplicant *wpa_s,
+			     int id, int peer_id, const u8 *peer_addr,
+			     const u8 *ssi, size_t ssi_len)
+{
+}
+
+static inline void
+wpas_dbus_signal_nan_publish_terminated(struct wpa_supplicant *wpa_s,
+					int publish_id, int reason)
+{
+}
+
+static inline void
+wpas_dbus_signal_nan_subscribe_terminated(struct wpa_supplicant *wpa_s,
+					  int subscribe_id, int reason)
+{
+}
+
 #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
 
 #endif /* CTRL_IFACE_DBUS_H_NEW */
diff --git a/wpa_supplicant/dbus/dbus_new_handlers.c b/wpa_supplicant/dbus/dbus_new_handlers.c
index 6ad49a136..bc5a6d65e 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers.c
+++ b/wpa_supplicant/dbus/dbus_new_handlers.c
@@ -12,6 +12,7 @@
 
 #include "common.h"
 #include "common/ieee802_11_defs.h"
+#include "common/nan_de.h"
 #include "eap_peer/eap_methods.h"
 #include "eapol_supp/eapol_supp_sm.h"
 #include "rsn_supp/wpa.h"
@@ -27,6 +28,7 @@
 #include "../autoscan.h"
 #include "../ap.h"
 #include "../interworking.h"
+#include "../nan_usd.h"
 #include "dbus_new_helpers.h"
 #include "dbus_new.h"
 #include "dbus_new_handlers.h"
@@ -2706,6 +2708,537 @@ DBusMessage * wpas_dbus_handler_eap_logon(DBusMessage *message,
 }
 
 
+#ifdef CONFIG_NAN_USD
+#define MAX_NAN_SRV_NAME_LEN		256
+#define NAN_FREQ_LIST_ALL		0xff
+
+int unit_len(int dbus_type)
+{
+	switch (dbus_type) {
+		case DBUS_TYPE_BYTE:
+		case DBUS_TYPE_BOOLEAN:
+			return 1;
+		case DBUS_TYPE_INT16:
+		case DBUS_TYPE_UINT16:
+			return 2;
+		case DBUS_TYPE_INT32:
+		case DBUS_TYPE_UINT32:
+			return 4;
+		case DBUS_TYPE_INT64:
+		case DBUS_TYPE_UINT64:
+		case DBUS_TYPE_DOUBLE:
+			return 8;
+	}
+	return 0;
+}
+static bool get_gvariant_items(DBusMessageIter *piter, int type, void* datpt, u32 dat_buf_len)
+{
+	int rtype = dbus_message_iter_get_arg_type(piter);
+
+	if (rtype == DBUS_TYPE_VARIANT) {
+		DBusMessageIter	subiter;
+		dbus_message_iter_recurse(piter, &subiter);
+		dbus_message_iter_next(piter);
+		return get_gvariant_items(&subiter, type, datpt, dat_buf_len);
+	} else if (rtype == DBUS_TYPE_ARRAY) {
+		DBusMessageIter	array_iter;
+		int offset=0;
+		int ulen;
+		int arytype;
+		dbus_message_iter_recurse(piter, &array_iter);
+		dbus_message_iter_next(piter);
+		// Loop through the array
+		arytype = dbus_message_iter_get_arg_type(&array_iter);
+		if (arytype != type) {
+			wpa_printf(MSG_ERROR, "Item type: (exp, get)=(%c, %c)", type, arytype);
+			return false;
+		}
+		ulen = unit_len(arytype);
+		while ((arytype = dbus_message_iter_get_arg_type(&array_iter)) != DBUS_TYPE_INVALID) {
+			if (arytype != type) {
+				wpa_printf(MSG_ERROR, "Item type: (exp, get)=(%c, %c)", type, arytype);
+				return false;
+			}
+			dbus_message_iter_get_basic(&array_iter, (datpt+offset));
+			dbus_message_iter_next(&array_iter);
+			offset+= ulen;
+			if ((offset+ulen) > dat_buf_len) {
+				wpa_printf(MSG_WARNING, "end_of_buffer(%d, %d, %u)", offset, ulen, dat_buf_len);
+				break;
+			}
+		}
+	} else {
+		if (rtype != type) {
+			wpa_printf(MSG_ERROR, "Item type: (exp, get)=(%c, %c)", type, rtype);
+			return false;
+		}
+		dbus_message_iter_get_basic(piter, datpt);
+		dbus_message_iter_next(piter);
+	}
+	return true;
+}
+/*
+ * wpas_dbus_handler_nan_publish - Send out NAN publish packets
+ * @message: Pointer to incoming dbus message
+ * @wpa_s: wpa_supplicant structure for a network interface
+ * Returns: NULL indicating success or DBus error message on failure
+ *
+ * Handler function for "NANPublish" method call of network interface.
+ */
+DBusMessage * wpas_dbus_handler_nan_publish(DBusMessage *message,
+					    struct wpa_supplicant *wpa_s)
+{
+	int publish_id;
+	/* Parameters from DBUS */
+	char service_name[MAX_NAN_SRV_NAME_LEN];
+	char *psrv_name;
+	enum nan_service_protocol_type srv_proto_type=0;
+	u8 solicited;
+	u8 unsolicited;
+	u8 solicited_multicast;
+	u8 disable_events;
+	u8 fsd;
+	u8 fsd_gas;
+	u16 announcement_period;
+	u16 freq=0;
+	u16 freq_list_len;
+	u16 ssi_len;
+	u16 ttl;
+	DBusMessageIter	iter, subiter;
+
+	struct nan_publish_params params;
+	struct wpabuf *freq_list = NULL;
+	struct wpabuf *ssi = NULL;
+
+	wpa_printf(MSG_INFO, "DBUS NAN_PUBLISH:");
+	os_memset(&params, 0, sizeof(params));
+	os_memset(service_name, 0, sizeof(service_name));
+
+	// Get the parameters from dbus
+	dbus_message_iter_init(message, &iter);
+	if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRUCT) {
+		wpa_printf(MSG_INFO, "Unexpected, arg is not struct");
+		goto fail;
+	}
+	// Open the structure
+	dbus_message_iter_recurse(&iter, &subiter);
+	// Extract the elements
+	if (get_gvariant_items(&subiter, DBUS_TYPE_STRING, (void*)&psrv_name, sizeof(&psrv_name)) == false) {
+		wpa_printf(MSG_ERROR, "Error while fetching srv_name");
+		goto fail;
+	}
+	strncpy(service_name, psrv_name, MAX_NAN_SRV_NAME_LEN-1);
+	if (get_gvariant_items(&subiter, DBUS_TYPE_BYTE, (void*)&srv_proto_type, sizeof(u8)) == false) {
+		wpa_printf(MSG_ERROR, "Error while fetching srv_proto_type");
+		goto fail;
+	}
+	if (get_gvariant_items(&subiter, DBUS_TYPE_BOOLEAN, (void*)&solicited, sizeof(bool)) == false) {
+		wpa_printf(MSG_ERROR, "Error while fetching solicited");
+		goto fail;
+	}
+	if (get_gvariant_items(&subiter, DBUS_TYPE_BOOLEAN, (void*)&unsolicited, sizeof(bool)) == false) {
+		wpa_printf(MSG_ERROR, "Error while fetching solicited");
+		goto fail;
+	}
+	if (get_gvariant_items(&subiter, DBUS_TYPE_BOOLEAN, (void*)&solicited_multicast, sizeof(bool)) == false) {
+		wpa_printf(MSG_ERROR, "Error while fetching solicited_multicast");
+		goto fail;
+	}
+	if (get_gvariant_items(&subiter, DBUS_TYPE_UINT16, (void*)&ttl, sizeof(u16)) == false) {
+		wpa_printf(MSG_ERROR, "Error while fetching ttl");
+		goto fail;
+	}
+	if (get_gvariant_items(&subiter, DBUS_TYPE_BOOLEAN, (void*)&disable_events, sizeof(bool)) == false) {
+		wpa_printf(MSG_ERROR, "Error while fetching disable_events");
+		goto fail;
+	}
+	if (get_gvariant_items(&subiter, DBUS_TYPE_BOOLEAN, (void*)&fsd, sizeof(bool)) == false) {
+		wpa_printf(MSG_ERROR, "Error while fetching fsd");
+		goto fail;
+	}
+	if (get_gvariant_items(&subiter, DBUS_TYPE_BOOLEAN, (void*)&fsd_gas, sizeof(bool)) == false) {
+		wpa_printf(MSG_ERROR, "Error while fetching fsd_gas");
+		goto fail;
+	}
+	if (get_gvariant_items(&subiter, DBUS_TYPE_UINT16, (void*)&freq, sizeof(u16)) == false) {
+		wpa_printf(MSG_ERROR, "Error while fetching freq");
+		goto fail;
+	}
+	if (get_gvariant_items(&subiter, DBUS_TYPE_UINT16, (void*)&announcement_period, sizeof(u16)) == false) {
+		wpa_printf(MSG_ERROR, "Error while fetching announcement_period");
+		goto fail;
+	}
+	if (get_gvariant_items(&subiter, DBUS_TYPE_UINT16, (void*)&ssi_len, sizeof(u16)) == false) {
+		wpa_printf(MSG_ERROR, "Error while fetching ssi_len");
+		goto fail;
+	}
+	if (get_gvariant_items(&subiter, DBUS_TYPE_UINT16, (void*)&freq_list_len, sizeof(u16)) == false) {
+		wpa_printf(MSG_ERROR, "Error while fetching freq_list_len");
+		goto fail;
+	}
+	if (ssi_len > 0) {
+		ssi = wpabuf_alloc(ssi_len);
+		if (ssi == NULL) {
+			goto fail;
+		}
+		if (get_gvariant_items(&subiter, DBUS_TYPE_BYTE, (void*)ssi->buf, ssi_len) == false) {
+			wpa_printf(MSG_ERROR, "Error while fetching ssi");
+			goto fail;
+		}
+		ssi->used= ssi_len;
+	}
+	if (freq_list_len > 0) {
+		if (freq_list_len == NAN_FREQ_LIST_ALL) {
+			params.freq_list = wpas_nan_usd_all_freqs(wpa_s);
+		} else if (freq_list_len > 0) {
+			freq_list = wpabuf_alloc(freq_list_len);
+			if (freq_list == NULL) {
+				goto fail;
+			}
+			if (get_gvariant_items(&subiter, DBUS_TYPE_UINT16, (void*)freq_list->buf, (sizeof(u16)*freq_list_len)) == false) {
+				wpa_printf(MSG_ERROR, "Error while fetching freq_list");
+				goto fail;
+			}
+			params.freq_list = (int *)freq_list->buf;
+		}
+	}
+
+	wpa_printf(MSG_INFO, "service_name:[%s]", service_name);
+	wpa_printf(MSG_INFO, "srv_proto_type:[%u]", srv_proto_type);
+	wpa_printf(MSG_INFO, "solicited:[%d]", solicited);
+	wpa_printf(MSG_INFO, "unsolicited:[%d]", unsolicited);
+	wpa_printf(MSG_INFO, "ttl:[%u]", ttl);
+	wpa_printf(MSG_INFO, "freq:[%u]", freq);
+	wpa_printf(MSG_INFO, "freq_list_len:[%u]", freq_list_len);
+	wpa_hexdump(MSG_MSGDUMP, "freq_list", params.freq_list, freq_list_len*sizeof(u16));
+	wpa_printf(MSG_INFO, "ssi_len:[%u]", ssi_len);
+	wpa_hexdump(MSG_MSGDUMP, "publish_ssi:", ssi->buf, ssi_len);
+
+	params.ttl = ttl;
+	params.solicited = solicited;
+	params.unsolicited = unsolicited;
+	params.freq = freq;
+	params.fsd = freq;
+	publish_id = wpas_nan_usd_publish(wpa_s, service_name, srv_proto_type,
+					  ssi, &params);
+	if (publish_id > 0) {
+		DBusMessage *reply;
+		reply = dbus_message_new_method_return(message);
+		dbus_message_append_args(reply, DBUS_TYPE_INT32,
+					 &publish_id, DBUS_TYPE_INVALID);
+		return reply;
+	}
+fail:
+	wpabuf_free(ssi);
+	wpabuf_free(freq_list);
+	return wpas_dbus_error_unknown_error(
+			message, "error publishing nan-usd");
+}
+
+/*
+ * wpas_dbus_handler_nan_cancel_publish - Cancel the publish
+ * @message: Pointer to incoming dbus message
+ * @wpa_s: wpa_supplicant structure for a network interface
+ * Returns: NULL indicating success or DBus error message on failure
+ *
+ * Handler function for "NANCancelPublish" method call of network interface.
+ */
+DBusMessage * wpas_dbus_handler_nan_cancel_publish(DBusMessage *message,
+						   struct wpa_supplicant *wpa_s)
+{
+	int publish_id = -1;
+
+	wpa_printf(MSG_INFO, "DBUS NAN_CANCEL_PUBLISH:");
+	if (!dbus_message_get_args(message, NULL,
+				   DBUS_TYPE_INT32, &publish_id,
+				   DBUS_TYPE_INVALID)) {
+		wpa_printf(MSG_DEBUG, " DBUS NAN_CANCEL_PUBLISH, failed to get args ");
+		return NULL;
+	}
+
+	if ((!wpa_s->nan_de) || (publish_id == -1))
+		return NULL;
+	wpa_printf(MSG_INFO, "DBUS NAN_CANCEL_PUBLISH: %d", publish_id);
+	nan_de_cancel_publish(wpa_s->nan_de, publish_id);
+	return NULL;
+}
+
+/*
+ * wpas_dbus_handler_nan_update_publish - Update the publish ssi
+ * @message: Pointer to incoming dbus message
+ * @wpa_s: wpa_supplicant structure for a network interface
+ * Returns: NULL indicating success or DBus error message on failure
+ *
+ * Handler function for "NANUpdatePublish" method call of network interface.
+ */
+DBusMessage * wpas_dbus_handler_nan_update_publish(DBusMessage *message,
+						   struct wpa_supplicant *wpa_s)
+{
+	int publish_id = -1;
+	u16 ssi_len;
+	struct wpabuf *ssi = NULL;
+	DBusMessageIter	iter, subiter;
+
+	wpa_printf(MSG_INFO, "DBUS NAN_UPDATE_PUBLISH:");
+	// Get the parameters from dbus
+	dbus_message_iter_init(message, &iter);
+	if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRUCT) {
+		wpa_printf(MSG_INFO, "Unexpected, arg is not struct");
+		goto fail;
+	}
+	// Open the structure
+	dbus_message_iter_recurse(&iter, &subiter);
+	// Extract the elements
+	if (get_gvariant_items(&subiter, DBUS_TYPE_INT32, (void*)&publish_id, sizeof(u16)) == false) {
+		wpa_printf(MSG_ERROR, "Error while fetching publish_id");
+		goto fail;
+	}
+	if (get_gvariant_items(&subiter, DBUS_TYPE_UINT16, (void*)&ssi_len, sizeof(u16)) == false) {
+		wpa_printf(MSG_ERROR, "Error while fetching ssi_len");
+		goto fail;
+	}
+	if (ssi_len > 0) {
+		ssi = wpabuf_alloc(ssi_len);
+		if (ssi == NULL) {
+			goto fail;
+		}
+		if (get_gvariant_items(&subiter, DBUS_TYPE_BYTE, (void*)ssi->buf, ssi_len) == false) {
+			wpa_printf(MSG_ERROR, "Error while fetching ssi");
+			goto fail;
+		}
+		ssi->used= ssi_len;
+	}
+	if ((!wpa_s->nan_de) || (publish_id == -1))
+		return NULL;
+	wpa_printf(MSG_INFO, "DBUS NAN_UPDATE_PUBLISH: %d", publish_id);
+	nan_de_update_publish(wpa_s->nan_de, publish_id, ssi);
+
+	return NULL;
+fail:
+	wpabuf_free(ssi);
+	return wpas_dbus_error_unknown_error(
+			message, "error updating nan-usd publish ssi");
+}
+
+
+/*
+ * wpas_dbus_handler_nan_subscribe - Send out nan-subscribe packets
+ * @message: Pointer to incoming dbus message
+ * @wpa_s: wpa_supplicant structure for a network interface
+ * Returns: NULL indicating success or DBus error message on failure
+ *
+ * Handler function for "NANSubscribe" method call of network interface.
+ */
+DBusMessage * wpas_dbus_handler_nan_subscribe(DBusMessage *message,
+					      struct wpa_supplicant *wpa_s)
+{
+	int subscribe_id;
+	struct nan_subscribe_params params;
+
+	char service_name[MAX_NAN_SRV_NAME_LEN];
+	char *psrv_name;
+	enum nan_service_protocol_type srv_proto_type=0;
+	u8 is_active;
+	u16 ttl;
+	u16 freq=0;
+	u16 ssi_len;
+	struct wpabuf *ssi = NULL;
+	DBusMessageIter	iter, subiter;
+
+	wpa_printf(MSG_INFO, "DBUS NAN_SUBSCRIBE: ");
+	os_memset(&params, 0, sizeof(params));
+
+	// Get the parameters from dbus
+	dbus_message_iter_init(message, &iter);
+	if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRUCT) {
+		wpa_printf(MSG_INFO, "Unexpected, arg is not struct");
+		goto fail;
+	}
+	// Open the structure
+	dbus_message_iter_recurse(&iter, &subiter);
+	// Extract the elements
+	if (get_gvariant_items(&subiter, DBUS_TYPE_STRING, (void*)&psrv_name, sizeof(&psrv_name)) == false) {
+		wpa_printf(MSG_ERROR, "Error while fetching srv_name");
+		goto fail;
+	}
+	strncpy(service_name, psrv_name, MAX_NAN_SRV_NAME_LEN-1);
+	if (get_gvariant_items(&subiter, DBUS_TYPE_BYTE, (void*)&srv_proto_type, sizeof(u8)) == false) {
+		wpa_printf(MSG_ERROR, "Error while fetching srv_proto_type");
+		goto fail;
+	}
+	if (get_gvariant_items(&subiter, DBUS_TYPE_BYTE, (void*)&is_active, sizeof(u8)) == false) {
+		wpa_printf(MSG_ERROR, "Error while fetching is_active");
+		goto fail;
+	}
+	if (get_gvariant_items(&subiter, DBUS_TYPE_UINT16, (void*)&ttl, sizeof(u16)) == false) {
+		wpa_printf(MSG_ERROR, "Error while fetching ttl");
+		goto fail;
+	}
+	if (get_gvariant_items(&subiter, DBUS_TYPE_UINT16, (void*)&freq, sizeof(u16)) == false) {
+		wpa_printf(MSG_ERROR, "Error while fetching freq");
+		goto fail;
+	}
+	if (get_gvariant_items(&subiter, DBUS_TYPE_UINT16, (void*)&ssi_len, sizeof(u16)) == false) {
+		wpa_printf(MSG_ERROR, "Error while fetching ssi_len");
+		goto fail;
+	}
+	if (ssi_len > 0) {
+		ssi = wpabuf_alloc(ssi_len);
+		if (ssi == NULL) {
+			goto fail;
+		}
+		if (get_gvariant_items(&subiter, DBUS_TYPE_BYTE, (void*)ssi->buf, ssi_len) == false) {
+			wpa_printf(MSG_ERROR, "Error while fetching ssi");
+			goto fail;
+		}
+		ssi->used= ssi_len;
+	}
+	wpa_printf(MSG_INFO, "service_name:[%s]", service_name);
+	wpa_printf(MSG_INFO, "srv_proto_type:[%u]", srv_proto_type);
+	wpa_printf(MSG_INFO, "active:[%d]", is_active);
+	wpa_printf(MSG_INFO, "ttl:[%u]", ttl);
+	wpa_printf(MSG_INFO, "freq:[%u]", freq);
+	wpa_printf(MSG_INFO, "ssi_len:[%u]", ssi_len);
+	wpa_hexdump(MSG_MSGDUMP, "publish_ssi:", ssi->buf, ssi_len);
+
+	params.active = is_active;
+	params.ttl = ttl;
+	params.freq = freq;
+
+	subscribe_id = wpas_nan_usd_subscribe(wpa_s, service_name,
+					      srv_proto_type, ssi,
+					      &params);
+	if (subscribe_id > 0) {
+		DBusMessage *reply;
+		reply = dbus_message_new_method_return(message);
+		dbus_message_append_args(reply, DBUS_TYPE_INT32,
+					 &subscribe_id, DBUS_TYPE_INVALID);
+		return reply;
+	}
+fail:
+	wpabuf_free(ssi);
+	return wpas_dbus_error_unknown_error(
+			message, "error subscribing nan-usd");
+}
+
+
+/*
+ * wpas_dbus_handler_nan_cancel_subscribe - Cancel the subscription
+ * @message: Pointer to incoming dbus message
+ * @wpa_s: wpa_supplicant structure for a network interface
+ * Returns: NULL indicating success or DBus error message on failure
+ *
+ * Handler function for "NANCancelSubscribe" method call of network interface.
+ */
+DBusMessage *
+wpas_dbus_handler_nan_cancel_subscribe(DBusMessage *message,
+				       struct wpa_supplicant *wpa_s)
+{
+	int subscribe_id = -1;
+
+	wpa_printf(MSG_INFO, "DBUS NAN_CANCEL_SUBSCRIBE:");
+
+	if (!dbus_message_get_args(message, NULL,
+				   DBUS_TYPE_INT32, &subscribe_id,
+				   DBUS_TYPE_INVALID)) {
+		wpa_printf(MSG_DEBUG, " DBUS NAN_CANCEL_SUBSCRIBE, failed to get args ");
+		return NULL;
+	}
+
+	if ((!wpa_s->nan_de)||(subscribe_id == -1))
+		return NULL;
+	nan_de_cancel_subscribe(wpa_s->nan_de, subscribe_id);
+	return NULL;
+}
+
+
+/*
+ * wpas_dbus_handler_nan_transmit - Send out nan-followup packets
+ * @message: Pointer to incoming dbus message
+ * @wpa_s: wpa_supplicant structure for a network interface
+ * Returns: NULL indicating success or DBus error message on failure
+ *
+ * Handler function for "NANTransmit" method call of network interface.
+ */
+DBusMessage * wpas_dbus_handler_nan_transmit(DBusMessage *message,
+					     struct wpa_supplicant *wpa_s)
+{
+	int handle = 0;
+	int req_instance_id = 0;
+	struct wpabuf *ssi = NULL;
+	u8 peer_addr[ETH_ALEN];
+	char* paddr_msg;
+	int ret = -1;
+	u16 ssilen;
+
+	DBusMessageIter	iter, subiter;
+
+	wpa_printf(MSG_INFO, "DBUS NAN_TRANSMIT:");
+
+	// Get the parameters from dbus
+	dbus_message_iter_init(message, &iter);
+	if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_STRUCT) {
+		wpa_printf(MSG_INFO, "Unexpected, arg is not struct");
+		goto fail;
+	}
+	// Open the structure
+	dbus_message_iter_recurse(&iter, &subiter);
+	// Extract the elements
+	if (get_gvariant_items(&subiter, DBUS_TYPE_BYTE, (void*)&handle, sizeof(u8)) == false) {
+		wpa_printf(MSG_ERROR, "Error while fetching handle");
+		goto fail;
+	}
+	if (get_gvariant_items(&subiter, DBUS_TYPE_BYTE, (void*)&req_instance_id, sizeof(u8)) == false) {
+		wpa_printf(MSG_ERROR, "Error while fetching req_instance_id");
+		goto fail;
+	}
+	if (get_gvariant_items(&subiter, DBUS_TYPE_STRING, (void*)&paddr_msg, sizeof(&paddr_msg)) == false) {
+		wpa_printf(MSG_ERROR, "Error while fetching paddr_msg");
+		goto fail;
+	}
+	if (hwaddr_aton(paddr_msg, peer_addr) < 0) {
+		wpa_printf(MSG_ERROR, "Error while converting peer address");
+		goto fail;
+	}
+	if (get_gvariant_items(&subiter, DBUS_TYPE_UINT16, (void*)&ssilen, sizeof(u16)) == false) {
+		wpa_printf(MSG_ERROR, "Error while fetching ssilen");
+		goto fail;
+	}
+	ssi = wpabuf_alloc(ssilen);
+	if (ssi == NULL) {
+		wpa_printf(MSG_ERROR, "Fail to allocate ssi_buf(%u)", ssilen);
+		goto fail;
+	}
+	if (get_gvariant_items(&subiter, DBUS_TYPE_BYTE, (void*)ssi->buf, ssilen) == false) {
+		wpa_printf(MSG_ERROR, "Error while fetching ssi");
+		goto fail;
+	}
+	ssi->used= ssilen;
+
+	if (handle <= 0) {
+		wpa_printf(MSG_INFO,
+			"CTRL: Invalid or missing NAN_TRANSMIT handle");
+		goto fail;
+	}
+
+	if (is_zero_ether_addr(peer_addr)) {
+		wpa_printf(MSG_INFO,
+			"CTRL: Invalid or missing NAN_TRANSMIT address");
+		goto fail;
+	}
+
+	ret = wpas_nan_usd_transmit(wpa_s, handle, ssi, NULL, peer_addr,
+				    req_instance_id);
+fail:
+	wpa_printf(MSG_INFO, "DBUS NAN_TRANSMIT Done, %d", ret);
+	wpabuf_free(ssi);
+	return wpas_dbus_error_unknown_error(
+			message, "error sending follow-up packets");
+}
+
+#endif /* CONFIG_NAN_USD */
+
+
 #ifdef CONFIG_TDLS
 
 static int get_peer_hwaddr_helper(DBusMessage *message, const char *func_name,
diff --git a/wpa_supplicant/dbus/dbus_new_handlers.h b/wpa_supplicant/dbus/dbus_new_handlers.h
index 97fa337bd..42218495a 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers.h
+++ b/wpa_supplicant/dbus/dbus_new_handlers.h
@@ -285,4 +285,18 @@ DBusMessage * wpas_dbus_handler_subscribe_preq(
 DBusMessage * wpas_dbus_handler_unsubscribe_preq(
 	DBusMessage *message, struct wpa_supplicant *wpa_s);
 
+DBusMessage * wpas_dbus_handler_nan_publish(DBusMessage *message,
+					    struct wpa_supplicant *wpa_s);
+DBusMessage * wpas_dbus_handler_nan_cancel_publish(
+	DBusMessage *message, struct wpa_supplicant *wpa_s);
+DBusMessage * wpas_dbus_handler_nan_update_publish(
+	DBusMessage *message, struct wpa_supplicant *wpa_s);
+DBusMessage * wpas_dbus_handler_nan_subscribe(DBusMessage *message,
+					      struct wpa_supplicant *wpa_s);
+DBusMessage *
+wpas_dbus_handler_nan_cancel_subscribe(DBusMessage *message,
+				       struct wpa_supplicant *wpa_s);
+DBusMessage * wpas_dbus_handler_nan_transmit(DBusMessage *message,
+					     struct wpa_supplicant *wpa_s);
+
 #endif /* CTRL_IFACE_DBUS_HANDLERS_NEW_H */
diff --git a/wpa_supplicant/dbus/dbus_new_helpers.h b/wpa_supplicant/dbus/dbus_new_helpers.h
index c8d44a00b..c45beeadc 100644
--- a/wpa_supplicant/dbus/dbus_new_helpers.h
+++ b/wpa_supplicant/dbus/dbus_new_helpers.h
@@ -112,6 +112,30 @@ struct wpa_dbus_property_desc {
 #define WPA_DBUS_PROPERTIES_SET "Set"
 #define WPA_DBUS_PROPERTIES_GETALL "GetAll"
 
+struct wpa_dbus_discov_info {
+	u32 subscribe_id;
+	u32 peer_publish_id;
+	u8 peer_addr[ETH_ALEN];
+	bool fsd;
+	bool fsd_gas;
+	u32 ssi_len;
+};
+
+struct wpa_dbus_reply_info {
+	u32 publish_id;
+	u32 peer_subscribe_id;
+	u8 peer_addr[ETH_ALEN];
+	u32 ssi_len;
+};
+
+
+struct wpa_dbus_nanrx_info {
+	u32 id;
+	u32 peer_id;
+	u8 peer_addr[ETH_ALEN];
+	u32 ssi_len;
+};
+
 void free_dbus_object_desc(struct wpa_dbus_object_desc *obj_dsc);
 
 int wpa_dbus_ctrl_iface_init(struct wpas_dbus_priv *iface, char *dbus_path,
diff --git a/wpa_supplicant/notify.c b/wpa_supplicant/notify.c
index 7a1222f37..91630246d 100644
--- a/wpa_supplicant/notify.c
+++ b/wpa_supplicant/notify.c
@@ -1062,6 +1062,11 @@ void wpas_notify_nan_discovery_result(struct wpa_supplicant *wpa_s,
 		subscribe_id, peer_publish_id, MAC2STR(peer_addr),
 		fsd, fsd_gas, srv_proto_type, ssi_hex);
 	os_free(ssi_hex);
+
+	wpas_dbus_signal_nan_discovery_result(wpa_s, subscribe_id,
+					      peer_publish_id, peer_addr,
+					      fsd, fsd_gas,
+					      ssi, ssi_len);
 }
 
 
@@ -1084,6 +1089,10 @@ void wpas_notify_nan_replied(struct wpa_supplicant *wpa_s,
 		publish_id, MAC2STR(peer_addr), peer_subscribe_id,
 		srv_proto_type, ssi_hex);
 	os_free(ssi_hex);
+
+	wpas_dbus_signal_nan_replied(wpa_s, publish_id,
+					      peer_subscribe_id, peer_addr,
+					      ssi, ssi_len);
 }
 
 
@@ -1102,6 +1111,9 @@ void wpas_notify_nan_receive(struct wpa_supplicant *wpa_s, int id,
 		"id=%d peer_instance_id=%d address=" MACSTR " ssi=%s",
 		id, peer_instance_id, MAC2STR(peer_addr), ssi_hex);
 	os_free(ssi_hex);
+
+	wpas_dbus_signal_nan_receive(wpa_s, id, peer_instance_id, peer_addr,
+				     ssi, ssi_len);
 }
 
 
@@ -1127,6 +1139,8 @@ void wpas_notify_nan_publish_terminated(struct wpa_supplicant *wpa_s,
 	wpa_msg(wpa_s, MSG_INFO, NAN_PUBLISH_TERMINATED
 		"publish_id=%d reason=%s",
 		publish_id, nan_reason_txt(reason));
+
+	wpas_dbus_signal_nan_publish_terminated(wpa_s, publish_id, reason);
 }
 
 
@@ -1137,6 +1151,8 @@ void wpas_notify_nan_subscribe_terminated(struct wpa_supplicant *wpa_s,
 	wpa_msg(wpa_s, MSG_INFO, NAN_SUBSCRIBE_TERMINATED
 		"subscribe_id=%d reason=%s",
 		subscribe_id, nan_reason_txt(reason));
+
+	wpas_dbus_signal_nan_subscribe_terminated(wpa_s, subscribe_id, reason);
 }
 
 #endif /* CONFIG_NAN_USD */
-- 
2.21.0.windows.1


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux