Commit Graph

312 Commits

Author SHA1 Message Date
iphydf
16809dc36e
feat: Add dht_get_nodes_response event to the events system.
Should probably rename it to something starting with `debug_` and make
it opt-in. Right now, it absolutely spams the events object.
2024-01-16 10:52:31 +00:00
iphydf
e2c01e457b
refactor: Use enum-specific pack functions for enum values.
It's more obvious this way.
2024-01-15 21:47:13 +00:00
Green Sky
8c35e0fefb
feat: add ngc events 2024-01-15 16:32:10 +00:00
iphydf
97bdd83937
refactor: Make event dispatch ordered by receive time. 2024-01-15 16:32:10 +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
50f1b30fa9
test: Add fuzz tests to the coverage run.
So we don't need to write so many edge case tests ourselves for things
like parsers, which really don't need those manual tests, as long as we
can check for some properties like "can output the parsed data and it'll
be the same as the input".
2024-01-12 12:33:41 +00:00
iphydf
afc38f2458
test: Add more unit tests for add_to_list. 2024-01-10 02:58:13 +00:00
iphydf
b148a2afff
chore: Simplify msvc build using vcpkg. 2024-01-06 12:27:31 +00:00
iphydf
766e62bc89
chore: Use pkg_search_module directly in cmake.
The `pkg_use_module` was doing magic we used to use, but no longer need.
2023-12-26 01:14:50 +00:00
iphydf
00ff078f91
cleanup: Use target_link_libraries directly in cmake.
Instead of using `target_link_modules`, which does magic that we no
longer need, because we only have 1 library we install, and all binaries
we build link statically because they need access to internal symbols.
2023-12-26 00:24:08 +00:00
iphydf
c58928cc89
chore: Add IMPORTED_TARGET to pkg-config packages.
Also use `PRIVATE` for `target_link_libraries`. This helps avoid
implicit transitive dependencies.
2023-12-26 00:04:07 +00:00
iphydf
425216d9ec
fix: Correct a use-after-free and fix some memory leaks.
Also: use `find_package` to find gtest. This fixes the coverage build to
include unit tests.
2023-12-21 17:17:51 +00:00
iphydf
65d09c9bfb
cleanup: Remove test net support.
Mainnet now supports NGC.
2023-12-19 18:36:56 +00:00
iphydf
028b017d79
perf: Slightly reduce bandwidth usage when there are few nodes.
This mainly saves spam in test logs, but may save some packets here and
there, if nodes are randomly selected twice for GET_NODES and onion
routing packets.
2023-12-18 16:23:45 +00:00
jfreegman
7a6d50ebe3
Install header for private/experimental API functions
This allows client developers to use the private API without
needing to manually specify the header path in the source
code, which may vary from system to system.
2023-12-07 13:02:18 -05:00
iphydf
47e77d1bb0
chore: Use C99 on MSVC instead of C11.
The windows sdk has buggy headers in C11.
2023-11-22 19:55:28 +00:00
iphydf
7155f7f60e
test: Add an s390x build (on alpine) for CI.
It doesn't work at all, because we're missing something in the net code
to do with endian conversions. I haven't investigated, yet, but at least
now we have a failing test that can be investigated.

Also moved to cmake 3.5 at minimum. CMake will stop supporting lower
versions than that, soon.

Also moved to C11 from C99 to get `static_assert`.

Also made a network ERROR into a WARNING. It triggers on FreeBSD.
2023-11-22 18:29:26 +00:00
iphydf
48dbcfebc0
cleanup: Remove redundant -DSODIUM_EXPORT from definitions.
`-DSODIUM_STATIC` implies `-DSODIUM_EXPORT`.
2023-09-11 19:43:00 +00:00
iphydf
a549807df7
refactor: Add mem module to allow tests to override allocators.
This will allow us to do more interesting things with memory allocation
within toxcore, and allow fuzzers to explore various allocation failure
paths.
2023-08-30 22:55:05 +00:00
sudden6
8c7d30475f
refactor: re-implement shared key cache in separate file
The exisiting implementation is not clearly documented and used by
multiple modules.
2022-11-22 23:43:05 +01:00
jfreegman
0a277b52ea
Merge the remainder of the new groupchats implementation
Commit history: https://github.com/jfreegman/toxcore/tree/ngc_jf
Spec: https://toktok.ltd/spec.html#dht-group-chats
2022-09-22 11:16:08 -04:00
Robin Linden
3a5da3588f
Release 0.2.18 2022-04-18 20:12:07 +02:00
jfreegman
616bd63021
Downgrade C++ version to 17 2022-04-10 12:44:04 -04:00
iphydf
e3fd8922a4
chore: Upgrade to C++20 in CMake build.
We need at least C++14 for `std::make_unique`, and would like to use
C++20 for designated initialisers to construct Network/Random vtables.
2022-04-07 19:57:05 +00:00
jfreegman
f68b1412b4
Merge group announce portion of new groupchats implementation 2022-04-06 10:56:09 -04:00
Robin Linden
657d185de5
chore: Support producing shared libraries on Windows
The FLAT_OUTPUT_STRUCTURE CMake option was added to allow the tests to
find the .dlls.

The global data symbols were converted to functions to allow
WINDOWS_EXPORT_ALL_SYMBOLS handle them.

See:
https://cmake.org/cmake/help/v3.23/prop_tgt/WINDOWS_EXPORT_ALL_SYMBOLS.html
2022-04-03 23:04:11 +02:00
iphydf
e4d1958ffa
refactor: Allow NULL logger; make it no-op in NDEBUG. 2022-04-03 18:29:22 +00:00
zugz (tox)
e49a477a84
feat: add forwarding and announce request handling
This is the "server-side" part of the new friend finding system,
allowing DHT nodes to store small amounts of data and permit searching
for it. A forwarding (proxying) mechanism allows this to be used by TCP
clients, and deals with non-transitivity in the network.
2022-04-03 00:00:08 +00:00
zugz (tox)
97acb39c1f
cleanup: add timed_auth module for ping_ids 2022-04-03 00:00:08 +00:00
iphydf
eb07575334
cleanup: Remove layers in the cmake build.
Nothing checks whether these layers are actually observed. The bazel
build does check this, so there's no need to have this documentation in
the cmake build. It'll just go out of date.
2022-04-01 17:17:15 +00:00
iphydf
cc0c4a5fe1
cleanup: Move definitions of tox_private.h functions to tox_private.c.
Also moved lock/unlock to tox_private so they can be used across these 2
tox/tox_private translation units.
2022-03-31 18:49:26 +00:00
jfreegman
015305a088
Merge moderation portion of new groupchats codebase 2022-03-30 20:09:50 -04:00
sudden6
bc006beb4e
cleanup: split CMakeLists.txt and add some missing targets 2022-03-27 20:09:10 +02:00
iphydf
ee154da4a9
refactor: Use cmp instead of msgpack-c for events packing.
This library is better in every way.
2022-03-26 23:57:15 +00:00
Robin Linden
0467101381
Release 0.2.17 2022-03-06 01:45:06 +01:00
iphydf
2cc8dafd4c
cleanup: Remove redundant Messenger and DHT tests.
These don't test anything that isn't covered by higher level tox tests.
These are also not unit tests and have never found any bug that wasn't
also caught by other tests. This makes them a pure maintenance burden.
2022-03-03 21:17:03 +00:00
iphydf
093927ba4f
test: Add mallocfail and proxy test to our coverage runs. 2022-02-25 01:55:28 +00:00
iphydf
aa72c47125
test: Add test coverage docker build for local tests.
This uses mallocfail to further increase coverage using the existing
tests. Also:
* Moved the non-auto "tox_one_test" to gtest. This should be
  split into smaller tests later.
* Changed `hole_punching` to `bool`.
2022-02-24 16:24:28 +00:00
sudden6
3e6fc59f91
chore: remove cpufeatures.c
The method to detect CPU features in Android has changed and this is no
longer needed.
2022-02-23 20:59:06 +01:00
sudden6
e42441e3cf
chore: remove DHT_test.c since it's unused 2022-02-22 22:30:27 +01:00
iphydf
6a6bc029de
cleanup: Remove unused execution trace library. 2022-02-19 11:44:13 +00:00
Robin Linden
1937ee39c3
Release 0.2.16 2022-02-19 00:51:01 +01:00
jfreegman
a06a736321
Add wrapper library for msgpack pack functions
This allows us to abstract out some of msgpack's quirks
and gives us symmetry with bin_unpack.c
2022-02-11 22:11:32 -05:00
jfreegman
a0a317db49
Split tox_unpack into two smaller libs
tox_unpack is for unpacking Tox types, and bin_unpack is for
unpacking ints and binary data. This prevents us from creating
dependency cycles due to tox_unpack depending on tox.h
2022-02-10 15:34:35 -05:00
jfreegman
73ba0504b0
Add autotest for dht getnodes API
The test creates a small DHT and makes sure that each
peer is able to crawl the full network
2022-02-10 10:33:34 -05:00
Maxim Biro
2965403e2c
Add bash-completion for tox-bootstrapd 2022-02-10 02:40:42 -05:00
iphydf
71d5f8a4c3
chore: Speed up cmake builds with UNITY_BUILD.
`dht_test` breaks with unity build because it includes `DHT.c`. It
really shouldn't do that, but I'm not fixing that in this PR.
2022-02-08 01:07:58 +00:00
iphydf
cb8b9bbabf
feat: Add unpacker functions for events structures. 2022-02-08 00:02:51 +00:00
iphydf
0a2190f28c
feat: Add binary packing functions for tox events. 2022-02-07 02:43:24 +00:00
iphydf
de4af4c270
feat: Add async event handling (callbacks) code.
Instead of synchronously handling events as they happen in
`tox_iterate`, this first collects all events in a structure and then
lets the client process them. This allows clients to process events in
parallel, since the data structure returned is mostly immutable.

This also makes toxcore compatible with languages that don't (easily)
support callbacks from C into the non-C language.

If we remove the callbacks, this allows us to add fields to the events
without breaking the API.
2022-02-06 17:28:28 +00:00