Files
utun2/tools/chatgui/transport/utun_node.h
T
Evgeny e285a93b7f chatgui: create group, unified logging, fix uasync_post epoll bug
- Add CreateGroupDialog with group name input
- Generate X25519+Ed25519 keypairs, random uint64 channel_id,
  Ed25519 signature, write to DB via uasync thread
- chat_core_create_channel(): create msg table, topo_node_sqlite_channel_put()
- GUI_EVT_CHANNEL_UPDATED notification to reload channel list
- Per-category debug config: debug_level= + debug_categories= in [gui]
- Unified logging via debug_config: all threads write to same file/console
- debug_enable_console(1) to mirror file output to stderr
- DEBUG_LEVEL_DISABLED=-1: truly disable category, NONE=0 fallback to global
- Fix uasync_post under epoll: process_posted_tasks was never called
- Fix MainWindow constructor parameter ordering (dbPath vs debugFile)
- debug_ui.h: append mode ('a' instead of 'w')
2026-07-12 17:39:20 +03:00

54 lines
1.3 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 <thread>
struct UTUN_INSTANCE;
class UtunNode : public QObject {
Q_OBJECT
public:
explicit UtunNode(QObject* parent = nullptr);
~UtunNode();
bool start(const QString& configPath);
void stop();
bool isRunning() const { return m_running; }
void setDebugFile(const QString& path);
void setDbPath(const QString& path);
void setDebugLevel(const QString& level);
void setDebugCategories(const QString& categories);
void send(uint64_t dstNodeId, const QByteArray& data);
QString nodeIdHex() const;
QString pubKeyHex() const;
signals:
void started();
void stopped();
void error(const QString& msg);
void messageReceived(uint64_t src, const QByteArray& data);
private:
void runLoop();
static void recvCallback(struct ETCP_CONN* conn, struct ll_entry* entry);
UTUN_INSTANCE* m_instance = 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