Skip to content

Commit

Permalink
refactor: Change the TCP_PACKET_* defines into an enum.
Browse files Browse the repository at this point in the history
  • Loading branch information
iphydf committed Dec 20, 2023
1 parent 22cd38a commit 0ce46b6
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions toxcore/TCP_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,20 @@ void wipe_priority_list(const Memory *mem, TCP_Priority_List *p);
#define NUM_RESERVED_PORTS 16
#define NUM_CLIENT_CONNECTIONS (256 - NUM_RESERVED_PORTS)

#define TCP_PACKET_ROUTING_REQUEST 0
#define TCP_PACKET_ROUTING_RESPONSE 1
#define TCP_PACKET_CONNECTION_NOTIFICATION 2
#define TCP_PACKET_DISCONNECT_NOTIFICATION 3
#define TCP_PACKET_PING 4
#define TCP_PACKET_PONG 5
#define TCP_PACKET_OOB_SEND 6
#define TCP_PACKET_OOB_RECV 7
#define TCP_PACKET_ONION_REQUEST 8
#define TCP_PACKET_ONION_RESPONSE 9
#define TCP_PACKET_FORWARD_REQUEST 10
#define TCP_PACKET_FORWARDING 11
typedef enum Tcp_Packet {
TCP_PACKET_ROUTING_REQUEST = 0,
TCP_PACKET_ROUTING_RESPONSE = 1,
TCP_PACKET_CONNECTION_NOTIFICATION = 2,
TCP_PACKET_DISCONNECT_NOTIFICATION = 3,
TCP_PACKET_PING = 4,
TCP_PACKET_PONG = 5,
TCP_PACKET_OOB_SEND = 6,
TCP_PACKET_OOB_RECV = 7,
TCP_PACKET_ONION_REQUEST = 8,
TCP_PACKET_ONION_RESPONSE = 9,
TCP_PACKET_FORWARD_REQUEST = 10,
TCP_PACKET_FORWARDING = 11,
} Tcp_Packet;

#define TCP_HANDSHAKE_PLAIN_SIZE (CRYPTO_PUBLIC_KEY_SIZE + CRYPTO_NONCE_SIZE)
#define TCP_SERVER_HANDSHAKE_SIZE (CRYPTO_NONCE_SIZE + TCP_HANDSHAKE_PLAIN_SIZE + CRYPTO_MAC_SIZE)
Expand Down

0 comments on commit 0ce46b6

Please sign in to comment.