P2P NFC: Add OOB GO Negotiation Channel attribute
Add definition and helper functions for the new OOB GO Negotiation Channel attribute. Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
14d8645f63
commit
9e323a24cd
4 changed files with 44 additions and 0 deletions
|
@ -926,6 +926,7 @@ enum p2p_attr_id {
|
||||||
P2P_ATTR_INTERFACE = 16,
|
P2P_ATTR_INTERFACE = 16,
|
||||||
P2P_ATTR_OPERATING_CHANNEL = 17,
|
P2P_ATTR_OPERATING_CHANNEL = 17,
|
||||||
P2P_ATTR_INVITATION_FLAGS = 18,
|
P2P_ATTR_INVITATION_FLAGS = 18,
|
||||||
|
P2P_ATTR_OOB_GO_NEG_CHANNEL = 19,
|
||||||
P2P_ATTR_VENDOR_SPECIFIC = 221
|
P2P_ATTR_VENDOR_SPECIFIC = 221
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -971,6 +972,12 @@ enum p2p_status_code {
|
||||||
P2P_SC_FAIL_REJECTED_BY_USER = 11,
|
P2P_SC_FAIL_REJECTED_BY_USER = 11,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum p2p_role_indication {
|
||||||
|
P2P_DEVICE_NOT_IN_GROUP = 0x00,
|
||||||
|
P2P_CLIENT_IN_A_GROUP = 0x01,
|
||||||
|
P2P_GO_IN_A_GROUP = 0x02,
|
||||||
|
};
|
||||||
|
|
||||||
#define P2P_WILDCARD_SSID "DIRECT-"
|
#define P2P_WILDCARD_SSID "DIRECT-"
|
||||||
#define P2P_WILDCARD_SSID_LEN 7
|
#define P2P_WILDCARD_SSID_LEN 7
|
||||||
|
|
||||||
|
|
|
@ -328,6 +328,23 @@ void p2p_buf_add_p2p_interface(struct wpabuf *buf, struct p2p_data *p2p)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void p2p_buf_add_oob_go_neg_channel(struct wpabuf *buf, const char *country,
|
||||||
|
u8 oper_class, u8 channel,
|
||||||
|
enum p2p_role_indication role)
|
||||||
|
{
|
||||||
|
/* OOB Group Owner Negotiation Channel */
|
||||||
|
wpabuf_put_u8(buf, P2P_ATTR_OOB_GO_NEG_CHANNEL);
|
||||||
|
wpabuf_put_le16(buf, 6);
|
||||||
|
wpabuf_put_data(buf, country, 3);
|
||||||
|
wpabuf_put_u8(buf, oper_class); /* Operating Class */
|
||||||
|
wpabuf_put_u8(buf, channel); /* Channel Number */
|
||||||
|
wpabuf_put_u8(buf, (u8) role); /* Role indication */
|
||||||
|
wpa_printf(MSG_DEBUG, "P2P: * OOB GO Negotiation Channel: Operating "
|
||||||
|
"Class %u Channel %u Role %d",
|
||||||
|
oper_class, channel, role);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int p2p_add_wps_string(struct wpabuf *buf, enum wps_attribute attr,
|
static int p2p_add_wps_string(struct wpabuf *buf, enum wps_attribute attr,
|
||||||
const char *val)
|
const char *val)
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
#include "utils/list.h"
|
#include "utils/list.h"
|
||||||
#include "p2p.h"
|
#include "p2p.h"
|
||||||
|
|
||||||
|
enum p2p_role_indication;
|
||||||
|
|
||||||
enum p2p_go_state {
|
enum p2p_go_state {
|
||||||
UNKNOWN_GO,
|
UNKNOWN_GO,
|
||||||
LOCAL_GO,
|
LOCAL_GO,
|
||||||
|
@ -503,6 +505,8 @@ struct p2p_message {
|
||||||
|
|
||||||
const u8 *minor_reason_code;
|
const u8 *minor_reason_code;
|
||||||
|
|
||||||
|
const u8 *oob_go_neg_channel;
|
||||||
|
|
||||||
/* P2P Device Info */
|
/* P2P Device Info */
|
||||||
const u8 *p2p_device_info;
|
const u8 *p2p_device_info;
|
||||||
size_t p2p_device_info_len;
|
size_t p2p_device_info_len;
|
||||||
|
@ -636,6 +640,9 @@ void p2p_buf_add_noa(struct wpabuf *buf, u8 noa_index, u8 opp_ps, u8 ctwindow,
|
||||||
void p2p_buf_add_ext_listen_timing(struct wpabuf *buf, u16 period,
|
void p2p_buf_add_ext_listen_timing(struct wpabuf *buf, u16 period,
|
||||||
u16 interval);
|
u16 interval);
|
||||||
void p2p_buf_add_p2p_interface(struct wpabuf *buf, struct p2p_data *p2p);
|
void p2p_buf_add_p2p_interface(struct wpabuf *buf, struct p2p_data *p2p);
|
||||||
|
void p2p_buf_add_oob_go_neg_channel(struct wpabuf *buf, const char *country,
|
||||||
|
u8 oper_class, u8 channel,
|
||||||
|
enum p2p_role_indication role);
|
||||||
int p2p_build_wps_ie(struct p2p_data *p2p, struct wpabuf *buf, int pw_id,
|
int p2p_build_wps_ie(struct p2p_data *p2p, struct wpabuf *buf, int pw_id,
|
||||||
int all_attr);
|
int all_attr);
|
||||||
|
|
||||||
|
|
|
@ -268,6 +268,19 @@ static int p2p_parse_attribute(u8 id, const u8 *data, u16 len,
|
||||||
wpa_printf(MSG_DEBUG, "P2P: * Minor Reason Code: %u",
|
wpa_printf(MSG_DEBUG, "P2P: * Minor Reason Code: %u",
|
||||||
*msg->minor_reason_code);
|
*msg->minor_reason_code);
|
||||||
break;
|
break;
|
||||||
|
case P2P_ATTR_OOB_GO_NEG_CHANNEL:
|
||||||
|
if (len < 6) {
|
||||||
|
wpa_printf(MSG_DEBUG, "P2P: Too short OOB GO Neg "
|
||||||
|
"Channel attribute (length %d)", len);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
msg->oob_go_neg_channel = data;
|
||||||
|
wpa_printf(MSG_DEBUG, "P2P: * OOB GO Neg Channel: "
|
||||||
|
"Country %c%c(0x%02x) Operating Class %d "
|
||||||
|
"Channel Number %d Role %d",
|
||||||
|
data[0], data[1], data[2], data[3], data[4],
|
||||||
|
data[5]);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
wpa_printf(MSG_DEBUG, "P2P: Skipped unknown attribute %d "
|
wpa_printf(MSG_DEBUG, "P2P: Skipped unknown attribute %d "
|
||||||
"(length %d)", id, len);
|
"(length %d)", id, len);
|
||||||
|
|
Loading…
Reference in a new issue