Loading...
Searching...
No Matches
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
21
22#include <stdbool.h>
23#include <stdint.h>
24
25#ifdef __cplusplus
26extern "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
65typedef struct {
66 uint32_t flags;
67 uint32_t seq_no;
68 uint32_t replies;
69 uint32_t rtt_last;
70 uint8_t payload[];
72
73
79typedef struct {
80 uint32_t flags;
81 uint32_t delay_us;
82 uint16_t payload_len;
84
85
97int 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.
uint32_t delay_us
delay between benchmark messages in µs
uint16_t payload_len
payload of benchmark messages
uint32_t flags
contains new config cookie
Benchmark message to the server.
uint32_t replies
number of replies received from server
uint32_t seq_no
number of packets sent sind config update
uint8_t payload[]
variable length payload
uint32_t flags
must include config cookie
uint32_t rtt_last
round trip time of the last packet