Zephyr API Documentation  3.6.99
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
17#ifndef ZEPHYR_INCLUDE_NET_ZPERF_H_
18#define ZEPHYR_INCLUDE_NET_ZPERF_H_
19
20#include <zephyr/net/net_ip.h>
21#include <zephyr/net/socket.h>
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
29enum zperf_status {
30 ZPERF_SESSION_STARTED,
31 ZPERF_SESSION_PERIODIC_RESULT,
32 ZPERF_SESSION_FINISHED,
33 ZPERF_SESSION_ERROR
34} __packed;
35
36struct zperf_upload_params {
37 struct sockaddr peer_addr;
38 uint32_t duration_ms;
39 uint32_t rate_kbps;
40 uint16_t packet_size;
41 char if_name[IFNAMSIZ];
42 struct {
43 uint8_t tos;
44 int tcp_nodelay;
45 int priority;
46 uint32_t report_interval_ms;
47 } options;
48};
49
50struct zperf_download_params {
51 uint16_t port;
52 struct sockaddr addr;
53 char if_name[IFNAMSIZ];
54};
55
70};
71
79typedef void (*zperf_callback)(enum zperf_status status,
80 struct zperf_results *result,
81 void *user_data);
82
92int zperf_udp_upload(const struct zperf_upload_params *param,
93 struct zperf_results *result);
94
104int zperf_tcp_upload(const struct zperf_upload_params *param,
105 struct zperf_results *result);
106
119int zperf_udp_upload_async(const struct zperf_upload_params *param,
120 zperf_callback callback, void *user_data);
121
134int zperf_tcp_upload_async(const struct zperf_upload_params *param,
135 zperf_callback callback, void *user_data);
136
148int zperf_udp_download(const struct zperf_download_params *param,
149 zperf_callback callback, void *user_data);
150
162int zperf_tcp_download(const struct zperf_download_params *param,
163 zperf_callback callback, void *user_data);
164
171
178
179#ifdef __cplusplus
180}
181#endif
182
187#endif /* ZEPHYR_INCLUDE_NET_ZPERF_H_ */
#define IFNAMSIZ
Network interface name length.
Definition: socket.h:1101
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:79
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:385
Performance results.
Definition: zperf.h:59
uint64_t total_len
Total length of the transferred data.
Definition: zperf.h:64
uint64_t client_time_in_us
Client connection time in microseconds.
Definition: zperf.h:67
uint32_t nb_packets_errors
Number of packet errors.
Definition: zperf.h:69
uint32_t packet_size
Packet size.
Definition: zperf.h:68
uint32_t nb_packets_outorder
Number of packets out of order.
Definition: zperf.h:63
uint64_t time_in_us
Total time of the transfer in microseconds.
Definition: zperf.h:65
uint32_t nb_packets_lost
Number of packets lost.
Definition: zperf.h:62
uint32_t nb_packets_rcvd
Number of packets received.
Definition: zperf.h:61
uint32_t nb_packets_sent
Number of packets sent.
Definition: zperf.h:60
uint32_t jitter_in_us
Jitter in microseconds.
Definition: zperf.h:66