From eb8834f7783cb85ae825976425800cd4af711263 Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Mon, 1 Apr 2024 23:00:34 +0200 Subject: Move further towards dual stack capable opentracker, name more constants --- trackerlogic.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/trackerlogic.h b/trackerlogic.h index 47d6a31..f43b4f1 100644 --- a/trackerlogic.h +++ b/trackerlogic.h @@ -34,6 +34,9 @@ typedef struct { ot_ip6 address; int bits; } #define PEERS_BENCODED "5:peers" #define OT_MAX_PEERS_UDP 200 #endif +#define OT_PORT_SIZE 2 +#define OT_FLAG_SIZE 1 +#define OT_TIME_SIZE 1 /* Some tracker behaviour tunable */ #define OT_CLIENT_TIMEOUT 30 @@ -75,7 +78,9 @@ extern volatile int g_opentracker_running; extern uint32_t g_tracker_id; typedef enum { FLAG_TCP, FLAG_UDP, FLAG_MCA, FLAG_SELFPIPE } PROTO_FLAG; -typedef uint8_t ot_peer[OT_IP_SIZE+2+2]; +#define OT_PEER_COMPARE_SIZE ((OT_IP_SIZE)+(OT_PORT_SIZE)) +#define OT_PEER_SIZE ((OT_TIME_SIZE)+(OT_FLAG_SIZE)+(OT_PEER_COMPARE_SIZE)) +typedef uint8_t ot_peer[OT_PEER_SIZE]; static const uint8_t PEER_FLAG_SEEDING = 0x80; static const uint8_t PEER_FLAG_COMPLETED = 0x40; static const uint8_t PEER_FLAG_STOPPED = 0x20; @@ -92,7 +97,6 @@ static const uint8_t PEER_FLAG_LEECHING = 0x00; #define OT_PEERTIME(peer) (((uint8_t*)(peer))[(OT_IP_SIZE)+3]) #define OT_HASH_COMPARE_SIZE (sizeof(ot_hash)) -#define OT_PEER_COMPARE_SIZE ((OT_IP_SIZE)+2) struct ot_peerlist; typedef struct ot_peerlist ot_peerlist; -- cgit v1.2.3