mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-upf.git
synced 2025-10-23 08:12:03 +00:00
Freely copying from gtp-load-gen.c, implement GTP flooding in osmo-pfcp-tool scripts. Add dependency liburing. It can be disabled with configure --disable-uring in which case the new 'gtp flood' command only logs an error. This verbosely commented example script serves as a good explanation: contrib/osmo-pfcp-tool-scripts/gtp_flood.vty Related: SYS#6590 Change-Id: I332aa0e2efd55f6e357cde4752a3d8b584db531b
39 lines
1.0 KiB
C
39 lines
1.0 KiB
C
#pragma once
|
|
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
#include <stdbool.h>
|
|
|
|
struct osmo_sockaddr;
|
|
|
|
/* A value large enough for an IPv6 address (128bit) */
|
|
struct range_val {
|
|
uint64_t buf[2];
|
|
size_t size;
|
|
};
|
|
|
|
/* Manage stepping through a defined range of values large enough to handle IPv6 addresses. */
|
|
struct range {
|
|
struct range_val first;
|
|
struct range_val last;
|
|
struct range_val next;
|
|
bool wrapped;
|
|
};
|
|
|
|
/* struct range r = {};
|
|
* range_val_set_int(&r.first, 23);
|
|
* range_val_set_int(&r.last, 42);
|
|
* while (1) {
|
|
* range_next();
|
|
* unsigned int val = range_val_get_int(&r.next);
|
|
* printf("%u\n", val);
|
|
* }
|
|
*/
|
|
void range_next(struct range *r);
|
|
void range_val_set_int(struct range_val *rv, uint32_t val);
|
|
uint32_t range_val_get_int(const struct range_val *rv);
|
|
void range_val_set_addr(struct range_val *rv, const struct osmo_sockaddr *val);
|
|
void range_val_get_addr(struct osmo_sockaddr *dst, const struct range_val *rv);
|
|
void range_val_inc(struct range_val *rv);
|
|
int range_val_cmp(const struct range_val *a, const struct range_val *b);
|