summaryrefslogtreecommitdiff
path: root/trackerlogic.h
diff options
context:
space:
mode:
Diffstat (limited to 'trackerlogic.h')
-rw-r--r--trackerlogic.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/trackerlogic.h b/trackerlogic.h
index 03ed577..ad18cba 100644
--- a/trackerlogic.h
+++ b/trackerlogic.h
@@ -1,6 +1,8 @@
1#ifndef __TRACKERLOGIC_H__ 1#ifndef __TRACKERLOGIC_H__
2#define __TRACKERLOGIC_H__ 2#define __TRACKERLOGIC_H__
3 3
4#include <sys/types.h>
5
4/* Should be called BYTE, WORD, DWORD - but some OSs already have that and there's no #iftypedef */ 6/* Should be called BYTE, WORD, DWORD - but some OSs already have that and there's no #iftypedef */
5/* They mark memory used as data instead of integer or human readable string - 7/* They mark memory used as data instead of integer or human readable string -
6 they should be cast before used as integer/text */ 8 they should be cast before used as integer/text */
@@ -12,8 +14,8 @@ typedef unsigned long ot_time;
12typedef ot_byte ot_hash[20]; 14typedef ot_byte ot_hash[20];
13typedef ot_byte ot_ip[ 4/*0*/ ]; 15typedef ot_byte ot_ip[ 4/*0*/ ];
14// tunables 16// tunables
15const unsigned long OT_TIMEOUT = 2700; 17static const unsigned long OT_TIMEOUT = 2700;
16const unsigned long OT_HUGE_FILESIZE = 1024*1024*256; // Thats 256MB per file, enough for 204800 peers of 128 bytes 18static const unsigned long OT_HUGE_FILESIZE = 1024*1024*256; // Thats 256MB per file, enough for 204800 peers of 128 bytes
17 19
18// We will not service v6, yes 20// We will not service v6, yes
19#define OT_COMPACT_ONLY 21#define OT_COMPACT_ONLY
@@ -35,8 +37,8 @@ typedef struct ot_peer {
35 ot_time death; 37 ot_time death;
36 ot_byte flags; 38 ot_byte flags;
37} *ot_peer; 39} *ot_peer;
38ot_byte PEER_FLAG_SEEDING = 0x80; 40static const ot_byte PEER_FLAG_SEEDING = 0x80;
39ot_byte PEER_IP_LENGTH_MASK = 0x3f; 41static const ot_byte PEER_IP_LENGTH_MASK = 0x3f;
40 42
41typedef struct { 43typedef struct {
42 ot_hash hash; 44 ot_hash hash;
@@ -64,8 +66,8 @@ void *binary_search( const void *key, const void *base,
64int init_logic( char *chdir_directory ); 66int init_logic( char *chdir_directory );
65void deinit_logic( ); 67void deinit_logic( );
66 68
67ot_torrent add_peer_to_torrent( ot_hash hash, ot_peer peer ); 69ot_torrent add_peer_to_torrent( ot_hash *hash, ot_peer peer );
68void return_peers_for_torrent( ot_torrent torrent, unsigned long amount, char *reply ); 70size_t return_peers_for_torrent( ot_torrent torrent, unsigned long amount, char *reply );
69void heal_torrent( ot_torrent torrent ); 71void heal_torrent( ot_torrent torrent );
70 72
71#endif 73#endif