P2PS: Callback to create pending group after sending PD Response

This introduces a P2P module callback function that will be used to
create the pending P2PS group after sending PD Response and receiving
ACK status for it.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
Krishna Vamsi 2014-12-10 16:59:29 +05:30 committed by Jouni Malinen
parent 895d94def9
commit 9a58e521ac
7 changed files with 93 additions and 11 deletions

View file

@ -3284,6 +3284,51 @@ static void p2p_prov_disc_cb(struct p2p_data *p2p, int success)
}
static int p2p_check_after_scan_tx_continuation(struct p2p_data *p2p)
{
if (p2p->after_scan_tx_in_progress) {
p2p->after_scan_tx_in_progress = 0;
if (p2p->start_after_scan != P2P_AFTER_SCAN_NOTHING &&
p2p_run_after_scan(p2p))
return 1;
if (p2p->state == P2P_SEARCH) {
p2p_dbg(p2p, "Continue find after after_scan_tx completion");
p2p_continue_find(p2p);
}
}
return 0;
}
static void p2p_prov_disc_resp_cb(struct p2p_data *p2p, int success)
{
p2p_dbg(p2p, "Provision Discovery Response TX callback: success=%d",
success);
if (p2p->send_action_in_progress) {
p2p->send_action_in_progress = 0;
p2p->cfg->send_action_done(p2p->cfg->cb_ctx);
}
p2p->pending_action_state = P2P_NO_PENDING_ACTION;
if (!success)
goto continue_search;
if (!p2p->cfg->prov_disc_resp_cb ||
p2p->cfg->prov_disc_resp_cb(p2p->cfg->cb_ctx) < 1)
goto continue_search;
p2p_dbg(p2p,
"Post-Provision Discovery operations started - do not try to continue other P2P operations");
return;
continue_search:
p2p_check_after_scan_tx_continuation(p2p);
}
int p2p_scan_res_handler(struct p2p_data *p2p, const u8 *bssid, int freq,
struct os_reltime *rx_time, int level, const u8 *ies,
size_t ies_len)
@ -3558,16 +3603,7 @@ void p2p_send_action_cb(struct p2p_data *p2p, unsigned int freq, const u8 *dst,
p2p->send_action_in_progress = 0;
p2p->cfg->send_action_done(p2p->cfg->cb_ctx);
}
if (p2p->after_scan_tx_in_progress) {
p2p->after_scan_tx_in_progress = 0;
if (p2p->start_after_scan != P2P_AFTER_SCAN_NOTHING &&
p2p_run_after_scan(p2p))
break;
if (p2p->state == P2P_SEARCH) {
p2p_dbg(p2p, "Continue find after after_scan_tx completion");
p2p_continue_find(p2p);
}
}
p2p_check_after_scan_tx_continuation(p2p);
break;
case P2P_PENDING_GO_NEG_REQUEST:
p2p_go_neg_req_cb(p2p, success);
@ -3587,6 +3623,9 @@ void p2p_send_action_cb(struct p2p_data *p2p, unsigned int freq, const u8 *dst,
case P2P_PENDING_PD:
p2p_prov_disc_cb(p2p, success);
break;
case P2P_PENDING_PD_RESPONSE:
p2p_prov_disc_resp_cb(p2p, success);
break;
case P2P_PENDING_INVITATION_REQUEST:
p2p_invitation_req_cb(p2p, success);
break;

View file

@ -980,6 +980,16 @@ struct p2p_config {
*/
int (*remove_stale_groups)(void *ctx, const u8 *peer, const u8 *go,
const u8 *ssid, size_t ssid_len);
/**
* prov_disc_resp_cb - Callback for indicating completion of PD Response
* @ctx: Callback context from cb_ctx
* Returns: 1 if operation was started, 0 otherwise
*
* This callback can be used to perform any pending actions after
* provisioning. It is mainly used for P2PS pending group creation.
*/
int (*prov_disc_resp_cb)(void *ctx);
};

View file

@ -362,6 +362,7 @@ struct p2p_data {
P2P_PENDING_GO_NEG_CONFIRM,
P2P_PENDING_SD,
P2P_PENDING_PD,
P2P_PENDING_PD_RESPONSE,
P2P_PENDING_INVITATION_REQUEST,
P2P_PENDING_INVITATION_RESPONSE,
P2P_PENDING_DEV_DISC_REQUEST,

View file

@ -355,7 +355,7 @@ out:
p2p_parse_free(&msg);
return;
}
p2p->pending_action_state = P2P_NO_PENDING_ACTION;
p2p->pending_action_state = P2P_PENDING_PD_RESPONSE;
if (p2p_send_action(p2p, freq, sa, p2p->cfg->dev_addr,
p2p->cfg->dev_addr,
wpabuf_head(resp), wpabuf_len(resp), 200) < 0) {