Commit Graph

719 Commits

Author SHA1 Message Date
jfreegman 76bc4c496d refactor: TCP connection netprof objects are now owned by Messenger
This allows us to have a single netprof object for all TCP client
connections, which makes it easier to query and keep track of
TCP network data for groupchats. Previously we were not properly
querying groupchat TCP network data via the netprof API.
2025-03-18 21:32:41 -04:00
iphydf 199878f766 chore: Use new bazel script for circle ci. 2025-02-20 09:07:36 +00:00
iphydf b4a0e617c4 refactor: Use IP string length from ip_ntoa instead of strlen.
Saves us a strlen and is slightly safer. Also, changed the event length
to not include the terminating NUL byte. Adding it is just confusing.
2025-02-05 16:58:20 +00:00
Green Sky b85b91f22f cleanup: rename getnodes/sendnodes to nodes request/response
This change alignes the naming to be closer to the spec and
make it less ambiguous. This change also changes the naming
of some private/experimental marked APIs.
- tox_callback_dht_nodes_response()
- tox_dht_nodes_request()
- Tox_Event_Dht_Get_Nodes_Response

Also remove the "IPv6" from response.
The non-ipv6 capable response was removed 12 years ago.
2025-02-04 23:13:02 +01:00
iphydf f1991aaa02 perf: Use stack allocation for strerror rendering. 2025-01-30 21:20:25 +00:00
iphydf 92cc1e9174 refactor: Make Tox_Options own the passed proxy host and savedata.
This way, client code can immediately free their data and can pass
temporaries to the options setters.
2025-01-21 23:06:53 +00:00
iphydf f276b39722 test: Add some more asserts for I/O and alloc to succeed.
Silences some warnings from static analysis.
2025-01-19 17:51:33 +00:00
iphydf be457d5d0b cleanup: Use tox memory for bin_unpack and net_strerror.
Some of the last places where we use malloc.
2025-01-18 21:46:10 +00:00
jfreegman aa649165a5 chore: Add code for future netprof TCP testing
TCP does not presently work for autotests, but this
will allow us to test netprof with TCP packets
when it's fixed
2025-01-15 14:19:57 -05:00
jfreegman 9e5693de5a chore: add to_string functions for netprof enums
Also fixed u64 formatting in the netprof auto test
2025-01-15 11:18:27 -05:00
jfreegman 52d915e6a9 cleanup: Heap allocate network profile objects 2025-01-15 11:18:26 -05:00
jfreegman 80fabd4a72 feat: Implement Tox network profiler 2025-01-15 11:18:26 -05:00
iphydf 05abe083cb cleanup: Some random cleanups, mostly related to mem. 2025-01-15 12:47:24 +00:00
iphydf e092ecd124 cleanup: Use tox memory allocator in some more places. 2025-01-14 17:34:21 +00:00
iphydf ab88700368 fix: Allow TCP connections to fail connect calls. 2025-01-13 13:23:53 +00:00
iphydf 5bd8a85eb8 cleanup: Align internal logger with external on type of source line.
We use `uint32_t` everywhere now. It's easier that way, and line numbers
are never negative.
2025-01-12 23:47:23 +00:00
iphydf 380dde9f2a test: Add more logging to TCP connection constructor.
Also add more asserts to the test so we don't do UB.
2025-01-10 23:45:41 +00:00
iphydf 0f12f384c8 cleanup: Reduce stack frame sizes to below 4096 bytes.
This is currently only detectable in tests, because the main code uses
VLAs where stack frame size is unknown at compile time.
2025-01-05 23:52:06 +00:00
iphydf bc43cec062 chore: Happy new year! 2025-01-05 23:24:52 +00:00
iphydf fbe78f1702 cleanup: Add a TOX_HIDE_DEPRECATED check to hide deprecated symbols.
Compiling with that flag will make tox compile roughly as if it were
v0.3.0.
2025-01-05 00:55:30 +00:00
jfreegman fc0650601c fix: Allow peers to reconnect to group chats using a password
This commit deprecates the tox_group_reconnect groupchat API function and
modifies the tox_group_join function to automatically reconnect to groups
when it's called with a chat_id that designates a group that it's already
a member of.

This allows clients to implement group rejoin functionality that lets peers
rejoin/reconnect to groups with a passed password argument, which may be
necessary if the group password changes while a peer is offline. This fixes
the bug described in #2806.
2024-12-19 22:00:02 -05:00
iphydf c660bbe8c9 test: Fix crypto_test to initialise its plain text buffer.
msan caught this.
2024-12-04 18:40:32 +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 df2211e154 refactor: Use tox memory allocator for temporary buffers in crypto. 2024-11-28 22:58:25 +00:00
Green Sky ac812871a2 feat: implement the last 2 missing network struct functions
and make use of them
2024-11-28 16:15:05 +01:00
jfreegman 29d1043be0 test: friend request test now tests min/max message sizes 2024-11-27 20:10:38 -05: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
iphydf bdd17c1678 cleanup: Allocate logger using tox memory allocator. 2024-11-13 10:22:11 +00:00
Green Sky 2e94da60d0 feat(net): add missing connect to network struct 2024-11-12 23:28:22 +01:00
iphydf ce4f29e803 cleanup: Fix all -Wsign-compare warnings. 2024-11-08 18:06:15 +00:00
zoff99 a57c2c8f95 refactor: Make ToxAV independent of toxcore internals. 2024-11-07 17:36:32 +01:00
Green Sky 0199c0f17f cleanup: apply the same scheme to types 2024-03-08 18:15:02 +01:00
Green Sky b03b571272 fix: flaky tcp test
This only fixes the symptoms, not the real problem.
Sometimes or consistently on some platforms a socket might need a moment
before it can be written to.
2024-03-07 19:27:52 +01:00
jfreegman 32e67ab4c2 cleanup: use typedef for private message ID's in callback 2024-03-07 12:25:34 -05:00
jfreegman 7b1db6adc1 feat: add message IDs to private group messages 2024-03-07 10:39:39 -05:00
jfreegman 77e08876ff chore: Remove mod and founder from group API naming scheme 2024-02-23 00:29:48 -05:00
iphydf e1fa5cae96 refactor: Rename Queries to Query to align with other enums. 2024-02-22 00:24:57 +00:00
Maxim Biro 9a8dfa06ab fix: save_compatibility_test failing on big-endian systems
save_compatibility_test was failing on big-endian systems, as it was
written and tested on a little-endian system and savedata is not
endianness portable[1].

[1] https://github.com/TokTok/c-toxcore/issues/2693
2024-02-17 19:51:10 -05:00
iphydf 8201019f0d chore: Disable NGC saving by default, enable through Tox_Options.
This way, clients can decide whether they want to depend on unstable
functionality while we change the NGC save format. We can release with
experimental functionality disabled by default.
2024-02-11 16:22:04 +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 e202341e76 refactor: Don't rely on tox_dispatch passing tox in tests.
This frees up the dispatcher from having to know that `Tox *` exists.
2024-02-04 20:02:08 +00:00
iphydf 4e2dba4d9f chore: Reformat sources with astyle.
Restyled astyle is fixed now.
2024-02-02 01:31:32 +00:00
jfreegman d94246a906 fix: partially fix a bug that prevented group part messages from
sending.

When a peer leaves a group, they send a packet to the group
indicating that they're leaving. However if this packet is sent
via TCP, it gets put in a packet queue, which is then destroyed
on the rest of the group cleanup process before ever being able
to send.

This pr allows do_gc() to finish an iteration before cleaning the
group up, which allows the TCP packet queue to be emptied. However
this bug still exists on a tox_kill() event because we don't have
a chance to do another do_gc() iteration.
2024-01-27 12:27:27 -05:00
iphydf 8328449c1a chore: Speed up docker builds a bit by reducing layer count.
This is especially noticeable on local builds (less so on the github
workers).
2024-01-26 14:13:34 +00:00
iphydf d6d67d56f3 cleanup: Add const where possible in auto tests.
Also one in `DHT_bootstrap.c`.
2024-01-25 23:17:32 +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
jfreegman 203e1af81e fix: a few off by one errors in group autotests
Since we're nul terminating these buffers they need one extra byte
2024-01-25 11:08:35 -05:00
iphydf 5c093c4888 cleanup: Remove all uses of SIZEOF_VLA.
This is step 1 towards removing VLAs altogether.
2024-01-25 07:40:41 +00:00
iphydf a05dccad13 test: Add a simple new/delete test for Tox.
This can be used for some static analysis that doesn't currently survive
a full iterate loop, but can possibly survive a new+kill.
2024-01-24 08:58:03 +00:00