diff options
author | erdgeist <> | 2007-12-03 01:07:41 +0000 |
---|---|---|
committer | erdgeist <> | 2007-12-03 01:07:41 +0000 |
commit | 848a06a706b1661666f1923817ee99e9710a52d4 (patch) | |
tree | 580ea601618396d0fb395dadb748764eed5c4eee /trackerlogic.h | |
parent | 9bc0d99c6273e845c98dad9f7fc202b695055c9c (diff) |
Drop ot_{byte,word,dword} and use uint{8,16,32}_t, also simplify includes
Diffstat (limited to 'trackerlogic.h')
-rw-r--r-- | trackerlogic.h | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/trackerlogic.h b/trackerlogic.h index 1eff6df..eefc038 100644 --- a/trackerlogic.h +++ b/trackerlogic.h | |||
@@ -9,14 +9,7 @@ | |||
9 | #include <time.h> | 9 | #include <time.h> |
10 | #include <stdint.h> | 10 | #include <stdint.h> |
11 | 11 | ||
12 | /* Should be called BYTE, WORD, DWORD - but some OSs already have that and there's no #iftypedef */ | 12 | typedef uint8_t ot_hash[20]; |
13 | /* They mark memory used as data instead of integer or human readable string - | ||
14 | they should be cast before used as integer/text */ | ||
15 | typedef uint8_t ot_byte; | ||
16 | typedef uint16_t ot_word; | ||
17 | typedef uint32_t ot_dword; | ||
18 | |||
19 | typedef ot_byte ot_hash[20]; | ||
20 | typedef time_t ot_time; | 13 | typedef time_t ot_time; |
21 | 14 | ||
22 | /* Some tracker behaviour tunable */ | 15 | /* Some tracker behaviour tunable */ |
@@ -46,20 +39,19 @@ typedef time_t ot_time; | |||
46 | #define OT_POOLS_TIMEOUT (60*5) | 39 | #define OT_POOLS_TIMEOUT (60*5) |
47 | 40 | ||
48 | /* From opentracker.c */ | 41 | /* From opentracker.c */ |
49 | extern time_t ot_start_time; | ||
50 | extern time_t g_now; | 42 | extern time_t g_now; |
51 | #define NOW (g_now/OT_POOLS_TIMEOUT) | 43 | #define NOW (g_now/OT_POOLS_TIMEOUT) |
52 | 44 | ||
53 | typedef struct { | 45 | typedef struct { |
54 | ot_byte data[8]; | 46 | uint8_t data[8]; |
55 | } ot_peer; | 47 | } ot_peer; |
56 | static const ot_byte PEER_FLAG_SEEDING = 0x80; | 48 | static const uint8_t PEER_FLAG_SEEDING = 0x80; |
57 | static const ot_byte PEER_FLAG_COMPLETED = 0x40; | 49 | static const uint8_t PEER_FLAG_COMPLETED = 0x40; |
58 | static const ot_byte PEER_FLAG_STOPPED = 0x20; | 50 | static const uint8_t PEER_FLAG_STOPPED = 0x20; |
59 | 51 | ||
60 | #define OT_SETIP( peer, ip ) memmove((peer),(ip),4); | 52 | #define OT_SETIP( peer, ip ) memmove((peer),(ip),4); |
61 | #define OT_SETPORT( peer, port ) memmove(((ot_byte*)peer)+4,(port),2); | 53 | #define OT_SETPORT( peer, port ) memmove(((uint8_t*)peer)+4,(port),2); |
62 | #define OT_FLAG(peer) (((ot_byte*)(peer))[6]) | 54 | #define OT_FLAG(peer) (((uint8_t*)(peer))[6]) |
63 | 55 | ||
64 | #define OT_PEER_COMPARE_SIZE ((size_t)6) | 56 | #define OT_PEER_COMPARE_SIZE ((size_t)6) |
65 | #define OT_HASH_COMPARE_SIZE (sizeof(ot_hash)) | 57 | #define OT_HASH_COMPARE_SIZE (sizeof(ot_hash)) |