benchmark_udp.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2021 ML!PA Consulting GmbH
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
6 #pragma once
7 
19 #include <stdbool.h>
20 #include <stdint.h>
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
29 #ifndef BENCH_PAYLOAD_SIZE_MAX
30 #define BENCH_PAYLOAD_SIZE_MAX (1024)
31 #endif
32 
36 #ifndef BENCH_SERVER_DEFAULT
37 #define BENCH_SERVER_DEFAULT "fd00:dead:beef::1"
38 #endif
39 
43 #ifndef BENCH_PORT_DEFAULT
44 #define BENCH_PORT_DEFAULT (12345)
45 #endif
46 
50 #define BENCH_FLAG_CMD_PKT (1 << 0)
51 
55 #define BENCH_MASK_COOKIE (0xFFFFFF00)
56 
62 typedef struct {
63  uint32_t flags;
64  uint32_t seq_no;
65  uint32_t replies;
66  uint32_t rtt_last;
67  uint8_t payload[];
76 typedef struct {
77  uint32_t flags;
78  uint32_t delay_us;
79  uint16_t payload_len;
94 int benchmark_udp_start(const char *server, uint16_t port);
95 
103 
104 #ifdef __cplusplus
105 }
106 #endif
107 
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:76
uint32_t delay_us
delay between benchmark messages in µs
Definition: benchmark_udp.h:78
uint16_t payload_len
payload of benchmark messages
Definition: benchmark_udp.h:79
uint32_t flags
contains new config cookie
Definition: benchmark_udp.h:77
Benchmark message to the server.
Definition: benchmark_udp.h:62
uint32_t replies
number of replies received from server
Definition: benchmark_udp.h:65
uint32_t seq_no
number of packets sent sind config update
Definition: benchmark_udp.h:64
uint32_t flags
must include config cookie
Definition: benchmark_udp.h:63
uint32_t rtt_last
round trip time of the last packet
Definition: benchmark_udp.h:66