/* * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 *//* ... */#pragmaonce#include<sys/socket.h>#include"esp_err.h"#include"esp_types.h"#ifdef__cplusplusextern"C"{#endif/* * There's no CONFIG_LWIP_IPV4 in idf<5.1 * use LWIP_IPV4 from lwipopts.h (sys/socket.h) * LWIP_IPV4 should always be defined (0/1). *//* ... */#ifndefLWIP_IPV4#error"LWIP_IPV4 should be defined from lwipopts.h (sys/socket.h)."#endif/* * We only use lwip stack for now, but we may support different IP stack in the future. *//* ... */#defineIPERF_IPV4_ENABLEDLWIP_IPV4#defineIPERF_IPV6_ENABLEDLWIP_IPV6#defineIPERF_IP_TYPE_IPV40#defineIPERF_IP_TYPE_IPV61#defineIPERF_TRANS_TYPE_TCP0#defineIPERF_TRANS_TYPE_UDP1#defineIPERF_FLAG_SET(cfg,flag)((cfg)|=(flag))#defineIPERF_FLAG_CLR(cfg,flag)((cfg)&=(~(flag)))#defineIPERF_FLAG_CLIENT(1)#defineIPERF_FLAG_SERVER(1<<1)#defineIPERF_FLAG_TCP(1<<2)#defineIPERF_FLAG_UDP(1<<3)#defineIPERF_DEFAULT_PORT5001#defineIPERF_DEFAULT_INTERVAL3#defineIPERF_DEFAULT_TIME30#defineIPERF_DEFAULT_NO_BW_LIMIT-1#defineIPERF_TRAFFIC_TASK_NAME"iperf_traffic"#defineIPERF_TRAFFIC_TASK_PRIORITYCONFIG_IPERF_TRAFFIC_TASK_PRIORITY#defineIPERF_TRAFFIC_TASK_STACK4096#defineIPERF_REPORT_TASK_NAME"iperf_report"#defineIPERF_REPORT_TASK_PRIORITYCONFIG_IPERF_REPORT_TASK_PRIORITY#defineIPERF_REPORT_TASK_STACK4096#defineIPERF_DEFAULT_IPV4_UDP_TX_LENCONFIG_IPERF_DEF_IPV4_UDP_TX_BUFFER_LEN#defineIPERF_DEFAULT_IPV6_UDP_TX_LENCONFIG_IPERF_DEF_IPV6_UDP_TX_BUFFER_LEN#defineIPERF_DEFAULT_UDP_RX_LENCONFIG_IPERF_DEF_UDP_RX_BUFFER_LEN// TODO: change default value on v1.0, 16 << 10 may be too big for some sdk with small RAM#defineIPERF_DEFAULT_TCP_TX_LENCONFIG_IPERF_DEF_TCP_TX_BUFFER_LEN#defineIPERF_DEFAULT_TCP_RX_LENCONFIG_IPERF_DEF_TCP_RX_BUFFER_LEN#defineIPERF_MAX_DELAY64#defineIPERF_SOCKET_RX_TIMEOUTCONFIG_IPERF_SOCKET_RX_TIMEOUT#defineIPERF_SOCKET_TCP_TX_TIMEOUTCONFIG_IPERF_SOCKET_TCP_TX_TIMEOUT#defineIPERF_SOCKET_ACCEPT_TIMEOUT531 defines/** * @brief Iperf output report format *//* ... */typedefenum{MBITS_PER_SEC,KBITS_PER_SEC,}{ ... }iperf_output_format_t;/** * @brief Iperf Configuration *//* ... */typedefstruct{uint32_tflag;/**< iperf flag */union{uint32_tdestination_ip4;/**< destination ipv4 */char*destination_ip6;/**< destination ipv6 */}{ ... };union{uint32_tsource_ip4;/**< source ipv4 */char*source_ip6;/**< source ipv6 */}{ ... };uint8_ttype;/**< address type, ipv4 or ipv6 */iperf_output_format_tformat;/**< output format, K(bits/s), M(bits/s) */uint16_tdport;/**< destination port */uint16_tsport;/**< source port */uint32_tinterval;/**< report interval in secs */uint32_ttime;/**< total send time in secs */uint16_tlen_send_buf;/**< send buffer length in bytes */int32_tbw_lim;/**< bandwidth limit in Mbits/s */}{ ... }iperf_cfg_t;/** * @brief Iperf traffic type *//* ... */typedefenum{IPERF_TCP_SERVER,IPERF_TCP_CLIENT,IPERF_UDP_SERVER,IPERF_UDP_CLIENT,}{ ... }iperf_traffic_type_t;/** * @brief Iperf status *//* ... */typedefenum{IPERF_STARTED,IPERF_STOPPED,}{ ... }iperf_status_t;externboolg_iperf_is_running;/** * @brief Iperf traffic start with given config * * @param[in] cfg pointer to traffic config structure * * @return ESP_OK on success *//* ... */esp_err_tiperf_start(iperf_cfg_t*cfg);/** * @brief Iperf traffic stop * * @return ESP_OK on success *//* ... */esp_err_tiperf_stop(void);/* Support hook functions for performance debug */typedefvoid(*iperf_hook_func_t)(iperf_traffic_type_ttype,iperf_status_tstatus);externiperf_hook_func_tiperf_hook_func;/** * @brief Registers iperf traffic start/stop hook function *//* ... */voidiperf_register_hook_func(iperf_hook_func_tfunc);/* TODO: deprecate app_xxx in v0.2, remove them in v1.0 */#defineapp_register_iperf_hook_funciperf_register_hook_func#ifdef__cplusplus}{...}#endif
Details
Show: from
Types: Columns:
All items filtered out
All items filtered out
This file uses the notable symbols shown below. Click anywhere in the file to view more details.