Evgeny 794fe355d3 Refactor etcp_api: per-instance bindings with struct ETCP_BINDINGS
Changed from global bindings to per-instance bindings:

1. Added struct ETCP_BINDINGS in etcp_api.h:
   - Contains array of callbacks[ETCP_MAX_BINDINGS]
   - NULL means not bound

2. Updated UTUN_INSTANCE (utun_instance.h):
   - Added field: struct ETCP_BINDINGS api_bindings
   - Initialized to NULL by calloc in utun_instance_create

3. Updated API functions (etcp_api.h/c):
   - etcp_bind(inst, id, callback) - per-instance binding
   - etcp_unbind(inst, id) - per-instance unbinding
   - Removed etcp_api_init/etcp_api_deinit (not needed)
   - etcp_int_recv now uses conn->instance->api_bindings.callbacks[id]

4. Updated test_etcp_api.c:
   - Separate callbacks for server and client
   - Register via etcp_bind(server_instance, ...) and etcp_bind(client_instance, ...)
   - Removed global etcp_api_init/etcp_api_deinit calls

Test passes: All 100 packets transmitted in each direction.
2026-02-14 01:39:55 +03:00
2026-02-13 18:12:26 +03:00
…
2026-02-13 18:12:26 +03:00
2026-02-13 18:12:26 +03:00
…
…
S
Description
No description provided
GPL-3.0
447 MiB
0 Stars 1 Watchers 0 Forks
Languages
C 77.9%
C++ 12.7%
Kotlin 5.3%
HTML 2.6%
Python 0.5%
Other 0.7%