Skip to content

Commit

Permalink
Incorporate DHT groupchat changes into network profiler
Browse files Browse the repository at this point in the history
  • Loading branch information
JFreegman committed Dec 14, 2023
1 parent a8134a2 commit a0b77f8
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 19 deletions.
1 change: 0 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions toxcore/TCP_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion toxcore/TCP_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion toxcore/net_profile.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: GPL-3.0-or-later
* Copyright © 2022 The TokTok team.
* Copyright © 2023 The TokTok team.
*/

/**
Expand Down
2 changes: 1 addition & 1 deletion toxcore/net_profile.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* SPDX-License-Identifier: GPL-3.0-or-later
* Copyright © 2022 The TokTok team.
* Copyright © 2023 The TokTok team.
*/

/**
Expand Down
43 changes: 30 additions & 13 deletions toxcore/tox_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand All @@ -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.
Expand All @@ -286,23 +293,33 @@ 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.
*/
TOX_NETPROF_PACKET_ID_ONION_RECV_3 = 0x8c,
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.
Expand Down

0 comments on commit a0b77f8

Please sign in to comment.