blob: a9e44e4a057fd0bc5059249e244a5cc703f15eec [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 Malinencd4e3c32015-10-29 12:39:56 +02005 * All Rights Reserved.
6 * Licensed under the Clear BSD license. See README for more details.
7 */
8
9#ifndef SIGMA_DUT_H
10#define SIGMA_DUT_H
11
Lior David9981b512017-01-20 13:16:40 +020012#ifdef __GNUC__
13#define _GNU_SOURCE 1
14#endif
15
Jouni Malinencd4e3c32015-10-29 12:39:56 +020016#include <stdlib.h>
17#include <stdio.h>
18#include <stdarg.h>
19#include <string.h>
20#include <errno.h>
21#include <unistd.h>
22#include <time.h>
23#include <sys/time.h>
Jouni Malinen3d972ba2017-03-15 20:52:20 +020024#include <sys/types.h>
Jouni Malinencd4e3c32015-10-29 12:39:56 +020025#include <sys/socket.h>
26#include <net/if.h>
27#ifdef __QNXNTO__
28#include <sys/select.h>
29#include <net/if_ether.h>
30#endif /* __QNXNTO__ */
31#include <netinet/in.h>
32#include <arpa/inet.h>
33#ifdef CONFIG_TRAFFIC_AGENT
34#include <pthread.h>
35#endif /* CONFIG_TRAFFIC_AGENT */
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 */
Jouni Malinencd4e3c32015-10-29 12:39:56 +020043
44
45#ifdef __GNUC__
46#define PRINTF_FORMAT(a,b) __attribute__ ((format (printf, (a), (b))))
47#else
48#define PRINTF_FORMAT(a,b)
49#endif
50
51#ifndef SIGMA_TMPDIR
52#define SIGMA_TMPDIR "/tmp"
53#endif /* SIGMA_TMPDIR */
54
55#ifndef SIGMA_DUT_VER
56#define SIGMA_DUT_VER "(unknown)"
57#endif /* SIGMA_DUT_VER */
58
59#ifndef ETH_ALEN
60#define ETH_ALEN 6
61#endif
62
63#ifndef ETH_P_ARP
64#define ETH_P_ARP 0x0806
65#endif
66
67struct sigma_dut;
68
69#define MAX_PARAMS 100
Alejandro Vasquez363f5582018-07-17 11:25:05 -070070#define MAX_RADIO 3
Jouni Malinencd4e3c32015-10-29 12:39:56 +020071
72/* Set default operating channel width 80 MHz */
73#define VHT_DEFAULT_OPER_CHWIDTH AP_80_VHT_OPER_CHWIDTH
74
75typedef unsigned int u32;
Ankita Bajaj1bde7942018-01-09 19:15:01 +053076typedef uint16_t u16;
Jouni Malinencd4e3c32015-10-29 12:39:56 +020077typedef unsigned char u8;
78
79#define WPA_GET_BE32(a) ((((u32) (a)[0]) << 24) | (((u32) (a)[1]) << 16) | \
80 (((u32) (a)[2]) << 8) | ((u32) (a)[3]))
81#define WPA_PUT_BE32(a, val) \
82 do { \
83 (a)[0] = (u8) ((((u32) (val)) >> 24) & 0xff); \
84 (a)[1] = (u8) ((((u32) (val)) >> 16) & 0xff); \
85 (a)[2] = (u8) ((((u32) (val)) >> 8) & 0xff); \
86 (a)[3] = (u8) (((u32) (val)) & 0xff); \
87 } while (0)
88
89struct sigma_cmd {
90 char *params[MAX_PARAMS];
91 char *values[MAX_PARAMS];
92 int count;
93};
94
Alejandro Vasquez3410aa52018-07-17 11:26:17 -070095#define MAX_CMD_LEN 4096
Jouni Malinencd4e3c32015-10-29 12:39:56 +020096
97struct sigma_conn {
98 int s;
99 struct sockaddr_in addr;
100 socklen_t addrlen;
101 char buf[MAX_CMD_LEN + 5];
102 int pos;
103 int waiting_completion;
104};
105
Jouni Malinen0e29cf22019-02-19 01:13:21 +0200106enum sigma_cmd_result {
107 ERROR_SEND_STATUS = -2,
108 INVALID_SEND_STATUS = -1,
109 STATUS_SENT = 0,
110 SUCCESS_SEND_STATUS = 1
111};
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200112
113struct sigma_cmd_handler {
114 struct sigma_cmd_handler *next;
115 char *cmd;
116 int (*validate)(struct sigma_cmd *cmd);
117 /* process return value:
118 * -2 = failed, caller will send status,ERROR
119 * -1 = failed, caller will send status,INVALID
Jouni Malinen0e29cf22019-02-19 01:13:21 +0200120 * 0 = response already sent
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200121 * 1 = success, caller will send status,COMPLETE
122 */
Jouni Malinen26a5b762019-02-19 01:17:48 +0200123 enum sigma_cmd_result (*process)(struct sigma_dut *dut,
124 struct sigma_conn *conn,
125 struct sigma_cmd *cmd);
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200126};
127
128#define P2P_GRP_ID_LEN 128
129#define IP_ADDR_STR_LEN 16
130
131struct wfa_cs_p2p_group {
132 struct wfa_cs_p2p_group *next;
133 char ifname[IFNAMSIZ];
134 int go;
135 char grpid[P2P_GRP_ID_LEN];
136 char ssid[33];
137};
138
139#ifdef CONFIG_TRAFFIC_AGENT
140
141#define MAX_SIGMA_STREAMS 16
142#define MAX_SIGMA_STATS 6000
143
144struct sigma_frame_stats {
145 unsigned int seqnum;
146 unsigned int local_sec;
147 unsigned int local_usec;
148 unsigned int remote_sec;
149 unsigned int remote_usec;
150};
151
152struct sigma_stream {
153 enum sigma_stream_profile {
154 SIGMA_PROFILE_FILE_TRANSFER,
155 SIGMA_PROFILE_MULTICAST,
156 SIGMA_PROFILE_IPTV,
157 SIGMA_PROFILE_TRANSACTION,
158 SIGMA_PROFILE_START_SYNC,
159 SIGMA_PROFILE_UAPSD
160 } profile;
161 int sender;
162 struct in_addr dst;
163 int dst_port;
164 struct in_addr src;
165 int src_port;
166 int frame_rate;
167 int duration;
Jouni Malinenc2493f82016-06-05 18:01:33 +0300168 unsigned int payload_size;
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200169 int start_delay;
170 int max_cnt;
171 enum sigma_traffic_class {
172 SIGMA_TC_VOICE,
173 SIGMA_TC_VIDEO,
174 SIGMA_TC_BACKGROUND,
175 SIGMA_TC_BEST_EFFORT
176 } tc;
177 int user_priority;
178 int user_priority_set;
179 int started;
180 int no_timestamps;
181
182 int sock;
183 pthread_t thr;
184 int stop;
185 int ta_send_in_progress;
186 int trans_proto;
187
188 /* Statistics */
189 int tx_act_frames; /*
190 * Number of frames generated by the traffic
191 * generator application. The name is defined in the
192 * Sigma CAPI spec.
193 */
194 int tx_frames;
195 int rx_frames;
196 unsigned long long tx_payload_bytes;
197 unsigned long long rx_payload_bytes;
198 int out_of_seq_frames;
199 struct sigma_frame_stats *stats;
200 unsigned int num_stats;
201 unsigned int stream_id;
202
203 /* U-APSD */
204 unsigned int sta_id;
205 unsigned int rx_cookie;
206 unsigned int uapsd_sta_tc;
207 unsigned int uapsd_rx_state;
208 unsigned int uapsd_tx_state;
209 unsigned int tx_stop_cnt;
210 unsigned int tx_hello_cnt;
211 pthread_t uapsd_send_thr;
212 pthread_cond_t tx_thr_cond;
213 pthread_mutex_t tx_thr_mutex;
214 int reset_rx;
215 int num_retry;
216 char ifname[IFNAMSIZ]; /* ifname from the command */
217 struct sigma_dut *dut; /* for traffic agent thread to access context */
Pradeep Reddy POTTETI79594042015-11-23 12:59:12 +0530218 /* console */
219 char test_name[9]; /* test case name */
220 int can_quit;
221 int reset;
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200222};
223
224#endif /* CONFIG_TRAFFIC_AGENT */
225
Alexei Avshalom Lazarbc180dc2018-12-18 16:01:14 +0200226/* extended scheduling test */
227enum sigma_ese_type {
228 ESE_CBAP,
229 ESE_SP,
230};
231
232struct sigma_ese_alloc {
233 unsigned int percent_bi;
234 enum sigma_ese_type type;
235 unsigned int src_aid, dst_aid;
236};
237
238#define ESE_BCAST_AID 255
239#define MAX_ESE_ALLOCS 4
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200240
241#define NUM_AP_AC 4
242#define AP_AC_BE 0
243#define AP_AC_BK 1
244#define AP_AC_VI 2
245#define AP_AC_VO 3
246
Adil Saeed Musthafab7b297f2017-04-10 23:13:31 -0700247#define MAX_WLAN_TAGS 3
Adil Saeed Musthafa69063722017-04-10 23:13:40 -0700248#define MBO_MAX_PREF_BSSIDS 10
Adil Saeed Musthafa4ec61bd2017-04-10 23:13:41 -0700249#define MAX_FT_BSS_LIST 10
Adil Saeed Musthafab7b297f2017-04-10 23:13:31 -0700250
Peng Xu8863ec72018-08-06 11:50:37 -0700251#define TRANSPORT_PROTO_TYPE_TCP 0x06
252#define TRANSPORT_PROTO_TYPE_UDP 0x11
253#define NAN_TRANSPORT_PORT_DEFAULT 7000
254#define NAN_TRANSPORT_PROTOCOL_DEFAULT TRANSPORT_PROTO_TYPE_TCP
255
Jouni Malinen57fa3d82016-11-30 12:51:43 +0200256enum value_not_set_enabled_disabled {
257 VALUE_NOT_SET,
258 VALUE_ENABLED,
259 VALUE_DISABLED
260};
261
Pradeep Reddy Potteti4b0cdee2017-03-15 12:37:33 +0530262enum sec_ch_offset {
263 SEC_CH_NO,
264 SEC_CH_40ABOVE,
265 SEC_CH_40BELOW
266};
267
Adil Saeed Musthafa69063722017-04-10 23:13:40 -0700268struct mbo_pref_ap {
269 int ap_ne_class;
270 int ap_ne_op_ch;
271 int ap_ne_pref;
272 unsigned char mac_addr[ETH_ALEN];
273};
274
Peng Xu291d97d2018-01-31 16:34:03 -0800275#ifdef NL80211_SUPPORT
276#define SOCK_BUF_SIZE (32 * 1024)
277struct nl80211_ctx {
278 struct nl_sock *sock;
279 int netlink_familyid;
280 int nlctrl_familyid;
281 size_t sock_buf_size;
282};
283#endif /* NL80211_SUPPORT */
284
Alexei Avshalom Lazar33f700c2018-12-18 16:00:39 +0200285/* hardcoded long WSC IE values to force fragmentation */
286#define WPS_LONG_DEVICE_NAME "Qti1234511adtest1234567890123456"
287#define WPS_LONG_MANUFACTURER "Qti1234511adQti1234511adQti1234511adQti1234511adQti1234511ad"
288#define WPS_LONG_MODEL_NAME "Qti1234511adtest1234567890123456"
289#define WPS_LONG_MODEL_NUMBER "11111111111111111111111111111111"
290#define WPS_LONG_SERIAL_NUMBER "22222222222222222222222222222222"
291
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200292struct sigma_dut {
293 int s; /* server TCP socket */
294 int debug_level;
295 int stdout_debug;
296 struct sigma_cmd_handler *cmds;
297
298 /* Default timeout value (seconds) for commands */
299 unsigned int default_timeout;
300
301 int next_streamid;
302
303 const char *bridge; /* bridge interface to use in AP mode */
304
305 enum sigma_mode {
306 SIGMA_MODE_UNKNOWN,
307 SIGMA_MODE_STATION,
308 SIGMA_MODE_AP,
309 SIGMA_MODE_SNIFFER
310 } mode;
311
312 /*
313 * Local cached values to handle API that does not provide all the
314 * needed information with commands that actually trigger some
315 * operations.
316 */
317 int listen_chn;
318 int persistent;
319 int intra_bss;
320 int noa_duration;
321 int noa_interval;
322 int noa_count;
323 enum wfa_cs_wps_method {
324 WFA_CS_WPS_NOT_READY,
325 WFA_CS_WPS_PBC,
326 WFA_CS_WPS_PIN_DISPLAY,
327 WFA_CS_WPS_PIN_LABEL,
328 WFA_CS_WPS_PIN_KEYPAD
329 } wps_method;
330 char wps_pin[9];
331
332 struct wfa_cs_p2p_group *groups;
333
334 char infra_ssid[33];
335 int infra_network_id;
336
337 enum p2p_mode {
338 P2P_IDLE, P2P_DISCOVER, P2P_LISTEN, P2P_DISABLE
339 } p2p_mode;
340
341 int go;
342 int p2p_client;
Purushottam Kushwaha091e2532016-08-23 11:52:21 +0530343 char *p2p_ifname;
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200344
345 int client_uapsd;
346
347 char arp_ipaddr[IP_ADDR_STR_LEN];
348 char arp_ifname[IFNAMSIZ + 1];
349
350 enum sta_pmf {
351 STA_PMF_DISABLED,
352 STA_PMF_OPTIONAL,
353 STA_PMF_REQUIRED
354 } sta_pmf;
355
356 int no_tpk_expiration;
357
358 int er_oper_performed;
359 char er_oper_bssid[20];
360 int amsdu_size;
361 int back_rcv_buf;
362
363 int testbed_flag_txsp;
364 int testbed_flag_rxsp;
365 int chwidth;
366
367 /* AP configuration */
368 char ap_ssid[33];
Adil Saeed Musthafab7b297f2017-04-10 23:13:31 -0700369 /*
370 * WLAN-TAG of 1 will use 'ap_' variables;
371 * tag higher than 1 will use 'ap_tag_' variables.
372 */
373 char ap_tag_ssid[MAX_WLAN_TAGS - 1][33];
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200374 enum ap_mode {
375 AP_11a,
376 AP_11g,
377 AP_11b,
378 AP_11na,
379 AP_11ng,
380 AP_11ac,
Alexei Avshalom Lazar2712cc82018-12-23 16:29:14 +0200381 AP_11ad,
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200382 AP_inval
383 } ap_mode;
384 int ap_channel;
385 int ap_rts;
386 int ap_frgmnt;
387 int ap_bcnint;
388 struct qos_params {
389 int ac;
390 int cwmin;
391 int cwmax;
392 int aifs;
393 int txop;
394 int acm;
395 } ap_qos[NUM_AP_AC], ap_sta_qos[NUM_AP_AC];
Jouni Malinen57fa3d82016-11-30 12:51:43 +0200396 enum value_not_set_enabled_disabled ap_noack;
397 enum value_not_set_enabled_disabled ap_ampdu;
398 enum value_not_set_enabled_disabled ap_amsdu;
399 enum value_not_set_enabled_disabled ap_rx_amsdu;
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200400 int ap_ampdu_exp;
Jouni Malinen57fa3d82016-11-30 12:51:43 +0200401 enum value_not_set_enabled_disabled ap_addba_reject;
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200402 int ap_fixed_rate;
403 int ap_mcs;
404 int ap_rx_streams;
405 int ap_tx_streams;
406 unsigned int ap_vhtmcs_map;
Jouni Malinen57fa3d82016-11-30 12:51:43 +0200407 enum value_not_set_enabled_disabled ap_ldpc;
408 enum value_not_set_enabled_disabled ap_sig_rts;
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200409 enum ap_chwidth {
410 AP_20,
411 AP_40,
412 AP_80,
413 AP_160,
priyadharshini gowthaman63ab8482017-12-28 15:32:55 -0800414 AP_80_80,
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200415 AP_AUTO
416 } ap_chwidth;
Pradeep Reddy Pottetibf8af292017-02-15 15:28:39 +0530417 enum ap_chwidth default_11na_ap_chwidth;
418 enum ap_chwidth default_11ng_ap_chwidth;
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200419 int ap_tx_stbc;
Jouni Malinen57fa3d82016-11-30 12:51:43 +0200420 enum value_not_set_enabled_disabled ap_dyn_bw_sig;
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200421 int ap_sgi80;
422 int ap_p2p_mgmt;
423 enum ap_key_mgmt {
424 AP_OPEN,
425 AP_WPA2_PSK,
426 AP_WPA_PSK,
427 AP_WPA2_EAP,
428 AP_WPA_EAP,
429 AP_WPA2_EAP_MIXED,
Jouni Malinen30824df2017-08-22 21:21:38 +0300430 AP_WPA2_PSK_MIXED,
431 AP_WPA2_SAE,
432 AP_WPA2_PSK_SAE,
Jouni Malinenad395a22017-09-01 21:13:46 +0300433 AP_SUITEB,
Jouni Malinen147b3c32017-10-09 16:51:54 +0300434 AP_WPA2_OWE,
Jouni Malinen4cf699f2018-06-19 00:46:27 +0300435 AP_WPA2_EAP_OSEN,
Jouni Malinen6be21c82018-08-01 18:47:24 +0300436 AP_WPA2_FT_EAP,
437 AP_WPA2_FT_PSK,
438 AP_WPA2_EAP_SHA256,
439 AP_WPA2_PSK_SHA256,
440 AP_WPA2_ENT_FT_EAP,
Jouni Malinenc2b91212018-09-12 02:26:39 +0300441 AP_OSEN,
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200442 } ap_key_mgmt;
Adil Saeed Musthafab7b297f2017-04-10 23:13:31 -0700443 enum ap_tag_key_mgmt {
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200444 AP2_OPEN,
Adil Saeed Musthafab7b297f2017-04-10 23:13:31 -0700445 AP2_OSEN,
Jouni Malinen353ba8b2018-01-10 17:04:12 +0200446 AP2_WPA2_PSK,
447 AP2_WPA2_OWE,
Adil Saeed Musthafab7b297f2017-04-10 23:13:31 -0700448 } ap_tag_key_mgmt[MAX_WLAN_TAGS - 1];
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200449 int ap_add_sha256;
priyadharshini gowthamande81f392017-12-28 15:28:49 -0800450 int ap_add_sha384;
Sarvepalli, Rajesh Babu24dc7e42016-03-18 21:27:26 +0530451 int ap_rsn_preauth;
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200452 enum ap_pmf {
453 AP_PMF_DISABLED,
454 AP_PMF_OPTIONAL,
455 AP_PMF_REQUIRED
456 } ap_pmf;
457 enum ap_cipher {
Jouni Malinen2ba24492017-11-17 12:43:59 +0200458 AP_NO_GROUP_CIPHER_SET,
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200459 AP_CCMP,
460 AP_TKIP,
461 AP_WEP,
462 AP_PLAIN,
Jouni Malinenad395a22017-09-01 21:13:46 +0300463 AP_CCMP_TKIP,
464 AP_GCMP_256,
Jouni Malinen3d633da2017-09-14 22:19:21 +0300465 AP_GCMP_128,
466 AP_CCMP_256,
Jouni Malinend538c782017-11-17 12:13:04 +0200467 AP_CCMP_128_GCMP_256,
Jouni Malinen2ba24492017-11-17 12:43:59 +0200468 } ap_cipher, ap_group_cipher;
Jouni Malinen3d633da2017-09-14 22:19:21 +0300469 enum ap_group_mgmt_cipher {
470 AP_NO_GROUP_MGMT_CIPHER_SET,
471 AP_BIP_GMAC_256,
472 AP_BIP_CMAC_256,
473 AP_BIP_GMAC_128,
474 AP_BIP_CMAC_128,
475 } ap_group_mgmt_cipher;
Jouni Malinened670f42017-08-31 01:39:28 +0300476 char *ap_sae_groups;
Jouni Malinen2f524ce2017-08-31 01:43:29 +0300477 int sae_anti_clogging_threshold;
Jouni Malinenb347db02017-09-02 01:36:03 +0300478 int sae_reflection;
Jouni Malinen2126f422017-10-11 23:24:33 +0300479 char ap_passphrase[101];
Jouni Malinen63370622017-11-18 17:47:13 +0200480 char ap_psk[65];
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200481 char ap_wepkey[27];
482 char ap_radius_ipaddr[20];
483 int ap_radius_port;
484 char ap_radius_password[200];
485 char ap2_radius_ipaddr[20];
486 int ap2_radius_port;
487 char ap2_radius_password[200];
488 int ap_tdls_prohibit;
489 int ap_tdls_prohibit_chswitch;
490 int ap_hs2;
491 int ap_dgaf_disable;
492 int ap_p2p_cross_connect;
493 int ap_oper_name;
494 int ap_wan_metrics;
495 int ap_conn_capab;
496 int ap_oper_class;
497
498 int ap_interworking;
499 int ap_access_net_type;
500 int ap_internet;
501 int ap_venue_group;
502 int ap_venue_type;
503 char ap_hessid[20];
504 char ap_roaming_cons[100];
505 int ap_venue_name;
506 int ap_net_auth_type;
507 int ap_nai_realm_list;
508 char ap_domain_name_list[1000];
509 int ap_ip_addr_type_avail;
510 char ap_plmn_mcc[10][4];
511 char ap_plmn_mnc[10][4];
512 int ap_gas_cb_delay;
513 int ap_proxy_arp;
514 int ap2_proxy_arp;
Jouni Malinendbbc2c42018-11-14 23:55:41 +0200515 int ap2_osu;
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200516 int ap_l2tif;
517 int ap_anqpserver;
518 int ap_anqpserver_on;
519 int ap_osu_provider_list;
Jouni Malinen93a837f2018-11-01 17:09:22 +0200520 int ap_osu_provider_nai_list;
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200521 int ap_qos_map_set;
522 int ap_bss_load;
523 char ap_osu_server_uri[10][256];
524 char ap_osu_ssid[33];
525 int ap_osu_method[10];
526 int ap_osu_icon_tag;
Jouni Malinen54a89b02018-05-01 00:16:26 +0300527 int ap_venue_url;
Jouni Malinenf7ff42b2018-05-01 00:21:56 +0300528 int ap_advice_of_charge;
Jouni Malinenac104532018-05-01 00:27:37 +0300529 int ap_oper_icon_metadata;
Jouni Malinenac367142018-05-01 00:32:24 +0300530 int ap_tnc_file_name;
531 unsigned int ap_tnc_time_stamp;
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200532
533 int ap_fake_pkhash;
534 int ap_disable_protection;
535 int ap_allow_vht_wep;
536 int ap_allow_vht_tkip;
537
538 enum ap_vht_chwidth {
539 AP_20_40_VHT_OPER_CHWIDTH,
540 AP_80_VHT_OPER_CHWIDTH,
541 AP_160_VHT_OPER_CHWIDTH
542 } ap_vht_chwidth;
543 int ap_txBF;
544 int ap_mu_txBF;
Pradeep Reddy POTTETIfba27db2015-11-20 16:42:22 +0530545 enum ap_regulatory_mode {
546 AP_80211D_MODE_DISABLED,
547 AP_80211D_MODE_ENABLED,
548 } ap_regulatory_mode;
549 enum ap_dfs_mode {
550 AP_DFS_MODE_DISABLED,
551 AP_DFS_MODE_ENABLED,
552 } ap_dfs_mode;
priyadharshini gowthaman264d5442016-02-25 15:52:22 -0800553 int ap_ndpa_frame;
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200554
priyadharshini gowthaman8e26ff42016-06-22 22:47:14 -0700555 int ap_lci;
556 char ap_val_lci[33];
priyadharshini gowthamanc2357bd2016-06-22 22:47:14 -0700557 char ap_infoz[17];
priyadharshini gowthaman8e26ff42016-06-22 22:47:14 -0700558 int ap_lcr;
559 char ap_val_lcr[400];
560 int ap_rrm;
561 int ap_rtt;
562 int ap_neighap; /* number of configured neighbor APs */
563 unsigned char ap_val_neighap[3][6];
564 int ap_opchannel; /* number of oper channels */
565 int ap_val_opchannel[3];
566 int ap_scan;
priyadharshini gowthamanc2357bd2016-06-22 22:47:14 -0700567 int ap_fqdn_held;
568 int ap_fqdn_supl;
priyadharshini gowthamana27b5b62016-06-22 22:47:14 -0700569 int ap_msnt_type;
570
priyadharshini gowthamanb4e05fc2016-10-13 15:02:35 -0700571 int ap_mbo;
572 int ap_ne_class;
573 int ap_ne_op_ch;
574 int ap_set_bssidpref;
575 int ap_btmreq_disassoc_imnt;
576 int ap_btmreq_term_bit;
Adil Saeed Musthafa7d9ae382017-04-10 23:13:33 -0700577 int ap_disassoc_timer;
578 int ap_btmreq_bss_term_dur;
Adil Saeed Musthafa604c8262017-04-10 23:13:31 -0700579 enum reg_domain {
580 REG_DOMAIN_NOT_SET,
581 REG_DOMAIN_LOCAL,
582 REG_DOMAIN_GLOBAL
583 } ap_reg_domain;
Adil Saeed Musthafacf752fa2017-04-10 23:13:32 -0700584 char ap_mobility_domain[10];
Adil Saeed Musthafa023108a2017-04-10 23:13:37 -0700585 unsigned char ap_cell_cap_pref;
Adil Saeed Musthafa4ec61bd2017-04-10 23:13:41 -0700586 int ap_ft_oa;
587 int ap_name;
priyadharshini gowthaman09d613e2017-12-20 11:43:44 -0800588 int ap_interface_5g;
589 int ap_interface_2g;
priyadharshini gowthaman776562e2017-12-20 12:33:34 -0800590 int ap_assoc_delay;
priyadharshini gowthaman94062b52017-12-20 12:33:34 -0800591 int ap_btmreq_bss_term_tsf;
priyadharshini gowthaman00798a22017-12-28 15:15:00 -0800592 int ap_fils_dscv_int;
593 int ap_nairealm_int;
594 char ap_nairealm[33];
595 int ap_blechanutil;
596 int ap_ble_admit_cap;
597 int ap_datappdudura;
598 int ap_airtimefract;
599 char ap_dhcpserv_ipaddr[20];
600 int ap_dhcp_stop;
601 int ap_bawinsize;
602 int ap_blestacnt;
priyadharshini gowthamancb22e432017-12-28 15:23:31 -0800603 int ap_ul_availcap;
604 int ap_dl_availcap;
priyadharshini gowthamande81f392017-12-28 15:28:49 -0800605 int ap_akm;
606 int ap_pmksa;
607 int ap_pmksa_caching;
priyadharshini gowthaman63ab8482017-12-28 15:32:55 -0800608 int ap_80plus80;
priyadharshini gowthaman9149afc2018-01-15 13:40:18 -0800609 int ap_oper_chn;
Adil Saeed Musthafa4ec61bd2017-04-10 23:13:41 -0700610
Adil Saeed Musthafa69063722017-04-10 23:13:40 -0700611 struct mbo_pref_ap mbo_pref_aps[MBO_MAX_PREF_BSSIDS];
612 struct mbo_pref_ap mbo_self_ap_tuple;
613 int mbo_pref_ap_cnt;
Adil Saeed Musthafa4ec61bd2017-04-10 23:13:41 -0700614 unsigned char ft_bss_mac_list[MAX_FT_BSS_LIST][ETH_ALEN];
615 int ft_bss_mac_cnt;
priyadharshini gowthamanb4e05fc2016-10-13 15:02:35 -0700616
priyadharshini gowthaman00798a22017-12-28 15:15:00 -0800617 enum value_not_set_enabled_disabled ap_oce;
618 enum value_not_set_enabled_disabled ap_filsdscv;
619 enum value_not_set_enabled_disabled ap_filshlp;
620 enum value_not_set_enabled_disabled ap_broadcast_ssid;
621 enum value_not_set_enabled_disabled ap_rnr;
622 enum value_not_set_enabled_disabled ap_esp;
623
priyadharshini gowthaman350f1912018-06-04 13:09:12 -0700624 enum ppdu {
625 PPDU_NOT_SET,
626 PPDU_MU,
627 PPDU_SU,
628 PPDU_ER,
629 PPDU_TB,
630 } ap_he_ppdu;
631
Alexei Avshalom Lazarbc180dc2018-12-18 16:01:14 +0200632 struct sigma_ese_alloc ap_ese_allocs[MAX_ESE_ALLOCS];
633 int ap_num_ese_allocs;
634
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200635 const char *hostapd_debug_log;
Alexei Avshalom Lazar3e8267e2018-12-18 15:58:54 +0200636 const char *wpa_supplicant_debug_log;
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200637
638#ifdef CONFIG_TRAFFIC_AGENT
639 /* Traffic Agent */
640 struct sigma_stream streams[MAX_SIGMA_STREAMS];
641 int stream_id;
642 int num_streams;
643 pthread_t thr;
644#endif /* CONFIG_TRAFFIC_AGENT */
645
Jouni Malinenc2493f82016-06-05 18:01:33 +0300646 unsigned int throughput_pktsize; /* If non-zero, override pktsize for
647 * throughput tests */
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200648 int no_timestamps;
649
650 const char *sniffer_ifname;
651 const char *set_macaddr;
652 int tmp_mac_addr;
653 int ap_is_dual;
654 enum ap_mode ap_mode_1;
655 enum ap_chwidth ap_chwidth_1;
656 int ap_channel_1;
657 char ap_countrycode[3];
658
659 int ap_wpsnfc;
660
Pradeep Reddy POTTETI0d3db632016-03-11 15:21:11 +0530661 enum ap_wme {
662 AP_WME_OFF,
663 AP_WME_ON,
664 } ap_wme;
665
Mohammed Shafi Shajakhan02e3b822017-02-23 04:15:02 +0530666 enum ap_wmmps {
667 AP_WMMPS_OFF,
668 AP_WMMPS_ON,
669 } ap_wmmps;
670
Pradeep Reddy Potteti4b0cdee2017-03-15 12:37:33 +0530671 enum sec_ch_offset ap_chwidth_offset;
672
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200673#ifdef CONFIG_SNIFFER
674 pid_t sniffer_pid;
675 char sniffer_filename[200];
676#endif /* CONFIG_SNIFFER */
677
678 int last_set_ip_config_ipv6;
Amarnath Hullur Subramanyam9c381f52017-03-17 00:04:41 -0700679#ifdef MIRACAST
680 pthread_t rtsp_thread_handle;
681 int wfd_device_type; /* 0 for source, 1 for sink */
682 char peer_mac_address[32];
683 void *miracast_lib;
684 const char *miracast_lib_path;
685 char mdns_instance_name[64];
686#endif /* MIRACAST */
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200687
688 int tid_to_handle[8]; /* Mapping of TID to handle */
689 int dialog_token; /* Used for generating unique handle for an addTs */
690
691 enum sigma_program {
692 PROGRAM_UNKNOWN = 0,
693 PROGRAM_TDLS,
694 PROGRAM_HS2,
695 PROGRAM_HS2_R2,
696 PROGRAM_WFD,
Amarnath Hullur Subramanyam659a34c2017-03-17 00:04:41 -0700697 PROGRAM_DISPLAYR2,
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200698 PROGRAM_PMF,
699 PROGRAM_WPS,
700 PROGRAM_60GHZ,
701 PROGRAM_HT,
702 PROGRAM_VHT,
703 PROGRAM_NAN,
priyadharshini gowthaman12dd4142016-06-22 22:47:14 -0700704 PROGRAM_LOC,
Adil Saeed Musthafa33ea2872017-04-10 23:13:24 -0700705 PROGRAM_MBO,
Jouni Malinen5c3813a2017-08-26 13:30:39 +0300706 PROGRAM_IOTLP,
707 PROGRAM_DPP,
Ankita Bajaja2cb5672017-10-25 16:08:28 +0530708 PROGRAM_OCE,
priyadharshini gowthaman0e209fc2018-01-26 15:15:37 -0800709 PROGRAM_WPA3,
Amarnath Hullur Subramanyam8f9c8682018-01-30 19:01:51 -0800710 PROGRAM_HE,
Jouni Malinenba630452018-06-22 11:49:59 +0300711 PROGRAM_HS2_R3,
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200712 } program;
713
714 enum device_type {
715 device_type_unknown,
716 AP_unknown,
717 AP_testbed,
718 AP_dut,
719 STA_unknown,
720 STA_testbed,
721 STA_dut
722 } device_type;
723
724 enum {
725 DEVROLE_UNKNOWN = 0,
726 DEVROLE_STA,
727 DEVROLE_PCP,
Alexei Avshalom Lazar2712cc82018-12-23 16:29:14 +0200728 DEVROLE_STA_CFON,
729 DEVROLE_AP,
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200730 } dev_role;
731
Alexei Avshalom Lazar33f700c2018-12-18 16:00:39 +0200732 enum wps_band {
733 WPS_BAND_NON_60G = 0,
734 WPS_BAND_60G,
735 } band;
736
Alexei Avshalom Lazareee9ab02018-12-24 16:27:48 +0200737 int wps_disable; /* Used for 60G to disable PCP from sending WPS IE */
Alexei Avshalom Lazar33f700c2018-12-18 16:00:39 +0200738 int wsc_fragment; /* simulate WSC IE fragmentation */
Alexei Avshalom Lazarb094bf02018-12-18 16:00:53 +0200739 enum {
740 /* no change */
741 FORCE_RSN_IE_NONE = 0,
742 /* if exists, remove and clear privacy bit */
743 FORCE_RSN_IE_REMOVE,
744 /* if not exists, add and set privacy bit */
745 FORCE_RSN_IE_ADD,
746 } force_rsn_ie; /* override RSN IE in association request */
Alexei Avshalom Lazar33f700c2018-12-18 16:00:39 +0200747
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200748 const char *version;
749 int no_ip_addr_set;
750 int sta_channel;
751
752 const char *summary_log;
753 const char *hostapd_entropy_log;
754
755 int iface_down_on_reset;
756 int write_stats; /* traffic stream e2e*.txt files */
Bala Krishna Bhamidipati73d7af02016-03-24 12:27:56 +0530757 int sim_no_username; /* do not set SIM username to use real SIM */
Jouni Malinen5db3b102016-08-04 12:27:18 +0300758
759 const char *vendor_name; /* device_get_info vendor override */
760 const char *model_name; /* device_get_info model override */
761 const char *version_name; /* device_get_info version override */
Rakesh Sunki7d37f412017-03-30 14:47:55 -0700762
Rakesh Sunki14cfcd22017-03-30 14:47:55 -0700763 int ndp_enable; /* Flag which is set once the NDP is setup */
764
Peng Xu8863ec72018-08-06 11:50:37 -0700765 int ndpe; /* Flag indicating NDPE is supported */
766 u16 trans_port; /* transport port number for TCP/UDP connection */
767 u8 trans_proto; /* transport protocol, 0x06: TCP, 0x11: UDP */
768
Rakesh Sunki7d37f412017-03-30 14:47:55 -0700769 /* Length of nan_pmk in octets */
770 u8 nan_pmk_len;
771
772 /*
773 * PMK: Info is optional in Discovery phase. PMK info can
774 * be passed during the NDP session.
775 */
776 u8 nan_pmk[32];
Adil Saeed Musthafa33ea2872017-04-10 23:13:24 -0700777
778 enum value_not_set_enabled_disabled wnm_bss_max_feature;
779 int wnm_bss_max_idle_time;
780 enum value_not_set_enabled_disabled wnm_bss_max_protection;
Ashwini Patil00402582017-04-13 12:29:39 +0530781
782 char *non_pref_ch_list; /* MBO: non-preferred channel report */
Ashwini Patil5acd7382017-04-13 15:55:04 +0530783 char *btm_query_cand_list; /* Candidate list for BTM Query */
Jouni Malinen3c367e82017-06-23 17:01:47 +0300784
Jouni Malinen68143132017-09-02 02:34:08 +0300785 char *sae_commit_override;
Jouni Malinen3c367e82017-06-23 17:01:47 +0300786 char *rsne_override;
Jouni Malinend6bf1b42017-06-23 17:51:01 +0300787 const char *hostapd_bin;
788 int use_hostapd_pid_file;
789 const char *hostapd_ifname;
Jouni Malinend86e5822017-08-29 03:55:32 +0300790 int hostapd_running;
791
Jouni Malinenb1dd21f2017-11-13 19:14:29 +0200792 char *dpp_peer_uri;
Jouni Malinend86e5822017-08-29 03:55:32 +0300793 int dpp_local_bootstrap;
794 int dpp_conf_id;
Ankita Bajaj1bde7942018-01-09 19:15:01 +0530795
796 u8 fils_hlp;
797 pthread_t hlp_thread;
Peng Xu291d97d2018-01-31 16:34:03 -0800798
799#ifdef NL80211_SUPPORT
800 struct nl80211_ctx *nl_ctx;
Sunil Dutt076081f2018-02-05 19:45:50 +0530801 int config_rsnie;
Peng Xu291d97d2018-01-31 16:34:03 -0800802#endif /* NL80211_SUPPORT */
Arif Hussainac6c5112018-05-25 17:34:00 -0700803
804 int sta_nss;
Anurag Das2052daa2018-08-31 14:35:25 +0530805
806#ifdef ANDROID
807 int nanservicediscoveryinprogress;
808#endif /* ANDROID */
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200809};
810
811
812enum sigma_dut_print_level {
813 DUT_MSG_DEBUG, DUT_MSG_INFO, DUT_MSG_ERROR
814};
815
816void sigma_dut_print(struct sigma_dut *dut, int level, const char *fmt, ...)
817PRINTF_FORMAT(3, 4);
818
819void sigma_dut_summary(struct sigma_dut *dut, const char *fmt, ...)
820PRINTF_FORMAT(2, 3);
821
822
823enum sigma_status {
824 SIGMA_RUNNING, SIGMA_INVALID, SIGMA_ERROR, SIGMA_COMPLETE
825};
826
827void send_resp(struct sigma_dut *dut, struct sigma_conn *conn,
Jouni Malinen76401f52017-03-18 01:04:55 +0200828 enum sigma_status status, const char *buf);
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200829
830const char * get_param(struct sigma_cmd *cmd, const char *name);
Alexei Avshalom Lazarbc180dc2018-12-18 16:01:14 +0200831const char * get_param_indexed(struct sigma_cmd *cmd, const char *name,
832 int index);
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200833
834int sigma_dut_reg_cmd(const char *cmd,
835 int (*validate)(struct sigma_cmd *cmd),
Jouni Malinen26a5b762019-02-19 01:17:48 +0200836 enum sigma_cmd_result (*process)(struct sigma_dut *dut,
837 struct sigma_conn *conn,
838 struct sigma_cmd *cmd));
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200839
840void sigma_dut_register_cmds(void);
841
842int cmd_sta_send_frame(struct sigma_dut *dut, struct sigma_conn *conn,
843 struct sigma_cmd *cmd);
844int cmd_sta_set_parameter(struct sigma_dut *dut, struct sigma_conn *conn,
845 struct sigma_cmd *cmd);
846int cmd_ap_send_frame(struct sigma_dut *dut, struct sigma_conn *conn,
847 struct sigma_cmd *cmd);
848int cmd_wlantest_send_frame(struct sigma_dut *dut, struct sigma_conn *conn,
849 struct sigma_cmd *cmd);
Ankita Bajaj0d5825b2017-10-25 16:20:17 +0530850int sta_cfon_set_wireless(struct sigma_dut *dut, struct sigma_conn *conn,
851 struct sigma_cmd *cmd);
852int sta_cfon_get_mac_address(struct sigma_dut *dut, struct sigma_conn *conn,
853 struct sigma_cmd *cmd);
854int sta_cfon_reset_default(struct sigma_dut *dut, struct sigma_conn *conn,
855 struct sigma_cmd *cmd);
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200856
857enum driver_type {
858 DRIVER_NOT_SET,
859 DRIVER_ATHEROS,
860 DRIVER_WCN,
861 DRIVER_MAC80211,
862 DRIVER_AR6003,
863 DRIVER_WIL6210,
864 DRIVER_QNXNTO,
Sreelakshmi Konamkib692f102016-04-26 19:47:00 +0530865 DRIVER_OPENWRT,
866 DRIVER_LINUX_WCN,
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200867};
868
869enum openwrt_driver_type {
870 OPENWRT_DRIVER_NOT_SET,
871 OPENWRT_DRIVER_ATHEROS
872};
873
874#define DRIVER_NAME_60G "wil6210"
875
876int set_wifi_chip(const char *chip_type);
877enum driver_type get_driver_type(void);
878enum openwrt_driver_type get_openwrt_driver_type(void);
879int file_exists(const char *fname);
880
881struct wpa_ctrl;
882
883int wps_connection_event(struct sigma_dut *dut, struct sigma_conn *conn,
884 struct wpa_ctrl *ctrl, const char *intf, int p2p_resp);
885int ascii2hexstr(const char *str, char *hex);
886void disconnect_station(struct sigma_dut *dut);
887void nfc_status(struct sigma_dut *dut, const char *state, const char *oper);
888int get_ip_config(struct sigma_dut *dut, const char *ifname, char *buf,
889 size_t buf_len);
890int ath6kl_client_uapsd(struct sigma_dut *dut, const char *intf, int uapsd);
891int is_ip_addr(const char *str);
892int run_system(struct sigma_dut *dut, const char *cmd);
Adil Saeed Musthafa5f793f02017-04-10 23:13:30 -0700893int run_system_wrapper(struct sigma_dut *dut, const char *cmd, ...);
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200894int cmd_wlantest_set_channel(struct sigma_dut *dut, struct sigma_conn *conn,
895 struct sigma_cmd *cmd);
896void sniffer_close(struct sigma_dut *dut);
897
898/* ap.c */
899void ath_disable_txbf(struct sigma_dut *dut, const char *intf);
Priyadharshini Gowthaman818afef2015-11-09 13:28:15 -0800900void ath_config_dyn_bw_sig(struct sigma_dut *dut, const char *ifname,
901 const char *val);
priyadharshini gowthamane5e25172015-12-08 14:53:48 -0800902void novap_reset(struct sigma_dut *dut, const char *ifname);
Jouni Malinen2e6ccc22017-09-04 13:43:16 +0300903int get_hwaddr(const char *ifname, unsigned char *hwaddr);
Jouni Malinena326d7b2017-09-04 13:46:02 +0300904int cmd_ap_config_commit(struct sigma_dut *dut, struct sigma_conn *conn,
905 struct sigma_cmd *cmd);
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200906
907/* sta.c */
908int set_ps(const char *intf, struct sigma_dut *dut, int enabled);
909void ath_set_zero_crc(struct sigma_dut *dut, const char *val);
910void ath_set_cts_width(struct sigma_dut *dut, const char *ifname,
911 const char *val);
912int ath_set_width(struct sigma_dut *dut, struct sigma_conn *conn,
913 const char *intf, const char *val);
Alexei Avshalom Lazar49498b82019-01-31 15:16:32 +0200914int sta_set_60g_abft_len(struct sigma_dut *dut, struct sigma_conn *conn,
915 int abft_len);
Lior David0fe101e2017-03-09 16:09:50 +0200916int wil6210_send_frame_60g(struct sigma_dut *dut, struct sigma_conn *conn,
917 struct sigma_cmd *cmd);
Ankita Bajaj1bde7942018-01-09 19:15:01 +0530918int hwaddr_aton(const char *txt, unsigned char *addr);
919int set_ipv4_addr(struct sigma_dut *dut, const char *ifname,
920 const char *ip, const char *mask);
921int set_ipv4_gw(struct sigma_dut *dut, const char *gw);
Alexei Avshalom Lazar79fa3fe2018-12-24 15:43:33 +0200922int send_addba_60g(struct sigma_dut *dut, struct sigma_conn *conn,
923 struct sigma_cmd *cmd, const char *param);
Alexei Avshalom Lazarbc180dc2018-12-18 16:01:14 +0200924int wil6210_set_ese(struct sigma_dut *dut, int count,
925 struct sigma_ese_alloc *allocs);
926int sta_extract_60g_ese(struct sigma_dut *dut, struct sigma_cmd *cmd,
927 struct sigma_ese_alloc *allocs, int *allocs_size);
Alexei Avshalom Lazaraad97b02018-12-18 16:01:23 +0200928int wil6210_set_force_mcs(struct sigma_dut *dut, int force, int mcs);
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200929
930/* p2p.c */
931int p2p_cmd_sta_get_parameter(struct sigma_dut *dut, struct sigma_conn *conn,
932 struct sigma_cmd *cmd);
Purushottam Kushwaha091e2532016-08-23 11:52:21 +0530933void p2p_create_event_thread(struct sigma_dut *dut);
934void stop_event_thread(void);
Amarnath Hullur Subramanyam89b37cd2017-03-17 00:04:41 -0700935void start_dhcp(struct sigma_dut *dut, const char *group_ifname, int go);
936void stop_dhcp(struct sigma_dut *dut, const char *group_ifname, int go);
937int p2p_discover_peer(struct sigma_dut *dut, const char *ifname,
938 const char *peer, int full);
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200939
Jouni Malinenc54710d2019-01-23 12:34:21 +0200940/* basic.c */
941void get_ver(const char *cmd, char *buf, size_t buflen);
942
priyadharshini gowthaman72462ef2016-06-22 22:47:14 -0700943/* utils.c */
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200944enum sigma_program sigma_program_to_enum(const char *prog);
Jouni Malinen08cf2312017-09-04 13:39:47 +0300945int parse_hexstr(const char *hex, unsigned char *buf, size_t buflen);
priyadharshini gowthaman72462ef2016-06-22 22:47:14 -0700946int parse_mac_address(struct sigma_dut *dut, const char *arg,
947 unsigned char *addr);
Alexei Avshalom Lazar093569f2018-11-13 14:08:17 +0200948int is_60g_sigma_dut(struct sigma_dut *dut);
949unsigned int channel_to_freq(struct sigma_dut *dut, unsigned int channel);
Rakesh Sunki7192dc42017-03-30 14:47:55 -0700950unsigned int freq_to_channel(unsigned int freq);
Peng Xu525965b2018-06-26 16:40:14 -0700951int is_ipv6_addr(const char *str);
Rakesh Sunki8f8e74b2017-05-16 15:42:12 -0700952void convert_mac_addr_to_ipv6_lladdr(u8 *mac_addr, char *ipv6_buf,
953 size_t buf_len);
Peng Xu8863ec72018-08-06 11:50:37 -0700954size_t convert_mac_addr_to_ipv6_linklocal(const u8 *mac_addr, u8 *ipv6);
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200955
Peng Xu769731a2017-05-10 17:27:28 -0700956#ifndef ANDROID
957size_t strlcpy(char *dest, const char *src, size_t siz);
958size_t strlcat(char *dst, const char *str, size_t size);
959#endif /* ANDROID */
Ankita Bajaj1bde7942018-01-09 19:15:01 +0530960void hex_dump(struct sigma_dut *dut, u8 *data, size_t len);
Alexei Avshalom Lazar0dae51c2018-12-18 16:00:18 +0200961int get_wps_pin_from_mac(struct sigma_dut *dut, const char *macaddr,
962 char *pin, size_t len);
Alexei Avshalom Lazar64279692018-12-23 16:49:49 +0200963void str_remove_chars(char *str, char ch);
Peng Xu769731a2017-05-10 17:27:28 -0700964
965
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200966/* uapsd_stream.c */
967void receive_uapsd(struct sigma_stream *s);
Pradeep Reddy POTTETI79594042015-11-23 12:59:12 +0530968void send_uapsd_console(struct sigma_stream *s);
Jouni Malinencd4e3c32015-10-29 12:39:56 +0200969
970/* nan.c */
971int nan_preset_testparameters(struct sigma_dut *dut, struct sigma_conn *conn,
972 struct sigma_cmd *cmd);
973int nan_cmd_sta_get_parameter(struct sigma_dut *dut, struct sigma_conn *conn,
974 struct sigma_cmd *cmd);
975int nan_cmd_sta_exec_action(struct sigma_dut *dut, struct sigma_conn *conn,
976 struct sigma_cmd *cmd);
977int nan_cmd_sta_get_events(struct sigma_dut *dut, struct sigma_conn *conn,
978 struct sigma_cmd *cmd);
979int nan_cmd_sta_transmit_followup(struct sigma_dut *dut,
980 struct sigma_conn *conn,
981 struct sigma_cmd *cmd);
982void nan_cmd_sta_reset_default(struct sigma_dut *dut, struct sigma_conn *conn,
983 struct sigma_cmd *cmd);
984int nan_cmd_sta_preset_testparameters(struct sigma_dut *dut,
985 struct sigma_conn *conn,
986 struct sigma_cmd *cmd);
987
priyadharshini gowthamand66913a2016-07-29 15:11:17 -0700988/* ftm.c */
989int loc_cmd_sta_exec_action(struct sigma_dut *dut, struct sigma_conn *conn,
990 struct sigma_cmd *cmd);
991int loc_cmd_sta_send_frame(struct sigma_dut *dut, struct sigma_conn *conn,
992 struct sigma_cmd *cmd);
993int loc_cmd_sta_preset_testparameters(struct sigma_dut *dut,
994 struct sigma_conn *conn,
995 struct sigma_cmd *cmd);
996
Jouni Malinend86e5822017-08-29 03:55:32 +0300997/* dpp.c */
998int dpp_dev_exec_action(struct sigma_dut *dut, struct sigma_conn *conn,
999 struct sigma_cmd *cmd);
1000
Ankita Bajaj1bde7942018-01-09 19:15:01 +05301001/* dhcp.c */
1002void process_fils_hlp(struct sigma_dut *dut);
1003void hlp_thread_cleanup(struct sigma_dut *dut);
Jouni Malinend86e5822017-08-29 03:55:32 +03001004
Peng Xu291d97d2018-01-31 16:34:03 -08001005#ifdef NL80211_SUPPORT
1006struct nl80211_ctx * nl80211_init(struct sigma_dut *dut);
1007void nl80211_deinit(struct sigma_dut *dut, struct nl80211_ctx *ctx);
1008struct nl_msg * nl80211_drv_msg(struct sigma_dut *dut, struct nl80211_ctx *ctx,
1009 int ifindex, int flags,
1010 uint8_t cmd);
1011int send_and_recv_msgs(struct sigma_dut *dut, struct nl80211_ctx *ctx,
1012 struct nl_msg *nlmsg,
1013 int (*valid_handler)(struct nl_msg *, void *),
1014 void *valid_data);
1015#endif /* NL80211_SUPPORT */
1016
Jouni Malinencd4e3c32015-10-29 12:39:56 +02001017#endif /* SIGMA_DUT_H */