frame-xchg: add type to frame_xchg_prefix

All uses of frame-xchg were for action frames, and the frame type
was hard coded. Soon other frame types will be needed so the type
must now be specified in the frame_xchg_prefix structure.
This commit is contained in:
James Prestwood 2022-09-15 15:07:28 -07:00 committed by Denis Kenzior
parent 9a447b9b31
commit 0b6eb251d5
4 changed files with 7 additions and 1 deletions

View File

@ -156,6 +156,7 @@ static bool anqp_response_frame_event(const struct mmpdu_header *hdr,
}
static const struct frame_xchg_prefix anqp_frame_prefix = {
.frame_type = 0x00d0,
.data = (uint8_t []) {
0x04, 0x0b,
},

View File

@ -1193,7 +1193,7 @@ uint32_t frame_xchg_startv(uint64_t wdev_id, struct iovec *frame, uint32_t freq,
watch = l_new(struct frame_xchg_watch_data, 1);
watch->prefix = prefix;
watch->cb = va_arg(resp_args, void *);
frame_watch_add(wdev_id, group_id, 0x00d0,
frame_watch_add(wdev_id, group_id, prefix->frame_type,
prefix->data, prefix->len,
frame_xchg_resp_cb, fx, NULL);

View File

@ -32,6 +32,7 @@ typedef void (*frame_xchg_cb_t)(int err, void *user_data);
typedef void (*frame_xchg_destroy_func_t)(void *user_data);
struct frame_xchg_prefix {
uint16_t frame_type;
const uint8_t *data;
size_t len;
};

View File

@ -820,6 +820,7 @@ static void p2p_peer_frame_xchg(struct p2p_peer *peer, struct iovec *tx_body,
static const struct frame_xchg_prefix p2p_frame_go_neg_req = {
/* Management -> Public Action -> P2P -> GO Negotiation Request */
.frame_type = 0x00d0,
.data = (uint8_t []) {
0x04, 0x09, 0x50, 0x6f, 0x9a, 0x09,
P2P_ACTION_GO_NEGOTIATION_REQ
@ -829,6 +830,7 @@ static const struct frame_xchg_prefix p2p_frame_go_neg_req = {
static const struct frame_xchg_prefix p2p_frame_go_neg_resp = {
/* Management -> Public Action -> P2P -> GO Negotiation Response */
.frame_type = 0x00d0,
.data = (uint8_t []) {
0x04, 0x09, 0x50, 0x6f, 0x9a, 0x09,
P2P_ACTION_GO_NEGOTIATION_RESP
@ -838,6 +840,7 @@ static const struct frame_xchg_prefix p2p_frame_go_neg_resp = {
static const struct frame_xchg_prefix p2p_frame_go_neg_confirm = {
/* Management -> Public Action -> P2P -> GO Negotiation Confirm */
.frame_type = 0x00d0,
.data = (uint8_t []) {
0x04, 0x09, 0x50, 0x6f, 0x9a, 0x09,
P2P_ACTION_GO_NEGOTIATION_CONFIRM
@ -847,6 +850,7 @@ static const struct frame_xchg_prefix p2p_frame_go_neg_confirm = {
static const struct frame_xchg_prefix p2p_frame_pd_resp = {
/* Management -> Public Action -> P2P -> Provision Discovery Response */
.frame_type = 0x00d0,
.data = (uint8_t []) {
0x04, 0x09, 0x50, 0x6f, 0x9a, 0x09,
P2P_ACTION_PROVISION_DISCOVERY_RESP