P2P NFC: Report handover select from tag for static handover

WPS_NFC_TAG_READ can be used to report static connection handover where
the connection handover select message was read from an NFC tag.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2013-04-27 18:38:41 +03:00 committed by Jouni Malinen
parent db6ae69e6b
commit dd37a93884
3 changed files with 20 additions and 0 deletions

View file

@ -7265,6 +7265,16 @@ static int wpas_p2p_nfc_connection_handover(struct wpa_supplicant *wpa_s,
} }
int wpas_p2p_nfc_tag_process(struct wpa_supplicant *wpa_s,
const struct wpabuf *data)
{
if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL)
return -1;
return wpas_p2p_nfc_connection_handover(wpa_s, data, 1, 1);
}
int wpas_p2p_nfc_report_handover(struct wpa_supplicant *wpa_s, int init, int wpas_p2p_nfc_report_handover(struct wpa_supplicant *wpa_s, int init,
const struct wpabuf *req, const struct wpabuf *req,
const struct wpabuf *sel) const struct wpabuf *sel)

View file

@ -152,6 +152,8 @@ struct wpabuf * wpas_p2p_nfc_handover_req(struct wpa_supplicant *wpa_s,
int ndef); int ndef);
struct wpabuf * wpas_p2p_nfc_handover_sel(struct wpa_supplicant *wpa_s, struct wpabuf * wpas_p2p_nfc_handover_sel(struct wpa_supplicant *wpa_s,
int ndef, int tag); int ndef, int tag);
int wpas_p2p_nfc_tag_process(struct wpa_supplicant *wpa_s,
const struct wpabuf *data);
int wpas_p2p_nfc_report_handover(struct wpa_supplicant *wpa_s, int init, int wpas_p2p_nfc_report_handover(struct wpa_supplicant *wpa_s, int init,
const struct wpabuf *req, const struct wpabuf *req,
const struct wpabuf *sel); const struct wpabuf *sel);

View file

@ -2281,6 +2281,14 @@ int wpas_wps_nfc_tag_read(struct wpa_supplicant *wpa_s,
/* Assume this contains full NDEF record */ /* Assume this contains full NDEF record */
tmp = ndef_parse_wifi(data); tmp = ndef_parse_wifi(data);
if (tmp == NULL) { if (tmp == NULL) {
#ifdef CONFIG_P2P
tmp = ndef_parse_p2p(data);
if (tmp) {
ret = wpas_p2p_nfc_tag_process(wpa_s, tmp);
wpabuf_free(tmp);
return ret;
}
#endif /* CONFIG_P2P */
wpa_printf(MSG_DEBUG, "WPS: Could not parse NDEF"); wpa_printf(MSG_DEBUG, "WPS: Could not parse NDEF");
return -1; return -1;
} }