Squashed 'external/toxcore/c-toxcore/' changes from 11ab1d2a723..d9b8fa6098d

d9b8fa6098d fix: Fake broadcast address for 127.x.x.x
aa649165a57 chore: Add code for future netprof TCP testing
9e5693de5ac chore: add to_string functions for netprof enums
52d915e6a90 cleanup: Heap allocate network profile objects
80fabd4a729 feat: Implement Tox network profiler
05abe083cb6 cleanup: Some random cleanups, mostly related to mem.
5cca24513b8 cleanup: Check that onion IP/Port packing worked.
e092ecd1244 cleanup: Use tox memory allocator in some more places.
3cfe41c7587 fix: Avoid `memcpy`-ing structs into onion ping id data.
e32ac001938 fix: Add more information on why the frame was not sent.
ab887003687 fix: Allow TCP connections to fail `connect` calls.
7603170e663 refactor: Use tox memory in group connection allocations.
5bd8a85eb89 cleanup: Align internal logger with external on type of source line.
e9bf524d9e1 cleanup: Add missing `#include` to sort_test.cc.
d10c966b998 feat: Add `to_string` functions for toxencryptsave errors.
7bfd0dc8003 docs: Update the docs for group join functions
380dde9f2ae test: Add more logging to TCP connection constructor.
0f12f384c8c cleanup: Reduce stack frame sizes to below 4096 bytes.
bc43cec0626 chore: Happy new year!
fbe78f1702e cleanup: Add a `TOX_HIDE_DEPRECATED` check to hide deprecated symbols.
44d9da07e77 refactor: Use tox memory for group moderation/pack allocations.
7f26d520168 refactor: Use tox memory in group chats allocations.
2f62f3d0e77 refactor: Use tox Memory for group allocations.
8a968162041 chore: Add dispatch/events headers to bazel export.
2bbfb35abf6 docs: Output the error code string instead of int. in toxav logging
d55d0e4eaef cleanup: Remove redundant code for checking if group exists
2a6dc643338 chore: Upgrade dependencies for websockify.
fc0650601c1 fix: Allow peers to reconnect to group chats using a password

git-subtree-dir: external/toxcore/c-toxcore
git-subtree-split: d9b8fa6098de6c074038b6664d2572627540b148
This commit is contained in:
Green Sky
2025-01-18 15:53:06 +01:00
parent 261d2e53b7
commit 3b6bb15e86
213 changed files with 2341 additions and 758 deletions

View File

@ -1,5 +1,5 @@
/* SPDX-License-Identifier: GPL-3.0-or-later
* Copyright © 2016-2024 The TokTok team.
* Copyright © 2016-2025 The TokTok team.
* Copyright © 2013 Tox project.
*/
@ -87,6 +87,13 @@
* If any other thread calls tox_self_set_name while this thread is allocating
* memory, the length may have become invalid, and the call to
* tox_self_get_name may cause undefined behaviour.
*
* @section deprecations
*
* Some functions and types are deprecated. We recommend compiling with
* `-DTOX_HIDE_DEPRECATED` to hide them. They will be removed in the next major
* version of Tox (and since we're in major version 0, that means the next
* minor version).
*/
#ifndef C_TOXCORE_TOXCORE_TOX_H
#define C_TOXCORE_TOXCORE_TOX_H
@ -512,6 +519,7 @@ typedef void tox_log_cb(Tox *tox, Tox_Log_Level level, const char *file, uint32_
* private) in v0.3.0.
*/
typedef struct Tox_Options Tox_Options;
#ifndef TOX_HIDE_DEPRECATED
struct Tox_Options {
/**
@ -687,6 +695,7 @@ struct Tox_Options {
*/
bool experimental_disable_dns;
};
#endif /* TOX_HIDE_DEPRECATED */
bool tox_options_get_ipv6_enabled(const Tox_Options *options);
@ -3165,6 +3174,7 @@ const char *tox_err_conference_by_id_to_string(Tox_Err_Conference_By_Id value);
Tox_Conference_Number tox_conference_by_id(
const Tox *tox, const uint8_t id[TOX_CONFERENCE_ID_SIZE], Tox_Err_Conference_By_Id *error);
#ifndef TOX_HIDE_DEPRECATED
/**
* @brief Get the conference unique ID.
*
@ -3179,6 +3189,7 @@ Tox_Conference_Number tox_conference_by_id(
*/
bool tox_conference_get_uid(
const Tox *tox, Tox_Conference_Number conference_number, uint8_t uid[TOX_CONFERENCE_UID_SIZE]);
#endif /* TOX_HIDE_DEPRECATED */
typedef enum Tox_Err_Conference_By_Uid {
@ -3201,6 +3212,7 @@ typedef enum Tox_Err_Conference_By_Uid {
const char *tox_err_conference_by_uid_to_string(Tox_Err_Conference_By_Uid value);
#ifndef TOX_HIDE_DEPRECATED
/**
* @brief Return the conference number associated with the specified uid.
*
@ -3213,6 +3225,7 @@ const char *tox_err_conference_by_uid_to_string(Tox_Err_Conference_By_Uid value)
*/
Tox_Conference_Number tox_conference_by_uid(
const Tox *tox, const uint8_t uid[TOX_CONFERENCE_UID_SIZE], Tox_Err_Conference_By_Uid *error);
#endif /* TOX_HIDE_DEPRECATED */
/** @} */
@ -3685,9 +3698,7 @@ typedef enum Tox_Err_Group_Join {
TOX_ERR_GROUP_JOIN_INIT,
/**
* The chat_id pointer is set to NULL or a group with chat_id already
* exists. This usually happens if the client attempts to create multiple
* sessions for the same group.
* The chat_id pointer is set to NULL.
*/
TOX_ERR_GROUP_JOIN_BAD_CHAT_ID,
@ -3717,12 +3728,15 @@ typedef enum Tox_Err_Group_Join {
const char *tox_err_group_join_to_string(Tox_Err_Group_Join value);
/**
* Joins a group chat with specified Chat ID.
* Joins a group chat with specified Chat ID or reconnects to an existing group.
*
* This function creates a new group chat object, adds it to the chats array,
* and sends a DHT announcement to find peers in the group associated with
* chat_id. Once a peer has been found a join attempt will be initiated.
*
* If a group with the specified Chat ID already exists, this function will attempt
* to reconnect to the group.
*
* @param chat_id The Chat ID of the group you wish to join. This must be
* TOX_GROUP_CHAT_ID_SIZE bytes.
* @param password The password required to join the group. Set to NULL if no
@ -3817,6 +3831,7 @@ typedef enum Tox_Err_Group_Reconnect {
const char *tox_err_group_reconnect_to_string(Tox_Err_Group_Reconnect value);
#ifndef TOX_HIDE_DEPRECATED
/**
* Reconnects to a group.
*
@ -3827,8 +3842,11 @@ const char *tox_err_group_reconnect_to_string(Tox_Err_Group_Reconnect value);
* @param group_number The group number of the group we wish to reconnect to.
*
* @return true on success.
*
* @deprecated Use `tox_group_join` instead.
*/
bool tox_group_reconnect(Tox *tox, Tox_Group_Number group_number, Tox_Err_Group_Reconnect *error);
#endif /* TOX_HIDE_DEPRECATED */
typedef enum Tox_Err_Group_Leave {
@ -5742,6 +5760,7 @@ void tox_callback_group_moderation(Tox *tox, tox_group_moderation_cb *callback);
//!TOKSTYLE-
#ifndef DOXYGEN_IGNORE
#ifndef TOX_HIDE_DEPRECATED
typedef Tox_Err_Options_New TOX_ERR_OPTIONS_NEW;
typedef Tox_Err_New TOX_ERR_NEW;
typedef Tox_Err_Bootstrap TOX_ERR_BOOTSTRAP;
@ -5781,6 +5800,7 @@ typedef Tox_Connection TOX_CONNECTION;
typedef Tox_File_Control TOX_FILE_CONTROL;
typedef Tox_Conference_Type TOX_CONFERENCE_TYPE;
typedef enum Tox_File_Kind TOX_FILE_KIND;
#endif /* TOX_HIDE_DEPRECATED */
#endif
//!TOKSTYLE+