#ifndef BROADCAST_H #define BROADCAST_H #ifdef __cplusplus extern "C" { #endif #include #include 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