summaryrefslogtreecommitdiff
path: root/core/DHT.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/DHT.h')
-rw-r--r--core/DHT.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/core/DHT.h b/core/DHT.h
index 010721f8..094c7e65 100644
--- a/core/DHT.h
+++ b/core/DHT.h
@@ -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.
95void addfriend(char * client_id); 95//returns 0 if success
96//returns 1 if failure (friends list is full)
97int 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)
101char delfriend(char * client_id); 103int 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
138int sock; 140int 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
142Client_data close_clientlist[LCLIENT_LIST]; 145Client_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.
146Friend friends_list[256]; 152Friend friends_list[MAX_FRIENDS];
147uint16_t num_friends; 153uint16_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