dm: прямой обмен сообщениями (DM) + soundtouch + архитектура звонков
- src/dm/: dm_core/dm_crypto/dm_mailbox — прямой обмен сообщениями (DM) - lib/soundtouch-master/: vendored SoundTouch (изменение темпа/высоты аудио) - doc/dm_arch.md, doc/chat_call_arch.md: архитектура DM и звонков - tests: test_dm.c, test_dm_e2e.c - chat: рефакторинг chat_* модулей, member_sync, invite_build - chatgui/chatgui-android: синхронизация с новым API чата - lib/u_async, debug_config, utun_instance: сопутствующие изменения
This commit is contained in:
1 parent
761f64cf76
commit
73fe99b33f
123 files changed
+14095
-1270
No files matched your search
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* dm_mailbox.h — offline-хранение DM-сообщений на storage-узлах
|
||||
*
|
||||
* Когда пир недоступен (нет прямой связи), отправитель кладёт зашифрованное
|
||||
* сообщение на storage-узлы (мемберы общих групп с флагом dm_storage=yes).
|
||||
* Получатель при выходе в online вытягивает накопившуюся почту, проверяет
|
||||
* подпись, расшифровывает и вставляет в dm_messages (dedup по seq).
|
||||
*
|
||||
* Сервис ETCP_RT_ID_DM_MAILBOX (0x35), подкоманды PUT/PULL/PULL_RESP/ACK.
|
||||
*/
|
||||
|
||||
#ifndef DM_MAILBOX_H
|
||||
#define DM_MAILBOX_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
struct UTUN_INSTANCE;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Жизненный цикл: init после chat_core_init, destroy перед chat_core_destroy. */
|
||||
int dm_mailbox_init(struct UTUN_INSTANCE* inst);
|
||||
void dm_mailbox_destroy(struct UTUN_INSTANCE* inst);
|
||||
|
||||
/* Коллбэк доставки вытянутых сообщений в dm_core (msg = каноническое тело
|
||||
* DM-сообщения, включая подпись). Вызывается из uasync-потока. */
|
||||
typedef void (*dm_mail_deliver_fn)(const uint8_t* msg, size_t len, void* arg);
|
||||
void dm_mailbox_set_deliver_cb(struct UTUN_INSTANCE* inst, dm_mail_deliver_fn fn, void* arg);
|
||||
|
||||
/* Отправитель: положить зашифрованное сообщение на storage-узлы. msg — уже
|
||||
* собранное каноническое тело (зашифровано + подписано). 0=ок, <0=ошибка. */
|
||||
int dm_mailbox_put(struct UTUN_INSTANCE* inst, uint64_t recipient, uint64_t sender,
|
||||
const uint8_t* msg, size_t msg_len);
|
||||
|
||||
/* Получатель: вытянуть почту от конкретного отправителя (seq > since_seq) со
|
||||
* всех известных storage-узлов. Вызывается из uasync-потока. */
|
||||
void dm_mailbox_pull(struct UTUN_INSTANCE* inst, uint64_t peer_node_id, uint64_t since_seq);
|
||||
|
||||
/* Собрать node_id storage-узлов (dm_storage=yes) из общих групп. До max штук.
|
||||
* Возвращает количество найденных. out — буфер на max*8 байт. */
|
||||
int dm_mailbox_get_storage_nodes(struct UTUN_INSTANCE* inst, uint64_t* out, int max);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* DM_MAILBOX_H */
|
||||
Reference in new issue
Block a user