diff options
Diffstat (limited to 'core/DHT.h')
-rw-r--r-- | core/DHT.h | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -92,13 +92,15 @@ typedef struct | |||
92 | 92 | ||
93 | //Add a new friend to the friends list | 93 | //Add a new friend to the friends list |
94 | //client_id must be CLIENT_ID_SIZE bytes long. | 94 | //client_id must be CLIENT_ID_SIZE bytes long. |
95 | void addfriend(char * client_id); | 95 | //returns 0 if success |
96 | //returns 1 if failure (friends list is full) | ||
97 | int addfriend(char * client_id); | ||
96 | 98 | ||
97 | //Delete a friend from the friends list | 99 | //Delete a friend from the friends list |
98 | //client_id must be CLIENT_ID_SIZE bytes long. | 100 | //client_id must be CLIENT_ID_SIZE bytes long. |
99 | //returns 0 if success | 101 | //returns 0 if success |
100 | //returns 1 if failure (client_id not in friends list) | 102 | //returns 1 if failure (client_id not in friends list) |
101 | char delfriend(char * client_id); | 103 | int delfriend(char * client_id); |
102 | 104 | ||
103 | 105 | ||
104 | //Get ip of friend | 106 | //Get ip of friend |
@@ -137,13 +139,17 @@ char self_client_id[CLIENT_ID_SIZE]; | |||
137 | //We only use one so it's much easier to have it as a global variable | 139 | //We only use one so it's much easier to have it as a global variable |
138 | int sock; | 140 | int sock; |
139 | 141 | ||
142 | //TODO: Move these out of here and put them into the .c file. | ||
140 | //A list of the clients mathematically closest to ours. | 143 | //A list of the clients mathematically closest to ours. |
141 | #define LCLIENT_LIST 32 | 144 | #define LCLIENT_LIST 32 |
142 | Client_data close_clientlist[LCLIENT_LIST]; | 145 | Client_data close_clientlist[LCLIENT_LIST]; |
143 | 146 | ||
144 | 147 | ||
148 | //Hard maximum number of friends | ||
149 | #define MAX_FRIENDS 256 | ||
150 | |||
145 | //Let's start with a static array for testing. | 151 | //Let's start with a static array for testing. |
146 | Friend friends_list[256]; | 152 | Friend friends_list[MAX_FRIENDS]; |
147 | uint16_t num_friends; | 153 | uint16_t num_friends; |
148 | 154 | ||
149 | //The list of ip ports along with the ping_id of what we sent them and a timestamp | 155 | //The list of ip ports along with the ping_id of what we sent them and a timestamp |