Files
utun2/src/broadcast.h
T
evgeny b2e4aadbf0 e2e: AES-128-CCM encryption via BGP router (ROUTER_FLAG_ENCRYPTED), ECDH key per peer-pair from NODEINFO pubkeys, cache 8 entries
- etcp_router.h/c: new flag ROUTER_FLAG_ENCRYPTED (0x04), etcp_route_send_encrypted(), inflight/retrans/send_q support
- utun_instance.h: e2e_ctx_cache[8] — per-peer sc_context_t cache with derived session key
- topo_node.c: topo_node_sign_self() — single point for Ed25519 self-signing of NODEINFO
- topo_node.c: fix stale x25519_self_sig after address update (topo_node_sign_self call)
- nat_detection.c: fix stale x25519_self_sig after in-place socket meta modification
- test_etcp_router_unit: 5 E2E tests (basic round-trip, no NODEINFO drop, tampered, cache reuse, ENCRYPTED+SIGNED combined)
- builds clean, 70/70 tests pass
2026-08-09 08:19:20 +03:00

42 lines
1.1 KiB
C

#ifndef BROADCAST_H
#define BROADCAST_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <stddef.h>
struct TOPO_GROUP;
struct UTUN_INSTANCE;
#define BROADCAST_MAX_DATA 1600
#define BROADCAST_UUID_SIZE 16
#define BROADCAST_CLEANUP_INTERVAL_TB 600000 // 1 минута
#define BROADCAST_TTL_TB 1200000 // 2 минуты
typedef void (*broadcast_recv_fn)(const uint8_t* uuid, const uint8_t* data, uint16_t data_len, void* arg);
struct broadcast_cbk_entry {
broadcast_recv_fn fn;
void* arg;
struct broadcast_cbk_entry* next;
};
struct broadcast_ctx;
int broadcast_init(struct TOPO_GROUP* group);
void broadcast_destroy(struct TOPO_GROUP* group);
int broadcast_send(struct TOPO_GROUP* group, const uint8_t* data, uint16_t data_len);
void broadcast_add_cbk(struct TOPO_GROUP* group, broadcast_recv_fn fn, void* arg);
void broadcast_remove_cbk(struct TOPO_GROUP* group, broadcast_recv_fn fn, void* arg);
int broadcast_init_instance(struct UTUN_INSTANCE* instance);
void broadcast_destroy_instance(struct UTUN_INSTANCE* instance);
#ifdef __cplusplus
}
#endif
#endif