894 Commits
Author SHA1 Message Date
iphydf a9ff898222 cleanup: Add a Tox_Pass_Salt type for the pass-key salt.
Every other fixed-size byte array in the API is a named typedef
(Tox_Public_Key, Tox_Address, ...); the salt was the lone exception.
2026-05-20 12:58:46 +00:00
iphydf b202ef7a51 test: Fix CI build and test failures.
- Drop the MSVC-only `/wd4200` copt that the GNU/zig toolchain rejects.
- Use C++ casts in `ev_test_util.cc` to satisfy `-Wold-style-cast`.
- Refresh the bootstrap node list with live TCP relays; the old ones
  no longer respond, so `tcp_relay_test` timed out.
- Shard `tox_network_test` so it fits the test timeout under tsan.
- Pin smatch to 1.74 in sparse.Dockerfile; its HEAD no longer builds.
- Fix the bazel-msan CircleCI target; lossless_packet_test moved to
  auto_tests/scenarios/.
2026-05-17 08:18:42 +00:00
iphydf 109752403e feat: Add Tox_Iterate_Options for granular control over tox_iterate.
deploy / Prepare (push) Failing after -2s
deploy / Linux (aarch64) (push) Has been skipped
deploy / Linux (x86_64) (push) Has been skipped
deploy / macOS (arm64) (push) Has been skipped
deploy / macOS (x86_64) (push) Has been skipped
deploy / iOS (ios-arm64) (push) Has been skipped
deploy / iOS (ios-armv7) (push) Has been skipped
deploy / iOS (ios-armv7s) (push) Has been skipped
deploy / iOS (iphonesimulator-arm64) (push) Has been skipped
deploy / iOS (iphonesimulator-x86_64) (push) Has been skipped
deploy / Xcode Framework (push) Has been skipped
deploy / Android (x86) (push) Has been skipped
deploy / Android (x86_64) (push) Has been skipped
deploy / WebAssembly (push) Has been skipped
deploy / Single file (push) Has been skipped
deploy / Source tarball (push) Has been skipped
docker / docker-bootstrap-node (push) Failing after 15s
docker / docker-clusterfuzz (push) Failing after 26s
draft / release (push) Failing after -2s
docker / docker-windows-mingw (64) (push) Failing after 17s
deploy / Android (arm64-v8a) (push) Has been skipped
deploy / Android (armeabi-v7a) (push) Has been skipped
docker / docker-bootstrap-node-websocket (push) Has been skipped
docker / docker-fuzzer (push) Failing after 16s
docker / docker-windows-mingw (32) (push) Failing after 18s
docker / docker-esp32 (push) Failing after 22s
post-submit / build (alpine-s390x) (push) Successful in 33m10s
post-submit / docker-coverage (push) Failing after 21s
sonar-scan / sonar-scan (push) Failing after 16s
post-submit / build (freebsd) (push) Successful in 39m11s
ClusterFuzzLite batch fuzzing / BatchFuzzing (address) (push) Failing after 10s
ClusterFuzzLite batch fuzzing / BatchFuzzing (memory) (push) Failing after 15s
ClusterFuzzLite batch fuzzing / BatchFuzzing (undefined) (push) Failing after 10s
coverity-scan / latest (push) Failing after 22s
ClusterFuzzLite cron tasks / Pruning (push) Failing after 9s
ClusterFuzzLite cron tasks / Coverage (push) Failing after 8s
CodeQL / Analyze (cpp) (push) Failing after 8m47s
2026-02-12 22:50:25 +00:00
iphydf ea597edff7 test: Improve simulation determinism and reliability.
Require explicit seeds for `Simulation` and `SimulatedEnvironment` to
ensure reproducible test results.

Also:
- Drop packets in `FakeUdpSocket` when the receive queue is full to
  prevent unbounded memory growth during stress tests.
- Improve synchronization in `Simulation::run_until` by adding a timeout
  to the barrier wait, preventing hangs if a runner is unregistered.
2026-02-09 09:34:26 +00:00
iphydf 40ce0bce66 cleanup: Use std::size_t in C++ to fix compilation errors.
On some stdlibs, `size_t` doesn't exist in the global namespace.

Fixes #3020.
2026-02-08 21:57:40 +00:00
iphydf 2101260fdf chore: Update bootstrap node sha256 hash. 2026-02-04 15:36:22 +00:00
iphydf 6f735b51be chore: Happy new year 2026! 2026-01-27 22:35:47 +00:00
iphydf 2e4b423eb6 refactor: Use specific typedefs for public API arrays.
Makes it clearer to static analysers and API generators what those
things are, and whether they are compatible.
2026-01-21 00:49:26 +00:00
iphydf 2f87ac67b0 feat: Add Event Loop abstraction (Ev).
- `Ev` interface in `toxcore/ev.h` and `toxcore/ev.c`.
- System-specific event loop backends (epoll, poll, win32) in
  `toxcore/os_event.c`.

Performance Benchmarks (epoll backend):

| Sockets (N) | Active (M) | Time (ns) | Time/Active (ns) |
|------------:|-----------:|----------:|-----------------:|
|           8 |          1 |       438 |              438 |
|          64 |          1 |       438 |              438 |
|         512 |          1 |       443 |              443 |
|        1024 |          1 |       442 |              442 |
|        1024 |         10 |       947 |               95 |
|        1024 |        100 |     6,268 |               63 |
|        1024 |       1024 |    61,875 |               60 |
2026-01-19 17:49:39 +00:00
iphydf 38313921e3 test(TCP): Add regression test for TCP priority queue integrity.
This test ensures that multiple priority packets added to a
`TCP_Connection` while the socket is busy are correctly queued in the
linked list without dropping intermediate packets.

Specifically, it protects against regressions where updating the tail
pointer incorrectly (e.g., using the head pointer as a base for append)
would result in data loss. This was identified as a risk in PR #2387.
2026-01-17 20:28:44 +00:00
iphydf 4962bdbb80 test: Improve TCP simulation and add tests
- `FakeTcpSocket` handles basic TCP state machine (SYN, ACK, RST, buffering).
- `NetworkUniverse` handles TCP routing and loopback.
- Add `TcpRelayChaining` test.
- Add LogFilter to Simulation.
2026-01-17 14:35:20 +00:00
iphydf b14943bbdd refactor: Move Logger out of Messenger into Tox.
So it can be used across other pieces we plug together in `tox_new`.
2026-01-15 18:08:29 +00:00
iphydf dd31362509 cleanup: Apply nullability qualifiers to C++ codebase. 2026-01-15 12:19:00 +00:00
iphydf 1849f70fca refactor: Extract low-level networking code to net and os_network.
Move core networking types and the Network interface to net, and the
standard OS socket implementation to os_network. Update network to use
these new abstractions.
2026-01-14 23:44:18 +00:00
iphydf 8fec754218 refactor: Delete tox_random, align on rng and os_random. 2026-01-14 15:15:40 +00:00
iphydf a03ae8051e refactor: Delete tox_memory, align on mem and os_memory.
os_memory will be os_mem later.
2026-01-14 10:19:05 +00:00
iphydf 4c88fed2c9 refactor: Use std:: prefixes more consistently in C++ code. 2026-01-14 02:10:10 +00:00
iphydf 72452f2aeb test: Add some more tests for onion and shared key cache.
Also some other cleanups.
2026-01-13 23:43:56 +00:00
iphydf b6f5b9fc56 test: Add some benchmarks for various high level things. 2026-01-12 14:37:27 +00:00
iphydf 8a8d02785e test(support): Introduce threaded Tox runner and simulation barrier
- Add `MpscQueue` for thread-safe task scheduling.
- Add `ToxRunner` to execute Tox instances in dedicated threads.
- Update `Simulation` to coordinate time steps across multiple runners using a synchronization barrier.
- Refactor `FakeMemory` and `FakeClock` to be thread-safe.
- Update `tox_network` helpers and tests to utilize the threaded runner infrastructure.
2026-01-11 22:51:59 +00:00
iphydf 4f6d4546b2 test: Improve the fake network library.
Some bugfixes, and getting ready for benchmark support code.
2026-01-11 12:32:44 +00:00
iphydf 695b6417aa test: Add some more simulated network support.
We'll need this for future tests (coming soon).
2026-01-08 18:50:34 +00:00
iphydf 9c22e79cc8 test(support): add SimulatedEnvironment for deterministic testing
Introduces a new testing support library 'testing/support' that provides
a clean, modular, and fully deterministic environment for testing
toxcore components.
2026-01-07 13:06:18 +00:00
iphydf 0e4715598f test: Add new scenario testing framework. 2026-01-05 21:45:47 +00:00
iphydf 668291f441 refactor(toxcore): decouple Network_Funcs from sockaddr via IP_Port
Replaces the use of the platform-specific `Network_Addr` in the public
`Network_Funcs` interface with the platform-independent `IP_Port`
struct, allowing higher-level abstractions (like simulated networks for
testing) to interact with the network layer without needing to depend on
or mock low-level OS socket headers.
2026-01-05 18:58:33 +00:00
iphydf 46bfdc2df7 fix: correct printf format specifiers for unsigned integers 2026-01-01 16:01:12 +00:00
iphydf 390f7db060 refactor: Move random and memory OS-specifics to os_* files. 2025-10-08 10:59:32 +00:00
iphydf 34ec822da7 cleanup: Fix some clang-19 format warnings. 2025-07-13 12:26:15 +00:00
iphydf 2ccecdc2a1 chore: Add remaining fuzz tests to cflite.
So we can run them daily and get coverage info from them.
2025-02-05 21:03:48 +00:00
iphydf 4626c2e230 test: Add a Net_Crypto fuzz test. 2025-02-05 19:45:48 +00:00
iphydf 463eeae114 cleanup: Avoid clashing with global define DEBUG.
Some systems define this, breaking our test code.
2025-01-22 23:52:44 +00:00
iphydf d10c966b99 feat: Add to_string functions for toxencryptsave errors.
Also added a tox save decryption tool.
2025-01-11 00:50:08 +00:00
iphydf bc43cec062 chore: Happy new year! 2025-01-05 23:24:52 +00:00
iphydf 0204db6184 cleanup: Fix layering check warnings.
These warnings aren't available yet, but will be in a future
toktok-stack build.
2024-12-04 10:24:23 +00:00
iphydf 819aa2b261 feat: Add option to disable DNS lookups in toxcore.
Allows clients to prevent leaking IP addresses through DNS lookups. This
option, together with disabling Tox UDP, entirely prevents any UDP
packets being sent by toxcore.
2024-11-27 17:19:56 +00:00
iphydf 14d823165d chore: Migrate to conan 2. 2024-11-20 23:48:57 +00:00
Green SkyandGreen Sky 2e94da60d0 feat(net): add missing connect to network struct 2024-11-12 23:28:22 +01:00
iphydf 350c0ba120 cleanup: Sort apk/apt install commands in Dockerfiles.
CodeQL scanning is complaining about this.
2024-11-06 15:43:33 +00:00
Maxim Biro 0ec4978de5 refactor: Don't expose Tox_System in the public API
It makes no sense to include it in the public API as clients can't make
any meaningful use of it via public API, it can only be used if one also
includes other internal/private headers that we don't install.

It's used only in the testing code, which has access to the internal
headers.

Fixes #2739, at least to some degree. I decided against moving things to
a separate `tox_testing.h` and leaving only things in `tox_private.h`
that we are fine with clients using, as otherwise `tox_lock()` /
`tox_unlock()` would have to be moved out of `tox_private.h` to
somewhere else, but `tox_private.h` actually sounds like the right place
for them, naming-wise. So perhaps it's fine if we have things in
`tox_private.h` that we don't want clients to use.
2024-03-17 11:22:43 -04:00
iphydf 3e05824b80 refactor: Rename out parameters to out_$something.
In preparation for supporting `out` as a type qualifier in parameters.
2024-03-08 22:11:30 +00:00
Maxim Biro 9bb79c174f cleanup: Remove a couple of unnecessary misc_tools dependencies
These programs link against libsodium, which already provides bin-to-hex
and hex-to-bin conversion functions. Removing the misc_tools dependency
shaves ~30KiB (in some cases 10%) off Windows static binaries using it.
2024-03-04 15:11:55 -05:00
iphydf 93c83fbc7c refactor: Use strong typedef instead of struct for Socket.
Sparse checks it. This is neater than using a struct, which has some
slightly weird syntax at times. This also reduces the risk of someone
adding another struct member.
2024-02-09 01:10:06 +00:00
iphydf 5bdaaaedb6 refactor: Remove Tox * from tox_dispatch.
User data can contain a tox instance if it needs to.
2024-02-04 20:18:26 +00:00
iphydf b7404f24f6 cleanup: Remove implicit bool conversions. 2024-02-02 01:31:54 +00:00
iphydf 4e2dba4d9f chore: Reformat sources with astyle.
Restyled astyle is fixed now.
2024-02-02 01:31:32 +00:00
iphydf 4359e3a6bc chore: Rename C++ headers to .hh suffixes.
This helps formatters and other dump (simple) tools know what's C++ and
what's C.
2024-02-01 23:44:37 +00:00
iphydf bdf460a3a9 refactor: Rename system_{memory,...} to os_{memory,...}.
This rename happens in the system PR, so I'm pulling it out to reduce
the size of that PR.
2024-01-25 21:33:52 +00:00
iphydf 1cdcf938b9 cleanup: Add comment after every #endif.
This makes far-away endifs clearer, so we're applying the rule to all
endifs to be consistent.
2024-01-23 21:52:41 +00:00
iphydf bcb6592af5 test: Add C++ classes wrapping system interfaces.
These are more convenient and safer than the manual vtables we have in
the fuzzer support code. We can override individual member functions,
and C++ will take care of correctly casting and offsetting this-pointers
when needed.
2024-01-13 16:16:47 +00:00
iphydf 4cea4f9ca4 fix: Make all the fuzzers work again, and add a test for protodump.
fuzz_select_target wasn't selecting anything, so fuzzers using that
function either did nothing or would only ever select one of the
functions.
2024-01-13 15:06:30 +00:00