summaryrefslogtreecommitdiff
path: root/core/DHT.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/DHT.h')
-rw-r--r--core/DHT.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/core/DHT.h b/core/DHT.h
index 3238191c..be8b8722 100644
--- a/core/DHT.h
+++ b/core/DHT.h
@@ -36,7 +36,7 @@
36 36
37typedef struct 37typedef struct
38{ 38{
39 char client_id[CLIENT_ID_SIZE]; 39 uint8_t client_id[CLIENT_ID_SIZE];
40 IP_Port ip_port; 40 IP_Port ip_port;
41 uint32_t timestamp; 41 uint32_t timestamp;
42 uint32_t last_pinged; 42 uint32_t last_pinged;
@@ -45,7 +45,7 @@ typedef struct
45#define MAX_FRIEND_CLIENTS 8 45#define MAX_FRIEND_CLIENTS 8
46typedef struct 46typedef struct
47{ 47{
48 char client_id[CLIENT_ID_SIZE]; 48 uint8_t client_id[CLIENT_ID_SIZE];
49 Client_data client_list[MAX_FRIEND_CLIENTS]; 49 Client_data client_list[MAX_FRIEND_CLIENTS];
50 50
51}Friend; 51}Friend;
@@ -53,7 +53,7 @@ typedef struct
53 53
54typedef struct 54typedef struct
55{ 55{
56 char client_id[CLIENT_ID_SIZE]; 56 uint8_t client_id[CLIENT_ID_SIZE];
57 IP_Port ip_port; 57 IP_Port ip_port;
58}Node_format; 58}Node_format;
59 59
@@ -70,13 +70,13 @@ typedef struct
70//client_id must be CLIENT_ID_SIZE bytes long. 70//client_id must be CLIENT_ID_SIZE bytes long.
71//returns 0 if success 71//returns 0 if success
72//returns 1 if failure (friends list is full) 72//returns 1 if failure (friends list is full)
73int addfriend(char * client_id); 73int addfriend(uint8_t * client_id);
74 74
75//Delete a friend from the friends list 75//Delete a friend from the friends list
76//client_id must be CLIENT_ID_SIZE bytes long. 76//client_id must be CLIENT_ID_SIZE bytes long.
77//returns 0 if success 77//returns 0 if success
78//returns 1 if failure (client_id not in friends list) 78//returns 1 if failure (client_id not in friends list)
79int delfriend(char * client_id); 79int delfriend(uint8_t * client_id);
80 80
81 81
82//Get ip of friend 82//Get ip of friend
@@ -86,7 +86,7 @@ int delfriend(char * client_id);
86//returns ip if success 86//returns ip if success
87//returns ip of 0 if failure (This means the friend is either offline or we have not found him yet.) 87//returns ip of 0 if failure (This means the friend is either offline or we have not found him yet.)
88//returns ip of 1 if friend is not in list. 88//returns ip of 1 if friend is not in list.
89IP_Port getfriendip(char * client_id); 89IP_Port getfriendip(uint8_t * client_id);
90 90
91 91
92//Run this function at least a couple times per second (It's the main loop) 92//Run this function at least a couple times per second (It's the main loop)
@@ -95,7 +95,7 @@ void doDHT();
95//if we recieve a DHT packet we call this function so it can be handled. 95//if we recieve a DHT packet we call this function so it can be handled.
96//Return 0 if packet is handled correctly. 96//Return 0 if packet is handled correctly.
97//return 1 if it didn't handle the packet or if the packet was shit. 97//return 1 if it didn't handle the packet or if the packet was shit.
98int DHT_handlepacket(char * packet, uint32_t length, IP_Port source); 98int DHT_handlepacket(uint8_t * packet, uint32_t length, IP_Port source);
99 99
100//Use this function to bootstrap the client 100//Use this function to bootstrap the client
101//Sends a get nodes request to the given ip port 101//Sends a get nodes request to the given ip port
@@ -109,7 +109,7 @@ void bootstrap(IP_Port ip_port);
109//Global variables 109//Global variables
110 110
111//Our client id 111//Our client id
112extern char self_client_id[CLIENT_ID_SIZE]; 112extern uint8_t self_client_id[CLIENT_ID_SIZE];
113 113
114 114
115//TODO: Move these out of here and put them into the .c file. 115//TODO: Move these out of here and put them into the .c file.