summaryrefslogtreecommitdiff
path: root/trackerlogic.h
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2024-04-01 23:00:34 +0200
committerDirk Engling <erdgeist@erdgeist.org>2024-04-01 23:00:34 +0200
commiteb8834f7783cb85ae825976425800cd4af711263 (patch)
treebe5889e351446fd4c9657366cadd99d319e30e83 /trackerlogic.h
parent9275eb3f82ed0f82d4fc2dad0a0728e76a774a04 (diff)
Move further towards dual stack capable opentracker, name more constants
Diffstat (limited to 'trackerlogic.h')
-rw-r--r--trackerlogic.h8
1 files 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; }
34#define PEERS_BENCODED "5:peers" 34#define PEERS_BENCODED "5:peers"
35#define OT_MAX_PEERS_UDP 200 35#define OT_MAX_PEERS_UDP 200
36#endif 36#endif
37#define OT_PORT_SIZE 2
38#define OT_FLAG_SIZE 1
39#define OT_TIME_SIZE 1
37 40
38/* Some tracker behaviour tunable */ 41/* Some tracker behaviour tunable */
39#define OT_CLIENT_TIMEOUT 30 42#define OT_CLIENT_TIMEOUT 30
@@ -75,7 +78,9 @@ extern volatile int g_opentracker_running;
75extern uint32_t g_tracker_id; 78extern uint32_t g_tracker_id;
76typedef enum { FLAG_TCP, FLAG_UDP, FLAG_MCA, FLAG_SELFPIPE } PROTO_FLAG; 79typedef enum { FLAG_TCP, FLAG_UDP, FLAG_MCA, FLAG_SELFPIPE } PROTO_FLAG;
77 80
78typedef uint8_t ot_peer[OT_IP_SIZE+2+2]; 81#define OT_PEER_COMPARE_SIZE ((OT_IP_SIZE)+(OT_PORT_SIZE))
82#define OT_PEER_SIZE ((OT_TIME_SIZE)+(OT_FLAG_SIZE)+(OT_PEER_COMPARE_SIZE))
83typedef uint8_t ot_peer[OT_PEER_SIZE];
79static const uint8_t PEER_FLAG_SEEDING = 0x80; 84static const uint8_t PEER_FLAG_SEEDING = 0x80;
80static const uint8_t PEER_FLAG_COMPLETED = 0x40; 85static const uint8_t PEER_FLAG_COMPLETED = 0x40;
81static const uint8_t PEER_FLAG_STOPPED = 0x20; 86static const uint8_t PEER_FLAG_STOPPED = 0x20;
@@ -92,7 +97,6 @@ static const uint8_t PEER_FLAG_LEECHING = 0x00;
92#define OT_PEERTIME(peer) (((uint8_t*)(peer))[(OT_IP_SIZE)+3]) 97#define OT_PEERTIME(peer) (((uint8_t*)(peer))[(OT_IP_SIZE)+3])
93 98
94#define OT_HASH_COMPARE_SIZE (sizeof(ot_hash)) 99#define OT_HASH_COMPARE_SIZE (sizeof(ot_hash))
95#define OT_PEER_COMPARE_SIZE ((OT_IP_SIZE)+2)
96 100
97struct ot_peerlist; 101struct ot_peerlist;
98typedef struct ot_peerlist ot_peerlist; 102typedef struct ot_peerlist ot_peerlist;