summaryrefslogtreecommitdiff
path: root/trackerlogic.h
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2024-04-05 16:30:02 +0200
committerDirk Engling <erdgeist@erdgeist.org>2024-04-05 16:30:02 +0200
commit524d78d6c7552cd4c44be7cea1ccc7cdbb11b490 (patch)
treefb2de9f3255e9e3a05cf91438eeba7d5c4265251 /trackerlogic.h
parent64e25b681c4668577fa54ead3215442ad707440d (diff)
constify
Diffstat (limited to 'trackerlogic.h')
-rw-r--r--trackerlogic.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/trackerlogic.h b/trackerlogic.h
index 24ef097..4fb8bc7 100644
--- a/trackerlogic.h
+++ b/trackerlogic.h
@@ -82,7 +82,7 @@ typedef enum { FLAG_TCP, FLAG_UDP, FLAG_MCA, FLAG_SELFPIPE } PROTO_FLAG;
82#define OT_PEER_SIZE6 ((OT_TIME_SIZE)+(OT_FLAG_SIZE)+(OT_PEER_COMPARE_SIZE6)) 82#define OT_PEER_SIZE6 ((OT_TIME_SIZE)+(OT_FLAG_SIZE)+(OT_PEER_COMPARE_SIZE6))
83#define OT_PEER_SIZE4 ((OT_TIME_SIZE)+(OT_FLAG_SIZE)+(OT_PEER_COMPARE_SIZE4)) 83#define OT_PEER_SIZE4 ((OT_TIME_SIZE)+(OT_FLAG_SIZE)+(OT_PEER_COMPARE_SIZE4))
84 84
85typedef uint8_t ot_peer[1]; 85typedef uint8_t ot_peer[1]; /* Generic pointer to a v6 or v4 peer */
86typedef uint8_t ot_peer6[OT_PEER_SIZE6]; 86typedef uint8_t ot_peer6[OT_PEER_SIZE6];
87typedef uint8_t ot_peer4[OT_PEER_SIZE4]; 87typedef uint8_t ot_peer4[OT_PEER_SIZE4];
88static const uint8_t PEER_FLAG_SEEDING = 0x80; 88static const uint8_t PEER_FLAG_SEEDING = 0x80;
@@ -96,11 +96,11 @@ ot_peer *peer_from_peer6(ot_peer6 *peer, size_t *peer_size);
96size_t peer_size_from_peer6(ot_peer6 *peer); 96size_t peer_size_from_peer6(ot_peer6 *peer);
97 97
98/* New style */ 98/* New style */
99#define OT_SETIP(peer,ip) memcpy((peer),(ip),OT_IP_SIZE6) 99#define OT_SETIP(peer,ip) memcpy((uint8_t*)(peer),(ip),OT_IP_SIZE6)
100#define OT_SETPORT(peer,port) memcpy(((uint8_t*)(peer))+(OT_IP_SIZE6),(port),2) 100#define OT_SETPORT(peer,port) memcpy(((uint8_t*)(peer))+(OT_IP_SIZE6),(port),2)
101#define OT_PEERFLAG(peer) (((uint8_t*)(peer))[(OT_IP_SIZE6)+2]) 101#define OT_PEERFLAG(peer) (((uint8_t*)(peer))[(OT_IP_SIZE6)+2])
102#define OT_PEERFLAG_D(peer,peersize) (((uint8_t*)(peer))[(peersize)-2]) 102#define OT_PEERFLAG_D(peer,peersize) (((uint8_t*)(peer))[(peersize)-2])
103#define OT_PEERTIME(peer,peersize) (((uint8_t*)(peer))[(peersize)-1]) 103#define OT_PEERTIME(peer,peersize) (((uint8_t*)(peer))[(peersize)-1])
104 104
105#define PEERS_BENCODED6 "6:peers6" 105#define PEERS_BENCODED6 "6:peers6"
106#define PEERS_BENCODED4 "5:peers" 106#define PEERS_BENCODED4 "5:peers"
@@ -187,9 +187,9 @@ void exerr( char * message );
187 otherwise it is released in return_peers_for_torrent */ 187 otherwise it is released in return_peers_for_torrent */
188size_t add_peer_to_torrent_and_return_peers( PROTO_FLAG proto, struct ot_workstruct *ws, size_t amount ); 188size_t add_peer_to_torrent_and_return_peers( PROTO_FLAG proto, struct ot_workstruct *ws, size_t amount );
189size_t remove_peer_from_torrent( PROTO_FLAG proto, struct ot_workstruct *ws ); 189size_t remove_peer_from_torrent( PROTO_FLAG proto, struct ot_workstruct *ws );
190size_t return_tcp_scrape_for_torrent( ot_hash *hash, int amount, char *reply ); 190size_t return_tcp_scrape_for_torrent( ot_hash const *hash_list, int amount, char *reply );
191size_t return_udp_scrape_for_torrent( ot_hash hash, char *reply ); 191size_t return_udp_scrape_for_torrent( ot_hash const hash, char *reply );
192void add_torrent_from_saved_state( ot_hash hash, ot_time base, size_t down_count ); 192void add_torrent_from_saved_state( ot_hash const hash, ot_time base, size_t down_count );
193 193
194/* torrent iterator */ 194/* torrent iterator */
195void iterate_all_torrents( int (*for_each)( ot_torrent* torrent, uintptr_t data ), uintptr_t data ); 195void iterate_all_torrents( int (*for_each)( ot_torrent* torrent, uintptr_t data ), uintptr_t data );