diff options
Diffstat (limited to 'testing/DHT_test.c')
-rw-r--r-- | testing/DHT_test.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/testing/DHT_test.c b/testing/DHT_test.c index 9100c01a..25bf869e 100644 --- a/testing/DHT_test.c +++ b/testing/DHT_test.c | |||
@@ -1,13 +1,13 @@ | |||
1 | /* DHT test | 1 | /* DHT test |
2 | * A file with a main that runs our DHT for testing. | 2 | * A file with a main that runs our DHT for testing. |
3 | * | 3 | * |
4 | * Compile with: gcc -O2 -Wall -o test ../core/DHT.c ../core/network.c DHT_test.c | 4 | * Compile with: gcc -O2 -Wall -o test ../core/network.c DHT_test.c |
5 | * | 5 | * |
6 | * Command line arguments are the ip and port of a node and the client_id (32 bytes) of the friend you want to find the ip_port of | 6 | * Command line arguments are the ip and port of a node and the client_id (32 bytes) of the friend you want to find the ip_port of |
7 | * EX: ./test 127.0.0.1 33445 ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef | 7 | * EX: ./test 127.0.0.1 33445 ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef |
8 | */ | 8 | */ |
9 | #include "../core/network.h" | 9 | #include "../core/network.h" |
10 | #include "../core/DHT.h" | 10 | #include "../core/DHT.c" |
11 | 11 | ||
12 | #include <string.h> | 12 | #include <string.h> |
13 | 13 | ||
@@ -58,7 +58,7 @@ void print_friendlist() | |||
58 | { | 58 | { |
59 | printf("%c", friends_list[k].client_id[j]); | 59 | printf("%c", friends_list[k].client_id[j]); |
60 | } | 60 | } |
61 | p_ip = getfriendip(friends_list[k].client_id); | 61 | p_ip = DHT_getfriendip(friends_list[k].client_id); |
62 | printf("\nIP: %u.%u.%u.%u:%u",p_ip.ip.c[0],p_ip.ip.c[1],p_ip.ip.c[2],p_ip.ip.c[3],ntohs(p_ip.port)); | 62 | printf("\nIP: %u.%u.%u.%u:%u",p_ip.ip.c[0],p_ip.ip.c[1],p_ip.ip.c[2],p_ip.ip.c[3],ntohs(p_ip.port)); |
63 | 63 | ||
64 | printf("\nCLIENTS IN LIST:\n\n"); | 64 | printf("\nCLIENTS IN LIST:\n\n"); |
@@ -102,7 +102,7 @@ int main(int argc, char *argv[]) | |||
102 | printf("usage %s ip port client_id(of friend to find ip_port of)\n", argv[0]); | 102 | printf("usage %s ip port client_id(of friend to find ip_port of)\n", argv[0]); |
103 | exit(0); | 103 | exit(0); |
104 | } | 104 | } |
105 | addfriend((uint8_t *)argv[3]); | 105 | DHT_addfriend((uint8_t *)argv[3]); |
106 | 106 | ||
107 | //initialize networking | 107 | //initialize networking |
108 | //bind to ip 0.0.0.0:PORT | 108 | //bind to ip 0.0.0.0:PORT |
@@ -122,7 +122,7 @@ int main(int argc, char *argv[]) | |||
122 | //bootstrap_ip_port.ip.c[2] = 0; | 122 | //bootstrap_ip_port.ip.c[2] = 0; |
123 | //bootstrap_ip_port.ip.c[3] = 1; | 123 | //bootstrap_ip_port.ip.c[3] = 1; |
124 | bootstrap_ip_port.ip.i = inet_addr(argv[1]); | 124 | bootstrap_ip_port.ip.i = inet_addr(argv[1]); |
125 | bootstrap(bootstrap_ip_port); | 125 | DHT_bootstrap(bootstrap_ip_port); |
126 | 126 | ||
127 | IP_Port ip_port; | 127 | IP_Port ip_port; |
128 | uint8_t data[MAX_UDP_PACKET_SIZE]; | 128 | uint8_t data[MAX_UDP_PACKET_SIZE]; |