Zephyr API Documentation 4.0.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
zperf.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016 Intel Corporation
3 * Copyright (c) 2022 Nordic Semiconductor ASA
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
19#ifndef ZEPHYR_INCLUDE_NET_ZPERF_H_
20#define ZEPHYR_INCLUDE_NET_ZPERF_H_
21
22#include <zephyr/net/net_ip.h>
23#include <zephyr/net/socket.h>
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
31enum zperf_status {
32 ZPERF_SESSION_STARTED,
33 ZPERF_SESSION_PERIODIC_RESULT,
34 ZPERF_SESSION_FINISHED,
35 ZPERF_SESSION_ERROR
36} __packed;
37
38struct zperf_upload_params {
39 struct sockaddr peer_addr;
40 uint32_t duration_ms;
41 uint32_t rate_kbps;
42 uint16_t packet_size;
43 char if_name[IFNAMSIZ];
44 struct {
45 uint8_t tos;
46 int tcp_nodelay;
47 int priority;
48 uint32_t report_interval_ms;
49 } options;
50};
51
52struct zperf_download_params {
53 uint16_t port;
54 struct sockaddr addr;
55 char if_name[IFNAMSIZ];
56};
57
73
81typedef void (*zperf_callback)(enum zperf_status status,
82 struct zperf_results *result,
83 void *user_data);
84
94int zperf_udp_upload(const struct zperf_upload_params *param,
95 struct zperf_results *result);
96
106int zperf_tcp_upload(const struct zperf_upload_params *param,
107 struct zperf_results *result);
108
121int zperf_udp_upload_async(const struct zperf_upload_params *param,
122 zperf_callback callback, void *user_data);
123
136int zperf_tcp_upload_async(const struct zperf_upload_params *param,
137 zperf_callback callback, void *user_data);
138
150int zperf_udp_download(const struct zperf_download_params *param,
151 zperf_callback callback, void *user_data);
152
164int zperf_tcp_download(const struct zperf_download_params *param,
165 zperf_callback callback, void *user_data);
166
173
180
181#ifdef __cplusplus
182}
183#endif
184
189#endif /* ZEPHYR_INCLUDE_NET_ZPERF_H_ */
#define IFNAMSIZ
Network interface name length.
Definition socket.h:1051
int zperf_tcp_upload_async(const struct zperf_upload_params *param, zperf_callback callback, void *user_data)
Asynchronous TCP upload operation.
int zperf_tcp_upload(const struct zperf_upload_params *param, struct zperf_results *result)
Synchronous TCP upload operation.
int zperf_udp_download_stop(void)
Stop UDP server.
int zperf_udp_upload(const struct zperf_upload_params *param, struct zperf_results *result)
Synchronous UDP upload operation.
int zperf_tcp_download(const struct zperf_download_params *param, zperf_callback callback, void *user_data)
Start TCP server.
int zperf_udp_download(const struct zperf_download_params *param, zperf_callback callback, void *user_data)
Start UDP server.
int zperf_tcp_download_stop(void)
Stop TCP server.
int zperf_udp_upload_async(const struct zperf_upload_params *param, zperf_callback callback, void *user_data)
Asynchronous UDP upload operation.
void(* zperf_callback)(enum zperf_status status, struct zperf_results *result, void *user_data)
Zperf callback function used for asynchronous operations.
Definition zperf.h:81
BSD Sockets compatible API definitions.
IPv6 and IPv4 definitions.
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT64_TYPE__ uint64_t
Definition stdint.h:91
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Generic sockaddr struct.
Definition net_ip.h:388
Performance results.
Definition zperf.h:61
uint64_t total_len
Total length of the transferred data.
Definition zperf.h:66
uint64_t client_time_in_us
Client connection time in microseconds.
Definition zperf.h:69
uint32_t nb_packets_errors
Number of packet errors.
Definition zperf.h:71
uint32_t packet_size
Packet size.
Definition zperf.h:70
uint32_t nb_packets_outorder
Number of packets out of order.
Definition zperf.h:65
uint64_t time_in_us
Total time of the transfer in microseconds.
Definition zperf.h:67
uint32_t nb_packets_lost
Number of packets lost.
Definition zperf.h:64
uint32_t nb_packets_rcvd
Number of packets received.
Definition zperf.h:63
uint32_t nb_packets_sent
Number of packets sent.
Definition zperf.h:62
uint32_t jitter_in_us
Jitter in microseconds.
Definition zperf.h:68