From b9f0b4801941478fc9ceb6d4d5a26c73cdc0879a Mon Sep 17 00:00:00 2001 From: jfreegman Date: Wed, 29 Nov 2023 10:23:57 -0500 Subject: [PATCH] Incorporate DHT groupchat changes into network profiler --- .circleci/config.yml | 1 - .../docker/tox-bootstrapd.sha256 | 2 +- toxcore/TCP_client.c | 2 - toxcore/TCP_client.h | 2 +- toxcore/net_profile.c | 2 +- toxcore/net_profile.h | 2 +- toxcore/tox_private.h | 43 +++++++++++++------ 7 files changed, 34 insertions(+), 20 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3bd04544bea..ee37ea56fde 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -77,7 +77,6 @@ jobs: llvm-dev ninja-build pkg-config - llvm-dev - checkout - run: git submodule update --init --recursive - run: CC=clang .circleci/cmake-asan diff --git a/other/bootstrap_daemon/docker/tox-bootstrapd.sha256 b/other/bootstrap_daemon/docker/tox-bootstrapd.sha256 index f212827744c..615633a9701 100644 --- a/other/bootstrap_daemon/docker/tox-bootstrapd.sha256 +++ b/other/bootstrap_daemon/docker/tox-bootstrapd.sha256 @@ -1 +1 @@ -1608abb52cd16775216d01d06569e6437d86ed11e9fc8dc6dc9c1c28668ccd8b /usr/local/bin/tox-bootstrapd +7c8ee2fd2d2348cd6e223cb8a2c847b6f94ff988b01f0360c498b61a4b91f825 /usr/local/bin/tox-bootstrapd diff --git a/toxcore/TCP_client.c b/toxcore/TCP_client.c index ced5a6f3389..e81f3219cee 100644 --- a/toxcore/TCP_client.c +++ b/toxcore/TCP_client.c @@ -791,8 +791,6 @@ static int handle_tcp_client_oob_recv(TCP_Client_Connection *conn, const uint8_t return -1; } - netprof_record_packet(conn->con.net_profile, data[0], length, DIR_RECV); - if (conn->oob_data_callback != nullptr) { conn->oob_data_callback(conn->oob_data_callback_object, data + 1, data + 1 + CRYPTO_PUBLIC_KEY_SIZE, length - (1 + CRYPTO_PUBLIC_KEY_SIZE), userdata); diff --git a/toxcore/TCP_client.h b/toxcore/TCP_client.h index 2ff29bb18f1..55c6eba365e 100644 --- a/toxcore/TCP_client.h +++ b/toxcore/TCP_client.h @@ -57,7 +57,7 @@ non_null() void tcp_con_set_custom_uint(TCP_Client_Connection *con, uint32_t value); /** Create new TCP connection to ip_port/public_key */ -non_null(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) nullable(11) +non_null(1, 2, 3, 4, 5, 6, 7, 8, 9) nullable(10, 11) TCP_Client_Connection *new_tcp_connection( const Logger *logger, const Memory *mem, const Mono_Time *mono_time, const Random *rng, const Network *ns, const IP_Port *ip_port, const uint8_t *public_key, const uint8_t *self_public_key, const uint8_t *self_secret_key, diff --git a/toxcore/net_profile.c b/toxcore/net_profile.c index ee3e231563c..caf75e27f9d 100644 --- a/toxcore/net_profile.c +++ b/toxcore/net_profile.c @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: GPL-3.0-or-later - * Copyright © 2022 The TokTok team. + * Copyright © 2023 The TokTok team. */ /** diff --git a/toxcore/net_profile.h b/toxcore/net_profile.h index 4e2cf2effa9..ffec249e4d6 100644 --- a/toxcore/net_profile.h +++ b/toxcore/net_profile.h @@ -1,5 +1,5 @@ /* SPDX-License-Identifier: GPL-3.0-or-later - * Copyright © 2022 The TokTok team. + * Copyright © 2023 The TokTok team. */ /** diff --git a/toxcore/tox_private.h b/toxcore/tox_private.h index 051d54ed99f..df7a7ab97fb 100644 --- a/toxcore/tox_private.h +++ b/toxcore/tox_private.h @@ -259,6 +259,13 @@ typedef enum Tox_Netprof_Packet_Id { */ TOX_NETPROF_PACKET_ID_LAN_DISCOVERY = 0x21, + /** + * DHT groupchat packets. + */ + TOX_NETPROF_PACKET_ID_GC_HANDSHAKE = 0x5a, + TOX_NETPROF_PACKET_ID_GC_LOSSLESS = 0x5b, + TOX_NETPROF_PACKET_ID_GC_LOSSY = 0x5c, + /** * Onion send packets. */ @@ -267,14 +274,14 @@ typedef enum Tox_Netprof_Packet_Id { TOX_NETPROF_PACKET_ID_ONION_SEND_2 = 0x82, /** - * DHT announce request packet. + * DHT announce request packet (deprecated). */ - TOX_NETPROF_PACKET_ID_ANNOUNCE_REQUEST = 0x83, + TOX_NETPROF_PACKET_ID_ANNOUNCE_REQUEST_OLD = 0x83, /** - * DHT announce response packet. + * DHT announce response packet (deprecated). */ - TOX_NETPROF_PACKET_ID_ANNOUNCE_RESPONSE = 0x84, + TOX_NETPROF_PACKET_ID_ANNOUNCE_RESPONSE_OLD = 0x84, /** * Onion data request packet. @@ -286,6 +293,16 @@ typedef enum Tox_Netprof_Packet_Id { */ TOX_NETPROF_PACKET_ID_ONION_DATA_RESPONSE = 0x86, + /** + * DHT announce request packet. + */ + TOX_NETPROF_PACKET_ID_ANNOUNCE_REQUEST = 0x87, + + /** + * DHT announce response packet. + */ + TOX_NETPROF_PACKET_ID_ANNOUNCE_RESPONSE = 0x88, + /** * Onion receive packets. */ @@ -293,16 +310,16 @@ typedef enum Tox_Netprof_Packet_Id { TOX_NETPROF_PACKET_ID_ONION_RECV_2 = 0x8d, TOX_NETPROF_PACKET_ID_ONION_RECV_1 = 0x8e, - TOX_NETPROF_PACKET_FORWARD_REQUEST = 0x90, - TOX_NETPROF_FORWARDING = 0x91, - TOX_NETPROF_FORWARD_REPLY = 0x92, + TOX_NETPROF_PACKET_ID_FORWARD_REQUEST = 0x90, + TOX_NETPROF_PACKET_ID_FORWARDING = 0x91, + TOX_NETPROF_PACKET_ID_FORWARD_REPLY = 0x92, - TOX_NETPROF_DATA_SEARCH_REQUEST = 0x93, - TOX_NETPROF_DATA_SEARCH_RESPONSE = 0x94, - TOX_NETPROF_DATA_RETRIEVE_REQUEST = 0x95, - TOX_NETPROF_DATA_RETRIEVE_RESPONSE = 0x96, - TOX_NETPROF_STORE_ANNOUNCE_REQUEST = 0x97, - TOX_NETPROF_STORE_ANNOUNCE_RESPONSE = 0x98, + TOX_NETPROF_PACKET_ID_DATA_SEARCH_REQUEST = 0x93, + TOX_NETPROF_PACKET_ID_DATA_SEARCH_RESPONSE = 0x94, + TOX_NETPROF_PACKET_ID_DATA_RETRIEVE_REQUEST = 0x95, + TOX_NETPROF_PACKET_ID_DATA_RETRIEVE_RESPONSE = 0x96, + TOX_NETPROF_PACKET_ID_STORE_ANNOUNCE_REQUEST = 0x97, + TOX_NETPROF_PACKET_ID_STORE_ANNOUNCE_RESPONSE = 0x98, /** * Bootstrap info packet.