2013-06-24 13:05:28 +08:00
|
|
|
#include "DHT.h"
|
|
|
|
|
|
|
|
//send a getnodes request
|
|
|
|
int getnodes()
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//send a ping request
|
|
|
|
//Currently incomplete: missing the ping_id part
|
|
|
|
int ping(IP_Port ip_port)
|
|
|
|
{
|
|
|
|
char data[37];
|
|
|
|
data[0] = 00;
|
|
|
|
memcpy(data + 5, self_client_id, 32);
|
2013-06-24 19:26:30 +08:00
|
|
|
//ADDR addr = {.family = AF_INET, .ip = ip_port.ip, .port = ip_port.port};
|
2013-06-24 13:05:28 +08:00
|
|
|
|
2013-06-24 19:26:30 +08:00
|
|
|
//return sendto(sock, data, sizeof(data) - 1, 0, (struct sockaddr *)&addr, addrlen);
|
|
|
|
//sendto(int socket_descriptor, char *buffer, int buffer_length, int flags, struct sockaddr *destination_address, int address_length);
|
2013-06-24 13:05:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void addfriend(char * client_id)
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-24 19:26:30 +08:00
|
|
|
char delfriend(char * client_id)
|
2013-06-24 13:05:28 +08:00
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
IP_Port getfriendip(char * client_id)
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void DHT_recvpacket(char * packet, uint32_t length)
|
|
|
|
{
|
2013-06-24 19:26:30 +08:00
|
|
|
|
2013-06-24 13:05:28 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void doDHT()
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void bootstrap(IP_Port ip_port)
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-24 19:26:30 +08:00
|
|
|
}
|
|
|
|
|