- Add libutun.a (noinst) containing all src/*.c except utun.c - utun binary now links libutun.a + libuasync.a - tests/Makefile.am simplified: all tests link libutun.a instead of manual .o file lists (removed ~70 lines of boilerplate) - Add db_sync module: distributed content-addressed DB with LMDB backend, peer-to-peer sync via etcp_router (svc 0x20) - etcp API: etcp_send_in_order(), etcp_clear_inflight_queues(), verify_packet_signature(), BBR getters - BBR: adaptive threshold (1/4 of pipe-min instead of hardcoded) - route_bgp/etcp_connect: STCP transport support in NODEINFO - conn_mgr: NODEINFO_ADDRS doc for nat_type/transport/proto fields - Cleanup: removed AUDIT_FINDINGS.txt, filelist.txt, nat.txt
42 lines
1.2 KiB
C
42 lines
1.2 KiB
C
// db_sync.h — Distributed content-addressed table with LMDB storage and peer sync via etcp_router
|
|
#ifndef DB_SYNC_H
|
|
#define DB_SYNC_H
|
|
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
|
|
struct UTUN_INSTANCE;
|
|
|
|
// etcp_router service ID
|
|
#define ETCP_RT_ID_DB_SYNC 0x20
|
|
|
|
// Message types
|
|
#define DB_MSG_INIT_SYNC 0x01
|
|
#define DB_MSG_INIT_RESP 0x02
|
|
#define DB_MSG_REFINE 0x03
|
|
#define DB_MSG_SEND_DATA 0x04
|
|
#define DB_MSG_PUSH 0x05
|
|
#define DB_MSG_ACK_PUSH 0x06
|
|
#define DB_MSG_SYNC_DONE 0x07
|
|
|
|
// Defaults
|
|
#define DB_SYNC_DEFAULT_TTL 86400
|
|
#define DB_SYNC_DEFAULT_MAPSIZE (100UL * 1024 * 1024)
|
|
#define DB_SYNC_PEER_CHECK_INTERVAL 5
|
|
#define DB_SYNC_TTL_INTERVAL 3600
|
|
|
|
// Record flags
|
|
#define DB_REC_FLAG_WAS_SENT 0x01
|
|
|
|
// Sync protocol constants
|
|
#define DB_REFINE_HASHES 16
|
|
#define DB_SEND_DATA_MAX 32
|
|
|
|
int db_sync_init(struct UTUN_INSTANCE* inst);
|
|
void db_sync_destroy(struct UTUN_INSTANCE* inst);
|
|
int db_sync_insert(struct UTUN_INSTANCE* inst, const char* json_data);
|
|
int db_sync_insert_len(struct UTUN_INSTANCE* inst, const char* json_data, size_t len);
|
|
uint32_t db_sync_count(struct UTUN_INSTANCE* inst);
|
|
|
|
#endif // DB_SYNC_H
|