Home | History | Annotate | Download | only in p2p

Lines Matching refs:p2p

2  * Wi-Fi Direct - P2P Device Discoverability procedure
14 #include "p2p.h"
17 static struct wpabuf * p2p_build_dev_disc_req(struct p2p_data *p2p,
43 void p2p_dev_disc_req_cb(struct p2p_data *p2p, int success)
45 p2p_dbg(p2p, "Device Discoverability Request TX callback: success=%d",
50 * Use P2P find, if needed, to find the other device or to
53 p2p_set_state(p2p, P2P_CONNECT);
54 p2p_set_timeout(p2p, 0, 100000);
58 p2p_dbg(p2p, "GO acknowledged Device Discoverability Request - wait for response");
67 int p2p_send_dev_disc_req(struct p2p_data *p2p, struct p2p_device *dev)
73 go = p2p_get_device(p2p, dev->member_in_go_dev);
75 p2p_dbg(p2p, "Could not find peer entry for GO and frequency to send Device Discoverability Request");
79 req = p2p_build_dev_disc_req(p2p, go, dev->info.p2p_device_addr);
83 p2p_dbg(p2p, "Sending Device Discoverability Request to GO " MACSTR
88 p2p->pending_client_disc_go = go;
89 os_memcpy(p2p->pending_client_disc_addr, dev->info.p2p_device_addr,
91 p2p->pending_action_state = P2P_PENDING_DEV_DISC_REQUEST;
93 if (p2p->cfg->max_listen && wait_time > p2p->cfg->max_listen)
94 wait_time = p2p->cfg->max_listen;
95 if (p2p_send_action(p2p, dev->oper_freq, go->info.p2p_device_addr,
96 p2p->cfg->dev_addr, go->info.p2p_device_addr,
98 p2p_dbg(p2p, "Failed to send Action frame");
129 void p2p_dev_disc_resp_cb(struct p2p_data *p2p, int success)
131 p2p_dbg(p2p, "Device Discoverability Response TX callback: success=%d",
133 p2p->cfg->send_action_done(p2p->cfg->cb_ctx);
137 static void p2p_send_dev_disc_resp(struct p2p_data *p2p, u8 dialog_token,
146 p2p_dbg(p2p, "Sending Device Discoverability Response to " MACSTR
150 p2p->pending_action_state = P2P_PENDING_DEV_DISC_RESPONSE;
151 if (p2p_send_action(p2p, freq, addr, p2p->cfg->dev_addr,
152 p2p->cfg->dev_addr,
154 p2p_dbg(p2p, "Failed to send Action frame");
161 void p2p_process_dev_disc_req(struct p2p_data *p2p, const u8 *sa,
167 p2p_dbg(p2p, "Received Device Discoverability Request from " MACSTR
174 p2p_dbg(p2p, "Invalid Dialog Token 0 (must be nonzero) in Device Discoverability Request");
175 p2p_send_dev_disc_resp(p2p, msg.dialog_token, sa, rx_freq,
182 p2p_dbg(p2p, "P2P Device ID attribute missing from Device Discoverability Request");
183 p2p_send_dev_disc_resp(p2p, msg.dialog_token, sa, rx_freq,
189 for (g = 0; g < p2p->num_groups; g++) {
190 if (p2p_group_go_discover(p2p->groups[g], msg.device_id, sa,
192 p2p_dbg(p2p, "Scheduled GO Discoverability Request for the target device");
194 * P2P group code will use a callback to indicate TX
199 p2p->pending_dev_disc_dialog_token = msg.dialog_token;
200 os_memcpy(p2p->pending_dev_disc_addr, sa, ETH_ALEN);
201 p2p->pending_dev_disc_freq = rx_freq;
207 p2p_dbg(p2p, "Requested client was not found in any group or did not support client discoverability");
208 p2p_send_dev_disc_resp(p2p, msg.dialog_token, sa, rx_freq,
214 void p2p_process_dev_disc_resp(struct p2p_data *p2p, const u8 *sa,
221 p2p_dbg(p2p, "Received Device Discoverability Response from " MACSTR,
224 go = p2p->pending_client_disc_go;
227 p2p_dbg(p2p, "Ignore unexpected Device Discoverability Response");
240 p2p_dbg(p2p, "Ignore Device Discoverability Response with unexpected dialog token %u (expected %u)",
249 p2p_dbg(p2p, "Device Discoverability Response status %u", status);
251 if (p2p->go_neg_peer == NULL ||
252 os_memcmp(p2p->pending_client_disc_addr,
253 p2p->go_neg_peer->info.p2p_device_addr, ETH_ALEN) != 0 ||
254 os_memcmp(p2p->go_neg_peer->member_in_go_dev,
256 p2p_dbg(p2p, "No pending operation with the client discoverability peer anymore");
265 p2p_dbg(p2p, "Client discoverability request succeeded");
266 if (p2p->state == P2P_CONNECT) {
272 p2p_set_state(p2p, P2P_CONNECT_LISTEN);
273 p2p->cfg->send_action_done(p2p->cfg->cb_ctx);
275 p2p_set_timeout(p2p, 0, 0);
281 p2p_dbg(p2p, "Client discoverability request failed");
282 p2p_set_timeout(p2p, 0, 500000);
288 void p2p_go_disc_req_cb(struct p2p_data *p2p, int success)
290 p2p_dbg(p2p, "GO Discoverability Request TX callback: success=%d",
292 p2p->cfg->send_action_done(p2p->cfg->cb_ctx);
294 if (p2p->pending_dev_disc_dialog_token == 0) {
295 p2p_dbg(p2p, "No pending Device Discoverability Request");
299 p2p_send_dev_disc_resp(p2p, p2p->pending_dev_disc_dialog_token,
300 p2p->pending_dev_disc_addr,
301 p2p->pending_dev_disc_freq,
305 p2p->pending_dev_disc_dialog_token = 0;
309 void p2p_process_go_disc_req(struct p2p_data *p2p, const u8 *da, const u8 *sa,
315 p2p_dbg(p2p, "Received GO Discoverability Request - remain awake for 100 TU");
317 ies = p2p_build_probe_resp_ies(p2p, NULL, 0);
322 p2p->pending_client_disc_freq = rx_freq;
324 if (p2p->cfg->start_listen(p2p->cfg->cb_ctx, rx_freq, 1024 * tu / 1000,
326 p2p_dbg(p2p, "Failed to start listen mode for client discoverability");