29 lines
671 B
C
29 lines
671 B
C
#ifndef DHT_H
|
|
#define DHT_H
|
|
#include <netinet/in.h>
|
|
|
|
#include "http.h"
|
|
|
|
#define NODE_IP_MAX_SIZE 16
|
|
|
|
extern int server_socket_udp;
|
|
|
|
typedef struct __attribute__((packed)){
|
|
uint8_t message_type;
|
|
uint16_t hash_id;
|
|
uint16_t node_id;
|
|
struct in_addr node_ip;
|
|
uint16_t node_port;
|
|
}lookup_request;
|
|
|
|
void lookup_request_init(lookup_request*, int message_type, int node_id, in_addr_t node_ip, int node_port, uint16_t hash_id);
|
|
void build_lookup_request(lookup_request*);
|
|
|
|
void extract_lookup_request(lookup_request*);
|
|
|
|
int call_network(lookup_request*, in_addr_t, int);
|
|
|
|
void clone_lookup_request(lookup_request* dest, lookup_request* source);
|
|
|
|
#endif //DHT_H
|