refactor: Change the TCP_PACKET_* defines into an enum.

This commit is contained in:
iphydf 2023-12-20 15:11:23 +00:00
parent 22cd38ad50
commit 0ce46b644e
No known key found for this signature in database
GPG Key ID: 3855DBA2D74403C9

View File

@ -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)