Browse Source

android: fix key regeneration, Clear DB, uasync eventfd, udp log from config

- jni_on_event: fix JNI_EDETACHED — AttachCurrentThread/DetachCurrentThread
- u_async.c: pipe→eventfd for reliable cross-thread wakeup
  add process_posted_tasks in poll() path, fix EINTR (saved_errno)
- bridge_debug_hook: keep udp_log_write, remove mutex from udp_log
- memory_pool.c: alloc/free logs INFO→DEBUG (reduce spam)
- instance_lite.c: chat_event_set_handler before ensure_keys,
  KEYS_GENERATED events, fchmod 0600 on keys.conf,
  UDP log from config [log_udp] section, regenerate_trampoline
- config_parser: parse [log_udp] ip/port
- NativeLib.kt: remove callbacksSet, simplify init/stop/destroy
- ChatViewModel.kt: unified event callback in init, pubKey StateFlow,
  requestRegenerateKeys, clearState fix
- SettingsScreen.kt: pubKey.collectAsState(), Clear DB via restart()
- HeadlessService.kt: remove setUdpLogTarget (now from config)
- android_udp_log.c: simplified — no mutex, buffer+send+timer in one thread
- utun_instance.c: NULL-check tcp_connections before destroy
- chat_event.h: +CHAT_EVT_KEYS_GENERATED 11, -NODE_CHANGED
- logreceiver: UDP log receiver tool
topo_upd
evgeny 2 months ago
parent
commit
064bed06f2
  1. 4
      AGENTS.md
  2. 4
      lib/debug_config.c
  3. 8
      lib/memory_pool.c
  4. 46
      lib/u_async.c
  5. 2
      src/chat/chat_event.c
  6. 2
      src/chat/chat_event.h
  7. 44
      src/chat/chat_sync.c
  8. 21
      src/chat/db_sync.c
  9. 10
      src/chat/merkle_sync.c
  10. 8
      src/config_parser.c
  11. 3
      src/config_parser.h
  12. 106
      src/routing_layer/conn_mgr.c
  13. 6
      src/routing_layer/etcp_router.c
  14. 30
      src/transport_layer/etcp_connect.c
  15. 50
      src/transport_layer/etcp_connections.c
  16. 15
      src/transport_layer/etcp_connections.h
  17. 18
      src/utun_instance.c
  18. 24
      src/utun_instance.h
  19. 1
      tools/chatgui-android/app/src/main/cpp/CMakeLists.txt
  20. 1
      tools/chatgui-android/app/src/main/java/com/utun/chat/ChatApplication.kt
  21. 10
      tools/chatgui-android/app/src/main/java/com/utun/chat/MainActivity.kt
  22. 5
      tools/chatgui-android/app/src/main/java/com/utun/chat/data/ChatRepository.kt
  23. 90
      tools/chatgui-android/app/src/main/java/com/utun/chat/data/ConfigProvider.kt
  24. 66
      tools/chatgui-android/app/src/main/java/com/utun/chat/data/InviteLink.kt
  25. 20
      tools/chatgui-android/app/src/main/java/com/utun/chat/data/NativeLib.kt
  26. 27
      tools/chatgui-android/app/src/main/java/com/utun/chat/headless/HeadlessService.kt
  27. 3
      tools/chatgui-android/app/src/main/java/com/utun/chat/ui/screens/JoinChannelDialog.kt
  28. 106
      tools/chatgui-android/app/src/main/java/com/utun/chat/ui/screens/SettingsScreen.kt
  29. 134
      tools/chatgui-android/app/src/main/java/com/utun/chat/viewmodel/ChatViewModel.kt
  30. 75
      tools/chatgui-android/jni_bridge/android_jni_bridge.c
  31. 100
      tools/chatgui-android/jni_bridge/android_udp_log.c
  32. 30
      tools/chatgui-android/jni_bridge/android_udp_log.h
  33. 56
      tools/chatgui-android/libutun_lite/instance_lite.c
  34. 4
      tools/chatgui-android/libutun_lite/instance_lite.h
  35. 114
      tools/chatgui/transport/utun_node.cpp
  36. 7
      tools/logreceiver/CMakeLists.txt
  37. 340
      tools/logreceiver/build/CMakeCache.txt
  38. 84
      tools/logreceiver/build/CMakeFiles/4.1.2/CMakeCCompiler.cmake
  39. BIN
      tools/logreceiver/build/CMakeFiles/4.1.2/CMakeDetermineCompilerABI_C.bin
  40. 15
      tools/logreceiver/build/CMakeFiles/4.1.2/CMakeSystem.cmake
  41. 934
      tools/logreceiver/build/CMakeFiles/4.1.2/CompilerIdC/CMakeCCompilerId.c
  42. BIN
      tools/logreceiver/build/CMakeFiles/4.1.2/CompilerIdC/a.out
  43. 1363
      tools/logreceiver/build/CMakeFiles/CMakeConfigureLog.yaml
  44. 16
      tools/logreceiver/build/CMakeFiles/CMakeDirectoryInformation.cmake
  45. 7
      tools/logreceiver/build/CMakeFiles/InstallScripts.json
  46. 120
      tools/logreceiver/build/CMakeFiles/Makefile.cmake
  47. 122
      tools/logreceiver/build/CMakeFiles/Makefile2
  48. 3
      tools/logreceiver/build/CMakeFiles/TargetDirectories.txt
  49. 1
      tools/logreceiver/build/CMakeFiles/cmake.check_cache
  50. 24
      tools/logreceiver/build/CMakeFiles/logreceiver.dir/DependInfo.cmake
  51. 114
      tools/logreceiver/build/CMakeFiles/logreceiver.dir/build.make
  52. 12
      tools/logreceiver/build/CMakeFiles/logreceiver.dir/cmake_clean.cmake
  53. 134
      tools/logreceiver/build/CMakeFiles/logreceiver.dir/compiler_depend.internal
  54. 386
      tools/logreceiver/build/CMakeFiles/logreceiver.dir/compiler_depend.make
  55. 2
      tools/logreceiver/build/CMakeFiles/logreceiver.dir/compiler_depend.ts
  56. 2
      tools/logreceiver/build/CMakeFiles/logreceiver.dir/depend.make
  57. 10
      tools/logreceiver/build/CMakeFiles/logreceiver.dir/flags.make
  58. 76
      tools/logreceiver/build/CMakeFiles/logreceiver.dir/link.d
  59. 1
      tools/logreceiver/build/CMakeFiles/logreceiver.dir/link.txt
  60. 106
      tools/logreceiver/build/CMakeFiles/logreceiver.dir/logreceiver.c.o.d
  61. 3
      tools/logreceiver/build/CMakeFiles/logreceiver.dir/progress.make
  62. 1
      tools/logreceiver/build/CMakeFiles/progress.marks
  63. 66
      tools/logreceiver/build/cmake_install.cmake
  64. BIN
      tools/logreceiver/build/logreceiver
  65. 157
      tools/logreceiver/logreceiver.c
  66. 0
      tools/logreceiver/logreceiver_output.log.1
  67. 0
      tools/logreceiver/logreceiver_output.log.2
  68. 32
      tools/logreceiver/logreceiver_restart.sh

4
AGENTS.md

@ -395,6 +395,10 @@ KEEPALIVE=21, ETCPROUTE=22, BBR=23, ETCP_DUMP=24
Твой бич - ты постоянно гадаешь и анализируешь код. Что приводит к снежному кобу ошибок и неверных гипотез. 10 раз повторяю - только логи логи логи и никакого гадания. Лоооги!!! правильные логи покажут всё с предельной точностью. Вся суть отладки - информативные логи
И смотри логи. не задавливай их grep-ом. лучше больше. единственное с чем борись - это бесполезные спам логи.
Проблемы часто не там где их ищешь. Поэтому анализируй более полно логи и приглядывайся к любым подозрительным местам. А не одну строку выгребай грепом безуспешно по 10му кругу когда реальная проблема в другом месте.
Ты часто как слепой котёнок не смотришь по сторонам, пытаясь найти проблему где сам придумал и логично что ничего не получается.
Правльный подход: оптимиировать логи под конкретный баг. Убрать спам и вывести всё что относится к отлаживаемому механизму со всеми нужными подробностями. Прогнать и внимательно проанализировать ВЕСЬ это лог. Если он слишком большой - думай как выводить только нужное не в ущерб информативности.
Но полезные смотри всегда, и всегда оставляй логи которые выводятся нечасто.
Частые логи - это трафик которые >100 раз повторяются. Но которые мало раз обязательно оставлять и выводить.
можешь в тесте включить логи в нужный интервал чтобы не спамить. debug_set_level(DEBUG_LEVEL_TRACE) и выключить debug_set_level(DEBUG_LEVEL_NONE)

4
lib/debug_config.c

@ -409,7 +409,9 @@ void debug_output(debug_level_t level, debug_category_t category_idx,
/* Add file:line if enabled */
if (g_debug_config.file_line_enabled && file) {
offset += snprintf(buffer + offset, remaining, "(%s:%d) ", file, line);
const char* bn = strrchr(file, '/');
bn = bn ? bn + 1 : file;
offset += snprintf(buffer + offset, remaining, "(%s:%d) ", bn, line);
remaining = BUFFER_SIZE - offset;
}

8
lib/memory_pool.c

@ -84,12 +84,12 @@ void* memory_pool_alloc_impl(struct memory_pool* pool, const char* location) {
pool->reuse_count++;
memset(obj, 0, pool->object_size);
pool_init_tags(pool, obj, location);
DEBUG_INFO(DEBUG_CATEGORY_MEMORY, "pool_alloc reused: %s, remaining=%zu", location, pool->free_count);
DEBUG_DEBUG(DEBUG_CATEGORY_MEMORY, "pool_alloc reused: %s, remaining=%zu", location, pool->free_count);
return obj;
}
pool->allocations++;
DEBUG_INFO(DEBUG_CATEGORY_MEMORY, "pool_alloc: %s, total_allocs=%zu", location, pool->allocations);
DEBUG_DEBUG(DEBUG_CATEGORY_MEMORY, "pool_alloc: %s, total_allocs=%zu", location, pool->allocations);
void* obj = u_calloc_impl(1, POOL_ALLOC_SIZE, location);
if (obj) pool_init_tags(pool, obj, location);
return obj;
@ -108,11 +108,11 @@ void memory_pool_free_impl(struct memory_pool* pool, void* obj, const char* loca
pool->free_head = obj;
pool->free_count++;
g_total_free++;
DEBUG_INFO(DEBUG_CATEGORY_MEMORY, "pool_free returned: %s, free_count=%zu", location, pool->free_count);
DEBUG_DEBUG(DEBUG_CATEGORY_MEMORY, "pool_free returned: %s, free_count=%zu", location, pool->free_count);
return;
}
DEBUG_INFO(DEBUG_CATEGORY_MEMORY, "pool_free direct: %s", location);
DEBUG_DEBUG(DEBUG_CATEGORY_MEMORY, "pool_free direct: %s", location);
u_free_impl(obj, location);
}

46
lib/u_async.c

@ -23,6 +23,7 @@
// Platform-specific includes
#ifdef __linux__
#include <sys/epoll.h>
#include <sys/eventfd.h>
#define HAS_EPOLL 1
#else
#define HAS_EPOLL 0
@ -368,11 +369,8 @@ uint64_t get_time_us(void) {
static void drain_wakeup_pipe(struct UASYNC* ua) {
if (!ua || !ua->wakeup_initialized) return;
char buf[64];
while (1) {
ssize_t n = read(ua->wakeup_pipe[0], buf, sizeof(buf));
if (n <= 0) break;
}
uint64_t val;
while (read(ua->wakeup_pipe[0], &val, sizeof(val)) > 0) {}
}
// Process posted tasks (lock-u_free during execution)
@ -417,8 +415,8 @@ static void handle_wakeup(struct UASYNC* ua) {
SOCKET s = (SOCKET)(intptr_t)ua->wakeup_pipe[0];
while (recv(s, buf, sizeof(buf), 0) > 0) {}
#else
char buf[64];
while (read(ua->wakeup_pipe[0], buf, sizeof(buf)) > 0) {}
uint64_t val;
while (read(ua->wakeup_pipe[0], &val, sizeof(val)) > 0) {}
#endif
// DEBUG_DEBUG(DEBUG_CATEGORY_TIMERS, "POST: wakeup process");
@ -1051,9 +1049,10 @@ void uasync_poll(struct UASYNC* ua, int timeout_tb) {
int max_events = 64;
int ret = epoll_wait(ua->epoll_fd, events, max_events, timeout_ms);
int saved_errno = errno;
ua->last_poll_exit_us = get_time_us();
if (ret < 0) {
if (errno == EINTR) {
if (saved_errno == EINTR) {
return;
}
perror("epoll_wait");
@ -1206,9 +1205,10 @@ void uasync_poll(struct UASYNC* ua, int timeout_tb) {
}
int ret = poll(ua->poll_fds, ua->poll_fds_count, timeout_ms);
int saved_errno = errno;
ua->last_poll_exit_us = get_time_us();
if (ret < 0) {
if (errno == EINTR) {
if (saved_errno == EINTR) {
return;
}
perror("poll");
@ -1226,6 +1226,7 @@ void uasync_poll(struct UASYNC* ua, int timeout_tb) {
if (ua->poll_fds[i].revents & POLLIN) {
drain_wakeup_pipe(ua);
}
process_posted_tasks(ua);
continue;
}
@ -1281,7 +1282,8 @@ void uasync_poll(struct UASYNC* ua, int timeout_tb) {
}
#endif
/* Process timeouts that may have expired during poll or socket processing */
/* Process posted tasks and timeouts that may have expired during poll */
process_posted_tasks(ua);
process_timeouts(ua);
}
@ -1450,12 +1452,14 @@ struct UASYNC* uasync_create(void) {
InitializeCriticalSection(&ua->posted_lock);
#else
// POSIX pipe
if (pipe(ua->wakeup_pipe) != 0) {
DEBUG_ERROR(DEBUG_CATEGORY_UASYNC, "pipe() failed: %s", strerror(errno));
// POSIX: use eventfd for reliable cross-thread wakeup
ua->wakeup_pipe[0] = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
if (ua->wakeup_pipe[0] < 0) {
DEBUG_ERROR(DEBUG_CATEGORY_UASYNC, "eventfd() failed: %s", strerror(errno));
u_free(ua);
return NULL;
}
ua->wakeup_pipe[1] = ua->wakeup_pipe[0];
ua->wakeup_initialized = 1;
#if HAS_EPOLL
@ -1469,9 +1473,6 @@ struct UASYNC* uasync_create(void) {
}
#endif
fcntl(ua->wakeup_pipe[0], F_SETFL, fcntl(ua->wakeup_pipe[0], F_GETFL, 0) | O_NONBLOCK);
fcntl(ua->wakeup_pipe[1], F_SETFL, fcntl(ua->wakeup_pipe[1], F_GETFL, 0) | O_NONBLOCK);
if (!ua->use_epoll) {
uasync_add_socket(ua, ua->wakeup_pipe[0], wakeup_read_callback_posix, NULL, NULL, ua); // ← ua
}
@ -1741,16 +1742,19 @@ void uasync_post(struct UASYNC* ua, uasync_post_callback_t callback, void* arg)
int uasync_wakeup(struct UASYNC* ua) {
if (!ua || !ua->wakeup_initialized) return -1;
char byte = 0;
#ifdef _WIN32
char byte = 0;
int ret = send((SOCKET)(intptr_t)ua->wakeup_pipe[1], &byte, 1, 0);
#else
ssize_t ret = write(ua->wakeup_pipe[1], &byte, 1);
#endif
if (ret != 1) {
// Don't print error from signal handler
return -1;
}
#else
uint64_t val = 1;
ssize_t ret = write(ua->wakeup_pipe[1], &val, sizeof(val));
if (ret != sizeof(val)) {
return -1;
}
#endif
return 0;
}

2
src/chat/chat_event.c

@ -21,7 +21,7 @@ void chat_event_post(int type, const uint8_t* data, int len) {
[1]="MSG_RECEIVED", [2]="CONNECT_RESULT", [3]="NEW_PEER",
[4]="CHANNEL_UPDATED", [5]="MEMBERS_CHANGED", [6]="MY_NODE_ID",
[7]="AUTO_CONNECT_STATUS", [8]="CHANNEL_PEERS_ONLINE",
[9]="DB_READY", [10]="STATUS_REFRESH", [11]="NODE_CHANGED",
[9]="DB_READY", [10]="STATUS_REFRESH", [11]="KEYS_GENERATED",
};
const char* n = (type >= 1 && type <= 11) ? names[type] : "?";
DEBUG_DEBUG(DEBUG_CATEGORY_DEBUG, "chat_event: %s(%d) data=%d bytes", n, type, len);

2
src/chat/chat_event.h

@ -29,7 +29,7 @@ extern "C" {
#define CHAT_EVT_CHANNEL_PEERS_ONLINE 8 /* [ch_id_len:1][ch_id:var][online_count:2] */
#define CHAT_EVT_DB_READY 9 /* data: none */
#define CHAT_EVT_STATUS_REFRESH 10 /* data: status text */
#define CHAT_EVT_NODE_CHANGED 11 /* [node_id:8] */
#define CHAT_EVT_KEYS_GENERATED 11 /* [pub_hex:64] */
typedef void (*chat_event_handler_fn)(int type, const uint8_t* data, int len);

44
src/chat/chat_sync.c

@ -215,16 +215,10 @@ static void cs_join_timeout_cb(void* arg) {
/* ── helper: find active ETCP_CONN for node ── */
static struct ETCP_CONN* cs_find_conn_for_node(struct UTUN_INSTANCE* inst, uint64_t node_id) {
struct ETCP_CONN* conn = instance_find_conn(inst, node_id);
if (conn && conn->initialized && conn->links_up) return conn;
if (!inst->connections) { DEBUG_INFO(DEBUG_CATEGORY_DB_SYNC, "%s: find_conn connections=NULL", CS_ID); return NULL; }
struct ll_entry* e = queue_find_data_by_index(inst->connections, (const uint8_t*)&node_id);
if (e) {
struct conn_queue_entry* ce = (struct conn_queue_entry*)e->data;
DEBUG_INFO(DEBUG_CATEGORY_DB_SYNC, "%s: find_conn node=%016llx found=%p initialized=%d links_up=%d state=%d",
CS_ID, (unsigned long long)node_id, (void*)ce->conn, ce->conn->initialized, ce->conn->links_up, ce->conn->state);
if (ce->conn->initialized && ce->conn->links_up) return ce->conn;
return NULL;
}
DEBUG_INFO(DEBUG_CATEGORY_DB_SYNC, "%s: find_conn node=%016llx NOT FOUND in queue (head=%p count=%d)",
DEBUG_INFO(DEBUG_CATEGORY_DB_SYNC, "%s: find_conn node=%016llx NOT FOUND (head=%p count=%d)",
CS_ID, (unsigned long long)node_id, (void*)inst->connections->head, queue_entry_count(inst->connections));
return NULL;
}
@ -233,15 +227,9 @@ static struct ETCP_CONN* cs_find_conn_for_node(struct UTUN_INSTANCE* inst, uint6
static int cs_is_peer_online(struct UTUN_INSTANCE* inst, uint64_t peer_id) {
if (!inst->connections) { DEBUG_DEBUG(DEBUG_CATEGORY_DB_SYNC, "%s: is_online peer=0x%016llx CONNS=NULL", CS_ID, (unsigned long long)peer_id); return 0; }
struct ll_entry* e = queue_find_data_by_index(inst->connections, (const uint8_t*)&peer_id);
if (e) {
struct conn_queue_entry* ce = (struct conn_queue_entry*)e->data;
int onl = ce->conn->initialized && ce->conn->links_up;
DEBUG_DEBUG(DEBUG_CATEGORY_DB_SYNC, "%s: is_online peer=0x%016llx found=1 init=%d links=%d online=%d",
CS_ID, (unsigned long long)peer_id, ce->conn->initialized, ce->conn->links_up, onl);
return onl;
}
DEBUG_DEBUG(DEBUG_CATEGORY_DB_SYNC, "%s: is_online peer=0x%016llx found=0", CS_ID, (unsigned long long)peer_id);
struct ETCP_CONN* conn = instance_find_conn(inst, peer_id);
if (conn) return conn->initialized && conn->links_up;
DEBUG_DEBUG(DEBUG_CATEGORY_DB_SYNC, "%s: is_online peer=0x%016llx NOT FOUND", CS_ID, (unsigned long long)peer_id);
return 0;
}
@ -601,17 +589,17 @@ static void cm_invite_trampoline(void* arg) {
/* save invite addresses (socket_id=0) */
sqlite3_prepare_v2(db, "DELETE FROM node_addresses WHERE node_id=? AND socket_id=0", -1, &st, NULL);
if (st) { sqlite3_bind_int64(st, 1, (sqlite3_int64)node_id); sqlite3_step(st); sqlite3_finalize(st); }
sqlite3_prepare_v2(db, "INSERT INTO node_addresses(node_id,family,protocol,address,port,addr_type,socket_id) VALUES(?,?,1,?,?,0,?)", -1, &st, NULL);
sqlite3_prepare_v2(db, "INSERT INTO node_addresses(node_id,family,protocol,address,port,addr_type,socket_id) VALUES(?,?,?,?,?,0,?)", -1, &st, NULL);
if (st) {
const uint8_t* ap = inv->addrs_data;
for (int i = 0; i < inv->addr_count; i++) {
uint8_t family = *ap++; ap++; /* skip sock_id */
uint8_t proto = *ap++; /* read proto */
if (family != 4) { ap += 18; continue; }
sqlite3_bind_int64(st, 1, (sqlite3_int64)node_id); sqlite3_bind_int(st, 2, 4);
sqlite3_bind_blob(st, 3, ap, 4, SQLITE_STATIC); ap += 4;
sqlite3_bind_int64(st, 1, (sqlite3_int64)node_id); sqlite3_bind_int(st, 2, 4); sqlite3_bind_int(st, 3, proto);
sqlite3_bind_blob(st, 4, ap, 4, SQLITE_STATIC); ap += 4;
uint16_t port = ((uint16_t)ap[0] << 8) | ap[1]; ap += 2;
sqlite3_bind_int(st, 4, (int)port); sqlite3_bind_int(st, 5, 1); /* addr_type=1 (DIRECT) */
sqlite3_bind_int(st, 5, (int)port); sqlite3_bind_int(st, 6, 1); /* addr_type=1 (DIRECT) */
sqlite3_step(st); sqlite3_reset(st);
}
sqlite3_finalize(st);
@ -634,6 +622,10 @@ static void cm_invite_trampoline(void* arg) {
const uint8_t* ap = inv->addrs_data;
for (int i = 0; i < inv->addr_count; i++) {
uint8_t family = *ap++; uint8_t sock_id = *ap++; uint8_t proto = *ap++;
uint16_t port = 0;
if (family == 4) { const uint8_t* a = ap; port = ((uint16_t)ap[4] << 8) | ap[5]; }
DEBUG_DEBUG(DEBUG_CATEGORY_DB_SYNC, "%s: invite addr[%d] family=%d proto=%d sock=%d %d.%d.%d.%d:%d",
CS_ID, i, family, proto, sock_id, ap[0], ap[1], ap[2], ap[3], port);
if (family != 4) { ap += 18; continue; }
struct TOPO_ADDR4* a4 = u_calloc(1, sizeof(*a4));
if (!a4) break;
@ -650,12 +642,8 @@ static void cm_invite_trampoline(void* arg) {
}
if (g_cs && g_cs->pending_invite_ch_id != 0 && !g_cs->info_req_timer) {
struct ETCP_CONN* conn = NULL;
{
struct ll_entry* e = queue_find_data_by_index(inst->connections, (const uint8_t*)&node_id);
if (e) { struct conn_queue_entry* ce = (struct conn_queue_entry*)e->data; if (ce->conn->links_up) conn = ce->conn; }
}
if (conn) {
struct ETCP_CONN* conn = instance_find_conn(inst, node_id);
if (conn && conn->links_up) {
DEBUG_INFO(DEBUG_CATEGORY_DB_SYNC, "%s: invite conn already UP node=0x%016llx, triggering cs_on_conn_up", CS_ID, (unsigned long long)node_id);
cs_on_conn_up(conn, NULL);
}

21
src/chat/db_sync.c

@ -384,14 +384,11 @@ static int db_get_ed25519_pubkey(struct DB_SYNC* db, uint64_t node_id, uint8_t o
if (db->inst->topo_sqlite_db) {
if (topo_node_sqlite_get_ed25519_pubkey(db->inst->topo_sqlite_db, node_id, out) == 0) return 0;
}
struct ll_entry* e = queue_find_data_by_index(db->inst->connections, (const uint8_t*)&node_id);
if (e) {
struct conn_queue_entry* ce = (struct conn_queue_entry*)e->data;
if (ce->conn) {
memcpy(out, ce->conn->peer_ed25519_pubkey, 32);
uint64_t chk; memcpy(&chk, out, 8);
if (chk != 0) return 0;
}
struct ETCP_CONN* conn = instance_find_conn(db->inst, node_id);
if (conn) {
memcpy(out, conn->peer_ed25519_pubkey, 32);
uint64_t chk; memcpy(&chk, out, 8);
if (chk != 0) return 0;
}
return -1;
}
@ -545,12 +542,8 @@ static int db_sync_send_hash(struct DB_SYNC* db, uint64_t node_id, uint64_t hash
entry->dgram = buf;
entry->len = plen + 9;
struct ETCP_CONN* conn = NULL;
{
struct ll_entry* e = queue_find_data_by_index(db->inst->connections, (const uint8_t*)&node_id);
if (e) { struct conn_queue_entry* ce = (struct conn_queue_entry*)e->data; if (ce->conn->links_up) conn = ce->conn; }
}
if (!conn) {
struct ETCP_CONN* conn = instance_find_conn(db->inst, node_id);
if (!conn || !conn->links_up) {
DEBUG_WARN(DEBUG_CATEGORY_DB_SYNC, "sync: send DROP — no direct conn to %04llX (hash=%016llx, type=%02x)",
(unsigned long long)(node_id >> 16), hash, plen > 0 ? payload[0] : 0);
queue_entry_free(entry);

10
src/chat/merkle_sync.c

@ -215,11 +215,11 @@ static int _get_level_hashes(struct merkle_sync* ms, const char* ns,
static struct ETCP_CONN* ms_find_conn_for_node(struct UTUN_INSTANCE* inst, uint64_t node_id) {
if (!inst->connections) { DEBUG_DEBUG(DEBUG_CATEGORY_DB_SYNC, "%s: find_conn — inst->connections is NULL", MS_ID); return NULL; }
struct ll_entry* e = queue_find_data_by_index(inst->connections, (const uint8_t*)&node_id);
if (!e) { DEBUG_DEBUG(DEBUG_CATEGORY_DB_SYNC, "%s: find_conn — node=%016llx NOT FOUND in connections", MS_ID, (unsigned long long)node_id); return NULL; }
struct conn_queue_entry* ce = (struct conn_queue_entry*)e->data;
DEBUG_DEBUG(DEBUG_CATEGORY_DB_SYNC, "%s: find_conn — node=%016llx found=%d initialized=%d links_up=%d", MS_ID, (unsigned long long)node_id, 1, ce->conn->initialized, ce->conn->links_up);
if (ce->conn->initialized && ce->conn->links_up) return ce->conn;
struct ETCP_CONN* conn = instance_find_conn(inst, node_id);
if (!conn) { DEBUG_DEBUG(DEBUG_CATEGORY_DB_SYNC, "%s: find_conn — node=%016llx NOT FOUND", MS_ID, (unsigned long long)node_id); return NULL; }
DEBUG_DEBUG(DEBUG_CATEGORY_DB_SYNC, "%s: find_conn — node=%016llx found=%d initialized=%d links_up=%d",
MS_ID, (unsigned long long)node_id, 1, conn->initialized, conn->links_up);
if (conn->initialized && conn->links_up) return conn;
return NULL;
}

8
src/config_parser.c

@ -49,7 +49,8 @@ typedef enum {
SECTION_TCP_PROXY_SERVER,
SECTION_NETWORK,
SECTION_GUI,
SECTION_NTP
SECTION_NTP,
SECTION_LOG_UDP
} section_type_t;
static char* trim(char *str) {
@ -754,6 +755,7 @@ static section_type_t parse_section_header(const char *line, char *name, size_t
if (strcasecmp(section, "tcp_proxy_server") == 0) return SECTION_TCP_PROXY_SERVER;
if (strcasecmp(section, "ntp") == 0) return SECTION_NTP;
if (strcasecmp(section, "gui") == 0) return SECTION_GUI;
if (strcasecmp(section, "log_udp") == 0) return SECTION_LOG_UDP;
char *colon = strchr(section, ':');
if (!colon) return SECTION_UNKNOWN;
@ -1107,6 +1109,10 @@ struct utun_config* parse_config_from_buf(const char *buf, size_t len, const cha
case SECTION_NETWORK: if (cur_network) parse_network(key, value, cur_network, filename, line_num); break;
case SECTION_NTP: if (strcmp(key, "enabled") == 0) cfg->global.ntp_enabled = strcasecmp(value, "yes") == 0 || strcasecmp(value, "1") == 0 || strcasecmp(value, "true") == 0; else if (strcmp(key, "server") == 0) { struct CFG_NTP_SERVER *ns = u_calloc(1, sizeof(struct CFG_NTP_SERVER)); if (ns) { strncpy(ns->name, value, sizeof(ns->name) - 1); ns->name[sizeof(ns->name) - 1] = '\0'; ns->next = cfg->global.ntp_servers; cfg->global.ntp_servers = ns; cfg->global.ntp_server_count++; } } else if (strcmp(key, "interval") == 0) { cfg->global.ntp_resync_interval = atoi(value); if (cfg->global.ntp_resync_interval < 60) cfg->global.ntp_resync_interval = 60; } else DEBUG_ERROR(DEBUG_CATEGORY_CONFIG, "%s:%d: Unknown ntp option '%s'", filename, line_num, key); break;
case SECTION_GUI: break;
case SECTION_LOG_UDP:
if (strcmp(key, "ip") == 0) strncpy(cfg->global.log_udp_ip, value, sizeof(cfg->global.log_udp_ip) - 1);
else if (strcmp(key, "port") == 0) cfg->global.log_udp_port = atoi(value);
break;
default: DEBUG_WARN(DEBUG_CATEGORY_CONFIG, "%s:%d: Key outside section: %s", filename, line_num, key); break;
}
}

3
src/config_parser.h

@ -120,6 +120,9 @@ struct global_config {
char db_path[256]; // Path to SQLite database (empty = disabled)
int db_sync_enabled; // 1 = enable distributed DB sync (default: 0)
uint32_t db_sync_ttl; // TTL for unsent records in seconds (default: 86400)
// UDP log target
char log_udp_ip[64];
int log_udp_port;
char debug_level[16]; // debug level: error, warn, info, debug, trace
int enable_timestamp; // enable timestamps in logs
int enable_function_names; // enable function names in logs

106
src/routing_layer/conn_mgr.c

@ -20,6 +20,7 @@
#include "topo_node.h"
#include "topo_node_sqlite.h"
#include "topo_group.h"
#include "../transport_layer/stcp_link.h"
#include "route_ping.h"
#include "route_connectivity.h"
#include "conn_mgr.h"
@ -95,6 +96,8 @@ struct cm_invite_pending {
uint32_t timeout_ms;
uint8_t state;
struct ETCP_CONN* conn;
struct stcp_link* tcp_link;
uint8_t tcp_ready : 1;
void* overall_timer;
conn_mgr_connect_callback_t cb;
void* cb_arg;
@ -269,17 +272,7 @@ int conn_mgr_connect_node(struct CONN_MGR* mgr, uint64_t node_id, uint32_t idle_
return CONN_MGR_OK;
}
struct ETCP_CONN* existing = topo_group_find_conn_for_node(group, node_id);
if (!existing) {
struct ll_entry* ce = queue_find_data_by_index(mgr->instance->connections, (const uint8_t*)&node_id);
while (ce) {
struct conn_queue_entry* cqe = (struct conn_queue_entry*)ce->data;
if (cqe->conn && cqe->conn->peer_node_id == node_id) {
existing = cqe->conn;
break;
}
ce = queue_find_next_by_index(mgr->instance->connections, (const uint8_t*)&node_id, ce);
}
}
if (!existing) existing = instance_find_conn(mgr->instance, node_id);
if (existing && existing->peer_node_id == node_id && existing->links) {
struct ETCP_LINK* l = existing->links;
while (l) { if (l->link_status && l->initialized) break; l = l->next; }
@ -1203,8 +1196,7 @@ static void cm_handle_invite_info_req(struct CONN_MGR* mgr, struct ETCP_CONN* co
DEBUG_INFO(DEBUG_CATEGORY_GENERAL, "conn_mgr: INVITE_INFO_REQ from 0x%016llx group=0x%016llx",
(unsigned long long)peer_node_id, (unsigned long long)req->group_id);
uint8_t is_member = 0;
if (req->group_id != 0) is_member = (uint8_t)cm_check_group_member(mgr, req->group_id, peer_node_id);
uint8_t is_member = 1; /* invite link itself is authorization — no group membership check needed */
struct TOPO_GROUP* group = topo_groups_find(mgr->instance->topo_groups, req->group_id);
struct TOPO_GROUP* src_group = group ? group : mgr->group;
@ -1282,6 +1274,7 @@ static void cm_handle_invite_info_resp(struct CONN_MGR* mgr, const uint8_t* data
static void cm_invite_init_cb(struct ETCP_CONN* conn, void* arg) {
struct cm_invite_pending* inv = (struct cm_invite_pending*)arg;
if (inv->state != CM_INVITE_CONNECTING) return;
if (!conn || conn->peer_node_id != inv->node_id) {
DEBUG_WARN(DEBUG_CATEGORY_GENERAL, "conn_mgr: invite init cb peer mismatch conn=0x%016llx inv=0x%016llx",
(unsigned long long)(conn ? conn->peer_node_id : 0), (unsigned long long)inv->node_id);
@ -1311,11 +1304,46 @@ static void cm_invite_overall_timeout(void* arg) {
cm_invite_fail(inv, CONN_MGR_ERR_TIMEOUT);
}
/* ── TCP invite callbacks ── */
static void cm_tcp_ready_cb(struct stcp_link* link, void* arg) {
struct cm_invite_pending* inv = (struct cm_invite_pending*)arg;
if (!inv || inv->tcp_ready) return;
inv->tcp_ready = 1;
struct ETCP_CONN* etcp = stcp_link_get_etcp_conn(link);
etcp->peer_node_id = inv->node_id;
struct ll_entry* qe = queue_entry_new(sizeof(struct tcp_conn_entry));
if (!qe) { cm_invite_fail(inv, CONN_MGR_ERR_INTERNAL); return; }
struct tcp_conn_entry* te = (struct tcp_conn_entry*)qe->data;
te->node_id = inv->node_id; te->link = link; te->etcp_conn = etcp;
queue_data_put_with_index(inv->mgr->instance->tcp_connections, qe);
inv->conn = etcp;
DEBUG_INFO(DEBUG_CATEGORY_GENERAL, "conn_mgr: TCP invite ready node=0x%016llx", (unsigned long long)inv->node_id);
cm_invite_init_cb(etcp, inv);
}
static void cm_tcp_close_cb(struct stcp_link* link, int err, void* arg) {
struct cm_invite_pending* inv = (struct cm_invite_pending*)arg;
if (!inv) return;
DEBUG_INFO(DEBUG_CATEGORY_GENERAL, "conn_mgr: TCP invite closed node=0x%016llx err=%d",
(unsigned long long)inv->node_id, err);
inv->tcp_link = NULL;
}
static void cm_invite_fail(struct cm_invite_pending* inv, int result) {
if (!inv) return;
struct CONN_MGR* mgr = inv->mgr;
if (inv->overall_timer) { uasync_cancel_timeout(mgr->instance->ua, inv->overall_timer); inv->overall_timer = NULL; }
if (inv->conn) { etcp_connection_close(inv->conn); inv->conn = NULL; }
if (inv->tcp_link) {
struct ll_entry* e = queue_find_data_by_index(mgr->instance->tcp_connections, (const uint8_t*)&inv->node_id);
if (e) queue_remove_data(mgr->instance->tcp_connections, e);
stcp_link_close(inv->tcp_link); inv->tcp_link = NULL; inv->conn = NULL;
} else if (inv->conn) {
etcp_connection_close(inv->conn); inv->conn = NULL;
}
if (inv->temp_nq) {
struct TOPO_GROUP* group = mgr->group;
queue_remove_data(group->nodes, &inv->temp_nq->ll);
@ -1378,29 +1406,57 @@ int conn_mgr_connect_from_invite(struct CONN_MGR* mgr, struct TOPO_NODE* ni,
queue_data_put_with_index(group->nodes, &nq->ll);
int connected = 0;
int udp_connected = 0, tcp_connected = 0;
struct ETCP_CONN* udp_conn = NULL;
/* ── UDP: all addresses × all local sockets (single ETCP_CONN, no break) ── */
for (const struct TOPO_ADDR4* a = group_ni->v4_addrs; a; a = a->next) {
if (a->protocol != TOPO_PROTO_UDP) continue;
if (!(a->protocol & TOPO_PROTO_UDP)) continue;
struct ETCP_SOCKET* s = mgr->instance->etcp_sockets;
while (s) {
if (s->local_addr.ss_family == AF_INET) {
struct sockaddr_in sin; memset(&sin, 0, sizeof(sin)); sin.sin_family = AF_INET;
memcpy(&sin.sin_addr.s_addr, a->addr, 4); sin.sin_port = htons(a->port);
struct sockaddr_storage sa; memset(&sa, 0, sizeof(sa)); memcpy(&sa, &sin, sizeof(sin));
struct ETCP_CONN* conn = etcp_connection_create(mgr->instance, NULL);
if (conn) {
etcp_conn_add_init_cbk(conn, cm_invite_init_cb, inv);
sc_init_ctx(&conn->crypto_ctx, &mgr->instance->my_keys);
sc_set_peer_public_key(&conn->crypto_ctx, group_ni->public_key, 0);
if (etcp_link_new(conn, s, &sa, 0)) { inv->conn = conn; connected = 1; break; }
etcp_connection_close(conn);
if (!udp_conn) {
udp_conn = etcp_connection_create(mgr->instance, NULL);
if (udp_conn) {
etcp_conn_add_init_cbk(udp_conn, cm_invite_init_cb, inv);
sc_init_ctx(&udp_conn->crypto_ctx, &mgr->instance->my_keys);
sc_set_peer_public_key(&udp_conn->crypto_ctx, group_ni->public_key, 0);
}
}
if (udp_conn && etcp_link_new(udp_conn, s, &sa, 0)) {
inv->conn = udp_conn; udp_connected = 1;
}
}
s = s->next;
}
if (connected) break;
}
if (!connected) { cm_invite_fail(inv, CONN_MGR_ERR_UNREACHABLE); return CONN_MGR_ERR_UNREACHABLE; }
/* ── TCP: first address ── */
for (const struct TOPO_ADDR4* a = group_ni->v4_addrs; a; a = a->next) {
if (!(a->protocol & TOPO_PROTO_TCP)) continue;
struct sockaddr_in sin; memset(&sin, 0, sizeof(sin)); sin.sin_family = AF_INET;
memcpy(&sin.sin_addr.s_addr, a->addr, 4); sin.sin_port = htons(a->port);
struct sockaddr_storage sa; memset(&sa, 0, sizeof(sa)); memcpy(&sa, &sin, sizeof(sin));
struct stcp_link_config tcp_cfg = {
.ua = mgr->instance->ua, .my_keys = &mgr->instance->my_keys, .inst = mgr->instance,
.peer_pubkey = group_ni->public_key, .peer_pubkey_mode = 0,
.remote_addr = &sa, .remote_port = a->port,
};
inv->tcp_link = stcp_link_connect(&tcp_cfg);
if (inv->tcp_link) {
stcp_link_set_on_ready(inv->tcp_link, cm_tcp_ready_cb, inv);
stcp_link_set_on_close(inv->tcp_link, cm_tcp_close_cb, inv);
tcp_connected = 1;
}
break;
}
if (!udp_connected && !tcp_connected) {
cm_invite_fail(inv, CONN_MGR_ERR_UNREACHABLE); return CONN_MGR_ERR_UNREACHABLE;
}
inv->overall_timer = uasync_set_timeout(mgr->instance->ua, (int)inv->timeout_ms * 10, inv, cm_invite_overall_timeout, "conn_mgr_invite");
DEBUG_INFO(DEBUG_CATEGORY_GENERAL, "conn_mgr: invite started node=0x%016llx group=0x%016llx timeout=%ums",

6
src/routing_layer/etcp_router.c

@ -1063,7 +1063,11 @@ void etcp_router_destroy(struct UTUN_INSTANCE* inst) {
int etcp_router_bind(struct UTUN_INSTANCE* inst, uint8_t svc_id, etcp_recv_fn callback) {
if (!inst) { DEBUG_ERROR(DEBUG_CATEGORY_ETCPROUTE, "NULL instance"); return -1; }
if (!callback) { DEBUG_ERROR(DEBUG_CATEGORY_ETCPROUTE, "NULL callback for svc_id=%u", svc_id); return -1; }
if (!callback) {
DEBUG_DEBUG(DEBUG_CATEGORY_ETCPROUTE, "unbind svc_id=%u", svc_id);
inst->router_bindings.callbacks[svc_id] = NULL;
return 0;
}
if (inst->router_bindings.callbacks[svc_id])
DEBUG_WARN(DEBUG_CATEGORY_ETCPROUTE, "overwriting svc_id=%u", svc_id);
inst->router_bindings.callbacks[svc_id] = callback;

30
src/transport_layer/etcp_connect.c

@ -211,24 +211,20 @@ int etcp_connect(struct UTUN_INSTANCE* inst, struct TOPO_NODEQ* node,
if (!inst || !node || !cb) return -1;
uint64_t node_id = node->node->node_id;
// Check if already connected via indexed queue
// Check if already connected
{
struct ll_entry* e = queue_find_data_by_index(inst->connections, (const uint8_t*)&node_id);
if (e) {
struct conn_queue_entry* ce = (struct conn_queue_entry*)e->data;
struct ETCP_CONN* existing = ce->conn;
if (existing && existing->peer_node_id == node_id) {
struct ETCP_LINK* l = existing->links;
while (l) { if (l->link_state == 3) break; l = l->next; }
if (l) {
DEBUG_INFO(DEBUG_CATEGORY_ETCP_CONNECT, "[etcp_connect] node 0x%016llx already connected, delivering immediately",
(unsigned long long)node_id);
if (flags & ETCP_CONNECT_EARLY) cb(arg, existing, ETCP_CONNECT_EARLY);
if (flags & ETCP_CONNECT_LATE) cb(arg, existing, ETCP_CONNECT_LATE);
if ((flags & ETCP_CONNECT_BGP_READY) && existing->routing_exchange_active >= 3)
cb(arg, existing, ETCP_CONNECT_BGP_READY);
return 0;
}
struct ETCP_CONN* existing = instance_find_conn(inst, node_id);
if (existing && existing->peer_node_id == node_id) {
struct ETCP_LINK* l = existing->links;
while (l) { if (l->link_state == 3) break; l = l->next; }
if (l) {
DEBUG_INFO(DEBUG_CATEGORY_ETCP_CONNECT, "[etcp_connect] node 0x%016llx already connected, delivering immediately",
(unsigned long long)node_id);
if (flags & ETCP_CONNECT_EARLY) cb(arg, existing, ETCP_CONNECT_EARLY);
if (flags & ETCP_CONNECT_LATE) cb(arg, existing, ETCP_CONNECT_LATE);
if ((flags & ETCP_CONNECT_BGP_READY) && existing->routing_exchange_active >= 3)
cb(arg, existing, ETCP_CONNECT_BGP_READY);
return 0;
}
}
}

50
src/transport_layer/etcp_connections.c

@ -733,6 +733,55 @@ void etcp_socket_remove(struct ETCP_SOCKET* conn) {
u_free(conn);
}
/* ── TCP socket management ── */
struct TCP_SOCKET* tcp_socket_add(struct UTUN_INSTANCE* instance, struct CFG_SERVER* server) {
if (!instance || !server) return NULL;
struct TCP_SOCKET* ts = u_calloc(1, sizeof(struct TCP_SOCKET));
if (!ts) { DEBUG_ERROR(DEBUG_CATEGORY_SOCKET, "tcp_socket_add: alloc failed"); return NULL; }
ts->instance = instance;
ts->type = server->type;
if (server->name && server->name[0]) {
strncpy(ts->name, server->name, MAX_CONN_NAME_LEN - 1);
ts->name[MAX_CONN_NAME_LEN - 1] = '\0';
}
ts->sock_id = instance->next_socket_id++;
if (server->ip.ss_family == AF_INET) {
struct sockaddr_in* sin = (struct sockaddr_in*)&server->ip;
memcpy(&ts->local_addr, sin, sizeof(*sin));
ts->interface_addr = ts->local_addr;
if (server->type == CFG_SERVER_TYPE_PUBLIC && sin->sin_addr.s_addr == 0) {
struct sockaddr_storage remote; memset(&remote, 0, sizeof(remote));
struct sockaddr_in* rs = (struct sockaddr_in*)&remote;
rs->sin_family = AF_INET; rs->sin_port = htons(53);
inet_pton(AF_INET, "8.8.8.8", &rs->sin_addr);
struct sockaddr_storage local;
if (get_outgoing_local_ip(&server->ip, &remote, &local) == 0)
ts->interface_addr = local;
}
} else if (server->ip.ss_family == AF_INET6) {
struct sockaddr_in6* sin6 = (struct sockaddr_in6*)&server->ip;
memcpy(&ts->local_addr, sin6, sizeof(*sin6));
ts->interface_addr = ts->local_addr;
}
ts->next = instance->tcp_sockets;
instance->tcp_sockets = ts;
DEBUG_INFO(DEBUG_CATEGORY_SOCKET, "tcp_socket_add: %s type=%d sock_id=%u", ts->name, ts->type, ts->sock_id);
return ts;
}
void tcp_socket_remove(struct TCP_SOCKET* sock) {
if (!sock || !sock->instance) return;
struct UTUN_INSTANCE* inst = sock->instance;
struct TCP_SOCKET** pp = &inst->tcp_sockets;
while (*pp && *pp != sock) pp = &(*pp)->next;
if (*pp) *pp = sock->next;
DEBUG_INFO(DEBUG_CATEGORY_SOCKET, "tcp_socket_remove: %s sock_id=%u", sock->name, sock->sock_id);
u_free(sock);
}
struct ETCP_LINK* etcp_link_new(struct ETCP_CONN* etcp, struct ETCP_SOCKET* conn, struct sockaddr_storage* remote_addr, uint8_t is_server) {
DEBUG_TRACE(DEBUG_CATEGORY_CONNECTION, "");
@ -2061,6 +2110,7 @@ int init_sockets(struct UTUN_INSTANCE* instance) {
fail_count++;
} else {
instance->stcp_server = tsrv;
tcp_socket_add(instance, server);
success_count++;
DEBUG_INFO(DEBUG_CATEGORY_ETCP, "TCP server %s on port %u", server->name, port);
}

15
src/transport_layer/etcp_connections.h

@ -317,6 +317,21 @@ struct ETCP_SOCKET* etcp_socket_add(struct UTUN_INSTANCE* instance, struct CFG_S
// удаляет сокет и освобождает ресурсы (грохает все его подключения и сокет)
void etcp_socket_remove(struct ETCP_SOCKET* conn);
// TCP socket descriptor (analogous to ETCP_SOCKET for UDP)
struct TCP_SOCKET {
struct TCP_SOCKET* next;
struct UTUN_INSTANCE* instance;
char name[MAX_CONN_NAME_LEN];
uint8_t sock_id;
uint8_t type; // CFG_SERVER_TYPE_*
struct sockaddr_storage local_addr;
struct sockaddr_storage interface_addr;
struct sockaddr_storage nat_addr;
};
struct TCP_SOCKET* tcp_socket_add(struct UTUN_INSTANCE* instance, struct CFG_SERVER* server);
void tcp_socket_remove(struct TCP_SOCKET* sock);
// connection functions
// создает новый канал связи для etcp подключения (ETCP_CONN)
struct ETCP_LINK* etcp_link_new(struct ETCP_CONN* etcp, struct ETCP_SOCKET* conn, struct sockaddr_storage* remote_addr, uint8_t is_server);

18
src/utun_instance.c

@ -129,6 +129,8 @@ static int instance_init_common(struct UTUN_INSTANCE* instance, struct UASYNC* u
// Initialize connection queue
instance->connections = queue_new(ua, 256, 0, 8, "connections");
if (!instance->connections) { DEBUG_ERROR(DEBUG_CATEGORY_ETCP, "Failed to create connections queue"); return -1; }
instance->tcp_connections = queue_new(ua, sizeof(struct tcp_conn_entry), sizeof(uint64_t), 8, "tcpconn");
if (!instance->tcp_connections) { DEBUG_ERROR(DEBUG_CATEGORY_ETCP, "Failed to create tcp_connections queue"); return -1; }
struct CFG_NETWORK *net = config->networks;
while (net) {
struct ll_entry *entry = queue_entry_new(sizeof(struct NETWORK_ENTRY));
@ -440,6 +442,22 @@ void utun_instance_destroy(struct UTUN_INSTANCE *instance) {
queue_free(instance->connections); instance->connections = NULL;
DEBUG_INFO(DEBUG_CATEGORY_MEMORY, "[INSTANCE_DESTROY] ETCP connections cleanup complete");
// Cleanup TCP connections (stcp_links)
if (instance->tcp_connections) {
struct ll_entry* entry = instance->tcp_connections->head;
while (entry) {
struct ll_entry* next = entry->next;
struct tcp_conn_entry* te = (struct tcp_conn_entry*)entry->data;
if (te && te->link) stcp_link_close(te->link);
entry = next;
}
}
queue_free(instance->tcp_connections); instance->tcp_connections = NULL;
DEBUG_INFO(DEBUG_CATEGORY_MEMORY, "[INSTANCE_DESTROY] TCP connections cleanup complete");
// Cleanup TCP sockets
while (instance->tcp_sockets) tcp_socket_remove(instance->tcp_sockets);
// Wait for all deferred callbacks (etcp_connection_free_deferred)
// to finish before destroying pools
while (instance->ua && instance->ua->immediate_queue_head)

24
src/utun_instance.h

@ -34,6 +34,7 @@ struct ROUTE_TABLE;
struct ETCP_CONN;
typedef void (*etcp_new_conn_fn)(struct ETCP_CONN* conn, void* arg);
struct ETCP_SOCKET;
struct TCP_SOCKET;
struct tun_if;
struct ETCP_BINDINGS;
struct ETCP_ROUTER_BINDINGS;
@ -61,6 +62,13 @@ struct conn_queue_entry {
struct ETCP_CONN* conn;
};
// Queue entry for instance->tcp_connections (indexed by node_id)
struct tcp_conn_entry {
uint64_t node_id; // index key
struct stcp_link* link; // active TCP link
struct ETCP_CONN* etcp_conn; // = stcp_link_get_etcp_conn(link) — for etcp_send() compat
};
// uTun instance configuration
struct UTUN_INSTANCE {
// Identification
@ -101,6 +109,7 @@ struct UTUN_INSTANCE {
// Connections (очередь всех подключений для instance)
struct ll_queue* connections; // indexed by peer_node_id (0=pending), data=conn_queue_entry
struct ll_queue* tcp_connections; // indexed by node_id, data=tcp_conn_entry [TCP-only]
// Callback chain for new ETCP connections
struct etcp_cbk_entry* new_conn_cbks;
@ -113,6 +122,7 @@ struct UTUN_INSTANCE {
// Active sockets (UDP)
struct ETCP_SOCKET* etcp_sockets;// linked-list
struct TCP_SOCKET* tcp_sockets; // linked-list [TCP-only]
struct stcp_server *stcp_server; // TCP server (single for now)
// Pending one-shot pings (for callback on PONG or timeout)
@ -177,6 +187,20 @@ void utun_instance_set_topo_group_enabled(int enabled);
// Diagnostic function for memory leak analysis
void utun_instance_diagnose_leaks(struct UTUN_INSTANCE* instance, const char* phase);
/* Find active connection by node_id — searches both UDP (connections) and TCP (tcp_connections) queues.
Returns ETCP_CONN* ready for etcp_send(), or NULL if not found. */
static inline struct ETCP_CONN* instance_find_conn(struct UTUN_INSTANCE* inst, uint64_t node_id) {
if (inst->connections) {
struct ll_entry* e = queue_find_data_by_index(inst->connections, (const uint8_t*)&node_id);
if (e) return ((struct conn_queue_entry*)e->data)->conn;
}
if (inst->tcp_connections) {
struct ll_entry* e = queue_find_data_by_index(inst->tcp_connections, (const uint8_t*)&node_id);
if (e) return ((struct tcp_conn_entry*)e->data)->etcp_conn;
}
return NULL;
}
#ifdef __cplusplus
}

1
tools/chatgui-android/app/src/main/cpp/CMakeLists.txt

@ -35,6 +35,7 @@ set_target_properties(utun_core PROPERTIES C_STANDARD 99 C_STANDARD_REQUIRED ON)
# JNI bridge + link into shared library
add_library(utun SHARED
${JNI_DIR}/android_jni_bridge.c
${JNI_DIR}/android_udp_log.c
$<TARGET_OBJECTS:utun_core>
)

1
tools/chatgui-android/app/src/main/java/com/utun/chat/ChatApplication.kt

@ -18,7 +18,6 @@ class ChatApplication : Application() {
if (configProvider.isFirstLaunch()) {
kotlinx.coroutines.runBlocking {
LogManager.addLog("INFO", "APP", "First launch — configuring")
configProvider.generateKeys()
configProvider.detectInterfaces()
configProvider.markLaunched()
LogManager.addLog("INFO", "APP", "First launch done, ${configProvider.loadServers().size} interfaces detected")

10
tools/chatgui-android/app/src/main/java/com/utun/chat/MainActivity.kt

@ -7,14 +7,12 @@ import androidx.activity.compose.setContent
import androidx.compose.runtime.*
import androidx.core.content.ContextCompat
import androidx.lifecycle.viewmodel.compose.viewModel
import com.utun.chat.data.ChatRepository
import com.utun.chat.data.InviteData
import com.utun.chat.data.NativeLib
import com.utun.chat.headless.HeadlessService
import com.utun.chat.ui.screens.*
import com.utun.chat.viewmodel.ChatViewModel
import android.content.Intent
import java.io.File
class MainActivity : ComponentActivity() {
enum class Screen { ChannelList, Chat, Settings, Logs, QrScan }
@ -25,11 +23,9 @@ class MainActivity : ComponentActivity() {
/* Start uTun headless service (must be from foreground Activity on API 34+) */
ContextCompat.startForegroundService(this, Intent(this, HeadlessService::class.java))
val dbFile = File(filesDir, "chats.db")
val repo = ChatRepository(dbFile.absolutePath)
setContent {
val vm: ChatViewModel = viewModel(factory = ChatViewModel.Factory(repo))
val vm: ChatViewModel = viewModel(factory = ChatViewModel.Factory())
var screen by remember { mutableStateOf(Screen.ChannelList) }
var qrResult by remember { mutableStateOf<String?>(null) }
var showJoinDialog by remember { mutableStateOf(false) }
@ -73,7 +69,7 @@ class MainActivity : ComponentActivity() {
)
}
}
Screen.Settings -> SettingsScreen(onBack = { screen = Screen.ChannelList })
Screen.Settings -> SettingsScreen(vm = vm, onBack = { screen = Screen.ChannelList })
Screen.Logs -> LogScreen(onBack = { screen = Screen.ChannelList })
Screen.QrScan -> {
QrScanScreen(

5
tools/chatgui-android/app/src/main/java/com/utun/chat/data/ChatRepository.kt

@ -12,9 +12,6 @@ class ChatRepository(dbPath: String) {
private var myNodeId: Long? = null
init {
val f = java.io.File(dbPath)
var tries = 0
while (tries < 50 && !f.exists()) { Thread.sleep(100); tries++ }
db = SQLiteDatabase.openDatabase(dbPath, null, SQLiteDatabase.OPEN_READONLY)
try {
db.rawQuery("SELECT node_id FROM local_identity WHERE id=1", null).use { cur ->
@ -99,6 +96,8 @@ class ChatRepository(dbPath: String) {
fun connectChannel(channelId: String) = NativeLib.connectChannel(channelId)
fun isReady() = NativeLib.isReady()
fun close() { db.close() }
companion object {
fun msgTableName(chId: String): String = "msg_" + sanitize(chId)
fun peersTableName(chId: String): String = "peers_" + sanitize(chId)

90
tools/chatgui-android/app/src/main/java/com/utun/chat/data/ConfigProvider.kt

@ -17,6 +17,7 @@ import java.net.Inet4Address
import java.net.Inet6Address
import java.net.InetAddress
import java.net.NetworkInterface
import java.io.File
import java.util.UUID
private val Context.dataStore by preferencesDataStore("utun_config")
@ -32,12 +33,40 @@ class ConfigProvider(private val context: Context) {
private val debugConsoleLevel = stringPreferencesKey("debug_console_level")
private val debugLogFile = stringPreferencesKey("debug_log_file")
private val debugCategories = stringPreferencesKey("debug_categories")
private val logUdpIp = stringPreferencesKey("log_udp_ip")
private val logUdpPort = intPreferencesKey("log_udp_port")
private val serversJson = stringPreferencesKey("servers")
private val firstLaunchDone = booleanPreferencesKey("first_launch_done")
private val gson = Gson()
private val random = java.util.concurrent.ThreadLocalRandom.current()
private fun keysFilePath(): String {
val dir = runBlocking { context.dataStore.data.first()[dbPath] } ?: context.filesDir.absolutePath
return "$dir/keys.conf"
}
fun deleteKeysFile() {
File(keysFilePath()).delete()
}
private fun readKeysFromFile(): Pair<String, String>? {
val f = File(keysFilePath())
if (!f.exists()) return null
try {
val lines = f.readLines()
var pub = ""; var priv = ""
for (l in lines) {
when {
l.startsWith("public_key=") -> pub = l.removePrefix("public_key=").trim()
l.startsWith("private_key=") -> priv = l.removePrefix("private_key=").trim()
}
}
if (pub.length == 64 && priv.length == 64) return Pair(pub, priv)
} catch (_: Exception) {}
return null
}
fun getDeviceName(): String = Build.MODEL.ifEmpty { "Android" }
val allValues: Flow<Map<String, String>> = context.dataStore.data.map { prefs ->
@ -47,10 +76,12 @@ class ConfigProvider(private val context: Context) {
"node.name" to (prefs[nodeName] ?: getDeviceName()),
"node.listen_port" to (prefs[nodeListenPort]?.toString() ?: "12345"),
"control.port" to (prefs[controlPort]?.toString() ?: "9999"),
"db.path" to (prefs[dbPath] ?: "utun_chat.db"),
"db.path" to (prefs[dbPath] ?: context.filesDir.absolutePath),
"debug.console_level" to (prefs[debugConsoleLevel] ?: "info"),
"debug.log_file" to (prefs[debugLogFile] ?: "utun.log"),
"debug.categories" to (prefs[debugCategories] ?: "")
"debug.categories" to (prefs[debugCategories] ?: ""),
"log_udp.ip" to (prefs[logUdpIp] ?: ""),
"log_udp.port" to (prefs[logUdpPort]?.toString() ?: "0")
)
}
@ -69,14 +100,15 @@ class ConfigProvider(private val context: Context) {
}
}
key == "servers.count" -> loadServers().size.toString()
key == "node.private_key" -> context.dataStore.data.first()[nodePrivateKey]
key == "node.public_key" -> context.dataStore.data.first()[nodePublicKey]
key == "node.private_key" -> readKeysFromFile()?.second ?: context.dataStore.data.first()[nodePrivateKey]
key == "node.public_key" -> readKeysFromFile()?.first ?: context.dataStore.data.first()[nodePublicKey]
key == "node.name" -> context.dataStore.data.first()[nodeName] ?: getDeviceName()
key == "db.path" -> context.dataStore.data.first()[dbPath] ?: "utun_chat.db"
key == "db.path" -> context.dataStore.data.first()[dbPath] ?: context.filesDir.absolutePath
key == "control.bind_ip" -> context.dataStore.data.first()[controlBindIp] ?: "127.0.0.1"
key == "debug.console_level" -> context.dataStore.data.first()[debugConsoleLevel] ?: "info"
key == "debug.log_file" -> context.dataStore.data.first()[debugLogFile] ?: "utun.log"
key == "debug.categories" -> context.dataStore.data.first()[debugCategories] ?: ""
key == "log_udp.ip" -> context.dataStore.data.first()[logUdpIp] ?: "192.168.40.250"
else -> null
}
}
@ -97,6 +129,7 @@ class ConfigProvider(private val context: Context) {
key == "servers.count" -> loadServers().size
key == "node.listen_port" -> context.dataStore.data.first()[nodeListenPort] ?: 12345
key == "control.port" -> context.dataStore.data.first()[controlPort] ?: 9999
key == "log_udp.port" -> context.dataStore.data.first()[logUdpPort] ?: 9999
else -> 0
}
}
@ -114,17 +147,15 @@ class ConfigProvider(private val context: Context) {
"debug.console_level" -> prefs[debugConsoleLevel] = value
"debug.log_file" -> prefs[debugLogFile] = value
"debug.categories" -> prefs[debugCategories] = value
"log_udp.ip" -> prefs[logUdpIp] = value
"log_udp.port" -> prefs[logUdpPort] = value.toIntOrNull() ?: 0
}
}
}
suspend fun generateKeys() {
val priv = "priv_" + (1..64).map { "0123456789abcdef".random() }.joinToString("")
val pub = "pub_" + (1..64).map { "0123456789abcdef".random() }.joinToString("")
context.dataStore.edit { prefs ->
prefs[nodePrivateKey] = priv
prefs[nodePublicKey] = pub
}
/* Keys are generated in C (instance_lite via ensure_keys).
* They are saved back via NativeLib.start() → nativeGetGeneratedKeys(). */
}
private companion object {
@ -216,4 +247,41 @@ class ConfigProvider(private val context: Context) {
if (list.isEmpty()) list.add("lo" to "127.0.0.1")
list
}
/** Build full INI config text for NativeLib.start() */
fun buildConfigText(): String {
val pubKey = getString("node.public_key") ?: ""
val privKey = getString("node.private_key") ?: ""
val nodeName = getString("node.name") ?: getDeviceName()
val listenPort = getInt("node.listen_port")
val dbDir = getString("db.path") ?: context.filesDir.absolutePath
return buildString {
appendLine("[global]")
if (nodeName.isNotBlank()) appendLine("my_node_name=$nodeName")
if (pubKey.length == 64) appendLine("my_public_key=$pubKey")
if (privKey.length == 64) appendLine("my_private_key=$privKey")
appendLine("db_path=$dbDir")
appendLine("db_sync_enabled=1")
appendLine()
appendLine("[server:main]")
appendLine("addr=0.0.0.0:$listenPort")
appendLine()
appendLine("[allowed_keys]")
appendLine("allow_all=yes")
appendLine()
appendLine("[ntp]")
appendLine("enabled=no")
appendLine()
appendLine("[debug]")
appendLine("console_level=info")
val udpIp = getString("log_udp.ip") ?: ""
val udpPort = getInt("log_udp.port")
if (udpIp.isNotEmpty() && udpPort > 0) {
appendLine()
appendLine("[log_udp]")
appendLine("ip=$udpIp")
appendLine("port=$udpPort")
}
}
}
}

66
tools/chatgui-android/app/src/main/java/com/utun/chat/data/InviteLink.kt

@ -1,24 +1,30 @@
package com.utun.chat.data
import android.util.Base64
import com.utun.chat.data.LogManager
import java.security.MessageDigest
const val INVITE_LINK_VERSION: Int = 0x01
const val INVITE_PUBKEY_SIZE: Int = 32
const val INVITE_PROTO_UDP: Int = 0x01
const val INVITE_PROTO_TCP: Int = 0x02
const val INVITE_PROTO_BOTH: Int = 0x03
data class InviteAddr(
val family: Int, // 4 or 6
val address: ByteArray,
val port: Int,
val socketId: Int
val socketId: Int,
val proto: Int // INVITE_PROTO_UDP/TCP/BOTH
) {
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (other !is InviteAddr) return false
return family == other.family && address.contentEquals(other.address) &&
port == other.port && socketId == other.socketId
port == other.port && socketId == other.socketId && proto == other.proto
}
override fun hashCode(): Int = family * 31 + address.contentHashCode() + port * 31 + socketId
override fun hashCode(): Int = family * 31 + address.contentHashCode() + port * 31 + socketId * 31 + proto
}
data class InviteData(
@ -27,14 +33,15 @@ data class InviteData(
val nodeId: Long,
val addrs: List<InviteAddr>
) {
/** Serialize addresses for C bridge: family(1) + socketId(1) + address(4|16) + port(2 BE) */
/** Serialize addresses for C bridge: family(1) + socketId(1) + proto(1) + address(4|16) + port(2 BE) */
fun serializeAddrs(): ByteArray {
val size = addrs.fold(0) { acc, a -> acc + if (a.family == 4) 8 else 20 }
val size = addrs.fold(0) { acc, a -> acc + if (a.family == 4) 9 else 21 }
val buf = ByteArray(size)
var pos = 0
for (a in addrs) {
buf[pos] = a.family.toByte(); pos++
buf[pos] = a.socketId.toByte(); pos++
buf[pos] = a.proto.toByte(); pos++
val ipLen = if (a.family == 4) 4 else 16
System.arraycopy(a.address, 0, buf, pos, ipLen); pos += ipLen
buf[pos] = ((a.port shr 8) and 0xFF).toByte(); pos++
@ -65,17 +72,32 @@ object InviteLink {
}
fun decode(link: String): InviteData? {
if (!link.startsWith(PREFIX)) return null
LogManager.addLog("DEBUG", "INVITE", "decode: ${link.take(80)}")
if (!link.startsWith(PREFIX)) {
LogManager.addLog("WARN", "INVITE", "decode: missing utun:// prefix, len=${link.length}")
return null
}
val b64 = link.substring(PREFIX.length)
LogManager.addLog("DEBUG", "INVITE", "decode: base64 len=${b64.length}")
val raw: ByteArray
try {
raw = Base64.decode(link.substring(PREFIX.length), Base64.DEFAULT)
raw = Base64.decode(b64, Base64.DEFAULT)
} catch (e: Exception) {
LogManager.addLog("ERROR", "INVITE", "decode: base64 failed: ${e.message}")
return null
}
LogManager.addLog("DEBUG", "INVITE", "decode: raw=${raw.size}B ver=${raw[0].toInt() and 0xFF}")
if (raw.size < 11) {
LogManager.addLog("ERROR", "INVITE", "decode: raw too short (${raw.size} < 11)")
return null
}
if (raw.size < 11) return null
var off = 0
if ((raw[off].toInt() and 0xFF) != INVITE_LINK_VERSION) return null
if ((raw[off].toInt() and 0xFF) != INVITE_LINK_VERSION) {
LogManager.addLog("ERROR", "INVITE", "decode: wrong version 0x%02x expected 0x%02x".format(
raw[off].toInt() and 0xFF, INVITE_LINK_VERSION))
return null
}
off++
var chId = 0L
@ -85,6 +107,8 @@ object InviteLink {
}
off += 8
LogManager.addLog("DEBUG", "INVITE", "decode: chId=0x%016x".format(chId))
var pubkey: ByteArray? = null
val addrs = mutableListOf<InviteAddr>()
var firstBlock = true
@ -104,24 +128,38 @@ object InviteLink {
for (j in 0 until cnt) {
val isV6 = ((header shr (2 + j)) and 1) != 0
val ipLen = if (isV6) 16 else 4
if (off + 1 + ipLen + 2 > raw.size) return null
if (off + 2 + ipLen + 2 > raw.size) return null
val sockId = raw[off].toInt() and 0xFF; off++
val proto = raw[off].toInt() and 0xFF; off++
val ip = raw.copyOfRange(off, off + ipLen); off += ipLen
val port = ((raw[off].toInt() and 0xFF) shl 8) or (raw[off + 1].toInt() and 0xFF); off += 2
addrs.add(InviteAddr(family = if (isV6) 6 else 4, address = ip, port = port, socketId = sockId))
val addr = InviteAddr(family = if (isV6) 6 else 4, address = ip, port = port, socketId = sockId, proto = proto)
addrs.add(addr)
LogManager.addLog("DEBUG", "INVITE", "decode: ${addrToString(addr)}")
}
}
if (pubkey == null || pubkey.size != INVITE_PUBKEY_SIZE) return null
val nodeId = deriveNodeId(pubkey)
val pkHex = pubkey.take(8).joinToString("") { "%02x".format(it) }
LogManager.addLog("INFO", "INVITE", "decode: ch=0x%016x node=0x%016x pk=%s... addrs=%d".format(
chId, nodeId, pkHex, addrs.size))
return InviteData(channelId = chId, pubkey = pubkey, nodeId = nodeId, addrs = addrs)
}
fun addrToString(addr: InviteAddr): String {
if (addr.family == 4 && addr.address.size == 4) {
val protoStr = when (addr.proto) {
INVITE_PROTO_UDP -> "UDP"
INVITE_PROTO_TCP -> "TCP"
INVITE_PROTO_BOTH -> "UDP+TCP"
else -> "?${addr.proto}"
}
val ip = if (addr.family == 4 && addr.address.size == 4) {
val b = addr.address
return "${b[0].toInt() and 0xFF}.${b[1].toInt() and 0xFF}.${b[2].toInt() and 0xFF}.${b[3].toInt() and 0xFF}:${addr.port}"
"${b[0].toInt() and 0xFF}.${b[1].toInt() and 0xFF}.${b[2].toInt() and 0xFF}.${b[3].toInt() and 0xFF}:${addr.port}"
} else {
"ipv6:${addr.address.joinToString("") { "%02x".format(it) }}:${addr.port}"
}
return "ipv6:${addr.address.joinToString("") { "%02x".format(it) }}:${addr.port}"
return "$protoStr $ip sock=${addr.socketId}"
}
}

20
tools/chatgui-android/app/src/main/java/com/utun/chat/data/NativeLib.kt

@ -7,7 +7,6 @@ interface ChatEventCallback {
}
object NativeLib {
private var callbacksSet = false
private var running = false
init {
@ -16,14 +15,11 @@ object NativeLib {
/** Save Kotlin callbacks to C globals (log, config). Must be called before start(). */
fun init(dbPath: String, controlPort: Int): Boolean {
if (callbacksSet) return true
val ok = nativeInit(
return nativeInit(
dbPath, controlPort,
ChatApplication.instance.configProvider,
LogManager
)
if (ok) callbacksSet = true
return ok
}
/** Start full uTun instance from INI config text */
@ -48,13 +44,13 @@ object NativeLib {
fun destroy() {
nativeDestroy()
callbacksSet = false
running = false
}
fun restart(dbPath: String, controlPort: Int): Boolean {
destroy()
return init(dbPath, controlPort)
fun restart(dbPath: String, controlPort: Int, configText: String): Boolean {
stop()
init(dbPath, controlPort)
return start(configText)
}
fun isReady(): Boolean = running
@ -68,10 +64,13 @@ object NativeLib {
fun connectChannel(channelId: String) { nativeConnectChannel(channelId) }
fun getChannels(): String = nativeGetChannels() ?: "[]"
fun getMessages(channelId: String, limit: Int = 50): String = nativeGetMessages(channelId, limit) ?: "[]"
fun clearDatabase(): Boolean = nativeClearDatabase()
fun setDebugLevel(category: String, level: String) { nativeSetDebugLevel(category, level) }
/** Enable/disable forwarding native C logs to LogManager (expensive, off by default) */
fun subscribeNativeLogs(enabled: Boolean) { nativeSubscribeLogs(enabled) }
fun setUdpLogTarget(ip: String, port: Int) { nativeSetUdpLogTarget(ip, port) }
fun regenerateKeys() { nativeRegenerateKeys() }
private external fun nativeInit(dbPath: String, controlPort: Int, config: Any, logCb: Any): Boolean
private external fun nativeStart(configText: String): Boolean
@ -87,4 +86,7 @@ object NativeLib {
private external fun nativeGetMessages(channelId: String, limit: Int): String?
private external fun nativeSetDebugLevel(category: String, level: String)
private external fun nativeSubscribeLogs(enabled: Boolean)
private external fun nativeSetUdpLogTarget(ip: String, port: Int)
private external fun nativeRegenerateKeys()
private external fun nativeClearDatabase(): Boolean
}

27
tools/chatgui-android/app/src/main/java/com/utun/chat/headless/HeadlessService.kt

@ -33,36 +33,13 @@ class HeadlessService : Service() {
startForeground(1, notification)
val provider = ChatApplication.instance.configProvider
val dbDir = filesDir.absolutePath
val pubKey = provider.getString("node.public_key") ?: ""
val privKey = provider.getString("node.private_key") ?: ""
val nodeName = provider.getString("node.name") ?: provider.getDeviceName()
val dbDir = provider.getString("db.path") ?: filesDir.absolutePath
val listenPort = provider.getInt("node.listen_port")
val configText = buildString {
appendLine("[global]")
if (nodeName.isNotBlank()) appendLine("my_node_name=$nodeName")
if (pubKey.length == 64) appendLine("my_public_key=$pubKey")
if (privKey.length == 64) appendLine("my_private_key=$privKey")
appendLine("db_path=$dbDir")
appendLine("db_sync_enabled=1")
appendLine()
appendLine("[server:main]")
appendLine("addr=0.0.0.0:$listenPort")
appendLine()
appendLine("[allowed_keys]")
appendLine("allow_all=yes")
appendLine()
appendLine("[ntp]")
appendLine("enabled=no")
appendLine()
appendLine("[debug]")
appendLine("console_level=info")
}
val configText = provider.buildConfigText()
LogManager.addLog("INFO", "SRV", "uTun service starting, port=$listenPort db=$dbDir")
/* Init callbacks first (log + config) — required before start */
NativeLib.init(dbDir, 9999)
val ok = NativeLib.start(configText)

3
tools/chatgui-android/app/src/main/java/com/utun/chat/ui/screens/JoinChannelDialog.kt

@ -14,6 +14,7 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.utun.chat.data.InviteData
import com.utun.chat.data.InviteLink
import com.utun.chat.data.LogManager
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
@ -46,6 +47,8 @@ fun JoinChannelDialog(
status = "Connecting to peer..."
delay(800)
LogManager.addLog("INFO", "INVITE", "connect: ch=0x%016x node=0x%016x addrs=%d"
.format(d.channelId, d.nodeId, d.addrs.size))
onConnect(d)
} else {
connecting = false

106
tools/chatgui-android/app/src/main/java/com/utun/chat/ui/screens/SettingsScreen.kt

@ -10,6 +10,7 @@ import androidx.compose.material.icons.filled.Add
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material.icons.filled.ArrowDropDown
import androidx.compose.material.icons.filled.Close
import androidx.compose.material.icons.filled.Delete
import androidx.compose.material3.*
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier
@ -18,7 +19,10 @@ import androidx.compose.ui.unit.dp
import com.utun.chat.ChatApplication
import com.utun.chat.data.NativeLib
import com.utun.chat.data.ServerEntry
import com.utun.chat.viewmodel.ChatViewModel
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.util.UUID
private val LEVELS = listOf("NONE", "ERROR", "WARN", "INFO", "DEBUG", "TRACE")
@ -32,7 +36,7 @@ private val PROTOCOLS = listOf("tcp", "udp")
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun SettingsScreen(onBack: () -> Unit) {
fun SettingsScreen(vm: ChatViewModel, onBack: () -> Unit) {
val provider = ChatApplication.instance.configProvider
val scope = rememberCoroutineScope()
var dirty by remember { mutableStateOf(false) }
@ -45,10 +49,15 @@ fun SettingsScreen(onBack: () -> Unit) {
var dbPath by remember { mutableStateOf("") }
var debugLevel by remember { mutableStateOf("info") }
var logFile by remember { mutableStateOf("") }
var pubKey by remember { mutableStateOf("") }
var logUdpIp by remember { mutableStateOf("") }
var logUdpPort by remember { mutableStateOf("") }
val pubKey by vm.pubKey.collectAsState()
val generatingKeys by vm.generatingKeys.collectAsState()
var showDebugCategories by remember { mutableStateOf(false) }
var showOverwriteKeys by remember { mutableStateOf(false) }
var showClearDb by remember { mutableStateOf(false) }
var clearingDb by remember { mutableStateOf(false) }
var catLevels by remember { mutableStateOf<Map<String, String>>(emptyMap()) }
var servers by remember { mutableStateOf<List<ServerEntry>>(emptyList()) }
@ -64,7 +73,12 @@ fun SettingsScreen(onBack: () -> Unit) {
dbPath = provider.getString("db.path") ?: "utun_chat.db"
debugLevel = provider.getString("debug.console_level") ?: "info"
logFile = provider.getString("debug.log_file") ?: "utun.log"
pubKey = provider.getString("node.public_key") ?: "Not generated"
logUdpIp = provider.getString("log_udp.ip") ?: "192.168.40.250"
logUdpPort = provider.getInt("log_udp.port").toString().let { if (it == "0") "9999" else it }
val port = logUdpPort.toIntOrNull() ?: 0
if (logUdpIp.isNotEmpty() && port > 0) {
NativeLib.setUdpLogTarget(logUdpIp, port)
}
val stored = provider.getString("debug.categories") ?: ""
catLevels = if (stored.isNotEmpty()) {
stored.split(",").associate { pair ->
@ -102,9 +116,12 @@ fun SettingsScreen(onBack: () -> Unit) {
val handleBack = {
if (dirty) {
val path = provider.getString("db.path") ?: "utun_chat.db"
val port = provider.getInt("control.port")
NativeLib.restart(path, port)
scope.launch(Dispatchers.IO) {
val path = provider.getString("db.path") ?: "utun_chat.db"
val port = provider.getInt("control.port")
val configText = provider.buildConfigText()
NativeLib.restart(path, port, configText)
}
}
onBack()
}
@ -165,12 +182,19 @@ fun SettingsScreen(onBack: () -> Unit) {
Text("Keys", style = MaterialTheme.typography.titleMedium)
OutlinedTextField(pubKey, {}, label = { Text("Public Key") }, readOnly = true, singleLine = true)
Button(onClick = {
val hasKey = pubKey.isNotEmpty() && pubKey != "Not generated" && pubKey != ""
if (hasKey) showOverwriteKeys = true
else { dirty = true; scope.launch { provider.generateKeys(); pubKey = provider.getString("node.public_key") ?: "" } }
}) {
Text("Generate Keys")
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
Button(onClick = {
if (pubKey.length == 64) showOverwriteKeys = true
else { dirty = true; vm.requestRegenerateKeys() }
}, enabled = !generatingKeys) {
Text(if (generatingKeys) "Generating..." else "Generate Keys")
}
Button(onClick = { showClearDb = true },
colors = ButtonDefaults.buttonColors(containerColor = MaterialTheme.colorScheme.error)) {
Icon(Icons.Default.Delete, null, modifier = Modifier.size(18.dp))
Spacer(Modifier.width(4.dp))
Text("Clear DB")
}
}
HorizontalDivider(Modifier.padding(vertical = 8.dp))
@ -274,6 +298,32 @@ fun SettingsScreen(onBack: () -> Unit) {
OutlinedTextField(logFile, { v -> logFile = v; scope.launch { provider.setValue("debug.log_file", v) } },
label = { Text("Log File") }, singleLine = true)
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
OutlinedTextField(logUdpIp, { v ->
logUdpIp = v
scope.launch { provider.setValue("log_udp.ip", v) }
val port = logUdpPort.toIntOrNull() ?: 0
if (v.isNotEmpty() && port > 0) NativeLib.setUdpLogTarget(v, port)
else NativeLib.setUdpLogTarget("", 0)
},
label = { Text("UDP Log IP") },
modifier = Modifier.weight(1f).heightIn(min = 40.dp),
singleLine = true)
OutlinedTextField(logUdpPort, { v ->
logUdpPort = v
val port = v.toIntOrNull() ?: 0
scope.launch { provider.setValue("log_udp.port", v) }
if (logUdpIp.isNotEmpty() && port > 0 && port <= 65535)
NativeLib.setUdpLogTarget(logUdpIp, port)
else
NativeLib.setUdpLogTarget("", 0)
},
label = { Text("Port") },
modifier = Modifier.width(80.dp).heightIn(min = 40.dp),
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number),
singleLine = true)
}
Row(modifier = Modifier.fillMaxWidth().clickable { showDebugCategories = !showDebugCategories },
horizontalArrangement = Arrangement.SpaceBetween) {
Text("Categories", style = MaterialTheme.typography.titleMedium)
@ -301,7 +351,7 @@ fun SettingsScreen(onBack: () -> Unit) {
Button(onClick = {
showOverwriteKeys = false
dirty = true
scope.launch { provider.generateKeys(); pubKey = provider.getString("node.public_key") ?: "" }
vm.requestRegenerateKeys()
}) { Text("Overwrite") }
},
dismissButton = {
@ -309,6 +359,36 @@ fun SettingsScreen(onBack: () -> Unit) {
}
)
}
if (showClearDb) {
AlertDialog(
onDismissRequest = { showClearDb = false },
title = { Text("Clear Database?") },
text = { Text("This will delete all channels, messages, and peers.\nThis cannot be undone.") },
confirmButton = {
Button(onClick = {
showClearDb = false
clearingDb = true
scope.launch(Dispatchers.IO) {
vm.clearState()
NativeLib.stop()
NativeLib.clearDatabase()
val path = provider.getString("db.path") ?: ""
val port = provider.getInt("control.port")
val configText = provider.buildConfigText()
NativeLib.restart(path, port, configText)
withContext(Dispatchers.Main) { clearingDb = false }
}
}, enabled = !clearingDb,
colors = ButtonDefaults.buttonColors(containerColor = MaterialTheme.colorScheme.error)) {
Text("Delete All")
}
},
dismissButton = {
TextButton(onClick = { showClearDb = false }) { Text("Cancel") }
}
)
}
}
@OptIn(ExperimentalMaterial3Api::class)

134
tools/chatgui-android/app/src/main/java/com/utun/chat/viewmodel/ChatViewModel.kt

@ -3,13 +3,17 @@ package com.utun.chat.viewmodel
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.viewModelScope
import com.utun.chat.ChatApplication
import com.utun.chat.data.*
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.*
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
class ChatViewModel(private val repo: ChatRepository) : ViewModel() {
class ChatViewModel : ViewModel() {
private var repo: ChatRepository? = null
private val _channels = MutableStateFlow<List<Channel>>(emptyList())
val channels: StateFlow<List<Channel>> = _channels
@ -20,83 +24,133 @@ class ChatViewModel(private val repo: ChatRepository) : ViewModel() {
private val _currentChannel = MutableStateFlow<Channel?>(null)
val currentChannel: StateFlow<Channel?> = _currentChannel
private val _pubKey = MutableStateFlow("")
val pubKey: StateFlow<String> = _pubKey
private val _generatingKeys = MutableStateFlow(false)
val generatingKeys: StateFlow<Boolean> = _generatingKeys
init {
NativeLib.setEventCallback(object : ChatEventCallback {
override fun onEvent(type: Int, data: ByteArray?) {
when (type) {
1 -> { /* MSG_RECEIVED: [ch_id_len:1][ch_id:var][author:8] */
if (data != null && data.size >= 2) {
val chLen = data[0].toInt() and 0xFF
if (data.size >= 1 + chLen) {
val chId = String(data, 1, chLen)
val cur = _currentChannel.value
if (cur != null && cur.id == chId) refreshMessages(chId)
refreshChannels()
}
}
}
8 -> refreshChannels() /* CHANNEL_PEERS_ONLINE */
2 -> { /* CONNECT_RESULT: [node_id:8][result:4][channel_id:8] */
if (data != null && data.size >= 20) {
val buf = java.nio.ByteBuffer.wrap(data).order(java.nio.ByteOrder.LITTLE_ENDIAN)
val nodeId = buf.getLong()
val result = buf.getInt()
val chId = buf.getLong()
LogManager.addLog(
if (result == 0) "INFO" else "ERROR",
"JOIN", "connect to 0x%016x ch=$chId result=$result".format(nodeId))
if (result == 0) refreshChannels()
}
}
4 -> refreshChannels() /* CHANNEL_UPDATED */
override fun onEvent(type: Int, data: ByteArray?) = handleEvent(type, data)
})
viewModelScope.launch(Dispatchers.IO) {
val key = ChatApplication.instance.configProvider.getString("node.public_key")
if (key != null && key.length == 64) _pubKey.value = key
}
}
private fun handleEvent(type: Int, data: ByteArray?) {
when (type) {
9 -> { /* DB_READY */
if (repo != null) return
val dbDir = ChatApplication.instance.configProvider.getString("db.path") ?: ""
if (dbDir.isEmpty()) return
repo = ChatRepository("$dbDir/chats.db")
refreshChannels()
}
11 -> { /* KEYS_GENERATED: [pub_hex:64] */
if (data != null && data.size >= 64) {
_pubKey.value = String(data, 0, 64)
_generatingKeys.value = false
}
}
})
refreshChannels()
1 -> { /* MSG_RECEIVED: [ch_id_len:1][ch_id:var][author:8] */
if (repo == null || data == null || data.size < 2) return
val chLen = data[0].toInt() and 0xFF
if (data.size >= 1 + chLen) {
val chId = String(data, 1, chLen)
val cur = _currentChannel.value
if (cur != null && cur.id == chId) refreshMessages(chId)
refreshChannels()
}
}
8 -> if (repo != null) refreshChannels() /* CHANNEL_PEERS_ONLINE */
2 -> { /* CONNECT_RESULT: [node_id:8][result:4][channel_id:8] */
if (repo == null || data == null || data.size < 20) return
val buf = java.nio.ByteBuffer.wrap(data).order(java.nio.ByteOrder.LITTLE_ENDIAN)
val nodeId = buf.getLong()
val result = buf.getInt()
val chId = buf.getLong()
LogManager.addLog(
if (result == 0) "INFO" else "ERROR",
"JOIN", "connect to 0x%016x ch=$chId result=$result".format(nodeId))
if (result == 0) refreshChannels()
}
4 -> if (repo != null) refreshChannels() /* CHANNEL_UPDATED */
}
}
fun requestRegenerateKeys() {
_generatingKeys.value = true
NativeLib.regenerateKeys()
viewModelScope.launch {
delay(5000)
if (_generatingKeys.value) {
_generatingKeys.value = false
LogManager.addLog("ERROR", "KEYS", "key regeneration timeout")
}
}
}
fun refreshChannels() {
val r = repo ?: return
viewModelScope.launch {
_channels.value = withContext(Dispatchers.IO) { repo.getChannels() }
_channels.value = withContext(Dispatchers.IO) { r.getChannels() }
}
}
fun refreshMessages(chId: String) {
val r = repo ?: return
viewModelScope.launch {
_messages.value = withContext(Dispatchers.IO) { repo.getMessages(chId) }
_messages.value = withContext(Dispatchers.IO) { r.getMessages(chId) }
}
}
fun selectChannel(channel: Channel) {
val r = repo ?: return
_currentChannel.value = channel
repo.connectChannel(channel.id)
r.connectChannel(channel.id)
refreshMessages(channel.id)
}
fun sendMessage(text: String) {
val r = repo ?: return
val ch = _currentChannel.value ?: return
repo.sendMessage(ch.id, text)
r.sendMessage(ch.id, text)
viewModelScope.launch {
_messages.value = withContext(Dispatchers.IO) { repo.getMessages(ch.id) }
_messages.value = withContext(Dispatchers.IO) { r.getMessages(ch.id) }
refreshChannels()
}
}
fun createChannel(name: String, channelId: String) {
repo.createChannel(name, channelId)
val r = repo ?: return
r.createChannel(name, channelId)
refreshChannels()
}
fun connectNode(address: String, port: Int, pubkeyHex: String) {
repo.connectNode(address, port, pubkeyHex)
val r = repo ?: return
r.connectNode(address, port, pubkeyHex)
}
fun joinChannel(channelId: Long, nodeId: Long, pubkey: ByteArray, addrs: ByteArray, addrCount: Int) {
repo.joinChannel(channelId, nodeId, pubkey, addrs, addrCount)
val r = repo ?: return
r.joinChannel(channelId, nodeId, pubkey, addrs, addrCount)
}
fun clearState() {
repo?.close()
repo = null
_channels.value = emptyList()
_messages.value = emptyList()
_currentChannel.value = null
_generatingKeys.value = false
}
class Factory(private val repo: ChatRepository) : ViewModelProvider.Factory {
class Factory : ViewModelProvider.Factory {
@Suppress("UNCHECKED_CAST")
override fun <T : ViewModel> create(modelClass: Class<T>): T = ChatViewModel(repo) as T
override fun <T : ViewModel> create(modelClass: Class<T>): T = ChatViewModel() as T
}
}

75
tools/chatgui-android/jni_bridge/android_jni_bridge.c

@ -7,16 +7,19 @@
* - Chat events → JNI callback → Kotlin
*/
#include "android_jni_bridge.h"
#include "android_udp_log.h"
#include "../libutun_lite/utun_config_api.h"
#include "../libutun_lite/invite_link_c.h"
#include "../libutun_lite/instance_lite.h"
#include "../../../lib/debug_config.h"
#include "../../../lib/u_async.h"
#include "../../../lib/mem.h"
#include "../../../lib/sqlite3.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <unistd.h>
#ifdef __ANDROID__
#include <jni.h>
@ -82,6 +85,7 @@ static void bridge_debug_hook(int level, const char* category, const char* messa
#else
fprintf(stderr, "[%s] %s\n", category ? category : "?", message ? message : "");
#endif
udp_log_write(message, (int)strlen(message));
if (g_on_log) g_on_log(level, category, message);
}
@ -232,6 +236,7 @@ static jobject g_config_callback = NULL;
static jobject g_log_callback = NULL;
static jobject g_event_callback = NULL;
static jmethodID g_event_mid = NULL;
static char g_db_path[512];
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved) {
(void)reserved;
@ -244,15 +249,23 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved) {
static void jni_on_log(int level, const char* category, const char* message) {
if (!g_jvm || !g_log_callback || !category || !message) return;
JNIEnv* env = NULL;
if ((*g_jvm)->GetEnv(g_jvm, (void**)&env, JNI_VERSION_1_6) != JNI_OK) return;
int attached = 0;
jint res = (*g_jvm)->GetEnv(g_jvm, (void**)&env, JNI_VERSION_1_6);
if (res == JNI_EDETACHED) {
if ((*g_jvm)->AttachCurrentThread(g_jvm, &env, NULL) != JNI_OK) return;
attached = 1;
} else if (res != JNI_OK) {
return;
}
jclass cls = (*env)->GetObjectClass(env, g_log_callback);
jmethodID mid = (*env)->GetMethodID(env, cls, "onNativeLog", "(ILjava/lang/String;Ljava/lang/String;)V");
if (!mid) return;
if (!mid) { if (attached) (*g_jvm)->DetachCurrentThread(g_jvm); return; }
jstring jcat = (*env)->NewStringUTF(env, category);
jstring jmsg = (*env)->NewStringUTF(env, message);
(*env)->CallVoidMethod(env, g_log_callback, mid, level, jcat, jmsg);
(*env)->DeleteLocalRef(env, jmsg);
(*env)->DeleteLocalRef(env, jcat);
if (attached) (*g_jvm)->DetachCurrentThread(g_jvm);
}
/* ── JNI event callback (chat_event → Kotlin) ── */
@ -260,7 +273,14 @@ static void jni_on_log(int level, const char* category, const char* message) {
static void jni_on_event(int type, const uint8_t* data, int len) {
if (!g_jvm || !g_event_callback || !g_event_mid) return;
JNIEnv* env = NULL;
if ((*g_jvm)->GetEnv(g_jvm, (void**)&env, JNI_VERSION_1_6) != JNI_OK) return;
int attached = 0;
jint res = (*g_jvm)->GetEnv(g_jvm, (void**)&env, JNI_VERSION_1_6);
if (res == JNI_EDETACHED) {
if ((*g_jvm)->AttachCurrentThread(g_jvm, &env, NULL) != JNI_OK) return;
attached = 1;
} else if (res != JNI_OK) {
return;
}
jbyteArray jdata = NULL;
if (data && len > 0) {
jdata = (*env)->NewByteArray(env, len);
@ -268,6 +288,7 @@ static void jni_on_event(int type, const uint8_t* data, int len) {
}
(*env)->CallVoidMethod(env, g_event_callback, g_event_mid, (jint)type, jdata);
if (jdata) (*env)->DeleteLocalRef(env, jdata);
if (attached) (*g_jvm)->DetachCurrentThread(g_jvm);
}
static void instance_event_handler(int type, const uint8_t* data, int len) {
@ -322,15 +343,12 @@ JNIEXPORT jboolean JNICALL Java_com_utun_chat_data_NativeLib_nativeStart(
const char* cfg = (*env)->GetStringUTFChars(env, configText, NULL);
if (!cfg) return JNI_FALSE;
/* Wire C logs → logcat + Kotlin LogManager */
utun_log_fn log_cb = g_log_callback ? jni_on_log : NULL;
utun_bridge_init(NULL, 0, log_cb, NULL, NULL);
/* Set up event forwarder */
/* Set up event forwarder (bridge config/log are set by nativeInit) */
instance_lite_set_event_handler(instance_event_handler);
utun_bridge_start(cfg);
(*env)->ReleaseStringUTFChars(env, configText, cfg);
return instance_lite_is_running() ? JNI_TRUE : JNI_FALSE;
}
@ -356,6 +374,15 @@ JNIEXPORT jboolean JNICALL Java_com_utun_chat_data_NativeLib_nativeInit(
g_log_callback = logCb ? (*env)->NewGlobalRef(env, logCb) : NULL;
const char* db = dbPath ? (*env)->GetStringUTFChars(env, dbPath, NULL) : NULL;
if (db) { strncpy(g_db_path, db, sizeof(g_db_path) - 1); g_db_path[sizeof(g_db_path) - 1] = '\0'; }
/* Create empty DB file synchronously so ChatRepository (read-only) can open it immediately */
if (g_db_path[0]) {
char db_file[512]; snprintf(db_file, sizeof(db_file), "%s/chats.db", g_db_path);
sqlite3* js3; if (sqlite3_open_v2(db_file, &js3, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL) == SQLITE_OK)
sqlite3_close(js3);
}
utun_log_fn log_cb = g_log_callback ? jni_on_log : NULL;
struct utun_bridge_config cfg = {
@ -414,6 +441,7 @@ JNIEXPORT void JNICALL Java_com_utun_chat_data_NativeLib_nativeSetEventCallback(
JNIEXPORT void JNICALL Java_com_utun_chat_data_NativeLib_nativeDestroy(
JNIEnv* env, jobject thiz) {
(void)thiz;
udp_log_stop();
utun_bridge_destroy();
if (g_config_callback) { (*env)->DeleteGlobalRef(env, g_config_callback); g_config_callback = NULL; }
if (g_log_callback) { (*env)->DeleteGlobalRef(env, g_log_callback); g_log_callback = NULL; }
@ -492,7 +520,36 @@ JNIEXPORT void JNICALL Java_com_utun_chat_data_NativeLib_nativeSubscribeLogs(
JNIEnv* env, jobject thiz, jboolean enabled) {
(void)thiz; (void)env;
g_on_log = (enabled && g_log_callback) ? jni_on_log : NULL;
bridge_log(BLEV_INFO, "native log subscription %s", enabled ? "ON" : "OFF");
}
JNIEXPORT void JNICALL Java_com_utun_chat_data_NativeLib_nativeSetUdpLogTarget(
JNIEnv* env, jobject thiz, jstring ip, jint port) {
(void)thiz;
const char* ip_str = (*env)->GetStringUTFChars(env, ip, NULL);
udp_log_set_target(ip_str, (int)port);
(*env)->ReleaseStringUTFChars(env, ip, ip_str);
}
JNIEXPORT void JNICALL Java_com_utun_chat_data_NativeLib_nativeRegenerateKeys(
JNIEnv* env, jobject thiz) {
(void)env; (void)thiz;
instance_lite_regenerate_keys();
}
JNIEXPORT jboolean JNICALL Java_com_utun_chat_data_NativeLib_nativeClearDatabase(
JNIEnv* env, jobject thiz) {
(void)env; (void)thiz;
if (!g_db_path[0]) {
bridge_log(BLEV_ERROR, "clearDatabase: no db path");
return JNI_FALSE;
}
char db_file[512], wal_file[512], shm_file[512];
snprintf(db_file, sizeof(db_file), "%s/chats.db", g_db_path);
snprintf(wal_file, sizeof(wal_file), "%s/chats.db-wal", g_db_path);
snprintf(shm_file, sizeof(shm_file), "%s/chats.db-shm", g_db_path);
unlink(db_file); unlink(wal_file); unlink(shm_file);
bridge_log(BLEV_INFO, "clearDatabase: deleted DB files at %s", g_db_path);
return JNI_TRUE;
}
#endif /* __ANDROID__ */

100
tools/chatgui-android/jni_bridge/android_udp_log.c

@ -0,0 +1,100 @@
/*
* android_udp_log.c — non-blocking UDP log sender for Android
*
* Called ONLY from uasync worker thread (bridge_debug_hook).
* No mutex needed. Flushes at 16KB threshold or via uasync timer.
*/
#include "android_udp_log.h"
#include "../libutun_lite/instance_lite.h"
#include "../../../lib/u_async.h"
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#define UDP_BUF_SIZE 65536
#define UDP_FLUSH_BYTES 16384
#define UDP_FLUSH_TB 2000 /* 200ms in uasync timebase (0.1ms units) */
static int g_udp_fd = -1;
static struct sockaddr_in g_udp_addr;
static int g_udp_has_addr = 0;
static char g_udp_buf[UDP_BUF_SIZE];
static int g_udp_buf_len = 0;
static void* g_udp_timer = NULL;
static void udp_reschedule_timer(void) {
struct UASYNC* ua = instance_lite_get_uasync();
if (ua) g_udp_timer = uasync_set_timeout(ua, UDP_FLUSH_TB, NULL, udp_trampoline, "udp_log_flush");
}
static void udp_open_socket(void) {
if (g_udp_fd >= 0 || !g_udp_has_addr) return;
g_udp_fd = socket(AF_INET, SOCK_DGRAM | SOCK_NONBLOCK, 0);
if (g_udp_fd < 0) return;
if (connect(g_udp_fd, (struct sockaddr*)&g_udp_addr, sizeof(g_udp_addr)) < 0) {
close(g_udp_fd); g_udp_fd = -1; return;
}
udp_reschedule_timer();
}
static void udp_do_send(const char* data, int len) {
if (g_udp_fd < 0) { udp_open_socket(); if (g_udp_fd < 0) return; }
ssize_t sent = send(g_udp_fd, data, len, MSG_DONTWAIT);
(void)sent;
if (sent < 0 && (errno == ECONNREFUSED || errno == ENETUNREACH || errno == EHOSTUNREACH)) {
close(g_udp_fd);
g_udp_fd = -1;
}
}
void udp_trampoline(void* arg) {
(void)arg;
if (g_udp_buf_len > 0) {
udp_do_send(g_udp_buf, g_udp_buf_len);
g_udp_buf_len = 0;
}
g_udp_timer = NULL;
if (g_udp_fd >= 0) udp_reschedule_timer();
}
void udp_log_set_target(const char* ip, int port) {
g_udp_buf_len = 0;
if (ip && port > 0) {
memset(&g_udp_addr, 0, sizeof(g_udp_addr));
g_udp_addr.sin_family = AF_INET;
g_udp_addr.sin_port = htons((unsigned short)port);
g_udp_has_addr = (inet_pton(AF_INET, ip, &g_udp_addr.sin_addr) == 1);
} else {
g_udp_has_addr = 0;
}
}
void udp_log_write(const char* data, int len) {
if (!data || len <= 0 || !g_udp_has_addr) return;
if (g_udp_fd < 0) udp_open_socket();
if (g_udp_buf_len + len > UDP_BUF_SIZE) {
if (g_udp_buf_len > 0) { udp_do_send(g_udp_buf, g_udp_buf_len); g_udp_buf_len = 0; }
if (len > UDP_BUF_SIZE) return;
}
memcpy(g_udp_buf + g_udp_buf_len, data, len);
g_udp_buf_len += len;
if (g_udp_buf_len >= UDP_FLUSH_BYTES) {
udp_do_send(g_udp_buf, g_udp_buf_len);
g_udp_buf_len = 0;
}
}
void udp_log_stop(void) {
struct UASYNC* ua = instance_lite_get_uasync();
if (ua && g_udp_timer) uasync_cancel_timeout(ua, g_udp_timer);
g_udp_timer = NULL;
if (g_udp_fd >= 0) { close(g_udp_fd); g_udp_fd = -1; }
g_udp_has_addr = 0;
g_udp_buf_len = 0;
}

30
tools/chatgui-android/jni_bridge/android_udp_log.h

@ -0,0 +1,30 @@
/*
* android_udp_log.h — non-blocking UDP log sender for Android
*
* Thread-safe buffer with non-blocking send.
* Flushes at 16KB threshold or 200ms timer.
*/
#ifndef ANDROID_UDP_LOG_H
#define ANDROID_UDP_LOG_H
#ifdef __cplusplus
extern "C" {
#endif
/* Configure target. ua may be NULL (delayed init, will retry on write).
* Call from ANY thread. Posts timer setup to uasync event loop. */
void udp_log_set_target(const char* ip, int port);
/* Write log line to buffer. Non-blocking send if threshold reached.
* Thread-safe — call from any thread (bridge_debug_hook). */
void udp_log_write(const char* data, int len);
/* Stop sending, close socket, cancel timer. Call from any thread. */
void udp_log_stop(void);
void udp_trampoline(void* arg);
#ifdef __cplusplus
}
#endif
#endif /* ANDROID_UDP_LOG_H */

56
tools/chatgui-android/libutun_lite/instance_lite.c

@ -21,6 +21,7 @@
#include "sqlite3.h"
#include "mem.h"
#include "debug_config.h"
#include "../jni_bridge/android_udp_log.h"
#include <pthread.h>
#include <stdio.h>
#include <string.h>
@ -74,6 +75,18 @@ static int generate_x25519_keys(char pub_hex[65], char priv_hex[65]) {
return 0;
}
static void save_keys_to_file(const char* pub, const char* priv) {
if (!g_db_path[0]) { IL_LOGE("save_keys_to_file: g_db_path is empty, keys not saved to disk"); return; }
char fname[512];
snprintf(fname, sizeof(fname), "%s/keys.conf", g_db_path);
FILE* f = fopen(fname, "w");
if (!f) { IL_LOGE("cannot write %s: %s", fname, strerror(errno)); return; }
fchmod(fileno(f), 0600);
fprintf(f, "public_key=%s\nprivate_key=%s\n", pub, priv);
fclose(f);
IL_LOGI("keys saved to %s", fname);
}
/* ── Ensure valid keys in config, generate if missing ── */
static void ensure_keys(struct utun_config* config) {
@ -84,6 +97,7 @@ static void ensure_keys(struct utun_config* config) {
memcpy(config->global.my_public_key_hex, g_generated_pub, 65);
memcpy(config->global.my_private_key_hex, g_generated_priv, 65);
IL_LOGI("new keys generated pub=%s", g_generated_pub);
save_keys_to_file(g_generated_pub, g_generated_priv);
} else {
IL_LOGE("key generation failed");
}
@ -143,6 +157,15 @@ static void* instance_thread(void* arg) {
return NULL;
}
/* Start UDP log early before any DEBUG messages */
if (config->global.log_udp_ip[0] && config->global.log_udp_port > 0) {
udp_log_set_target(config->global.log_udp_ip, config->global.log_udp_port);
uasync_set_timeout(g_ua, 2000, NULL, udp_trampoline, "udp_log_flush");
}
/* Set event handler before ensure_keys so KEYS_GENERATED event is delivered */
chat_event_set_handler(chat_event_forward);
/* Generate keys if missing (before creating instance) */
ensure_keys(config);
@ -191,11 +214,14 @@ static void* instance_thread(void* arg) {
/* Bind chat sync via etcp_router */
etcp_router_bind(g_inst, ETCP_RT_ID_CHAT_SYNC, NULL);
/* Forward chat events → Kotlin */
chat_event_set_handler(chat_event_forward);
IL_LOGI("all init done, entering poll loop");
/* Notify GUI of current public key (initial generation or existing) */
if (strlen(config->global.my_public_key_hex) == 64) {
chat_event_post(CHAT_EVT_KEYS_GENERATED,
(const uint8_t*)config->global.my_public_key_hex, 64);
}
g_running = 1;
while (!g_stop) {
@ -212,6 +238,7 @@ int instance_lite_start(const char* config_text) {
if (!config_text || g_running) return -1;
debug_config_init();
debug_set_level(DEBUG_LEVEL_INFO);
debug_enable_function_name(0);
/* Extract db_path for later SQLite open */
@ -276,6 +303,29 @@ struct UASYNC* instance_lite_get_uasync(void) {
return g_ua;
}
static void regenerate_trampoline(void* arg) {
(void)arg;
if (!g_inst || !g_inst->config) { IL_LOGE("regenerate_keys: instance not running"); return; }
struct utun_config* config = g_inst->config;
IL_LOGI("regenerating keys...");
config->global.my_public_key_hex[0] = '\0';
config->global.my_private_key_hex[0] = '\0';
ensure_keys(config);
if (g_generated_pub[0]) {
uint8_t pk_bin[32];
for (int i = 0; i < 32; i++) { unsigned int b; sscanf(g_generated_pub + i * 2, "%2x", &b); pk_bin[i] = (uint8_t)b; }
g_inst->node_id = sc_derive_node_id_from_pubkey(pk_bin);
sc_init_local_keys(&g_inst->my_keys, g_generated_pub, g_generated_priv);
IL_LOGI("keys regenerated, node_id=0x%016llx", (unsigned long long)g_inst->node_id);
chat_event_post(CHAT_EVT_KEYS_GENERATED, (const uint8_t*)g_generated_pub, 64);
}
}
void instance_lite_regenerate_keys(void) {
if (!g_ua || !g_inst) return;
uasync_post(g_ua, regenerate_trampoline, NULL);
}
void instance_lite_set_event_handler(instance_lite_event_fn handler) {
g_event_handler = handler;
if (g_running) chat_event_set_handler(chat_event_forward);

4
tools/chatgui-android/libutun_lite/instance_lite.h

@ -36,6 +36,10 @@ struct UASYNC* instance_lite_get_uasync(void);
typedef void (*instance_lite_event_fn)(int type, const uint8_t* data, int len);
void instance_lite_set_event_handler(instance_lite_event_fn handler);
/* Regenerate X25519 keys in the worker thread. Saves to keys.conf file.
* Call from any thread. Keys are regenerated asynchronously. */
void instance_lite_regenerate_keys(void);
#ifdef __cplusplus
}
#endif

114
tools/chatgui/transport/utun_node.cpp

@ -2,6 +2,8 @@
#include "utun_node.h"
#include <cinttypes>
#include <QDir>
#include <QMap>
#include <QPair>
#include <csignal>
#include "../../lib/socket_compat.h"
@ -146,8 +148,28 @@ bool UtunNode::ntpEnabled() const {
QList<NodeAddr> UtunNode::getInviteAddresses(DbManager* db) {
(void)db;
QList<NodeAddr> addrs;
QMap<QPair<QByteArray, quint16>, uint8_t> addrProto; // key=(addr,port) → proto bits
auto add_addr = [&](const QByteArray& addr, quint16 port, int family,
int sockId, uint8_t proto) {
QPair<QByteArray, quint16> key(addr, port);
uint8_t existing = addrProto.value(key, 0);
addrProto[key] = existing | proto;
// Store sockId/family for serialization (overwrite is fine — same port)
};
auto append_from_addr_proto = [&](const QByteArray& addr, quint16 port,
int family, int sockId, uint8_t proto) {
NodeAddr a;
a.family = family;
a.address = addr;
a.port = port;
a.socketId = sockId;
a.protocol = proto;
addrs.append(a);
};
if (m_instance) {
/* 1) UDP from active ETCP links */
struct ll_entry* entry = m_instance->connections->head;
while (entry) {
struct conn_queue_entry* ce = (struct conn_queue_entry*)entry->data;
@ -156,56 +178,74 @@ QList<NodeAddr> UtunNode::getInviteAddresses(DbManager* db) {
struct ETCP_LINK* link = conn->links;
while (link) {
if (link->link_state == 3 && link->nat_type == NAT_TYPE_DIRECT) {
NodeAddr a;
a.socketId = link->conn ? (int)link->conn->sock_id : 0;
a.protocol = INVITE_PROTO_UDP;
struct sockaddr_storage* sa = &link->remote_addr;
if (sa->ss_family == AF_INET) {
struct sockaddr_in* sin = (struct sockaddr_in*)sa;
a.family = 4;
a.address = QByteArray((const char*)&sin->sin_addr, 4);
a.port = ntohs(sin->sin_port);
QByteArray addr((const char*)&sin->sin_addr, 4);
add_addr(addr, ntohs(sin->sin_port), 4,
link->conn ? (int)link->conn->sock_id : 0, INVITE_PROTO_UDP);
} else {
struct sockaddr_in6* sin6 = (struct sockaddr_in6*)sa;
a.family = 6;
a.address = QByteArray((const char*)&sin6->sin6_addr, 16);
a.port = ntohs(sin6->sin6_port);
QByteArray addr((const char*)&sin6->sin6_addr, 16);
add_addr(addr, ntohs(sin6->sin6_port), 6,
link->conn ? (int)link->conn->sock_id : 0, INVITE_PROTO_UDP);
}
addrs.append(a);
}
link = link->next;
}
}
entry = entry->next;
}
}
if (addrs.isEmpty() && m_instance) {
struct ETCP_SOCKET* sock = m_instance->etcp_sockets;
while (sock) {
struct sockaddr_storage* sa;
if (sock->nat_addr.ss_family != 0)
sa = &sock->nat_addr;
else if (sock->interface_addr.ss_family != 0)
sa = &sock->interface_addr;
else { sock = sock->next; continue; }
NodeAddr a;
a.socketId = (int)sock->sock_id;
a.protocol = INVITE_PROTO_UDP;
if (sa->ss_family == AF_INET) {
struct sockaddr_in* sin = (struct sockaddr_in*)sa;
a.family = 4;
a.address = QByteArray((const char*)&sin->sin_addr, 4);
a.port = ntohs(sin->sin_port);
} else {
struct sockaddr_in6* sin6 = (struct sockaddr_in6*)sa;
a.family = 6;
a.address = QByteArray((const char*)&sin6->sin6_addr, 16);
a.port = ntohs(sin6->sin6_port);
/* 2) UDP from local ETCP sockets (fallback) */
{
struct ETCP_SOCKET* sock = m_instance->etcp_sockets;
while (sock) {
struct sockaddr_storage* sa = NULL;
if (sock->nat_addr.ss_family != 0)
sa = &sock->nat_addr;
else if (sock->interface_addr.ss_family != 0)
sa = &sock->interface_addr;
if (sa) {
if (sa->ss_family == AF_INET) {
struct sockaddr_in* sin = (struct sockaddr_in*)sa;
QByteArray addr((const char*)&sin->sin_addr, 4);
add_addr(addr, ntohs(sin->sin_port), 4, (int)sock->sock_id, INVITE_PROTO_UDP);
} else {
struct sockaddr_in6* sin6 = (struct sockaddr_in6*)sa;
QByteArray addr((const char*)&sin6->sin6_addr, 16);
add_addr(addr, ntohs(sin6->sin6_port), 6, (int)sock->sock_id, INVITE_PROTO_UDP);
}
}
sock = sock->next;
}
}
/* 3) TCP from local TCP sockets */
{
struct TCP_SOCKET* ts = m_instance->tcp_sockets;
while (ts) {
struct sockaddr_storage* sa = &ts->interface_addr;
if (sa->ss_family == AF_INET) {
struct sockaddr_in* sin = (struct sockaddr_in*)sa;
QByteArray addr((const char*)&sin->sin_addr, 4);
add_addr(addr, ntohs(sin->sin_port), 4, (int)ts->sock_id, INVITE_PROTO_TCP);
} else if (sa->ss_family == AF_INET6) {
struct sockaddr_in6* sin6 = (struct sockaddr_in6*)sa;
QByteArray addr((const char*)&sin6->sin6_addr, 16);
add_addr(addr, ntohs(sin6->sin6_port), 6, (int)ts->sock_id, INVITE_PROTO_TCP);
}
ts = ts->next;
}
addrs.append(a);
sock = sock->next;
}
/* 4) Merge: dedup by (addr,port), write result with merged proto */
for (auto it = addrProto.begin(); it != addrProto.end(); ++it) {
QByteArray addr = it.key().first;
quint16 port = it.key().second;
uint8_t proto = it.value();
int family = (addr.size() == 16) ? 6 : 4;
append_from_addr_proto(addr, port, family, 0, proto);
}
}

7
tools/logreceiver/CMakeLists.txt

@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 3.16)
project(logreceiver C)
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED ON)
add_executable(logreceiver logreceiver.c)

340
tools/logreceiver/build/CMakeCache.txt

@ -0,0 +1,340 @@
# This is the CMakeCache file.
# For build in directory: /home/user/utun2/tools/logreceiver/build
# It was generated by CMake: /home/user/android/cmake/4.1.2/bin/cmake
# You can edit this file to change values found and used by cmake.
# If you do not want to change any of the values, simply exit the editor.
# If you do want to change a value, simply edit, save, and exit the editor.
# The syntax for the file is as follows:
# KEY:TYPE=VALUE
# KEY is the name of a variable in the cache.
# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!.
# VALUE is the current value for the KEY.
########################
# EXTERNAL cache entries
########################
//Path to a program.
CMAKE_ADDR2LINE:FILEPATH=/usr/bin/addr2line
//Path to a program.
CMAKE_AR:FILEPATH=/usr/bin/ar
//Choose the type of build, options are: None Debug Release RelWithDebInfo
// MinSizeRel ...
CMAKE_BUILD_TYPE:STRING=
//Enable/Disable color output during build.
CMAKE_COLOR_MAKEFILE:BOOL=ON
//C compiler
CMAKE_C_COMPILER:FILEPATH=/usr/bin/cc
//A wrapper around 'ar' adding the appropriate '--plugin' option
// for the GCC compiler
CMAKE_C_COMPILER_AR:FILEPATH=/usr/bin/gcc-ar-15
//A wrapper around 'ranlib' adding the appropriate '--plugin' option
// for the GCC compiler
CMAKE_C_COMPILER_RANLIB:FILEPATH=/usr/bin/gcc-ranlib-15
//Flags used by the C compiler during all build types.
CMAKE_C_FLAGS:STRING=
//Flags used by the C compiler during DEBUG builds.
CMAKE_C_FLAGS_DEBUG:STRING=-g
//Flags used by the C compiler during MINSIZEREL builds.
CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG
//Flags used by the C compiler during RELEASE builds.
CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG
//Flags used by the C compiler during RELWITHDEBINFO builds.
CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g -DNDEBUG
//Path to a program.
CMAKE_DLLTOOL:FILEPATH=CMAKE_DLLTOOL-NOTFOUND
//Flags used by the linker during all build types.
CMAKE_EXE_LINKER_FLAGS:STRING=
//Flags used by the linker during DEBUG builds.
CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING=
//Flags used by the linker during MINSIZEREL builds.
CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING=
//Flags used by the linker during RELEASE builds.
CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING=
//Flags used by the linker during RELWITHDEBINFO builds.
CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING=
//Enable/Disable output of compile commands during generation.
CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=
//Value Computed by CMake.
CMAKE_FIND_PACKAGE_REDIRECTS_DIR:STATIC=/home/user/utun2/tools/logreceiver/build/CMakeFiles/pkgRedirects
//Install path prefix, prepended onto install directories.
CMAKE_INSTALL_PREFIX:PATH=/usr/local
//Path to a program.
CMAKE_LINKER:FILEPATH=/usr/bin/ld
//Path to a program.
CMAKE_MAKE_PROGRAM:FILEPATH=/usr/bin/gmake
//Flags used by the linker during the creation of modules during
// all build types.
CMAKE_MODULE_LINKER_FLAGS:STRING=
//Flags used by the linker during the creation of modules during
// DEBUG builds.
CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING=
//Flags used by the linker during the creation of modules during
// MINSIZEREL builds.
CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING=
//Flags used by the linker during the creation of modules during
// RELEASE builds.
CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING=
//Flags used by the linker during the creation of modules during
// RELWITHDEBINFO builds.
CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING=
//Path to a program.
CMAKE_NM:FILEPATH=/usr/bin/nm
//Path to a program.
CMAKE_OBJCOPY:FILEPATH=/usr/bin/objcopy
//Path to a program.
CMAKE_OBJDUMP:FILEPATH=/usr/bin/objdump
//Value Computed by CMake
CMAKE_PROJECT_COMPAT_VERSION:STATIC=
//Value Computed by CMake
CMAKE_PROJECT_DESCRIPTION:STATIC=
//Value Computed by CMake
CMAKE_PROJECT_HOMEPAGE_URL:STATIC=
//Value Computed by CMake
CMAKE_PROJECT_NAME:STATIC=logreceiver
//Path to a program.
CMAKE_RANLIB:FILEPATH=/usr/bin/ranlib
//Path to a program.
CMAKE_READELF:FILEPATH=/usr/bin/readelf
//Flags used by the linker during the creation of shared libraries
// during all build types.
CMAKE_SHARED_LINKER_FLAGS:STRING=
//Flags used by the linker during the creation of shared libraries
// during DEBUG builds.
CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING=
//Flags used by the linker during the creation of shared libraries
// during MINSIZEREL builds.
CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING=
//Flags used by the linker during the creation of shared libraries
// during RELEASE builds.
CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING=
//Flags used by the linker during the creation of shared libraries
// during RELWITHDEBINFO builds.
CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING=
//If set, runtime paths are not added when installing shared libraries,
// but are added when building.
CMAKE_SKIP_INSTALL_RPATH:BOOL=NO
//If set, runtime paths are not added when using shared libraries.
CMAKE_SKIP_RPATH:BOOL=NO
//Flags used by the archiver during the creation of static libraries
// during all build types.
CMAKE_STATIC_LINKER_FLAGS:STRING=
//Flags used by the archiver during the creation of static libraries
// during DEBUG builds.
CMAKE_STATIC_LINKER_FLAGS_DEBUG:STRING=
//Flags used by the archiver during the creation of static libraries
// during MINSIZEREL builds.
CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL:STRING=
//Flags used by the archiver during the creation of static libraries
// during RELEASE builds.
CMAKE_STATIC_LINKER_FLAGS_RELEASE:STRING=
//Flags used by the archiver during the creation of static libraries
// during RELWITHDEBINFO builds.
CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO:STRING=
//Path to a program.
CMAKE_STRIP:FILEPATH=/usr/bin/strip
//Path to a program.
CMAKE_TAPI:FILEPATH=CMAKE_TAPI-NOTFOUND
//If this value is on, makefiles will be generated without the
// .SILENT directive, and all commands will be echoed to the console
// during the make. This is useful for debugging only. With Visual
// Studio IDE projects all commands are done without /nologo.
CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE
//Value Computed by CMake
logreceiver_BINARY_DIR:STATIC=/home/user/utun2/tools/logreceiver/build
//Value Computed by CMake
logreceiver_IS_TOP_LEVEL:STATIC=ON
//Value Computed by CMake
logreceiver_SOURCE_DIR:STATIC=/home/user/utun2/tools/logreceiver
########################
# INTERNAL cache entries
########################
//ADVANCED property for variable: CMAKE_ADDR2LINE
CMAKE_ADDR2LINE-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_AR
CMAKE_AR-ADVANCED:INTERNAL=1
//This is the directory where this CMakeCache.txt was created
CMAKE_CACHEFILE_DIR:INTERNAL=/home/user/utun2/tools/logreceiver/build
//Major version of cmake used to create the current loaded cache
CMAKE_CACHE_MAJOR_VERSION:INTERNAL=4
//Minor version of cmake used to create the current loaded cache
CMAKE_CACHE_MINOR_VERSION:INTERNAL=1
//Patch version of cmake used to create the current loaded cache
CMAKE_CACHE_PATCH_VERSION:INTERNAL=2
//ADVANCED property for variable: CMAKE_COLOR_MAKEFILE
CMAKE_COLOR_MAKEFILE-ADVANCED:INTERNAL=1
//Path to CMake executable.
CMAKE_COMMAND:INTERNAL=/home/user/android/cmake/4.1.2/bin/cmake
//Path to cpack program executable.
CMAKE_CPACK_COMMAND:INTERNAL=/home/user/android/cmake/4.1.2/bin/cpack
//Path to ctest program executable.
CMAKE_CTEST_COMMAND:INTERNAL=/home/user/android/cmake/4.1.2/bin/ctest
//ADVANCED property for variable: CMAKE_C_COMPILER
CMAKE_C_COMPILER-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_C_COMPILER_AR
CMAKE_C_COMPILER_AR-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_C_COMPILER_RANLIB
CMAKE_C_COMPILER_RANLIB-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_C_FLAGS
CMAKE_C_FLAGS-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_DEBUG-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_C_FLAGS_MINSIZEREL
CMAKE_C_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_RELEASE-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_C_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_DLLTOOL
CMAKE_DLLTOOL-ADVANCED:INTERNAL=1
//Executable file format
CMAKE_EXECUTABLE_FORMAT:INTERNAL=ELF
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS
CMAKE_EXE_LINKER_FLAGS-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_DEBUG
CMAKE_EXE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_MINSIZEREL
CMAKE_EXE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELEASE
CMAKE_EXE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO
CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_EXPORT_COMPILE_COMMANDS
CMAKE_EXPORT_COMPILE_COMMANDS-ADVANCED:INTERNAL=1
//Name of external makefile project generator.
CMAKE_EXTRA_GENERATOR:INTERNAL=
//Name of generator.
CMAKE_GENERATOR:INTERNAL=Unix Makefiles
//Generator instance identifier.
CMAKE_GENERATOR_INSTANCE:INTERNAL=
//Name of generator platform.
CMAKE_GENERATOR_PLATFORM:INTERNAL=
//Name of generator toolset.
CMAKE_GENERATOR_TOOLSET:INTERNAL=
//Source directory with the top level CMakeLists.txt file for this
// project
CMAKE_HOME_DIRECTORY:INTERNAL=/home/user/utun2/tools/logreceiver
//Install .so files without execute permission.
CMAKE_INSTALL_SO_NO_EXE:INTERNAL=1
//ADVANCED property for variable: CMAKE_LINKER
CMAKE_LINKER-ADVANCED:INTERNAL=1
//Name of CMakeLists files to read
CMAKE_LIST_FILE_NAME:INTERNAL=CMakeLists.txt
//ADVANCED property for variable: CMAKE_MAKE_PROGRAM
CMAKE_MAKE_PROGRAM-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS
CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_DEBUG
CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL
CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELEASE
CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO
CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_NM
CMAKE_NM-ADVANCED:INTERNAL=1
//number of local generators
CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=1
//ADVANCED property for variable: CMAKE_OBJCOPY
CMAKE_OBJCOPY-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_OBJDUMP
CMAKE_OBJDUMP-ADVANCED:INTERNAL=1
//Platform information initialized
CMAKE_PLATFORM_INFO_INITIALIZED:INTERNAL=1
//ADVANCED property for variable: CMAKE_RANLIB
CMAKE_RANLIB-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_READELF
CMAKE_READELF-ADVANCED:INTERNAL=1
//Path to CMake installation.
CMAKE_ROOT:INTERNAL=/home/user/android/cmake/4.1.2/share/cmake-4.1
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS
CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_DEBUG
CMAKE_SHARED_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL
CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELEASE
CMAKE_SHARED_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO
CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_SKIP_INSTALL_RPATH
CMAKE_SKIP_INSTALL_RPATH-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_SKIP_RPATH
CMAKE_SKIP_RPATH-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS
CMAKE_STATIC_LINKER_FLAGS-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_DEBUG
CMAKE_STATIC_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL
CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELEASE
CMAKE_STATIC_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO
CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_STRIP
CMAKE_STRIP-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_TAPI
CMAKE_TAPI-ADVANCED:INTERNAL=1
//uname command
CMAKE_UNAME:INTERNAL=/usr/bin/uname
//ADVANCED property for variable: CMAKE_VERBOSE_MAKEFILE
CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1

84
tools/logreceiver/build/CMakeFiles/4.1.2/CMakeCCompiler.cmake

@ -0,0 +1,84 @@
set(CMAKE_C_COMPILER "/usr/bin/cc")
set(CMAKE_C_COMPILER_ARG1 "")
set(CMAKE_C_COMPILER_ID "GNU")
set(CMAKE_C_COMPILER_VERSION "15.2.0")
set(CMAKE_C_COMPILER_VERSION_INTERNAL "")
set(CMAKE_C_COMPILER_WRAPPER "")
set(CMAKE_C_STANDARD_COMPUTED_DEFAULT "23")
set(CMAKE_C_EXTENSIONS_COMPUTED_DEFAULT "ON")
set(CMAKE_C_STANDARD_LATEST "23")
set(CMAKE_C_COMPILE_FEATURES "c_std_90;c_function_prototypes;c_std_99;c_restrict;c_variadic_macros;c_std_11;c_static_assert;c_std_17;c_std_23")
set(CMAKE_C90_COMPILE_FEATURES "c_std_90;c_function_prototypes")
set(CMAKE_C99_COMPILE_FEATURES "c_std_99;c_restrict;c_variadic_macros")
set(CMAKE_C11_COMPILE_FEATURES "c_std_11;c_static_assert")
set(CMAKE_C17_COMPILE_FEATURES "c_std_17")
set(CMAKE_C23_COMPILE_FEATURES "c_std_23")
set(CMAKE_C_PLATFORM_ID "Linux")
set(CMAKE_C_SIMULATE_ID "")
set(CMAKE_C_COMPILER_FRONTEND_VARIANT "GNU")
set(CMAKE_C_COMPILER_APPLE_SYSROOT "")
set(CMAKE_C_SIMULATE_VERSION "")
set(CMAKE_C_COMPILER_ARCHITECTURE_ID "x86_64")
set(CMAKE_AR "/usr/bin/ar")
set(CMAKE_C_COMPILER_AR "/usr/bin/gcc-ar-15")
set(CMAKE_RANLIB "/usr/bin/ranlib")
set(CMAKE_C_COMPILER_RANLIB "/usr/bin/gcc-ranlib-15")
set(CMAKE_LINKER "/usr/bin/ld")
set(CMAKE_LINKER_LINK "")
set(CMAKE_LINKER_LLD "")
set(CMAKE_C_COMPILER_LINKER "/usr/bin/ld")
set(CMAKE_C_COMPILER_LINKER_ID "GNU")
set(CMAKE_C_COMPILER_LINKER_VERSION 2.46)
set(CMAKE_C_COMPILER_LINKER_FRONTEND_VARIANT GNU)
set(CMAKE_MT "")
set(CMAKE_TAPI "CMAKE_TAPI-NOTFOUND")
set(CMAKE_COMPILER_IS_GNUCC 1)
set(CMAKE_C_COMPILER_LOADED 1)
set(CMAKE_C_COMPILER_WORKS TRUE)
set(CMAKE_C_ABI_COMPILED TRUE)
set(CMAKE_C_COMPILER_ENV_VAR "CC")
set(CMAKE_C_COMPILER_ID_RUN 1)
set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m)
set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
set(CMAKE_C_LINKER_PREFERENCE 10)
set(CMAKE_C_LINKER_DEPFILE_SUPPORTED TRUE)
set(CMAKE_LINKER_PUSHPOP_STATE_SUPPORTED TRUE)
set(CMAKE_C_LINKER_PUSHPOP_STATE_SUPPORTED TRUE)
# Save compiler ABI information.
set(CMAKE_C_SIZEOF_DATA_PTR "8")
set(CMAKE_C_COMPILER_ABI "ELF")
set(CMAKE_C_BYTE_ORDER "LITTLE_ENDIAN")
set(CMAKE_C_LIBRARY_ARCHITECTURE "x86_64-linux-gnu")
if(CMAKE_C_SIZEOF_DATA_PTR)
set(CMAKE_SIZEOF_VOID_P "${CMAKE_C_SIZEOF_DATA_PTR}")
endif()
if(CMAKE_C_COMPILER_ABI)
set(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}")
endif()
if(CMAKE_C_LIBRARY_ARCHITECTURE)
set(CMAKE_LIBRARY_ARCHITECTURE "x86_64-linux-gnu")
endif()
set(CMAKE_C_CL_SHOWINCLUDES_PREFIX "")
if(CMAKE_C_CL_SHOWINCLUDES_PREFIX)
set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_C_CL_SHOWINCLUDES_PREFIX}")
endif()
set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/15/include;/usr/local/include;/usr/include/x86_64-linux-gnu;/usr/include")
set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "gcc;gcc_s;c;gcc;gcc_s")
set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "/usr/lib/gcc/x86_64-linux-gnu/15;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib")
set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "")

BIN
tools/logreceiver/build/CMakeFiles/4.1.2/CMakeDetermineCompilerABI_C.bin

Binary file not shown.

15
tools/logreceiver/build/CMakeFiles/4.1.2/CMakeSystem.cmake

@ -0,0 +1,15 @@
set(CMAKE_HOST_SYSTEM "Linux-7.0.0-28-generic")
set(CMAKE_HOST_SYSTEM_NAME "Linux")
set(CMAKE_HOST_SYSTEM_VERSION "7.0.0-28-generic")
set(CMAKE_HOST_SYSTEM_PROCESSOR "x86_64")
set(CMAKE_SYSTEM "Linux-7.0.0-28-generic")
set(CMAKE_SYSTEM_NAME "Linux")
set(CMAKE_SYSTEM_VERSION "7.0.0-28-generic")
set(CMAKE_SYSTEM_PROCESSOR "x86_64")
set(CMAKE_CROSSCOMPILING "FALSE")
set(CMAKE_SYSTEM_LOADED 1)

934
tools/logreceiver/build/CMakeFiles/4.1.2/CompilerIdC/CMakeCCompilerId.c

@ -0,0 +1,934 @@
#ifdef __cplusplus
# error "A C++ compiler has been selected for C."
#endif
#if defined(__18CXX)
# define ID_VOID_MAIN
#endif
#if defined(__CLASSIC_C__)
/* cv-qualifiers did not exist in K&R C */
# define const
# define volatile
#endif
#if !defined(__has_include)
/* If the compiler does not have __has_include, pretend the answer is
always no. */
# define __has_include(x) 0
#endif
/* Version number components: V=Version, R=Revision, P=Patch
Version date components: YYYY=Year, MM=Month, DD=Day */
#if defined(__INTEL_COMPILER) || defined(__ICC)
# define COMPILER_ID "Intel"
# if defined(_MSC_VER)
# define SIMULATE_ID "MSVC"
# endif
# if defined(__GNUC__)
# define SIMULATE_ID "GNU"
# endif
/* __INTEL_COMPILER = VRP prior to 2021, and then VVVV for 2021 and later,
except that a few beta releases use the old format with V=2021. */
# if __INTEL_COMPILER < 2021 || __INTEL_COMPILER == 202110 || __INTEL_COMPILER == 202111
# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100)
# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10)
# if defined(__INTEL_COMPILER_UPDATE)
# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE)
# else
# define COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER % 10)
# endif
# else
# define COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER)
# define COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER_UPDATE)
/* The third version component from --version is an update index,
but no macro is provided for it. */
# define COMPILER_VERSION_PATCH DEC(0)
# endif
# if defined(__INTEL_COMPILER_BUILD_DATE)
/* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */
# define COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
# endif
# if defined(_MSC_VER)
/* _MSC_VER = VVRR */
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
# endif
# if defined(__GNUC__)
# define SIMULATE_VERSION_MAJOR DEC(__GNUC__)
# elif defined(__GNUG__)
# define SIMULATE_VERSION_MAJOR DEC(__GNUG__)
# endif
# if defined(__GNUC_MINOR__)
# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__)
# endif
# if defined(__GNUC_PATCHLEVEL__)
# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
# endif
#elif (defined(__clang__) && defined(__INTEL_CLANG_COMPILER)) || defined(__INTEL_LLVM_COMPILER)
# define COMPILER_ID "IntelLLVM"
#if defined(_MSC_VER)
# define SIMULATE_ID "MSVC"
#endif
#if defined(__GNUC__)
# define SIMULATE_ID "GNU"
#endif
/* __INTEL_LLVM_COMPILER = VVVVRP prior to 2021.2.0, VVVVRRPP for 2021.2.0 and
* later. Look for 6 digit vs. 8 digit version number to decide encoding.
* VVVV is no smaller than the current year when a version is released.
*/
#if __INTEL_LLVM_COMPILER < 1000000L
# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/100)
# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/10 % 10)
# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 10)
#else
# define COMPILER_VERSION_MAJOR DEC(__INTEL_LLVM_COMPILER/10000)
# define COMPILER_VERSION_MINOR DEC(__INTEL_LLVM_COMPILER/100 % 100)
# define COMPILER_VERSION_PATCH DEC(__INTEL_LLVM_COMPILER % 100)
#endif
#if defined(_MSC_VER)
/* _MSC_VER = VVRR */
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
#endif
#if defined(__GNUC__)
# define SIMULATE_VERSION_MAJOR DEC(__GNUC__)
#elif defined(__GNUG__)
# define SIMULATE_VERSION_MAJOR DEC(__GNUG__)
#endif
#if defined(__GNUC_MINOR__)
# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__)
#endif
#if defined(__GNUC_PATCHLEVEL__)
# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
#endif
#elif defined(__PATHCC__)
# define COMPILER_ID "PathScale"
# define COMPILER_VERSION_MAJOR DEC(__PATHCC__)
# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__)
# if defined(__PATHCC_PATCHLEVEL__)
# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__)
# endif
#elif defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__)
# define COMPILER_ID "Embarcadero"
# define COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF)
# define COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF)
# define COMPILER_VERSION_PATCH DEC(__CODEGEARC_VERSION__ & 0xFFFF)
#elif defined(__BORLANDC__)
# define COMPILER_ID "Borland"
/* __BORLANDC__ = 0xVRR */
# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8)
# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)
#elif defined(__WATCOMC__) && __WATCOMC__ < 1200
# define COMPILER_ID "Watcom"
/* __WATCOMC__ = VVRR */
# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
# if (__WATCOMC__ % 10) > 0
# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
# endif
#elif defined(__WATCOMC__)
# define COMPILER_ID "OpenWatcom"
/* __WATCOMC__ = VVRP + 1100 */
# define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100)
# define COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
# if (__WATCOMC__ % 10) > 0
# define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
# endif
#elif defined(__SUNPRO_C)
# define COMPILER_ID "SunPro"
# if __SUNPRO_C >= 0x5100
/* __SUNPRO_C = 0xVRRP */
# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12)
# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF)
# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF)
# else
/* __SUNPRO_CC = 0xVRP */
# define COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8)
# define COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF)
# define COMPILER_VERSION_PATCH HEX(__SUNPRO_C & 0xF)
# endif
#elif defined(__HP_cc)
# define COMPILER_ID "HP"
/* __HP_cc = VVRRPP */
# define COMPILER_VERSION_MAJOR DEC(__HP_cc/10000)
# define COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100)
# define COMPILER_VERSION_PATCH DEC(__HP_cc % 100)
#elif defined(__DECC)
# define COMPILER_ID "Compaq"
/* __DECC_VER = VVRRTPPPP */
# define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000)
# define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100)
# define COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000)
#elif defined(__IBMC__) && defined(__COMPILER_VER__)
# define COMPILER_ID "zOS"
/* __IBMC__ = VRP */
# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
#elif defined(__open_xl__) && defined(__clang__)
# define COMPILER_ID "IBMClang"
# define COMPILER_VERSION_MAJOR DEC(__open_xl_version__)
# define COMPILER_VERSION_MINOR DEC(__open_xl_release__)
# define COMPILER_VERSION_PATCH DEC(__open_xl_modification__)
# define COMPILER_VERSION_TWEAK DEC(__open_xl_ptf_fix_level__)
# define COMPILER_VERSION_INTERNAL_STR __clang_version__
#elif defined(__ibmxl__) && defined(__clang__)
# define COMPILER_ID "XLClang"
# define COMPILER_VERSION_MAJOR DEC(__ibmxl_version__)
# define COMPILER_VERSION_MINOR DEC(__ibmxl_release__)
# define COMPILER_VERSION_PATCH DEC(__ibmxl_modification__)
# define COMPILER_VERSION_TWEAK DEC(__ibmxl_ptf_fix_level__)
#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ >= 800
# define COMPILER_ID "XL"
/* __IBMC__ = VRP */
# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
#elif defined(__IBMC__) && !defined(__COMPILER_VER__) && __IBMC__ < 800
# define COMPILER_ID "VisualAge"
/* __IBMC__ = VRP */
# define COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
# define COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
# define COMPILER_VERSION_PATCH DEC(__IBMC__ % 10)
#elif defined(__NVCOMPILER)
# define COMPILER_ID "NVHPC"
# define COMPILER_VERSION_MAJOR DEC(__NVCOMPILER_MAJOR__)
# define COMPILER_VERSION_MINOR DEC(__NVCOMPILER_MINOR__)
# if defined(__NVCOMPILER_PATCHLEVEL__)
# define COMPILER_VERSION_PATCH DEC(__NVCOMPILER_PATCHLEVEL__)
# endif
#elif defined(__PGI)
# define COMPILER_ID "PGI"
# define COMPILER_VERSION_MAJOR DEC(__PGIC__)
# define COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
# if defined(__PGIC_PATCHLEVEL__)
# define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
# endif
#elif defined(__clang__) && defined(__cray__)
# define COMPILER_ID "CrayClang"
# define COMPILER_VERSION_MAJOR DEC(__cray_major__)
# define COMPILER_VERSION_MINOR DEC(__cray_minor__)
# define COMPILER_VERSION_PATCH DEC(__cray_patchlevel__)
# define COMPILER_VERSION_INTERNAL_STR __clang_version__
#elif defined(_CRAYC)
# define COMPILER_ID "Cray"
# define COMPILER_VERSION_MAJOR DEC(_RELEASE_MAJOR)
# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)
#elif defined(__TI_COMPILER_VERSION__)
# define COMPILER_ID "TI"
/* __TI_COMPILER_VERSION__ = VVVRRRPPP */
# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000)
# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000)
# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000)
#elif defined(__CLANG_FUJITSU)
# define COMPILER_ID "FujitsuClang"
# define COMPILER_VERSION_MAJOR DEC(__FCC_major__)
# define COMPILER_VERSION_MINOR DEC(__FCC_minor__)
# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__)
# define COMPILER_VERSION_INTERNAL_STR __clang_version__
#elif defined(__FUJITSU)
# define COMPILER_ID "Fujitsu"
# if defined(__FCC_version__)
# define COMPILER_VERSION __FCC_version__
# elif defined(__FCC_major__)
# define COMPILER_VERSION_MAJOR DEC(__FCC_major__)
# define COMPILER_VERSION_MINOR DEC(__FCC_minor__)
# define COMPILER_VERSION_PATCH DEC(__FCC_patchlevel__)
# endif
# if defined(__fcc_version)
# define COMPILER_VERSION_INTERNAL DEC(__fcc_version)
# elif defined(__FCC_VERSION)
# define COMPILER_VERSION_INTERNAL DEC(__FCC_VERSION)
# endif
#elif defined(__ghs__)
# define COMPILER_ID "GHS"
/* __GHS_VERSION_NUMBER = VVVVRP */
# ifdef __GHS_VERSION_NUMBER
# define COMPILER_VERSION_MAJOR DEC(__GHS_VERSION_NUMBER / 100)
# define COMPILER_VERSION_MINOR DEC(__GHS_VERSION_NUMBER / 10 % 10)
# define COMPILER_VERSION_PATCH DEC(__GHS_VERSION_NUMBER % 10)
# endif
#elif defined(__TASKING__)
# define COMPILER_ID "Tasking"
# define COMPILER_VERSION_MAJOR DEC(__VERSION__/1000)
# define COMPILER_VERSION_MINOR DEC(__VERSION__ % 100)
# define COMPILER_VERSION_INTERNAL DEC(__VERSION__)
#elif defined(__ORANGEC__)
# define COMPILER_ID "OrangeC"
# define COMPILER_VERSION_MAJOR DEC(__ORANGEC_MAJOR__)
# define COMPILER_VERSION_MINOR DEC(__ORANGEC_MINOR__)
# define COMPILER_VERSION_PATCH DEC(__ORANGEC_PATCHLEVEL__)
#elif defined(__RENESAS__)
# define COMPILER_ID "Renesas"
/* __RENESAS_VERSION__ = 0xVVRRPP00 */
# define COMPILER_VERSION_MAJOR HEX(__RENESAS_VERSION__ >> 24 & 0xFF)
# define COMPILER_VERSION_MINOR HEX(__RENESAS_VERSION__ >> 16 & 0xFF)
# define COMPILER_VERSION_PATCH HEX(__RENESAS_VERSION__ >> 8 & 0xFF)
#elif defined(__TINYC__)
# define COMPILER_ID "TinyCC"
#elif defined(__BCC__)
# define COMPILER_ID "Bruce"
#elif defined(__SCO_VERSION__)
# define COMPILER_ID "SCO"
#elif defined(__ARMCC_VERSION) && !defined(__clang__)
# define COMPILER_ID "ARMCC"
#if __ARMCC_VERSION >= 1000000
/* __ARMCC_VERSION = VRRPPPP */
# define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/1000000)
# define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 100)
# define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000)
#else
/* __ARMCC_VERSION = VRPPPP */
# define COMPILER_VERSION_MAJOR DEC(__ARMCC_VERSION/100000)
# define COMPILER_VERSION_MINOR DEC(__ARMCC_VERSION/10000 % 10)
# define COMPILER_VERSION_PATCH DEC(__ARMCC_VERSION % 10000)
#endif
#elif defined(__clang__) && defined(__apple_build_version__)
# define COMPILER_ID "AppleClang"
# if defined(_MSC_VER)
# define SIMULATE_ID "MSVC"
# endif
# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
# if defined(_MSC_VER)
/* _MSC_VER = VVRR */
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
# endif
# define COMPILER_VERSION_TWEAK DEC(__apple_build_version__)
#elif defined(__clang__) && defined(__ARMCOMPILER_VERSION)
# define COMPILER_ID "ARMClang"
# define COMPILER_VERSION_MAJOR DEC(__ARMCOMPILER_VERSION/1000000)
# define COMPILER_VERSION_MINOR DEC(__ARMCOMPILER_VERSION/10000 % 100)
# define COMPILER_VERSION_PATCH DEC(__ARMCOMPILER_VERSION/100 % 100)
# define COMPILER_VERSION_INTERNAL DEC(__ARMCOMPILER_VERSION)
#elif defined(__clang__) && defined(__ti__)
# define COMPILER_ID "TIClang"
# define COMPILER_VERSION_MAJOR DEC(__ti_major__)
# define COMPILER_VERSION_MINOR DEC(__ti_minor__)
# define COMPILER_VERSION_PATCH DEC(__ti_patchlevel__)
# define COMPILER_VERSION_INTERNAL DEC(__ti_version__)
#elif defined(__clang__)
# define COMPILER_ID "Clang"
# if defined(_MSC_VER)
# define SIMULATE_ID "MSVC"
# endif
# define COMPILER_VERSION_MAJOR DEC(__clang_major__)
# define COMPILER_VERSION_MINOR DEC(__clang_minor__)
# define COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
# if defined(_MSC_VER)
/* _MSC_VER = VVRR */
# define SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
# define SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
# endif
#elif defined(__LCC__) && (defined(__GNUC__) || defined(__GNUG__) || defined(__MCST__))
# define COMPILER_ID "LCC"
# define COMPILER_VERSION_MAJOR DEC(__LCC__ / 100)
# define COMPILER_VERSION_MINOR DEC(__LCC__ % 100)
# if defined(__LCC_MINOR__)
# define COMPILER_VERSION_PATCH DEC(__LCC_MINOR__)
# endif
# if defined(__GNUC__) && defined(__GNUC_MINOR__)
# define SIMULATE_ID "GNU"
# define SIMULATE_VERSION_MAJOR DEC(__GNUC__)
# define SIMULATE_VERSION_MINOR DEC(__GNUC_MINOR__)
# if defined(__GNUC_PATCHLEVEL__)
# define SIMULATE_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
# endif
# endif
#elif defined(__GNUC__)
# define COMPILER_ID "GNU"
# define COMPILER_VERSION_MAJOR DEC(__GNUC__)
# if defined(__GNUC_MINOR__)
# define COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__)
# endif
# if defined(__GNUC_PATCHLEVEL__)
# define COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
# endif
#elif defined(_MSC_VER)
# define COMPILER_ID "MSVC"
/* _MSC_VER = VVRR */
# define COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100)
# define COMPILER_VERSION_MINOR DEC(_MSC_VER % 100)
# if defined(_MSC_FULL_VER)
# if _MSC_VER >= 1400
/* _MSC_FULL_VER = VVRRPPPPP */
# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000)
# else
/* _MSC_FULL_VER = VVRRPPPP */
# define COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000)
# endif
# endif
# if defined(_MSC_BUILD)
# define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD)
# endif
#elif defined(_ADI_COMPILER)
# define COMPILER_ID "ADSP"
#if defined(__VERSIONNUM__)
/* __VERSIONNUM__ = 0xVVRRPPTT */
# define COMPILER_VERSION_MAJOR DEC(__VERSIONNUM__ >> 24 & 0xFF)
# define COMPILER_VERSION_MINOR DEC(__VERSIONNUM__ >> 16 & 0xFF)
# define COMPILER_VERSION_PATCH DEC(__VERSIONNUM__ >> 8 & 0xFF)
# define COMPILER_VERSION_TWEAK DEC(__VERSIONNUM__ & 0xFF)
#endif
#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)
# define COMPILER_ID "IAR"
# if defined(__VER__) && defined(__ICCARM__)
# define COMPILER_VERSION_MAJOR DEC((__VER__) / 1000000)
# define COMPILER_VERSION_MINOR DEC(((__VER__) / 1000) % 1000)
# define COMPILER_VERSION_PATCH DEC((__VER__) % 1000)
# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__)
# elif defined(__VER__) && (defined(__ICCAVR__) || defined(__ICCRX__) || defined(__ICCRH850__) || defined(__ICCRL78__) || defined(__ICC430__) || defined(__ICCRISCV__) || defined(__ICCV850__) || defined(__ICC8051__) || defined(__ICCSTM8__))
# define COMPILER_VERSION_MAJOR DEC((__VER__) / 100)
# define COMPILER_VERSION_MINOR DEC((__VER__) - (((__VER__) / 100)*100))
# define COMPILER_VERSION_PATCH DEC(__SUBVERSION__)
# define COMPILER_VERSION_INTERNAL DEC(__IAR_SYSTEMS_ICC__)
# endif
#elif defined(__DCC__) && defined(_DIAB_TOOL)
# define COMPILER_ID "Diab"
# define COMPILER_VERSION_MAJOR DEC(__VERSION_MAJOR_NUMBER__)
# define COMPILER_VERSION_MINOR DEC(__VERSION_MINOR_NUMBER__)
# define COMPILER_VERSION_PATCH DEC(__VERSION_ARCH_FEATURE_NUMBER__)
# define COMPILER_VERSION_TWEAK DEC(__VERSION_BUG_FIX_NUMBER__)
#elif defined(__SDCC_VERSION_MAJOR) || defined(SDCC)
# define COMPILER_ID "SDCC"
# if defined(__SDCC_VERSION_MAJOR)
# define COMPILER_VERSION_MAJOR DEC(__SDCC_VERSION_MAJOR)
# define COMPILER_VERSION_MINOR DEC(__SDCC_VERSION_MINOR)
# define COMPILER_VERSION_PATCH DEC(__SDCC_VERSION_PATCH)
# else
/* SDCC = VRP */
# define COMPILER_VERSION_MAJOR DEC(SDCC/100)
# define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10)
# define COMPILER_VERSION_PATCH DEC(SDCC % 10)
# endif
/* These compilers are either not known or too old to define an
identification macro. Try to identify the platform and guess that
it is the native compiler. */
#elif defined(__hpux) || defined(__hpua)
# define COMPILER_ID "HP"
#else /* unknown compiler */
# define COMPILER_ID ""
#endif
/* Construct the string literal in pieces to prevent the source from
getting matched. Store it in a pointer rather than an array
because some compilers will just produce instructions to fill the
array rather than assigning a pointer to a static array. */
char const* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
#ifdef SIMULATE_ID
char const* info_simulate = "INFO" ":" "simulate[" SIMULATE_ID "]";
#endif
#ifdef __QNXNTO__
char const* qnxnto = "INFO" ":" "qnxnto[]";
#endif
#if defined(__CRAYXT_COMPUTE_LINUX_TARGET)
char const *info_cray = "INFO" ":" "compiler_wrapper[CrayPrgEnv]";
#endif
#define STRINGIFY_HELPER(X) #X
#define STRINGIFY(X) STRINGIFY_HELPER(X)
/* Identify known platforms by name. */
#if defined(__linux) || defined(__linux__) || defined(linux)
# define PLATFORM_ID "Linux"
#elif defined(__MSYS__)
# define PLATFORM_ID "MSYS"
#elif defined(__CYGWIN__)
# define PLATFORM_ID "Cygwin"
#elif defined(__MINGW32__)
# define PLATFORM_ID "MinGW"
#elif defined(__APPLE__)
# define PLATFORM_ID "Darwin"
#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
# define PLATFORM_ID "Windows"
#elif defined(__FreeBSD__) || defined(__FreeBSD)
# define PLATFORM_ID "FreeBSD"
#elif defined(__NetBSD__) || defined(__NetBSD)
# define PLATFORM_ID "NetBSD"
#elif defined(__OpenBSD__) || defined(__OPENBSD)
# define PLATFORM_ID "OpenBSD"
#elif defined(__sun) || defined(sun)
# define PLATFORM_ID "SunOS"
#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
# define PLATFORM_ID "AIX"
#elif defined(__hpux) || defined(__hpux__)
# define PLATFORM_ID "HP-UX"
#elif defined(__HAIKU__)
# define PLATFORM_ID "Haiku"
#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
# define PLATFORM_ID "BeOS"
#elif defined(__QNX__) || defined(__QNXNTO__)
# define PLATFORM_ID "QNX"
#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__)
# define PLATFORM_ID "Tru64"
#elif defined(__riscos) || defined(__riscos__)
# define PLATFORM_ID "RISCos"
#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__)
# define PLATFORM_ID "SINIX"
#elif defined(__UNIX_SV__)
# define PLATFORM_ID "UNIX_SV"
#elif defined(__bsdos__)
# define PLATFORM_ID "BSDOS"
#elif defined(_MPRAS) || defined(MPRAS)
# define PLATFORM_ID "MP-RAS"
#elif defined(__osf) || defined(__osf__)
# define PLATFORM_ID "OSF1"
#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv)
# define PLATFORM_ID "SCO_SV"
#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX)
# define PLATFORM_ID "ULTRIX"
#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
# define PLATFORM_ID "Xenix"
#elif defined(__WATCOMC__)
# if defined(__LINUX__)
# define PLATFORM_ID "Linux"
# elif defined(__DOS__)
# define PLATFORM_ID "DOS"
# elif defined(__OS2__)
# define PLATFORM_ID "OS2"
# elif defined(__WINDOWS__)
# define PLATFORM_ID "Windows3x"
# elif defined(__VXWORKS__)
# define PLATFORM_ID "VxWorks"
# else /* unknown platform */
# define PLATFORM_ID
# endif
#elif defined(__INTEGRITY)
# if defined(INT_178B)
# define PLATFORM_ID "Integrity178"
# else /* regular Integrity */
# define PLATFORM_ID "Integrity"
# endif
# elif defined(_ADI_COMPILER)
# define PLATFORM_ID "ADSP"
#else /* unknown platform */
# define PLATFORM_ID
#endif
/* For windows compilers MSVC and Intel we can determine
the architecture of the compiler being used. This is because
the compilers do not have flags that can change the architecture,
but rather depend on which compiler is being used
*/
#if defined(_WIN32) && defined(_MSC_VER)
# if defined(_M_IA64)
# define ARCHITECTURE_ID "IA64"
# elif defined(_M_ARM64EC)
# define ARCHITECTURE_ID "ARM64EC"
# elif defined(_M_X64) || defined(_M_AMD64)
# define ARCHITECTURE_ID "x64"
# elif defined(_M_IX86)
# define ARCHITECTURE_ID "X86"
# elif defined(_M_ARM64)
# define ARCHITECTURE_ID "ARM64"
# elif defined(_M_ARM)
# if _M_ARM == 4
# define ARCHITECTURE_ID "ARMV4I"
# elif _M_ARM == 5
# define ARCHITECTURE_ID "ARMV5I"
# else
# define ARCHITECTURE_ID "ARMV" STRINGIFY(_M_ARM)
# endif
# elif defined(_M_MIPS)
# define ARCHITECTURE_ID "MIPS"
# elif defined(_M_SH)
# define ARCHITECTURE_ID "SHx"
# else /* unknown architecture */
# define ARCHITECTURE_ID ""
# endif
#elif defined(__WATCOMC__)
# if defined(_M_I86)
# define ARCHITECTURE_ID "I86"
# elif defined(_M_IX86)
# define ARCHITECTURE_ID "X86"
# else /* unknown architecture */
# define ARCHITECTURE_ID ""
# endif
#elif defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)
# if defined(__ICCARM__)
# define ARCHITECTURE_ID "ARM"
# elif defined(__ICCRX__)
# define ARCHITECTURE_ID "RX"
# elif defined(__ICCRH850__)
# define ARCHITECTURE_ID "RH850"
# elif defined(__ICCRL78__)
# define ARCHITECTURE_ID "RL78"
# elif defined(__ICCRISCV__)
# define ARCHITECTURE_ID "RISCV"
# elif defined(__ICCAVR__)
# define ARCHITECTURE_ID "AVR"
# elif defined(__ICC430__)
# define ARCHITECTURE_ID "MSP430"
# elif defined(__ICCV850__)
# define ARCHITECTURE_ID "V850"
# elif defined(__ICC8051__)
# define ARCHITECTURE_ID "8051"
# elif defined(__ICCSTM8__)
# define ARCHITECTURE_ID "STM8"
# else /* unknown architecture */
# define ARCHITECTURE_ID ""
# endif
#elif defined(__ghs__)
# if defined(__PPC64__)
# define ARCHITECTURE_ID "PPC64"
# elif defined(__ppc__)
# define ARCHITECTURE_ID "PPC"
# elif defined(__ARM__)
# define ARCHITECTURE_ID "ARM"
# elif defined(__x86_64__)
# define ARCHITECTURE_ID "x64"
# elif defined(__i386__)
# define ARCHITECTURE_ID "X86"
# else /* unknown architecture */
# define ARCHITECTURE_ID ""
# endif
#elif defined(__clang__) && defined(__ti__)
# if defined(__ARM_ARCH)
# define ARCHITECTURE_ID "ARM"
# else /* unknown architecture */
# define ARCHITECTURE_ID ""
# endif
#elif defined(__TI_COMPILER_VERSION__)
# if defined(__TI_ARM__)
# define ARCHITECTURE_ID "ARM"
# elif defined(__MSP430__)
# define ARCHITECTURE_ID "MSP430"
# elif defined(__TMS320C28XX__)
# define ARCHITECTURE_ID "TMS320C28x"
# elif defined(__TMS320C6X__) || defined(_TMS320C6X)
# define ARCHITECTURE_ID "TMS320C6x"
# else /* unknown architecture */
# define ARCHITECTURE_ID ""
# endif
# elif defined(__ADSPSHARC__)
# define ARCHITECTURE_ID "SHARC"
# elif defined(__ADSPBLACKFIN__)
# define ARCHITECTURE_ID "Blackfin"
#elif defined(__TASKING__)
# if defined(__CTC__) || defined(__CPTC__)
# define ARCHITECTURE_ID "TriCore"
# elif defined(__CMCS__)
# define ARCHITECTURE_ID "MCS"
# elif defined(__CARM__) || defined(__CPARM__)
# define ARCHITECTURE_ID "ARM"
# elif defined(__CARC__)
# define ARCHITECTURE_ID "ARC"
# elif defined(__C51__)
# define ARCHITECTURE_ID "8051"
# elif defined(__CPCP__)
# define ARCHITECTURE_ID "PCP"
# else
# define ARCHITECTURE_ID ""
# endif
#elif defined(__RENESAS__)
# if defined(__CCRX__)
# define ARCHITECTURE_ID "RX"
# elif defined(__CCRL__)
# define ARCHITECTURE_ID "RL78"
# elif defined(__CCRH__)
# define ARCHITECTURE_ID "RH850"
# else
# define ARCHITECTURE_ID ""
# endif
#else
# define ARCHITECTURE_ID
#endif
/* Convert integer to decimal digit literals. */
#define DEC(n) \
('0' + (((n) / 10000000)%10)), \
('0' + (((n) / 1000000)%10)), \
('0' + (((n) / 100000)%10)), \
('0' + (((n) / 10000)%10)), \
('0' + (((n) / 1000)%10)), \
('0' + (((n) / 100)%10)), \
('0' + (((n) / 10)%10)), \
('0' + ((n) % 10))
/* Convert integer to hex digit literals. */
#define HEX(n) \
('0' + ((n)>>28 & 0xF)), \
('0' + ((n)>>24 & 0xF)), \
('0' + ((n)>>20 & 0xF)), \
('0' + ((n)>>16 & 0xF)), \
('0' + ((n)>>12 & 0xF)), \
('0' + ((n)>>8 & 0xF)), \
('0' + ((n)>>4 & 0xF)), \
('0' + ((n) & 0xF))
/* Construct a string literal encoding the version number. */
#ifdef COMPILER_VERSION
char const* info_version = "INFO" ":" "compiler_version[" COMPILER_VERSION "]";
/* Construct a string literal encoding the version number components. */
#elif defined(COMPILER_VERSION_MAJOR)
char const info_version[] = {
'I', 'N', 'F', 'O', ':',
'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','[',
COMPILER_VERSION_MAJOR,
# ifdef COMPILER_VERSION_MINOR
'.', COMPILER_VERSION_MINOR,
# ifdef COMPILER_VERSION_PATCH
'.', COMPILER_VERSION_PATCH,
# ifdef COMPILER_VERSION_TWEAK
'.', COMPILER_VERSION_TWEAK,
# endif
# endif
# endif
']','\0'};
#endif
/* Construct a string literal encoding the internal version number. */
#ifdef COMPILER_VERSION_INTERNAL
char const info_version_internal[] = {
'I', 'N', 'F', 'O', ':',
'c','o','m','p','i','l','e','r','_','v','e','r','s','i','o','n','_',
'i','n','t','e','r','n','a','l','[',
COMPILER_VERSION_INTERNAL,']','\0'};
#elif defined(COMPILER_VERSION_INTERNAL_STR)
char const* info_version_internal = "INFO" ":" "compiler_version_internal[" COMPILER_VERSION_INTERNAL_STR "]";
#endif
/* Construct a string literal encoding the version number components. */
#ifdef SIMULATE_VERSION_MAJOR
char const info_simulate_version[] = {
'I', 'N', 'F', 'O', ':',
's','i','m','u','l','a','t','e','_','v','e','r','s','i','o','n','[',
SIMULATE_VERSION_MAJOR,
# ifdef SIMULATE_VERSION_MINOR
'.', SIMULATE_VERSION_MINOR,
# ifdef SIMULATE_VERSION_PATCH
'.', SIMULATE_VERSION_PATCH,
# ifdef SIMULATE_VERSION_TWEAK
'.', SIMULATE_VERSION_TWEAK,
# endif
# endif
# endif
']','\0'};
#endif
/* Construct the string literal in pieces to prevent the source from
getting matched. Store it in a pointer rather than an array
because some compilers will just produce instructions to fill the
array rather than assigning a pointer to a static array. */
char const* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]";
char const* info_arch = "INFO" ":" "arch[" ARCHITECTURE_ID "]";
#define C_STD_99 199901L
#define C_STD_11 201112L
#define C_STD_17 201710L
#define C_STD_23 202311L
#ifdef __STDC_VERSION__
# define C_STD __STDC_VERSION__
#endif
#if !defined(__STDC__) && !defined(__clang__) && !defined(__RENESAS__)
# if defined(_MSC_VER) || defined(__ibmxl__) || defined(__IBMC__)
# define C_VERSION "90"
# else
# define C_VERSION
# endif
#elif C_STD > C_STD_17
# define C_VERSION "23"
#elif C_STD > C_STD_11
# define C_VERSION "17"
#elif C_STD > C_STD_99
# define C_VERSION "11"
#elif C_STD >= C_STD_99
# define C_VERSION "99"
#else
# define C_VERSION "90"
#endif
const char* info_language_standard_default =
"INFO" ":" "standard_default[" C_VERSION "]";
const char* info_language_extensions_default = "INFO" ":" "extensions_default["
#if (defined(__clang__) || defined(__GNUC__) || defined(__xlC__) || \
defined(__TI_COMPILER_VERSION__) || defined(__RENESAS__)) && \
!defined(__STRICT_ANSI__)
"ON"
#else
"OFF"
#endif
"]";
/*--------------------------------------------------------------------------*/
#ifdef ID_VOID_MAIN
void main() {}
#else
# if defined(__CLASSIC_C__)
int main(argc, argv) int argc; char *argv[];
# else
int main(int argc, char* argv[])
# endif
{
int require = 0;
require += info_compiler[argc];
require += info_platform[argc];
require += info_arch[argc];
#ifdef COMPILER_VERSION_MAJOR
require += info_version[argc];
#endif
#if defined(COMPILER_VERSION_INTERNAL) || defined(COMPILER_VERSION_INTERNAL_STR)
require += info_version_internal[argc];
#endif
#ifdef SIMULATE_ID
require += info_simulate[argc];
#endif
#ifdef SIMULATE_VERSION_MAJOR
require += info_simulate_version[argc];
#endif
#if defined(__CRAYXT_COMPUTE_LINUX_TARGET)
require += info_cray[argc];
#endif
require += info_language_standard_default[argc];
require += info_language_extensions_default[argc];
(void)argv;
return require;
}
#endif

BIN
tools/logreceiver/build/CMakeFiles/4.1.2/CompilerIdC/a.out

Binary file not shown.

1363
tools/logreceiver/build/CMakeFiles/CMakeConfigureLog.yaml

File diff suppressed because it is too large Load Diff

16
tools/logreceiver/build/CMakeFiles/CMakeDirectoryInformation.cmake

@ -0,0 +1,16 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 4.1
# Relative path conversion top directories.
set(CMAKE_RELATIVE_PATH_TOP_SOURCE "/home/user/utun2/tools/logreceiver")
set(CMAKE_RELATIVE_PATH_TOP_BINARY "/home/user/utun2/tools/logreceiver/build")
# Force unix paths in dependencies.
set(CMAKE_FORCE_UNIX_PATHS 1)
# The C and CXX include file regular expressions for this directory.
set(CMAKE_C_INCLUDE_REGEX_SCAN "^.*$")
set(CMAKE_C_INCLUDE_REGEX_COMPLAIN "^$")
set(CMAKE_CXX_INCLUDE_REGEX_SCAN ${CMAKE_C_INCLUDE_REGEX_SCAN})
set(CMAKE_CXX_INCLUDE_REGEX_COMPLAIN ${CMAKE_C_INCLUDE_REGEX_COMPLAIN})

7
tools/logreceiver/build/CMakeFiles/InstallScripts.json

@ -0,0 +1,7 @@
{
"InstallScripts" :
[
"/home/user/utun2/tools/logreceiver/build/cmake_install.cmake"
],
"Parallel" : false
}

120
tools/logreceiver/build/CMakeFiles/Makefile.cmake

@ -0,0 +1,120 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 4.1
# The generator used is:
set(CMAKE_DEPENDS_GENERATOR "Unix Makefiles")
# The top level Makefile was generated from the following files:
set(CMAKE_MAKEFILE_DEPENDS
"CMakeCache.txt"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/CMakeCCompiler.cmake.in"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/CMakeCCompilerABI.c"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/CMakeCInformation.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/CMakeCommonLanguageInclude.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/CMakeCompilerIdDetection.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/CMakeDetermineCCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/CMakeDetermineCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/CMakeDetermineCompilerABI.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/CMakeDetermineCompilerId.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/CMakeDetermineCompilerSupport.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/CMakeDetermineSystem.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/CMakeFindBinUtils.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/CMakeGenericSystem.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/CMakeInitializeConfigs.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/CMakeLanguageInformation.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/CMakeParseImplicitIncludeInfo.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/CMakeParseImplicitLinkInfo.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/CMakeParseLibraryArchitecture.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/CMakeSystem.cmake.in"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/CMakeSystemSpecificInformation.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/CMakeSystemSpecificInitialize.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/CMakeTestCCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/CMakeTestCompilerCommon.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/CMakeUnixFindMake.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/ADSP-DetermineCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/ARMCC-DetermineCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/ARMClang-DetermineCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/AppleClang-DetermineCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/Borland-DetermineCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/Bruce-C-DetermineCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/CMakeCommonCompilerMacros.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/Clang-DetermineCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/Clang-DetermineCompilerInternal.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/Compaq-C-DetermineCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/Cray-DetermineCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/CrayClang-DetermineCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/Diab-DetermineCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/Embarcadero-DetermineCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/Fujitsu-DetermineCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/FujitsuClang-DetermineCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/GHS-DetermineCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/GNU-C-DetermineCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/GNU-C.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/GNU-FindBinUtils.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/GNU.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/HP-C-DetermineCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/IAR-DetermineCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/IBMClang-C-DetermineCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/Intel-DetermineCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/IntelLLVM-DetermineCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/LCC-C-DetermineCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/MSVC-DetermineCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/NVHPC-DetermineCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/NVIDIA-DetermineCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/OpenWatcom-DetermineCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/OrangeC-DetermineCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/PGI-DetermineCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/PathScale-DetermineCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/Renesas-DetermineCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/SCO-DetermineCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/SDCC-C-DetermineCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/SunPro-C-DetermineCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/TI-DetermineCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/TIClang-DetermineCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/Tasking-DetermineCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/TinyCC-C-DetermineCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/VisualAge-C-DetermineCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/Watcom-DetermineCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/XL-C-DetermineCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/XLClang-C-DetermineCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Compiler/zOS-C-DetermineCompiler.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Internal/CMakeCLinkerInformation.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Internal/CMakeCommonLinkerInformation.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Internal/CMakeDetermineLinkerId.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Internal/CMakeInspectCLinker.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Internal/FeatureTesting.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Linker/GNU-C.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Linker/GNU.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Platform/Linker/GNU.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Platform/Linker/Linux-GNU-C.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Platform/Linker/Linux-GNU.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Platform/Linux-GNU-C.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Platform/Linux-GNU.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Platform/Linux-Initialize.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Platform/Linux.cmake"
"/home/user/android/cmake/4.1.2/share/cmake-4.1/Modules/Platform/UnixPaths.cmake"
"/home/user/utun2/tools/logreceiver/CMakeLists.txt"
"CMakeFiles/4.1.2/CMakeCCompiler.cmake"
"CMakeFiles/4.1.2/CMakeSystem.cmake"
)
# The corresponding makefile is:
set(CMAKE_MAKEFILE_OUTPUTS
"Makefile"
"CMakeFiles/cmake.check_cache"
)
# Byproducts of CMake generate step:
set(CMAKE_MAKEFILE_PRODUCTS
"CMakeFiles/4.1.2/CMakeSystem.cmake"
"CMakeFiles/4.1.2/CMakeCCompiler.cmake"
"CMakeFiles/4.1.2/CMakeCCompiler.cmake"
"CMakeFiles/4.1.2/CMakeCCompiler.cmake"
"CMakeFiles/CMakeDirectoryInformation.cmake"
)
# Dependency information for all targets:
set(CMAKE_DEPEND_INFO_FILES
"CMakeFiles/logreceiver.dir/DependInfo.cmake"
)

122
tools/logreceiver/build/CMakeFiles/Makefile2

@ -0,0 +1,122 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 4.1
# Default target executed when no arguments are given to make.
default_target: all
.PHONY : default_target
#=============================================================================
# Special targets provided by cmake.
# Disable implicit rules so canonical targets will work.
.SUFFIXES:
# Disable VCS-based implicit rules.
% : %,v
# Disable VCS-based implicit rules.
% : RCS/%
# Disable VCS-based implicit rules.
% : RCS/%,v
# Disable VCS-based implicit rules.
% : SCCS/s.%
# Disable VCS-based implicit rules.
% : s.%
.SUFFIXES: .hpux_make_needs_suffix_list
# Command-line flag to silence nested $(MAKE).
$(VERBOSE)MAKESILENT = -s
#Suppress display of executed commands.
$(VERBOSE).SILENT:
# A target that is always out of date.
cmake_force:
.PHONY : cmake_force
#=============================================================================
# Set environment variables for the build.
# The shell in which to execute make rules.
SHELL = /bin/sh
# The CMake executable.
CMAKE_COMMAND = /home/user/android/cmake/4.1.2/bin/cmake
# The command to remove a file.
RM = /home/user/android/cmake/4.1.2/bin/cmake -E rm -f
# Escaping for special characters.
EQUALS = =
# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /home/user/utun2/tools/logreceiver
# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /home/user/utun2/tools/logreceiver/build
#=============================================================================
# Directory level rules for the build root directory
# The main recursive "all" target.
all: CMakeFiles/logreceiver.dir/all
.PHONY : all
# The main recursive "codegen" target.
codegen: CMakeFiles/logreceiver.dir/codegen
.PHONY : codegen
# The main recursive "preinstall" target.
preinstall:
.PHONY : preinstall
# The main recursive "clean" target.
clean: CMakeFiles/logreceiver.dir/clean
.PHONY : clean
#=============================================================================
# Target rules for target CMakeFiles/logreceiver.dir
# All Build rule for target.
CMakeFiles/logreceiver.dir/all:
$(MAKE) $(MAKESILENT) -f CMakeFiles/logreceiver.dir/build.make CMakeFiles/logreceiver.dir/depend
$(MAKE) $(MAKESILENT) -f CMakeFiles/logreceiver.dir/build.make CMakeFiles/logreceiver.dir/build
@$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --progress-dir=/home/user/utun2/tools/logreceiver/build/CMakeFiles --progress-num=1,2 "Built target logreceiver"
.PHONY : CMakeFiles/logreceiver.dir/all
# Build rule for subdir invocation for target.
CMakeFiles/logreceiver.dir/rule: cmake_check_build_system
$(CMAKE_COMMAND) -E cmake_progress_start /home/user/utun2/tools/logreceiver/build/CMakeFiles 2
$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 CMakeFiles/logreceiver.dir/all
$(CMAKE_COMMAND) -E cmake_progress_start /home/user/utun2/tools/logreceiver/build/CMakeFiles 0
.PHONY : CMakeFiles/logreceiver.dir/rule
# Convenience name for target.
logreceiver: CMakeFiles/logreceiver.dir/rule
.PHONY : logreceiver
# codegen rule for target.
CMakeFiles/logreceiver.dir/codegen:
$(MAKE) $(MAKESILENT) -f CMakeFiles/logreceiver.dir/build.make CMakeFiles/logreceiver.dir/codegen
@$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --progress-dir=/home/user/utun2/tools/logreceiver/build/CMakeFiles --progress-num=1,2 "Finished codegen for target logreceiver"
.PHONY : CMakeFiles/logreceiver.dir/codegen
# clean rule for target.
CMakeFiles/logreceiver.dir/clean:
$(MAKE) $(MAKESILENT) -f CMakeFiles/logreceiver.dir/build.make CMakeFiles/logreceiver.dir/clean
.PHONY : CMakeFiles/logreceiver.dir/clean
#=============================================================================
# Special targets to cleanup operation of make.
# Special rule to run CMake to check the build system integrity.
# No rule that depends on this can have commands that come from listfiles
# because they might be regenerated.
cmake_check_build_system:
$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
.PHONY : cmake_check_build_system

3
tools/logreceiver/build/CMakeFiles/TargetDirectories.txt

@ -0,0 +1,3 @@
/home/user/utun2/tools/logreceiver/build/CMakeFiles/logreceiver.dir
/home/user/utun2/tools/logreceiver/build/CMakeFiles/edit_cache.dir
/home/user/utun2/tools/logreceiver/build/CMakeFiles/rebuild_cache.dir

1
tools/logreceiver/build/CMakeFiles/cmake.check_cache

@ -0,0 +1 @@
# This file is generated by cmake for dependency checking of the CMakeCache.txt file

24
tools/logreceiver/build/CMakeFiles/logreceiver.dir/DependInfo.cmake

@ -0,0 +1,24 @@
# Consider dependencies only in project.
set(CMAKE_DEPENDS_IN_PROJECT_ONLY OFF)
# The set of languages for which implicit dependencies are needed:
set(CMAKE_DEPENDS_LANGUAGES
)
# The set of dependency files which are needed:
set(CMAKE_DEPENDS_DEPENDENCY_FILES
"/home/user/utun2/tools/logreceiver/logreceiver.c" "CMakeFiles/logreceiver.dir/logreceiver.c.o" "gcc" "CMakeFiles/logreceiver.dir/logreceiver.c.o.d"
"" "logreceiver" "gcc" "CMakeFiles/logreceiver.dir/link.d"
)
# Targets to which this target links which contain Fortran sources.
set(CMAKE_Fortran_TARGET_LINKED_INFO_FILES
)
# Targets to which this target links which contain Fortran sources.
set(CMAKE_Fortran_TARGET_FORWARD_LINKED_INFO_FILES
)
# Fortran module output directory.
set(CMAKE_Fortran_TARGET_MODULE_DIR "")

114
tools/logreceiver/build/CMakeFiles/logreceiver.dir/build.make

@ -0,0 +1,114 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 4.1
# Delete rule output on recipe failure.
.DELETE_ON_ERROR:
#=============================================================================
# Special targets provided by cmake.
# Disable implicit rules so canonical targets will work.
.SUFFIXES:
# Disable VCS-based implicit rules.
% : %,v
# Disable VCS-based implicit rules.
% : RCS/%
# Disable VCS-based implicit rules.
% : RCS/%,v
# Disable VCS-based implicit rules.
% : SCCS/s.%
# Disable VCS-based implicit rules.
% : s.%
.SUFFIXES: .hpux_make_needs_suffix_list
# Command-line flag to silence nested $(MAKE).
$(VERBOSE)MAKESILENT = -s
#Suppress display of executed commands.
$(VERBOSE).SILENT:
# A target that is always out of date.
cmake_force:
.PHONY : cmake_force
#=============================================================================
# Set environment variables for the build.
# The shell in which to execute make rules.
SHELL = /bin/sh
# The CMake executable.
CMAKE_COMMAND = /home/user/android/cmake/4.1.2/bin/cmake
# The command to remove a file.
RM = /home/user/android/cmake/4.1.2/bin/cmake -E rm -f
# Escaping for special characters.
EQUALS = =
# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /home/user/utun2/tools/logreceiver
# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /home/user/utun2/tools/logreceiver/build
# Include any dependencies generated for this target.
include CMakeFiles/logreceiver.dir/depend.make
# Include any dependencies generated by the compiler for this target.
include CMakeFiles/logreceiver.dir/compiler_depend.make
# Include the progress variables for this target.
include CMakeFiles/logreceiver.dir/progress.make
# Include the compile flags for this target's objects.
include CMakeFiles/logreceiver.dir/flags.make
CMakeFiles/logreceiver.dir/codegen:
.PHONY : CMakeFiles/logreceiver.dir/codegen
CMakeFiles/logreceiver.dir/logreceiver.c.o: CMakeFiles/logreceiver.dir/flags.make
CMakeFiles/logreceiver.dir/logreceiver.c.o: /home/user/utun2/tools/logreceiver/logreceiver.c
CMakeFiles/logreceiver.dir/logreceiver.c.o: CMakeFiles/logreceiver.dir/compiler_depend.ts
@$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green --progress-dir=/home/user/utun2/tools/logreceiver/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Building C object CMakeFiles/logreceiver.dir/logreceiver.c.o"
/usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -MD -MT CMakeFiles/logreceiver.dir/logreceiver.c.o -MF CMakeFiles/logreceiver.dir/logreceiver.c.o.d -o CMakeFiles/logreceiver.dir/logreceiver.c.o -c /home/user/utun2/tools/logreceiver/logreceiver.c
CMakeFiles/logreceiver.dir/logreceiver.c.i: cmake_force
@$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Preprocessing C source to CMakeFiles/logreceiver.dir/logreceiver.c.i"
/usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -E /home/user/utun2/tools/logreceiver/logreceiver.c > CMakeFiles/logreceiver.dir/logreceiver.c.i
CMakeFiles/logreceiver.dir/logreceiver.c.s: cmake_force
@$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green "Compiling C source to assembly CMakeFiles/logreceiver.dir/logreceiver.c.s"
/usr/bin/cc $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -S /home/user/utun2/tools/logreceiver/logreceiver.c -o CMakeFiles/logreceiver.dir/logreceiver.c.s
# Object files for target logreceiver
logreceiver_OBJECTS = \
"CMakeFiles/logreceiver.dir/logreceiver.c.o"
# External object files for target logreceiver
logreceiver_EXTERNAL_OBJECTS =
logreceiver: CMakeFiles/logreceiver.dir/logreceiver.c.o
logreceiver: CMakeFiles/logreceiver.dir/build.make
logreceiver: CMakeFiles/logreceiver.dir/compiler_depend.ts
logreceiver: CMakeFiles/logreceiver.dir/link.txt
@$(CMAKE_COMMAND) -E cmake_echo_color "--switch=$(COLOR)" --green --bold --progress-dir=/home/user/utun2/tools/logreceiver/build/CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Linking C executable logreceiver"
$(CMAKE_COMMAND) -E cmake_link_script CMakeFiles/logreceiver.dir/link.txt --verbose=$(VERBOSE)
# Rule to build all files generated by this target.
CMakeFiles/logreceiver.dir/build: logreceiver
.PHONY : CMakeFiles/logreceiver.dir/build
CMakeFiles/logreceiver.dir/clean:
$(CMAKE_COMMAND) -P CMakeFiles/logreceiver.dir/cmake_clean.cmake
.PHONY : CMakeFiles/logreceiver.dir/clean
CMakeFiles/logreceiver.dir/depend:
cd /home/user/utun2/tools/logreceiver/build && $(CMAKE_COMMAND) -E cmake_depends "Unix Makefiles" /home/user/utun2/tools/logreceiver /home/user/utun2/tools/logreceiver /home/user/utun2/tools/logreceiver/build /home/user/utun2/tools/logreceiver/build /home/user/utun2/tools/logreceiver/build/CMakeFiles/logreceiver.dir/DependInfo.cmake "--color=$(COLOR)"
.PHONY : CMakeFiles/logreceiver.dir/depend

12
tools/logreceiver/build/CMakeFiles/logreceiver.dir/cmake_clean.cmake

@ -0,0 +1,12 @@
file(REMOVE_RECURSE
"CMakeFiles/logreceiver.dir/link.d"
"CMakeFiles/logreceiver.dir/logreceiver.c.o"
"CMakeFiles/logreceiver.dir/logreceiver.c.o.d"
"logreceiver"
"logreceiver.pdb"
)
# Per-language clean rules from dependency scanning.
foreach(lang C)
include(CMakeFiles/logreceiver.dir/cmake_clean_${lang}.cmake OPTIONAL)
endforeach()

134
tools/logreceiver/build/CMakeFiles/logreceiver.dir/compiler_depend.internal

@ -0,0 +1,134 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 4.1
CMakeFiles/logreceiver.dir/logreceiver.c.o
/home/user/utun2/tools/logreceiver/logreceiver.c
/usr/include/alloca.h
/usr/include/arpa/inet.h
/usr/include/asm-generic/bitsperlong.h
/usr/include/asm-generic/errno-base.h
/usr/include/asm-generic/errno.h
/usr/include/asm-generic/posix_types.h
/usr/include/asm-generic/socket.h
/usr/include/asm-generic/sockios.h
/usr/include/endian.h
/usr/include/errno.h
/usr/include/features-time64.h
/usr/include/features.h
/usr/include/linux/errno.h
/usr/include/linux/posix_types.h
/usr/include/linux/stddef.h
/usr/include/netinet/in.h
/usr/include/signal.h
/usr/include/stdc-predef.h
/usr/include/stdio.h
/usr/include/stdlib.h
/usr/include/string.h
/usr/include/strings.h
/usr/include/unistd.h
/usr/include/x86_64-linux-gnu/asm/bitsperlong.h
/usr/include/x86_64-linux-gnu/asm/errno.h
/usr/include/x86_64-linux-gnu/asm/posix_types.h
/usr/include/x86_64-linux-gnu/asm/posix_types_64.h
/usr/include/x86_64-linux-gnu/asm/socket.h
/usr/include/x86_64-linux-gnu/asm/sockios.h
/usr/include/x86_64-linux-gnu/bits/atomic_wide_counter.h
/usr/include/x86_64-linux-gnu/bits/byteswap.h
/usr/include/x86_64-linux-gnu/bits/confname.h
/usr/include/x86_64-linux-gnu/bits/endian.h
/usr/include/x86_64-linux-gnu/bits/endianness.h
/usr/include/x86_64-linux-gnu/bits/environments.h
/usr/include/x86_64-linux-gnu/bits/errno.h
/usr/include/x86_64-linux-gnu/bits/floatn-common.h
/usr/include/x86_64-linux-gnu/bits/floatn.h
/usr/include/x86_64-linux-gnu/bits/getopt_core.h
/usr/include/x86_64-linux-gnu/bits/getopt_posix.h
/usr/include/x86_64-linux-gnu/bits/in.h
/usr/include/x86_64-linux-gnu/bits/libc-header-start.h
/usr/include/x86_64-linux-gnu/bits/long-double.h
/usr/include/x86_64-linux-gnu/bits/posix_opt.h
/usr/include/x86_64-linux-gnu/bits/pthreadtypes-arch.h
/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h
/usr/include/x86_64-linux-gnu/bits/select.h
/usr/include/x86_64-linux-gnu/bits/sigaction.h
/usr/include/x86_64-linux-gnu/bits/sigcontext.h
/usr/include/x86_64-linux-gnu/bits/sigevent-consts.h
/usr/include/x86_64-linux-gnu/bits/siginfo-arch.h
/usr/include/x86_64-linux-gnu/bits/siginfo-consts.h
/usr/include/x86_64-linux-gnu/bits/signal_ext.h
/usr/include/x86_64-linux-gnu/bits/signum-arch.h
/usr/include/x86_64-linux-gnu/bits/signum-generic.h
/usr/include/x86_64-linux-gnu/bits/sigstack.h
/usr/include/x86_64-linux-gnu/bits/sigstksz.h
/usr/include/x86_64-linux-gnu/bits/sigthread.h
/usr/include/x86_64-linux-gnu/bits/sockaddr.h
/usr/include/x86_64-linux-gnu/bits/socket.h
/usr/include/x86_64-linux-gnu/bits/socket_type.h
/usr/include/x86_64-linux-gnu/bits/ss_flags.h
/usr/include/x86_64-linux-gnu/bits/stdint-intn.h
/usr/include/x86_64-linux-gnu/bits/stdint-uintn.h
/usr/include/x86_64-linux-gnu/bits/stdio_lim.h
/usr/include/x86_64-linux-gnu/bits/stdlib-float.h
/usr/include/x86_64-linux-gnu/bits/struct_mutex.h
/usr/include/x86_64-linux-gnu/bits/struct_rwlock.h
/usr/include/x86_64-linux-gnu/bits/thread-shared-types.h
/usr/include/x86_64-linux-gnu/bits/time64.h
/usr/include/x86_64-linux-gnu/bits/timesize.h
/usr/include/x86_64-linux-gnu/bits/types.h
/usr/include/x86_64-linux-gnu/bits/types/FILE.h
/usr/include/x86_64-linux-gnu/bits/types/__FILE.h
/usr/include/x86_64-linux-gnu/bits/types/__fpos64_t.h
/usr/include/x86_64-linux-gnu/bits/types/__fpos_t.h
/usr/include/x86_64-linux-gnu/bits/types/__locale_t.h
/usr/include/x86_64-linux-gnu/bits/types/__mbstate_t.h
/usr/include/x86_64-linux-gnu/bits/types/__sigset_t.h
/usr/include/x86_64-linux-gnu/bits/types/__sigval_t.h
/usr/include/x86_64-linux-gnu/bits/types/clock_t.h
/usr/include/x86_64-linux-gnu/bits/types/clockid_t.h
/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h
/usr/include/x86_64-linux-gnu/bits/types/locale_t.h
/usr/include/x86_64-linux-gnu/bits/types/sig_atomic_t.h
/usr/include/x86_64-linux-gnu/bits/types/sigevent_t.h
/usr/include/x86_64-linux-gnu/bits/types/siginfo_t.h
/usr/include/x86_64-linux-gnu/bits/types/sigset_t.h
/usr/include/x86_64-linux-gnu/bits/types/sigval_t.h
/usr/include/x86_64-linux-gnu/bits/types/stack_t.h
/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h
/usr/include/x86_64-linux-gnu/bits/types/struct_iovec.h
/usr/include/x86_64-linux-gnu/bits/types/struct_osockaddr.h
/usr/include/x86_64-linux-gnu/bits/types/struct_sigstack.h
/usr/include/x86_64-linux-gnu/bits/types/struct_timespec.h
/usr/include/x86_64-linux-gnu/bits/types/struct_timeval.h
/usr/include/x86_64-linux-gnu/bits/types/time_t.h
/usr/include/x86_64-linux-gnu/bits/types/timer_t.h
/usr/include/x86_64-linux-gnu/bits/typesizes.h
/usr/include/x86_64-linux-gnu/bits/uintn-identity.h
/usr/include/x86_64-linux-gnu/bits/unistd_ext.h
/usr/include/x86_64-linux-gnu/bits/waitflags.h
/usr/include/x86_64-linux-gnu/bits/waitstatus.h
/usr/include/x86_64-linux-gnu/bits/wordsize.h
/usr/include/x86_64-linux-gnu/gnu/stubs-64.h
/usr/include/x86_64-linux-gnu/gnu/stubs.h
/usr/include/x86_64-linux-gnu/sys/cdefs.h
/usr/include/x86_64-linux-gnu/sys/select.h
/usr/include/x86_64-linux-gnu/sys/socket.h
/usr/include/x86_64-linux-gnu/sys/types.h
/usr/include/x86_64-linux-gnu/sys/ucontext.h
/usr/lib/gcc/x86_64-linux-gnu/15/include/stdarg.h
/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h
logreceiver
/lib64/ld-linux-x86-64.so.2
/usr/lib/x86_64-linux-gnu/Scrt1.o
/usr/lib/x86_64-linux-gnu/crti.o
/usr/lib/x86_64-linux-gnu/crtn.o
/usr/lib/x86_64-linux-gnu/libc.so
/usr/lib/x86_64-linux-gnu/libgcc_s.so.1
/usr/lib/gcc/x86_64-linux-gnu/15/crtbeginS.o
/usr/lib/gcc/x86_64-linux-gnu/15/crtendS.o
/usr/lib/gcc/x86_64-linux-gnu/15/libgcc.a
/usr/lib/gcc/x86_64-linux-gnu/15/libgcc_s.so
/usr/lib/x86_64-linux-gnu/libc.so.6
/usr/lib/x86_64-linux-gnu/libc_nonshared.a
/home/user/utun2/tools/logreceiver/build/CMakeFiles/logreceiver.dir/logreceiver.c.o

386
tools/logreceiver/build/CMakeFiles/logreceiver.dir/compiler_depend.make

@ -0,0 +1,386 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 4.1
CMakeFiles/logreceiver.dir/logreceiver.c.o: /home/user/utun2/tools/logreceiver/logreceiver.c \
/usr/include/alloca.h \
/usr/include/arpa/inet.h \
/usr/include/asm-generic/bitsperlong.h \
/usr/include/asm-generic/errno-base.h \
/usr/include/asm-generic/errno.h \
/usr/include/asm-generic/posix_types.h \
/usr/include/asm-generic/socket.h \
/usr/include/asm-generic/sockios.h \
/usr/include/endian.h \
/usr/include/errno.h \
/usr/include/features-time64.h \
/usr/include/features.h \
/usr/include/linux/errno.h \
/usr/include/linux/posix_types.h \
/usr/include/linux/stddef.h \
/usr/include/netinet/in.h \
/usr/include/signal.h \
/usr/include/stdc-predef.h \
/usr/include/stdio.h \
/usr/include/stdlib.h \
/usr/include/string.h \
/usr/include/strings.h \
/usr/include/unistd.h \
/usr/include/x86_64-linux-gnu/asm/bitsperlong.h \
/usr/include/x86_64-linux-gnu/asm/errno.h \
/usr/include/x86_64-linux-gnu/asm/posix_types.h \
/usr/include/x86_64-linux-gnu/asm/posix_types_64.h \
/usr/include/x86_64-linux-gnu/asm/socket.h \
/usr/include/x86_64-linux-gnu/asm/sockios.h \
/usr/include/x86_64-linux-gnu/bits/atomic_wide_counter.h \
/usr/include/x86_64-linux-gnu/bits/byteswap.h \
/usr/include/x86_64-linux-gnu/bits/confname.h \
/usr/include/x86_64-linux-gnu/bits/endian.h \
/usr/include/x86_64-linux-gnu/bits/endianness.h \
/usr/include/x86_64-linux-gnu/bits/environments.h \
/usr/include/x86_64-linux-gnu/bits/errno.h \
/usr/include/x86_64-linux-gnu/bits/floatn-common.h \
/usr/include/x86_64-linux-gnu/bits/floatn.h \
/usr/include/x86_64-linux-gnu/bits/getopt_core.h \
/usr/include/x86_64-linux-gnu/bits/getopt_posix.h \
/usr/include/x86_64-linux-gnu/bits/in.h \
/usr/include/x86_64-linux-gnu/bits/libc-header-start.h \
/usr/include/x86_64-linux-gnu/bits/long-double.h \
/usr/include/x86_64-linux-gnu/bits/posix_opt.h \
/usr/include/x86_64-linux-gnu/bits/pthreadtypes-arch.h \
/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h \
/usr/include/x86_64-linux-gnu/bits/select.h \
/usr/include/x86_64-linux-gnu/bits/sigaction.h \
/usr/include/x86_64-linux-gnu/bits/sigcontext.h \
/usr/include/x86_64-linux-gnu/bits/sigevent-consts.h \
/usr/include/x86_64-linux-gnu/bits/siginfo-arch.h \
/usr/include/x86_64-linux-gnu/bits/siginfo-consts.h \
/usr/include/x86_64-linux-gnu/bits/signal_ext.h \
/usr/include/x86_64-linux-gnu/bits/signum-arch.h \
/usr/include/x86_64-linux-gnu/bits/signum-generic.h \
/usr/include/x86_64-linux-gnu/bits/sigstack.h \
/usr/include/x86_64-linux-gnu/bits/sigstksz.h \
/usr/include/x86_64-linux-gnu/bits/sigthread.h \
/usr/include/x86_64-linux-gnu/bits/sockaddr.h \
/usr/include/x86_64-linux-gnu/bits/socket.h \
/usr/include/x86_64-linux-gnu/bits/socket_type.h \
/usr/include/x86_64-linux-gnu/bits/ss_flags.h \
/usr/include/x86_64-linux-gnu/bits/stdint-intn.h \
/usr/include/x86_64-linux-gnu/bits/stdint-uintn.h \
/usr/include/x86_64-linux-gnu/bits/stdio_lim.h \
/usr/include/x86_64-linux-gnu/bits/stdlib-float.h \
/usr/include/x86_64-linux-gnu/bits/struct_mutex.h \
/usr/include/x86_64-linux-gnu/bits/struct_rwlock.h \
/usr/include/x86_64-linux-gnu/bits/thread-shared-types.h \
/usr/include/x86_64-linux-gnu/bits/time64.h \
/usr/include/x86_64-linux-gnu/bits/timesize.h \
/usr/include/x86_64-linux-gnu/bits/types.h \
/usr/include/x86_64-linux-gnu/bits/types/FILE.h \
/usr/include/x86_64-linux-gnu/bits/types/__FILE.h \
/usr/include/x86_64-linux-gnu/bits/types/__fpos64_t.h \
/usr/include/x86_64-linux-gnu/bits/types/__fpos_t.h \
/usr/include/x86_64-linux-gnu/bits/types/__locale_t.h \
/usr/include/x86_64-linux-gnu/bits/types/__mbstate_t.h \
/usr/include/x86_64-linux-gnu/bits/types/__sigset_t.h \
/usr/include/x86_64-linux-gnu/bits/types/__sigval_t.h \
/usr/include/x86_64-linux-gnu/bits/types/clock_t.h \
/usr/include/x86_64-linux-gnu/bits/types/clockid_t.h \
/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h \
/usr/include/x86_64-linux-gnu/bits/types/locale_t.h \
/usr/include/x86_64-linux-gnu/bits/types/sig_atomic_t.h \
/usr/include/x86_64-linux-gnu/bits/types/sigevent_t.h \
/usr/include/x86_64-linux-gnu/bits/types/siginfo_t.h \
/usr/include/x86_64-linux-gnu/bits/types/sigset_t.h \
/usr/include/x86_64-linux-gnu/bits/types/sigval_t.h \
/usr/include/x86_64-linux-gnu/bits/types/stack_t.h \
/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h \
/usr/include/x86_64-linux-gnu/bits/types/struct_iovec.h \
/usr/include/x86_64-linux-gnu/bits/types/struct_osockaddr.h \
/usr/include/x86_64-linux-gnu/bits/types/struct_sigstack.h \
/usr/include/x86_64-linux-gnu/bits/types/struct_timespec.h \
/usr/include/x86_64-linux-gnu/bits/types/struct_timeval.h \
/usr/include/x86_64-linux-gnu/bits/types/time_t.h \
/usr/include/x86_64-linux-gnu/bits/types/timer_t.h \
/usr/include/x86_64-linux-gnu/bits/typesizes.h \
/usr/include/x86_64-linux-gnu/bits/uintn-identity.h \
/usr/include/x86_64-linux-gnu/bits/unistd_ext.h \
/usr/include/x86_64-linux-gnu/bits/waitflags.h \
/usr/include/x86_64-linux-gnu/bits/waitstatus.h \
/usr/include/x86_64-linux-gnu/bits/wordsize.h \
/usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
/usr/include/x86_64-linux-gnu/gnu/stubs.h \
/usr/include/x86_64-linux-gnu/sys/cdefs.h \
/usr/include/x86_64-linux-gnu/sys/select.h \
/usr/include/x86_64-linux-gnu/sys/socket.h \
/usr/include/x86_64-linux-gnu/sys/types.h \
/usr/include/x86_64-linux-gnu/sys/ucontext.h \
/usr/lib/gcc/x86_64-linux-gnu/15/include/stdarg.h \
/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h
logreceiver: /lib64/ld-linux-x86-64.so.2 \
/usr/lib/x86_64-linux-gnu/Scrt1.o \
/usr/lib/x86_64-linux-gnu/crti.o \
/usr/lib/x86_64-linux-gnu/crtn.o \
/usr/lib/x86_64-linux-gnu/libc.so \
/usr/lib/x86_64-linux-gnu/libgcc_s.so.1 \
/usr/lib/gcc/x86_64-linux-gnu/15/crtbeginS.o \
/usr/lib/gcc/x86_64-linux-gnu/15/crtendS.o \
/usr/lib/gcc/x86_64-linux-gnu/15/libgcc.a \
/usr/lib/gcc/x86_64-linux-gnu/15/libgcc_s.so \
/usr/lib/x86_64-linux-gnu/libc.so.6 \
/usr/lib/x86_64-linux-gnu/libc_nonshared.a \
CMakeFiles/logreceiver.dir/logreceiver.c.o
/usr/lib/x86_64-linux-gnu/libc_nonshared.a:
/usr/lib/gcc/x86_64-linux-gnu/15/libgcc.a:
/usr/lib/x86_64-linux-gnu/Scrt1.o:
/usr/include/x86_64-linux-gnu/sys/ucontext.h:
/usr/include/x86_64-linux-gnu/sys/types.h:
/usr/include/x86_64-linux-gnu/gnu/stubs-64.h:
/usr/lib/gcc/x86_64-linux-gnu/15/crtendS.o:
/usr/include/x86_64-linux-gnu/bits/wordsize.h:
/usr/include/x86_64-linux-gnu/bits/waitstatus.h:
/usr/include/x86_64-linux-gnu/bits/waitflags.h:
/usr/include/x86_64-linux-gnu/bits/unistd_ext.h:
/usr/include/x86_64-linux-gnu/bits/uintn-identity.h:
/usr/include/x86_64-linux-gnu/sys/cdefs.h:
/usr/include/x86_64-linux-gnu/bits/types/struct_timeval.h:
/usr/include/x86_64-linux-gnu/bits/types/struct_sigstack.h:
/usr/include/x86_64-linux-gnu/bits/types/struct_osockaddr.h:
/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h:
/usr/include/x86_64-linux-gnu/bits/types/stack_t.h:
/usr/include/x86_64-linux-gnu/bits/types/struct_iovec.h:
/usr/include/x86_64-linux-gnu/bits/types/sigval_t.h:
/usr/include/x86_64-linux-gnu/bits/types/siginfo_t.h:
/usr/include/x86_64-linux-gnu/bits/types/clockid_t.h:
/usr/include/x86_64-linux-gnu/bits/types/__sigval_t.h:
/usr/include/x86_64-linux-gnu/bits/types/__mbstate_t.h:
/usr/include/x86_64-linux-gnu/bits/types/__fpos_t.h:
/usr/include/x86_64-linux-gnu/bits/types/struct_timespec.h:
/usr/include/x86_64-linux-gnu/bits/types/__fpos64_t.h:
CMakeFiles/logreceiver.dir/logreceiver.c.o:
/usr/include/x86_64-linux-gnu/bits/types/clock_t.h:
/usr/include/x86_64-linux-gnu/bits/types/__FILE.h:
/usr/include/x86_64-linux-gnu/bits/types/FILE.h:
/usr/include/x86_64-linux-gnu/bits/types/sigset_t.h:
/usr/include/x86_64-linux-gnu/bits/time64.h:
/usr/include/x86_64-linux-gnu/bits/thread-shared-types.h:
/usr/include/x86_64-linux-gnu/bits/struct_rwlock.h:
/usr/lib/x86_64-linux-gnu/crtn.o:
/usr/include/x86_64-linux-gnu/bits/struct_mutex.h:
/usr/include/x86_64-linux-gnu/bits/stdint-uintn.h:
/usr/include/x86_64-linux-gnu/bits/stdint-intn.h:
/usr/include/x86_64-linux-gnu/bits/socket.h:
/usr/include/unistd.h:
/usr/include/x86_64-linux-gnu/bits/floatn-common.h:
/usr/include/x86_64-linux-gnu/bits/typesizes.h:
/usr/include/asm-generic/posix_types.h:
/usr/include/stdlib.h:
/usr/include/x86_64-linux-gnu/asm/posix_types.h:
/usr/include/arpa/inet.h:
/usr/lib/gcc/x86_64-linux-gnu/15/include/stdarg.h:
/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h:
/usr/include/x86_64-linux-gnu/bits/stdio_lim.h:
/usr/include/x86_64-linux-gnu/bits/ss_flags.h:
/usr/include/x86_64-linux-gnu/asm/errno.h:
/usr/lib/x86_64-linux-gnu/libgcc_s.so.1:
/usr/include/string.h:
/usr/include/x86_64-linux-gnu/bits/endian.h:
/usr/include/x86_64-linux-gnu/bits/sockaddr.h:
/usr/include/x86_64-linux-gnu/asm/bitsperlong.h:
/usr/include/x86_64-linux-gnu/sys/socket.h:
/usr/include/x86_64-linux-gnu/bits/stdlib-float.h:
/usr/include/stdc-predef.h:
/usr/include/x86_64-linux-gnu/bits/socket_type.h:
/usr/include/netinet/in.h:
/usr/include/x86_64-linux-gnu/bits/types/sigevent_t.h:
/usr/include/linux/errno.h:
/usr/include/asm-generic/errno.h:
/usr/include/alloca.h:
/usr/lib/gcc/x86_64-linux-gnu/15/crtbeginS.o:
/usr/include/x86_64-linux-gnu/bits/in.h:
/usr/include/x86_64-linux-gnu/gnu/stubs.h:
/usr/include/asm-generic/bitsperlong.h:
/usr/lib/x86_64-linux-gnu/crti.o:
/usr/include/x86_64-linux-gnu/bits/sigstack.h:
/usr/include/asm-generic/errno-base.h:
/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:
/usr/include/x86_64-linux-gnu/asm/posix_types_64.h:
/usr/include/asm-generic/socket.h:
/usr/include/features-time64.h:
/usr/include/asm-generic/sockios.h:
/usr/include/strings.h:
/usr/include/x86_64-linux-gnu/bits/siginfo-arch.h:
/usr/include/features.h:
/usr/include/x86_64-linux-gnu/bits/types/timer_t.h:
/usr/include/endian.h:
/usr/lib/gcc/x86_64-linux-gnu/15/libgcc_s.so:
/usr/include/x86_64-linux-gnu/bits/endianness.h:
/usr/include/linux/stddef.h:
/usr/include/x86_64-linux-gnu/bits/signal_ext.h:
/usr/include/errno.h:
/usr/include/linux/posix_types.h:
/usr/include/x86_64-linux-gnu/asm/sockios.h:
/usr/include/x86_64-linux-gnu/bits/timesize.h:
/usr/include/x86_64-linux-gnu/asm/socket.h:
/usr/include/x86_64-linux-gnu/bits/getopt_core.h:
/usr/lib/x86_64-linux-gnu/libc.so:
/usr/include/x86_64-linux-gnu/bits/types/locale_t.h:
/usr/include/x86_64-linux-gnu/bits/sigevent-consts.h:
/usr/include/x86_64-linux-gnu/bits/sigthread.h:
/usr/include/x86_64-linux-gnu/bits/types.h:
/usr/include/x86_64-linux-gnu/bits/atomic_wide_counter.h:
/usr/include/x86_64-linux-gnu/sys/select.h:
/usr/include/signal.h:
/usr/include/x86_64-linux-gnu/bits/environments.h:
/usr/include/x86_64-linux-gnu/bits/types/sig_atomic_t.h:
/usr/include/x86_64-linux-gnu/bits/confname.h:
/lib64/ld-linux-x86-64.so.2:
/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h:
/usr/include/x86_64-linux-gnu/bits/errno.h:
/usr/lib/x86_64-linux-gnu/libc.so.6:
/usr/include/x86_64-linux-gnu/bits/floatn.h:
/usr/include/x86_64-linux-gnu/bits/types/__locale_t.h:
/usr/include/stdio.h:
/usr/include/x86_64-linux-gnu/bits/getopt_posix.h:
/usr/include/x86_64-linux-gnu/bits/libc-header-start.h:
/usr/include/x86_64-linux-gnu/bits/siginfo-consts.h:
/usr/include/x86_64-linux-gnu/bits/types/__sigset_t.h:
/usr/include/x86_64-linux-gnu/bits/byteswap.h:
/usr/include/x86_64-linux-gnu/bits/long-double.h:
/usr/include/x86_64-linux-gnu/bits/posix_opt.h:
/usr/include/x86_64-linux-gnu/bits/types/time_t.h:
/usr/include/x86_64-linux-gnu/bits/pthreadtypes-arch.h:
/usr/include/x86_64-linux-gnu/bits/signum-arch.h:
/home/user/utun2/tools/logreceiver/logreceiver.c:
/usr/include/x86_64-linux-gnu/bits/select.h:
/usr/include/x86_64-linux-gnu/bits/sigaction.h:
/usr/include/x86_64-linux-gnu/bits/sigcontext.h:
/usr/include/x86_64-linux-gnu/bits/signum-generic.h:
/usr/include/x86_64-linux-gnu/bits/sigstksz.h:

2
tools/logreceiver/build/CMakeFiles/logreceiver.dir/compiler_depend.ts

@ -0,0 +1,2 @@
# CMAKE generated file: DO NOT EDIT!
# Timestamp file for compiler generated dependencies management for logreceiver.

2
tools/logreceiver/build/CMakeFiles/logreceiver.dir/depend.make

@ -0,0 +1,2 @@
# Empty dependencies file for logreceiver.
# This may be replaced when dependencies are built.

10
tools/logreceiver/build/CMakeFiles/logreceiver.dir/flags.make

@ -0,0 +1,10 @@
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 4.1
# compile C with /usr/bin/cc
C_DEFINES =
C_INCLUDES =
C_FLAGS = -std=gnu99

76
tools/logreceiver/build/CMakeFiles/logreceiver.dir/link.d

@ -0,0 +1,76 @@
logreceiver: \
/usr/lib/gcc/x86_64-linux-gnu/15/../../../x86_64-linux-gnu/Scrt1.o \
/usr/lib/gcc/x86_64-linux-gnu/15/../../../x86_64-linux-gnu/crti.o \
/usr/lib/gcc/x86_64-linux-gnu/15/crtbeginS.o \
CMakeFiles/logreceiver.dir/logreceiver.c.o \
/usr/lib/gcc/x86_64-linux-gnu/15/libgcc.a \
/usr/lib/gcc/x86_64-linux-gnu/15/libgcc_s.so \
/usr/lib/gcc/x86_64-linux-gnu/15/libgcc_s.so \
/usr/lib/gcc/x86_64-linux-gnu/15/libgcc_s.so \
/usr/lib/gcc/x86_64-linux-gnu/15/../../../x86_64-linux-gnu/libgcc_s.so.1 \
/usr/lib/gcc/x86_64-linux-gnu/15/libgcc.a \
/usr/lib/gcc/x86_64-linux-gnu/15/../../../x86_64-linux-gnu/libc.so \
/usr/lib/gcc/x86_64-linux-gnu/15/../../../x86_64-linux-gnu/libc.so \
/usr/lib/gcc/x86_64-linux-gnu/15/../../../x86_64-linux-gnu/libc.so \
/usr/lib/x86_64-linux-gnu/libc.so.6 \
/usr/lib/x86_64-linux-gnu/libc_nonshared.a \
/lib64/ld-linux-x86-64.so.2 \
/usr/lib/gcc/x86_64-linux-gnu/15/libgcc.a \
/usr/lib/gcc/x86_64-linux-gnu/15/libgcc_s.so \
/usr/lib/gcc/x86_64-linux-gnu/15/libgcc_s.so \
/usr/lib/gcc/x86_64-linux-gnu/15/libgcc_s.so \
/usr/lib/gcc/x86_64-linux-gnu/15/../../../x86_64-linux-gnu/libgcc_s.so.1 \
/usr/lib/gcc/x86_64-linux-gnu/15/libgcc.a \
/usr/lib/gcc/x86_64-linux-gnu/15/crtendS.o \
/usr/lib/gcc/x86_64-linux-gnu/15/../../../x86_64-linux-gnu/crtn.o \
/lib64/ld-linux-x86-64.so.2
/usr/lib/gcc/x86_64-linux-gnu/15/../../../x86_64-linux-gnu/Scrt1.o:
/usr/lib/gcc/x86_64-linux-gnu/15/../../../x86_64-linux-gnu/crti.o:
/usr/lib/gcc/x86_64-linux-gnu/15/crtbeginS.o:
CMakeFiles/logreceiver.dir/logreceiver.c.o:
/usr/lib/gcc/x86_64-linux-gnu/15/libgcc.a:
/usr/lib/gcc/x86_64-linux-gnu/15/libgcc_s.so:
/usr/lib/gcc/x86_64-linux-gnu/15/libgcc_s.so:
/usr/lib/gcc/x86_64-linux-gnu/15/libgcc_s.so:
/usr/lib/gcc/x86_64-linux-gnu/15/../../../x86_64-linux-gnu/libgcc_s.so.1:
/usr/lib/gcc/x86_64-linux-gnu/15/libgcc.a:
/usr/lib/gcc/x86_64-linux-gnu/15/../../../x86_64-linux-gnu/libc.so:
/usr/lib/gcc/x86_64-linux-gnu/15/../../../x86_64-linux-gnu/libc.so:
/usr/lib/gcc/x86_64-linux-gnu/15/../../../x86_64-linux-gnu/libc.so:
/usr/lib/x86_64-linux-gnu/libc.so.6:
/usr/lib/x86_64-linux-gnu/libc_nonshared.a:
/lib64/ld-linux-x86-64.so.2:
/usr/lib/gcc/x86_64-linux-gnu/15/libgcc.a:
/usr/lib/gcc/x86_64-linux-gnu/15/libgcc_s.so:
/usr/lib/gcc/x86_64-linux-gnu/15/libgcc_s.so:
/usr/lib/gcc/x86_64-linux-gnu/15/libgcc_s.so:
/usr/lib/gcc/x86_64-linux-gnu/15/../../../x86_64-linux-gnu/libgcc_s.so.1:
/usr/lib/gcc/x86_64-linux-gnu/15/libgcc.a:
/usr/lib/gcc/x86_64-linux-gnu/15/crtendS.o:
/usr/lib/gcc/x86_64-linux-gnu/15/../../../x86_64-linux-gnu/crtn.o:
/lib64/ld-linux-x86-64.so.2:

1
tools/logreceiver/build/CMakeFiles/logreceiver.dir/link.txt

@ -0,0 +1 @@
/usr/bin/cc -Wl,--dependency-file=CMakeFiles/logreceiver.dir/link.d CMakeFiles/logreceiver.dir/logreceiver.c.o -o logreceiver

106
tools/logreceiver/build/CMakeFiles/logreceiver.dir/logreceiver.c.o.d

@ -0,0 +1,106 @@
CMakeFiles/logreceiver.dir/logreceiver.c.o: \
/home/user/utun2/tools/logreceiver/logreceiver.c \
/usr/include/stdc-predef.h /usr/include/stdio.h \
/usr/include/x86_64-linux-gnu/bits/libc-header-start.h \
/usr/include/features.h /usr/include/features-time64.h \
/usr/include/x86_64-linux-gnu/bits/wordsize.h \
/usr/include/x86_64-linux-gnu/bits/timesize.h \
/usr/include/x86_64-linux-gnu/sys/cdefs.h \
/usr/include/x86_64-linux-gnu/bits/long-double.h \
/usr/include/x86_64-linux-gnu/gnu/stubs.h \
/usr/include/x86_64-linux-gnu/gnu/stubs-64.h \
/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h \
/usr/lib/gcc/x86_64-linux-gnu/15/include/stdarg.h \
/usr/include/x86_64-linux-gnu/bits/types.h \
/usr/include/x86_64-linux-gnu/bits/typesizes.h \
/usr/include/x86_64-linux-gnu/bits/time64.h \
/usr/include/x86_64-linux-gnu/bits/types/__fpos_t.h \
/usr/include/x86_64-linux-gnu/bits/types/__mbstate_t.h \
/usr/include/x86_64-linux-gnu/bits/types/__fpos64_t.h \
/usr/include/x86_64-linux-gnu/bits/types/__FILE.h \
/usr/include/x86_64-linux-gnu/bits/types/FILE.h \
/usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h \
/usr/include/x86_64-linux-gnu/bits/types/cookie_io_functions_t.h \
/usr/include/x86_64-linux-gnu/bits/stdio_lim.h \
/usr/include/x86_64-linux-gnu/bits/floatn.h \
/usr/include/x86_64-linux-gnu/bits/floatn-common.h /usr/include/stdlib.h \
/usr/include/x86_64-linux-gnu/bits/waitflags.h \
/usr/include/x86_64-linux-gnu/bits/waitstatus.h \
/usr/include/x86_64-linux-gnu/sys/types.h \
/usr/include/x86_64-linux-gnu/bits/types/clock_t.h \
/usr/include/x86_64-linux-gnu/bits/types/clockid_t.h \
/usr/include/x86_64-linux-gnu/bits/types/time_t.h \
/usr/include/x86_64-linux-gnu/bits/types/timer_t.h \
/usr/include/x86_64-linux-gnu/bits/stdint-intn.h /usr/include/endian.h \
/usr/include/x86_64-linux-gnu/bits/endian.h \
/usr/include/x86_64-linux-gnu/bits/endianness.h \
/usr/include/x86_64-linux-gnu/bits/byteswap.h \
/usr/include/x86_64-linux-gnu/bits/uintn-identity.h \
/usr/include/x86_64-linux-gnu/sys/select.h \
/usr/include/x86_64-linux-gnu/bits/select.h \
/usr/include/x86_64-linux-gnu/bits/types/sigset_t.h \
/usr/include/x86_64-linux-gnu/bits/types/__sigset_t.h \
/usr/include/x86_64-linux-gnu/bits/types/struct_timeval.h \
/usr/include/x86_64-linux-gnu/bits/types/struct_timespec.h \
/usr/include/x86_64-linux-gnu/bits/pthreadtypes.h \
/usr/include/x86_64-linux-gnu/bits/thread-shared-types.h \
/usr/include/x86_64-linux-gnu/bits/pthreadtypes-arch.h \
/usr/include/x86_64-linux-gnu/bits/atomic_wide_counter.h \
/usr/include/x86_64-linux-gnu/bits/struct_mutex.h \
/usr/include/x86_64-linux-gnu/bits/struct_rwlock.h /usr/include/alloca.h \
/usr/include/x86_64-linux-gnu/bits/stdlib-float.h /usr/include/string.h \
/usr/include/x86_64-linux-gnu/bits/types/locale_t.h \
/usr/include/x86_64-linux-gnu/bits/types/__locale_t.h \
/usr/include/strings.h /usr/include/signal.h \
/usr/include/x86_64-linux-gnu/bits/signum-generic.h \
/usr/include/x86_64-linux-gnu/bits/signum-arch.h \
/usr/include/x86_64-linux-gnu/bits/types/sig_atomic_t.h \
/usr/include/x86_64-linux-gnu/bits/types/siginfo_t.h \
/usr/include/x86_64-linux-gnu/bits/types/__sigval_t.h \
/usr/include/x86_64-linux-gnu/bits/siginfo-arch.h \
/usr/include/x86_64-linux-gnu/bits/siginfo-consts.h \
/usr/include/x86_64-linux-gnu/bits/types/sigval_t.h \
/usr/include/x86_64-linux-gnu/bits/types/sigevent_t.h \
/usr/include/x86_64-linux-gnu/bits/sigevent-consts.h \
/usr/include/x86_64-linux-gnu/bits/sigaction.h \
/usr/include/x86_64-linux-gnu/bits/sigcontext.h \
/usr/include/x86_64-linux-gnu/bits/types/stack_t.h \
/usr/include/x86_64-linux-gnu/sys/ucontext.h \
/usr/include/x86_64-linux-gnu/bits/sigstack.h \
/usr/include/x86_64-linux-gnu/bits/sigstksz.h \
/usr/include/x86_64-linux-gnu/bits/ss_flags.h \
/usr/include/x86_64-linux-gnu/bits/types/struct_sigstack.h \
/usr/include/x86_64-linux-gnu/bits/sigthread.h \
/usr/include/x86_64-linux-gnu/bits/signal_ext.h /usr/include/errno.h \
/usr/include/x86_64-linux-gnu/bits/errno.h /usr/include/linux/errno.h \
/usr/include/x86_64-linux-gnu/asm/errno.h \
/usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h \
/usr/include/fcntl.h /usr/include/x86_64-linux-gnu/bits/fcntl.h \
/usr/include/x86_64-linux-gnu/bits/fcntl-linux.h \
/usr/include/x86_64-linux-gnu/bits/stat.h \
/usr/include/x86_64-linux-gnu/bits/struct_stat.h \
/usr/include/x86_64-linux-gnu/sys/socket.h \
/usr/include/x86_64-linux-gnu/bits/types/struct_iovec.h \
/usr/include/x86_64-linux-gnu/bits/socket.h \
/usr/include/x86_64-linux-gnu/bits/socket_type.h \
/usr/include/x86_64-linux-gnu/bits/sockaddr.h \
/usr/include/x86_64-linux-gnu/asm/socket.h \
/usr/include/asm-generic/socket.h /usr/include/linux/posix_types.h \
/usr/include/linux/stddef.h \
/usr/include/x86_64-linux-gnu/asm/posix_types.h \
/usr/include/x86_64-linux-gnu/asm/posix_types_64.h \
/usr/include/asm-generic/posix_types.h \
/usr/include/x86_64-linux-gnu/asm/bitsperlong.h \
/usr/include/asm-generic/bitsperlong.h \
/usr/include/x86_64-linux-gnu/asm/sockios.h \
/usr/include/asm-generic/sockios.h \
/usr/include/x86_64-linux-gnu/bits/types/struct_osockaddr.h \
/usr/include/x86_64-linux-gnu/sys/stat.h /usr/include/netinet/in.h \
/usr/include/x86_64-linux-gnu/bits/stdint-uintn.h \
/usr/include/x86_64-linux-gnu/bits/in.h /usr/include/arpa/inet.h \
/usr/include/unistd.h /usr/include/x86_64-linux-gnu/bits/posix_opt.h \
/usr/include/x86_64-linux-gnu/bits/environments.h \
/usr/include/x86_64-linux-gnu/bits/confname.h \
/usr/include/x86_64-linux-gnu/bits/getopt_posix.h \
/usr/include/x86_64-linux-gnu/bits/getopt_core.h \
/usr/include/x86_64-linux-gnu/bits/unistd_ext.h

3
tools/logreceiver/build/CMakeFiles/logreceiver.dir/progress.make

@ -0,0 +1,3 @@
CMAKE_PROGRESS_1 = 1
CMAKE_PROGRESS_2 = 2

1
tools/logreceiver/build/CMakeFiles/progress.marks

@ -0,0 +1 @@
2

66
tools/logreceiver/build/cmake_install.cmake

@ -0,0 +1,66 @@
# Install script for directory: /home/user/utun2/tools/logreceiver
# Set the install prefix
if(NOT DEFINED CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX "/usr/local")
endif()
string(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
# Set the install configuration name.
if(NOT DEFINED CMAKE_INSTALL_CONFIG_NAME)
if(BUILD_TYPE)
string(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
else()
set(CMAKE_INSTALL_CONFIG_NAME "")
endif()
message(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
endif()
# Set the component getting installed.
if(NOT CMAKE_INSTALL_COMPONENT)
if(COMPONENT)
message(STATUS "Install component: \"${COMPONENT}\"")
set(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
else()
set(CMAKE_INSTALL_COMPONENT)
endif()
endif()
# Install shared libraries without execute permission?
if(NOT DEFINED CMAKE_INSTALL_SO_NO_EXE)
set(CMAKE_INSTALL_SO_NO_EXE "1")
endif()
# Is this installation the result of a crosscompile?
if(NOT DEFINED CMAKE_CROSSCOMPILING)
set(CMAKE_CROSSCOMPILING "FALSE")
endif()
# Set path to fallback-tool for dependency-resolution.
if(NOT DEFINED CMAKE_OBJDUMP)
set(CMAKE_OBJDUMP "/usr/bin/objdump")
endif()
string(REPLACE ";" "\n" CMAKE_INSTALL_MANIFEST_CONTENT
"${CMAKE_INSTALL_MANIFEST_FILES}")
if(CMAKE_INSTALL_LOCAL_ONLY)
file(WRITE "/home/user/utun2/tools/logreceiver/build/install_local_manifest.txt"
"${CMAKE_INSTALL_MANIFEST_CONTENT}")
endif()
if(CMAKE_INSTALL_COMPONENT)
if(CMAKE_INSTALL_COMPONENT MATCHES "^[a-zA-Z0-9_.+-]+$")
set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt")
else()
string(MD5 CMAKE_INST_COMP_HASH "${CMAKE_INSTALL_COMPONENT}")
set(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INST_COMP_HASH}.txt")
unset(CMAKE_INST_COMP_HASH)
endif()
else()
set(CMAKE_INSTALL_MANIFEST "install_manifest.txt")
endif()
if(NOT CMAKE_INSTALL_LOCAL_ONLY)
file(WRITE "/home/user/utun2/tools/logreceiver/build/${CMAKE_INSTALL_MANIFEST}"
"${CMAKE_INSTALL_MANIFEST_CONTENT}")
endif()

BIN
tools/logreceiver/build/logreceiver

Binary file not shown.

157
tools/logreceiver/logreceiver.c

@ -0,0 +1,157 @@
/*
* logreceiver.c — UDP log receiver (Linux)
*
* Listens on IP:port, receives datagrams, writes to file or stdout.
* Usage: ./logreceiver [-d] [-p pidfile] <bind_ip> <port> [output_file]
* -d daemonize (fork to background)
* -p FILE write PID to file
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#define RECV_BUF_SIZE 65536
static volatile int g_stop = 0;
static void sig_handler(int sig) {
(void)sig;
g_stop = 1;
}
static void daemonize(void) {
pid_t pid = fork();
if (pid < 0) { perror("fork"); exit(1); }
if (pid > 0) _exit(0);
if (setsid() < 0) { perror("setsid"); exit(1); }
pid = fork();
if (pid < 0) { perror("fork2"); exit(1); }
if (pid > 0) _exit(0);
chdir("/");
umask(0);
close(STDIN_FILENO);
close(STDOUT_FILENO);
close(STDERR_FILENO);
int fd = open("/dev/null", O_RDWR);
if (fd >= 0) {
dup2(fd, STDIN_FILENO);
dup2(fd, STDOUT_FILENO);
dup2(fd, STDERR_FILENO);
if (fd > 2) close(fd);
}
}
static int write_pidfile(const char *path) {
FILE *f = fopen(path, "w");
if (!f) { perror("fopen pidfile"); return -1; }
fprintf(f, "%d\n", getpid());
fclose(f);
return 0;
}
int main(int argc, char **argv) {
int daemon = 0;
const char *pidfile = NULL;
int argi = 1;
while (argi < argc && argv[argi][0] == '-') {
if (strcmp(argv[argi], "-d") == 0) { daemon = 1; argi++; }
else if (strcmp(argv[argi], "-p") == 0 && argi + 1 < argc) {
pidfile = argv[argi + 1]; argi += 2;
} else {
fprintf(stderr, "Unknown option: %s\n", argv[argi]);
return 1;
}
}
if (argc - argi < 2) {
fprintf(stderr, "Usage: %s [-d] [-p pidfile] <bind_ip> <port> [output_file]\n",
argv[0] ? argv[0] : "logreceiver");
return 1;
}
const char *bind_ip = argv[argi];
int port = atoi(argv[argi + 1]);
const char *out_path = (argc - argi >= 3) ? argv[argi + 2] : NULL;
if (port < 1 || port > 65535) {
fprintf(stderr, "Invalid port: %d\n", port);
return 1;
}
FILE *out = stdout;
if (out_path) {
out = fopen(out_path, "a");
if (!out) { perror("fopen"); return 1; }
setvbuf(out, NULL, _IOLBF, 0);
}
signal(SIGINT, sig_handler);
signal(SIGTERM, sig_handler);
int fd = socket(AF_INET, SOCK_DGRAM, 0);
if (fd < 0) { perror("socket"); return 1; }
struct sockaddr_in addr;
memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
addr.sin_port = htons((unsigned short)port);
if (inet_pton(AF_INET, bind_ip, &addr.sin_addr) != 1) {
fprintf(stderr, "Invalid IP: %s\n", bind_ip);
close(fd);
return 1;
}
int reuse = 1;
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse));
if (bind(fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
perror("bind");
close(fd);
return 1;
}
if (daemon) {
if (pidfile) write_pidfile(pidfile);
daemonize();
}
if (!daemon) {
printf("logreceiver: listening on %s:%d, output: %s\n",
bind_ip, port, out_path ? out_path : "stdout");
}
char buf[RECV_BUF_SIZE];
struct sockaddr_in from;
socklen_t from_len = sizeof(from);
while (!g_stop) {
ssize_t n = recvfrom(fd, buf, sizeof(buf) - 1, 0,
(struct sockaddr *)&from, &from_len);
if (n < 0) {
if (errno == EINTR) continue;
break;
}
buf[n] = '\0';
fputs(buf, out);
fflush(out);
}
if (!daemon) printf("\nlogreceiver: stopped.\n");
if (out_path && out != stdout) fclose(out);
close(fd);
if (pidfile) unlink(pidfile);
return 0;
}

0
tools/logreceiver/logreceiver_output.log.1

0
tools/logreceiver/logreceiver_output.log.2

32
tools/logreceiver/logreceiver_restart.sh

@ -0,0 +1,32 @@
#!/bin/bash
# logreceiver_restart.sh — kill all, clear log, restart daemon
set -e
BIND_IP="0.0.0.0"
PORT=9999
SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
LOG_FILE="$SCRIPT_DIR/logreceiver_output.log"
PID_FILE="/tmp/logreceiver.pid"
BIN="/home/user/utun2/tools/logreceiver/build/logreceiver"
killall logreceiver 2>/dev/null || true
sleep 0.2
killall -9 logreceiver 2>/dev/null || true
rm -f "$PID_FILE"
rm -f "$LOG_FILE.9" 2>/dev/null
for i in 8 7 6 5 4 3 2 1; do
mv -f "$LOG_FILE.$i" "$LOG_FILE.$((i+1))" 2>/dev/null || true
done
mv -f "$LOG_FILE" "$LOG_FILE.1" 2>/dev/null || true
echo "rotated $LOG_FILE (keeping last 10)"
"$BIN" -d -p "$PID_FILE" "$BIND_IP" "$PORT" "$LOG_FILE"
sleep 0.3
if [ -f "$PID_FILE" ]; then
echo "logreceiver restarted: $BIND_IP:$PORT -> $LOG_FILE (pid=$(cat $PID_FILE))"
else
echo "ERROR: logreceiver failed to start"
exit 1
fi
Loading…
Cancel
Save