From 710ae9ac1f98d6cf8599d7c6b9f1badb4f13eab8 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 18 May 2013 16:06:40 +0300 Subject: [PATCH] P2P: Move p2p_find stopped event message into p2p_supplicant.c This removes wpa_ctrl.h dependency from src/p2p/* and makes the P2P events more consistent, i.e., everything that is aimed for upper layer processing from the wpa_supplicant control interfaces is generated in p2p_supplicant.c. Signed-hostap: Jouni Malinen --- src/p2p/p2p.c | 5 ++--- src/p2p/p2p.h | 6 ++++++ wpa_supplicant/p2p_supplicant.c | 8 ++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c index 539aec4a4..a0b21b025 100644 --- a/src/p2p/p2p.c +++ b/src/p2p/p2p.c @@ -12,7 +12,6 @@ #include "eloop.h" #include "common/ieee802_11_defs.h" #include "common/ieee802_11_common.h" -#include "common/wpa_ctrl.h" #include "wps/wps_i.h" #include "p2p_i.h" #include "p2p.h" @@ -1108,7 +1107,7 @@ int p2p_other_scan_completed(struct p2p_data *p2p) if (p2p_find(p2p, p2p->last_p2p_find_timeout, p2p->find_type, p2p->num_req_dev_types, p2p->req_dev_types, p2p->find_dev_id, p2p->search_delay) < 0) { - wpa_msg(p2p->cfg->msg_ctx, MSG_INFO, P2P_EVENT_FIND_STOPPED); + p2p->cfg->find_stopped(p2p->cfg->cb_ctx); return 0; } return 1; @@ -1123,7 +1122,7 @@ void p2p_stop_find_for_freq(struct p2p_data *p2p, int freq) if (p2p->state == P2P_SEARCH || p2p->state == P2P_CONTINUE_SEARCH_WHEN_READY || p2p->state == P2P_SEARCH_WHEN_READY) - wpa_msg(p2p->cfg->msg_ctx, MSG_INFO, P2P_EVENT_FIND_STOPPED); + p2p->cfg->find_stopped(p2p->cfg->cb_ctx); p2p_set_state(p2p, P2P_IDLE); p2p_free_req_dev_types(p2p); p2p->start_after_scan = P2P_AFTER_SCAN_NOTHING; diff --git a/src/p2p/p2p.h b/src/p2p/p2p.h index eeaa14989..2673bfdaa 100644 --- a/src/p2p/p2p.h +++ b/src/p2p/p2p.h @@ -544,6 +544,12 @@ struct p2p_config { */ void (*dev_lost)(void *ctx, const u8 *dev_addr); + /** + * find_stopped - Notification of a p2p_find operation stopping + * @ctx: Callback context from cb_ctx + */ + void (*find_stopped)(void *ctx); + /** * go_neg_req_rx - Notification of a receive GO Negotiation Request * @ctx: Callback context from cb_ctx diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index db199bdd2..31c241ca8 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -1226,6 +1226,13 @@ static void wpas_dev_lost(void *ctx, const u8 *dev_addr) } +static void wpas_find_stopped(void *ctx) +{ + struct wpa_supplicant *wpa_s = ctx; + wpa_msg(wpa_s, MSG_INFO, P2P_EVENT_FIND_STOPPED); +} + + static int wpas_start_listen(void *ctx, unsigned int freq, unsigned int duration, const struct wpabuf *probe_resp_ie) @@ -2969,6 +2976,7 @@ int wpas_p2p_init(struct wpa_global *global, struct wpa_supplicant *wpa_s) p2p.go_neg_req_rx = wpas_go_neg_req_rx; p2p.dev_found = wpas_dev_found; p2p.dev_lost = wpas_dev_lost; + p2p.find_stopped = wpas_find_stopped; p2p.start_listen = wpas_start_listen; p2p.stop_listen = wpas_stop_listen; p2p.send_probe_resp = wpas_send_probe_resp;