[PATCH 2/3] dbus: Enabled dpp functions

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

 



From: "jeonghwan.yoon" <jeonghwan.yoon@xxxxxxx>

Added dbus signals to report general dpp process.

Signed-off-by: jeonghwan.yoon <jeonghwan.yoon@xxxxxxx>
---
 doc/dbus.doxygen               |  65 +++++++++++++++++++
 wpa_supplicant/dbus/dbus_new.c | 140 +++++++++++++++++++++++++++++++++++++++++
 wpa_supplicant/dbus/dbus_new.h |  30 +++++++++
 3 files changed, 235 insertions(+)

diff --git a/doc/dbus.doxygen b/doc/dbus.doxygen
index 7905557..3d1cd2d 100644
--- a/doc/dbus.doxygen
+++ b/doc/dbus.doxygen
@@ -1427,6 +1427,71 @@ Interface for performing DPP (Device Provisioning Protocol) Device operations.
   </li>
 
 </ul>
+\subsection dbus_dppdevice_signals Signals
+
+<ul>
+  <li>
+    <h3>DppTx ( s : dst mac, u : frequency, i : type )</h3>
+    <p> Transmission of the dpp action frame was successful.</p>
+    <h4>Arguments</h4>
+    <dl>
+      <dt>s : dst mac</dt>
+      <dd>destination mac address.</dd>
+    </dl>
+    <dl>
+      <dt>u : frequency</dt>
+      <dd>operating frequency.</dd>
+    </dl>
+    <dl>
+      <dt>i : type</dt>
+      <dd>type number of the transmitted public frame</dd>
+    </dl>
+  </li>
+  <li>
+    <h3>DppTxStatus ( s : dst mac, u : frequency, s : status )</h3>
+    <p> Transmission of the dpp action frame was successful.</p>
+    <h4>Arguments</h4>
+    <dl>
+      <dt>s : dst mac</dt>
+      <dd>destination mac address.</dd>
+    </dl>
+    <dl>
+      <dt>u : frequency</dt>
+      <dd>operating frequency.</dd>
+    </dl>
+    <dl>
+      <dt>s : result</dt>
+      <dd>transmission status : "SUCCESS", "no-ACK", "FAILED"</dd>
+    </dl>
+  </li>
+  <li>
+    <h3>DppRx ( s : src mac, u : frequency, i : type )</h3>
+    <p> Received the dpp action frame.</p>
+    <h4>Arguments</h4>
+    <dl>
+      <dt>s : src mac</dt>
+      <dd>source mac address.</dd>
+    </dl>
+    <dl>
+      <dt>u : frequency</dt>
+      <dd>operating frequency.</dd>
+    </dl>
+    <dl>
+      <dt>i : type</dt>
+      <dd>type number of the transmitted public frame</dd>
+    </dl>
+  </li>
+  <li>
+    <h3>DppFailed ( s : message )</h3>
+    <p> Failed in dpp process.</p>
+    <h4>Arguments</h4>
+    <dl>
+      <dt>s : message</dt>
+      <dd>reason of failed.</dd>
+    </dl>
+  </li>  
+
+</ul>
 \section dbus_p2pdevice fi.w1.wpa_supplicant1.Interface.P2PDevice
 
 Interface for performing P2P (Wi-Fi Peer-to-Peer) P2P Device operations.
diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c
index 67bef7b..3ee7796 100644
--- a/wpa_supplicant/dbus/dbus_new.c
+++ b/wpa_supplicant/dbus/dbus_new.c
@@ -2109,6 +2109,146 @@ void wpas_dbus_signal_p2p_invitation_received(struct wpa_supplicant *wpa_s,
 
 #endif /* CONFIG_P2P */
 
+#ifdef CONFIG_DPP
+void wpas_dbus_signal_dpp_tx(struct wpa_supplicant *wpa_s,
+						  const u8 *dst, unsigned int freq, int type)
+{
+	DBusMessage *msg;
+	DBusMessageIter iter;
+	struct wpas_dbus_priv *iface;
+	char mac_dst[WPAS_DBUS_OBJECT_PATH_MAX], *mac_dst_p;
+
+	iface = wpa_s->global->dbus;
+
+	/* Do nothing if the control interface is not turned on */
+	if (iface == NULL || !wpa_s->dbus_new_path)
+		return;
+
+	os_snprintf(mac_dst, WPAS_DBUS_OBJECT_PATH_MAX, MACSTR, MAC2STR(dst));
+	mac_dst_p = mac_dst;
+
+	msg = dbus_message_new_signal(wpa_s->dbus_new_path,
+			WPAS_DBUS_NEW_IFACE_DPPDEVICE,
+			"DppTx");
+
+	if (msg == NULL)
+		return;
+
+	dbus_message_iter_init_append(msg, &iter);
+	if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING,
+				&mac_dst_p) ||
+		!dbus_message_iter_append_basic(&iter, DBUS_TYPE_UINT32, &freq) ||
+		!dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32, &type))
+		wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
+	else
+		dbus_connection_send(iface->con, msg, NULL);
+
+	dbus_message_unref(msg);
+}
+
+void wpas_dbus_signal_dpp_tx_status(struct wpa_supplicant *wpa_s,
+						  const u8 *dst, unsigned int freq, const char *res)
+{
+	DBusMessage *msg;
+	DBusMessageIter iter;
+	struct wpas_dbus_priv *iface;
+	char mac_dst[WPAS_DBUS_OBJECT_PATH_MAX], *mac_dst_p;
+
+	iface = wpa_s->global->dbus;
+
+	/* Do nothing if the control interface is not turned on */
+	if (iface == NULL || !wpa_s->dbus_new_path)
+		return;
+
+	os_snprintf(mac_dst, WPAS_DBUS_OBJECT_PATH_MAX, MACSTR, MAC2STR(dst));
+	mac_dst_p = mac_dst;
+
+	msg = dbus_message_new_signal(wpa_s->dbus_new_path,
+								  WPAS_DBUS_NEW_IFACE_DPPDEVICE,
+								  "DppTxStatus");
+	if (msg == NULL)
+		return;
+
+	dbus_message_iter_init_append(msg, &iter);
+
+	if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING,
+				&mac_dst_p) ||
+		!dbus_message_iter_append_basic(&iter, DBUS_TYPE_UINT32,
+				&freq) ||
+		!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING,
+				&res))
+        wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
+	else
+		dbus_connection_send(iface->con, msg, NULL);
+
+	dbus_message_unref(msg);
+}
+
+void wpas_dbus_signal_dpp_rx(struct wpa_supplicant *wpa_s,
+						  const u8 *src, unsigned int freq, int type)
+{
+	DBusMessage *msg;
+	DBusMessageIter iter;
+	struct wpas_dbus_priv *iface;
+	char mac_src[WPAS_DBUS_OBJECT_PATH_MAX], *mac_src_p;
+
+	iface = wpa_s->global->dbus;
+
+	/* Do nothing if the control interface is not turned on */
+	if (iface == NULL || !wpa_s->dbus_new_path)
+		return;
+
+	os_snprintf(mac_src, WPAS_DBUS_OBJECT_PATH_MAX, MACSTR, MAC2STR(src));
+	mac_src_p = mac_src;
+
+	msg = dbus_message_new_signal(wpa_s->dbus_new_path,
+								  WPAS_DBUS_NEW_IFACE_DPPDEVICE,
+								  "DppRx");
+	if (msg == NULL)
+		return;
+
+	dbus_message_iter_init_append(msg, &iter);
+
+	if (!dbus_message_iter_append_basic(&iter, DBUS_TYPE_STRING,
+				&mac_src_p) ||
+		!dbus_message_iter_append_basic(&iter, DBUS_TYPE_UINT32,
+				&freq) ||
+		!dbus_message_iter_append_basic(&iter, DBUS_TYPE_INT32,
+				&type))
+		wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
+	else
+		dbus_connection_send(iface->con, msg, NULL);
+
+	dbus_message_unref(msg);
+}
+
+void wpas_dbus_signal_dpp_failed(struct wpa_supplicant *wpa_s, const char *res)
+{
+	struct wpas_dbus_priv *iface;
+	DBusMessage *msg;
+
+	iface = wpa_s->global->dbus;
+
+	/* Do nothing if the control interface is not turned on */
+	if (iface == NULL || !wpa_s->dbus_new_path)
+		return;
+
+	msg = dbus_message_new_signal(wpa_s->dbus_new_path,
+				 WPAS_DBUS_NEW_IFACE_DPPDEVICE, "DppFailed");
+	if (msg == NULL)
+		return;
+
+	if (dbus_message_append_args(msg, DBUS_TYPE_STRING, &res,
+								 DBUS_TYPE_INVALID)){
+		dbus_connection_send(iface->con, msg, NULL);
+	} else {
+		wpa_printf(MSG_ERROR, "dbus: Failed to construct signal");
+	}
+
+	dbus_message_unref(msg);
+}
+
+#endif /* CONFIG_DPP */
 
 /**
  * wpas_dbus_signal_prop_changed - Signals change of property
diff --git a/wpa_supplicant/dbus/dbus_new.h b/wpa_supplicant/dbus/dbus_new.h
index b53a218..a95270a 100644
--- a/wpa_supplicant/dbus/dbus_new.h
+++ b/wpa_supplicant/dbus/dbus_new.h
@@ -255,6 +255,15 @@ void wpas_dbus_signal_mesh_peer_connected(struct wpa_supplicant *wpa_s,
 void wpas_dbus_signal_mesh_peer_disconnected(struct wpa_supplicant *wpa_s,
 					     const u8 *peer_addr, int reason);
 
+#ifdef CONFIG_DPP
+void wpas_dbus_signal_dpp_tx(struct wpa_supplicant *wpa_s,
+		const u8 *dst, unsigned int freq, int type);
+void wpas_dbus_signal_dpp_tx_status(struct wpa_supplicant *wpa_s,
+		const u8 *dst, unsigned int freq, const char *res);
+void wpas_dbus_signal_dpp_rx(struct wpa_supplicant *wpa_s,
+		const u8 *src, unsigned int freq, int type);
+void wpas_dbus_signal_dpp_failed(struct wpa_supplicant *wpa_s, const char *res);
+#endif /* CONFIG_DPP */
 #else /* CONFIG_CTRL_IFACE_DBUS_NEW */
 
 static inline int wpas_dbus_register_interface(struct wpa_supplicant *wpa_s)
@@ -594,6 +603,27 @@ void wpas_dbus_signal_mesh_peer_disconnected(struct wpa_supplicant *wpa_s,
 {
 }
 
+#ifdef CONFIG_DPP
+static inline
+void wpas_dbus_signal_dpp_tx(struct wpa_supplicant *wpa_s,
+		const u8 *dst, unsigned int freq, int type)
+{
+}
+static inline
+void wpas_dbus_signal_dpp_tx_status(struct wpa_supplicant *wpa_s,
+		const u8 *dst, unsigned int freq, const char *res)
+{
+}
+static inline
+void wpas_dbus_signal_dpp_rx(struct wpa_supplicant *wpa_s,
+		const u8 *src, unsigned int freq, int type)
+{
+}
+static inline
+void wpas_dbus_signal_dpp_failed(struct wpa_supplicant *wpa_s, const char *res)
+{
+}
+#endif /* CONFIG_DPP */
 #endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
 
 #endif /* CTRL_IFACE_DBUS_H_NEW */
-- 
2.7.4


_______________________________________________
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