P2P: Add wpas_notify_p2p_provision_discovery()

Add a notification for P2P provision discovery status/result.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Johannes Berg 2011-06-12 14:31:56 -07:00 committed by Jouni Malinen
parent 349b213cc8
commit dd8a7e0547
3 changed files with 47 additions and 0 deletions

View file

@ -415,6 +415,27 @@ void wpas_notify_p2p_sd_response(struct wpa_supplicant *wpa_s,
{
}
/**
* wpas_notify_p2p_provision_discovery - Notification of provision discovery
* @dev_addr: Who sent the request or responded to our request.
* @request: Will be 1 if request, 0 for response.
* @status: Valid only in case of response (0 in case of success)
* @config_methods: WPS config methods
* @generated_pin: PIN to be displayed in case of WPS_CONFIG_DISPLAY method
*
* This can be used to notify:
* - Requests or responses
* - Various config methods
* - Failure condition in case of response
*/
void wpas_notify_p2p_provision_discovery(struct wpa_supplicant *wpa_s,
const u8 *dev_addr, int request,
enum p2p_prov_disc_status status,
u16 config_methods,
unsigned int generated_pin)
{
}
#endif /* CONFIG_P2P */

View file

@ -15,6 +15,8 @@
#ifndef NOTIFY_H
#define NOTIFY_H
#include "p2p/p2p.h"
struct wps_credential;
struct wps_event_m2d;
struct wps_event_fail;
@ -101,5 +103,10 @@ void wpas_notify_p2p_sd_request(struct wpa_supplicant *wpa_s,
void wpas_notify_p2p_sd_response(struct wpa_supplicant *wpa_s,
const u8 *sa, u16 update_indic,
const u8 *tlvs, size_t tlvs_len);
void wpas_notify_p2p_provision_discovery(struct wpa_supplicant *wpa_s,
const u8 *dev_addr, int request,
enum p2p_prov_disc_status status,
u16 config_methods,
unsigned int generated_pin);
#endif /* NOTIFY_H */

View file

@ -1893,6 +1893,10 @@ void wpas_prov_disc_req(void *ctx, const u8 *peer, u16 config_methods,
else if (config_methods & WPS_CONFIG_PUSHBUTTON)
wpa_msg(wpa_s, MSG_INFO, P2P_EVENT_PROV_DISC_PBC_REQ MACSTR
"%s", MAC2STR(peer), params);
wpas_notify_p2p_provision_discovery(wpa_s, peer, 1 /* request */,
P2P_PROV_DISC_SUCCESS,
config_methods, generated_pin);
}
@ -1910,6 +1914,10 @@ void wpas_prov_disc_resp(void *ctx, const u8 *peer, u16 config_methods)
wpa_msg(wpa_s, MSG_INFO, P2P_EVENT_PROV_DISC_PBC_RESP MACSTR,
MAC2STR(peer));
wpas_notify_p2p_provision_discovery(wpa_s, peer, 0 /* response */,
P2P_PROV_DISC_SUCCESS,
config_methods, generated_pin);
if (wpa_s->pending_pd_before_join &&
(os_memcmp(peer, wpa_s->pending_join_dev_addr, ETH_ALEN) == 0 ||
os_memcmp(peer, wpa_s->pending_join_iface_addr, ETH_ALEN) == 0)) {
@ -1921,6 +1929,16 @@ void wpas_prov_disc_resp(void *ctx, const u8 *peer, u16 config_methods)
}
void wpas_prov_disc_fail(void *ctx, const u8 *peer,
enum p2p_prov_disc_status status)
{
struct wpa_supplicant *wpa_s = ctx;
wpas_notify_p2p_provision_discovery(wpa_s, peer, 0 /* response */,
status, 0, 0);
}
static u8 wpas_invitation_process(void *ctx, const u8 *sa, const u8 *bssid,
const u8 *go_dev_addr, const u8 *ssid,
size_t ssid_len, int *go, u8 *group_bssid,
@ -2356,6 +2374,7 @@ int wpas_p2p_init(struct wpa_global *global, struct wpa_supplicant *wpa_s)
p2p.sd_response = wpas_sd_response;
p2p.prov_disc_req = wpas_prov_disc_req;
p2p.prov_disc_resp = wpas_prov_disc_resp;
p2p.prov_disc_fail = wpas_prov_disc_fail;
p2p.invitation_process = wpas_invitation_process;
p2p.invitation_received = wpas_invitation_received;
p2p.invitation_result = wpas_invitation_result;