Implemented DHT

This commit is contained in:
t
2025-01-10 01:59:20 +01:00
parent b06a71186a
commit 3c3e8127c9
6 changed files with 258 additions and 54 deletions
+9 -2
View File
@@ -5,6 +5,7 @@
#define NODE_IP_MAX_SIZE 16
typedef struct{
int message_type;
int node_id;
char node_ip[NODE_IP_MAX_SIZE];
int node_port;
@@ -14,7 +15,13 @@ typedef struct{
char node_request[HTTP_MAX_SIZE];
}lookup_request;
void lookup_request_init(lookup_request*, int node_id, char *node_ip, int node_port, uint16_t hash_id, char *node_request);
void create_lookup_request(lookup_request*, char *request);
void lookup_request_init(lookup_request*, int message_type, int node_id, char *node_ip, int node_port, uint16_t hash_id, char *node_request);
void build_lookup_request(lookup_request*);
void extract_lookup_request(lookup_request*, char*);
int call_network(lookup_request*, char*, int);
void clone_lookup_request(lookup_request* dest, lookup_request* source);
#endif //DHT_H