benchmark_udp.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 ML!PA Consulting GmbH
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
20 #ifndef TEST_UTILS_BENCHMARK_UDP_H
21 #define TEST_UTILS_BENCHMARK_UDP_H
22 
23 #include <stdbool.h>
24 #include <stdint.h>
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
33 #ifndef BENCH_PAYLOAD_SIZE_MAX
34 #define BENCH_PAYLOAD_SIZE_MAX (1024)
35 #endif
36 
40 #ifndef BENCH_SERVER_DEFAULT
41 #define BENCH_SERVER_DEFAULT "fd00:dead:beef::1"
42 #endif
43 
47 #ifndef BENCH_PORT_DEFAULT
48 #define BENCH_PORT_DEFAULT (12345)
49 #endif
50 
54 #define BENCH_FLAG_CMD_PKT (1 << 0)
55 
59 #define BENCH_MASK_COOKIE (0xFFFFFF00)
60 
66 typedef struct {
67  uint32_t flags;
68  uint32_t seq_no;
69  uint32_t replies;
70  uint32_t rtt_last;
71  uint8_t payload[];
80 typedef struct {
81  uint32_t flags;
82  uint32_t delay_us;
83  uint16_t payload_len;
98 int benchmark_udp_start(const char *server, uint16_t port);
99 
107 
108 #ifdef __cplusplus
109 }
110 #endif
111 
112 #endif /* TEST_UTILS_BENCHMARK_UDP_H */
bool benchmark_udp_stop(void)
Stop the benchmark process.
int benchmark_udp_start(const char *server, uint16_t port)
This will start the benchmark process.
Command response from the server.
Definition: benchmark_udp.h:80
uint32_t delay_us
delay between benchmark messages in µs
Definition: benchmark_udp.h:82
uint16_t payload_len
payload of benchmark messages
Definition: benchmark_udp.h:83
uint32_t flags
contains new config cookie
Definition: benchmark_udp.h:81
Benchmark message to the server.
Definition: benchmark_udp.h:66
uint32_t replies
number of replies received from server
Definition: benchmark_udp.h:69
uint32_t seq_no
number of packets sent sind config update
Definition: benchmark_udp.h:68
uint32_t flags
must include config cookie
Definition: benchmark_udp.h:67
uint32_t rtt_last
round trip time of the last packet
Definition: benchmark_udp.h:70