summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/DHT.c6
-rw-r--r--core/DHT.h2
-rw-r--r--core/Lossless_UDP.c16
-rw-r--r--core/Lossless_UDP.h2
-rw-r--r--core/net_crypto.c22
-rw-r--r--core/net_crypto.h12
-rw-r--r--core/network.c2
-rw-r--r--core/network.h4
-rw-r--r--docs/Crypto.txt4
-rw-r--r--docs/IDEAS.txt4
-rw-r--r--docs/Lossless_UDP.txt4
-rw-r--r--testing/DHT_cryptosendfiletest.c2
-rw-r--r--testing/DHT_sendfiletest.c2
-rw-r--r--testing/DHT_test.c2
-rw-r--r--testing/Lossless_UDP_testclient.c2
-rw-r--r--testing/Lossless_UDP_testserver.c2
16 files changed, 44 insertions, 44 deletions
diff --git a/core/DHT.c b/core/DHT.c
index 31a3fad3..5ca3604f 100644
--- a/core/DHT.c
+++ b/core/DHT.c
@@ -246,7 +246,7 @@ int get_close_nodes(uint8_t * client_id, Node_format * nodes_list)
246 246
247 247
248//replace first bad (or empty) node with this one 248//replace first bad (or empty) node with this one
249//return 0 if successfull 249//return 0 if successful
250//return 1 if not (list contains no bad nodes) 250//return 1 if not (list contains no bad nodes)
251int replace_bad(Client_data * list, uint32_t length, uint8_t * client_id, IP_Port ip_port)//tested 251int replace_bad(Client_data * list, uint32_t length, uint8_t * client_id, IP_Port ip_port)//tested
252{ 252{
@@ -291,7 +291,7 @@ void addto_lists(IP_Port ip_port, uint8_t * client_id)
291{ 291{
292 uint32_t i; 292 uint32_t i;
293 293
294 //NOTE: current behaviour if there are two clients with the same id is to only keep one (the first one) 294 //NOTE: current behavior if there are two clients with the same id is to only keep one (the first one)
295 if(!client_in_list(close_clientlist, LCLIENT_LIST, client_id, ip_port)) 295 if(!client_in_list(close_clientlist, LCLIENT_LIST, client_id, ip_port))
296 { 296 {
297 297
@@ -548,7 +548,7 @@ int sendnodes(IP_Port ip_port, uint8_t * client_id, uint32_t ping_id)
548 548
549 549
550//Packet handling functions 550//Packet handling functions
551//One to handle each types of packets we recieve 551//One to handle each types of packets we receive
552//return 0 if handled correctly, 1 if packet is bad. 552//return 0 if handled correctly, 1 if packet is bad.
553int handle_pingreq(uint8_t * packet, uint32_t length, IP_Port source)//tested 553int handle_pingreq(uint8_t * packet, uint32_t length, IP_Port source)//tested
554{ 554{
diff --git a/core/DHT.h b/core/DHT.h
index 87794e63..0290ef92 100644
--- a/core/DHT.h
+++ b/core/DHT.h
@@ -62,7 +62,7 @@ IP_Port DHT_getfriendip(uint8_t * client_id);
62//Run this function at least a couple times per second (It's the main loop) 62//Run this function at least a couple times per second (It's the main loop)
63void doDHT(); 63void doDHT();
64 64
65//if we recieve a DHT packet we call this function so it can be handled. 65//if we receive a DHT packet we call this function so it can be handled.
66//Return 0 if packet is handled correctly. 66//Return 0 if packet is handled correctly.
67//return 1 if it didn't handle the packet or if the packet was shit. 67//return 1 if it didn't handle the packet or if the packet was shit.
68int DHT_handlepacket(uint8_t * packet, uint32_t length, IP_Port source); 68int DHT_handlepacket(uint8_t * packet, uint32_t length, IP_Port source);
diff --git a/core/Lossless_UDP.c b/core/Lossless_UDP.c
index b249760a..080dc821 100644
--- a/core/Lossless_UDP.c
+++ b/core/Lossless_UDP.c
@@ -27,7 +27,7 @@
27 27
28 28
29 29
30//maximum data packets in sent and recieve queues. 30//maximum data packets in sent and receive queues.
31#define MAX_QUEUE_NUM 16 31#define MAX_QUEUE_NUM 16
32 32
33//maximum length of the data in the data packets 33//maximum length of the data in the data packets
@@ -66,14 +66,14 @@ typedef struct
66 uint16_t data_rate;//current data packet send rate packets per second. 66 uint16_t data_rate;//current data packet send rate packets per second.
67 uint64_t last_SYNC; //time at which our last SYNC packet was sent. 67 uint64_t last_SYNC; //time at which our last SYNC packet was sent.
68 uint64_t last_sent; //time at which our last data or handshake packet was sent. 68 uint64_t last_sent; //time at which our last data or handshake packet was sent.
69 uint64_t last_recv; //time at which we last recieved something from the other 69 uint64_t last_recv; //time at which we last received something from the other
70 uint64_t killat; //time at which to kill the connection 70 uint64_t killat; //time at which to kill the connection
71 Data sendbuffer[MAX_QUEUE_NUM];//packet send buffer. 71 Data sendbuffer[MAX_QUEUE_NUM];//packet send buffer.
72 Data recvbuffer[MAX_QUEUE_NUM];//packet recieve buffer. 72 Data recvbuffer[MAX_QUEUE_NUM];//packet receive buffer.
73 uint32_t handshake_id1; 73 uint32_t handshake_id1;
74 uint32_t handshake_id2; 74 uint32_t handshake_id2;
75 uint32_t recv_packetnum; //number of data packets recieved (also used as handshake_id1) 75 uint32_t recv_packetnum; //number of data packets received (also used as handshake_id1)
76 uint32_t orecv_packetnum; //number of packets recieved by the other peer 76 uint32_t orecv_packetnum; //number of packets received by the other peer
77 uint32_t sent_packetnum; //number of data packets sent 77 uint32_t sent_packetnum; //number of data packets sent
78 uint32_t osent_packetnum; //number of packets sent by the other peer. 78 uint32_t osent_packetnum; //number of packets sent by the other peer.
79 uint32_t sendbuff_packetnum; //number of latest packet written onto the sendbuffer 79 uint32_t sendbuff_packetnum; //number of latest packet written onto the sendbuffer
@@ -250,7 +250,7 @@ int kill_connection_in(int connection_id, uint32_t seconds)
250//return 1 if attempting handshake 250//return 1 if attempting handshake
251//return 2 if handshake is done 251//return 2 if handshake is done
252//return 3 if fully connected 252//return 3 if fully connected
253//return 4 if timed out and wating to be killed 253//return 4 if timed out and waiting to be killed
254int is_connected(int connection_id) 254int is_connected(int connection_id)
255{ 255{
256 if(connection_id >= 0 && connection_id < MAX_CONNECTIONS) 256 if(connection_id >= 0 && connection_id < MAX_CONNECTIONS)
@@ -450,7 +450,7 @@ int send_DATA(uint32_t connection_id)
450 450
451 451
452//Packet handling functions 452//Packet handling functions
453//One to handle each type of packets we recieve 453//One to handle each type of packets we receive
454//return 0 if handled correctly, 1 if packet is bad. 454//return 0 if handled correctly, 1 if packet is bad.
455int handle_handshake(uint8_t * packet, uint32_t length, IP_Port source) 455int handle_handshake(uint8_t * packet, uint32_t length, IP_Port source)
456{ 456{
@@ -607,7 +607,7 @@ int handle_SYNC(uint8_t * packet, uint32_t length, IP_Port source)
607 return 0; 607 return 0;
608} 608}
609 609
610//add a packet to the recieved buffer and set the recv_packetnum of the connection to its proper value. 610//add a packet to the received buffer and set the recv_packetnum of the connection to its proper value.
611//return 1 if data was too big, 0 if not. 611//return 1 if data was too big, 0 if not.
612int add_recv(int connection_id, uint32_t data_num, uint8_t * data, uint16_t size) 612int add_recv(int connection_id, uint32_t data_num, uint8_t * data, uint16_t size)
613{ 613{
diff --git a/core/Lossless_UDP.h b/core/Lossless_UDP.h
index 18224088..ad8c545c 100644
--- a/core/Lossless_UDP.h
+++ b/core/Lossless_UDP.h
@@ -69,7 +69,7 @@ IP_Port connection_ip(int connection_id);
69char id_packet(int connection_id); 69char id_packet(int connection_id);
70 70
71//return 0 if there is no received data in the buffer. 71//return 0 if there is no received data in the buffer.
72//return length of recieved packet if successful 72//return length of received packet if successful
73int read_packet(int connection_id, uint8_t * data); 73int read_packet(int connection_id, uint8_t * data);
74 74
75 75
diff --git a/core/net_crypto.c b/core/net_crypto.c
index 3a3785ff..980250d0 100644
--- a/core/net_crypto.c
+++ b/core/net_crypto.c
@@ -36,13 +36,13 @@ uint8_t self_secret_key[crypto_box_SECRETKEYBYTES];
36typedef struct 36typedef struct
37{ 37{
38 uint8_t public_key[crypto_box_PUBLICKEYBYTES];//the real public key of the peer. 38 uint8_t public_key[crypto_box_PUBLICKEYBYTES];//the real public key of the peer.
39 uint8_t recv_nonce[crypto_box_NONCEBYTES];//nonce of recieved packets 39 uint8_t recv_nonce[crypto_box_NONCEBYTES];//nonce of received packets
40 uint8_t sent_nonce[crypto_box_NONCEBYTES];//nonce of sent packets. 40 uint8_t sent_nonce[crypto_box_NONCEBYTES];//nonce of sent packets.
41 uint8_t sessionpublic_key[crypto_box_PUBLICKEYBYTES];//our public key for this session. 41 uint8_t sessionpublic_key[crypto_box_PUBLICKEYBYTES];//our public key for this session.
42 uint8_t sessionsecret_key[crypto_box_SECRETKEYBYTES];//our private key for this session. 42 uint8_t sessionsecret_key[crypto_box_SECRETKEYBYTES];//our private key for this session.
43 uint8_t peersessionpublic_key[crypto_box_PUBLICKEYBYTES];//The public key of the peer. 43 uint8_t peersessionpublic_key[crypto_box_PUBLICKEYBYTES];//The public key of the peer.
44 uint8_t status;//0 if no connection, 1 we have sent a handshake, 2 if connexion is not confirmed yet 44 uint8_t status;//0 if no connection, 1 we have sent a handshake, 2 if connexion is not confirmed yet
45 //(we have recieved a hanshake but no empty data packet), 3 if the connection is established. 45 //(we have received a handshake but no empty data packet), 3 if the connection is established.
46 //4 if the connection is timed out. 46 //4 if the connection is timed out.
47 uint16_t number; //Lossless_UDP connection number corresponding to this connection. 47 uint16_t number; //Lossless_UDP connection number corresponding to this connection.
48 48
@@ -63,7 +63,7 @@ int outbound_friendrequests[MAX_FRIEND_REQUESTS];
63int incoming_connections[MAX_INCOMING]; 63int incoming_connections[MAX_INCOMING];
64 64
65//encrypts plain of length length to encrypted of length + 16 using the 65//encrypts plain of length length to encrypted of length + 16 using the
66//public key(32 bytes) of the reciever and the secret key of the sender and a 24 byte nonce 66//public key(32 bytes) of the receiver and the secret key of the sender and a 24 byte nonce
67//return -1 if there was a problem. 67//return -1 if there was a problem.
68//return length of encrypted data if everything was fine. 68//return length of encrypted data if everything was fine.
69int encrypt_data(uint8_t * public_key, uint8_t * secret_key, uint8_t * nonce, 69int encrypt_data(uint8_t * public_key, uint8_t * secret_key, uint8_t * nonce,
@@ -93,7 +93,7 @@ int encrypt_data(uint8_t * public_key, uint8_t * secret_key, uint8_t * nonce,
93} 93}
94 94
95//decrypts encrypted of length length to plain of length length - 16 using the 95//decrypts encrypted of length length to plain of length length - 16 using the
96//public key(32 bytes) of the sender, the secret key of the reciever and a 24 byte nonce 96//public key(32 bytes) of the sender, the secret key of the receiver and a 24 byte nonce
97//return -1 if there was a problem(decryption failed) 97//return -1 if there was a problem(decryption failed)
98//return length of plain data if everything was fine. 98//return length of plain data if everything was fine.
99int decrypt_data(uint8_t * public_key, uint8_t * secret_key, uint8_t * nonce, 99int decrypt_data(uint8_t * public_key, uint8_t * secret_key, uint8_t * nonce,
@@ -151,7 +151,7 @@ void random_nonce(uint8_t * nonce)
151 151
152//return 0 if there is no received data in the buffer 152//return 0 if there is no received data in the buffer
153//return -1 if the packet was discarded. 153//return -1 if the packet was discarded.
154//return length of recieved data if successful 154//return length of received data if successful
155int read_cryptpacket(int crypt_connection_id, uint8_t * data) 155int read_cryptpacket(int crypt_connection_id, uint8_t * data)
156{ 156{
157 if(crypt_connection_id < 0 || crypt_connection_id >= MAX_CRYPTO_CONNECTIONS) 157 if(crypt_connection_id < 0 || crypt_connection_id >= MAX_CRYPTO_CONNECTIONS)
@@ -436,7 +436,7 @@ int crypto_connect(uint8_t * public_key, IP_Port ip_port)
436 436
437//handle an incoming connection 437//handle an incoming connection
438//return -1 if no crypto inbound connection 438//return -1 if no crypto inbound connection
439//return incomming connection id (Lossless_UDP one) if there is an incomming crypto connection 439//return incoming connection id (Lossless_UDP one) if there is an incoming crypto connection
440//Put the public key of the peer in public_key, the secret_nonce from the handshake into secret_nonce 440//Put the public key of the peer in public_key, the secret_nonce from the handshake into secret_nonce
441//and the session public key for the connection in session_key 441//and the session public key for the connection in session_key
442//to accept it see: accept_crypto_inbound(...) 442//to accept it see: accept_crypto_inbound(...)
@@ -524,8 +524,8 @@ int accept_crypto_inbound(int connection_id, uint8_t * public_key, uint8_t * sec
524} 524}
525 525
526//return 0 if no connection, 1 we have sent a handshake, 2 if connexion is not confirmed yet 526//return 0 if no connection, 1 we have sent a handshake, 2 if connexion is not confirmed yet
527//(we have recieved a hanshake but no empty data packet), 3 if the connection is established. 527//(we have received a handshake but no empty data packet), 3 if the connection is established.
528//4 if the connection is timed out and wating to be killed 528//4 if the connection is timed out and waiting to be killed
529int is_cryptoconnected(int crypt_connection_id) 529int is_cryptoconnected(int crypt_connection_id)
530{ 530{
531 if(crypt_connection_id >= 0 && crypt_connection_id < MAX_CRYPTO_CONNECTIONS) 531 if(crypt_connection_id >= 0 && crypt_connection_id < MAX_CRYPTO_CONNECTIONS)
@@ -580,8 +580,8 @@ void handle_incomings()
580 } 580 }
581} 581}
582 582
583//handle recieved packets for not yet established crypto connections. 583//handle received packets for not yet established crypto connections.
584void recieve_crypto() 584void receive_crypto()
585{ 585{
586 uint32_t i; 586 uint32_t i;
587 for(i = 0; i < MAX_CRYPTO_CONNECTIONS; i++) 587 for(i = 0; i < MAX_CRYPTO_CONNECTIONS; i++)
@@ -678,6 +678,6 @@ void doNetCrypto()
678 //handle new incoming connections 678 //handle new incoming connections
679 //handle friend requests 679 //handle friend requests
680 handle_incomings(); 680 handle_incomings();
681 recieve_crypto(); 681 receive_crypto();
682 killTimedout(); 682 killTimedout();
683} 683}
diff --git a/core/net_crypto.h b/core/net_crypto.h
index a9bf1351..c8837c03 100644
--- a/core/net_crypto.h
+++ b/core/net_crypto.h
@@ -36,7 +36,7 @@ extern uint8_t self_public_key[crypto_box_PUBLICKEYBYTES];
36 36
37 37
38//encrypts plain of length length to encrypted of length + 16 using the 38//encrypts plain of length length to encrypted of length + 16 using the
39//public key(32 bytes) of the reciever and the secret key of the sender and a 24 byte nonce 39//public key(32 bytes) of the receiver and the secret key of the sender and a 24 byte nonce
40//return -1 if there was a problem. 40//return -1 if there was a problem.
41//return length of encrypted data if everything was fine. 41//return length of encrypted data if everything was fine.
42int encrypt_data(uint8_t * public_key, uint8_t * secret_key, uint8_t * nonce, 42int encrypt_data(uint8_t * public_key, uint8_t * secret_key, uint8_t * nonce,
@@ -44,7 +44,7 @@ int encrypt_data(uint8_t * public_key, uint8_t * secret_key, uint8_t * nonce,
44 44
45 45
46//decrypts encrypted of length length to plain of length length - 16 using the 46//decrypts encrypted of length length to plain of length length - 16 using the
47//public key(32 bytes) of the sender, the secret key of the reciever and a 24 byte nonce 47//public key(32 bytes) of the sender, the secret key of the receiver and a 24 byte nonce
48//return -1 if there was a problem(decryption failed) 48//return -1 if there was a problem(decryption failed)
49//return length of plain data if everything was fine. 49//return length of plain data if everything was fine.
50int decrypt_data(uint8_t * public_key, uint8_t * secret_key, uint8_t * nonce, 50int decrypt_data(uint8_t * public_key, uint8_t * secret_key, uint8_t * nonce,
@@ -53,7 +53,7 @@ int decrypt_data(uint8_t * public_key, uint8_t * secret_key, uint8_t * nonce,
53 53
54//return 0 if there is no received data in the buffer 54//return 0 if there is no received data in the buffer
55//return -1 if the packet was discarded. 55//return -1 if the packet was discarded.
56//return length of recieved data if successful 56//return length of received data if successful
57int read_cryptpacket(int crypt_connection_id, uint8_t * data); 57int read_cryptpacket(int crypt_connection_id, uint8_t * data);
58 58
59 59
@@ -94,7 +94,7 @@ int crypto_kill(int crypt_connection_id);
94 94
95//handle an incoming connection 95//handle an incoming connection
96//return -1 if no crypto inbound connection 96//return -1 if no crypto inbound connection
97//return incomming connection id (Lossless_UDP one) if there is an incomming crypto connection 97//return incoming connection id (Lossless_UDP one) if there is an incoming crypto connection
98//Put the public key of the peer in public_key, the secret_nonce from the handshake into secret_nonce 98//Put the public key of the peer in public_key, the secret_nonce from the handshake into secret_nonce
99//and the session public key for the connection in session_key 99//and the session public key for the connection in session_key
100//to accept it see: accept_crypto_inbound(...) 100//to accept it see: accept_crypto_inbound(...)
@@ -108,8 +108,8 @@ int crypto_inbound(uint8_t * public_key, uint8_t * secret_nonce, uint8_t * sessi
108int accept_crypto_inbound(int connection_id, uint8_t * public_key, uint8_t * secret_nonce, uint8_t * session_key); 108int accept_crypto_inbound(int connection_id, uint8_t * public_key, uint8_t * secret_nonce, uint8_t * session_key);
109 109
110//return 0 if no connection, 1 we have sent a handshake, 2 if connexion is not confirmed yet 110//return 0 if no connection, 1 we have sent a handshake, 2 if connexion is not confirmed yet
111//(we have recieved a hanshake but no empty data packet), 3 if the connection is established. 111//(we have received a handshake but no empty data packet), 3 if the connection is established.
112//4 if the connection is timed out and wating to be killed 112//4 if the connection is timed out and waiting to be killed
113int is_cryptoconnected(int crypt_connection_id); 113int is_cryptoconnected(int crypt_connection_id);
114 114
115 115
diff --git a/core/network.c b/core/network.c
index 6b5f9970..9693df1c 100644
--- a/core/network.c
+++ b/core/network.c
@@ -74,7 +74,7 @@ int sendpacket(IP_Port ip_port, uint8_t * data, uint32_t length)
74//the packet data into data 74//the packet data into data
75//the packet length into length. 75//the packet length into length.
76//dump all empty packets. 76//dump all empty packets.
77int recievepacket(IP_Port * ip_port, uint8_t * data, uint32_t * length) 77int receivepacket(IP_Port * ip_port, uint8_t * data, uint32_t * length)
78{ 78{
79 ADDR addr; 79 ADDR addr;
80 #ifdef WIN32 80 #ifdef WIN32
diff --git a/core/network.h b/core/network.h
index 9606d237..894bedeb 100644
--- a/core/network.h
+++ b/core/network.h
@@ -97,10 +97,10 @@ uint32_t random_int();
97//Function to send packet(data) of length length to ip_port 97//Function to send packet(data) of length length to ip_port
98int sendpacket(IP_Port ip_port, uint8_t * data, uint32_t length); 98int sendpacket(IP_Port ip_port, uint8_t * data, uint32_t length);
99 99
100//Function to recieve data, ip and port of sender is put into ip_port 100//Function to receive data, ip and port of sender is put into ip_port
101//the packet data into data 101//the packet data into data
102//the packet length into length. 102//the packet length into length.
103int recievepacket(IP_Port * ip_port, uint8_t * data, uint32_t * length); 103int receivepacket(IP_Port * ip_port, uint8_t * data, uint32_t * length);
104 104
105//initialize networking 105//initialize networking
106//bind to ip and port 106//bind to ip and port
diff --git a/docs/Crypto.txt b/docs/Crypto.txt
index 11653616..d53c16a8 100644
--- a/docs/Crypto.txt
+++ b/docs/Crypto.txt
@@ -51,8 +51,8 @@ Connecting to an already added friend:
51 Data packet: 51 Data packet:
52 [char with a value of 03][Encrypted data] 52 [char with a value of 03][Encrypted data]
53 Each data packet received it is decrypted using the secret nonce sent to the other(with +1 added for the first packet +2 for the second, etc...) 53 Each data packet received it is decrypted using the secret nonce sent to the other(with +1 added for the first packet +2 for the second, etc...)
54 along with the private session key of the reciever. 54 along with the private session key of the receiver.
55 Every data packet sent is encrypted using the secret nonce we received (with +1 added for the first packet +2 for the second, etc...), 55 Every data packet sent is encrypted using the secret nonce we received (with +1 added for the first packet +2 for the second, etc...),
56 the session public key of the reciever and the session private key of the sender. 56 the session public key of the receiver and the session private key of the sender.
57 57
58 The encrypted connection is only deemed successful when the empty data packet is received and decrypted successfully. 58 The encrypted connection is only deemed successful when the empty data packet is received and decrypted successfully.
diff --git a/docs/IDEAS.txt b/docs/IDEAS.txt
index c00b242e..d1be2ce6 100644
--- a/docs/IDEAS.txt
+++ b/docs/IDEAS.txt
@@ -14,6 +14,7 @@ A couple of ideas posted in the threads.
14 14
15- ability to log in with username and password 15- ability to log in with username and password
16 possible implementation: store keys in a server and use user/pass to retrieve keys from server transparently 16 possible implementation: store keys in a server and use user/pass to retrieve keys from server transparently
17 >too centralized
17- looking up people and adding as contacts, etc by name or username 18- looking up people and adding as contacts, etc by name or username
18 possible implementation: store pubkey-hash/info correspondences in a public directory, integrate access into client 19 possible implementation: store pubkey-hash/info correspondences in a public directory, integrate access into client
19- portable contact list/profile/other account data 20- portable contact list/profile/other account data
@@ -21,7 +22,6 @@ A couple of ideas posted in the threads.
21- POSSIBLY interfacing with regular phones. probably not possible, but plebs might complain (THIS IS EXPENSIVE (hence 'probably not possible')) <3 22- POSSIBLY interfacing with regular phones. probably not possible, but plebs might complain (THIS IS EXPENSIVE (hence 'probably not possible')) <3
22 23
23IMPORTANT: release two major sanctioned UIs, one for autists, one with inbuilt support for the previous list so that plebs can't get confused with setting it up and autists don't complain about it getting in their way. de geso 24IMPORTANT: release two major sanctioned UIs, one for autists, one with inbuilt support for the previous list so that plebs can't get confused with setting it up and autists don't complain about it getting in their way. de geso
24 25 > I would suggest a "Advanced options" where the autists can rejoice with all kinds of options (and it doesn't frighten the normalfags, since it's not shown by default). Also, 2 UIs would be chaos to maintain.
25
26############## 26##############
27 27
diff --git a/docs/Lossless_UDP.txt b/docs/Lossless_UDP.txt
index bbfd2ad1..1159feb6 100644
--- a/docs/Lossless_UDP.txt
+++ b/docs/Lossless_UDP.txt
@@ -53,7 +53,7 @@ Lossless UDP:
53 If the handshake was done: 53 If the handshake was done:
54 Start sending SYNC packets. 54 Start sending SYNC packets.
55 Add +1 to the counter of the SYNC packets we send. 55 Add +1 to the counter of the SYNC packets we send.
56 Check to see if any packets were dropped when sending them to us (compare sent_packetnum with the number of packets we recieved.) 56 Check to see if any packets were dropped when sending them to us (compare sent_packetnum with the number of packets we received.)
57 If some were, The next SYNC packets we send will be request packets requesting the missing packets. 57 If some were, The next SYNC packets we send will be request packets requesting the missing packets.
58 Check if the other client received what we sent him (compare recv_packetnum with the number of packets we sent) and clear them from the buffer. 58 Check if the other client received what we sent him (compare recv_packetnum with the number of packets we sent) and clear them from the buffer.
59 If the packet is a request packet. 59 If the packet is a request packet.
@@ -81,7 +81,7 @@ Lossless UDP:
81 81
82 Keep track of the percent of packets dropped, if it is too high, lower the send rate. If it is low, increase it. 82 Keep track of the percent of packets dropped, if it is too high, lower the send rate. If it is low, increase it.
83 83
84 Have a send packets buffer that we can write to and a recieved packets buffer that we can read from. 84 Have a send packets buffer that we can write to and a received packets buffer that we can read from.
85 85
86 86
87 87
diff --git a/testing/DHT_cryptosendfiletest.c b/testing/DHT_cryptosendfiletest.c
index 09683a45..ad77a17d 100644
--- a/testing/DHT_cryptosendfiletest.c
+++ b/testing/DHT_cryptosendfiletest.c
@@ -131,7 +131,7 @@ int main(int argc, char *argv[])
131 while(1) 131 while(1)
132 { 132 {
133 133
134 while(recievepacket(&ip_port, data, &length) != -1) 134 while(receivepacket(&ip_port, data, &length) != -1)
135 { 135 {
136 if(rand() % 3 != 1)//simulate packet loss 136 if(rand() % 3 != 1)//simulate packet loss
137 { 137 {
diff --git a/testing/DHT_sendfiletest.c b/testing/DHT_sendfiletest.c
index 9a455056..52ee7400 100644
--- a/testing/DHT_sendfiletest.c
+++ b/testing/DHT_sendfiletest.c
@@ -85,7 +85,7 @@ int main(int argc, char *argv[])
85 while(1) 85 while(1)
86 { 86 {
87 87
88 while(recievepacket(&ip_port, data, &length) != -1) 88 while(receivepacket(&ip_port, data, &length) != -1)
89 { 89 {
90 if(rand() % 3 != 1)//simulate packet loss 90 if(rand() % 3 != 1)//simulate packet loss
91 { 91 {
diff --git a/testing/DHT_test.c b/testing/DHT_test.c
index 25bf869e..38ca4992 100644
--- a/testing/DHT_test.c
+++ b/testing/DHT_test.c
@@ -133,7 +133,7 @@ int main(int argc, char *argv[])
133 133
134 doDHT(); 134 doDHT();
135 135
136 while(recievepacket(&ip_port, data, &length) != -1) 136 while(receivepacket(&ip_port, data, &length) != -1)
137 { 137 {
138 if(DHT_handlepacket(data, length, ip_port)) 138 if(DHT_handlepacket(data, length, ip_port))
139 { 139 {
diff --git a/testing/Lossless_UDP_testclient.c b/testing/Lossless_UDP_testclient.c
index 79ae4a37..cc12206b 100644
--- a/testing/Lossless_UDP_testclient.c
+++ b/testing/Lossless_UDP_testclient.c
@@ -106,7 +106,7 @@ void Lossless_UDP()
106 IP_Port ip_port; 106 IP_Port ip_port;
107 char data[MAX_UDP_PACKET_SIZE]; 107 char data[MAX_UDP_PACKET_SIZE];
108 uint32_t length; 108 uint32_t length;
109 while(recievepacket(&ip_port, data, &length) != -1) 109 while(receivepacket(&ip_port, data, &length) != -1)
110 { 110 {
111 printf("packet with length: %u\n", length); 111 printf("packet with length: %u\n", length);
112 if(rand() % 3 != 1)//add packet loss 112 if(rand() % 3 != 1)//add packet loss
diff --git a/testing/Lossless_UDP_testserver.c b/testing/Lossless_UDP_testserver.c
index 8357c2ef..2e369b30 100644
--- a/testing/Lossless_UDP_testserver.c
+++ b/testing/Lossless_UDP_testserver.c
@@ -102,7 +102,7 @@ void Lossless_UDP()
102 IP_Port ip_port; 102 IP_Port ip_port;
103 char data[MAX_UDP_PACKET_SIZE]; 103 char data[MAX_UDP_PACKET_SIZE];
104 uint32_t length; 104 uint32_t length;
105 while(recievepacket(&ip_port, data, &length) != -1) 105 while(receivepacket(&ip_port, data, &length) != -1)
106 { 106 {
107 if(rand() % 3 != 1)//add packet loss 107 if(rand() % 3 != 1)//add packet loss
108 { 108 {