wpa_supplicant / hostapd  2.5
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Functions
p2p_parse.c File Reference

P2P - IE parser. More...

#include "includes.h"
#include "common.h"
#include "common/ieee802_11_defs.h"
#include "common/ieee802_11_common.h"
#include "wps/wps_i.h"
#include "p2p_i.h"

Functions

int p2p_parse_p2p_ie (const struct wpabuf *buf, struct p2p_message *msg)
 Parse P2P IE. More...
 
int p2p_parse_ies (const u8 *data, size_t len, struct p2p_message *msg)
 Parse P2P message IEs (both WPS and P2P IE) More...
 
int p2p_parse (const u8 *data, size_t len, struct p2p_message *msg)
 Parse a P2P Action frame contents. More...
 
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)
 Free temporary data from P2P parsing. More...
 
int p2p_group_info_parse (const u8 *gi, size_t gi_len, struct p2p_group_info *info)
 
int p2p_attr_text (struct wpabuf *data, char *buf, char *end)
 Build text format description of P2P IE attributes. More...
 
int p2p_get_cross_connect_disallowed (const struct wpabuf *p2p_ie)
 Does WLAN AP disallows cross connection. More...
 
u8 p2p_get_group_capab (const struct wpabuf *p2p_ie)
 Get Group Capability from P2P IE data. More...
 
const u8 * p2p_get_go_dev_addr (const struct wpabuf *p2p_ie)
 Get P2P Device Address from P2P IE data. More...
 

Detailed Description

P2P - IE parser.

Function Documentation

int p2p_attr_text ( struct wpabuf data,
char *  buf,
char *  end 
)

Build text format description of P2P IE attributes.

Parameters
dataP2P IE contents
bufBuffer for returning text
endPointer to the end of the buf area
Returns
Number of octets written to the buffer or -1 on faikure

This function can be used to parse P2P IE contents into text format field=value lines.

int p2p_get_cross_connect_disallowed ( const struct wpabuf p2p_ie)

Does WLAN AP disallows cross connection.

Parameters
p2p_ieP2P IE(s) contents
Returns
0 if cross connection is allow, 1 if not
const u8* p2p_get_go_dev_addr ( const struct wpabuf p2p_ie)

Get P2P Device Address from P2P IE data.

Parameters
p2p_ieP2P IE(s) contents
Returns
Pointer to P2P Device Address or NULL if not included
u8 p2p_get_group_capab ( const struct wpabuf p2p_ie)

Get Group Capability from P2P IE data.

Parameters
p2p_ieP2P IE(s) contents
Returns
Group Capability
int p2p_parse ( const u8 *  data,
size_t  len,
struct p2p_message msg 
)

Parse a P2P Action frame contents.

Parameters
dataAction frame payload after Category and Code fields
lenLength of data buffer in octets
msgBuffer for returning parsed attributes
Returns
0 on success, -1 on failure

Note: Caller must free temporary memory allocations by calling p2p_parse_free() when the parsed data is not needed anymore.

void p2p_parse_free ( struct p2p_message msg)

Free temporary data from P2P parsing.

Parameters
msgParsed attributes
int p2p_parse_ies ( const u8 *  data,
size_t  len,
struct p2p_message msg 
)

Parse P2P message IEs (both WPS and P2P IE)

Parameters
dataIEs from the message
lenLength of data buffer in octets
msgBuffer for returning parsed attributes
Returns
0 on success, -1 on failure

Note: Caller is responsible for clearing the msg data structure before calling this function.

Note: Caller must free temporary memory allocations by calling p2p_parse_free() when the parsed data is not needed anymore.

int p2p_parse_p2p_ie ( const struct wpabuf buf,
struct p2p_message msg 
)

Parse P2P IE.

Parameters
bufConcatenated P2P IE(s) payload
msgBuffer for returning parsed attributes
Returns
0 on success, -1 on failure

Note: Caller is responsible for clearing the msg data structure before calling this function.