Commit Graph

5358 Commits

Author SHA1 Message Date
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
iphydf
33588c1aad
cleanup: Don't use VLAs for huge allocations.
One of these was creating a single 262144 byte stack frame. We now have
a way to check and limit the allocation size of a VLA. The `Cmp_Data`
ones were also fairly large. Now, no allocation is larger than 2KiB
(though rtp.c allocates close to that much).
2022-02-11 03:05:30 +00:00
cryptogospod
86ed00a218
docs: Add libmsgpack dependency in INSTALL.md 2022-02-11 00:01:19 +01:00
Robin Linden
dd19856a6c
chore: Set up an Android CI job 2022-02-10 23:31:09 +01:00
iphydf
73d52cdb33
chore: Disable non-null attributes by default.
We enable them on CI, but a default build will compile without them so a
default build doesn't end up with lots of warnings (which we also
disable on CI).
2022-02-10 21:33:51 +00: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
6dc1656e28
Silence clang compile warnings causing circle-ci/asan to fail 2022-02-10 14:11:58 -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
jfreegman
652ae27eeb
Add DHT queries to private API
This commit adds functionality for clients to interact with
the DHT, sending getnodes requests to their peers and receiving
nodes in getnodes responses.
2022-02-10 10:33:31 -05:00
Maxim Biro
e58ee06492
Fix Coverty scan 2022-02-10 10:11:22 -05:00
Maxim Biro
df1bfbecd7
Turn autotools warnings into errors 2022-02-10 08:16:12 -05:00
Maxim Biro
bab4949433
Get skeletons out of the closet
The test was removed in c7ecee7c15 but
the entries in the build system remained, causing autotools to spit out
warnings.
2022-02-10 08:16:10 -05:00
Maxim Biro
836201e333
Add custom path options for msgpack in autotols 2022-02-10 05:28:05 -05:00
Maxim Biro
6e8ea97c06
Fix shared toxcore autotools build failing
Turns out libtoxcore.so wasn't being linked against libmsgpackc.
2022-02-10 05:28:03 -05:00
Maxim Biro
2965403e2c
Add bash-completion for tox-bootstrapd 2022-02-10 02:40:42 -05:00
iphydf
8002c35c79
chore: Remove duplicate source file in autotools build. 2022-02-09 20:49:34 +00:00
Robin Linden
6ee8fa0218
chore: Fix Appveyor failing due to adding a remote that already exists
Also drop the cache whenever the conanfile.py changes to ensure that we
don't work against stale data when adding dependencies and things.
2022-02-09 21:38:55 +01:00
Robin Linden
b64825b389
fix: Fix Conan build link failures 2022-02-09 21:38:52 +01:00
iphydf
10f86f6c00
cleanup: Add more nonnull and nullable annotations. 2022-02-09 20:03:34 +00:00
iphydf
5a3a0b6453
cleanup: Add nonnull annotations to function definitions.
These help static analysis and ubsan. We should eventually have all
functions annotated like this with a cimple check to make sure every
pointer has an explicit nullability annotation. The `nullable`
annotation does nothing in GCC, but will be used by cimple to validate
that every parameter has defined nullability.
2022-02-08 17:57:47 +00:00
iphydf
6f36b67a13
chore: Add an undefined behaviour/integer sanitizer build. 2022-02-08 09:18:18 +00: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
9218566599
cleanup: Make LAN discovery thread-safe without data races.
It was kind of thread-safe, maybe, but there was a data race that makes
tsan unhappy. We now do interface detection once per Tox instance
instead of once per process.
2022-02-06 19:56:34 +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
iphydf
cde796f1f8
cleanup: Comply with new cimple callback rules.
* Function arguments must use `foo_cb *p` and can't just use `foo_cb p`
* You can no longer cast function pointers (if it's incompatible, you
  must wrap the callback). I'm avoiding this with tokstyle exclusions.
2022-02-06 16:45:41 +00:00
iphydf
4d4120214a
chore: Add an easy way to run autotools and circleci builds locally. 2022-02-06 15:48:02 +00:00
Robin Linden
f87a6df938
cleanup: Split msi callback array into 1 member per callback 2022-02-06 15:45:24 +01:00
Robin Linden
bd71210e6f
Update readme header
* Drop the Travis build status.
* Drop the link to projects since we're not using that GitHub feature
  anymore.
* Update the Binaries/Downloads link to point to tox.chat/downloads. The
  previous link just lead to a page telling the user to go to
  tox.chat/downloads.
* Update the code coverage badge to point to codecov.
2022-02-06 06:57:00 +00:00
Robin Linden
d93e795cfe
Release 0.2.15 2022-02-06 04:40:03 +01:00
iphydf
79eb17aeac
fix: Reduce logging verbosity even more. 2022-02-06 03:33:34 +00:00
iphydf
fedcdea95a
fix: Reduce logging verbosity in TCP server. 2022-02-06 03:06:27 +00:00
Robin Linden
f41caa2a1e
Release 0.2.14 2022-02-05 22:24:58 +01:00
iphydf
d39f803c7e
docs: Make crypto_core.h appear on doxygen. 2022-02-05 19:34:13 +00:00
jfreegman
96814c4645
Use proper method for generating random numbers in a range
Using modulus creates a bias in its output. The libsodium
randombytes_uniform() function guarantees a uniform distribution
of possible outputs
2022-02-05 11:14:45 -05:00
iphydf
2ed9b1927f
doc: Add doxygen configuration and netlify publishing. 2022-02-05 15:59:45 +00:00
iphydf
7f0395b746
chore: Make the last few remaining top level comments doxygen style. 2022-02-04 23:25:45 +00:00
iphydf
13e4ff47fe
chore: Sync all comments between header and source files. 2022-02-04 22:43:02 +00:00
iphydf
074051078d
chore: Make all top level comments doxygen style /**.
This allows tokstyle to match them between header and source.
2022-02-04 22:43:02 +00:00
iphydf
1859d0f44a
cleanup: Ensure we limit the system headers included in .h files.
Most system headers contain functions (e.g. `memcpy` in `string.h`)
which aren't needed in our own header files. For the most part, our own
headers should only include types needed to declare our own types and
functions. We now enforce this so we think twice about which headers we
really need in the .h files.
2022-02-04 20:54:37 +00:00
Maxim Biro
cda6c9b6e8
Fix potential freeing of an immutable static buffer
strerror_r() has two versions: GNU-specific and XSI-compliant. The XSI
version always stores the string in the provided buffer, but the GNU
version might store it in the provided buffer or it might use some
immutable static buffer instead. Since we always free the error string,
we might end up freeing the immutable static buffer.
2022-02-04 08:09:14 -05:00
iphydf
28dc8c1ded
cleanup: Don't pass the whole DHT object to lan discovery.
It only needs net and dht public key.
2022-02-03 20:50:36 +00:00
iphydf
014cc42249
chore: Make run-infer script use docker.
So people can run it locally more easily.
2022-02-03 20:11:16 +00:00
jfreegman
1d3778fc53
Move duplicate code for converting IPv4-in-6 to IPv4 to a function 2022-02-03 12:32:30 -05:00
jfreegman
5619b5e056
Make more functions take const pointers to IP_Port
We additionally now make local copies of the IP_Port param instead
of modifying the passed argument
2022-02-03 11:17:29 -05:00
jfreegman
5880971af8
Make functions take const pointer to IP_Port wherever possible
An IP_Port is a fairly large data structure, and copying them down
the call stack creates a lot of unnecessary overhead.
2022-02-03 10:54:48 -05:00
jfreegman
3a72ed5fae
Properly copy Node_format using serialized format
Also fix a bad comment
2022-02-02 22:00:06 -05:00
iphydf
fcabbd2ed4
chore: Disable some cimple warnings for now.
So we can push the latest cimple to toktok-stack and then start fixing
the warnings.
2022-02-03 01:50:23 +00:00
iphydf
71965a0f3b
feat: Add WASM build for toxcore and websocket bootstrap node.
The websocket bootstrap node will be running on Heroku.
2022-02-02 16:05:25 +00:00