Commit Graph

387 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
pranomostro 03f99bde2e Test for memberlist not changing after changing own name.
This test shows that the conference members callback is not invoked when
the own name changes.
2017-06-04 13:40:44 +00:00
pranomostro 7ef27a9105 Make variable names in file saving test less cryptic. 2017-05-13 22:59:50 +02:00
Maxim Biro c25e3d2d7c Revert "initial version of tox_loop"
This reverts commit 200ee1cace.
2017-04-22 15:31:25 -04:00
Maxim Biro c7f63737eb Revert "Implement tox_loop"
This reverts commit 5ff099763b.
2017-04-22 15:31:25 -04:00
Diadlo e565523640 Add test for DHT pack_nodes and unpack_nodes 2017-04-13 20:25:19 +00:00
Ansa89 5ff099763b Implement tox_loop 2017-04-01 17:47:34 +02:00
michael bishop 200ee1cace initial version of tox_loop 2017-04-01 17:47:34 +02:00
Diadlo 50c526e1a5 Move c_sleep to helpers.h and misc_tools.h
Also fix a mistake with forgotten braces around parameter
2017-03-25 20:40:34 +03:00
Maxim Biro def92ab029 Add test for tox_strncasecmp() 2017-03-01 20:43:30 -05: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
zugz b630121f2f reduce thread-unsafe use of static variables
- rework ip_ntoa() to avoid use of static variables
- rework sort_client_list() to avoid use of static variables
- move static 'lastdump' into Messenger struct
- rework ID2String() to avoid use of static variables; rename to id_to_string()
- fetch_broadcast_info(): attempt to mitigate risks from concurrent execution
- current_time_monotonic(): attempt to mitigate risks from concurrent execution
- comment on non-thread-safety of unix_time_update
2017-01-21 22:08:52 +01: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 8f1dbaa2c5 Set up autotools build to build against vanilla NaCl.
Fixes #363.
2017-01-08 15:27:26 +00:00
endoffile78 d41bb3a8d4 Fix issues in crypto_test.c 2017-01-07 11:47:31 -06:00
endoffile78 e667ec23b9 Replace make_quick_sort with qsort 2017-01-07 11:47:30 -06:00
iphydf 3fb683115c Add logging callback to messenger_test.
So we can see what went wrong if it fails.
2017-01-06 23:25:46 +00:00
David Zero 8ef1f35ca7 Revert "Revert "Portability fixes""
This reverts commit 59e2a844f0, and
defines _DARWIN_C_SOURCE in toxcore/network.c
2017-01-06 04:20:00 -08:00
endoffile78 59e2a844f0 Revert "Portability fixes"
This reverts commit f3469070fe.
2017-01-05 15:16:56 -06:00
David Zero f3469070fe Portability fixes
- CFLAG gnu99 was changed to c99.
- CXXFLAG c++98 was changed to c++11.
- CFLAG -pedantic-errors was added so that non-ISO C now throws errors.
- _XOPEN_SOURCE feature test macro added and set to 600 to expose SUSv3
  and c99 definitions in modules that required them.
- Fixed tests (and bootstrap daemon logging) that were failing due to
  the altered build flags.
- Avoid string suffix misinterpretation; explicit narrowing conversion.
- Misc. additions to .gitignore to make sure build artifacts don't wind
  up in version control.
2017-01-04 13:44:39 -08:00
Diadlo b99e99f5d9 Add tests to secure memcmp and memzero functions. 2017-01-04 01:34:20 +03:00
iphydf ce49e88d33 avoid dereferencing Tox_Options 2016-12-23 00:26:46 +00:00
iphydf 1c20e9f76b Remove tox_options_copy. 2016-12-22 20:42:47 +00:00
iphydf db71602731 Use tox_options_set_* instead of direct member access.
Also added a `tox_options_copy` function for cloning an options object.
This can be useful when creating several Tox instances with slightly
varying options.
2016-12-22 10:53:39 +00:00
iphydf 2328cb74ab Improve documentation of crypto_core. 2016-12-22 10:26:59 +00:00
iphydf ce29c8e7ec Wrap all sodium/nacl functions in crypto_core.c. 2016-12-22 10:26:59 +00:00
iphydf de623f9eb9 Add test to check if tox_new/tox_kill leaks.
We create and destroy 20k tox instances and run a single tox_iterate on
it. This test is not comprehensive, but provides a simple check to see
whether the destruction properly cleans up memory and perhaps other
resources.
2016-12-20 20:27:51 +00:00
pranomostro 1a1529c2c5 Add test for obtaining savedata, writing it to a file, reading it again and checking if it was read correctly. 2016-12-16 04:35:25 +00:00
pchk 22fca79ad7 Fixed attempt to join detached threads 2016-12-14 10:40:54 +00:00
iphydf 4cf69996cc Add apidsl file for toxencryptsave.
This breaks the toxencryptsave API. It hides the Tox_Pass_Key struct
definition.
2016-12-13 14:24:40 +00:00
sudden6 3cfe5544b1 Fix version compatibility test.
Also added some test cases for it.
2016-12-13 02:06:25 +00:00
Robin Lindén 029c4fb83f Fix padding in SAVED_FRIEND struct and add test.
Test covers saving and loading of a Tox instance with a friend added.
2016-12-13 01:36:28 +01:00
iphydf c8d7cf5002 Fix off by one error in saving our own status message. 2016-12-10 15:22:06 +00:00
Gregory Mullen (grayhatter) ad517eb1df add NAT hole punching level to Tox API 2016-11-24 17:38:34 -08:00
Robin Lindén 6e1a01bd16 Made saveformat platform-independent.
Fixes #215.
2016-11-21 00:28:33 +00:00
endoffile78 8899b69b40 Add DHT_create_packet 2016-11-11 15:53:04 -06: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 82515f92ee Move log callback to options.
Previously, all log messages generated by tox_new (which is quite a lot)
were dropped, because client code had no chance to register a logging
callback, yet. This change allows setting the log callback from the
beginning and removes the ability to unset it.

Since the log callback is forever special, since it can't be stateless,
we don't necessarily need to treat it uniformly (with `event`).
2016-11-06 20:35:09 +00:00
endoffile78 3f53090c1d Remove assoc 2016-11-06 09:14:53 -06:00
iphydf cf94537266 Enable all possible C compiler warning flags.
We disable the ones that fire, so we can use -Werror. We can then
investigate each warning individually and see whether to fix it or to
keep silencing it.
2016-11-06 01:32:10 +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 6d0c8060c1 Remove duplicate tests: split tests part 2. 2016-10-11 21:29:58 +02:00
iphydf d9f37e4c33 Duplicate tox_test to 4 other files.
In a next step, we will remove tests from each file to have a per-binary
split of tests. This will help identify which tests fail most often on
Travis CI.

In another future step, we will split the large one_test into several
auto tests, which will make testing quite a bit slower (adding about 10
seconds setup time to each), but hopefully a lot more stable ("Tox went
offline" should not happen as much anymore).
2016-10-06 16:46:35 +01:00
iphydf 1977d56caa Remove return after no-return situation (and other cleanups).
Cleanups:
- Fix header guards to not use reserved names.
- Avoid name shadowing.
- Removed an unused variable found by avoiding name shadowing.
2016-09-30 19:06:44 +01: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 0d347c2b2e Minor cleanups: unused vars, unreachable code, static globals.
- All global variables should be static unless they have an explicit
  extern declaration in a header file.
- `to_compare` was not used in encryptsave and toxav tests.
- `break` in switch cases is not required directly after `return`,
  `goto`, or a noreturn function like `abort`.
2016-09-24 20:52:09 +01:00
iphydf 18b298a3d6 Make TCP_Connections module-private. 2016-09-22 16:42:36 +01:00
iphydf 78d77349e4 Make TCP_Server opaque.
We should aim to make as many structures module-private as possible.
2016-09-22 11:22:32 +01:00