Skip to content

Commit 0ce46b6

Browse files
committed
refactor: Change the TCP_PACKET_* defines into an enum.
1 parent 22cd38a commit 0ce46b6

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

toxcore/TCP_common.h

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,20 @@ void wipe_priority_list(const Memory *mem, TCP_Priority_List *p);
2424
#define NUM_RESERVED_PORTS 16
2525
#define NUM_CLIENT_CONNECTIONS (256 - NUM_RESERVED_PORTS)
2626

27-
#define TCP_PACKET_ROUTING_REQUEST 0
28-
#define TCP_PACKET_ROUTING_RESPONSE 1
29-
#define TCP_PACKET_CONNECTION_NOTIFICATION 2
30-
#define TCP_PACKET_DISCONNECT_NOTIFICATION 3
31-
#define TCP_PACKET_PING 4
32-
#define TCP_PACKET_PONG 5
33-
#define TCP_PACKET_OOB_SEND 6
34-
#define TCP_PACKET_OOB_RECV 7
35-
#define TCP_PACKET_ONION_REQUEST 8
36-
#define TCP_PACKET_ONION_RESPONSE 9
37-
#define TCP_PACKET_FORWARD_REQUEST 10
38-
#define TCP_PACKET_FORWARDING 11
27+
typedef enum Tcp_Packet {
28+
TCP_PACKET_ROUTING_REQUEST = 0,
29+
TCP_PACKET_ROUTING_RESPONSE = 1,
30+
TCP_PACKET_CONNECTION_NOTIFICATION = 2,
31+
TCP_PACKET_DISCONNECT_NOTIFICATION = 3,
32+
TCP_PACKET_PING = 4,
33+
TCP_PACKET_PONG = 5,
34+
TCP_PACKET_OOB_SEND = 6,
35+
TCP_PACKET_OOB_RECV = 7,
36+
TCP_PACKET_ONION_REQUEST = 8,
37+
TCP_PACKET_ONION_RESPONSE = 9,
38+
TCP_PACKET_FORWARD_REQUEST = 10,
39+
TCP_PACKET_FORWARDING = 11,
40+
} Tcp_Packet;
3941

4042
#define TCP_HANDSHAKE_PLAIN_SIZE (CRYPTO_PUBLIC_KEY_SIZE + CRYPTO_NONCE_SIZE)
4143
#define TCP_SERVER_HANDSHAKE_SIZE (CRYPTO_NONCE_SIZE + TCP_HANDSHAKE_PLAIN_SIZE + CRYPTO_MAC_SIZE)

0 commit comments

Comments
 (0)