]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Add method to signal lost device
authorJohannes Berg <johannes.berg@intel.com>
Thu, 24 Feb 2011 20:22:16 +0000 (22:22 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 24 Feb 2011 20:22:16 +0000 (22:22 +0200)
This signal is used to notify users of the P2P
state machine or wpa_supplicant of lost devices.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
src/p2p/p2p.c
src/p2p/p2p.h
wpa_supplicant/notify.c
wpa_supplicant/notify.h
wpa_supplicant/p2p_supplicant.c

index 76cdf277a0b62b8166c1825bff1d8069bfe9a774..3211ba2840bd151f5007ad2e3abcfb1f44b5b427 100644 (file)
@@ -560,6 +560,8 @@ static void p2p_device_free(struct p2p_data *p2p, struct p2p_device *dev)
        if (p2p->pending_client_disc_go == dev)
                p2p->pending_client_disc_go = NULL;
 
+       p2p->cfg->dev_lost(p2p->cfg->cb_ctx, dev->info.p2p_device_addr);
+
        os_free(dev);
 }
 
index 0d09d1e941b82a69c32e91ed434dd94afaed3fea..f41e64d6abb331b1df046acdbb452af265499263 100644 (file)
@@ -441,6 +441,15 @@ struct p2p_config {
                          const struct p2p_peer_info *info,
                          int new_device);
 
+       /**
+        * dev_lost - Notification of a lost P2P Device
+        * @ctx: Callback context from cb_ctx
+        * @dev_addr: P2P Device Address of the lost P2P Device
+        *
+        * This callback is used to notify that a P2P Device has been deleted.
+        */
+       void (*dev_lost)(void *ctx, const u8 *dev_addr);
+
        /**
         * go_neg_req_rx - Notification of a receive GO Negotiation Request
         * @ctx: Callback context from cb_ctx
index 657708a95a7a0a70e4f1ec5284ea3ca168ba17ca..f69306090287e11a00d857cf0364ad9723039f87 100644 (file)
@@ -351,8 +351,16 @@ void wpas_notify_resume(struct wpa_global *global)
 
 
 #ifdef CONFIG_P2P
+
 void wpas_notify_p2p_device_found(struct wpa_supplicant *wpa_s,
                                  const u8 *dev_addr, int new_device)
 {
 }
+
+
+void wpas_notify_p2p_device_lost(struct wpa_supplicant *wpa_s,
+                                const u8 *dev_addr)
+{
+}
+
 #endif /* CONFIG_P2P */
index 9dfae1cac05279bc2e1bc56e4fd2360055880e50..b423830b0aed51573b3d9763d42c16e1af79ba2e 100644 (file)
@@ -80,5 +80,7 @@ void wpas_notify_resume(struct wpa_global *global);
 
 void wpas_notify_p2p_device_found(struct wpa_supplicant *wpa_s,
                                  const u8 *dev_addr, int new_device);
+void wpas_notify_p2p_device_lost(struct wpa_supplicant *wpa_s,
+                                const u8 *dev_addr);
 
 #endif /* NOTIFY_H */
index d5061bceac06eeb6e4f2395680d5a2e865ef6a93..a7d07ecf36b6fa07146ba8e6f18c944c186683d8 100644 (file)
@@ -1151,6 +1151,14 @@ void wpas_dev_found(void *ctx, const u8 *addr,
 }
 
 
+static void wpas_dev_lost(void *ctx, const u8 *dev_addr)
+{
+       struct wpa_supplicant *wpa_s = ctx;
+
+       wpas_notify_p2p_device_lost(wpa_s, dev_addr);
+}
+
+
 static int wpas_start_listen(void *ctx, unsigned int freq,
                             unsigned int duration,
                             const struct wpabuf *probe_resp_ie)
@@ -2331,6 +2339,7 @@ int wpas_p2p_init(struct wpa_global *global, struct wpa_supplicant *wpa_s)
        p2p.go_neg_completed = wpas_go_neg_completed;
        p2p.go_neg_req_rx = wpas_go_neg_req_rx;
        p2p.dev_found = wpas_dev_found;
+       p2p.dev_lost = wpas_dev_lost;
        p2p.start_listen = wpas_start_listen;
        p2p.stop_listen = wpas_stop_listen;
        p2p.send_probe_resp = wpas_send_probe_resp;