Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Sigma Control API DUT (station/AP) |
| 3 | * Copyright (c) 2010-2011, Atheros Communications, Inc. |
Amarnath Hullur Subramanyam | 9c381f5 | 2017-03-17 00:04:41 -0700 | [diff] [blame] | 4 | * Copyright (c) 2011-2017, Qualcomm Atheros, Inc. |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 5 | * 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 David | 9981b51 | 2017-01-20 13:16:40 +0200 | [diff] [blame] | 12 | #ifdef __GNUC__ |
| 13 | #define _GNU_SOURCE 1 |
| 14 | #endif |
| 15 | |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 16 | #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 Malinen | 3d972ba | 2017-03-15 20:52:20 +0200 | [diff] [blame] | 24 | #include <sys/types.h> |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 25 | #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 Xu | 291d97d | 2018-01-31 16:34:03 -0800 | [diff] [blame] | 36 | #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 Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 43 | |
| 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 | |
| 67 | struct sigma_dut; |
| 68 | |
| 69 | #define MAX_PARAMS 100 |
Alejandro Vasquez | 363f558 | 2018-07-17 11:25:05 -0700 | [diff] [blame] | 70 | #define MAX_RADIO 3 |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 71 | |
| 72 | /* Set default operating channel width 80 MHz */ |
| 73 | #define VHT_DEFAULT_OPER_CHWIDTH AP_80_VHT_OPER_CHWIDTH |
| 74 | |
| 75 | typedef unsigned int u32; |
Ankita Bajaj | 1bde794 | 2018-01-09 19:15:01 +0530 | [diff] [blame] | 76 | typedef uint16_t u16; |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 77 | typedef 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 | |
| 89 | struct sigma_cmd { |
| 90 | char *params[MAX_PARAMS]; |
| 91 | char *values[MAX_PARAMS]; |
| 92 | int count; |
| 93 | }; |
| 94 | |
Alejandro Vasquez | 3410aa5 | 2018-07-17 11:26:17 -0700 | [diff] [blame] | 95 | #define MAX_CMD_LEN 4096 |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 96 | |
| 97 | struct 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 | |
| 106 | #define SIGMA_DUT_ERROR_CALLER_SEND_STATUS -2 |
| 107 | #define SIGMA_DUT_INVALID_CALLER_SEND_STATUS -1 |
| 108 | #define SIGMA_DUT_SUCCESS_STATUS_SENT 0 |
| 109 | #define SIGMA_DUT_SUCCESS_CALLER_SEND_STATUS 1 |
| 110 | |
| 111 | struct sigma_cmd_handler { |
| 112 | struct sigma_cmd_handler *next; |
| 113 | char *cmd; |
| 114 | int (*validate)(struct sigma_cmd *cmd); |
| 115 | /* process return value: |
| 116 | * -2 = failed, caller will send status,ERROR |
| 117 | * -1 = failed, caller will send status,INVALID |
| 118 | * 0 = success, response already sent |
| 119 | * 1 = success, caller will send status,COMPLETE |
| 120 | */ |
| 121 | int (*process)(struct sigma_dut *dut, struct sigma_conn *conn, |
| 122 | struct sigma_cmd *cmd); |
| 123 | }; |
| 124 | |
| 125 | #define P2P_GRP_ID_LEN 128 |
| 126 | #define IP_ADDR_STR_LEN 16 |
| 127 | |
| 128 | struct wfa_cs_p2p_group { |
| 129 | struct wfa_cs_p2p_group *next; |
| 130 | char ifname[IFNAMSIZ]; |
| 131 | int go; |
| 132 | char grpid[P2P_GRP_ID_LEN]; |
| 133 | char ssid[33]; |
| 134 | }; |
| 135 | |
| 136 | #ifdef CONFIG_TRAFFIC_AGENT |
| 137 | |
| 138 | #define MAX_SIGMA_STREAMS 16 |
| 139 | #define MAX_SIGMA_STATS 6000 |
| 140 | |
| 141 | struct sigma_frame_stats { |
| 142 | unsigned int seqnum; |
| 143 | unsigned int local_sec; |
| 144 | unsigned int local_usec; |
| 145 | unsigned int remote_sec; |
| 146 | unsigned int remote_usec; |
| 147 | }; |
| 148 | |
| 149 | struct sigma_stream { |
| 150 | enum sigma_stream_profile { |
| 151 | SIGMA_PROFILE_FILE_TRANSFER, |
| 152 | SIGMA_PROFILE_MULTICAST, |
| 153 | SIGMA_PROFILE_IPTV, |
| 154 | SIGMA_PROFILE_TRANSACTION, |
| 155 | SIGMA_PROFILE_START_SYNC, |
| 156 | SIGMA_PROFILE_UAPSD |
| 157 | } profile; |
| 158 | int sender; |
| 159 | struct in_addr dst; |
| 160 | int dst_port; |
| 161 | struct in_addr src; |
| 162 | int src_port; |
| 163 | int frame_rate; |
| 164 | int duration; |
Jouni Malinen | c2493f8 | 2016-06-05 18:01:33 +0300 | [diff] [blame] | 165 | unsigned int payload_size; |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 166 | int start_delay; |
| 167 | int max_cnt; |
| 168 | enum sigma_traffic_class { |
| 169 | SIGMA_TC_VOICE, |
| 170 | SIGMA_TC_VIDEO, |
| 171 | SIGMA_TC_BACKGROUND, |
| 172 | SIGMA_TC_BEST_EFFORT |
| 173 | } tc; |
| 174 | int user_priority; |
| 175 | int user_priority_set; |
| 176 | int started; |
| 177 | int no_timestamps; |
| 178 | |
| 179 | int sock; |
| 180 | pthread_t thr; |
| 181 | int stop; |
| 182 | int ta_send_in_progress; |
| 183 | int trans_proto; |
| 184 | |
| 185 | /* Statistics */ |
| 186 | int tx_act_frames; /* |
| 187 | * Number of frames generated by the traffic |
| 188 | * generator application. The name is defined in the |
| 189 | * Sigma CAPI spec. |
| 190 | */ |
| 191 | int tx_frames; |
| 192 | int rx_frames; |
| 193 | unsigned long long tx_payload_bytes; |
| 194 | unsigned long long rx_payload_bytes; |
| 195 | int out_of_seq_frames; |
| 196 | struct sigma_frame_stats *stats; |
| 197 | unsigned int num_stats; |
| 198 | unsigned int stream_id; |
| 199 | |
| 200 | /* U-APSD */ |
| 201 | unsigned int sta_id; |
| 202 | unsigned int rx_cookie; |
| 203 | unsigned int uapsd_sta_tc; |
| 204 | unsigned int uapsd_rx_state; |
| 205 | unsigned int uapsd_tx_state; |
| 206 | unsigned int tx_stop_cnt; |
| 207 | unsigned int tx_hello_cnt; |
| 208 | pthread_t uapsd_send_thr; |
| 209 | pthread_cond_t tx_thr_cond; |
| 210 | pthread_mutex_t tx_thr_mutex; |
| 211 | int reset_rx; |
| 212 | int num_retry; |
| 213 | char ifname[IFNAMSIZ]; /* ifname from the command */ |
| 214 | struct sigma_dut *dut; /* for traffic agent thread to access context */ |
Pradeep Reddy POTTETI | 7959404 | 2015-11-23 12:59:12 +0530 | [diff] [blame] | 215 | /* console */ |
| 216 | char test_name[9]; /* test case name */ |
| 217 | int can_quit; |
| 218 | int reset; |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 219 | }; |
| 220 | |
| 221 | #endif /* CONFIG_TRAFFIC_AGENT */ |
| 222 | |
| 223 | |
| 224 | #define NUM_AP_AC 4 |
| 225 | #define AP_AC_BE 0 |
| 226 | #define AP_AC_BK 1 |
| 227 | #define AP_AC_VI 2 |
| 228 | #define AP_AC_VO 3 |
| 229 | |
Adil Saeed Musthafa | b7b297f | 2017-04-10 23:13:31 -0700 | [diff] [blame] | 230 | #define MAX_WLAN_TAGS 3 |
Adil Saeed Musthafa | 6906372 | 2017-04-10 23:13:40 -0700 | [diff] [blame] | 231 | #define MBO_MAX_PREF_BSSIDS 10 |
Adil Saeed Musthafa | 4ec61bd | 2017-04-10 23:13:41 -0700 | [diff] [blame] | 232 | #define MAX_FT_BSS_LIST 10 |
Adil Saeed Musthafa | b7b297f | 2017-04-10 23:13:31 -0700 | [diff] [blame] | 233 | |
Peng Xu | 8863ec7 | 2018-08-06 11:50:37 -0700 | [diff] [blame] | 234 | #define TRANSPORT_PROTO_TYPE_TCP 0x06 |
| 235 | #define TRANSPORT_PROTO_TYPE_UDP 0x11 |
| 236 | #define NAN_TRANSPORT_PORT_DEFAULT 7000 |
| 237 | #define NAN_TRANSPORT_PROTOCOL_DEFAULT TRANSPORT_PROTO_TYPE_TCP |
| 238 | |
Jouni Malinen | 57fa3d8 | 2016-11-30 12:51:43 +0200 | [diff] [blame] | 239 | enum value_not_set_enabled_disabled { |
| 240 | VALUE_NOT_SET, |
| 241 | VALUE_ENABLED, |
| 242 | VALUE_DISABLED |
| 243 | }; |
| 244 | |
Pradeep Reddy Potteti | 4b0cdee | 2017-03-15 12:37:33 +0530 | [diff] [blame] | 245 | enum sec_ch_offset { |
| 246 | SEC_CH_NO, |
| 247 | SEC_CH_40ABOVE, |
| 248 | SEC_CH_40BELOW |
| 249 | }; |
| 250 | |
Adil Saeed Musthafa | 6906372 | 2017-04-10 23:13:40 -0700 | [diff] [blame] | 251 | struct mbo_pref_ap { |
| 252 | int ap_ne_class; |
| 253 | int ap_ne_op_ch; |
| 254 | int ap_ne_pref; |
| 255 | unsigned char mac_addr[ETH_ALEN]; |
| 256 | }; |
| 257 | |
Peng Xu | 291d97d | 2018-01-31 16:34:03 -0800 | [diff] [blame] | 258 | #ifdef NL80211_SUPPORT |
| 259 | #define SOCK_BUF_SIZE (32 * 1024) |
| 260 | struct nl80211_ctx { |
| 261 | struct nl_sock *sock; |
| 262 | int netlink_familyid; |
| 263 | int nlctrl_familyid; |
| 264 | size_t sock_buf_size; |
| 265 | }; |
| 266 | #endif /* NL80211_SUPPORT */ |
| 267 | |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 268 | struct sigma_dut { |
| 269 | int s; /* server TCP socket */ |
| 270 | int debug_level; |
| 271 | int stdout_debug; |
| 272 | struct sigma_cmd_handler *cmds; |
| 273 | |
| 274 | /* Default timeout value (seconds) for commands */ |
| 275 | unsigned int default_timeout; |
| 276 | |
| 277 | int next_streamid; |
| 278 | |
| 279 | const char *bridge; /* bridge interface to use in AP mode */ |
| 280 | |
| 281 | enum sigma_mode { |
| 282 | SIGMA_MODE_UNKNOWN, |
| 283 | SIGMA_MODE_STATION, |
| 284 | SIGMA_MODE_AP, |
| 285 | SIGMA_MODE_SNIFFER |
| 286 | } mode; |
| 287 | |
| 288 | /* |
| 289 | * Local cached values to handle API that does not provide all the |
| 290 | * needed information with commands that actually trigger some |
| 291 | * operations. |
| 292 | */ |
| 293 | int listen_chn; |
| 294 | int persistent; |
| 295 | int intra_bss; |
| 296 | int noa_duration; |
| 297 | int noa_interval; |
| 298 | int noa_count; |
| 299 | enum wfa_cs_wps_method { |
| 300 | WFA_CS_WPS_NOT_READY, |
| 301 | WFA_CS_WPS_PBC, |
| 302 | WFA_CS_WPS_PIN_DISPLAY, |
| 303 | WFA_CS_WPS_PIN_LABEL, |
| 304 | WFA_CS_WPS_PIN_KEYPAD |
| 305 | } wps_method; |
| 306 | char wps_pin[9]; |
| 307 | |
| 308 | struct wfa_cs_p2p_group *groups; |
| 309 | |
| 310 | char infra_ssid[33]; |
| 311 | int infra_network_id; |
| 312 | |
| 313 | enum p2p_mode { |
| 314 | P2P_IDLE, P2P_DISCOVER, P2P_LISTEN, P2P_DISABLE |
| 315 | } p2p_mode; |
| 316 | |
| 317 | int go; |
| 318 | int p2p_client; |
Purushottam Kushwaha | 091e253 | 2016-08-23 11:52:21 +0530 | [diff] [blame] | 319 | char *p2p_ifname; |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 320 | |
| 321 | int client_uapsd; |
| 322 | |
| 323 | char arp_ipaddr[IP_ADDR_STR_LEN]; |
| 324 | char arp_ifname[IFNAMSIZ + 1]; |
| 325 | |
| 326 | enum sta_pmf { |
| 327 | STA_PMF_DISABLED, |
| 328 | STA_PMF_OPTIONAL, |
| 329 | STA_PMF_REQUIRED |
| 330 | } sta_pmf; |
| 331 | |
| 332 | int no_tpk_expiration; |
| 333 | |
| 334 | int er_oper_performed; |
| 335 | char er_oper_bssid[20]; |
| 336 | int amsdu_size; |
| 337 | int back_rcv_buf; |
| 338 | |
| 339 | int testbed_flag_txsp; |
| 340 | int testbed_flag_rxsp; |
| 341 | int chwidth; |
| 342 | |
| 343 | /* AP configuration */ |
| 344 | char ap_ssid[33]; |
Adil Saeed Musthafa | b7b297f | 2017-04-10 23:13:31 -0700 | [diff] [blame] | 345 | /* |
| 346 | * WLAN-TAG of 1 will use 'ap_' variables; |
| 347 | * tag higher than 1 will use 'ap_tag_' variables. |
| 348 | */ |
| 349 | char ap_tag_ssid[MAX_WLAN_TAGS - 1][33]; |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 350 | enum ap_mode { |
| 351 | AP_11a, |
| 352 | AP_11g, |
| 353 | AP_11b, |
| 354 | AP_11na, |
| 355 | AP_11ng, |
| 356 | AP_11ac, |
Alexei Avshalom Lazar | 2712cc8 | 2018-12-23 16:29:14 +0200 | [diff] [blame] | 357 | AP_11ad, |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 358 | AP_inval |
| 359 | } ap_mode; |
| 360 | int ap_channel; |
| 361 | int ap_rts; |
| 362 | int ap_frgmnt; |
| 363 | int ap_bcnint; |
| 364 | struct qos_params { |
| 365 | int ac; |
| 366 | int cwmin; |
| 367 | int cwmax; |
| 368 | int aifs; |
| 369 | int txop; |
| 370 | int acm; |
| 371 | } ap_qos[NUM_AP_AC], ap_sta_qos[NUM_AP_AC]; |
Jouni Malinen | 57fa3d8 | 2016-11-30 12:51:43 +0200 | [diff] [blame] | 372 | enum value_not_set_enabled_disabled ap_noack; |
| 373 | enum value_not_set_enabled_disabled ap_ampdu; |
| 374 | enum value_not_set_enabled_disabled ap_amsdu; |
| 375 | enum value_not_set_enabled_disabled ap_rx_amsdu; |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 376 | int ap_ampdu_exp; |
Jouni Malinen | 57fa3d8 | 2016-11-30 12:51:43 +0200 | [diff] [blame] | 377 | enum value_not_set_enabled_disabled ap_addba_reject; |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 378 | int ap_fixed_rate; |
| 379 | int ap_mcs; |
| 380 | int ap_rx_streams; |
| 381 | int ap_tx_streams; |
| 382 | unsigned int ap_vhtmcs_map; |
Jouni Malinen | 57fa3d8 | 2016-11-30 12:51:43 +0200 | [diff] [blame] | 383 | enum value_not_set_enabled_disabled ap_ldpc; |
| 384 | enum value_not_set_enabled_disabled ap_sig_rts; |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 385 | enum ap_chwidth { |
| 386 | AP_20, |
| 387 | AP_40, |
| 388 | AP_80, |
| 389 | AP_160, |
priyadharshini gowthaman | 63ab848 | 2017-12-28 15:32:55 -0800 | [diff] [blame] | 390 | AP_80_80, |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 391 | AP_AUTO |
| 392 | } ap_chwidth; |
Pradeep Reddy Potteti | bf8af29 | 2017-02-15 15:28:39 +0530 | [diff] [blame] | 393 | enum ap_chwidth default_11na_ap_chwidth; |
| 394 | enum ap_chwidth default_11ng_ap_chwidth; |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 395 | int ap_tx_stbc; |
Jouni Malinen | 57fa3d8 | 2016-11-30 12:51:43 +0200 | [diff] [blame] | 396 | enum value_not_set_enabled_disabled ap_dyn_bw_sig; |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 397 | int ap_sgi80; |
| 398 | int ap_p2p_mgmt; |
| 399 | enum ap_key_mgmt { |
| 400 | AP_OPEN, |
| 401 | AP_WPA2_PSK, |
| 402 | AP_WPA_PSK, |
| 403 | AP_WPA2_EAP, |
| 404 | AP_WPA_EAP, |
| 405 | AP_WPA2_EAP_MIXED, |
Jouni Malinen | 30824df | 2017-08-22 21:21:38 +0300 | [diff] [blame] | 406 | AP_WPA2_PSK_MIXED, |
| 407 | AP_WPA2_SAE, |
| 408 | AP_WPA2_PSK_SAE, |
Jouni Malinen | ad395a2 | 2017-09-01 21:13:46 +0300 | [diff] [blame] | 409 | AP_SUITEB, |
Jouni Malinen | 147b3c3 | 2017-10-09 16:51:54 +0300 | [diff] [blame] | 410 | AP_WPA2_OWE, |
Jouni Malinen | 4cf699f | 2018-06-19 00:46:27 +0300 | [diff] [blame] | 411 | AP_WPA2_EAP_OSEN, |
Jouni Malinen | 6be21c8 | 2018-08-01 18:47:24 +0300 | [diff] [blame] | 412 | AP_WPA2_FT_EAP, |
| 413 | AP_WPA2_FT_PSK, |
| 414 | AP_WPA2_EAP_SHA256, |
| 415 | AP_WPA2_PSK_SHA256, |
| 416 | AP_WPA2_ENT_FT_EAP, |
Jouni Malinen | c2b9121 | 2018-09-12 02:26:39 +0300 | [diff] [blame] | 417 | AP_OSEN, |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 418 | } ap_key_mgmt; |
Adil Saeed Musthafa | b7b297f | 2017-04-10 23:13:31 -0700 | [diff] [blame] | 419 | enum ap_tag_key_mgmt { |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 420 | AP2_OPEN, |
Adil Saeed Musthafa | b7b297f | 2017-04-10 23:13:31 -0700 | [diff] [blame] | 421 | AP2_OSEN, |
Jouni Malinen | 353ba8b | 2018-01-10 17:04:12 +0200 | [diff] [blame] | 422 | AP2_WPA2_PSK, |
| 423 | AP2_WPA2_OWE, |
Adil Saeed Musthafa | b7b297f | 2017-04-10 23:13:31 -0700 | [diff] [blame] | 424 | } ap_tag_key_mgmt[MAX_WLAN_TAGS - 1]; |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 425 | int ap_add_sha256; |
priyadharshini gowthaman | de81f39 | 2017-12-28 15:28:49 -0800 | [diff] [blame] | 426 | int ap_add_sha384; |
Sarvepalli, Rajesh Babu | 24dc7e4 | 2016-03-18 21:27:26 +0530 | [diff] [blame] | 427 | int ap_rsn_preauth; |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 428 | enum ap_pmf { |
| 429 | AP_PMF_DISABLED, |
| 430 | AP_PMF_OPTIONAL, |
| 431 | AP_PMF_REQUIRED |
| 432 | } ap_pmf; |
| 433 | enum ap_cipher { |
Jouni Malinen | 2ba2449 | 2017-11-17 12:43:59 +0200 | [diff] [blame] | 434 | AP_NO_GROUP_CIPHER_SET, |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 435 | AP_CCMP, |
| 436 | AP_TKIP, |
| 437 | AP_WEP, |
| 438 | AP_PLAIN, |
Jouni Malinen | ad395a2 | 2017-09-01 21:13:46 +0300 | [diff] [blame] | 439 | AP_CCMP_TKIP, |
| 440 | AP_GCMP_256, |
Jouni Malinen | 3d633da | 2017-09-14 22:19:21 +0300 | [diff] [blame] | 441 | AP_GCMP_128, |
| 442 | AP_CCMP_256, |
Jouni Malinen | d538c78 | 2017-11-17 12:13:04 +0200 | [diff] [blame] | 443 | AP_CCMP_128_GCMP_256, |
Jouni Malinen | 2ba2449 | 2017-11-17 12:43:59 +0200 | [diff] [blame] | 444 | } ap_cipher, ap_group_cipher; |
Jouni Malinen | 3d633da | 2017-09-14 22:19:21 +0300 | [diff] [blame] | 445 | enum ap_group_mgmt_cipher { |
| 446 | AP_NO_GROUP_MGMT_CIPHER_SET, |
| 447 | AP_BIP_GMAC_256, |
| 448 | AP_BIP_CMAC_256, |
| 449 | AP_BIP_GMAC_128, |
| 450 | AP_BIP_CMAC_128, |
| 451 | } ap_group_mgmt_cipher; |
Jouni Malinen | ed670f4 | 2017-08-31 01:39:28 +0300 | [diff] [blame] | 452 | char *ap_sae_groups; |
Jouni Malinen | 2f524ce | 2017-08-31 01:43:29 +0300 | [diff] [blame] | 453 | int sae_anti_clogging_threshold; |
Jouni Malinen | b347db0 | 2017-09-02 01:36:03 +0300 | [diff] [blame] | 454 | int sae_reflection; |
Jouni Malinen | 2126f42 | 2017-10-11 23:24:33 +0300 | [diff] [blame] | 455 | char ap_passphrase[101]; |
Jouni Malinen | 6337062 | 2017-11-18 17:47:13 +0200 | [diff] [blame] | 456 | char ap_psk[65]; |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 457 | char ap_wepkey[27]; |
| 458 | char ap_radius_ipaddr[20]; |
| 459 | int ap_radius_port; |
| 460 | char ap_radius_password[200]; |
| 461 | char ap2_radius_ipaddr[20]; |
| 462 | int ap2_radius_port; |
| 463 | char ap2_radius_password[200]; |
| 464 | int ap_tdls_prohibit; |
| 465 | int ap_tdls_prohibit_chswitch; |
| 466 | int ap_hs2; |
| 467 | int ap_dgaf_disable; |
| 468 | int ap_p2p_cross_connect; |
| 469 | int ap_oper_name; |
| 470 | int ap_wan_metrics; |
| 471 | int ap_conn_capab; |
| 472 | int ap_oper_class; |
| 473 | |
| 474 | int ap_interworking; |
| 475 | int ap_access_net_type; |
| 476 | int ap_internet; |
| 477 | int ap_venue_group; |
| 478 | int ap_venue_type; |
| 479 | char ap_hessid[20]; |
| 480 | char ap_roaming_cons[100]; |
| 481 | int ap_venue_name; |
| 482 | int ap_net_auth_type; |
| 483 | int ap_nai_realm_list; |
| 484 | char ap_domain_name_list[1000]; |
| 485 | int ap_ip_addr_type_avail; |
| 486 | char ap_plmn_mcc[10][4]; |
| 487 | char ap_plmn_mnc[10][4]; |
| 488 | int ap_gas_cb_delay; |
| 489 | int ap_proxy_arp; |
| 490 | int ap2_proxy_arp; |
Jouni Malinen | dbbc2c4 | 2018-11-14 23:55:41 +0200 | [diff] [blame] | 491 | int ap2_osu; |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 492 | int ap_l2tif; |
| 493 | int ap_anqpserver; |
| 494 | int ap_anqpserver_on; |
| 495 | int ap_osu_provider_list; |
Jouni Malinen | 93a837f | 2018-11-01 17:09:22 +0200 | [diff] [blame] | 496 | int ap_osu_provider_nai_list; |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 497 | int ap_qos_map_set; |
| 498 | int ap_bss_load; |
| 499 | char ap_osu_server_uri[10][256]; |
| 500 | char ap_osu_ssid[33]; |
| 501 | int ap_osu_method[10]; |
| 502 | int ap_osu_icon_tag; |
Jouni Malinen | 54a89b0 | 2018-05-01 00:16:26 +0300 | [diff] [blame] | 503 | int ap_venue_url; |
Jouni Malinen | f7ff42b | 2018-05-01 00:21:56 +0300 | [diff] [blame] | 504 | int ap_advice_of_charge; |
Jouni Malinen | ac10453 | 2018-05-01 00:27:37 +0300 | [diff] [blame] | 505 | int ap_oper_icon_metadata; |
Jouni Malinen | ac36714 | 2018-05-01 00:32:24 +0300 | [diff] [blame] | 506 | int ap_tnc_file_name; |
| 507 | unsigned int ap_tnc_time_stamp; |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 508 | |
| 509 | int ap_fake_pkhash; |
| 510 | int ap_disable_protection; |
| 511 | int ap_allow_vht_wep; |
| 512 | int ap_allow_vht_tkip; |
| 513 | |
| 514 | enum ap_vht_chwidth { |
| 515 | AP_20_40_VHT_OPER_CHWIDTH, |
| 516 | AP_80_VHT_OPER_CHWIDTH, |
| 517 | AP_160_VHT_OPER_CHWIDTH |
| 518 | } ap_vht_chwidth; |
| 519 | int ap_txBF; |
| 520 | int ap_mu_txBF; |
Pradeep Reddy POTTETI | fba27db | 2015-11-20 16:42:22 +0530 | [diff] [blame] | 521 | enum ap_regulatory_mode { |
| 522 | AP_80211D_MODE_DISABLED, |
| 523 | AP_80211D_MODE_ENABLED, |
| 524 | } ap_regulatory_mode; |
| 525 | enum ap_dfs_mode { |
| 526 | AP_DFS_MODE_DISABLED, |
| 527 | AP_DFS_MODE_ENABLED, |
| 528 | } ap_dfs_mode; |
priyadharshini gowthaman | 264d544 | 2016-02-25 15:52:22 -0800 | [diff] [blame] | 529 | int ap_ndpa_frame; |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 530 | |
priyadharshini gowthaman | 8e26ff4 | 2016-06-22 22:47:14 -0700 | [diff] [blame] | 531 | int ap_lci; |
| 532 | char ap_val_lci[33]; |
priyadharshini gowthaman | c2357bd | 2016-06-22 22:47:14 -0700 | [diff] [blame] | 533 | char ap_infoz[17]; |
priyadharshini gowthaman | 8e26ff4 | 2016-06-22 22:47:14 -0700 | [diff] [blame] | 534 | int ap_lcr; |
| 535 | char ap_val_lcr[400]; |
| 536 | int ap_rrm; |
| 537 | int ap_rtt; |
| 538 | int ap_neighap; /* number of configured neighbor APs */ |
| 539 | unsigned char ap_val_neighap[3][6]; |
| 540 | int ap_opchannel; /* number of oper channels */ |
| 541 | int ap_val_opchannel[3]; |
| 542 | int ap_scan; |
priyadharshini gowthaman | c2357bd | 2016-06-22 22:47:14 -0700 | [diff] [blame] | 543 | int ap_fqdn_held; |
| 544 | int ap_fqdn_supl; |
priyadharshini gowthaman | a27b5b6 | 2016-06-22 22:47:14 -0700 | [diff] [blame] | 545 | int ap_msnt_type; |
| 546 | |
priyadharshini gowthaman | b4e05fc | 2016-10-13 15:02:35 -0700 | [diff] [blame] | 547 | int ap_mbo; |
| 548 | int ap_ne_class; |
| 549 | int ap_ne_op_ch; |
| 550 | int ap_set_bssidpref; |
| 551 | int ap_btmreq_disassoc_imnt; |
| 552 | int ap_btmreq_term_bit; |
Adil Saeed Musthafa | 7d9ae38 | 2017-04-10 23:13:33 -0700 | [diff] [blame] | 553 | int ap_disassoc_timer; |
| 554 | int ap_btmreq_bss_term_dur; |
Adil Saeed Musthafa | 604c826 | 2017-04-10 23:13:31 -0700 | [diff] [blame] | 555 | enum reg_domain { |
| 556 | REG_DOMAIN_NOT_SET, |
| 557 | REG_DOMAIN_LOCAL, |
| 558 | REG_DOMAIN_GLOBAL |
| 559 | } ap_reg_domain; |
Adil Saeed Musthafa | cf752fa | 2017-04-10 23:13:32 -0700 | [diff] [blame] | 560 | char ap_mobility_domain[10]; |
Adil Saeed Musthafa | 023108a | 2017-04-10 23:13:37 -0700 | [diff] [blame] | 561 | unsigned char ap_cell_cap_pref; |
Adil Saeed Musthafa | 4ec61bd | 2017-04-10 23:13:41 -0700 | [diff] [blame] | 562 | int ap_ft_oa; |
| 563 | int ap_name; |
priyadharshini gowthaman | 09d613e | 2017-12-20 11:43:44 -0800 | [diff] [blame] | 564 | int ap_interface_5g; |
| 565 | int ap_interface_2g; |
priyadharshini gowthaman | 776562e | 2017-12-20 12:33:34 -0800 | [diff] [blame] | 566 | int ap_assoc_delay; |
priyadharshini gowthaman | 94062b5 | 2017-12-20 12:33:34 -0800 | [diff] [blame] | 567 | int ap_btmreq_bss_term_tsf; |
priyadharshini gowthaman | 00798a2 | 2017-12-28 15:15:00 -0800 | [diff] [blame] | 568 | int ap_fils_dscv_int; |
| 569 | int ap_nairealm_int; |
| 570 | char ap_nairealm[33]; |
| 571 | int ap_blechanutil; |
| 572 | int ap_ble_admit_cap; |
| 573 | int ap_datappdudura; |
| 574 | int ap_airtimefract; |
| 575 | char ap_dhcpserv_ipaddr[20]; |
| 576 | int ap_dhcp_stop; |
| 577 | int ap_bawinsize; |
| 578 | int ap_blestacnt; |
priyadharshini gowthaman | cb22e43 | 2017-12-28 15:23:31 -0800 | [diff] [blame] | 579 | int ap_ul_availcap; |
| 580 | int ap_dl_availcap; |
priyadharshini gowthaman | de81f39 | 2017-12-28 15:28:49 -0800 | [diff] [blame] | 581 | int ap_akm; |
| 582 | int ap_pmksa; |
| 583 | int ap_pmksa_caching; |
priyadharshini gowthaman | 63ab848 | 2017-12-28 15:32:55 -0800 | [diff] [blame] | 584 | int ap_80plus80; |
priyadharshini gowthaman | 9149afc | 2018-01-15 13:40:18 -0800 | [diff] [blame] | 585 | int ap_oper_chn; |
Adil Saeed Musthafa | 4ec61bd | 2017-04-10 23:13:41 -0700 | [diff] [blame] | 586 | |
Adil Saeed Musthafa | 6906372 | 2017-04-10 23:13:40 -0700 | [diff] [blame] | 587 | struct mbo_pref_ap mbo_pref_aps[MBO_MAX_PREF_BSSIDS]; |
| 588 | struct mbo_pref_ap mbo_self_ap_tuple; |
| 589 | int mbo_pref_ap_cnt; |
Adil Saeed Musthafa | 4ec61bd | 2017-04-10 23:13:41 -0700 | [diff] [blame] | 590 | unsigned char ft_bss_mac_list[MAX_FT_BSS_LIST][ETH_ALEN]; |
| 591 | int ft_bss_mac_cnt; |
priyadharshini gowthaman | b4e05fc | 2016-10-13 15:02:35 -0700 | [diff] [blame] | 592 | |
priyadharshini gowthaman | 00798a2 | 2017-12-28 15:15:00 -0800 | [diff] [blame] | 593 | enum value_not_set_enabled_disabled ap_oce; |
| 594 | enum value_not_set_enabled_disabled ap_filsdscv; |
| 595 | enum value_not_set_enabled_disabled ap_filshlp; |
| 596 | enum value_not_set_enabled_disabled ap_broadcast_ssid; |
| 597 | enum value_not_set_enabled_disabled ap_rnr; |
| 598 | enum value_not_set_enabled_disabled ap_esp; |
| 599 | |
priyadharshini gowthaman | 350f191 | 2018-06-04 13:09:12 -0700 | [diff] [blame] | 600 | enum ppdu { |
| 601 | PPDU_NOT_SET, |
| 602 | PPDU_MU, |
| 603 | PPDU_SU, |
| 604 | PPDU_ER, |
| 605 | PPDU_TB, |
| 606 | } ap_he_ppdu; |
| 607 | |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 608 | const char *hostapd_debug_log; |
Alexei Avshalom Lazar | 3e8267e | 2018-12-18 15:58:54 +0200 | [diff] [blame] | 609 | const char *wpa_supplicant_debug_log; |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 610 | |
| 611 | #ifdef CONFIG_TRAFFIC_AGENT |
| 612 | /* Traffic Agent */ |
| 613 | struct sigma_stream streams[MAX_SIGMA_STREAMS]; |
| 614 | int stream_id; |
| 615 | int num_streams; |
| 616 | pthread_t thr; |
| 617 | #endif /* CONFIG_TRAFFIC_AGENT */ |
| 618 | |
Jouni Malinen | c2493f8 | 2016-06-05 18:01:33 +0300 | [diff] [blame] | 619 | unsigned int throughput_pktsize; /* If non-zero, override pktsize for |
| 620 | * throughput tests */ |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 621 | int no_timestamps; |
| 622 | |
| 623 | const char *sniffer_ifname; |
| 624 | const char *set_macaddr; |
| 625 | int tmp_mac_addr; |
| 626 | int ap_is_dual; |
| 627 | enum ap_mode ap_mode_1; |
| 628 | enum ap_chwidth ap_chwidth_1; |
| 629 | int ap_channel_1; |
| 630 | char ap_countrycode[3]; |
| 631 | |
| 632 | int ap_wpsnfc; |
| 633 | |
Pradeep Reddy POTTETI | 0d3db63 | 2016-03-11 15:21:11 +0530 | [diff] [blame] | 634 | enum ap_wme { |
| 635 | AP_WME_OFF, |
| 636 | AP_WME_ON, |
| 637 | } ap_wme; |
| 638 | |
Mohammed Shafi Shajakhan | 02e3b82 | 2017-02-23 04:15:02 +0530 | [diff] [blame] | 639 | enum ap_wmmps { |
| 640 | AP_WMMPS_OFF, |
| 641 | AP_WMMPS_ON, |
| 642 | } ap_wmmps; |
| 643 | |
Pradeep Reddy Potteti | 4b0cdee | 2017-03-15 12:37:33 +0530 | [diff] [blame] | 644 | enum sec_ch_offset ap_chwidth_offset; |
| 645 | |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 646 | #ifdef CONFIG_SNIFFER |
| 647 | pid_t sniffer_pid; |
| 648 | char sniffer_filename[200]; |
| 649 | #endif /* CONFIG_SNIFFER */ |
| 650 | |
| 651 | int last_set_ip_config_ipv6; |
Amarnath Hullur Subramanyam | 9c381f5 | 2017-03-17 00:04:41 -0700 | [diff] [blame] | 652 | #ifdef MIRACAST |
| 653 | pthread_t rtsp_thread_handle; |
| 654 | int wfd_device_type; /* 0 for source, 1 for sink */ |
| 655 | char peer_mac_address[32]; |
| 656 | void *miracast_lib; |
| 657 | const char *miracast_lib_path; |
| 658 | char mdns_instance_name[64]; |
| 659 | #endif /* MIRACAST */ |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 660 | |
| 661 | int tid_to_handle[8]; /* Mapping of TID to handle */ |
| 662 | int dialog_token; /* Used for generating unique handle for an addTs */ |
| 663 | |
| 664 | enum sigma_program { |
| 665 | PROGRAM_UNKNOWN = 0, |
| 666 | PROGRAM_TDLS, |
| 667 | PROGRAM_HS2, |
| 668 | PROGRAM_HS2_R2, |
| 669 | PROGRAM_WFD, |
Amarnath Hullur Subramanyam | 659a34c | 2017-03-17 00:04:41 -0700 | [diff] [blame] | 670 | PROGRAM_DISPLAYR2, |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 671 | PROGRAM_PMF, |
| 672 | PROGRAM_WPS, |
| 673 | PROGRAM_60GHZ, |
| 674 | PROGRAM_HT, |
| 675 | PROGRAM_VHT, |
| 676 | PROGRAM_NAN, |
priyadharshini gowthaman | 12dd414 | 2016-06-22 22:47:14 -0700 | [diff] [blame] | 677 | PROGRAM_LOC, |
Adil Saeed Musthafa | 33ea287 | 2017-04-10 23:13:24 -0700 | [diff] [blame] | 678 | PROGRAM_MBO, |
Jouni Malinen | 5c3813a | 2017-08-26 13:30:39 +0300 | [diff] [blame] | 679 | PROGRAM_IOTLP, |
| 680 | PROGRAM_DPP, |
Ankita Bajaj | a2cb567 | 2017-10-25 16:08:28 +0530 | [diff] [blame] | 681 | PROGRAM_OCE, |
priyadharshini gowthaman | 0e209fc | 2018-01-26 15:15:37 -0800 | [diff] [blame] | 682 | PROGRAM_WPA3, |
Amarnath Hullur Subramanyam | 8f9c868 | 2018-01-30 19:01:51 -0800 | [diff] [blame] | 683 | PROGRAM_HE, |
Jouni Malinen | ba63045 | 2018-06-22 11:49:59 +0300 | [diff] [blame] | 684 | PROGRAM_HS2_R3, |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 685 | } program; |
| 686 | |
| 687 | enum device_type { |
| 688 | device_type_unknown, |
| 689 | AP_unknown, |
| 690 | AP_testbed, |
| 691 | AP_dut, |
| 692 | STA_unknown, |
| 693 | STA_testbed, |
| 694 | STA_dut |
| 695 | } device_type; |
| 696 | |
| 697 | enum { |
| 698 | DEVROLE_UNKNOWN = 0, |
| 699 | DEVROLE_STA, |
| 700 | DEVROLE_PCP, |
Alexei Avshalom Lazar | 2712cc8 | 2018-12-23 16:29:14 +0200 | [diff] [blame] | 701 | DEVROLE_STA_CFON, |
| 702 | DEVROLE_AP, |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 703 | } dev_role; |
| 704 | |
| 705 | const char *version; |
| 706 | int no_ip_addr_set; |
| 707 | int sta_channel; |
| 708 | |
| 709 | const char *summary_log; |
| 710 | const char *hostapd_entropy_log; |
| 711 | |
| 712 | int iface_down_on_reset; |
| 713 | int write_stats; /* traffic stream e2e*.txt files */ |
Bala Krishna Bhamidipati | 73d7af0 | 2016-03-24 12:27:56 +0530 | [diff] [blame] | 714 | int sim_no_username; /* do not set SIM username to use real SIM */ |
Jouni Malinen | 5db3b10 | 2016-08-04 12:27:18 +0300 | [diff] [blame] | 715 | |
| 716 | const char *vendor_name; /* device_get_info vendor override */ |
| 717 | const char *model_name; /* device_get_info model override */ |
| 718 | const char *version_name; /* device_get_info version override */ |
Rakesh Sunki | 7d37f41 | 2017-03-30 14:47:55 -0700 | [diff] [blame] | 719 | |
Rakesh Sunki | 14cfcd2 | 2017-03-30 14:47:55 -0700 | [diff] [blame] | 720 | int ndp_enable; /* Flag which is set once the NDP is setup */ |
| 721 | |
Peng Xu | 8863ec7 | 2018-08-06 11:50:37 -0700 | [diff] [blame] | 722 | int ndpe; /* Flag indicating NDPE is supported */ |
| 723 | u16 trans_port; /* transport port number for TCP/UDP connection */ |
| 724 | u8 trans_proto; /* transport protocol, 0x06: TCP, 0x11: UDP */ |
| 725 | |
Rakesh Sunki | 7d37f41 | 2017-03-30 14:47:55 -0700 | [diff] [blame] | 726 | /* Length of nan_pmk in octets */ |
| 727 | u8 nan_pmk_len; |
| 728 | |
| 729 | /* |
| 730 | * PMK: Info is optional in Discovery phase. PMK info can |
| 731 | * be passed during the NDP session. |
| 732 | */ |
| 733 | u8 nan_pmk[32]; |
Adil Saeed Musthafa | 33ea287 | 2017-04-10 23:13:24 -0700 | [diff] [blame] | 734 | |
| 735 | enum value_not_set_enabled_disabled wnm_bss_max_feature; |
| 736 | int wnm_bss_max_idle_time; |
| 737 | enum value_not_set_enabled_disabled wnm_bss_max_protection; |
Ashwini Patil | 0040258 | 2017-04-13 12:29:39 +0530 | [diff] [blame] | 738 | |
| 739 | char *non_pref_ch_list; /* MBO: non-preferred channel report */ |
Ashwini Patil | 5acd738 | 2017-04-13 15:55:04 +0530 | [diff] [blame] | 740 | char *btm_query_cand_list; /* Candidate list for BTM Query */ |
Jouni Malinen | 3c367e8 | 2017-06-23 17:01:47 +0300 | [diff] [blame] | 741 | |
Jouni Malinen | 6814313 | 2017-09-02 02:34:08 +0300 | [diff] [blame] | 742 | char *sae_commit_override; |
Jouni Malinen | 3c367e8 | 2017-06-23 17:01:47 +0300 | [diff] [blame] | 743 | char *rsne_override; |
Jouni Malinen | d6bf1b4 | 2017-06-23 17:51:01 +0300 | [diff] [blame] | 744 | const char *hostapd_bin; |
| 745 | int use_hostapd_pid_file; |
| 746 | const char *hostapd_ifname; |
Jouni Malinen | d86e582 | 2017-08-29 03:55:32 +0300 | [diff] [blame] | 747 | int hostapd_running; |
| 748 | |
Jouni Malinen | b1dd21f | 2017-11-13 19:14:29 +0200 | [diff] [blame] | 749 | char *dpp_peer_uri; |
Jouni Malinen | d86e582 | 2017-08-29 03:55:32 +0300 | [diff] [blame] | 750 | int dpp_local_bootstrap; |
| 751 | int dpp_conf_id; |
Ankita Bajaj | 1bde794 | 2018-01-09 19:15:01 +0530 | [diff] [blame] | 752 | |
| 753 | u8 fils_hlp; |
| 754 | pthread_t hlp_thread; |
Peng Xu | 291d97d | 2018-01-31 16:34:03 -0800 | [diff] [blame] | 755 | |
| 756 | #ifdef NL80211_SUPPORT |
| 757 | struct nl80211_ctx *nl_ctx; |
Sunil Dutt | 076081f | 2018-02-05 19:45:50 +0530 | [diff] [blame] | 758 | int config_rsnie; |
Peng Xu | 291d97d | 2018-01-31 16:34:03 -0800 | [diff] [blame] | 759 | #endif /* NL80211_SUPPORT */ |
Arif Hussain | ac6c511 | 2018-05-25 17:34:00 -0700 | [diff] [blame] | 760 | |
| 761 | int sta_nss; |
Anurag Das | 2052daa | 2018-08-31 14:35:25 +0530 | [diff] [blame] | 762 | |
| 763 | #ifdef ANDROID |
| 764 | int nanservicediscoveryinprogress; |
| 765 | #endif /* ANDROID */ |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 766 | }; |
| 767 | |
| 768 | |
| 769 | enum sigma_dut_print_level { |
| 770 | DUT_MSG_DEBUG, DUT_MSG_INFO, DUT_MSG_ERROR |
| 771 | }; |
| 772 | |
| 773 | void sigma_dut_print(struct sigma_dut *dut, int level, const char *fmt, ...) |
| 774 | PRINTF_FORMAT(3, 4); |
| 775 | |
| 776 | void sigma_dut_summary(struct sigma_dut *dut, const char *fmt, ...) |
| 777 | PRINTF_FORMAT(2, 3); |
| 778 | |
| 779 | |
| 780 | enum sigma_status { |
| 781 | SIGMA_RUNNING, SIGMA_INVALID, SIGMA_ERROR, SIGMA_COMPLETE |
| 782 | }; |
| 783 | |
| 784 | void send_resp(struct sigma_dut *dut, struct sigma_conn *conn, |
Jouni Malinen | 76401f5 | 2017-03-18 01:04:55 +0200 | [diff] [blame] | 785 | enum sigma_status status, const char *buf); |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 786 | |
| 787 | const char * get_param(struct sigma_cmd *cmd, const char *name); |
| 788 | |
| 789 | int sigma_dut_reg_cmd(const char *cmd, |
| 790 | int (*validate)(struct sigma_cmd *cmd), |
| 791 | int (*process)(struct sigma_dut *dut, |
| 792 | struct sigma_conn *conn, |
| 793 | struct sigma_cmd *cmd)); |
| 794 | |
| 795 | void sigma_dut_register_cmds(void); |
| 796 | |
| 797 | int cmd_sta_send_frame(struct sigma_dut *dut, struct sigma_conn *conn, |
| 798 | struct sigma_cmd *cmd); |
| 799 | int cmd_sta_set_parameter(struct sigma_dut *dut, struct sigma_conn *conn, |
| 800 | struct sigma_cmd *cmd); |
| 801 | int cmd_ap_send_frame(struct sigma_dut *dut, struct sigma_conn *conn, |
| 802 | struct sigma_cmd *cmd); |
| 803 | int cmd_wlantest_send_frame(struct sigma_dut *dut, struct sigma_conn *conn, |
| 804 | struct sigma_cmd *cmd); |
Ankita Bajaj | 0d5825b | 2017-10-25 16:20:17 +0530 | [diff] [blame] | 805 | int sta_cfon_set_wireless(struct sigma_dut *dut, struct sigma_conn *conn, |
| 806 | struct sigma_cmd *cmd); |
| 807 | int sta_cfon_get_mac_address(struct sigma_dut *dut, struct sigma_conn *conn, |
| 808 | struct sigma_cmd *cmd); |
| 809 | int sta_cfon_reset_default(struct sigma_dut *dut, struct sigma_conn *conn, |
| 810 | struct sigma_cmd *cmd); |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 811 | |
| 812 | enum driver_type { |
| 813 | DRIVER_NOT_SET, |
| 814 | DRIVER_ATHEROS, |
| 815 | DRIVER_WCN, |
| 816 | DRIVER_MAC80211, |
| 817 | DRIVER_AR6003, |
| 818 | DRIVER_WIL6210, |
| 819 | DRIVER_QNXNTO, |
Sreelakshmi Konamki | b692f10 | 2016-04-26 19:47:00 +0530 | [diff] [blame] | 820 | DRIVER_OPENWRT, |
| 821 | DRIVER_LINUX_WCN, |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 822 | }; |
| 823 | |
| 824 | enum openwrt_driver_type { |
| 825 | OPENWRT_DRIVER_NOT_SET, |
| 826 | OPENWRT_DRIVER_ATHEROS |
| 827 | }; |
| 828 | |
| 829 | #define DRIVER_NAME_60G "wil6210" |
| 830 | |
| 831 | int set_wifi_chip(const char *chip_type); |
| 832 | enum driver_type get_driver_type(void); |
| 833 | enum openwrt_driver_type get_openwrt_driver_type(void); |
| 834 | int file_exists(const char *fname); |
| 835 | |
| 836 | struct wpa_ctrl; |
| 837 | |
| 838 | int wps_connection_event(struct sigma_dut *dut, struct sigma_conn *conn, |
| 839 | struct wpa_ctrl *ctrl, const char *intf, int p2p_resp); |
| 840 | int ascii2hexstr(const char *str, char *hex); |
| 841 | void disconnect_station(struct sigma_dut *dut); |
| 842 | void nfc_status(struct sigma_dut *dut, const char *state, const char *oper); |
| 843 | int get_ip_config(struct sigma_dut *dut, const char *ifname, char *buf, |
| 844 | size_t buf_len); |
| 845 | int ath6kl_client_uapsd(struct sigma_dut *dut, const char *intf, int uapsd); |
| 846 | int is_ip_addr(const char *str); |
| 847 | int run_system(struct sigma_dut *dut, const char *cmd); |
Adil Saeed Musthafa | 5f793f0 | 2017-04-10 23:13:30 -0700 | [diff] [blame] | 848 | int run_system_wrapper(struct sigma_dut *dut, const char *cmd, ...); |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 849 | int cmd_wlantest_set_channel(struct sigma_dut *dut, struct sigma_conn *conn, |
| 850 | struct sigma_cmd *cmd); |
| 851 | void sniffer_close(struct sigma_dut *dut); |
| 852 | |
| 853 | /* ap.c */ |
| 854 | void ath_disable_txbf(struct sigma_dut *dut, const char *intf); |
Priyadharshini Gowthaman | 818afef | 2015-11-09 13:28:15 -0800 | [diff] [blame] | 855 | void ath_config_dyn_bw_sig(struct sigma_dut *dut, const char *ifname, |
| 856 | const char *val); |
priyadharshini gowthaman | e5e2517 | 2015-12-08 14:53:48 -0800 | [diff] [blame] | 857 | void novap_reset(struct sigma_dut *dut, const char *ifname); |
Jouni Malinen | 2e6ccc2 | 2017-09-04 13:43:16 +0300 | [diff] [blame] | 858 | int get_hwaddr(const char *ifname, unsigned char *hwaddr); |
Jouni Malinen | a326d7b | 2017-09-04 13:46:02 +0300 | [diff] [blame] | 859 | int cmd_ap_config_commit(struct sigma_dut *dut, struct sigma_conn *conn, |
| 860 | struct sigma_cmd *cmd); |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 861 | |
| 862 | /* sta.c */ |
| 863 | int set_ps(const char *intf, struct sigma_dut *dut, int enabled); |
| 864 | void ath_set_zero_crc(struct sigma_dut *dut, const char *val); |
| 865 | void ath_set_cts_width(struct sigma_dut *dut, const char *ifname, |
| 866 | const char *val); |
| 867 | int ath_set_width(struct sigma_dut *dut, struct sigma_conn *conn, |
| 868 | const char *intf, const char *val); |
Lior David | 0fe101e | 2017-03-09 16:09:50 +0200 | [diff] [blame] | 869 | int wil6210_send_frame_60g(struct sigma_dut *dut, struct sigma_conn *conn, |
| 870 | struct sigma_cmd *cmd); |
Ankita Bajaj | 1bde794 | 2018-01-09 19:15:01 +0530 | [diff] [blame] | 871 | int hwaddr_aton(const char *txt, unsigned char *addr); |
| 872 | int set_ipv4_addr(struct sigma_dut *dut, const char *ifname, |
| 873 | const char *ip, const char *mask); |
| 874 | int set_ipv4_gw(struct sigma_dut *dut, const char *gw); |
Alexei Avshalom Lazar | 79fa3fe | 2018-12-24 15:43:33 +0200 | [diff] [blame] | 875 | int send_addba_60g(struct sigma_dut *dut, struct sigma_conn *conn, |
| 876 | struct sigma_cmd *cmd, const char *param); |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 877 | |
| 878 | /* p2p.c */ |
| 879 | int p2p_cmd_sta_get_parameter(struct sigma_dut *dut, struct sigma_conn *conn, |
| 880 | struct sigma_cmd *cmd); |
Purushottam Kushwaha | 091e253 | 2016-08-23 11:52:21 +0530 | [diff] [blame] | 881 | void p2p_create_event_thread(struct sigma_dut *dut); |
| 882 | void stop_event_thread(void); |
Amarnath Hullur Subramanyam | 89b37cd | 2017-03-17 00:04:41 -0700 | [diff] [blame] | 883 | void start_dhcp(struct sigma_dut *dut, const char *group_ifname, int go); |
| 884 | void stop_dhcp(struct sigma_dut *dut, const char *group_ifname, int go); |
| 885 | int p2p_discover_peer(struct sigma_dut *dut, const char *ifname, |
| 886 | const char *peer, int full); |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 887 | |
Jouni Malinen | c54710d | 2019-01-23 12:34:21 +0200 | [diff] [blame] | 888 | /* basic.c */ |
| 889 | void get_ver(const char *cmd, char *buf, size_t buflen); |
| 890 | |
priyadharshini gowthaman | 72462ef | 2016-06-22 22:47:14 -0700 | [diff] [blame] | 891 | /* utils.c */ |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 892 | enum sigma_program sigma_program_to_enum(const char *prog); |
Jouni Malinen | 08cf231 | 2017-09-04 13:39:47 +0300 | [diff] [blame] | 893 | int parse_hexstr(const char *hex, unsigned char *buf, size_t buflen); |
priyadharshini gowthaman | 72462ef | 2016-06-22 22:47:14 -0700 | [diff] [blame] | 894 | int parse_mac_address(struct sigma_dut *dut, const char *arg, |
| 895 | unsigned char *addr); |
Alexei Avshalom Lazar | 093569f | 2018-11-13 14:08:17 +0200 | [diff] [blame] | 896 | int is_60g_sigma_dut(struct sigma_dut *dut); |
| 897 | unsigned int channel_to_freq(struct sigma_dut *dut, unsigned int channel); |
Rakesh Sunki | 7192dc4 | 2017-03-30 14:47:55 -0700 | [diff] [blame] | 898 | unsigned int freq_to_channel(unsigned int freq); |
Peng Xu | 525965b | 2018-06-26 16:40:14 -0700 | [diff] [blame] | 899 | int is_ipv6_addr(const char *str); |
Rakesh Sunki | 8f8e74b | 2017-05-16 15:42:12 -0700 | [diff] [blame] | 900 | void convert_mac_addr_to_ipv6_lladdr(u8 *mac_addr, char *ipv6_buf, |
| 901 | size_t buf_len); |
Peng Xu | 8863ec7 | 2018-08-06 11:50:37 -0700 | [diff] [blame] | 902 | size_t convert_mac_addr_to_ipv6_linklocal(const u8 *mac_addr, u8 *ipv6); |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 903 | |
Peng Xu | 769731a | 2017-05-10 17:27:28 -0700 | [diff] [blame] | 904 | #ifndef ANDROID |
| 905 | size_t strlcpy(char *dest, const char *src, size_t siz); |
| 906 | size_t strlcat(char *dst, const char *str, size_t size); |
| 907 | #endif /* ANDROID */ |
Ankita Bajaj | 1bde794 | 2018-01-09 19:15:01 +0530 | [diff] [blame] | 908 | void hex_dump(struct sigma_dut *dut, u8 *data, size_t len); |
Alexei Avshalom Lazar | 6427969 | 2018-12-23 16:49:49 +0200 | [diff] [blame] | 909 | void str_remove_chars(char *str, char ch); |
Peng Xu | 769731a | 2017-05-10 17:27:28 -0700 | [diff] [blame] | 910 | |
| 911 | |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 912 | /* uapsd_stream.c */ |
| 913 | void receive_uapsd(struct sigma_stream *s); |
Pradeep Reddy POTTETI | 7959404 | 2015-11-23 12:59:12 +0530 | [diff] [blame] | 914 | void send_uapsd_console(struct sigma_stream *s); |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 915 | |
| 916 | /* nan.c */ |
| 917 | int nan_preset_testparameters(struct sigma_dut *dut, struct sigma_conn *conn, |
| 918 | struct sigma_cmd *cmd); |
| 919 | int nan_cmd_sta_get_parameter(struct sigma_dut *dut, struct sigma_conn *conn, |
| 920 | struct sigma_cmd *cmd); |
| 921 | int nan_cmd_sta_exec_action(struct sigma_dut *dut, struct sigma_conn *conn, |
| 922 | struct sigma_cmd *cmd); |
| 923 | int nan_cmd_sta_get_events(struct sigma_dut *dut, struct sigma_conn *conn, |
| 924 | struct sigma_cmd *cmd); |
| 925 | int nan_cmd_sta_transmit_followup(struct sigma_dut *dut, |
| 926 | struct sigma_conn *conn, |
| 927 | struct sigma_cmd *cmd); |
| 928 | void nan_cmd_sta_reset_default(struct sigma_dut *dut, struct sigma_conn *conn, |
| 929 | struct sigma_cmd *cmd); |
| 930 | int nan_cmd_sta_preset_testparameters(struct sigma_dut *dut, |
| 931 | struct sigma_conn *conn, |
| 932 | struct sigma_cmd *cmd); |
| 933 | |
priyadharshini gowthaman | d66913a | 2016-07-29 15:11:17 -0700 | [diff] [blame] | 934 | /* ftm.c */ |
| 935 | int loc_cmd_sta_exec_action(struct sigma_dut *dut, struct sigma_conn *conn, |
| 936 | struct sigma_cmd *cmd); |
| 937 | int loc_cmd_sta_send_frame(struct sigma_dut *dut, struct sigma_conn *conn, |
| 938 | struct sigma_cmd *cmd); |
| 939 | int loc_cmd_sta_preset_testparameters(struct sigma_dut *dut, |
| 940 | struct sigma_conn *conn, |
| 941 | struct sigma_cmd *cmd); |
| 942 | |
Jouni Malinen | d86e582 | 2017-08-29 03:55:32 +0300 | [diff] [blame] | 943 | /* dpp.c */ |
| 944 | int dpp_dev_exec_action(struct sigma_dut *dut, struct sigma_conn *conn, |
| 945 | struct sigma_cmd *cmd); |
| 946 | |
Ankita Bajaj | 1bde794 | 2018-01-09 19:15:01 +0530 | [diff] [blame] | 947 | /* dhcp.c */ |
| 948 | void process_fils_hlp(struct sigma_dut *dut); |
| 949 | void hlp_thread_cleanup(struct sigma_dut *dut); |
Jouni Malinen | d86e582 | 2017-08-29 03:55:32 +0300 | [diff] [blame] | 950 | |
Peng Xu | 291d97d | 2018-01-31 16:34:03 -0800 | [diff] [blame] | 951 | #ifdef NL80211_SUPPORT |
| 952 | struct nl80211_ctx * nl80211_init(struct sigma_dut *dut); |
| 953 | void nl80211_deinit(struct sigma_dut *dut, struct nl80211_ctx *ctx); |
| 954 | struct nl_msg * nl80211_drv_msg(struct sigma_dut *dut, struct nl80211_ctx *ctx, |
| 955 | int ifindex, int flags, |
| 956 | uint8_t cmd); |
| 957 | int send_and_recv_msgs(struct sigma_dut *dut, struct nl80211_ctx *ctx, |
| 958 | struct nl_msg *nlmsg, |
| 959 | int (*valid_handler)(struct nl_msg *, void *), |
| 960 | void *valid_data); |
| 961 | #endif /* NL80211_SUPPORT */ |
| 962 | |
Jouni Malinen | cd4e3c3 | 2015-10-29 12:39:56 +0200 | [diff] [blame] | 963 | #endif /* SIGMA_DUT_H */ |