]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P NFC: Allow separate WPS/P2P IES to be parsed
authorJouni Malinen <jouni@qca.qualcomm.com>
Fri, 15 Feb 2013 15:07:28 +0000 (17:07 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 27 Jan 2014 19:10:56 +0000 (21:10 +0200)
This will be needed for processing the NFC connection handover messages
for P2P.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>

src/p2p/p2p_i.h
src/p2p/p2p_parse.c

index 9e41f26a6725a2f8b153160f71b4b77e2ee053e1..0fa4b70a1d363cd758116578053a32dc5ea9f088 100644 (file)
@@ -585,6 +585,8 @@ int p2p_channel_select(struct p2p_channels *chans, const int *classes,
 int p2p_parse_p2p_ie(const struct wpabuf *buf, struct p2p_message *msg);
 int p2p_parse_ies(const u8 *data, size_t len, struct p2p_message *msg);
 int p2p_parse(const u8 *data, size_t len, struct p2p_message *msg);
+int p2p_parse_ies_separate(const u8 *wsc, size_t wsc_len, const u8 *p2p,
+                          size_t p2p_len, struct p2p_message *msg);
 void p2p_parse_free(struct p2p_message *msg);
 int p2p_attr_text(struct wpabuf *data, char *buf, char *end);
 int p2p_group_info_parse(const u8 *gi, size_t gi_len,
index cdf8b40d52ec5d8fd0bc92745f62fb87306d3962..bc548e8d40e085a2f68e9776a178de643838d619 100644 (file)
@@ -466,6 +466,33 @@ int p2p_parse(const u8 *data, size_t len, struct p2p_message *msg)
 }
 
 
+int p2p_parse_ies_separate(const u8 *wsc, size_t wsc_len, const u8 *p2p,
+                          size_t p2p_len, struct p2p_message *msg)
+{
+       os_memset(msg, 0, sizeof(*msg));
+
+       msg->wps_attributes = wpabuf_alloc_copy(wsc, wsc_len);
+       if (msg->wps_attributes &&
+           p2p_parse_wps_ie(msg->wps_attributes, msg)) {
+               p2p_parse_free(msg);
+               return -1;
+       }
+
+       msg->p2p_attributes = wpabuf_alloc_copy(p2p, p2p_len);
+       if (msg->p2p_attributes &&
+           p2p_parse_p2p_ie(msg->p2p_attributes, msg)) {
+               wpa_printf(MSG_DEBUG, "P2P: Failed to parse P2P IE data");
+               if (msg->p2p_attributes)
+                       wpa_hexdump_buf(MSG_MSGDUMP, "P2P: P2P IE data",
+                                       msg->p2p_attributes);
+               p2p_parse_free(msg);
+               return -1;
+       }
+
+       return 0;
+}
+
+
 /**
  * p2p_parse_free - Free temporary data from P2P parsing
  * @msg: Parsed attributes