- topo_sqlite_db moved from TOPO_GROUPS to UTUN_INSTANCE (direct access) - topo_groups_set_sqlite_db() removed - chatgui: chat_sync_connect_node → chat_core_connect_auto (direct ETCP, no conn_mgr) - chatgui: chat_core_connect_from_invite saves to SQLite → auto connect (no BGP) - chatgui: removed _on_node_updated BGP callback from member_sync - chatgui: removed conn_mgr_get_status from status dump - chatgui: removed all conn_mgr.h and topo_group.h includes - chatgui: CONN_MGR_ERR_* constants → CC_* in chat_core.h - removed unused cc_parallel_* code, conn_state_str/conn_type_str helpers
66 lines
2.1 KiB
C
66 lines
2.1 KiB
C
#ifndef CHAT_SYNC_H
|
|
#define CHAT_SYNC_H
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
|
|
struct UTUN_INSTANCE;
|
|
struct UASYNC;
|
|
|
|
/* etcp service ID (direct P2P) */
|
|
#define ETCP_RT_ID_CHAT_SYNC 0x30
|
|
#define ETCP_RT_ID_MEMBER_SYNC 0x31
|
|
|
|
/* Message types */
|
|
#define CS_MSG_INIT_SYNC 0x01
|
|
#define CS_MSG_INIT_RESP 0x02
|
|
#define CS_MSG_SEND_DATA 0x03
|
|
#define CS_MSG_PUSH 0x04
|
|
#define CS_MSG_ACK_PUSH 0x05
|
|
#define CS_MSG_SYNC_DONE 0x06
|
|
#define CS_MSG_ERROR 0x07
|
|
#define CS_MSG_CHANNEL_INFO_REQ 0x09
|
|
#define CS_MSG_CHANNEL_INFO_RESP 0x0A
|
|
#define CS_MSG_CHANNEL_JOIN 0x0B
|
|
#define CS_MSG_WELCOME 0x0C
|
|
#define CS_MSG_PEER_UPSERT 0x0D
|
|
#define CS_MSG_PEER_REMOVE 0x0E
|
|
|
|
/* Protocol constants */
|
|
#define CS_SEND_DATA_MAX 32
|
|
#define CS_MAX_SPARSE 16
|
|
#define CS_PEER_TIMEOUT_MS 5000
|
|
|
|
/* Sync states per channel */
|
|
#define CS_SYNC_NONE 0
|
|
#define CS_SYNC_IN_PROGRESS 1
|
|
#define CS_SYNC_DONE 2
|
|
|
|
/* ── Public API ── */
|
|
|
|
int chat_sync_init(struct UTUN_INSTANCE* inst,
|
|
void (*gui_result_cb)(void*, int, const uint8_t*, int));
|
|
void chat_sync_destroy(struct UTUN_INSTANCE* inst);
|
|
|
|
/* Прямое ETCP-подключение к узлу (pubkey+адреса из БД) */
|
|
void chat_sync_connect_node(struct UTUN_INSTANCE* inst, uint64_t node_id);
|
|
|
|
/* Подключиться к пиру по данным invite-ссылки (вызывается из GUI-потока) */
|
|
void chat_sync_connect_from_invite(uint64_t channel_id, uint64_t node_id,
|
|
const uint8_t* pubkey_bin,
|
|
const uint8_t* addrs_data, int addr_count);
|
|
|
|
/* Авто-подключение к узлам группы (параллельно до 10, останавливается при 3 успешных) */
|
|
void chat_sync_auto_connect_start(struct UTUN_INSTANCE* inst);
|
|
void chat_sync_auto_connect_stop(void);
|
|
void chat_sync_auto_connect_switch_group(struct UTUN_INSTANCE* inst, uint64_t new_group_id);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
#endif /* CHAT_SYNC_H */
|