diff options
Diffstat (limited to 'core/DHT.h')
-rw-r--r-- | core/DHT.h | 20 |
1 files changed, 16 insertions, 4 deletions
@@ -1,3 +1,6 @@ | |||
1 | #ifndef DHT_H | ||
2 | #define DHT_H | ||
3 | |||
1 | #include <stdlib.h> | 4 | #include <stdlib.h> |
2 | #include <stdio.h> | 5 | #include <stdio.h> |
3 | #include <stdint.h> | 6 | #include <stdint.h> |
@@ -48,15 +51,22 @@ typedef struct | |||
48 | uint32_t timestamp; | 51 | uint32_t timestamp; |
49 | 52 | ||
50 | }Client_data; | 53 | }Client_data; |
51 | 54 | //maximum number of clients stored per friend. | |
52 | 55 | #define MAX_FRIEND_CLIENTS 8 | |
53 | typedef struct | 56 | typedef struct |
54 | { | 57 | { |
55 | char client_id[CLIENT_ID_SIZE]; | 58 | char client_id[CLIENT_ID_SIZE]; |
56 | Client_data client_list[8]; | 59 | Client_data client_list[MAX_FRIEND_CLIENTS]; |
57 | 60 | ||
58 | }Friend; | 61 | }Friend; |
59 | 62 | ||
63 | |||
64 | typedef struct | ||
65 | { | ||
66 | char client_id[CLIENT_ID_SIZE]; | ||
67 | IP_Port ip_port; | ||
68 | }Node_format; | ||
69 | |||
60 | typedef struct | 70 | typedef struct |
61 | { | 71 | { |
62 | IP_Port ip_port; | 72 | IP_Port ip_port; |
@@ -153,4 +163,6 @@ int sendpacket(IP_Port ip_port, char * data, uint32_t length); | |||
153 | //Function to recieve data, ip and port of sender is put into ip_port | 163 | //Function to recieve data, ip and port of sender is put into ip_port |
154 | //the packet data into data | 164 | //the packet data into data |
155 | //the packet length into length. | 165 | //the packet length into length. |
156 | int recievepacket(IP_Port * ip_port, char * data, uint32_t * length); \ No newline at end of file | 166 | int recievepacket(IP_Port * ip_port, char * data, uint32_t * length); |
167 | |||
168 | #endif \ No newline at end of file | ||