|
|
|
|
@ -126,18 +126,54 @@ sc_decrypt(&ctx, ciphertext, ciphertext_len, plaintext, &plaintext_len);
|
|
|
|
|
|
|
|
|
|
### Directory Structure |
|
|
|
|
``` |
|
|
|
|
├── lib/ # Core libraries (uasync, ll_queue, memory pools) |
|
|
|
|
├── lib/ # Core libraries |
|
|
|
|
├── src/ # Main source code |
|
|
|
|
│ ├── utun.c # Main program entry |
|
|
|
|
│ ├── etcp*.c # ETCP protocol implementation |
|
|
|
|
│ ├── secure_channel.c # Cryptography |
|
|
|
|
│ └── tun_if.c # TUN/TAP interface |
|
|
|
|
├── tests/ # Test programs |
|
|
|
|
├── doc/ # Technical Specifications |
|
|
|
|
├── tinycrypt/ # TinyCrypt crypto library |
|
|
|
|
└── net_emulator/ # Network emulator |
|
|
|
|
├── tests/ # Test programs |
|
|
|
|
├── doc/ # Technical Specifications |
|
|
|
|
├── tinycrypt/ # TinyCrypt crypto library (external) |
|
|
|
|
└── net_emulator/ # Network emulator |
|
|
|
|
``` |
|
|
|
|
|
|
|
|
|
### File Overview |
|
|
|
|
|
|
|
|
|
**Core (src/)** |
|
|
|
|
- `utun.c` - Main program entry point, CLI parsing, daemon mode |
|
|
|
|
- `utun_instance.c/h` - Root instance lifecycle management |
|
|
|
|
- `tun_if.c/h` - Simplified TUN interface (init/write/close) |
|
|
|
|
|
|
|
|
|
**Network Stack (src/)** |
|
|
|
|
- `etcp.c/h` - ETCP protocol implementation (TCP-like with crypto) |
|
|
|
|
- `etcp_connections.c/h` - Socket and link management |
|
|
|
|
- `etcp_loadbalancer.c/h` - Multi-link load balancing |
|
|
|
|
- `pkt_normalizer.c/h` - Packet fragmentation/reassembly |
|
|
|
|
- `routing.c/h` - Routing table management |
|
|
|
|
|
|
|
|
|
**Crypto (src/)** |
|
|
|
|
- `secure_channel.c/h` - AES-CCM encryption with ECC key exchange |
|
|
|
|
- `crc32.c/h` - CRC32 checksums |
|
|
|
|
|
|
|
|
|
**Config (src/)** |
|
|
|
|
- `config_parser.c/h` - INI-style config file parsing |
|
|
|
|
- `config_updater.c/h` - Config file modification utilities |
|
|
|
|
|
|
|
|
|
**Libraries (lib/)** |
|
|
|
|
- `u_async.c/h` - Async event loop (epoll/poll, timers) |
|
|
|
|
- `ll_queue.c/h` - Lock-free linked list queue with callbacks |
|
|
|
|
- `memory_pool.c/h` - Fast object pool allocator |
|
|
|
|
- `debug_config.c/h` - Debug logging system |
|
|
|
|
- `timeout_heap.c/h` - Min-heap for timer management |
|
|
|
|
- `sha256.c/h` - SHA256 hashing |
|
|
|
|
|
|
|
|
|
**Tests (tests/)** |
|
|
|
|
- `test_etcp_*.c` - ETCP protocol tests |
|
|
|
|
- `test_crypto.c` - TinyCrypt AES/CCM tests |
|
|
|
|
- `test_ecc_encrypt.c` - ECC encryption tests |
|
|
|
|
- `test_ll_queue.c` - Queue functionality tests |
|
|
|
|
- `bench_*.c` - Performance benchmarks |
|
|
|
|
|
|
|
|
|
**External** |
|
|
|
|
- `tinycrypt/` - TinyCrypt library (AES, ECC, SHA256) |
|
|
|
|
|
|
|
|
|
### Key Components |
|
|
|
|
- **UASYNC:** Asynchronous event loop for sockets and timers |
|
|
|
|
- **LL_QUEUE:** Lock-free lockstep queue for packet handling |
|
|
|
|
|