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 
9 #pragma once
10 
22 #include <stdbool.h>
23 #include <stdint.h>
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
32 #ifndef BENCH_PAYLOAD_SIZE_MAX
33 #define BENCH_PAYLOAD_SIZE_MAX (1024)
34 #endif
35 
39 #ifndef BENCH_SERVER_DEFAULT
40 #define BENCH_SERVER_DEFAULT "fd00:dead:beef::1"
41 #endif
42 
46 #ifndef BENCH_PORT_DEFAULT
47 #define BENCH_PORT_DEFAULT (12345)
48 #endif
49 
53 #define BENCH_FLAG_CMD_PKT (1 << 0)
54 
58 #define BENCH_MASK_COOKIE (0xFFFFFF00)
59 
65 typedef struct {
66  uint32_t flags;
67  uint32_t seq_no;
68  uint32_t replies;
69  uint32_t rtt_last;
70  uint8_t payload[];
79 typedef struct {
80  uint32_t flags;
81  uint32_t delay_us;
82  uint16_t payload_len;
97 int benchmark_udp_start(const char *server, uint16_t port);
98 
106 
107 #ifdef __cplusplus
108 }
109 #endif
110 
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:79
uint32_t delay_us
delay between benchmark messages in µs
Definition: benchmark_udp.h:81
uint16_t payload_len
payload of benchmark messages
Definition: benchmark_udp.h:82
uint32_t flags
contains new config cookie
Definition: benchmark_udp.h:80
Benchmark message to the server.
Definition: benchmark_udp.h:65
uint32_t replies
number of replies received from server
Definition: benchmark_udp.h:68
uint32_t seq_no
number of packets sent sind config update
Definition: benchmark_udp.h:67
uint32_t flags
must include config cookie
Definition: benchmark_udp.h:66
uint32_t rtt_last
round trip time of the last packet
Definition: benchmark_udp.h:69