blob: 73a234a58a66b1b1acd8ce13f5aff0a4b539226d [file] [log] [blame]
Jouni Malinencd4e3c32015-10-29 12:39:56 +02001/*
2 * Sigma Control API DUT (station/AP)
3 * Copyright (c) 2010-2011, Atheros Communications, Inc.
Amarnath Hullur Subramanyam9c381f52017-03-17 00:04:41 -07004 * Copyright (c) 2011-2017, Qualcomm Atheros, Inc.
Jouni Malinen2feb9132021-11-16 00:53:06 +02005 * Copyright (c) 2018-2021, The Linux Foundation
Jouni Malinencd4e3c32015-10-29 12:39:56 +02006 * All Rights Reserved.
7 * Licensed under the Clear BSD license. See README for more details.
8 */
9
10#ifndef SIGMA_DUT_H
11#define SIGMA_DUT_H
12
Lior David9981b512017-01-20 13:16:40 +020013#ifdef __GNUC__
14#define _GNU_SOURCE 1
15#endif
16
Jouni Malinencd4e3c32015-10-29 12:39:56 +020017#include <stdlib.h>
Veerendranath Jakkam2e5ef8e2021-02-12 15:05:16 +053018#include <stdbool.h>
Jouni Malinencd4e3c32015-10-29 12:39:56 +020019#include <stdio.h>
20#include <stdarg.h>
21#include <string.h>
22#include <errno.h>
23#include <unistd.h>
24#include <time.h>
25#include <sys/time.h>
Jouni Malinen3d972ba2017-03-15 20:52:20 +020026#include <sys/types.h>
Jouni Malinencd4e3c32015-10-29 12:39:56 +020027#include <sys/socket.h>
28#include <net/if.h>
29#ifdef __QNXNTO__
30#include <sys/select.h>
31#include <net/if_ether.h>
32#endif /* __QNXNTO__ */
33#include <netinet/in.h>
34#include <arpa/inet.h>
Jouni Malinencd4e3c32015-10-29 12:39:56 +020035#include <pthread.h>
Peng Xu291d97d2018-01-31 16:34:03 -080036#ifdef NL80211_SUPPORT
37#include <netlink/genl/family.h>
38#include <netlink/genl/ctrl.h>
39#include <netlink/genl/genl.h>
40#include "qca-vendor_copy.h"
41#include "nl80211_copy.h"
42#endif /* NL80211_SUPPORT */
Vinay Gannevaram2dfb1da2019-06-14 15:24:08 +053043#ifdef ANDROID_WIFI_HAL
Sunil Dutt437476e2021-04-01 13:56:44 +053044/* avoid duplicate definitions from wifi_hal.h causing issues */
45#define u32 wifi_hal_u32
46#define u16 wifi_hal_u16
47#define u8 wifi_hal_u8
Vinay Gannevaram2dfb1da2019-06-14 15:24:08 +053048#include "wifi_hal.h"
Sunil Dutt437476e2021-04-01 13:56:44 +053049#undef u32
50#undef u16
51#undef u8
Vinay Gannevaram2dfb1da2019-06-14 15:24:08 +053052#endif /*ANDROID_WIFI_HAL*/
Jouni Malinencd4e3c32015-10-29 12:39:56 +020053
Veerendranath Jakkam764553e2020-09-10 07:27:45 +053054#ifdef NL80211_SUPPORT
55#ifndef NL_CAPABILITY_VERSION_3_5_0
56#define nla_nest_start(msg, attrtype) \
57 nla_nest_start(msg, NLA_F_NESTED | (attrtype))
58#endif
59#endif
Jouni Malinencd4e3c32015-10-29 12:39:56 +020060
61#ifdef __GNUC__
62#define PRINTF_FORMAT(a,b) __attribute__ ((format (printf, (a), (b))))
63#else
64#define PRINTF_FORMAT(a,b)
65#endif
66
Jouni Malinenda5f35b2019-03-26 00:25:53 +020067#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
68
Jouni Malinencd4e3c32015-10-29 12:39:56 +020069#ifndef SIGMA_TMPDIR
70#define SIGMA_TMPDIR "/tmp"
71#endif /* SIGMA_TMPDIR */
72
73#ifndef SIGMA_DUT_VER
74#define SIGMA_DUT_VER "(unknown)"
75#endif /* SIGMA_DUT_VER */
76
77#ifndef ETH_ALEN
78#define ETH_ALEN 6
79#endif
80
Veerendranath Jakkamd0ad6ef2020-05-21 17:09:26 +053081#ifndef BIT_ULL
82#define BIT_ULL(nr) (1ULL << (nr))
83#endif
84
Jouni Malinencd4e3c32015-10-29 12:39:56 +020085#ifndef ETH_P_ARP
86#define ETH_P_ARP 0x0806
87#endif
88
Peng Xu47d709b2019-06-04 18:14:02 -070089#define IPV6_ADDR_LEN 16
90
Jouni Malinencd4e3c32015-10-29 12:39:56 +020091struct sigma_dut;
92
93#define MAX_PARAMS 100
Alejandro Vasquez363f5582018-07-17 11:25:05 -070094#define MAX_RADIO 3
Jouni Malinencd4e3c32015-10-29 12:39:56 +020095
Ajit Vaishyac2ae9612020-02-28 00:09:07 +053096#define NAN_AWARE_IFACE "wifi-aware0"
Shivani Baranwal02161722022-08-26 12:12:29 +053097#define BROADCAST_ADDR "255.255.255.255"
Ajit Vaishyac2ae9612020-02-28 00:09:07 +053098
Jouni Malinencd4e3c32015-10-29 12:39:56 +020099/* Set default operating channel width 80 MHz */
100#define VHT_DEFAULT_OPER_CHWIDTH AP_80_VHT_OPER_CHWIDTH
101
102typedef unsigned int u32;
Ankita Bajaj1bde7942018-01-09 19:15:01 +0530103typedef uint16_t u16;
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200104typedef unsigned char u8;
105
Alexei Avshalom Lazara90032d2019-05-02 13:34:02 +0300106struct ieee80211_hdr_3addr {
107 uint16_t frame_control;
108 uint16_t duration_id;
109 uint8_t addr1[ETH_ALEN];
110 uint8_t addr2[ETH_ALEN];
111 uint8_t addr3[ETH_ALEN];
112 uint16_t seq_ctrl;
113} __attribute__((packed));
114
115struct wfa_p2p_attribute {
116 uint8_t id;
117 uint16_t len;
118 uint8_t variable[0];
119} __attribute__((packed));
120
Lavanya Suresh2e2097d2021-02-23 21:17:28 +0530121struct dut_hw_modes {
122 u16 ht_capab;
123 u8 mcs_set[16];
124 u8 ampdu_params;
125 u32 vht_capab;
126 u8 vht_mcs_set[8];
Venkateswara Naralasetty8784fcb2021-10-11 13:52:15 +0530127 u8 ap_he_phy_capab[11];
Hu Wangacede502021-11-15 19:41:00 +0530128 bool valid;
Lavanya Suresh2e2097d2021-02-23 21:17:28 +0530129};
130
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200131#define WPA_GET_BE32(a) ((((u32) (a)[0]) << 24) | (((u32) (a)[1]) << 16) | \
132 (((u32) (a)[2]) << 8) | ((u32) (a)[3]))
133#define WPA_PUT_BE32(a, val) \
134 do { \
135 (a)[0] = (u8) ((((u32) (val)) >> 24) & 0xff); \
136 (a)[1] = (u8) ((((u32) (val)) >> 16) & 0xff); \
137 (a)[2] = (u8) ((((u32) (val)) >> 8) & 0xff); \
138 (a)[3] = (u8) (((u32) (val)) & 0xff); \
139 } while (0)
140
141struct sigma_cmd {
142 char *params[MAX_PARAMS];
143 char *values[MAX_PARAMS];
144 int count;
145};
146
Alejandro Vasquez3410aa52018-07-17 11:26:17 -0700147#define MAX_CMD_LEN 4096
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200148
149struct sigma_conn {
150 int s;
151 struct sockaddr_in addr;
152 socklen_t addrlen;
153 char buf[MAX_CMD_LEN + 5];
154 int pos;
155 int waiting_completion;
156};
157
Jouni Malinen0e29cf22019-02-19 01:13:21 +0200158enum sigma_cmd_result {
Jouni Malinen53264f62019-05-03 13:04:40 +0300159 STATUS_SENT_ERROR = -3,
Jouni Malinen0e29cf22019-02-19 01:13:21 +0200160 ERROR_SEND_STATUS = -2,
161 INVALID_SEND_STATUS = -1,
162 STATUS_SENT = 0,
163 SUCCESS_SEND_STATUS = 1
164};
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200165
166struct sigma_cmd_handler {
167 struct sigma_cmd_handler *next;
168 char *cmd;
169 int (*validate)(struct sigma_cmd *cmd);
170 /* process return value:
171 * -2 = failed, caller will send status,ERROR
172 * -1 = failed, caller will send status,INVALID
Jouni Malinen0e29cf22019-02-19 01:13:21 +0200173 * 0 = response already sent
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200174 * 1 = success, caller will send status,COMPLETE
175 */
Jouni Malinen26a5b762019-02-19 01:17:48 +0200176 enum sigma_cmd_result (*process)(struct sigma_dut *dut,
177 struct sigma_conn *conn,
178 struct sigma_cmd *cmd);
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200179};
180
181#define P2P_GRP_ID_LEN 128
182#define IP_ADDR_STR_LEN 16
183
184struct wfa_cs_p2p_group {
185 struct wfa_cs_p2p_group *next;
186 char ifname[IFNAMSIZ];
187 int go;
188 char grpid[P2P_GRP_ID_LEN];
189 char ssid[33];
190};
191
192#ifdef CONFIG_TRAFFIC_AGENT
193
194#define MAX_SIGMA_STREAMS 16
195#define MAX_SIGMA_STATS 6000
196
197struct sigma_frame_stats {
198 unsigned int seqnum;
199 unsigned int local_sec;
200 unsigned int local_usec;
201 unsigned int remote_sec;
202 unsigned int remote_usec;
203};
204
205struct sigma_stream {
206 enum sigma_stream_profile {
207 SIGMA_PROFILE_FILE_TRANSFER,
208 SIGMA_PROFILE_MULTICAST,
209 SIGMA_PROFILE_IPTV,
210 SIGMA_PROFILE_TRANSACTION,
211 SIGMA_PROFILE_START_SYNC,
212 SIGMA_PROFILE_UAPSD
213 } profile;
214 int sender;
215 struct in_addr dst;
216 int dst_port;
217 struct in_addr src;
218 int src_port;
219 int frame_rate;
220 int duration;
Jouni Malinenc2493f82016-06-05 18:01:33 +0300221 unsigned int payload_size;
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200222 int start_delay;
223 int max_cnt;
224 enum sigma_traffic_class {
225 SIGMA_TC_VOICE,
226 SIGMA_TC_VIDEO,
227 SIGMA_TC_BACKGROUND,
228 SIGMA_TC_BEST_EFFORT
229 } tc;
230 int user_priority;
231 int user_priority_set;
232 int started;
233 int no_timestamps;
234
235 int sock;
236 pthread_t thr;
237 int stop;
238 int ta_send_in_progress;
239 int trans_proto;
240
241 /* Statistics */
242 int tx_act_frames; /*
243 * Number of frames generated by the traffic
244 * generator application. The name is defined in the
245 * Sigma CAPI spec.
246 */
247 int tx_frames;
248 int rx_frames;
249 unsigned long long tx_payload_bytes;
250 unsigned long long rx_payload_bytes;
251 int out_of_seq_frames;
252 struct sigma_frame_stats *stats;
253 unsigned int num_stats;
254 unsigned int stream_id;
255
256 /* U-APSD */
257 unsigned int sta_id;
258 unsigned int rx_cookie;
259 unsigned int uapsd_sta_tc;
260 unsigned int uapsd_rx_state;
261 unsigned int uapsd_tx_state;
262 unsigned int tx_stop_cnt;
263 unsigned int tx_hello_cnt;
264 pthread_t uapsd_send_thr;
265 pthread_cond_t tx_thr_cond;
266 pthread_mutex_t tx_thr_mutex;
267 int reset_rx;
268 int num_retry;
269 char ifname[IFNAMSIZ]; /* ifname from the command */
270 struct sigma_dut *dut; /* for traffic agent thread to access context */
Pradeep Reddy POTTETI79594042015-11-23 12:59:12 +0530271 /* console */
272 char test_name[9]; /* test case name */
273 int can_quit;
274 int reset;
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200275};
276
277#endif /* CONFIG_TRAFFIC_AGENT */
278
Alexei Avshalom Lazarbc180dc2018-12-18 16:01:14 +0200279/* extended scheduling test */
280enum sigma_ese_type {
281 ESE_CBAP,
282 ESE_SP,
283};
284
285struct sigma_ese_alloc {
286 unsigned int percent_bi;
287 enum sigma_ese_type type;
288 unsigned int src_aid, dst_aid;
289};
290
291#define ESE_BCAST_AID 255
292#define MAX_ESE_ALLOCS 4
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200293
294#define NUM_AP_AC 4
295#define AP_AC_BE 0
296#define AP_AC_BK 1
297#define AP_AC_VI 2
298#define AP_AC_VO 3
299
Adil Saeed Musthafab7b297f2017-04-10 23:13:31 -0700300#define MAX_WLAN_TAGS 3
Adil Saeed Musthafa69063722017-04-10 23:13:40 -0700301#define MBO_MAX_PREF_BSSIDS 10
Adil Saeed Musthafa4ec61bd2017-04-10 23:13:41 -0700302#define MAX_FT_BSS_LIST 10
Adil Saeed Musthafab7b297f2017-04-10 23:13:31 -0700303
Peng Xu8863ec72018-08-06 11:50:37 -0700304#define TRANSPORT_PROTO_TYPE_TCP 0x06
305#define TRANSPORT_PROTO_TYPE_UDP 0x11
306#define NAN_TRANSPORT_PORT_DEFAULT 7000
307#define NAN_TRANSPORT_PROTOCOL_DEFAULT TRANSPORT_PROTO_TYPE_TCP
308
Jouni Malinen57fa3d82016-11-30 12:51:43 +0200309enum value_not_set_enabled_disabled {
310 VALUE_NOT_SET,
311 VALUE_ENABLED,
312 VALUE_DISABLED
313};
314
Pradeep Reddy Potteti4b0cdee2017-03-15 12:37:33 +0530315enum sec_ch_offset {
316 SEC_CH_NO,
317 SEC_CH_40ABOVE,
318 SEC_CH_40BELOW
319};
320
Adil Saeed Musthafa69063722017-04-10 23:13:40 -0700321struct mbo_pref_ap {
322 int ap_ne_class;
323 int ap_ne_op_ch;
324 int ap_ne_pref;
325 unsigned char mac_addr[ETH_ALEN];
326};
327
Peng Xu291d97d2018-01-31 16:34:03 -0800328#ifdef NL80211_SUPPORT
329#define SOCK_BUF_SIZE (32 * 1024)
330struct nl80211_ctx {
331 struct nl_sock *sock;
332 int netlink_familyid;
333 int nlctrl_familyid;
334 size_t sock_buf_size;
Kiran Kumar Lokeref61a7432021-06-24 00:19:19 -0700335 struct nl_sock *event_sock;
Peng Xu291d97d2018-01-31 16:34:03 -0800336};
337#endif /* NL80211_SUPPORT */
338
Alexei Avshalom Lazar33f700c2018-12-18 16:00:39 +0200339/* hardcoded long WSC IE values to force fragmentation */
340#define WPS_LONG_DEVICE_NAME "Qti1234511adtest1234567890123456"
341#define WPS_LONG_MANUFACTURER "Qti1234511adQti1234511adQti1234511adQti1234511adQti1234511ad"
342#define WPS_LONG_MODEL_NAME "Qti1234511adtest1234567890123456"
343#define WPS_LONG_MODEL_NUMBER "11111111111111111111111111111111"
344#define WPS_LONG_SERIAL_NUMBER "22222222222222222222222222222222"
345
Jouni Malinene4fde732019-03-25 22:29:37 +0200346enum akm_suite_values {
347 AKM_WPA_EAP = 1,
348 AKM_WPA_PSK = 2,
349 AKM_FT_EAP = 3,
350 AKM_FT_PSK = 4,
351 AKM_EAP_SHA256 = 5,
352 AKM_PSK_SHA256 = 6,
353 AKM_SAE = 8,
354 AKM_FT_SAE = 9,
355 AKM_SUITE_B = 12,
356 AKM_FT_SUITE_B = 13,
357 AKM_FILS_SHA256 = 14,
358 AKM_FILS_SHA384 = 15,
359 AKM_FT_FILS_SHA256 = 16,
360 AKM_FT_FILS_SHA384 = 17,
361
362};
363
Veerendranath Jakkam9ceb3b12021-09-10 03:18:17 +0530364enum ip_version {
365 DEFAULT_IP_VERSION = 0,
366 IPV4 = 4,
367 IPV6 = 6,
368};
369
370enum ip_protocol {
371 DEFAULT_PROTOCOL = 0,
372 PROTOCOL_UDP = 17,
373 PROTOCOL_TCP = 6,
374 PROTOCOL_ESP = 50,
375};
376
377#define DSCP_POLICY_SUCCESS 0
378#define DSCP_POLICY_REJECT 1
379
380struct dscp_policy_status {
381 int id;
382 int status;
383};
384
385struct dscp_policy_data {
386 char domain_name[250];
387 int policy_id;
388 enum ip_version ip_version;
389 char src_ip[INET6_ADDRSTRLEN];
390 char dst_ip[INET6_ADDRSTRLEN];
391 int src_port;
392 int dst_port;
393 int start_port;
394 int end_port;
395 enum ip_protocol protocol;
396 int dscp;
Shivani Baranwal9cfc8d72021-11-22 11:53:19 +0530397 int granularity_score;
Veerendranath Jakkam9ceb3b12021-09-10 03:18:17 +0530398 struct dscp_policy_data *next;
399};
400
Jouni Malinen29a63f42022-04-13 22:08:47 +0300401enum dpp_mdns_role {
402 DPP_MDNS_NOT_RUNNING,
403 DPP_MDNS_RELAY,
404 DPP_MDNS_CONTROLLER,
Jouni Malinen3f5aa9f2022-05-17 23:25:03 +0300405 DPP_MDNS_BOOTSTRAPPING,
Jouni Malinen29a63f42022-04-13 22:08:47 +0300406};
407
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200408struct sigma_dut {
Jouni Malinend2095482019-11-04 17:10:43 +0200409 const char *main_ifname;
Jouni Malinenb21f0542019-11-04 17:53:38 +0200410 char *main_ifname_2g;
411 char *main_ifname_5g;
Jouni Malinend2095482019-11-04 17:10:43 +0200412 const char *station_ifname;
Jouni Malinenb21f0542019-11-04 17:53:38 +0200413 char *station_ifname_2g;
414 char *station_ifname_5g;
Jouni Malinen1f76fa62019-11-04 17:30:12 +0200415 char *p2p_ifname_buf;
Jouni Malinenb21f0542019-11-04 17:53:38 +0200416 int use_5g;
Kiran Kumar Lokereafa02af2021-05-11 18:28:03 -0700417 int ap_band_6g;
Jouni Malinen78217db2019-11-06 18:46:08 +0200418 int sta_2g_started;
419 int sta_5g_started;
Jouni Malinend2095482019-11-04 17:10:43 +0200420
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200421 int s; /* server TCP socket */
422 int debug_level;
423 int stdout_debug;
424 struct sigma_cmd_handler *cmds;
Jouni Malinen0fee7012019-02-19 12:41:07 +0200425 int response_sent;
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200426
Alexei Avshalom Lazarc9bc15d2020-01-29 10:52:13 +0200427 const char *sigma_tmpdir;
428
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200429 /* Default timeout value (seconds) for commands */
430 unsigned int default_timeout;
Vinita S. Maloof7a2cbf2020-11-18 19:29:44 +0530431 unsigned int user_config_timeout;
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200432
433 int next_streamid;
434
435 const char *bridge; /* bridge interface to use in AP mode */
436
437 enum sigma_mode {
438 SIGMA_MODE_UNKNOWN,
439 SIGMA_MODE_STATION,
440 SIGMA_MODE_AP,
441 SIGMA_MODE_SNIFFER
442 } mode;
443
444 /*
445 * Local cached values to handle API that does not provide all the
446 * needed information with commands that actually trigger some
447 * operations.
448 */
449 int listen_chn;
450 int persistent;
451 int intra_bss;
452 int noa_duration;
453 int noa_interval;
454 int noa_count;
455 enum wfa_cs_wps_method {
456 WFA_CS_WPS_NOT_READY,
457 WFA_CS_WPS_PBC,
458 WFA_CS_WPS_PIN_DISPLAY,
459 WFA_CS_WPS_PIN_LABEL,
460 WFA_CS_WPS_PIN_KEYPAD
461 } wps_method;
462 char wps_pin[9];
463
464 struct wfa_cs_p2p_group *groups;
465
466 char infra_ssid[33];
467 int infra_network_id;
468
469 enum p2p_mode {
470 P2P_IDLE, P2P_DISCOVER, P2P_LISTEN, P2P_DISABLE
471 } p2p_mode;
472
473 int go;
474 int p2p_client;
Jouni Malinen016ae6c2019-11-04 17:00:01 +0200475 const char *p2p_ifname;
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200476
477 int client_uapsd;
478
479 char arp_ipaddr[IP_ADDR_STR_LEN];
480 char arp_ifname[IFNAMSIZ + 1];
481
482 enum sta_pmf {
483 STA_PMF_DISABLED,
484 STA_PMF_OPTIONAL,
485 STA_PMF_REQUIRED
486 } sta_pmf;
487
Jouni Malinen6a7c9b42019-08-20 00:15:59 +0300488 int sta_ft_ds;
489
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200490 int no_tpk_expiration;
491
492 int er_oper_performed;
493 char er_oper_bssid[20];
494 int amsdu_size;
495 int back_rcv_buf;
496
497 int testbed_flag_txsp;
498 int testbed_flag_rxsp;
499 int chwidth;
500
Jouni Malinen8179fee2019-03-28 03:19:47 +0200501 unsigned int akm_values;
502
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200503 /* AP configuration */
504 char ap_ssid[33];
Adil Saeed Musthafab7b297f2017-04-10 23:13:31 -0700505 /*
506 * WLAN-TAG of 1 will use 'ap_' variables;
507 * tag higher than 1 will use 'ap_tag_' variables.
508 */
509 char ap_tag_ssid[MAX_WLAN_TAGS - 1][33];
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200510 enum ap_mode {
511 AP_11a,
512 AP_11g,
513 AP_11b,
514 AP_11na,
515 AP_11ng,
516 AP_11ac,
Alexei Avshalom Lazar2712cc82018-12-23 16:29:14 +0200517 AP_11ad,
Priyadharshini Gowthaman4401cee2019-11-21 14:38:33 -0800518 AP_11ax,
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200519 AP_inval
520 } ap_mode;
521 int ap_channel;
Xin Dengb78d1c22021-01-20 19:54:07 +0530522 int ap_tag_channel[MAX_WLAN_TAGS - 1];
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200523 int ap_rts;
524 int ap_frgmnt;
525 int ap_bcnint;
Jouni Malinend2e9bb32020-05-06 01:12:03 +0300526 int ap_start_disabled;
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200527 struct qos_params {
528 int ac;
529 int cwmin;
530 int cwmax;
531 int aifs;
532 int txop;
533 int acm;
534 } ap_qos[NUM_AP_AC], ap_sta_qos[NUM_AP_AC];
Jouni Malinen57fa3d82016-11-30 12:51:43 +0200535 enum value_not_set_enabled_disabled ap_noack;
536 enum value_not_set_enabled_disabled ap_ampdu;
537 enum value_not_set_enabled_disabled ap_amsdu;
538 enum value_not_set_enabled_disabled ap_rx_amsdu;
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200539 int ap_ampdu_exp;
Pravas Kumar Pandabaae9682021-02-23 22:27:09 +0530540 int ap_max_mpdu_len;
Jouni Malinen57fa3d82016-11-30 12:51:43 +0200541 enum value_not_set_enabled_disabled ap_addba_reject;
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200542 int ap_fixed_rate;
543 int ap_mcs;
544 int ap_rx_streams;
545 int ap_tx_streams;
546 unsigned int ap_vhtmcs_map;
Jouni Malinen57fa3d82016-11-30 12:51:43 +0200547 enum value_not_set_enabled_disabled ap_ldpc;
548 enum value_not_set_enabled_disabled ap_sig_rts;
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200549 enum ap_chwidth {
550 AP_20,
551 AP_40,
552 AP_80,
553 AP_160,
priyadharshini gowthaman63ab8482017-12-28 15:32:55 -0800554 AP_80_80,
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200555 AP_AUTO
556 } ap_chwidth;
Pradeep Reddy Pottetibf8af292017-02-15 15:28:39 +0530557 enum ap_chwidth default_11na_ap_chwidth;
558 enum ap_chwidth default_11ng_ap_chwidth;
Hu Wangacede502021-11-15 19:41:00 +0530559 enum value_not_set_enabled_disabled ap_tx_stbc;
Jouni Malinen57fa3d82016-11-30 12:51:43 +0200560 enum value_not_set_enabled_disabled ap_dyn_bw_sig;
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200561 int ap_sgi80;
562 int ap_p2p_mgmt;
563 enum ap_key_mgmt {
564 AP_OPEN,
565 AP_WPA2_PSK,
566 AP_WPA_PSK,
567 AP_WPA2_EAP,
568 AP_WPA_EAP,
569 AP_WPA2_EAP_MIXED,
Jouni Malinen30824df2017-08-22 21:21:38 +0300570 AP_WPA2_PSK_MIXED,
571 AP_WPA2_SAE,
572 AP_WPA2_PSK_SAE,
Jouni Malinenad395a22017-09-01 21:13:46 +0300573 AP_SUITEB,
Jouni Malinen147b3c32017-10-09 16:51:54 +0300574 AP_WPA2_OWE,
Jouni Malinen4cf699f2018-06-19 00:46:27 +0300575 AP_WPA2_EAP_OSEN,
Jouni Malinen6be21c82018-08-01 18:47:24 +0300576 AP_WPA2_FT_EAP,
577 AP_WPA2_FT_PSK,
578 AP_WPA2_EAP_SHA256,
579 AP_WPA2_PSK_SHA256,
580 AP_WPA2_ENT_FT_EAP,
Jouni Malinenc2b91212018-09-12 02:26:39 +0300581 AP_OSEN,
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200582 } ap_key_mgmt;
Adil Saeed Musthafab7b297f2017-04-10 23:13:31 -0700583 enum ap_tag_key_mgmt {
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200584 AP2_OPEN,
Adil Saeed Musthafab7b297f2017-04-10 23:13:31 -0700585 AP2_OSEN,
Jouni Malinen353ba8b2018-01-10 17:04:12 +0200586 AP2_WPA2_PSK,
587 AP2_WPA2_OWE,
Adil Saeed Musthafab7b297f2017-04-10 23:13:31 -0700588 } ap_tag_key_mgmt[MAX_WLAN_TAGS - 1];
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200589 int ap_add_sha256;
priyadharshini gowthamande81f392017-12-28 15:28:49 -0800590 int ap_add_sha384;
Sarvepalli, Rajesh Babu24dc7e42016-03-18 21:27:26 +0530591 int ap_rsn_preauth;
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200592 enum ap_pmf {
593 AP_PMF_DISABLED,
594 AP_PMF_OPTIONAL,
595 AP_PMF_REQUIRED
596 } ap_pmf;
597 enum ap_cipher {
Jouni Malinen2ba24492017-11-17 12:43:59 +0200598 AP_NO_GROUP_CIPHER_SET,
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200599 AP_CCMP,
600 AP_TKIP,
601 AP_WEP,
602 AP_PLAIN,
Jouni Malinenad395a22017-09-01 21:13:46 +0300603 AP_CCMP_TKIP,
604 AP_GCMP_256,
Jouni Malinen3d633da2017-09-14 22:19:21 +0300605 AP_GCMP_128,
606 AP_CCMP_256,
Jouni Malinend538c782017-11-17 12:13:04 +0200607 AP_CCMP_128_GCMP_256,
Jouni Malinen2ba24492017-11-17 12:43:59 +0200608 } ap_cipher, ap_group_cipher;
Jouni Malinen3d633da2017-09-14 22:19:21 +0300609 enum ap_group_mgmt_cipher {
610 AP_NO_GROUP_MGMT_CIPHER_SET,
611 AP_BIP_GMAC_256,
612 AP_BIP_CMAC_256,
613 AP_BIP_GMAC_128,
614 AP_BIP_CMAC_128,
615 } ap_group_mgmt_cipher;
Jouni Malinened670f42017-08-31 01:39:28 +0300616 char *ap_sae_groups;
Jouni Malinen2f524ce2017-08-31 01:43:29 +0300617 int sae_anti_clogging_threshold;
Jouni Malinenb347db02017-09-02 01:36:03 +0300618 int sae_reflection;
Jouni Malinen0a9876c2020-06-08 19:15:36 +0300619 int ap_sae_commit_status;
620 int ap_sae_pk_omit;
Jouni Malinen3c740ab2019-10-10 15:55:11 +0300621 int sae_confirm_immediate;
Jouni Malinen2126f422017-10-11 23:24:33 +0300622 char ap_passphrase[101];
Xin Dengb78d1c22021-01-20 19:54:07 +0530623 char ap_tag_passphrase[MAX_WLAN_TAGS - 1][101];
Jouni Malinen63370622017-11-18 17:47:13 +0200624 char ap_psk[65];
Jouni Malinen09550de2019-03-26 00:24:11 +0200625 char *ap_sae_passwords;
Jouni Malinen59fab0f2020-06-05 16:59:55 +0300626 char *ap_sae_pk_modifier;
627 char *ap_sae_pk_keypair;
Jouni Malinenfbf12ef2020-06-08 19:49:40 +0300628 char *ap_sae_pk_keypair_sig;
Jouni Malinen59fab0f2020-06-05 16:59:55 +0300629 int ap_sae_pk;
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200630 char ap_wepkey[27];
631 char ap_radius_ipaddr[20];
632 int ap_radius_port;
633 char ap_radius_password[200];
634 char ap2_radius_ipaddr[20];
635 int ap2_radius_port;
636 char ap2_radius_password[200];
637 int ap_tdls_prohibit;
638 int ap_tdls_prohibit_chswitch;
639 int ap_hs2;
640 int ap_dgaf_disable;
641 int ap_p2p_cross_connect;
642 int ap_oper_name;
643 int ap_wan_metrics;
644 int ap_conn_capab;
645 int ap_oper_class;
646
647 int ap_interworking;
648 int ap_access_net_type;
649 int ap_internet;
650 int ap_venue_group;
651 int ap_venue_type;
652 char ap_hessid[20];
653 char ap_roaming_cons[100];
654 int ap_venue_name;
655 int ap_net_auth_type;
656 int ap_nai_realm_list;
657 char ap_domain_name_list[1000];
658 int ap_ip_addr_type_avail;
659 char ap_plmn_mcc[10][4];
660 char ap_plmn_mnc[10][4];
661 int ap_gas_cb_delay;
662 int ap_proxy_arp;
663 int ap2_proxy_arp;
Jouni Malinendbbc2c42018-11-14 23:55:41 +0200664 int ap2_osu;
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200665 int ap_l2tif;
666 int ap_anqpserver;
667 int ap_anqpserver_on;
668 int ap_osu_provider_list;
Jouni Malinen93a837f2018-11-01 17:09:22 +0200669 int ap_osu_provider_nai_list;
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200670 int ap_qos_map_set;
671 int ap_bss_load;
672 char ap_osu_server_uri[10][256];
673 char ap_osu_ssid[33];
674 int ap_osu_method[10];
675 int ap_osu_icon_tag;
Jouni Malinen54a89b02018-05-01 00:16:26 +0300676 int ap_venue_url;
Jouni Malinenf7ff42b2018-05-01 00:21:56 +0300677 int ap_advice_of_charge;
Jouni Malinenac104532018-05-01 00:27:37 +0300678 int ap_oper_icon_metadata;
Jouni Malinenac367142018-05-01 00:32:24 +0300679 int ap_tnc_file_name;
680 unsigned int ap_tnc_time_stamp;
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200681
682 int ap_fake_pkhash;
683 int ap_disable_protection;
684 int ap_allow_vht_wep;
685 int ap_allow_vht_tkip;
686
687 enum ap_vht_chwidth {
688 AP_20_40_VHT_OPER_CHWIDTH,
689 AP_80_VHT_OPER_CHWIDTH,
690 AP_160_VHT_OPER_CHWIDTH
691 } ap_vht_chwidth;
692 int ap_txBF;
693 int ap_mu_txBF;
Pradeep Reddy POTTETIfba27db2015-11-20 16:42:22 +0530694 enum ap_regulatory_mode {
695 AP_80211D_MODE_DISABLED,
696 AP_80211D_MODE_ENABLED,
697 } ap_regulatory_mode;
698 enum ap_dfs_mode {
699 AP_DFS_MODE_DISABLED,
700 AP_DFS_MODE_ENABLED,
701 } ap_dfs_mode;
priyadharshini gowthaman264d5442016-02-25 15:52:22 -0800702 int ap_ndpa_frame;
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200703
priyadharshini gowthaman8e26ff42016-06-22 22:47:14 -0700704 int ap_lci;
705 char ap_val_lci[33];
priyadharshini gowthamanc2357bd2016-06-22 22:47:14 -0700706 char ap_infoz[17];
priyadharshini gowthaman8e26ff42016-06-22 22:47:14 -0700707 int ap_lcr;
708 char ap_val_lcr[400];
709 int ap_rrm;
710 int ap_rtt;
711 int ap_neighap; /* number of configured neighbor APs */
712 unsigned char ap_val_neighap[3][6];
713 int ap_opchannel; /* number of oper channels */
714 int ap_val_opchannel[3];
715 int ap_scan;
priyadharshini gowthamanc2357bd2016-06-22 22:47:14 -0700716 int ap_fqdn_held;
717 int ap_fqdn_supl;
priyadharshini gowthamana27b5b62016-06-22 22:47:14 -0700718 int ap_msnt_type;
719
priyadharshini gowthamanb4e05fc2016-10-13 15:02:35 -0700720 int ap_mbo;
721 int ap_ne_class;
722 int ap_ne_op_ch;
723 int ap_set_bssidpref;
724 int ap_btmreq_disassoc_imnt;
725 int ap_btmreq_term_bit;
Adil Saeed Musthafa7d9ae382017-04-10 23:13:33 -0700726 int ap_disassoc_timer;
727 int ap_btmreq_bss_term_dur;
Adil Saeed Musthafa604c8262017-04-10 23:13:31 -0700728 enum reg_domain {
729 REG_DOMAIN_NOT_SET,
730 REG_DOMAIN_LOCAL,
731 REG_DOMAIN_GLOBAL
732 } ap_reg_domain;
Adil Saeed Musthafacf752fa2017-04-10 23:13:32 -0700733 char ap_mobility_domain[10];
Adil Saeed Musthafa023108a2017-04-10 23:13:37 -0700734 unsigned char ap_cell_cap_pref;
Adil Saeed Musthafa4ec61bd2017-04-10 23:13:41 -0700735 int ap_ft_oa;
Jouni Malinen9f943312019-08-19 23:49:16 +0300736 enum value_not_set_enabled_disabled ap_ft_ds;
Adil Saeed Musthafa4ec61bd2017-04-10 23:13:41 -0700737 int ap_name;
priyadharshini gowthaman09d613e2017-12-20 11:43:44 -0800738 int ap_interface_5g;
739 int ap_interface_2g;
priyadharshini gowthaman776562e2017-12-20 12:33:34 -0800740 int ap_assoc_delay;
priyadharshini gowthaman94062b52017-12-20 12:33:34 -0800741 int ap_btmreq_bss_term_tsf;
priyadharshini gowthaman00798a22017-12-28 15:15:00 -0800742 int ap_fils_dscv_int;
743 int ap_nairealm_int;
744 char ap_nairealm[33];
745 int ap_blechanutil;
746 int ap_ble_admit_cap;
747 int ap_datappdudura;
748 int ap_airtimefract;
749 char ap_dhcpserv_ipaddr[20];
750 int ap_dhcp_stop;
751 int ap_bawinsize;
752 int ap_blestacnt;
priyadharshini gowthamancb22e432017-12-28 15:23:31 -0800753 int ap_ul_availcap;
754 int ap_dl_availcap;
priyadharshini gowthamande81f392017-12-28 15:28:49 -0800755 int ap_akm;
Jouni Malinenda5f35b2019-03-26 00:25:53 +0200756 unsigned int ap_akm_values;
priyadharshini gowthamande81f392017-12-28 15:28:49 -0800757 int ap_pmksa;
758 int ap_pmksa_caching;
Jouni Malinen05d005a2020-03-26 12:49:33 +0200759 int ap_beacon_prot;
Jouni Malinenc098c442020-03-26 13:01:50 +0200760 u8 ap_transition_disable;
priyadharshini gowthaman63ab8482017-12-28 15:32:55 -0800761 int ap_80plus80;
priyadharshini gowthaman9149afc2018-01-15 13:40:18 -0800762 int ap_oper_chn;
Adil Saeed Musthafa4ec61bd2017-04-10 23:13:41 -0700763
Adil Saeed Musthafa69063722017-04-10 23:13:40 -0700764 struct mbo_pref_ap mbo_pref_aps[MBO_MAX_PREF_BSSIDS];
765 struct mbo_pref_ap mbo_self_ap_tuple;
766 int mbo_pref_ap_cnt;
Adil Saeed Musthafa4ec61bd2017-04-10 23:13:41 -0700767 unsigned char ft_bss_mac_list[MAX_FT_BSS_LIST][ETH_ALEN];
768 int ft_bss_mac_cnt;
priyadharshini gowthamanb4e05fc2016-10-13 15:02:35 -0700769
Priyadharshini Gowthamanc067edf2019-06-20 11:23:27 -0700770 char *ar_ltf;
771
Priyadharshini Gowthamanbc948892019-09-10 14:22:49 -0700772 int ap_numsounddim;
Priyadharshini Gowthaman78ee2ef2019-11-15 16:08:28 -0800773 unsigned int he_mcsnssmap;
774 int he_ul_mcs;
Priyadharshini Gowthaman21f74402019-11-25 15:39:09 -0800775 int he_mmss;
Priyadharshini Gowthaman88d55c82019-12-12 14:31:46 -0800776 int he_srctrl_allow;
Priyadharshini Gowthamanbc948892019-09-10 14:22:49 -0700777
Priyadharshini Gowthamance7ba822020-05-27 13:03:09 -0700778 int ap_ocvc;
779
priyadharshini gowthaman00798a22017-12-28 15:15:00 -0800780 enum value_not_set_enabled_disabled ap_oce;
781 enum value_not_set_enabled_disabled ap_filsdscv;
782 enum value_not_set_enabled_disabled ap_filshlp;
783 enum value_not_set_enabled_disabled ap_broadcast_ssid;
784 enum value_not_set_enabled_disabled ap_rnr;
785 enum value_not_set_enabled_disabled ap_esp;
786
Priyadharshini Gowthamanc067edf2019-06-20 11:23:27 -0700787 enum value_not_set_enabled_disabled ap_he_ulofdma;
Priyadharshini Gowthamanfe60c502019-08-14 13:00:34 -0700788 enum value_not_set_enabled_disabled ap_he_dlofdma;
Priyadharshini Gowthaman670b3232019-09-10 16:09:19 -0700789 enum value_not_set_enabled_disabled ap_bcc;
Priyadharshini Gowthaman6bc4c1e2019-09-10 16:24:51 -0700790 enum value_not_set_enabled_disabled ap_he_frag;
Priyadharshini Gowthaman21895a52019-10-07 16:56:16 -0700791 enum value_not_set_enabled_disabled ap_mu_edca;
Priyadharshini Gowthaman43d6b412019-10-07 16:56:37 -0700792 enum value_not_set_enabled_disabled ap_he_rtsthrshld;
Priyadharshini Gowthaman8018c982019-10-31 15:14:37 -0700793 enum value_not_set_enabled_disabled ap_mbssid;
Priyadharshini Gowthamanae0a6052019-11-01 15:26:38 -0700794 enum value_not_set_enabled_disabled ap_twtresp;
Priyadharshini Gowthaman96d542e2019-11-21 14:25:21 -0800795 enum value_not_set_enabled_disabled he_sounding;
Priyadharshini Gowthaman9b7dbe12019-12-04 12:17:32 -0800796 enum value_not_set_enabled_disabled he_set_sta_1x1;
Priyadharshini Gowthamanc067edf2019-06-20 11:23:27 -0700797
priyadharshini gowthaman350f1912018-06-04 13:09:12 -0700798 enum ppdu {
799 PPDU_NOT_SET,
800 PPDU_MU,
801 PPDU_SU,
802 PPDU_ER,
803 PPDU_TB,
Priyadharshini Gowthamanfe60c502019-08-14 13:00:34 -0700804 PPDU_HESU,
priyadharshini gowthaman350f1912018-06-04 13:09:12 -0700805 } ap_he_ppdu;
806
Priyadharshini Gowthaman1a686bd2019-09-19 14:41:40 -0700807 enum bufsize {
808 BA_BUFSIZE_NOT_SET,
809 BA_BUFSIZE_64,
810 BA_BUFSIZE_256,
811 } ap_ba_bufsize;
812
Priyadharshini Gowthamandee79e22019-10-07 16:56:27 -0700813 enum mimo {
814 MIMO_NOT_SET,
815 MIMO_DL,
816 MIMO_UL,
817 } ap_he_mimo;
818
Alexei Avshalom Lazarbc180dc2018-12-18 16:01:14 +0200819 struct sigma_ese_alloc ap_ese_allocs[MAX_ESE_ALLOCS];
820 int ap_num_ese_allocs;
821
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200822 const char *hostapd_debug_log;
Alexei Avshalom Lazar3e8267e2018-12-18 15:58:54 +0200823 const char *wpa_supplicant_debug_log;
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200824
825#ifdef CONFIG_TRAFFIC_AGENT
826 /* Traffic Agent */
827 struct sigma_stream streams[MAX_SIGMA_STREAMS];
828 int stream_id;
829 int num_streams;
830 pthread_t thr;
831#endif /* CONFIG_TRAFFIC_AGENT */
832
Jouni Malinenc2493f82016-06-05 18:01:33 +0300833 unsigned int throughput_pktsize; /* If non-zero, override pktsize for
834 * throughput tests */
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200835 int no_timestamps;
836
837 const char *sniffer_ifname;
838 const char *set_macaddr;
839 int tmp_mac_addr;
840 int ap_is_dual;
841 enum ap_mode ap_mode_1;
842 enum ap_chwidth ap_chwidth_1;
843 int ap_channel_1;
844 char ap_countrycode[3];
845
846 int ap_wpsnfc;
847
Pradeep Reddy POTTETI0d3db632016-03-11 15:21:11 +0530848 enum ap_wme {
849 AP_WME_OFF,
850 AP_WME_ON,
851 } ap_wme;
852
Mohammed Shafi Shajakhan02e3b822017-02-23 04:15:02 +0530853 enum ap_wmmps {
854 AP_WMMPS_OFF,
855 AP_WMMPS_ON,
856 } ap_wmmps;
857
Pradeep Reddy Potteti4b0cdee2017-03-15 12:37:33 +0530858 enum sec_ch_offset ap_chwidth_offset;
859
Jouni Malinenba4f2d42019-10-04 16:13:41 +0300860 char *ap_dpp_conf_addr;
861 char *ap_dpp_conf_pkhash;
862
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200863#ifdef CONFIG_SNIFFER
864 pid_t sniffer_pid;
865 char sniffer_filename[200];
866#endif /* CONFIG_SNIFFER */
867
868 int last_set_ip_config_ipv6;
Amarnath Hullur Subramanyam9c381f52017-03-17 00:04:41 -0700869#ifdef MIRACAST
870 pthread_t rtsp_thread_handle;
871 int wfd_device_type; /* 0 for source, 1 for sink */
872 char peer_mac_address[32];
Sunil Duttbf9bcdf2020-04-02 19:14:52 +0530873 char modified_peer_mac_address[32];
Amarnath Hullur Subramanyam9c381f52017-03-17 00:04:41 -0700874 void *miracast_lib;
875 const char *miracast_lib_path;
876 char mdns_instance_name[64];
877#endif /* MIRACAST */
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200878
879 int tid_to_handle[8]; /* Mapping of TID to handle */
880 int dialog_token; /* Used for generating unique handle for an addTs */
881
882 enum sigma_program {
883 PROGRAM_UNKNOWN = 0,
884 PROGRAM_TDLS,
885 PROGRAM_HS2,
886 PROGRAM_HS2_R2,
887 PROGRAM_WFD,
Amarnath Hullur Subramanyam659a34c2017-03-17 00:04:41 -0700888 PROGRAM_DISPLAYR2,
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200889 PROGRAM_PMF,
890 PROGRAM_WPS,
891 PROGRAM_60GHZ,
892 PROGRAM_HT,
893 PROGRAM_VHT,
894 PROGRAM_NAN,
priyadharshini gowthaman12dd4142016-06-22 22:47:14 -0700895 PROGRAM_LOC,
Adil Saeed Musthafa33ea2872017-04-10 23:13:24 -0700896 PROGRAM_MBO,
Jouni Malinen5c3813a2017-08-26 13:30:39 +0300897 PROGRAM_IOTLP,
898 PROGRAM_DPP,
Ankita Bajaja2cb5672017-10-25 16:08:28 +0530899 PROGRAM_OCE,
priyadharshini gowthaman0e209fc2018-01-26 15:15:37 -0800900 PROGRAM_WPA3,
Amarnath Hullur Subramanyam8f9c8682018-01-30 19:01:51 -0800901 PROGRAM_HE,
Jouni Malinenba630452018-06-22 11:49:59 +0300902 PROGRAM_HS2_R3,
Vamsi Krishnaf642d6a2020-03-27 12:33:14 +0530903 PROGRAM_QM,
Jouni Malinen9a742ff2022-01-27 00:43:14 +0200904 PROGRAM_HS2_R4,
Jouni Malinend7152c72022-09-29 18:55:55 +0300905 PROGRAM_HS2_2022,
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200906 } program;
907
908 enum device_type {
909 device_type_unknown,
910 AP_unknown,
911 AP_testbed,
912 AP_dut,
913 STA_unknown,
914 STA_testbed,
915 STA_dut
916 } device_type;
917
918 enum {
919 DEVROLE_UNKNOWN = 0,
920 DEVROLE_STA,
921 DEVROLE_PCP,
Alexei Avshalom Lazar2712cc82018-12-23 16:29:14 +0200922 DEVROLE_STA_CFON,
923 DEVROLE_AP,
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200924 } dev_role;
925
Alexei Avshalom Lazar33f700c2018-12-18 16:00:39 +0200926 enum wps_band {
927 WPS_BAND_NON_60G = 0,
928 WPS_BAND_60G,
929 } band;
930
Alexei Avshalom Lazareee9ab02018-12-24 16:27:48 +0200931 int wps_disable; /* Used for 60G to disable PCP from sending WPS IE */
Alexei Avshalom Lazar33f700c2018-12-18 16:00:39 +0200932 int wsc_fragment; /* simulate WSC IE fragmentation */
Alexei Avshalom Lazar2eccf4d2019-01-31 10:03:59 +0200933 int eap_fragment; /* simulate EAP fragmentation */
Alexei Avshalom Lazar744ae8a2019-01-31 17:26:46 +0200934 int wps_forced_version; /* Used to force reported WPS version */
Alexei Avshalom Lazarb094bf02018-12-18 16:00:53 +0200935 enum {
936 /* no change */
937 FORCE_RSN_IE_NONE = 0,
938 /* if exists, remove and clear privacy bit */
939 FORCE_RSN_IE_REMOVE,
940 /* if not exists, add and set privacy bit */
941 FORCE_RSN_IE_ADD,
942 } force_rsn_ie; /* override RSN IE in association request */
Alexei Avshalom Lazar33f700c2018-12-18 16:00:39 +0200943
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200944 const char *version;
945 int no_ip_addr_set;
946 int sta_channel;
947
948 const char *summary_log;
949 const char *hostapd_entropy_log;
950
951 int iface_down_on_reset;
952 int write_stats; /* traffic stream e2e*.txt files */
Bala Krishna Bhamidipati73d7af02016-03-24 12:27:56 +0530953 int sim_no_username; /* do not set SIM username to use real SIM */
Jouni Malinen5db3b102016-08-04 12:27:18 +0300954
955 const char *vendor_name; /* device_get_info vendor override */
956 const char *model_name; /* device_get_info model override */
957 const char *version_name; /* device_get_info version override */
Kiran Kumar Lokere0128bf92019-04-08 18:36:16 -0700958 const char *log_file_dir; /* Directory to generate log file */
959 FILE *log_file_fd; /* Pointer to log file */
Rakesh Sunki7d37f412017-03-30 14:47:55 -0700960
Rakesh Sunki14cfcd22017-03-30 14:47:55 -0700961 int ndp_enable; /* Flag which is set once the NDP is setup */
962
Peng Xu8863ec72018-08-06 11:50:37 -0700963 int ndpe; /* Flag indicating NDPE is supported */
964 u16 trans_port; /* transport port number for TCP/UDP connection */
965 u8 trans_proto; /* transport protocol, 0x06: TCP, 0x11: UDP */
Peng Xu47d709b2019-06-04 18:14:02 -0700966 u8 nan_ipv6_addr[IPV6_ADDR_LEN]; /* NAN IPv6 address */
967 u8 nan_ipv6_len; /* NAN IPv6 address length */
Peng Xu8863ec72018-08-06 11:50:37 -0700968
Rakesh Sunki7d37f412017-03-30 14:47:55 -0700969 /* Length of nan_pmk in octets */
970 u8 nan_pmk_len;
971
972 /*
973 * PMK: Info is optional in Discovery phase. PMK info can
974 * be passed during the NDP session.
975 */
976 u8 nan_pmk[32];
Adil Saeed Musthafa33ea2872017-04-10 23:13:24 -0700977
978 enum value_not_set_enabled_disabled wnm_bss_max_feature;
979 int wnm_bss_max_idle_time;
980 enum value_not_set_enabled_disabled wnm_bss_max_protection;
Ashwini Patil00402582017-04-13 12:29:39 +0530981
982 char *non_pref_ch_list; /* MBO: non-preferred channel report */
Ashwini Patil5acd7382017-04-13 15:55:04 +0530983 char *btm_query_cand_list; /* Candidate list for BTM Query */
Jouni Malinen3c367e82017-06-23 17:01:47 +0300984
Jouni Malinen68143132017-09-02 02:34:08 +0300985 char *sae_commit_override;
Jouni Malinen3c367e82017-06-23 17:01:47 +0300986 char *rsne_override;
Jouni Malinen7960e3a2019-12-07 17:04:35 +0200987 char *rsnxe_override_eapol;
Jouni Malinen134fe3c2019-06-12 04:16:49 +0300988 int sta_associate_wait_connect;
989 char server_cert_hash[65];
Jouni Malinen37d5c692019-08-19 16:56:55 +0300990 int server_cert_tod;
Jouni Malinen134fe3c2019-06-12 04:16:49 +0300991 int sta_tod_policy;
Jouni Malinend6bf1b42017-06-23 17:51:01 +0300992 const char *hostapd_bin;
993 int use_hostapd_pid_file;
994 const char *hostapd_ifname;
Jouni Malinend86e5822017-08-29 03:55:32 +0300995 int hostapd_running;
996
Jouni Malinenb1dd21f2017-11-13 19:14:29 +0200997 char *dpp_peer_uri;
Jouni Malinend86e5822017-08-29 03:55:32 +0300998 int dpp_local_bootstrap;
999 int dpp_conf_id;
Jouni Malinen1dabb5a2020-06-26 21:05:21 +03001000 int dpp_network_id;
Jouni Malinen29a63f42022-04-13 22:08:47 +03001001 enum dpp_mdns_role dpp_mdns;
Ankita Bajaj1bde7942018-01-09 19:15:01 +05301002
1003 u8 fils_hlp;
1004 pthread_t hlp_thread;
Peng Xu291d97d2018-01-31 16:34:03 -08001005
1006#ifdef NL80211_SUPPORT
1007 struct nl80211_ctx *nl_ctx;
Sunil Dutt076081f2018-02-05 19:45:50 +05301008 int config_rsnie;
Peng Xu291d97d2018-01-31 16:34:03 -08001009#endif /* NL80211_SUPPORT */
Arif Hussainac6c5112018-05-25 17:34:00 -07001010
1011 int sta_nss;
Anurag Das2052daa2018-08-31 14:35:25 +05301012
Kiran Kumar Lokeref61a7432021-06-24 00:19:19 -07001013 int sta_async_twt_supp; /* Asynchronous TWT response event support */
1014
Anurag Das2052daa2018-08-31 14:35:25 +05301015#ifdef ANDROID
1016 int nanservicediscoveryinprogress;
1017#endif /* ANDROID */
Priyadharshini Gowthamand06f1002019-04-22 15:45:41 -07001018
1019 const char *priv_cmd; /* iwpriv / cfg80211tool command name */
Kiran Kumar Lokere0128bf92019-04-08 18:36:16 -07001020
1021 unsigned int wpa_log_size;
1022 char dev_start_test_runtime_id[100];
Vinay Gannevaram2dfb1da2019-06-14 15:24:08 +05301023#ifdef ANDROID_WIFI_HAL
1024 wifi_interface_handle wifi_hal_iface_handle;
1025 wifi_handle wifi_hal_handle;
1026 bool wifi_hal_initialized;
1027#endif /*ANDROID_WIFI_HAL*/
Jouni Malinen11e55212019-11-22 21:46:59 +02001028
1029 int sae_h2e_default;
1030 enum {
1031 SAE_PWE_DEFAULT,
1032 SAE_PWE_LOOP,
1033 SAE_PWE_H2E
1034 } sae_pwe;
Hu Wang6010ce72020-03-05 19:33:53 +08001035 int owe_ptk_workaround;
Lavanya Suresh2e2097d2021-02-23 21:17:28 +05301036 struct dut_hw_modes hw_modes;
Vamsi Krishnac1633d22020-05-06 18:31:21 +05301037 int ocvc;
Veerendranath Jakkamc1f71b62021-01-23 03:09:51 +05301038 int beacon_prot;
Jouni Malinen67433fc2020-06-26 22:50:33 +03001039 int client_privacy;
Veerendranath Jakkam47867202020-12-21 01:53:52 +05301040 int client_privacy_default;
Veerendranath Jakkam54ddc352020-07-05 15:47:54 +05301041 int saquery_oci_freq;
Venkateswara Naralasettyf0f88052020-11-11 19:15:17 +05301042 char device_driver[32];
Vinita S. Maloo1ded3742021-07-28 16:55:21 +05301043 int user_config_ap_ocvc;
1044 int user_config_ap_beacon_prot;
Veerendranath Jakkam329a3cd2021-09-11 18:10:13 +05301045 char qm_domain_name[250];
Veerendranath Jakkam9ceb3b12021-09-10 03:18:17 +05301046 struct dscp_policy_data *dscp_policy_table;
1047 pthread_t dscp_policy_mon_thread;
Veerendranath Jakkama16cdc82021-09-12 16:44:22 +05301048 int reject_dscp_policies;
1049 int dscp_reject_resp_code;
Veerendranath Jakkam1bf1bd62021-09-12 16:35:55 +05301050 struct dscp_policy_status dscp_status[5];
1051 unsigned int num_dscp_status;
Shivani Baranwalebde8f62021-10-19 12:26:02 +05301052 unsigned int prev_disable_scs_support;
1053 unsigned int prev_disable_mscs_support;
Shivani Baranwal9cfc8d72021-11-22 11:53:19 +05301054 int dscp_use_iptables;
Veerendranath Jakkamf6c8ab52022-03-10 05:43:02 -08001055 int autoconnect_default;
Veerendranath Jakkamfc5b7d22022-04-15 02:12:12 +05301056 int dhcp_client_running;
Jouni Malinencd4e3c32015-10-29 12:39:56 +02001057};
1058
1059
1060enum sigma_dut_print_level {
1061 DUT_MSG_DEBUG, DUT_MSG_INFO, DUT_MSG_ERROR
1062};
1063
1064void sigma_dut_print(struct sigma_dut *dut, int level, const char *fmt, ...)
1065PRINTF_FORMAT(3, 4);
1066
1067void sigma_dut_summary(struct sigma_dut *dut, const char *fmt, ...)
1068PRINTF_FORMAT(2, 3);
1069
1070
1071enum sigma_status {
1072 SIGMA_RUNNING, SIGMA_INVALID, SIGMA_ERROR, SIGMA_COMPLETE
1073};
1074
1075void send_resp(struct sigma_dut *dut, struct sigma_conn *conn,
Jouni Malinen76401f52017-03-18 01:04:55 +02001076 enum sigma_status status, const char *buf);
Jouni Malinencd4e3c32015-10-29 12:39:56 +02001077
1078const char * get_param(struct sigma_cmd *cmd, const char *name);
Alexei Avshalom Lazarbc180dc2018-12-18 16:01:14 +02001079const char * get_param_indexed(struct sigma_cmd *cmd, const char *name,
1080 int index);
Vinita S. Maloo8d7a28d2021-01-21 22:55:00 +05301081const char * get_param_fmt(struct sigma_cmd *cmd, const char *name, ...);
Jouni Malinencd4e3c32015-10-29 12:39:56 +02001082
1083int sigma_dut_reg_cmd(const char *cmd,
1084 int (*validate)(struct sigma_cmd *cmd),
Jouni Malinen26a5b762019-02-19 01:17:48 +02001085 enum sigma_cmd_result (*process)(struct sigma_dut *dut,
1086 struct sigma_conn *conn,
1087 struct sigma_cmd *cmd));
Jouni Malinencd4e3c32015-10-29 12:39:56 +02001088
1089void sigma_dut_register_cmds(void);
1090
Jouni Malinena485fd12019-06-13 23:27:01 +03001091enum sigma_cmd_result cmd_sta_send_frame(struct sigma_dut *dut,
1092 struct sigma_conn *conn,
1093 struct sigma_cmd *cmd);
Jouni Malinencd4e3c32015-10-29 12:39:56 +02001094int cmd_sta_set_parameter(struct sigma_dut *dut, struct sigma_conn *conn,
1095 struct sigma_cmd *cmd);
Jouni Malinena485fd12019-06-13 23:27:01 +03001096enum sigma_cmd_result cmd_ap_send_frame(struct sigma_dut *dut,
1097 struct sigma_conn *conn,
1098 struct sigma_cmd *cmd);
1099enum sigma_cmd_result cmd_wlantest_send_frame(struct sigma_dut *dut,
1100 struct sigma_conn *conn,
1101 struct sigma_cmd *cmd);
Ankita Bajaj0d5825b2017-10-25 16:20:17 +05301102int sta_cfon_set_wireless(struct sigma_dut *dut, struct sigma_conn *conn,
1103 struct sigma_cmd *cmd);
1104int sta_cfon_get_mac_address(struct sigma_dut *dut, struct sigma_conn *conn,
1105 struct sigma_cmd *cmd);
1106int sta_cfon_reset_default(struct sigma_dut *dut, struct sigma_conn *conn,
1107 struct sigma_cmd *cmd);
Jouni Malinencd4e3c32015-10-29 12:39:56 +02001108
1109enum driver_type {
1110 DRIVER_NOT_SET,
1111 DRIVER_ATHEROS,
1112 DRIVER_WCN,
1113 DRIVER_MAC80211,
1114 DRIVER_AR6003,
1115 DRIVER_WIL6210,
1116 DRIVER_QNXNTO,
Sreelakshmi Konamkib692f102016-04-26 19:47:00 +05301117 DRIVER_OPENWRT,
1118 DRIVER_LINUX_WCN,
Jouni Malinencd4e3c32015-10-29 12:39:56 +02001119};
1120
1121enum openwrt_driver_type {
1122 OPENWRT_DRIVER_NOT_SET,
1123 OPENWRT_DRIVER_ATHEROS
1124};
1125
1126#define DRIVER_NAME_60G "wil6210"
1127
1128int set_wifi_chip(const char *chip_type);
Jouni Malinen016ae6c2019-11-04 17:00:01 +02001129enum driver_type get_driver_type(struct sigma_dut *dut);
Jouni Malinencd4e3c32015-10-29 12:39:56 +02001130enum openwrt_driver_type get_openwrt_driver_type(void);
Venkateswara Naralasettyf0f88052020-11-11 19:15:17 +05301131void sigma_dut_get_device_driver_name(const char *ifname, char *name,
1132 size_t size);
Jouni Malinencd4e3c32015-10-29 12:39:56 +02001133int file_exists(const char *fname);
1134
1135struct wpa_ctrl;
1136
1137int wps_connection_event(struct sigma_dut *dut, struct sigma_conn *conn,
1138 struct wpa_ctrl *ctrl, const char *intf, int p2p_resp);
1139int ascii2hexstr(const char *str, char *hex);
1140void disconnect_station(struct sigma_dut *dut);
1141void nfc_status(struct sigma_dut *dut, const char *state, const char *oper);
1142int get_ip_config(struct sigma_dut *dut, const char *ifname, char *buf,
1143 size_t buf_len);
1144int ath6kl_client_uapsd(struct sigma_dut *dut, const char *intf, int uapsd);
1145int is_ip_addr(const char *str);
1146int run_system(struct sigma_dut *dut, const char *cmd);
Adil Saeed Musthafa5f793f02017-04-10 23:13:30 -07001147int run_system_wrapper(struct sigma_dut *dut, const char *cmd, ...);
Priyadharshini Gowthamand06f1002019-04-22 15:45:41 -07001148int run_iwpriv(struct sigma_dut *dut, const char *ifname, const char *cmd, ...);
Jouni Malinena485fd12019-06-13 23:27:01 +03001149enum sigma_cmd_result cmd_wlantest_set_channel(struct sigma_dut *dut,
1150 struct sigma_conn *conn,
1151 struct sigma_cmd *cmd);
Jouni Malinena2df7db2019-06-13 02:31:24 +03001152void wlantest_register_cmds(void);
Jouni Malinencd4e3c32015-10-29 12:39:56 +02001153void sniffer_close(struct sigma_dut *dut);
1154
Vinay Gannevaram2dfb1da2019-06-14 15:24:08 +05301155/* sigma_dut.c */
1156int wifi_hal_initialize(struct sigma_dut *dut);
1157
Jouni Malinencd4e3c32015-10-29 12:39:56 +02001158/* ap.c */
Jouni Malinena2df7db2019-06-13 02:31:24 +03001159void ap_register_cmds(void);
Jouni Malinencd4e3c32015-10-29 12:39:56 +02001160void ath_disable_txbf(struct sigma_dut *dut, const char *intf);
Priyadharshini Gowthaman818afef2015-11-09 13:28:15 -08001161void ath_config_dyn_bw_sig(struct sigma_dut *dut, const char *ifname,
1162 const char *val);
Priyadharshini Gowthaman8c5b9a42019-07-31 14:38:48 -07001163void novap_reset(struct sigma_dut *dut, const char *ifname, int reset);
Jouni Malinen2e6ccc22017-09-04 13:43:16 +03001164int get_hwaddr(const char *ifname, unsigned char *hwaddr);
Jouni Malinena485fd12019-06-13 23:27:01 +03001165enum sigma_cmd_result cmd_ap_config_commit(struct sigma_dut *dut,
1166 struct sigma_conn *conn,
1167 struct sigma_cmd *cmd);
Alexei Avshalom Lazar043230b2019-02-04 14:11:24 +02001168int ap_wps_registration(struct sigma_dut *dut, struct sigma_conn *conn,
1169 struct sigma_cmd *cmd);
Jouni Malinen314b9c62020-06-05 15:36:04 +03001170const char * get_hostapd_ifname(struct sigma_dut *dut);
Sai Pavan Akhil Remella6469f0c2021-12-20 15:49:53 +05301171void get_wiphy_capabilities(struct sigma_dut *dut);
Jouni Malinencd4e3c32015-10-29 12:39:56 +02001172
1173/* sta.c */
Jouni Malinena2df7db2019-06-13 02:31:24 +03001174void sta_register_cmds(void);
Jouni Malinencd4e3c32015-10-29 12:39:56 +02001175int set_ps(const char *intf, struct sigma_dut *dut, int enabled);
1176void ath_set_zero_crc(struct sigma_dut *dut, const char *val);
1177void ath_set_cts_width(struct sigma_dut *dut, const char *ifname,
1178 const char *val);
1179int ath_set_width(struct sigma_dut *dut, struct sigma_conn *conn,
1180 const char *intf, const char *val);
Alexei Avshalom Lazar49498b82019-01-31 15:16:32 +02001181int sta_set_60g_abft_len(struct sigma_dut *dut, struct sigma_conn *conn,
1182 int abft_len);
Lior David0fe101e2017-03-09 16:09:50 +02001183int wil6210_send_frame_60g(struct sigma_dut *dut, struct sigma_conn *conn,
1184 struct sigma_cmd *cmd);
Ankita Bajaj1bde7942018-01-09 19:15:01 +05301185int hwaddr_aton(const char *txt, unsigned char *addr);
1186int set_ipv4_addr(struct sigma_dut *dut, const char *ifname,
1187 const char *ip, const char *mask);
1188int set_ipv4_gw(struct sigma_dut *dut, const char *gw);
Alexei Avshalom Lazar79fa3fe2018-12-24 15:43:33 +02001189int send_addba_60g(struct sigma_dut *dut, struct sigma_conn *conn,
1190 struct sigma_cmd *cmd, const char *param);
Alexei Avshalom Lazarbc180dc2018-12-18 16:01:14 +02001191int wil6210_set_ese(struct sigma_dut *dut, int count,
1192 struct sigma_ese_alloc *allocs);
1193int sta_extract_60g_ese(struct sigma_dut *dut, struct sigma_cmd *cmd,
1194 struct sigma_ese_alloc *allocs, int *allocs_size);
Alexei Avshalom Lazaraad97b02018-12-18 16:01:23 +02001195int wil6210_set_force_mcs(struct sigma_dut *dut, int force, int mcs);
Qiwei Caib6806972020-01-15 13:52:11 +08001196int sta_set_addba_buf_size(struct sigma_dut *dut,
1197 const char *intf, int bufsize);
Kiran Kumar Lokerebed80952021-11-22 22:47:25 -08001198int wcn_set_he_gi(struct sigma_dut *dut, const char *intf, u8 gi_val);
Kiran Kumar Lokere26c0f862020-01-22 11:15:59 -08001199#ifdef NL80211_SUPPORT
1200int wcn_set_he_ltf(struct sigma_dut *dut, const char *intf,
1201 enum qca_wlan_he_ltf_cfg ltf);
1202#endif /* NL80211_SUPPORT */
Veerendranath Jakkam9ceb3b12021-09-10 03:18:17 +05301203void stop_dscp_policy_mon_thread(struct sigma_dut *dut);
1204void free_dscp_policy_table(struct sigma_dut *dut);
Jouni Malinencd4e3c32015-10-29 12:39:56 +02001205
1206/* p2p.c */
Jouni Malinena2df7db2019-06-13 02:31:24 +03001207void p2p_register_cmds(void);
Jouni Malinencd4e3c32015-10-29 12:39:56 +02001208int p2p_cmd_sta_get_parameter(struct sigma_dut *dut, struct sigma_conn *conn,
1209 struct sigma_cmd *cmd);
Purushottam Kushwaha091e2532016-08-23 11:52:21 +05301210void p2p_create_event_thread(struct sigma_dut *dut);
1211void stop_event_thread(void);
Amarnath Hullur Subramanyam89b37cd2017-03-17 00:04:41 -07001212void start_dhcp(struct sigma_dut *dut, const char *group_ifname, int go);
1213void stop_dhcp(struct sigma_dut *dut, const char *group_ifname, int go);
1214int p2p_discover_peer(struct sigma_dut *dut, const char *ifname,
1215 const char *peer, int full);
Jouni Malinena0bf62a2019-06-13 02:22:24 +03001216enum sigma_cmd_result cmd_sta_p2p_reset(struct sigma_dut *dut,
1217 struct sigma_conn *conn,
1218 struct sigma_cmd *cmd);
Jouni Malinencd4e3c32015-10-29 12:39:56 +02001219
Jouni Malinenc54710d2019-01-23 12:34:21 +02001220/* basic.c */
Jouni Malinena2df7db2019-06-13 02:31:24 +03001221void basic_register_cmds(void);
Jouni Malinenc54710d2019-01-23 12:34:21 +02001222void get_ver(const char *cmd, char *buf, size_t buflen);
1223
priyadharshini gowthaman72462ef2016-06-22 22:47:14 -07001224/* utils.c */
Jouni Malinencd4e3c32015-10-29 12:39:56 +02001225enum sigma_program sigma_program_to_enum(const char *prog);
Jouni Malinen409fc122022-09-29 18:54:09 +03001226bool is_passpoint_r2_or_newer(enum sigma_program prog);
1227bool is_passpoint(enum sigma_program prog);
Alexei Avshalom Lazar9a4f98d2019-05-02 13:35:22 +03001228int hex_byte(const char *str);
Jouni Malinen08cf2312017-09-04 13:39:47 +03001229int parse_hexstr(const char *hex, unsigned char *buf, size_t buflen);
priyadharshini gowthaman72462ef2016-06-22 22:47:14 -07001230int parse_mac_address(struct sigma_dut *dut, const char *arg,
1231 unsigned char *addr);
Alexei Avshalom Lazar093569f2018-11-13 14:08:17 +02001232int is_60g_sigma_dut(struct sigma_dut *dut);
1233unsigned int channel_to_freq(struct sigma_dut *dut, unsigned int channel);
Rakesh Sunki7192dc42017-03-30 14:47:55 -07001234unsigned int freq_to_channel(unsigned int freq);
Peng Xu525965b2018-06-26 16:40:14 -07001235int is_ipv6_addr(const char *str);
Rakesh Sunki8f8e74b2017-05-16 15:42:12 -07001236void convert_mac_addr_to_ipv6_lladdr(u8 *mac_addr, char *ipv6_buf,
1237 size_t buf_len);
Peng Xu8863ec72018-08-06 11:50:37 -07001238size_t convert_mac_addr_to_ipv6_linklocal(const u8 *mac_addr, u8 *ipv6);
Veerendranath Jakkam9ceb3b12021-09-10 03:18:17 +05301239int snprintf_error(size_t size, int res);
Jouni Malinencd4e3c32015-10-29 12:39:56 +02001240
Peng Xu769731a2017-05-10 17:27:28 -07001241#ifndef ANDROID
1242size_t strlcpy(char *dest, const char *src, size_t siz);
1243size_t strlcat(char *dst, const char *str, size_t size);
1244#endif /* ANDROID */
Ankita Bajaj1bde7942018-01-09 19:15:01 +05301245void hex_dump(struct sigma_dut *dut, u8 *data, size_t len);
Alexei Avshalom Lazar0dae51c2018-12-18 16:00:18 +02001246int get_wps_pin_from_mac(struct sigma_dut *dut, const char *macaddr,
1247 char *pin, size_t len);
Alexei Avshalom Lazar64279692018-12-23 16:49:49 +02001248void str_remove_chars(char *str, char ch);
Peng Xu769731a2017-05-10 17:27:28 -07001249
Alexei Avshalom Lazar744ae8a2019-01-31 17:26:46 +02001250int get_wps_forced_version(struct sigma_dut *dut, const char *str);
Alexei Avshalom Lazara37dc162019-02-04 14:06:48 +02001251int base64_encode(const char *src, size_t len, char *out, size_t out_len);
Jouni Malinen3d6d1622022-04-14 12:47:54 +03001252unsigned char * base64_decode(const char *src, size_t len, size_t *out_len);
Alexei Avshalom Lazara37dc162019-02-04 14:06:48 +02001253int random_get_bytes(char *buf, size_t len);
Jouni Malinen3c740ab2019-10-10 15:55:11 +03001254int get_enable_disable(const char *val);
Vinita Maloo54b78cf2020-03-30 12:18:19 +05301255int wcn_driver_cmd(const char *ifname, char *buf);
Peng Xu769731a2017-05-10 17:27:28 -07001256
Jouni Malinencd4e3c32015-10-29 12:39:56 +02001257/* uapsd_stream.c */
1258void receive_uapsd(struct sigma_stream *s);
Pradeep Reddy POTTETI79594042015-11-23 12:59:12 +05301259void send_uapsd_console(struct sigma_stream *s);
Jouni Malinencd4e3c32015-10-29 12:39:56 +02001260
1261/* nan.c */
1262int nan_preset_testparameters(struct sigma_dut *dut, struct sigma_conn *conn,
1263 struct sigma_cmd *cmd);
1264int nan_cmd_sta_get_parameter(struct sigma_dut *dut, struct sigma_conn *conn,
1265 struct sigma_cmd *cmd);
1266int nan_cmd_sta_exec_action(struct sigma_dut *dut, struct sigma_conn *conn,
1267 struct sigma_cmd *cmd);
1268int nan_cmd_sta_get_events(struct sigma_dut *dut, struct sigma_conn *conn,
1269 struct sigma_cmd *cmd);
1270int nan_cmd_sta_transmit_followup(struct sigma_dut *dut,
1271 struct sigma_conn *conn,
1272 struct sigma_cmd *cmd);
1273void nan_cmd_sta_reset_default(struct sigma_dut *dut, struct sigma_conn *conn,
1274 struct sigma_cmd *cmd);
1275int nan_cmd_sta_preset_testparameters(struct sigma_dut *dut,
1276 struct sigma_conn *conn,
1277 struct sigma_cmd *cmd);
1278
priyadharshini gowthamand66913a2016-07-29 15:11:17 -07001279/* ftm.c */
1280int loc_cmd_sta_exec_action(struct sigma_dut *dut, struct sigma_conn *conn,
1281 struct sigma_cmd *cmd);
1282int loc_cmd_sta_send_frame(struct sigma_dut *dut, struct sigma_conn *conn,
1283 struct sigma_cmd *cmd);
1284int loc_cmd_sta_preset_testparameters(struct sigma_dut *dut,
1285 struct sigma_conn *conn,
1286 struct sigma_cmd *cmd);
Vinay Gannevaram3b9fdd32019-06-14 17:55:44 +05301287int lowi_cmd_sta_reset_default(struct sigma_dut *dut, struct sigma_conn *conn,
1288 struct sigma_cmd *cmd);
priyadharshini gowthamand66913a2016-07-29 15:11:17 -07001289
Jouni Malinend86e5822017-08-29 03:55:32 +03001290/* dpp.c */
Jouni Malinen89cf6d62020-05-11 22:42:11 +03001291enum sigma_cmd_result dpp_dev_exec_action(struct sigma_dut *dut,
1292 struct sigma_conn *conn,
1293 struct sigma_cmd *cmd);
Jouni Malinencd208ad2022-04-14 13:04:00 +03001294int dpp_mdns_discover_relay_params(struct sigma_dut *dut);
Jouni Malinen29a63f42022-04-13 22:08:47 +03001295int dpp_mdns_start(struct sigma_dut *dut, enum dpp_mdns_role role);
1296void dpp_mdns_stop(struct sigma_dut *dut);
Jouni Malinend86e5822017-08-29 03:55:32 +03001297
Ankita Bajaj1bde7942018-01-09 19:15:01 +05301298/* dhcp.c */
1299void process_fils_hlp(struct sigma_dut *dut);
1300void hlp_thread_cleanup(struct sigma_dut *dut);
Jouni Malinend86e5822017-08-29 03:55:32 +03001301
Peng Xu291d97d2018-01-31 16:34:03 -08001302#ifdef NL80211_SUPPORT
1303struct nl80211_ctx * nl80211_init(struct sigma_dut *dut);
1304void nl80211_deinit(struct sigma_dut *dut, struct nl80211_ctx *ctx);
Kiran Kumar Lokere94829ce2022-01-20 10:49:08 -08001305int nl80211_open_event_sock(struct sigma_dut *dut);
1306void nl80211_close_event_sock(struct sigma_dut *dut);
Peng Xu291d97d2018-01-31 16:34:03 -08001307struct nl_msg * nl80211_drv_msg(struct sigma_dut *dut, struct nl80211_ctx *ctx,
1308 int ifindex, int flags,
1309 uint8_t cmd);
1310int send_and_recv_msgs(struct sigma_dut *dut, struct nl80211_ctx *ctx,
1311 struct nl_msg *nlmsg,
1312 int (*valid_handler)(struct nl_msg *, void *),
1313 void *valid_data);
Veerendranath Jakkam050b85a2020-07-04 04:00:32 +05301314int wcn_wifi_test_config_set_flag(struct sigma_dut *dut, const char *intf,
1315 int attr_id);
1316int wcn_wifi_test_config_set_u8(struct sigma_dut *dut, const char *intf,
1317 int attr_id, uint8_t val);
1318int wcn_wifi_test_config_set_u16(struct sigma_dut *dut, const char *intf,
1319 int attr_id, uint16_t val);
Peng Xu291d97d2018-01-31 16:34:03 -08001320#endif /* NL80211_SUPPORT */
1321
Jouni Malinena2df7db2019-06-13 02:31:24 +03001322void traffic_register_cmds(void);
1323void traffic_agent_register_cmds(void);
1324void powerswitch_register_cmds(void);
1325void atheros_register_cmds(void);
1326void dev_register_cmds(void);
1327void sniffer_register_cmds(void);
1328void server_register_cmds(void);
1329void miracast_register_cmds(void);
Veerendranath Jakkam176181c2020-05-16 00:19:21 +05301330int set_ipv6_addr(struct sigma_dut *dut, const char *ip, const char *mask,
1331 const char *ifname);
Shivani Baranwal31182012021-12-07 21:11:13 +05301332void kill_pid(struct sigma_dut *dut, const char *pid_file);
Jouni Malinena6b5e8b2022-05-20 12:42:02 +03001333int get_ip_addr(const char *ifname, int ipv6, char *buf, size_t len);
Jouni Malinena2df7db2019-06-13 02:31:24 +03001334
Jouni Malinencd4e3c32015-10-29 12:39:56 +02001335#endif /* SIGMA_DUT_H */