Hash is faulty

This commit is contained in:
t
2025-01-10 13:40:12 +01:00
parent c6c2d3c299
commit bb9c2d1d4c
3 changed files with 87 additions and 60 deletions
+11 -10
View File
@@ -1,26 +1,27 @@
#ifndef DHT_H
#define DHT_H
#include <netinet/in.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;
extern int server_socket_udp;
typedef struct __attribute__((packed)){
uint8_t message_type;
uint16_t hash_id;
char node_request[HTTP_MAX_SIZE];
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, char *node_ip, int node_port, uint16_t hash_id, char *node_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*, char*);
void extract_lookup_request(lookup_request*);
int call_network(lookup_request*, char*, int);
int call_network(lookup_request*, in_addr_t, int);
void clone_lookup_request(lookup_request* dest, lookup_request* source);