summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rw-r--r--docs/Group-Chats.md8
-rw-r--r--docs/Prevent_Tracking.txt5
-rw-r--r--docs/TCP_Network.txt4
-rw-r--r--docs/av_api.md2
-rw-r--r--docs/updates/Crypto.md2
-rw-r--r--m4/pkg.m42
-rw-r--r--other/DHTnodes2
-rw-r--r--other/fun/cracker.c2
-rw-r--r--toxav/Makefile.inc3
-rw-r--r--toxav/media.h2
-rwxr-xr-xtoxav/msi.c24
-rwxr-xr-xtoxav/msi.h6
-rwxr-xr-xtoxav/phone.c4
-rw-r--r--toxcore/DHT.c18
-rw-r--r--toxcore/DHT.h2
-rw-r--r--toxcore/Messenger.c6
-rw-r--r--toxcore/Messenger.h4
-rw-r--r--toxcore/TCP_server.c2
-rw-r--r--toxcore/TCP_server.h2
-rw-r--r--toxcore/assoc.c2
-rw-r--r--toxcore/network.c5
-rw-r--r--toxcore/onion_client.c6
-rw-r--r--toxcore/onion_client.h4
-rw-r--r--toxcore/tox.c4
-rw-r--r--toxcore/tox.h10
26 files changed, 70 insertions, 62 deletions
diff --git a/README.md b/README.md
index f2745d67..853a747d 100644
--- a/README.md
+++ b/README.md
@@ -9,6 +9,7 @@ With the rise of governmental monitoring programs, Tox, a FOSS initiative, aims
9## The Complex Stuff: 9## The Complex Stuff:
10### UDP vs. TCP 10### UDP vs. TCP
11Tox must use UDP simply because [hole punching](http://en.wikipedia.org/wiki/UDP_hole_punching) with TCP is not as reliable. 11Tox must use UDP simply because [hole punching](http://en.wikipedia.org/wiki/UDP_hole_punching) with TCP is not as reliable.
12However, Tox does use [TCP relays](https://github.com/irungentoo/ProjectTox-Core/blob/master/docs/TCP_Network.txt) as a fallback if it encounters a firewall that prevents UDP hole punching.
12 13
13### Connecting & Communicating 14### Connecting & Communicating
14Every peer is represented as a [byte string][String] (the public key [Tox ID] of the peer). By using torrent-style DHT, peers can find the IP of other peers by using their Tox ID. Once the IP is obtained, peers can initiate a [secure](https://github.com/irungentoo/ProjectTox-Core/wiki/Crypto) connection with each other. Once the connection is made, peers can exchange messages, send files, start video chats, etc. using encrypted communications. 15Every peer is represented as a [byte string][String] (the public key [Tox ID] of the peer). By using torrent-style DHT, peers can find the IP of other peers by using their Tox ID. Once the IP is obtained, peers can initiate a [secure](https://github.com/irungentoo/ProjectTox-Core/wiki/Crypto) connection with each other. Once the connection is made, peers can exchange messages, send files, start video chats, etc. using encrypted communications.
diff --git a/docs/Group-Chats.md b/docs/Group-Chats.md
index e318613d..5e00b550 100644
--- a/docs/Group-Chats.md
+++ b/docs/Group-Chats.md
@@ -21,18 +21,18 @@ See DHT, currently uses the IPv6 Node_format.
21Get nodes (Request): 21Get nodes (Request):
22Packet contents: 22Packet contents:
23``` 23```
24[char with a value of 48][Bob's (The reciever's) Public key (client_id) (32 bytes))][Alice's (The sender's) Public key (client_id) (32 bytes)][Random nonce (24 bytes)][Encrypted with the nonce, private key of the sender and public key of the reciever:[char with a value of 48][random 8 byte (ping_id)] 24[char with a value of 48][Bob's (The receiver's) Public key (client_id) (32 bytes))][Alice's (The sender's) Public key (client_id) (32 bytes)][Random nonce (24 bytes)][Encrypted with the nonce, private key of the sender and public key of the receiver:[char with a value of 48][random 8 byte (ping_id)]
25``` 25```
26Valid replies: a send_nodes packet 26Valid replies: a send_nodes packet
27 27
28Send_nodes (response): 28Send_nodes (response):
29``` 29```
30[char with a value of 48][Bob's (The reciever's) Public key (client_id) (32 bytes))][Alice's (The sender's) Public key (client_id) (32 bytes)][Random nonce (24 bytes)][Encrypted with the nonce, private key of the sender and public key of the reciever:[char with a value of 49][random 8 byte (ping_id)][Nodes in node format, length=40 * (number of nodes (maximum of 6 nodes)) bytes]] 30[char with a value of 48][Bob's (The receiver's) Public key (client_id) (32 bytes))][Alice's (The sender's) Public key (client_id) (32 bytes)][Random nonce (24 bytes)][Encrypted with the nonce, private key of the sender and public key of the receiver:[char with a value of 49][random 8 byte (ping_id)][Nodes in node format, length=40 * (number of nodes (maximum of 6 nodes)) bytes]]
31``` 31```
32 32
33Broadcast packet: 33Broadcast packet:
34``` 34```
35[char with a value of 48][Bob's (The reciever's) Public key (client_id) (32 bytes))][Alice's (The sender's) Public key (client_id) (32 bytes)][nonce][Encrypted with the nonce, private key of the sender and public key of the reciever:[char with a value of 50][Data to send to everyone]] 35[char with a value of 48][Bob's (The receiver's) Public key (client_id) (32 bytes))][Alice's (The sender's) Public key (client_id) (32 bytes)][nonce][Encrypted with the nonce, private key of the sender and public key of the receiver:[char with a value of 50][Data to send to everyone]]
36``` 36```
37 37
38 38
@@ -68,4 +68,4 @@ Ban a peer
68[uint8_t message[messagelen]] 68[uint8_t message[messagelen]]
69 69
7065 - action (/me) 7065 - action (/me)
71[uint8_t message[messagelen]] \ No newline at end of file 71[uint8_t message[messagelen]]
diff --git a/docs/Prevent_Tracking.txt b/docs/Prevent_Tracking.txt
index c5f33e96..d170103f 100644
--- a/docs/Prevent_Tracking.txt
+++ b/docs/Prevent_Tracking.txt
@@ -110,7 +110,8 @@ encrypted with that temporary private key and the nonce and the public key from
110(if Node D contains the ret data for the node, it sends the stuff in this packet as a data to route response packet to the right node) 110(if Node D contains the ret data for the node, it sends the stuff in this packet as a data to route response packet to the right node)
111 111
112The data in the previous packet is in format: [real public key of sender] 112The data in the previous packet is in format: [real public key of sender]
113encrypted with real private key of the sender, the nonce in the data packet and the real public key of the reciever:[[uint8_t id][data (optional)]] 113encrypted with real private key of the sender, the nonce in the data packet and
114the real public key of the receiver:[[uint8_t id][data (optional)]]
114 115
115Data sent to us: 116Data sent to us:
116announce response packet: 117announce response packet:
@@ -153,5 +154,5 @@ Data packets:
153 154
154To tell our friend what our DHT public key is so that he can connect to us we send a data packet 155To tell our friend what our DHT public key is so that he can connect to us we send a data packet
155with id 156 and the data being:[uint64_t (in network byte order) no_replay, the packet will only be 156with id 156 and the data being:[uint64_t (in network byte order) no_replay, the packet will only be
156accepted if this number is bigger than the last one recieved] [our dht public key][Node_Format * ( 157accepted if this number is bigger than the last one received] [our dht public key][Node_Format * (
157maximum of 8) nodes closest to us so that the friend can find us faster] 158maximum of 8) nodes closest to us so that the friend can find us faster]
diff --git a/docs/TCP_Network.txt b/docs/TCP_Network.txt
index 775ccc88..9841329c 100644
--- a/docs/TCP_Network.txt
+++ b/docs/TCP_Network.txt
@@ -81,7 +81,7 @@ received
81client sent the server the public key and the public key we sent to the client, 81client sent the server the public key and the public key we sent to the client,
82the next with base nonce + 1...) 82the next with base nonce + 1...)
83 83
84The connection is set to an unconfirmed state until a packet is recieved and 84The connection is set to an unconfirmed state until a packet is received and
85decrypted correctly using the information in the handshake. 85decrypted correctly using the information in the handshake.
86 86
87each packet sent to/from the server has an id (the first byte of the plain text 87each packet sent to/from the server has an id (the first byte of the plain text
@@ -135,7 +135,7 @@ responses must be sent to the proper client.
135 135
136Ping responses must have the same ping_id as the request. 136Ping responses must have the same ping_id as the request.
137 137
138If the server recieves a ping packet he must respond with a ping response. 138If the server receives a ping packet he must respond with a ping response.
139 139
140The server will send a ping packet to clients every 30 seconds, they have 30 140The server will send a ping packet to clients every 30 seconds, they have 30
141seconds to respond, if they don't the connection is deleted. 141seconds to respond, if they don't the connection is deleted.
diff --git a/docs/av_api.md b/docs/av_api.md
index 17930144..2f536ade 100644
--- a/docs/av_api.md
+++ b/docs/av_api.md
@@ -34,7 +34,7 @@ msi_session_t* - pointer to a newly created msi session handler.
34###msi_session_t reference: 34###msi_session_t reference:
35 35
36How to handle msi session: 36How to handle msi session:
37Controling is done via callbacks and action handlers. 37Controlling is done via callbacks and action handlers.
38First register callbacks for every state/action received and make sure 38First register callbacks for every state/action received and make sure
39NOT TO PLACE SOMETHING LIKE LOOPS THAT TAKES A LOT OF TIME TO EXECUTE; every callback is being called 39NOT TO PLACE SOMETHING LIKE LOOPS THAT TAKES A LOT OF TIME TO EXECUTE; every callback is being called
40directly from event loop. You can find examples in phone.c. 40directly from event loop. You can find examples in phone.c.
diff --git a/docs/updates/Crypto.md b/docs/updates/Crypto.md
index a6c701d3..939c15e2 100644
--- a/docs/updates/Crypto.md
+++ b/docs/updates/Crypto.md
@@ -74,4 +74,4 @@ Crypto request packets
74 74
75The encrypted message is encrypted with crypto_box() (using Bobs public key, Alice's private key and the nonce (randomly generated 24 bytes)) and is a message from Alice in which she tells Bob who she is. 75The encrypted message is encrypted with crypto_box() (using Bobs public key, Alice's private key and the nonce (randomly generated 24 bytes)) and is a message from Alice in which she tells Bob who she is.
76 76
77Each node can route the request to the reciever if they are connected to him. This is to bypass bad NATs. 77Each node can route the request to the receiver if they are connected to him. This is to bypass bad NATs.
diff --git a/m4/pkg.m4 b/m4/pkg.m4
index f26f84c9..260e1fb9 100644
--- a/m4/pkg.m4
+++ b/m4/pkg.m4
@@ -53,7 +53,7 @@ fi[]dnl
53# to PKG_CHECK_MODULES(), but does not set variables or print errors. 53# to PKG_CHECK_MODULES(), but does not set variables or print errors.
54# 54#
55# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) 55# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
56# only at the first occurence in configure.ac, so if the first place 56# only at the first occurrence in configure.ac, so if the first place
57# it's called might be skipped (such as if it is within an "if", you 57# it's called might be skipped (such as if it is within an "if", you
58# have to call PKG_CHECK_EXISTS manually 58# have to call PKG_CHECK_EXISTS manually
59# -------------------------------------------------------------- 59# --------------------------------------------------------------
diff --git a/other/DHTnodes b/other/DHTnodes
index 35509931..0abdbbd9 100644
--- a/other/DHTnodes
+++ b/other/DHTnodes
@@ -1,3 +1,3 @@
1As maintaining 2 seperate lists of the same information seemed redundant, this list has been phased out. 1As maintaining 2 separate lists of the same information seemed redundant, this list has been phased out.
2 2
3For a current DHT node list please visit http://wiki.tox.im/nodes 3For a current DHT node list please visit http://wiki.tox.im/nodes
diff --git a/other/fun/cracker.c b/other/fun/cracker.c
index 9921df31..7b7000de 100644
--- a/other/fun/cracker.c
+++ b/other/fun/cracker.c
@@ -32,7 +32,7 @@ void print_key(uint8_t *client_id)
32int main(int argc, char *argv[]) 32int main(int argc, char *argv[])
33{ 33{
34 if (argc < 2) { 34 if (argc < 2) {
35 printf("usage: ./cracker public_key(or beggining of one in hex format)\n"); 35 printf("usage: ./cracker public_key(or beginning of one in hex format)\n");
36 return 0; 36 return 0;
37 } 37 }
38 38
diff --git a/toxav/Makefile.inc b/toxav/Makefile.inc
index c3ab0da2..60b50ff0 100644
--- a/toxav/Makefile.inc
+++ b/toxav/Makefile.inc
@@ -18,15 +18,18 @@ libtoxav_la_SOURCES = ../toxav/event.h \
18 18
19libtoxav_la_CFLAGS = -I../toxcore \ 19libtoxav_la_CFLAGS = -I../toxcore \
20 -I../toxav \ 20 -I../toxav \
21 $(LIBSODIUM_CFLAGS) \
21 $(NACL_CFLAGS) \ 22 $(NACL_CFLAGS) \
22 $(AV_CFLAGS) \ 23 $(AV_CFLAGS) \
23 $(PTHREAD_CFLAGS) 24 $(PTHREAD_CFLAGS)
24 25
25libtoxav_la_LDFLAGS = $(TOXAV_LT_LDFLAGS) \ 26libtoxav_la_LDFLAGS = $(TOXAV_LT_LDFLAGS) \
27 $(LIBSODIUM_LDFLAGS) \
26 $(NACL_LDFLAGS) \ 28 $(NACL_LDFLAGS) \
27 $(EXTRA_LT_LDFLAGS) 29 $(EXTRA_LT_LDFLAGS)
28 30
29libtoxav_la_LIBADD = libtoxcore.la \ 31libtoxav_la_LIBADD = libtoxcore.la \
32 $(LIBSODIUM_LIBS) \
30 $(NACL_LIBS) \ 33 $(NACL_LIBS) \
31 $(PTHREAD_LIBS) \ 34 $(PTHREAD_LIBS) \
32 $(AV_LIBS) 35 $(AV_LIBS)
diff --git a/toxav/media.h b/toxav/media.h
index f5c5fbe4..57817516 100644
--- a/toxav/media.h
+++ b/toxav/media.h
@@ -36,7 +36,7 @@
36#define VIDEO_CODEC_ENCODER_INTERFACE (vpx_codec_vp8_cx()) 36#define VIDEO_CODEC_ENCODER_INTERFACE (vpx_codec_vp8_cx())
37 37
38/* Audio encoding/decoding */ 38/* Audio encoding/decoding */
39#include <opus/opus.h> 39#include <opus.h>
40 40
41typedef enum _Capabilities 41typedef enum _Capabilities
42{ 42{
diff --git a/toxav/msi.c b/toxav/msi.c
index ee23d03e..9664e4af 100755
--- a/toxav/msi.c
+++ b/toxav/msi.c
@@ -206,7 +206,7 @@ static inline__ const uint8_t *stringify_response ( MSIResponse response )
206 206
207#define ON_HEADER(iterator, header, descriptor, size_const) \ 207#define ON_HEADER(iterator, header, descriptor, size_const) \
208( memcmp(iterator, descriptor, size_const) == 0){ /* Okay */ \ 208( memcmp(iterator, descriptor, size_const) == 0){ /* Okay */ \
209 iterator += size_const; /* Set iterator at begining of value part */ \ 209 iterator += size_const; /* Set iterator at beginning of value part */ \
210 if ( *iterator != value_byte ) { assert(0); return -1; }\ 210 if ( *iterator != value_byte ) { assert(0); return -1; }\
211 iterator ++;\ 211 iterator ++;\
212 uint16_t _value_size = (uint16_t) *(iterator ) << 8 | \ 212 uint16_t _value_size = (uint16_t) *(iterator ) << 8 | \
@@ -225,7 +225,7 @@ static inline__ const uint8_t *stringify_response ( MSIResponse response )
225 * @param msg Container. 225 * @param msg Container.
226 * @param data The data. 226 * @param data The data.
227 * @return int 227 * @return int
228 * @retval -1 Error occured. 228 * @retval -1 Error occurred.
229 * @retval 0 Success. 229 * @retval 0 Success.
230 */ 230 */
231int parse_raw_data ( MSIMessage *msg, const uint8_t *data, uint16_t length ) 231int parse_raw_data ( MSIMessage *msg, const uint8_t *data, uint16_t length )
@@ -338,7 +338,7 @@ void free_message ( MSIMessage *msg )
338 * @param type Request or response. 338 * @param type Request or response.
339 * @param type_id Type of request/response. 339 * @param type_id Type of request/response.
340 * @return MSIMessage* Created message. 340 * @return MSIMessage* Created message.
341 * @retval NULL Error occured. 341 * @retval NULL Error occurred.
342 */ 342 */
343MSIMessage *msi_new_message ( uint8_t type, const uint8_t *type_id ) 343MSIMessage *msi_new_message ( uint8_t type, const uint8_t *type_id )
344{ 344{
@@ -367,7 +367,7 @@ MSIMessage *msi_new_message ( uint8_t type, const uint8_t *type_id )
367 * 367 *
368 * @param data The data. 368 * @param data The data.
369 * @return MSIMessage* Parsed message. 369 * @return MSIMessage* Parsed message.
370 * @retval NULL Error occured. 370 * @retval NULL Error occurred.
371 */ 371 */
372MSIMessage *parse_message ( const uint8_t *data, uint16_t length ) 372MSIMessage *parse_message ( const uint8_t *data, uint16_t length )
373{ 373{
@@ -422,7 +422,7 @@ uint8_t *append_header_to_string (
422 422
423 *dest = field_byte; /* Set the first byte */ 423 *dest = field_byte; /* Set the first byte */
424 424
425 uint8_t *_getback_byte = dest + 1; /* remeber the byte we were on */ 425 uint8_t *_getback_byte = dest + 1; /* remember the byte we were on */
426 dest += 3; /* swith to 4th byte where field value starts */ 426 dest += 3; /* swith to 4th byte where field value starts */
427 427
428 /* Now set the field value and calculate it's length */ 428 /* Now set the field value and calculate it's length */
@@ -604,7 +604,7 @@ static inline__ const uint8_t *stringify_error_code ( MSICallError error_code )
604 * @param msg The message. 604 * @param msg The message.
605 * @param to Where to. 605 * @param to Where to.
606 * @return int 606 * @return int
607 * @retval -1 Error occured. 607 * @retval -1 Error occurred.
608 * @retval 0 Success. 608 * @retval 0 Success.
609 */ 609 */
610int send_message ( MSISession *session, MSIMessage *msg, uint32_t to ) 610int send_message ( MSISession *session, MSIMessage *msg, uint32_t to )
@@ -721,7 +721,7 @@ int handle_error ( MSISession *session, MSICallError errid, uint32_t to )
721 * @param msg The message. 721 * @param msg The message.
722 * @return int 722 * @return int
723 * @retval -1 No error. 723 * @retval -1 No error.
724 * @retval 0 Error occured and response sent. 724 * @retval 0 Error occurred and response sent.
725 */ 725 */
726int has_call_error ( MSISession *session, MSIMessage *msg ) 726int has_call_error ( MSISession *session, MSIMessage *msg )
727{ 727{
@@ -830,7 +830,7 @@ MSICall *init_call ( MSISession *session, int peers, int ringing_timeout )
830 * 830 *
831 * @param session Control session. 831 * @param session Control session.
832 * @return int 832 * @return int
833 * @retval -1 Error occured. 833 * @retval -1 Error occurred.
834 * @retval 0 Success. 834 * @retval 0 Success.
835 */ 835 */
836int terminate_call ( MSISession *session ) 836int terminate_call ( MSISession *session )
@@ -882,7 +882,7 @@ int handle_recv_invite ( MSISession *session, MSIMessage *msg )
882 * B calls A. Who has advantage is set bey calculating 882 * B calls A. Who has advantage is set bey calculating
883 * 'bigger' Call id and then that call id is being used in 883 * 'bigger' Call id and then that call id is being used in
884 * future. User with 'bigger' Call id has the advantage 884 * future. User with 'bigger' Call id has the advantage
885 * as in he will wait the reponse from the other. 885 * as in he will wait the response from the other.
886 */ 886 */
887 887
888 if ( call_id_bigger (session->call->id, msg->callid.header_value) == 1 ) { /* Peer has advantage */ 888 if ( call_id_bigger (session->call->id, msg->callid.header_value) == 1 ) { /* Peer has advantage */
@@ -1250,7 +1250,7 @@ void msi_register_callback ( MSICallback callback, MSICallbackID id, void* userd
1250 * @param messenger Tox* object. 1250 * @param messenger Tox* object.
1251 * @param user_agent User agent, i.e. 'Venom'; 'QT-gui' 1251 * @param user_agent User agent, i.e. 'Venom'; 'QT-gui'
1252 * @return MSISession* The created session. 1252 * @return MSISession* The created session.
1253 * @retval NULL Error occured. 1253 * @retval NULL Error occurred.
1254 */ 1254 */
1255MSISession *msi_init_session ( Messenger* messenger ) 1255MSISession *msi_init_session ( Messenger* messenger )
1256{ 1256{
@@ -1351,7 +1351,7 @@ int msi_invite ( MSISession *session, MSICallType call_type, uint32_t rngsec, ui
1351 * 1351 *
1352 * @param session Control session. 1352 * @param session Control session.
1353 * @return int 1353 * @return int
1354 * @retval -1 Error occured. 1354 * @retval -1 Error occurred.
1355 * @retval 0 Success. 1355 * @retval 0 Success.
1356 */ 1356 */
1357int msi_hangup ( MSISession *session ) 1357int msi_hangup ( MSISession *session )
@@ -1485,4 +1485,4 @@ int msi_stopcall ( MSISession *session )
1485 terminate_call ( session ); 1485 terminate_call ( session );
1486 1486
1487 return 0; 1487 return 0;
1488} \ No newline at end of file 1488}
diff --git a/toxav/msi.h b/toxav/msi.h
index 37fc07a3..39a9c792 100755
--- a/toxav/msi.h
+++ b/toxav/msi.h
@@ -82,7 +82,7 @@ typedef struct _MSICall { /* Call info structure */
82 int ringing_timer_id; /* Timer id for ringing timeout */ 82 int ringing_timer_id; /* Timer id for ringing timeout */
83 83
84 pthread_mutex_t mutex; /* It's to be assumed that call will have 84 pthread_mutex_t mutex; /* It's to be assumed that call will have
85 * seperate thread so add mutex 85 * separate thread so add mutex
86 */ 86 */
87 uint32_t *peers; 87 uint32_t *peers;
88 uint16_t peer_count; 88 uint16_t peer_count;
@@ -152,7 +152,7 @@ void msi_register_callback(MSICallback callback, MSICallbackID id, void* userdat
152 * 152 *
153 * @param messenger Tox* object. 153 * @param messenger Tox* object.
154 * @return MSISession* The created session. 154 * @return MSISession* The created session.
155 * @retval NULL Error occured. 155 * @retval NULL Error occurred.
156 */ 156 */
157MSISession *msi_init_session ( Messenger *messenger ); 157MSISession *msi_init_session ( Messenger *messenger );
158 158
@@ -183,7 +183,7 @@ int msi_invite ( MSISession *session, MSICallType call_type, uint32_t rngsec, ui
183 * 183 *
184 * @param session Control session. 184 * @param session Control session.
185 * @return int 185 * @return int
186 * @retval -1 Error occured. 186 * @retval -1 Error occurred.
187 * @retval 0 Success. 187 * @retval 0 Success.
188 */ 188 */
189int msi_hangup ( MSISession *session ); 189int msi_hangup ( MSISession *session );
diff --git a/toxav/phone.c b/toxav/phone.c
index 2b33f7e9..74f743f7 100755
--- a/toxav/phone.c
+++ b/toxav/phone.c
@@ -5,7 +5,7 @@
5 * This file is for testing/reference purposes only, hence 5 * This file is for testing/reference purposes only, hence
6 * it is _poorly_ designed and it does not fully reflect the 6 * it is _poorly_ designed and it does not fully reflect the
7 * quaility of msi nor rtp. Although toxmsi* and toxrtp* are tested 7 * quaility of msi nor rtp. Although toxmsi* and toxrtp* are tested
8 * there is always possiblity of crashes. If crash occures, 8 * there is always possibility of crashes. If crash occures,
9 * contact me ( mannol ) on either irc channel #tox-dev @ freenode.net:6667 9 * contact me ( mannol ) on either irc channel #tox-dev @ freenode.net:6667
10 * or eniz_vukovic@hotmail.com 10 * or eniz_vukovic@hotmail.com
11 * 11 *
@@ -612,7 +612,7 @@ void *decode_video_thread(void *arg)
612 612
613 } //else { 613 } //else {
614 614
615 /* TODO: request the sender to create a new i-frame immediatly */ 615 /* TODO: request the sender to create a new i-frame immediately */
616 //printf("Bad video packet\n"); 616 //printf("Bad video packet\n");
617 //} 617 //}
618 //} 618 //}
diff --git a/toxcore/DHT.c b/toxcore/DHT.c
index c23bad5d..7678ae7f 100644
--- a/toxcore/DHT.c
+++ b/toxcore/DHT.c
@@ -164,7 +164,7 @@ void get_shared_key(Shared_Keys *shared_keys, uint8_t *shared_key, uint8_t *secr
164} 164}
165 165
166/* Copy shared_key to encrypt/decrypt DHT packet from client_id into shared_key 166/* Copy shared_key to encrypt/decrypt DHT packet from client_id into shared_key
167 * for packets that we recieve. 167 * for packets that we receive.
168 */ 168 */
169void DHT_get_shared_key_recv(DHT *dht, uint8_t *shared_key, uint8_t *client_id) 169void DHT_get_shared_key_recv(DHT *dht, uint8_t *shared_key, uint8_t *client_id)
170{ 170{
@@ -688,7 +688,7 @@ static int replace_possible_bad( Client_data *list,
688 688
689 sort_list(list, length, comp_client_id); 689 sort_list(list, length, comp_client_id);
690 690
691 /* TODO: decide if the folowing lines should stay commented or not. 691 /* TODO: decide if the following lines should stay commented or not.
692 if (id_closest(comp_client_id, list[0].client_id, client_id) == 1) 692 if (id_closest(comp_client_id, list[0].client_id, client_id) == 1)
693 return 0;*/ 693 return 0;*/
694 694
@@ -949,20 +949,20 @@ static int getnodes(DHT *dht, IP_Port ip_port, uint8_t *public_key, uint8_t *cli
949 949
950 uint64_t temp_time = unix_time(); 950 uint64_t temp_time = unix_time();
951 memcpy(plain_message, &temp_time, sizeof(temp_time)); 951 memcpy(plain_message, &temp_time, sizeof(temp_time));
952 Node_format reciever; 952 Node_format receiver;
953 memcpy(reciever.client_id, public_key, CLIENT_ID_SIZE); 953 memcpy(receiver.client_id, public_key, CLIENT_ID_SIZE);
954 reciever.ip_port = ip_port; 954 receiver.ip_port = ip_port;
955 memcpy(plain_message + sizeof(temp_time), &reciever, sizeof(reciever)); 955 memcpy(plain_message + sizeof(temp_time), &receiver, sizeof(receiver));
956 956
957 if (sendback_node != NULL) 957 if (sendback_node != NULL)
958 memcpy(plain_message + sizeof(temp_time) + sizeof(reciever), sendback_node, sizeof(Node_format)); 958 memcpy(plain_message + sizeof(temp_time) + sizeof(receiver), sendback_node, sizeof(Node_format));
959 else 959 else
960 memset(plain_message + sizeof(temp_time) + sizeof(reciever), 0, sizeof(Node_format)); 960 memset(plain_message + sizeof(temp_time) + sizeof(receiver), 0, sizeof(Node_format));
961 961
962 int len_m = encrypt_data_symmetric(dht->secret_symmetric_key, 962 int len_m = encrypt_data_symmetric(dht->secret_symmetric_key,
963 nonce, 963 nonce,
964 plain_message, 964 plain_message,
965 sizeof(temp_time) + sizeof(reciever) + sizeof(Node_format), 965 sizeof(temp_time) + sizeof(receiver) + sizeof(Node_format),
966 encrypted_message + crypto_box_NONCEBYTES); 966 encrypted_message + crypto_box_NONCEBYTES);
967 967
968 if (len_m != NODES_ENCRYPTED_MESSAGE_LENGTH - crypto_box_NONCEBYTES) 968 if (len_m != NODES_ENCRYPTED_MESSAGE_LENGTH - crypto_box_NONCEBYTES)
diff --git a/toxcore/DHT.h b/toxcore/DHT.h
index 52aad266..d6514ee9 100644
--- a/toxcore/DHT.h
+++ b/toxcore/DHT.h
@@ -217,7 +217,7 @@ typedef struct {
217void get_shared_key(Shared_Keys *shared_keys, uint8_t *shared_key, uint8_t *secret_key, uint8_t *client_id); 217void get_shared_key(Shared_Keys *shared_keys, uint8_t *shared_key, uint8_t *secret_key, uint8_t *client_id);
218 218
219/* Copy shared_key to encrypt/decrypt DHT packet from client_id into shared_key 219/* Copy shared_key to encrypt/decrypt DHT packet from client_id into shared_key
220 * for packets that we recieve. 220 * for packets that we receive.
221 */ 221 */
222void DHT_get_shared_key_recv(DHT *dht, uint8_t *shared_key, uint8_t *client_id); 222void DHT_get_shared_key_recv(DHT *dht, uint8_t *shared_key, uint8_t *client_id);
223 223
diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c
index a84c391b..fc8bd9bb 100644
--- a/toxcore/Messenger.c
+++ b/toxcore/Messenger.c
@@ -1835,6 +1835,10 @@ void kill_messenger(Messenger *m)
1835 kill_net_crypto(m->net_crypto); 1835 kill_net_crypto(m->net_crypto);
1836 kill_DHT(m->dht); 1836 kill_DHT(m->dht);
1837 kill_networking(m->net); 1837 kill_networking(m->net);
1838 for (i = 0; i < m->numfriends; ++i) {
1839 if (m->friendlist[i].statusmessage)
1840 free(m->friendlist[i].statusmessage);
1841 }
1838 free(m->friendlist); 1842 free(m->friendlist);
1839 free(m); 1843 free(m);
1840} 1844}
@@ -2228,7 +2232,7 @@ void do_friends(Messenger *m)
2228 } 2232 }
2229 2233
2230 if (m->friendlist[i].ping_lastrecv + FRIEND_CONNECTION_TIMEOUT < temp_time) { 2234 if (m->friendlist[i].ping_lastrecv + FRIEND_CONNECTION_TIMEOUT < temp_time) {
2231 /* If we stopped recieving ping packets, kill it. */ 2235 /* If we stopped receiving ping packets, kill it. */
2232 crypto_kill(m->net_crypto, m->friendlist[i].crypt_connection_id); 2236 crypto_kill(m->net_crypto, m->friendlist[i].crypt_connection_id);
2233 m->friendlist[i].crypt_connection_id = -1; 2237 m->friendlist[i].crypt_connection_id = -1;
2234 set_friend_status(m, i, FRIEND_CONFIRMED); 2238 set_friend_status(m, i, FRIEND_CONFIRMED);
diff --git a/toxcore/Messenger.h b/toxcore/Messenger.h
index 66ef39e5..b72a0831 100644
--- a/toxcore/Messenger.h
+++ b/toxcore/Messenger.h
@@ -88,7 +88,7 @@ enum {
88/* Interval between the sending of ping packets. */ 88/* Interval between the sending of ping packets. */
89#define FRIEND_PING_INTERVAL 5 89#define FRIEND_PING_INTERVAL 5
90 90
91/* If no packets are recieved from friend in this time interval, kill the connection. */ 91/* If no packets are received from friend in this time interval, kill the connection. */
92#define FRIEND_CONNECTION_TIMEOUT (FRIEND_PING_INTERVAL * 2) 92#define FRIEND_CONNECTION_TIMEOUT (FRIEND_PING_INTERVAL * 2)
93 93
94/* USERSTATUS - 94/* USERSTATUS -
@@ -352,7 +352,7 @@ int setname(Messenger *m, uint8_t *name, uint16_t length);
352 352
353/* 353/*
354 * Get your nickname. 354 * Get your nickname.
355 * m - The messanger context to use. 355 * m - The messenger context to use.
356 * name needs to be a valid memory location with a size of at least MAX_NAME_LENGTH bytes. 356 * name needs to be a valid memory location with a size of at least MAX_NAME_LENGTH bytes.
357 * 357 *
358 * return length of the name. 358 * return length of the name.
diff --git a/toxcore/TCP_server.c b/toxcore/TCP_server.c
index fa49274a..79a420d3 100644
--- a/toxcore/TCP_server.c
+++ b/toxcore/TCP_server.c
@@ -228,7 +228,7 @@ int read_TCP_packet(sock_t sock, uint8_t *data, uint16_t length)
228 return -1; 228 return -1;
229} 229}
230 230
231/* return length of recieved packet on success. 231/* return length of received packet on success.
232 * return 0 if could not read any packet. 232 * return 0 if could not read any packet.
233 * return -1 on failure (connection must be killed). 233 * return -1 on failure (connection must be killed).
234 */ 234 */
diff --git a/toxcore/TCP_server.h b/toxcore/TCP_server.h
index 26cfa493..2a6b8276 100644
--- a/toxcore/TCP_server.h
+++ b/toxcore/TCP_server.h
@@ -138,7 +138,7 @@ uint16_t read_TCP_length(sock_t sock);
138 */ 138 */
139int read_TCP_packet(sock_t sock, uint8_t *data, uint16_t length); 139int read_TCP_packet(sock_t sock, uint8_t *data, uint16_t length);
140 140
141/* return length of recieved packet on success. 141/* return length of received packet on success.
142 * return 0 if could not read any packet. 142 * return 0 if could not read any packet.
143 * return -1 on failure (connection must be killed). 143 * return -1 on failure (connection must be killed).
144 */ 144 */
diff --git a/toxcore/assoc.c b/toxcore/assoc.c
index 2c1f0bad..50bc3a3e 100644
--- a/toxcore/assoc.c
+++ b/toxcore/assoc.c
@@ -28,7 +28,7 @@
28 * Candidates are kept in buckets of hash tables. The hash 28 * Candidates are kept in buckets of hash tables. The hash
29 * function is calculated from the client_id. Up to 29 * function is calculated from the client_id. Up to
30 * HASH_COLLIDE_COUNT alternative positions are tried if 30 * HASH_COLLIDE_COUNT alternative positions are tried if
31 * the inital position is already used by a different entry. 31 * the initial position is already used by a different entry.
32 * The collision function is multiplicative, not additive. 32 * The collision function is multiplicative, not additive.
33 * 33 *
34 * A new candidate can bump an existing candidate, if it is 34 * A new candidate can bump an existing candidate, if it is
diff --git a/toxcore/network.c b/toxcore/network.c
index 69874189..0505091d 100644
--- a/toxcore/network.c
+++ b/toxcore/network.c
@@ -314,7 +314,6 @@ int sendpacket(Networking_Core *net, IP_Port ip_port, uint8_t *data, uint32_t le
314 * ip and port of sender is put into ip_port. 314 * ip and port of sender is put into ip_port.
315 * Packet data is put into data. 315 * Packet data is put into data.
316 * Packet length is put into length. 316 * Packet length is put into length.
317 * Dump all empty packets.
318 */ 317 */
319static int receivepacket(sock_t sock, IP_Port *ip_port, uint8_t *data, uint32_t *length) 318static int receivepacket(sock_t sock, IP_Port *ip_port, uint8_t *data, uint32_t *length)
320{ 319{
@@ -328,7 +327,7 @@ static int receivepacket(sock_t sock, IP_Port *ip_port, uint8_t *data, uint32_t
328 *length = 0; 327 *length = 0;
329 int fail_or_len = recvfrom(sock, (char *) data, MAX_UDP_PACKET_SIZE, 0, (struct sockaddr *)&addr, &addrlen); 328 int fail_or_len = recvfrom(sock, (char *) data, MAX_UDP_PACKET_SIZE, 0, (struct sockaddr *)&addr, &addrlen);
330 329
331 if (fail_or_len <= 0) { 330 if (fail_or_len < 0) {
332#ifdef LOGGING 331#ifdef LOGGING
333 332
334 if ((fail_or_len < 0) && (errno != EWOULDBLOCK)) { 333 if ((fail_or_len < 0) && (errno != EWOULDBLOCK)) {
@@ -337,7 +336,7 @@ static int receivepacket(sock_t sock, IP_Port *ip_port, uint8_t *data, uint32_t
337 } 336 }
338 337
339#endif 338#endif
340 return -1; /* Nothing received or empty packet. */ 339 return -1; /* Nothing received. */
341 } 340 }
342 341
343 *length = (uint32_t)fail_or_len; 342 *length = (uint32_t)fail_or_len;
diff --git a/toxcore/onion_client.c b/toxcore/onion_client.c
index 52fdfeaf..0a238b5f 100644
--- a/toxcore/onion_client.c
+++ b/toxcore/onion_client.c
@@ -509,9 +509,9 @@ static int handle_fakeid_announce(void *object, uint8_t *source_pubkey, uint8_t
509 return 0; 509 return 0;
510} 510}
511/* Send data of length length to friendnum. 511/* Send data of length length to friendnum.
512 * This data will be recieved by the friend using the Onion_Data_Handlers callbacks. 512 * This data will be received by the friend using the Onion_Data_Handlers callbacks.
513 * 513 *
514 * Even if this function succeeds, the friend might not recieve any data. 514 * Even if this function succeeds, the friend might not receive any data.
515 * 515 *
516 * return the number of packets sent on success 516 * return the number of packets sent on success
517 * return -1 on failure. 517 * return -1 on failure.
@@ -574,7 +574,7 @@ int send_onion_data(Onion_Client *onion_c, int friend_num, uint8_t *data, uint32
574 574
575/* Try to send the fakeid via the DHT instead of onion 575/* Try to send the fakeid via the DHT instead of onion
576 * 576 *
577 * Even if this function succeeds, the friend might not recieve any data. 577 * Even if this function succeeds, the friend might not receive any data.
578 * 578 *
579 * return the number of packets sent on success 579 * return the number of packets sent on success
580 * return -1 on failure. 580 * return -1 on failure.
diff --git a/toxcore/onion_client.h b/toxcore/onion_client.h
index 4affcc6a..32d2989f 100644
--- a/toxcore/onion_client.h
+++ b/toxcore/onion_client.h
@@ -184,9 +184,9 @@ int onion_getfriend_DHT_pubkey(Onion_Client *onion_c, int friend_num, uint8_t *d
184 184
185/* Send data of length length to friendnum. 185/* Send data of length length to friendnum.
186 * Maximum length of data is ONION_CLIENT_MAX_DATA_SIZE. 186 * Maximum length of data is ONION_CLIENT_MAX_DATA_SIZE.
187 * This data will be recieved by the friend using the Onion_Data_Handlers callbacks. 187 * This data will be received by the friend using the Onion_Data_Handlers callbacks.
188 * 188 *
189 * Even if this function succeeds, the friend might not recieve any data. 189 * Even if this function succeeds, the friend might not receive any data.
190 * 190 *
191 * return the number of packets sent on success 191 * return the number of packets sent on success
192 * return -1 on failure. 192 * return -1 on failure.
diff --git a/toxcore/tox.c b/toxcore/tox.c
index 037cb7f5..d49e2241 100644
--- a/toxcore/tox.c
+++ b/toxcore/tox.c
@@ -186,7 +186,7 @@ int tox_set_name(Tox *tox, uint8_t *name, uint16_t length)
186} 186}
187 187
188/* Get your nickname. 188/* Get your nickname.
189 * m - The messanger context to use. 189 * m - The messenger context to use.
190 * name - Pointer to a string for the name. (must be at least MAX_NAME_LENGTH) 190 * name - Pointer to a string for the name. (must be at least MAX_NAME_LENGTH)
191 * 191 *
192 * return length of the name. 192 * return length of the name.
@@ -828,4 +828,4 @@ int tox_load(Tox *tox, uint8_t *data, uint32_t length)
828{ 828{
829 Messenger *m = tox; 829 Messenger *m = tox;
830 return messenger_load(m, data, length); 830 return messenger_load(m, data, length);
831} \ No newline at end of file 831}
diff --git a/toxcore/tox.h b/toxcore/tox.h
index 8edf0499..111b2634 100644
--- a/toxcore/tox.h
+++ b/toxcore/tox.h
@@ -210,7 +210,7 @@ int tox_set_name(Tox *tox, uint8_t *name, uint16_t length);
210 210
211/* 211/*
212 * Get your nickname. 212 * Get your nickname.
213 * m - The messanger context to use. 213 * m - The messenger context to use.
214 * name - needs to be a valid memory location with a size of at least MAX_NAME_LENGTH (128) bytes. 214 * name - needs to be a valid memory location with a size of at least MAX_NAME_LENGTH (128) bytes.
215 * 215 *
216 * return length of name. 216 * return length of name.
@@ -515,11 +515,11 @@ uint32_t tox_get_chatlist(Tox *tox, int *out_list, uint32_t list_size);
515 * tox_file_data_remaining(...) can be used to know how many bytes are left to send/receive. 515 * tox_file_data_remaining(...) can be used to know how many bytes are left to send/receive.
516 * 516 *
517 * If the connection breaks during file sending (The other person goes offline without pausing the sending and then comes back) 517 * If the connection breaks during file sending (The other person goes offline without pausing the sending and then comes back)
518 * the reciever must send a control packet with receive_send == 0 message_id = TOX_FILECONTROL_RESUME_BROKEN and the data being 518 * the receiver must send a control packet with receive_send == 0 message_id = TOX_FILECONTROL_RESUME_BROKEN and the data being
519 * a uint64_t (in host byte order) containing the number of bytes recieved. 519 * a uint64_t (in host byte order) containing the number of bytes received.
520 * 520 *
521 * If the sender recieves this packet, he must send a control packet with receive_send == 1 and control_type == TOX_FILECONTROL_ACCEPT 521 * If the sender receives this packet, he must send a control packet with receive_send == 1 and control_type == TOX_FILECONTROL_ACCEPT
522 * then he must start sending file data from the position (data , uint64_t in host byte order) recieved in the TOX_FILECONTROL_RESUME_BROKEN packet. 522 * then he must start sending file data from the position (data , uint64_t in host byte order) received in the TOX_FILECONTROL_RESUME_BROKEN packet.
523 * 523 *
524 * More to come... 524 * More to come...
525 */ 525 */