Commit Graph

103 Commits

Author SHA1 Message Date
Diadlo 69c71ddd23 Change return type to be the same as return value type
Return value of 'addto_list' function is 'used' counter, which is uint32_t.
It will be better to use the same return type.
2017-06-05 01:51:12 +03:00
Diadlo b3174bb6c4 Extract SharedKey struct and use it as var instead of indexing 2017-06-05 01:51:11 +03:00
Diadlo b19a9e5464 Add part of platform-independent network API implementation
socket      -> net_socket
htons       -> net_htons
htonl       -> net_htonl
connect     -> net_connect
sendto      -> net_sendto_ip4
getaddrinfo -> net_getipport
sa_family_t -> Family
2017-02-26 23:16:16 +03:00
iphydf 8f96ca6d86 Update license headers and remove redundant file name comment.
"All rights reserved" was incorrect. The project was licensed under GPL3,
which means a lot of rights are licensed to everybody in the world, i.e.
not reserved to the "Tox Project".
2017-01-19 00:01:44 +00:00
iphydf ce29c8e7ec Wrap all sodium/nacl functions in crypto_core.c. 2016-12-22 10:26:59 +00:00
Gregory Mullen (grayhatter) ad517eb1df add NAT hole punching level to Tox API 2016-11-24 17:38:34 -08:00
endoffile78 3f53090c1d Remove assoc 2016-11-06 09:14:53 -06:00
iphydf 64870b6fd2 Move packing and unpacking DHT request packets to DHT module.
These definitely don't belong in a module called "crypto core". The DHT
module seems like the best place to put them, since they are sent to DHT
nodes.
2016-11-03 11:56:29 +00:00
iphydf 1494e474dd Ensure that all TODOs have an owner.
In the future, all TODOs added either need a bug number (TODO(#NN)) or a
person's github user name. By default, I made irungentoo the owner of
all toxcore TODOs, mannol the owner of toxav TODOs, and myself the owner
of API TODOs.
2016-09-16 12:06:02 +01:00
iphydf 45d28904b9 Use <stdbool.h> and replace _Bool with bool.
This header is a requirement for the public API, therefore is assumed to
exist. It is a C99 standard library header, and _Bool is not intended to
be used directly, except in legacy code that defines bool (and
true/false) itself. We don't use or depend on such code. None of our
client code uses or depends on such code. There is no reason to not use
bool.
2016-09-13 22:01:45 +01:00
Gregory Mullen (grayhatter) aad1e0ad3f Make friend requests stateless
Messenger is slightly twisty when it comes to sending connection status
callbacks It will very likely need at the very least a partial refactor to
clean it up a bit. Toxcore shouldn't need void *userdata as deep as is
currently does.

(amend 1) Because of the nature of toxcore connection callbacks, I decided to
change this commit from statelessness for connections changes to statelessness
for friend requests. It's simpler this was and doesn't include doing anything
foolish in the time between commits.

group fixup because grayhatter doesn't want to do it

"arguably correct" is not how you write security sensitive code

Clear a compiler warning about types within a function.
2016-09-06 02:22:04 -07:00
iphydf 13ae9e9a93 Move logging to a callback.
This removes the global logger (which by the way was deleted when the first tox
was killed, so other toxes would then stop logging). Various bits of the code
now carry a logger or pass it around. It's a bit less transparent now, but now
there is no need to have a global logger, and clients can decide what to log and
where.
2016-08-27 01:16:14 +01:00
irungentoo 760f20c945 DHT improvements part 1. 2016-01-04 20:14:57 -05:00
irungentoo 09aa7884c8 Slightly increase ping timeout. 2015-12-16 16:24:29 -05:00
irungentoo c1e00c5d39 Improved the to_ping list. 2015-12-16 11:28:30 -05:00
irungentoo 836e180757 More efficient DHT searching. 2015-12-15 14:13:28 -05:00
irungentoo 22b1ebb46e DHT improvements.
Feed better nodes to onion, bootstrap off close clients when DHT friend is added.
2015-12-11 16:48:10 -05:00
irungentoo 6cb8ff4d65 Removed a useless define. 2015-08-07 20:53:53 -04:00
irungentoo 23fbdf4ddf client_id -> public_key 2015-07-30 21:24:38 -04:00
irungentoo dfc154cc9e client_id -> public_key 2015-07-29 22:39:56 -04:00
irungentoo c989c246ea client_id -> public_key 2015-07-28 22:17:45 -04:00
irungentoo fa5df6aa17 client_id -> public_key 2015-07-27 15:23:32 -04:00
irungentoo 63ecb77556 Comment fix. 2015-07-25 23:34:42 -04:00
irungentoo 17af629d1f Added function to help calculate size of packet nodes. 2015-07-15 23:31:35 -04:00
irungentoo 0e982405d6 Some comment fixes. 2015-06-26 22:58:59 -04:00
irungentoo 0a38ffcbba Don't bootstrap to all loaded nodes at once. 2015-06-07 20:47:40 -04:00
irungentoo f4d0b85284 Save DHT nodes in a smarter way. 2015-06-06 22:13:43 -04:00
irungentoo f463cb52a2 Code cleanups.
Rename array in Node_format from client_id to public_key.
2015-01-29 19:38:44 -05:00
irungentoo d4ea2809db Removed useless function. 2015-01-02 22:40:53 -05:00
irungentoo 8ff85f09cb Check if received ip family is valid for the onion packets. 2014-12-31 12:30:39 -05:00
irungentoo 523cc20eb0 Remove useless code. 2014-12-30 21:34:01 -05:00
irungentoo 6bbb939855 Cleaned up packet length types in toxcore.
They are now all uint16_t instead of sometimes being uint32_t.

Replaced some other uint32_t with unsigned ints.
2014-11-21 20:18:29 -05:00
irungentoo 6c71bb7e64 Moved all the connection stuff from messenger to friend_connection.
Messenger was doing way do many things.

friend_connection takes care of finding and establishing a connection
to friends.
2014-09-27 18:25:03 -04:00
irungentoo f2a313359e Added callbacks to onion_client and net_crypto for the temp dht key.
Better than the polling mess.

Moved DHT to Messenger from onion_client (still needs some cleanups).
2014-09-26 20:32:38 -04:00
irungentoo 33721da46a Added callbacks to DHT called when the ip of a peer is discovered. 2014-09-26 17:56:06 -04:00
irungentoo bb60c28b73 DHT can now be used for group chat cons and friend cons at the same time. 2014-09-26 15:42:56 -04:00
irungentoo d5d84818fe More groupchats code written. 2014-09-25 21:05:17 -04:00
irungentoo ebdfa892b3 Removed now useless atributes from structs. 2014-09-25 16:49:05 -04:00
saneki 27369ac762 Removed tox_connect, initial connections are made on first tox_do 2014-09-12 12:21:17 -05:00
saneki 98a93c7880 Fixed spacing 2014-09-09 14:48:09 -05:00
saneki f771bfbe30 Added tox_connect function, no connecting done during tox_load 2014-09-09 11:34:39 -05:00
irungentoo c959f6c019 Added function to check if we were only connected to LAN DHT peers. 2014-08-18 18:56:02 -04:00
Marc Schütz 9762089bad Const-correctness for onion_client.c 2014-06-30 21:41:03 +02:00
irungentoo 07936960df Astyle and fixes. 2014-06-10 18:35:55 -04:00
Marc Schütz 99d5940140 Const correctness in various interdependent files 2014-06-10 20:54:48 +02:00
irungentoo d87c772a7e Reduced size of get_node packets.
Sendback data is now 8 bytes.

This does not break the network as the sendback data can be any
size between 1 and 150 bytes.
2014-05-28 17:59:48 -04:00
irungentoo a05ab89dbf pack/unpack nodes can now pack and unpack TCP nodes. 2014-05-13 14:53:59 -04:00
irungentoo a26ced5fcb Merge branch 'master' into TCP 2014-05-08 18:26:01 -04:00
irungentoo deb8bfc350 Random number functions belong in crypto_core. 2014-05-01 19:42:44 -04:00
irungentoo c16928c4aa MAX_SENT_NODE is now 4.
This means that in every part of the Tox code that sends nodes
will now send a maximum of 4 nodes instead of 8.
2014-04-25 09:15:53 -04:00