Squashed 'external/toxcore/c-toxcore/' changes from 73d9b845a3..e2c01e457b

e2c01e457b refactor: Use enum-specific pack functions for enum values.
afc472402b refactor: Factor out union pack switch from event packer.
6caa7ce4b1 cleanup: Move the 2-element array pack out of individual events.
687af81f20 cleanup: Remove empty test doing nothing.
fcf5882428 test: Add printf log statement to group_moderation_test.
b4d8826228 cleanup: Remove old type-ordered event getters.
8c35e0fefb feat: add ngc events
97bdd83937 refactor: Make event dispatch ordered by receive time.
001d00ab30 fix: dont resolve to ipv6 addresses when its disabled
d3b935f63f fix(test): tests use ipv6 by default, even with USE_IPV6 set to 0
29fc5ea1f7 chore: add clangd files to .gitignore
d30c81acbc refactor: Move file streaming test to its own file.
acdc67387b fix(ci): window builds now build in parallel
REVERT: 73d9b845a3 cleanup: Remove old type-ordered event getters.
REVERT: b0840cc02d feat: add ngc events
REVERT: 7df9a51349 refactor: Make event dispatch ordered by receive time.

git-subtree-dir: external/toxcore/c-toxcore
git-subtree-split: e2c01e457bfb8a59537175c8fe17ca9ab1c9e3e1
This commit is contained in:
2024-01-15 23:32:23 +01:00
parent b1fe064484
commit 61accfe184
63 changed files with 632 additions and 344 deletions

View File

@ -48,7 +48,7 @@ static void change_symmetric_key(Onion *onion)
/** packing and unpacking functions */
non_null()
static void ip_pack(uint8_t *data, const IP *source)
static void ip_pack_to_bytes(uint8_t *data, const IP *source)
{
data[0] = source->family.value;
@ -62,7 +62,7 @@ static void ip_pack(uint8_t *data, const IP *source)
/** return 0 on success, -1 on failure. */
non_null()
static int ip_unpack(IP *target, const uint8_t *data, unsigned int data_size, bool disable_family_check)
static int ip_unpack_from_bytes(IP *target, const uint8_t *data, unsigned int data_size, bool disable_family_check)
{
if (data_size < (1 + SIZE_IP6)) {
return -1;
@ -87,7 +87,7 @@ static int ip_unpack(IP *target, const uint8_t *data, unsigned int data_size, bo
non_null()
static void ipport_pack(uint8_t *data, const IP_Port *source)
{
ip_pack(data, &source->ip);
ip_pack_to_bytes(data, &source->ip);
memcpy(data + SIZE_IP, &source->port, SIZE_PORT);
}
@ -99,7 +99,7 @@ static int ipport_unpack(IP_Port *target, const uint8_t *data, unsigned int data
return -1;
}
if (ip_unpack(&target->ip, data, data_size, disable_family_check) == -1) {
if (ip_unpack_from_bytes(&target->ip, data, data_size, disable_family_check) == -1) {
return -1;
}