Все ETCP_ID_*/ETCP_RT_ID_* сведены в etcp_api.h (единственное место
определения) с реестром и предупреждением про коллизии в пределах одного
пространства имён. Убраны локальные define из topo_group.h,
topo_group_invite.h, db_sync.h, chat_sync.h, chat_join.h; хардкод 0x31 в
member_sync.c заменён на ETCP_RT_ID_MEMBER_SYNC.
Коллизия: chatgui-десктоп биндил мёртвый ETCP_RT_ID_CHAT 0x11 поверх
ETCP_RT_ID_CONN_MGR 0x11 — затирался conn_mgr_router_recv_handler, из-за
чего INDIRECT-обмен conn_mgr не работал и голос звонка не устанавливался.
Удалён мёртвый код recvCallback/messageReceived/send в utun_node.{cpp,h}.
59 lines
1.4 KiB
C++
59 lines
1.4 KiB
C++
// utun_node.h — C++ wrapper for embedded uTun node (runs in dedicated thread)
|
|
#ifndef UTUN_NODE_H
|
|
#define UTUN_NODE_H
|
|
|
|
#include <QObject>
|
|
#include <QByteArray>
|
|
#include <QString>
|
|
#include <atomic>
|
|
#include <cstdint>
|
|
#include <thread>
|
|
|
|
struct UTUN_INSTANCE;
|
|
|
|
class UtunNode : public QObject {
|
|
Q_OBJECT
|
|
public:
|
|
explicit UtunNode(QObject* parent = nullptr);
|
|
~UtunNode();
|
|
|
|
bool start(const QString& configPath);
|
|
void requestStop();
|
|
void stop();
|
|
bool isRunning() const { return m_running; }
|
|
void finalize();
|
|
|
|
void setDebugFile(const QString& path);
|
|
void setDbPath(const QString& path);
|
|
void setDebugLevel(const QString& level);
|
|
void setDebugCategories(const QString& categories);
|
|
|
|
struct UTUN_INSTANCE* instance() const { return m_instance; }
|
|
|
|
QString nodeIdHex() const;
|
|
QString pubKeyHex() const;
|
|
int64_t ntpOffsetUs() const;
|
|
bool ntpSynced() const;
|
|
bool ntpEnabled() const;
|
|
|
|
signals:
|
|
void started();
|
|
void stopped();
|
|
void error(const QString& msg);
|
|
|
|
private:
|
|
void runLoop();
|
|
|
|
UTUN_INSTANCE* m_instance = nullptr;
|
|
struct UASYNC* m_ua = nullptr;
|
|
std::thread m_thread;
|
|
std::atomic<bool> m_running{false};
|
|
std::atomic<bool> m_stop{false};
|
|
QString m_configPath;
|
|
QString m_debugFile;
|
|
QString m_dbPath;
|
|
QString m_debugLevel;
|
|
QString m_debugCategories;
|
|
};
|
|
#endif // UTUN_NODE_H
|