28 lines
644 B
C
28 lines
644 B
C
#ifndef DHT_H
|
|
#define DHT_H
|
|
#include "http.h"
|
|
|
|
#define NODE_IP_MAX_SIZE 16
|
|
|
|
typedef struct{
|
|
int message_type;
|
|
int node_id;
|
|
char node_ip[NODE_IP_MAX_SIZE];
|
|
int node_port;
|
|
|
|
uint16_t hash_id;
|
|
|
|
char node_request[HTTP_MAX_SIZE];
|
|
}lookup_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
|