Commit Graph
11 Commits
Author SHA1 Message Date
evgeny 20a1211e09 Add GPLv3 licensing and bundle third-party notices 2026-10-04 14:18:18 +02:00
evgeny 38c9f229bc stcp: ed25519 pubkey exchange in handshake, fix instance destroy segfault, fix chat_tcp_test
- u_async.c: process immediate_queue BEFORE epoll_wait in uasync_poll
- stcp_link.c: defensive NULL etcp_conn/etcp_link in stcp_link_close
- utun_instance.c: move stcp_server_list_destroy_all to Phase J (before ETCP),
  add deferred drain in both Phase J and L
- stcp.h/c: STCP_HS_ENC_CLIENT 6→38, STCP_HS_ENC_SERVER 7→39,
  exchange ed25519_pubkey in both handshake directions
- etcp_connections.c: copy peer_ed25519 from STCP to ETCP_CONN in
  etcp_link_enter_ready_tcp; guard link->etcp in tcp_link_close_cb
- chat_sync.c: fix lk->conn NULL dereference for TCP links
- test_stcp.c: update stcp_server_create/stcp_client_connect callsites
- tools/chat_tcp_test: change transport udp→tcp
2026-08-07 00:48:27 +03:00
evgeny d773f1724a refactor: STCP connections as ETCP links (is_tcp)
- Add is_tcp, tcp_link, tcp_reconnect_* fields to ETCP_LINK
- Remove transport_link from ETCP_CONN, add tcp_link_count
- stcp_link: replace embedded etcp_conn with pointer; add etcp_link backpointer
- stcp_link: link_rx_cb routes ETCP data to etcp_conn_input
- stcp_link: call on_close_cb in close
- New TCP functions: etcp_link_enter_ready_tcp, etcp_tcp_link_start_connect,
  etcp_tcp_link_start_reconnect, tcp_link_close_cb, etcp_tcp_send
- etcp_link_new: handle NULL conn for TCP links; skip enter_init for TCP
- etcp_link_close: close stcp_link for TCP
- etcp_encrypt_send: redirect TCP to etcp_tcp_send (skips AES-CCM)
- tcp_server_on_link: create ETCP_LINK(is_tcp=1) + enter_ready_tcp
- etcp_connect: TCP addrs -> etcp_tcp_link_start_connect
- Remove ctx->tcp_link/tcp_ready
- test_stcp_traffic: find stcp_link via links->is_tcp instead of transport_link
- 66/68 tests pass; 2 STCP tests expected to fail (integration not complete)
2026-08-06 22:14:32 +03:00
Evgeny 4fde0b0325 feat: integrate Opus codec into lib/libopus + voice messages in chatgui
- Add lib/libopus/ (opus v1.6.1 embedded source: CELT 18 .c, SILK 77 .c, SILK float 28 .c, OPUS core 14 .c)
- Add lib/opus_codec.h/.c (wrapper: encoder, decoder, raw PCM int16)
- Add tests/test_opus_codec.c (7 tests: silence, sine, compression, PLC, null, defaults, multi-frame)
- chatgui: AudioRecorder (miniaudio capture, 48kHz mono)
- chatgui: VoiceEncoder (PCM→Opus file with custom container)
- chatgui: VoicePlayer (Opus→PCM playback via SoundManager)
- chatgui: PTT button in InputBar, voice message send/receive in MessageList
- chatgui: AudioDeviceSettingsPage (device selection, persisted in ui_state)
- chatgui: MessageDelegate voice message rendering (play button + duration)
- Update autotools: configure.ac, Makefile.am, src/Makefile.am, tests/Makefile.am
- Update CMake: chatgui CMakeLists.txt, libutun CMakeLists.txt (link libopus_internal.a)
2026-07-26 20:34:38 +03:00
Evgeny 0f8df44b2b build: out-of-tree VPATH build, tests run once with colored timing
- Root Makefile: hand-written bootstrap delegating to build/
- Makefile.am: simplified to SUBDIRS + clean-local
- build.sh: delegates to make, autoreconf only
- tests: removed duplicate TESTS run, added colored [PASS]/[FAIL]/[SKIP] with timing
- .gitignore: added /build/ for out-of-tree artifacts

Result: 0 .o files in source dirs, 29/29 tests pass
2026-04-27 13:48:22 +03:00
Evgeny 15001487af Build: Out-of-tree build system with separate build directory
- Build in build/ directory instead of source tree
- Main binary (utun) copied to project root
- Tests run from build/tests/ with config files copied there
- Test output redirected to build/tests/logs/*.log files
- Console shows only [PASS]/[FAIL]/[SKIP] status
- Incremental build works correctly
- make check runs all tests with summary

Changes:
- New root Makefile as wrapper for out-of-tree build
- Updated Makefile.am files for lib, src, tests
- Added tinycrypt-objects target for test dependencies
- Tests no longer clutter project root
2026-02-13 22:58:41 +03:00
Evgeny ce15d6b883 Backup before route_lib.c refactoring 2026-02-13 18:12:26 +03:00
Evgeny 6429d1cda6 Build: Fixed test build configuration - moved tests from root Makefile.am to tests/Makefile.am
- Moved test configurations from main Makefile.am to tests/Makefile.am
- Fixed missing debug_config.c file in lib directory
- Updated lib/Makefile.am to include debug_config.c
- Tests now build correctly with 'make check'
- 2/3 tests passing (test_etcp_crypto, test_crypto)
- test_etcp_two_instances has connection timeout (separate networking issue)
2026-01-21 12:18:25 +03:00
Evgeny 4ddb190293 Найдена реальная ошибка: bind Address already in use
Проблема: test_etcp_two_instances.c создает два экземпляра (сервер и клиент),
и оба пытаются привязаться к одному и тому же адресу 127.0.0.1:9001.

Реальная ошибка: bind: Address already in use

Причина: В ETCP архитектуре каждый экземпляр создает серверные сокеты на основе
конфигурации. В тесте оба процесса на одной машине, поэтому возникает конфликт портов.

Что сделано:
1. Добавлен вызов bind() в etcp_socket_add (был пропущен критический вызов)
2. Добавлена отладка для отслеживания жизненного цикла сокетов
3. Создан debug_socket_test.sh для мониторинга портов в реальном времени
4. Удалены лишние вызовы init_connections для устранения дублирования

Результат: Теперь видно, что сервер действительно слушает на 127.0.0.1:9001,
но клиент не может привязаться к тому же порту. Необходимо использовать
разные порты для сервера и клиента в тестовой среде.
2026-01-21 12:07:38 +03:00
Evgeny 3f0a23aa93 Fix build: rename u_async to lib, add missing constants, out-of-tree build support 2026-01-18 16:18:28 +03:00
Evgeny c869ccf174 Major refactoring: Tasks 1-4 complete
Task 1: Migrate to GNU Autotools
- Add configure.ac, Makefile.am files (root, src, u_async, tests)
- Add autogen.sh bootstrap script
- Create INSTALL.autotools guide
- Update .gitignore for autotools
- Old Makefile backed up as Makefile.old

Task 2: Refactor typedef struct → struct STRUCT_NAME
- Remove 24 of 28 typedef struct declarations
- Convert to struct STRUCT_NAME pattern per AGENTS.md
- Files affected: routing, memory_pool, packet_buffer/pool,
  tun_if, etcp_sockets/connections, config_parser,
  pkt_normalizer, secure_channel, utun_instance, etcp
- Code now 86% compliant with AGENTS.md style guide

Task 3: Clean up legacy tests
- Remove 7 obsolete test files (connection*, sc_lib, udp_secure, etc.)
- Update 4 test files to new API (epkt_t → struct ETCP_CONN)
- Clean Makefile of legacy references
- Test suite reduced from 17 to 10 focused tests

Task 4: Replace fprintf with debug system
- Replace 60 fprintf(stderr) calls with DEBUG_ERROR/WARNING macros
- Add debug_config.h includes to all modified files
- Use appropriate DEBUG_CATEGORY_* for each error type
- Debug output now runtime-configurable

Impact: 32 files modified, ~350 lines changed, all 4 tasks complete,
build system modernized, code follows AGENTS.md, debugging improved.
2026-01-18 12:42:42 +03:00