本文整理汇总了C++中p2p_dbg函数的典型用法代码示例。如果您正苦于以下问题:C++ p2p_dbg函数的具体用法?C++ p2p_dbg怎么用?C++ p2p_dbg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了p2p_dbg函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: p2p_prov_disc_req
int p2p_prov_disc_req(struct p2p_data *p2p, const u8 *peer_addr, struct p2ps_provision *p2ps_prov, u16 config_methods, int join, int force_freq, int user_initiated_pd)
{
struct p2p_device *dev;
dev = p2p_get_device(p2p, peer_addr);
if (dev == NULL) {
dev = p2p_get_device_interface(p2p, peer_addr);
}
if (dev == NULL || (dev->flags & P2P_DEV_PROBE_REQ_ONLY)) {
p2p_dbg(p2p, "Provision Discovery Request destination " MACSTR " not yet known", MAC2STR(peer_addr));
os_free(p2ps_prov);
return -1;
}
p2p_dbg(p2p, "Provision Discovery Request with " MACSTR " (config methods 0x%x)", MAC2STR(peer_addr), config_methods);
if (config_methods == 0 && !p2ps_prov) {
os_free(p2ps_prov);
return -1;
}
if (p2ps_prov && p2ps_prov->status == P2P_SC_SUCCESS_DEFERRED && p2p->p2ps_prov) {
/* Use cached method from deferred provisioning */
p2ps_prov->method = p2p->p2ps_prov->method;
}
/* Reset provisioning info */
dev->wps_prov_info = 0;
p2ps_prov_free(p2p);
p2p->p2ps_prov = p2ps_prov;
dev->req_config_methods = config_methods;
if (join) {
dev->flags |= P2P_DEV_PD_FOR_JOIN;
} else {
dev->flags &= ~P2P_DEV_PD_FOR_JOIN;
}
if (p2p->state != P2P_IDLE && p2p->state != P2P_SEARCH && p2p->state != P2P_LISTEN_ONLY) {
p2p_dbg(p2p, "Busy with other operations; postpone Provision Discovery Request with " MACSTR " (config methods 0x%x)", MAC2STR(peer_addr), config_methods);
return 0;
}
p2p->user_initiated_pd = user_initiated_pd;
p2p->pd_force_freq = force_freq;
if (p2p->user_initiated_pd) {
p2p->pd_retries = MAX_PROV_DISC_REQ_RETRIES;
}
/*
* Assign dialog token here to use the same value in each retry within
* the same PD exchange.
*/
dev->dialog_token++;
if (dev->dialog_token == 0) {
dev->dialog_token = 1;
}
return p2p_send_prov_disc_req(p2p, dev, join, force_freq);
}
开发者ID:drashti304,项目名称:TizenRT,代码行数:60,代码来源:p2p_pd.c
示例2: p2p_start_sd
int p2p_start_sd(struct p2p_data *p2p, struct p2p_device *dev)
{
struct wpabuf *req;
int ret = 0;
struct p2p_sd_query *query;
int freq;
unsigned int wait_time;
freq = dev->listen_freq > 0 ? dev->listen_freq : dev->oper_freq;
if (freq <= 0) {
p2p_dbg(p2p, "No Listen/Operating frequency known for the peer "
MACSTR " to send SD Request",
MAC2STR(dev->info.p2p_device_addr));
return -1;
}
query = p2p_pending_sd_req(p2p, dev);
if (query == NULL)
return -1;
if (p2p->state == P2P_SEARCH &&
os_memcmp(p2p->sd_query_no_ack, dev->info.p2p_device_addr,
ETH_ALEN) == 0) {
p2p_dbg(p2p, "Do not start Service Discovery with " MACSTR
" due to it being the first no-ACK peer in this search iteration",
MAC2STR(dev->info.p2p_device_addr));
return -2;
}
p2p_dbg(p2p, "Start Service Discovery with " MACSTR,
MAC2STR(dev->info.p2p_device_addr));
req = p2p_build_sd_query(p2p->srv_update_indic, query->tlvs);
if (req == NULL)
return -1;
dev->sd_reqs++;
p2p->sd_peer = dev;
p2p->sd_query = query;
p2p->pending_action_state = P2P_PENDING_SD;
wait_time = 5000;
if (p2p->cfg->max_listen && wait_time > p2p->cfg->max_listen)
wait_time = p2p->cfg->max_listen;
if (p2p_send_action(p2p, freq, dev->info.p2p_device_addr,
p2p->cfg->dev_addr, dev->info.p2p_device_addr,
wpabuf_head(req), wpabuf_len(req), wait_time) < 0) {
p2p_dbg(p2p, "Failed to send Action frame");
ret = -1;
}
wpabuf_free(req);
return ret;
}
开发者ID:9A9A,项目名称:wpa_supplicant-fork,代码行数:54,代码来源:p2p_sd.c
示例3: p2p_sd_response
void p2p_sd_response(struct p2p_data *p2p, int freq, const u8 *dst,
u8 dialog_token, const struct wpabuf *resp_tlvs)
{
struct wpabuf *resp;
size_t max_len;
/*
* In the 60 GHz, we have a smaller maximum frame length for management
* frames.
*/
max_len = (freq > 56160) ? 928 : 1400;
/* TODO: fix the length limit to match with the maximum frame length */
if (wpabuf_len(resp_tlvs) > max_len) {
p2p_dbg(p2p, "SD response long enough to require fragmentation");
if (p2p->sd_resp) {
/*
* TODO: Could consider storing the fragmented response
* separately for each peer to avoid having to drop old
* one if there is more than one pending SD query.
* Though, that would eat more memory, so there are
* also benefits to just using a single buffer.
*/
p2p_dbg(p2p, "Drop previous SD response");
wpabuf_free(p2p->sd_resp);
}
p2p->sd_resp = wpabuf_dup(resp_tlvs);
if (p2p->sd_resp == NULL) {
p2p_err(p2p, "Failed to allocate SD response fragmentation area");
return;
}
os_memcpy(p2p->sd_resp_addr, dst, ETH_ALEN);
p2p->sd_resp_dialog_token = dialog_token;
p2p->sd_resp_pos = 0;
p2p->sd_frag_id = 0;
resp = p2p_build_sd_response(dialog_token, WLAN_STATUS_SUCCESS,
1, p2p->srv_update_indic, NULL);
} else {
p2p_dbg(p2p, "SD response fits in initial response");
resp = p2p_build_sd_response(dialog_token,
WLAN_STATUS_SUCCESS, 0,
p2p->srv_update_indic, resp_tlvs);
}
if (resp == NULL)
return;
p2p->pending_action_state = P2P_NO_PENDING_ACTION;
if (p2p_send_action(p2p, freq, dst, p2p->cfg->dev_addr,
p2p->cfg->dev_addr,
wpabuf_head(resp), wpabuf_len(resp), 200) < 0)
p2p_dbg(p2p, "Failed to send Action frame");
wpabuf_free(resp);
}
开发者ID:9A9A,项目名称:wpa_supplicant-fork,代码行数:54,代码来源:p2p_sd.c
示例4: p2p_send_prov_disc_req
int p2p_send_prov_disc_req(struct p2p_data *p2p, struct p2p_device *dev,
int join, int force_freq)
{
struct wpabuf *req;
int freq;
if (force_freq > 0)
freq = force_freq;
else
freq = dev->listen_freq > 0 ? dev->listen_freq :
dev->oper_freq;
if (freq <= 0) {
p2p_dbg(p2p, "No Listen/Operating frequency known for the peer "
MACSTR " to send Provision Discovery Request",
MAC2STR(dev->info.p2p_device_addr));
return -1;
}
if (dev->flags & P2P_DEV_GROUP_CLIENT_ONLY) {
if (!(dev->info.dev_capab &
P2P_DEV_CAPAB_CLIENT_DISCOVERABILITY)) {
p2p_dbg(p2p, "Cannot use PD with P2P Device " MACSTR
" that is in a group and is not discoverable",
MAC2STR(dev->info.p2p_device_addr));
return -1;
}
/* TODO: use device discoverability request through GO */
}
req = p2p_build_prov_disc_req(p2p, dev->dialog_token,
dev->req_config_methods,
join ? dev : NULL);
if (req == NULL)
return -1;
if (p2p->state != P2P_IDLE)
p2p_stop_listen_for_freq(p2p, freq);
p2p->pending_action_state = P2P_PENDING_PD;
if (p2p_send_action(p2p, freq, dev->info.p2p_device_addr,
p2p->cfg->dev_addr, dev->info.p2p_device_addr,
wpabuf_head(req), wpabuf_len(req), 200) < 0) {
p2p_dbg(p2p, "Failed to send Action frame");
wpabuf_free(req);
return -1;
}
os_memcpy(p2p->pending_pd_devaddr, dev->info.p2p_device_addr, ETH_ALEN);
wpabuf_free(req);
return 0;
}
开发者ID:Rogdham,项目名称:hostapd-mana,代码行数:51,代码来源:p2p_pd.c
示例5: p2p_start_sd
int p2p_start_sd(struct p2p_data *p2p, struct p2p_device *dev,
os_time_t *remaining_usec)
{
struct wpabuf *req;
int ret = 0;
struct p2p_sd_query *query;
int freq;
unsigned int wait_time;
freq = dev->listen_freq > 0 ? dev->listen_freq : dev->oper_freq;
if (freq <= 0) {
p2p_dbg(p2p, "No Listen/Operating frequency known for the peer "
MACSTR " to send SD Request",
MAC2STR(dev->info.p2p_device_addr));
return -1;
}
query = p2p_pending_sd_req(p2p, dev, remaining_usec);
if (query == NULL)
return -1;
p2p_dbg(p2p, "Start Service Discovery with " MACSTR,
MAC2STR(dev->info.p2p_device_addr));
req = p2p_build_sd_query(p2p->srv_update_indic, query->tlvs);
if (req == NULL)
return -1;
dev->sd_reqs++;
p2p->sd_peer = dev;
p2p->sd_query = query;
p2p->pending_action_state = P2P_PENDING_SD;
os_get_reltime(&dev->last_sd_bc_time);
wait_time = 5000;
if (p2p->cfg->max_listen && wait_time > p2p->cfg->max_listen)
wait_time = p2p->cfg->max_listen;
if (p2p_send_action(p2p, freq, dev->info.p2p_device_addr,
p2p->cfg->dev_addr, dev->info.p2p_device_addr,
wpabuf_head(req), wpabuf_len(req), wait_time) < 0) {
p2p_dbg(p2p, "Failed to send Action frame");
ret = -1;
}
wpabuf_free(req);
return ret;
}
开发者ID:PDi-Communication-Systems-Inc,项目名称:lollipop_external_wpa_supplicant_8,代码行数:48,代码来源:p2p_sd.c
示例6: p2p_invitation_req_cb
void p2p_invitation_req_cb(struct p2p_data *p2p, int success)
{
p2p_dbg(p2p, "Invitation Request TX callback: success=%d", success);
if (p2p->invite_peer == NULL) {
p2p_dbg(p2p, "No pending Invite");
return;
}
/*
* Use P2P find, if needed, to find the other device from its listen
* channel.
*/
p2p_set_state(p2p, P2P_INVITE);
p2p_set_timeout(p2p, 0, success ? 500000 : 100000);
}
开发者ID:ArcherHood,项目名称:ti-hostap,代码行数:16,代码来源:p2p_invitation.c
示例7: p2p_channels_dump
void p2p_channels_dump(struct p2p_data *p2p, const char *title,
const struct p2p_channels *chan)
{
char buf[500], *pos, *end;
size_t i, j;
int ret;
pos = buf;
end = pos + sizeof(buf);
for (i = 0; i < chan->reg_classes; i++) {
const struct p2p_reg_class *c;
c = &chan->reg_class[i];
ret = os_snprintf(pos, end - pos, " %u:", c->reg_class);
if (os_snprintf_error(end - pos, ret))
break;
pos += ret;
for (j = 0; j < c->channels; j++) {
ret = os_snprintf(pos, end - pos, "%s%u",
j == 0 ? "" : ",",
c->channel[j]);
if (os_snprintf_error(end - pos, ret))
break;
pos += ret;
}
}
*pos = '\0';
p2p_dbg(p2p, "%s:%s", title, buf);
}
开发者ID:PDi-Communication-Systems-Inc,项目名称:lollipop_external_wpa_supplicant_8,代码行数:31,代码来源:p2p_utils.c
示例8: p2p_invitation_resp_cb
void p2p_invitation_resp_cb(struct p2p_data *p2p, int success)
{
p2p_dbg(p2p, "Invitation Response TX callback: success=%d", success);
p2p->cfg->send_action_done(p2p->cfg->cb_ctx);
if (!success)
p2p_dbg(p2p, "Assume Invitation Response was actually received by the peer even though Ack was not reported");
if (p2p->cfg->invitation_received) {
p2p->cfg->invitation_received(p2p->cfg->cb_ctx,
p2p->inv_sa,
p2p->inv_group_bssid_ptr,
p2p->inv_ssid, p2p->inv_ssid_len,
p2p->inv_go_dev_addr,
p2p->inv_status,
p2p->inv_op_freq);
}
}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:18,代码来源:p2p_invitation.c
示例9: p2p_sd_cancel_request
int p2p_sd_cancel_request(struct p2p_data *p2p, void *req)
{
if (p2p_unlink_sd_query(p2p, req)) {
p2p_dbg(p2p, "Cancel pending SD query %p", req);
p2p_free_sd_query(req);
return 0;
}
return -1;
}
开发者ID:PDi-Communication-Systems-Inc,项目名称:lollipop_external_wpa_supplicant_8,代码行数:9,代码来源:p2p_sd.c
示例10: p2p_group_go_discover
int p2p_group_go_discover(struct p2p_group *group, const u8 *dev_id,
const u8 *searching_dev, int rx_freq)
{
struct p2p_group_member *m;
struct wpabuf *req;
struct p2p_data *p2p = group->p2p;
int freq;
m = p2p_group_get_client(group, dev_id);
if (m == NULL || m->client_info == NULL) {
p2p_dbg(group->p2p, "Requested client was not in this group "
MACSTR, MAC2STR(group->cfg->interface_addr));
return -1;
}
if (!(m->dev_capab & P2P_DEV_CAPAB_CLIENT_DISCOVERABILITY)) {
p2p_dbg(group->p2p, "Requested client does not support client discoverability");
return -1;
}
p2p_dbg(group->p2p, "Schedule GO Discoverability Request to be sent to "
MACSTR, MAC2STR(dev_id));
req = p2p_build_go_disc_req();
if (req == NULL)
return -1;
/* TODO: Should really use group operating frequency here */
freq = rx_freq;
p2p->pending_action_state = P2P_PENDING_GO_DISC_REQ;
if (p2p->cfg->send_action(p2p->cfg->cb_ctx, freq, m->addr,
group->cfg->interface_addr,
group->cfg->interface_addr,
wpabuf_head(req), wpabuf_len(req), 200) < 0)
{
p2p_dbg(p2p, "Failed to send Action frame");
}
wpabuf_free(req);
return 0;
}
开发者ID:brianwoo,项目名称:cm11_grouper,代码行数:43,代码来源:p2p_group.c
示例11: p2p_invite_send
int p2p_invite_send(struct p2p_data *p2p, struct p2p_device *dev,
const u8 *go_dev_addr, int dev_pw_id)
{
struct wpabuf *req;
int freq;
freq = dev->listen_freq > 0 ? dev->listen_freq : dev->oper_freq;
if (freq <= 0)
freq = dev->oob_go_neg_freq;
if (freq <= 0) {
p2p_dbg(p2p, "No Listen/Operating frequency known for the peer "
MACSTR " to send Invitation Request",
MAC2STR(dev->info.p2p_device_addr));
return -1;
}
req = p2p_build_invitation_req(p2p, dev, go_dev_addr, dev_pw_id);
if (req == NULL)
return -1;
if (p2p->state != P2P_IDLE)
p2p_stop_listen_for_freq(p2p, freq);
p2p_dbg(p2p, "Sending Invitation Request");
p2p_set_state(p2p, P2P_INVITE);
p2p->pending_action_state = P2P_PENDING_INVITATION_REQUEST;
p2p->invite_peer = dev;
dev->invitation_reqs++;
if (p2p_send_action(p2p, freq, dev->info.p2p_device_addr,
p2p->cfg->dev_addr, dev->info.p2p_device_addr,
wpabuf_head(req), wpabuf_len(req), 500) < 0) {
p2p_dbg(p2p, "Failed to send Action frame");
/* Use P2P find to recover and retry */
p2p_set_timeout(p2p, 0, 0);
} else {
dev->flags |= P2P_DEV_WAIT_INV_REQ_ACK;
}
wpabuf_free(req);
return 0;
}
开发者ID:FreeBSDFoundation,项目名称:freebsd,代码行数:40,代码来源:p2p_invitation.c
示例12: p2p_group_notif_disassoc
void p2p_group_notif_disassoc(struct p2p_group *group, const u8 *addr)
{
if (p2p_group_remove_member(group, addr)) {
p2p_dbg(group->p2p, "Remove client " MACSTR
" from group; num_members=%u/%u",
MAC2STR(addr), group->num_members,
group->cfg->max_clients);
if (group->num_members == group->cfg->max_clients - 1)
group->beacon_update = 1;
p2p_group_update_ies(group);
if (group->num_members == 0)
group->cfg->idle_update(group->cfg->cb_ctx, 1);
}
}
开发者ID:brianwoo,项目名称:cm11_grouper,代码行数:14,代码来源:p2p_group.c
示例13: wifi_display_build_go_ie
static struct wpabuf *
wifi_display_build_go_ie(struct p2p_group *group)
{
struct wpabuf *wfd_subelems, *wfd_ie;
struct p2p_group_member *m;
u8 *len;
unsigned int count = 0;
if (!group->p2p->wfd_ie_probe_resp)
return NULL;
wfd_subelems = wpabuf_alloc(wpabuf_len(group->p2p->wfd_ie_probe_resp) +
group->num_members * 24 + 100);
if (wfd_subelems == NULL)
return NULL;
if (group->p2p->wfd_dev_info)
wpabuf_put_buf(wfd_subelems, group->p2p->wfd_dev_info);
if (group->p2p->wfd_assoc_bssid)
wpabuf_put_buf(wfd_subelems,
group->p2p->wfd_assoc_bssid);
if (group->p2p->wfd_coupled_sink_info)
wpabuf_put_buf(wfd_subelems,
group->p2p->wfd_coupled_sink_info);
/* Build WFD Session Info */
wpabuf_put_u8(wfd_subelems, WFD_SUBELEM_SESSION_INFO);
len = wpabuf_put(wfd_subelems, 2);
m = group->members;
while (m) {
if (wifi_display_add_dev_info_descr(wfd_subelems, m))
count++;
m = m->next;
}
if (count == 0) {
/* No Wi-Fi Display clients - do not include subelement */
wfd_subelems->used -= 3;
} else {
WPA_PUT_BE16(len, (u8 *) wpabuf_put(wfd_subelems, 0) - len -
2);
p2p_dbg(group->p2p, "WFD: WFD Session Info: %u descriptors",
count);
}
wfd_ie = wifi_display_encaps(wfd_subelems);
wpabuf_free(wfd_subelems);
return wfd_ie;
}
开发者ID:brianwoo,项目名称:cm11_grouper,代码行数:49,代码来源:p2p_group.c
示例14: p2p_group_presence_req
u8 p2p_group_presence_req(struct p2p_group *group,
const u8 *client_interface_addr,
const u8 *noa, size_t noa_len)
{
struct p2p_group_member *m;
u8 curr_noa[50];
int curr_noa_len;
m = p2p_group_get_client_iface(group, client_interface_addr);
if (m == NULL || m->client_info == NULL) {
p2p_dbg(group->p2p, "Client was not in this group");
return P2P_SC_FAIL_UNABLE_TO_ACCOMMODATE;
}
wpa_hexdump(MSG_DEBUG, "P2P: Presence Request NoA", noa, noa_len);
if (group->p2p->cfg->get_noa)
curr_noa_len = group->p2p->cfg->get_noa(
group->p2p->cfg->cb_ctx, group->cfg->interface_addr,
curr_noa, sizeof(curr_noa));
else
curr_noa_len = -1;
if (curr_noa_len < 0)
p2p_dbg(group->p2p, "Failed to fetch current NoA");
else if (curr_noa_len == 0)
p2p_dbg(group->p2p, "No NoA being advertized");
else
wpa_hexdump(MSG_DEBUG, "P2P: Current NoA", curr_noa,
curr_noa_len);
/* TODO: properly process request and store copy */
if (curr_noa_len > 0 || curr_noa_len == -1)
return P2P_SC_FAIL_UNABLE_TO_ACCOMMODATE;
return P2P_SC_SUCCESS;
}
开发者ID:brianwoo,项目名称:cm11_grouper,代码行数:36,代码来源:p2p_group.c
示例15: p2p_pending_sd_req
struct p2p_sd_query * p2p_pending_sd_req(struct p2p_data *p2p,
struct p2p_device *dev)
{
struct p2p_sd_query *q;
int wsd = 0;
int count = 0;
if (!(dev->info.dev_capab & P2P_DEV_CAPAB_SERVICE_DISCOVERY))
return NULL; /* peer does not support SD */
#ifdef CONFIG_WIFI_DISPLAY
if (wfd_wsd_supported(dev->info.wfd_subelems))
wsd = 1;
#endif /* CONFIG_WIFI_DISPLAY */
for (q = p2p->sd_queries; q; q = q->next) {
/* Use WSD only if the peer indicates support or it */
if (q->wsd && !wsd)
continue;
/* if the query is a broadcast query */
if (q->for_all_peers) {
/*
* check if there are any broadcast queries pending for
* this device
*/
if (dev->sd_pending_bcast_queries <= 0)
return NULL;
/* query number that needs to be send to the device */
if (count == dev->sd_pending_bcast_queries - 1)
goto found;
count++;
}
if (!q->for_all_peers &&
os_memcmp(q->peer, dev->info.p2p_device_addr, ETH_ALEN) ==
0)
goto found;
}
return NULL;
found:
if (dev->sd_reqs > 100) {
p2p_dbg(p2p, "Too many SD request attempts to " MACSTR
" - skip remaining queries",
MAC2STR(dev->info.p2p_device_addr));
return NULL;
}
return q;
}
开发者ID:9A9A,项目名称:wpa_supplicant-fork,代码行数:48,代码来源:p2p_sd.c
示例16: p2p_send_gas_comeback_req
static void p2p_send_gas_comeback_req(struct p2p_data *p2p, const u8 *dst,
u8 dialog_token, int freq)
{
struct wpabuf *req;
req = gas_build_comeback_req(dialog_token);
if (req == NULL)
return;
p2p->pending_action_state = P2P_NO_PENDING_ACTION;
if (p2p_send_action(p2p, freq, dst, p2p->cfg->dev_addr, dst,
wpabuf_head(req), wpabuf_len(req), 200) < 0)
p2p_dbg(p2p, "Failed to send Action frame");
wpabuf_free(req);
}
开发者ID:PDi-Communication-Systems-Inc,项目名称:lollipop_external_wpa_supplicant_8,代码行数:16,代码来源:p2p_sd.c
示例17: p2p_sd_request
void * p2p_sd_request(struct p2p_data *p2p, const u8 *dst,
const struct wpabuf *tlvs)
{
struct p2p_sd_query *q;
q = os_zalloc(sizeof(*q));
if (q == NULL)
return NULL;
if (dst)
os_memcpy(q->peer, dst, ETH_ALEN);
else
q->for_all_peers = 1;
q->tlvs = wpabuf_dup(tlvs);
if (q->tlvs == NULL) {
p2p_free_sd_query(q);
return NULL;
}
q->next = p2p->sd_queries;
p2p->sd_queries = q;
p2p_dbg(p2p, "Added SD Query %p", q);
if (dst == NULL) {
struct p2p_device *dev;
p2p->num_p2p_sd_queries++;
/* Update all the devices for the newly added broadcast query */
dl_list_for_each(dev, &p2p->devices, struct p2p_device, list) {
#ifdef CONFIG_MTK_P2P
dev->flags &= ~P2P_DEV_SD_INFO;
#endif
if (dev->sd_pending_bcast_queries <= 0)
dev->sd_pending_bcast_queries = 1;
else
dev->sd_pending_bcast_queries++;
}
}
return q;
}
开发者ID:Bebooo43,项目名称:android_hardware_mediatek,代码行数:43,代码来源:p2p_sd.c
示例18: p2p_group_notif_assoc
int p2p_group_notif_assoc(struct p2p_group *group, const u8 *addr,
const u8 *ie, size_t len)
{
struct p2p_group_member *m;
if (group == NULL)
return -1;
p2p_add_device(group->p2p, addr, 0, NULL, 0, ie, len, 0);
m = os_zalloc(sizeof(*m));
if (m == NULL)
return -1;
os_memcpy(m->addr, addr, ETH_ALEN);
m->p2p_ie = ieee802_11_vendor_ie_concat(ie, len, P2P_IE_VENDOR_TYPE);
if (m->p2p_ie) {
m->client_info = p2p_build_client_info(addr, m->p2p_ie,
&m->dev_capab,
m->dev_addr);
}
#ifdef CONFIG_WIFI_DISPLAY
m->wfd_ie = ieee802_11_vendor_ie_concat(ie, len, WFD_IE_VENDOR_TYPE);
#endif /* CONFIG_WIFI_DISPLAY */
p2p_group_remove_member(group, addr);
m->next = group->members;
group->members = m;
group->num_members++;
p2p_dbg(group->p2p, "Add client " MACSTR
" to group (p2p=%d wfd=%d client_info=%d); num_members=%u/%u",
MAC2STR(addr), m->p2p_ie ? 1 : 0, m->wfd_ie ? 1 : 0,
m->client_info ? 1 : 0,
group->num_members, group->cfg->max_clients);
if (group->num_members == group->cfg->max_clients)
group->beacon_update = 1;
p2p_group_update_ies(group);
if (group->num_members == 1)
group->cfg->idle_update(group->cfg->cb_ctx, 0);
return 0;
}
开发者ID:brianwoo,项目名称:cm11_grouper,代码行数:42,代码来源:p2p_group.c
示例19: p2p_send_prov_disc_req
int p2p_send_prov_disc_req(struct p2p_data *p2p, struct p2p_device *dev,
int join, int force_freq)
{
struct wpabuf *req;
int freq;
if (force_freq > 0)
freq = force_freq;
else
freq = dev->listen_freq > 0 ? dev->listen_freq :
dev->oper_freq;
if (freq <= 0) {
p2p_dbg(p2p, "No Listen/Operating frequency known for the peer "
MACSTR " to send Provision Discovery Request",
MAC2STR(dev->info.p2p_device_addr));
return -1;
}
if (dev->flags & P2P_DEV_GROUP_CLIENT_ONLY) {
if (!(dev->info.dev_capab &
P2P_DEV_CAPAB_CLIENT_DISCOVERABILITY)) {
p2p_dbg(p2p, "Cannot use PD with P2P Device " MACSTR
" that is in a group and is not discoverable",
MAC2STR(dev->info.p2p_device_addr));
return -1;
}
/* TODO: use device discoverability request through GO */
}
if (p2p->p2ps_prov) {
if (p2p->p2ps_prov->status == P2P_SC_SUCCESS_DEFERRED) {
if (p2p->p2ps_prov->method == WPS_CONFIG_DISPLAY)
dev->req_config_methods = WPS_CONFIG_KEYPAD;
else if (p2p->p2ps_prov->method == WPS_CONFIG_KEYPAD)
dev->req_config_methods = WPS_CONFIG_DISPLAY;
else
dev->req_config_methods = WPS_CONFIG_P2PS;
} else {
/* Order of preference, based on peer's capabilities */
if (p2p->p2ps_prov->method)
dev->req_config_methods =
p2p->p2ps_prov->method;
else if (dev->info.config_methods & WPS_CONFIG_P2PS)
dev->req_config_methods = WPS_CONFIG_P2PS;
else if (dev->info.config_methods & WPS_CONFIG_DISPLAY)
dev->req_config_methods = WPS_CONFIG_DISPLAY;
else
dev->req_config_methods = WPS_CONFIG_KEYPAD;
}
p2p_dbg(p2p,
"Building PD Request based on P2PS config method 0x%x status %d --> req_config_methods 0x%x",
p2p->p2ps_prov->method, p2p->p2ps_prov->status,
dev->req_config_methods);
if (p2p_prepare_channel(p2p, dev, p2p->p2ps_prov->force_freq,
p2p->p2ps_prov->pref_freq, 1) < 0)
return -1;
}
req = p2p_build_prov_disc_req(p2p, dev, join);
if (req == NULL)
return -1;
if (p2p->state != P2P_IDLE)
p2p_stop_listen_for_freq(p2p, freq);
p2p->pending_action_state = P2P_PENDING_PD;
if (p2p_send_action(p2p, freq, dev->info.p2p_device_addr,
p2p->cfg->dev_addr, dev->info.p2p_device_addr,
wpabuf_head(req), wpabuf_len(req), 200) < 0) {
p2p_dbg(p2p, "Failed to send Action frame");
wpabuf_free(req);
return -1;
}
os_memcpy(p2p->pending_pd_devaddr, dev->info.p2p_device_addr, ETH_ALEN);
wpabuf_free(req);
return 0;
}
开发者ID:maojxsir,项目名称:rpi-softap,代码行数:79,代码来源:p2p_pd.c
示例20: p2p_rx_gas_comeback_resp
void p2p_rx_gas_comeback_resp(struct p2p_data *p2p, const u8 *sa,
const u8 *data, size_t len, int rx_freq)
{
const u8 *pos = data;
const u8 *end = data + len;
const u8 *next;
u8 dialog_token;
u16 status_code;
u8 frag_id;
u8 more_frags;
u16 comeback_delay;
u16 slen;
wpa_hexdump(MSG_DEBUG, "P2P: RX GAS Comeback Response", data, len);
if (p2p->state != P2P_SD_DURING_FIND || p2p->sd_peer == NULL ||
os_memcmp(sa, p2p->sd_peer->info.p2p_device_addr, ETH_ALEN) != 0) {
p2p_dbg(p2p, "Ignore unexpected GAS Comeback Response from "
MACSTR, MAC2STR(sa));
return;
}
p2p->cfg->send_action_done(p2p->cfg->cb_ctx);
p2p_clear_timeout(p2p);
p2p_dbg(p2p, "Received GAS Comeback Response from " MACSTR " (len=%d)",
MAC2STR(sa), (int) len);
if (len < 6 + 2) {
p2p_dbg(p2p, "Too short GAS Comeback Response frame");
return;
}
dialog_token = *pos++;
/* TODO: check dialog_token match */
status_code = WPA_GET_LE16(pos);
pos += 2;
frag_id = *pos & 0x7f;
more_frags = (*pos & 0x80) >> 7;
pos++;
comeback_delay = WPA_GET_LE16(pos);
pos += 2;
p2p_dbg(p2p, "dialog_token=%u status_code=%u frag_id=%d more_frags=%d "
"comeback_delay=%u",
dialog_token, status_code, frag_id, more_frags,
comeback_delay);
/* TODO: check frag_id match */
if (status_code) {
p2p_dbg(p2p, "Service Discovery failed: status code %u",
status_code);
return;
}
if (*pos != WLAN_EID_ADV_PROTO) {
p2p_dbg(p2p, "Unexpected IE in GAS Comeback Response: %u",
*pos);
return;
}
pos++;
slen = *pos++;
next = pos + slen;
if (next > end || slen < 2) {
p2p_dbg(p2p, "Invalid IE in GAS Comeback Response");
return;
}
pos++; /* skip QueryRespLenLimit and PAME-BI */
if (*pos != ACCESS_NETWORK_QUERY_PROTOCOL) {
p2p_dbg(p2p, "Unsupported GAS advertisement protocol id %u",
*pos);
return;
}
pos = next;
/* Query Response */
if (pos + 2 > end) {
p2p_dbg(p2p, "Too short Query Response");
return;
}
slen = WPA_GET_LE16(pos);
pos += 2;
p2p_dbg(p2p, "Query Response Length: %d", slen);
if (pos + slen > end) {
p2p_dbg(p2p, "Not enough Query Response data");
return;
}
if (slen == 0) {
p2p_dbg(p2p, "No Query Response data");
return;
}
end = pos + slen;
if (p2p->sd_rx_resp) {
/*
* ANQP header is only included in the first fragment; rest of
* the fragments start with continue TLVs.
*/
goto skip_nqp_header;
}
//.........这里部分代码省略.........
开发者ID:PDi-Communication-Systems-Inc,项目名称:lollipop_external_wpa_supplicant_8,代码行数:101,代码来源:p2p_sd.c
注:本文中的p2p_dbg函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论