From a632d960f8d8095566530d1d0dc1393f02e1e07f Mon Sep 17 00:00:00 2001 From: irungentoo Date: Sun, 7 Jul 2013 11:54:25 -0400 Subject: Fixed to be confilcts with the DHT and the messenger part. --- testing/DHT_cryptosendfiletest.c | 10 +++++----- testing/DHT_sendfiletest.c | 12 ++++++------ testing/DHT_test.c | 10 +++++----- 3 files changed, 16 insertions(+), 16 deletions(-) (limited to 'testing') diff --git a/testing/DHT_cryptosendfiletest.c b/testing/DHT_cryptosendfiletest.c index 84d777cc..09683a45 100644 --- a/testing/DHT_cryptosendfiletest.c +++ b/testing/DHT_cryptosendfiletest.c @@ -90,7 +90,7 @@ int main(int argc, char *argv[]) //memcpy(self_client_id, "qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq", 32); - addfriend(friend_id); + DHT_addfriend(friend_id); IP_Port friend_ip; int connection = -1; int inconnection = -1; @@ -112,7 +112,7 @@ int main(int argc, char *argv[]) IP_Port bootstrap_ip_port; bootstrap_ip_port.port = htons(atoi(argv[2])); bootstrap_ip_port.ip.i = inet_addr(argv[1]); - bootstrap(bootstrap_ip_port); + DHT_bootstrap(bootstrap_ip_port); IP_Port ip_port; uint8_t data[MAX_UDP_PACKET_SIZE]; @@ -146,21 +146,21 @@ int main(int argc, char *argv[]) } } } - friend_ip = getfriendip((uint8_t *)friend_id); + friend_ip = DHT_getfriendip(friend_id); if(friend_ip.ip.i != 0) { if(connection == -1 && friendrequest == -1) { printf("Sending friend request to peer:"); printip(friend_ip); - friendrequest = send_friendrequest(friend_id, friend_ip, "Hello World", 12); + friendrequest = send_friendrequest(friend_id, friend_ip,(uint8_t *) "Hello World", 12); //connection = crypto_connect((uint8_t *)friend_id, friend_ip); //connection = new_connection(friend_ip); } if(check_friendrequest(friendrequest) == 1) { printf("Started connecting to friend:"); - connection = crypto_connect((uint8_t *)friend_id, friend_ip); + connection = crypto_connect(friend_id, friend_ip); } } if(inconnection == -1) diff --git a/testing/DHT_sendfiletest.c b/testing/DHT_sendfiletest.c index fd4fd29f..9a455056 100644 --- a/testing/DHT_sendfiletest.c +++ b/testing/DHT_sendfiletest.c @@ -48,7 +48,7 @@ int main(int argc, char *argv[]) printf("usage %s ip port client_id(of friend to find ip_port of) filename(of file to send) client_id(ours)\n", argv[0]); exit(0); } - addfriend(argv[3]); + DHT_addfriend((uint8_t *)argv[3]); IP_Port friend_ip; int connection = -1; int inconnection = -1; @@ -66,15 +66,15 @@ int main(int argc, char *argv[]) IP_Port bootstrap_ip_port; bootstrap_ip_port.port = htons(atoi(argv[2])); bootstrap_ip_port.ip.i = inet_addr(argv[1]); - bootstrap(bootstrap_ip_port); + DHT_bootstrap(bootstrap_ip_port); IP_Port ip_port; - char data[MAX_UDP_PACKET_SIZE]; + uint8_t data[MAX_UDP_PACKET_SIZE]; uint32_t length; - char buffer1[128]; + uint8_t buffer1[128]; int read1 = 0; - char buffer2[128]; + uint8_t buffer2[128]; int read2 = 0; FILE *file1 = fopen(argv[4], "rb"); if ( file1==NULL ){printf("Error opening file.\n");return 1;} @@ -100,7 +100,7 @@ int main(int argc, char *argv[]) } } } - friend_ip = getfriendip(argv[3]); + friend_ip = DHT_getfriendip((uint8_t *)argv[3]); if(friend_ip.ip.i != 0) { if(connection == -1) 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 @@ /* DHT test * A file with a main that runs our DHT for testing. * - * Compile with: gcc -O2 -Wall -o test ../core/DHT.c ../core/network.c DHT_test.c + * Compile with: gcc -O2 -Wall -o test ../core/network.c DHT_test.c * * 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 * EX: ./test 127.0.0.1 33445 ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef */ #include "../core/network.h" -#include "../core/DHT.h" +#include "../core/DHT.c" #include @@ -58,7 +58,7 @@ void print_friendlist() { printf("%c", friends_list[k].client_id[j]); } - p_ip = getfriendip(friends_list[k].client_id); + p_ip = DHT_getfriendip(friends_list[k].client_id); 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)); printf("\nCLIENTS IN LIST:\n\n"); @@ -102,7 +102,7 @@ int main(int argc, char *argv[]) printf("usage %s ip port client_id(of friend to find ip_port of)\n", argv[0]); exit(0); } - addfriend((uint8_t *)argv[3]); + DHT_addfriend((uint8_t *)argv[3]); //initialize networking //bind to ip 0.0.0.0:PORT @@ -122,7 +122,7 @@ int main(int argc, char *argv[]) //bootstrap_ip_port.ip.c[2] = 0; //bootstrap_ip_port.ip.c[3] = 1; bootstrap_ip_port.ip.i = inet_addr(argv[1]); - bootstrap(bootstrap_ip_port); + DHT_bootstrap(bootstrap_ip_port); IP_Port ip_port; uint8_t data[MAX_UDP_PACKET_SIZE]; -- cgit v1.2.3