Commit Graph

60 Commits

Author SHA1 Message Date
iphydf 1e8fa85aad Add a monolith_test that includes all toxcore sources.
This requires that every symbol, even if static (file-scope), is unique.
The idea is that we can easily run "whole" program static analysis on
programs that include monolith.h ("whole" is in quotes, as we don't
include dependencies like libsodium in this static analysis).
2017-06-04 17:48:23 +00:00
Maxim Biro c7f63737eb Revert "Implement tox_loop"
This reverts commit 5ff099763b.
2017-04-22 15:31:25 -04:00
Ansa89 5ff099763b Implement tox_loop 2017-04-01 17:47:34 +02: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 6ae33c16cf Add VLA compatibility macro for C89-ish compilers. 2017-01-28 20:49:12 +00:00
Diadlo f00006cf1d Add platform-independent Socket and IP implementation 2017-01-26 23:11:15 +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
iphydf aed24408db Remove new_nonce function in favour of random_nonce.
`new_nonce` has been an alias for `random_nonce` for a while now. Having
two names for the same operation is confusing. `random_nonce` better
expresses the intent. The documentation for `new_nonce` talks about
guaranteeing that the nonce is different from previous ones, which is
incorrect, it's just quite likely to be different.
2016-11-09 22:30:49 +00:00
iphydf 96c672aef5 Compile as C++ for windows builds.
Compiling as C++ changes nothing semantically, but ensures that we don't
break C++ compatibility while also retaining C compatibility.

C++ compatibility is useful for tooling and additional diagnostics and
analyses.
2016-11-02 18:50:41 +00:00
iphydf 15cb426166 Make toxcore code C++ compatible.
It is still C code, so still compatible with C compilers as well. This
change lets us see more clearly where implicit conversions occur by
making them explicit.
2016-09-24 21:53:50 +01: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
iphydf 0aa2840164 Group #include directives in 3-4 groups.
1. Current module (if C file).
2. Headers from current library.
3. Headers from other library (e.g. toxcore includes in toxav).
4. System headers.
2016-09-13 00:32:02 +01:00
iphydf a9fbdaf46b Do not use else after return.
http://llvm.org/docs/CodingStandards.html#use-early-exits-and-continue-to-simplify-code
2016-09-02 11:02:56 +01:00
iphydf 633da98ae6 Add braces to all if statements. 2016-08-31 20:04:16 +01:00
iphydf a5e35180c7 Make tox_callback_friend_name stateless.
See #27 and #40 for details.
2016-08-18 00:01:53 +01:00
Roman Proskuryakov 23b0c9cded fix: replace memset with sodium_memzero for sensitive data 2016-01-27 02:17:40 +03:00
Roman Proskuryakov b3655f2c60 add: comments about hairy code 2016-01-27 02:14:59 +03:00
irungentoo e4ae993a80 Some small fixes.
Increased interval between onion key changes to 2 hours.
2015-04-20 20:40:32 -04:00
irungentoo be014f9e3c Fixed memory leak in TCP connection. 2015-04-15 19:52:13 -04:00
irungentoo efea858c91 Make it possible to port clients to the new api by just replacing
proxy_enabled with proxy_type.
2014-12-26 20:33:34 -05:00
irungentoo c2e394c5c2 Fixed bug with auto tests and cleaned up the code a bit. 2014-12-26 20:12:51 -05:00
Maxim Biro 35602e12c0 Further refactoring of proxy code 2014-12-21 21:00:46 -05:00
Maxim Biro e9bf38499e Some refactoring of proxy code 2014-12-21 19:59:00 -05:00
Maxim Biro 377da127a1 Added HTTP proxy support 2014-12-13 23:59:50 -05:00
irungentoo 411457dc8f Fixed gcc warnings. 2014-08-28 20:54:05 -04:00
irungentoo bb1bb58352 Set socket family to family of proxy when using proxy. 2014-08-15 12:06:13 -04:00
irungentoo 78dd2234e0 Added basic socks5 proxy support to TCP client. 2014-08-14 14:31:26 -04:00
Jfreegman 82c40b9c8a remove unneeded printf's/prevent stdout spam 2014-08-03 15:56:09 -04:00
irungentoo bcfb1261ac Fixed possible bug with TCP nonce not getting incremented. 2014-07-16 20:39:58 -04:00
irungentoo 1e69af8cff Merge branch 'split-video' of https://github.com/notsecure/toxcore 2014-07-16 20:38:53 -04:00
notsecure e04fff3eac applied priority queue changes to the TCP client too 2014-07-16 08:33:24 -04:00
irungentoo ae7a11cae9 Fixed TCP bug.
Packet was being copied with a wrong, smaller length.
2014-07-15 13:39:32 -04:00
irungentoo 078d60ab92 Fixed bug with TCP.
Don't increment nonce if packet was discarded instead of being sent.
2014-07-15 12:35:57 -04:00
irungentoo 21e797ac90 Fixed some small TCP issues. 2014-07-11 13:30:10 -04:00
irungentoo 1d6c393473 Made TCP a bit more solid.
TCP ping requests in TCP_client should have a higher success rate.
2014-07-10 18:15:55 -04:00
irungentoo 422ff3b77b TCP should be a bit more solid.
When a TCP ping request is recieved, try to send the response until
success instead of just dropping it if sending the response fails on
the first try.
2014-07-09 20:11:01 -04:00
irungentoo 6d4fdb3597 Merge branch 'const_correctness' of https://github.com/schuetzm/ProjectTox-Core 2014-07-02 15:41:59 -04:00
Marc Schütz 000692fca0 Const-correctness for TCP_client.c 2014-06-30 21:46:34 +02:00
Marc Schütz aba594d1f8 Const-correctness for toxcore/net_crypto.c 2014-06-30 21:26:51 +02:00
Marc Schütz 8391417f61 Const correctness for toxcore/Messenger.c and related files 2014-06-30 21:26:50 +02:00
irungentoo 376eecafd3 Fixed possible connection issue. 2014-05-18 13:58:41 -04:00
irungentoo 8cb3ddda8b Fixed TCP client connection isse. 2014-05-18 12:59:21 -04:00
irungentoo e87929e869 TCP branch now ready for start of real testing.
Friends can now exchange TCP relay addresses so that they can
connect together.

Currently all bootstrap nodes are treated as TCP relays.
2014-05-18 10:55:38 -04:00
irungentoo 9d4947ffa5 add_tcp_relay_peer() can be used to add relays that we know that
peer is connected to.

Some cleanups/fixes.
2014-05-17 21:30:52 -04:00
irungentoo 1f7d8b71f0 Fixed TCP_client connections not timing out correctly. 2014-05-16 13:42:19 -04:00
irungentoo a514167952 Exposed and tested disconnect notification TCP packets. 2014-05-15 20:57:55 -04:00
irungentoo c5559e192d Added OOB packets to the TCP client and server. 2014-05-14 17:15:43 -04:00
irungentoo 6b1578af3d TCP_client callbacks now have a per connection number that can be set. 2014-05-13 18:09:38 -04:00