• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 The Android Open Source Project
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  * 02110-1301, USA.
18  */
19 
20 #ifndef PMSR_H_
21 #define PMSR_H_
22 
23 #include <stdint.h>
24 #include <stdbool.h>
25 #include <netlink/attr.h>
26 #include <linux/nl80211.h>
27 
28 #include "ieee80211.h"
29 #include "list.h"
30 
31 struct pmsr_channel {
32 	uint32_t center_freq;
33 	uint32_t freq_offset;
34 	enum nl80211_channel_type channel_type;
35 	enum nl80211_chan_width width;
36 	uint32_t center_freq1;
37 	uint32_t center_freq2;
38 };
39 
40 struct pmsr_request_ftm {
41 	enum nl80211_preamble preamble;
42 	uint32_t burst_period;
43 	uint8_t asap:1,
44 	   request_lci:1,
45 	   request_civicloc:1,
46 	   trigger_based:1,
47 	   non_trigger_based:1,
48 	   lmr_feedback:1;
49 	uint8_t num_bursts_exp;
50 	uint8_t burst_duration;
51 	uint8_t ftms_per_burst;
52 	uint8_t ftmr_retries;
53 	uint8_t bss_color;
54 };
55 
56 struct pmsr_request_peer {
57 	struct list_head list;
58 
59 	uint8_t addr[ETH_ALEN];
60 	struct pmsr_channel channel;
61 	uint8_t report_ap_tsf:1;
62 	struct pmsr_request_ftm ftm;
63 };
64 
65 struct pmsr_request {
66 	uint32_t timeout;
67 
68 	// Only for mac randomization
69 	uint8_t mac_addr[ETH_ALEN];
70 	uint8_t mac_addr_mask[ETH_ALEN];
71 
72 	uint32_t n_peers;
73 
74 	// keeps pmsr_request_peer
75 	struct list_head peers;
76 };
77 
78 /*
79  * Parse pmsr request.
80  *
81  * Caller has responsibility to release peers in returned pmsr_request.
82  */
83 int parse_pmsr_request(struct nlattr *req, struct pmsr_request *out);
84 
85 #endif /* PMSR_H_ */
86