summaryrefslogtreecommitdiff
path: root/testing/DHT_test.c
AgeCommit message (Collapse)Author
2018-01-30Use nullptr as NULL pointer constant instead of NULL or 0.iphydf
This changes only code, no string literals or comments.
2018-01-16Make DHT a module-private type.iphydf
2017-03-25Move c_sleep to helpers.h and misc_tools.hDiadlo
Also fix a mistake with forgotten braces around parameter
2017-02-26Add part of platform-independent network API implementationDiadlo
socket -> net_socket htons -> net_htons htonl -> net_htonl connect -> net_connect sendto -> net_sendto_ip4 getaddrinfo -> net_getipport sa_family_t -> Family
2017-01-21reduce thread-unsafe use of static variableszugz
- 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-19Update license headers and remove redundant file name comment.iphydf
"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-06Revert "Revert "Portability fixes""David Zero
This reverts commit 59e2a844f04a8725e8079f854158aa86ef5988b2, and defines _DARWIN_C_SOURCE in toxcore/network.c
2017-01-05Revert "Portability fixes"endoffile78
This reverts commit f3469070fe899e8e4fd88665386a55bad9f77cd8.
2017-01-04Portability fixesDavid Zero
- 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.
2016-12-22Wrap all sodium/nacl functions in crypto_core.c.iphydf
2016-11-24add NAT hole punching level to Tox APIGregory Mullen (grayhatter)
2016-09-30Remove return after no-return situation (and other cleanups).iphydf
Cleanups: - Fix header guards to not use reserved names. - Avoid name shadowing. - Removed an unused variable found by avoiding name shadowing.
2016-09-24Minor cleanups: unused vars, unreachable code, static globals.iphydf
- 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-16Ensure that all TODOs have an owner.iphydf
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-06Improve static and const correctness.iphydf
- Any non-externally-visible declarations should be `static`. - Casting away the `const` qualifier from pointers-to-const is dangerous. All but one instance of this are now correct. The one instance where we can't keep `const` is one where toxav code actually writes to a chunk of memory marked as `const`. This code also assumes 4 byte alignment of data packets. I don't know whether that is a valid assumption, but it's likely unportable, and *not* obviously correct. - Replaced empty parameter lists with `(void)` to avoid passing parameters to it. Empty parameter lists are old style declarations for unknown number and type of arguments. - Commented out (as `#if DHT_HARDENING` block) the hardening code that was never executed. - Minor style fix: don't use `default` in enum-switches unless the number of enumerators in the default case is very large. In this case, it was 2, so we want to list them both explicitly to be warned about missing one if we add one in the future. - Removed the only two function declarations from nTox.h and put them into nTox.c. They are not used outside and nTox is not a library.
2016-09-02Do not use `else` after `return`.iphydf
http://llvm.org/docs/CodingStandards.html#use-early-exits-and-continue-to-simplify-code
2016-09-01Sort #includes in all source files.iphydf
2016-08-31Add braces to all if statements.iphydf
2016-08-27Move logging to a callback.iphydf
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-18Make tox_callback_friend_name stateless.iphydf
See #27 and #40 for details.
2016-01-27 fix: compare sensitive data with sodium_memcmpRoman Proskuryakov
fix: make increment_nonce & increment_nonce_number independent of user-controlled input fix: make crypto_core more stable agains null ptr dereference
2015-08-07Removed a useless define.irungentoo
2015-07-29client_id -> public_keyirungentoo
2014-09-26Added callbacks to DHT called when the ip of a peer is discovered.irungentoo
2014-04-23Updated some files so that they could build with latest core.irungentoo
Fixed some issues.
2014-02-25Added bound checking for friend ID input in DHT testseshagiriprabhu
2014-02-09Astyled and removed some useless files.irungentoo
2014-02-09Fixed memory leaks and removed repeated codeMaxim Biro
2014-01-20Updated DHT server list with onion supporting DHT servers.irungentoo
Onionised DHT_test.
2014-01-19proper windows preprocessor detectionBen Iofel
2013-12-16Astyled the code.irungentoo
2013-11-10Fixed small issues.irungentoo
DHT_test now only prints non zero entries.
2013-11-10Added more printing to DHT_test, fixed typo.irungentoo
2013-10-20Main: Eliminate TOX_ENABLE_IPV6 (then always on), CLIENT_ONETOONE_IP (then ↵Coren[m]
always off). Additionally (besides cleanups): network.h/tox.h: - WIN32: fix a strange sa_family_t definition - WIN32: define EWOULDBLOCK to WSAEWOULDBLOCK - WIN32: kill macro for an existing function (IN6_ADDR_EQUAL) network.c: - use EWOULDBLOCK instead of EAGAIN (same value, but EWOULDBLOCK is more "popular") - new_networking(): only try to enable IPv4-in-IPv6 if it's not already enabled per default - inet_ntop()/inet_pton(): WIN32: remove partial initializers in favor of a simple memset() - ip_equal(): WIN32: use an existing function - logging: networking_wait_execute(): only dump result if not timeout - logging: loglogdata(): kill an unused variable LAN_discovery.c: - send_broadcasts(): re-enabled, can only support IPv4 by principle, split into fetch_broadcast_info() (to fetch the addresses once) and send_broadcasts() (actual sending) DHT.c: - DHT_load_state_callback(): enclosed a fprintf(stderr, ...) into #ifdef DEBUG Lossless_UDP.c: - change_handshake(): harden against strange sa_family_t definitions Messenger.c: - logging: fix ID to string conversion util.c: - logging: eliminate a signed-warning
2013-09-27expanded Client_data to hold two addresses (IPv4, IPv6) instead of oneCoren[m]
Compilerflag: CLIENT_ONETOONE_IP (to define in DHT.h, default unset i.e. NEW case: two addresses) Every function in DHT{_test}.c working on Client_data has been rewritten to store IPv4 addresses in assoc4, IPv6 addresses in assoc6. Loading/Storing of states defined with other compiler switch is transparently adjusting to the differences. DHT.h, DHT.c: - introduction and handling of the structure changes DHT_test.c, Messenger.c: - logging adapted to new structures util.h: - LOGGING isn't undefined per default anymore
2013-09-16Fix warnings of -Wall -WextraCoren[m]
2013-09-14astyled everything.irungentoo
2013-09-11tox.h, DHT.h:Coren[m]
- tox_bootstrap_ex(), DHT_bootstrap_ex() renamed to tox_bootstrap_from_address(), DHT_bootstrap_from_address() - (handle_)sendnodes_ex() renamed to (handle_)sendnodes_ipv6() - only sending sendnodes_ipv6() if we're actually IPv6 enabled - changed comments to conform better nTox.c, Messenger_text.c, DHT_test.c, DHT_bootstrap.c: - fallout from *_ex() to *_from_address() DHT_bootstrap.c: - corrected a potentially wrong info message util.c: - fixed logfile name: now (funcptr) => now() (number) network.c: - addead comment about the necessity of bind() to succeed auto_test/messenger_test.c: - defaulting ipv6enabled to TOX_ENABLE_IPV6_DEFAULT LAN_discovery.c: - slight cleanup and comments for clarity
2013-09-11toxcore/util.h:Coren[m]
- moved cmdline_parsefor_ipv46() to testing/misc_tools.c
2013-09-11cmdline parsing:Coren[m]
- add missing includes (autobuild warnings)
2013-09-11cmdline parsing of --ipv4/6 plucked into utilCoren[m]
2013-09-10tox.*, DHT.*:Coren[m]
- return to the caller if the string could be resolved into an IP other/DHT_bootstrap.c, testing/*_test.c, testing/nTox.c: - parse cmdline for --ipv4/--ipv6 switch to allow user a choice util.h: - proper old-style C-comment
2013-09-10big push, putting all the infrastructure in place behind TOX_ENABLE_IPV6Coren[m]
2013-09-09network.h:Coren[m]
- IP: add in_addr_t as part of the union - IP: rename IP to IP4
2013-09-06Allow to build vs nacl instead of libsodiumJin^eLD
By default libsodium is used. Only if --enable-nacl is specified, then nacl will be used instead of libsodium. Pass locations of nacl headers and libraries by using the following options: --with-nacl-headers=/home/me/somewhere/nacl-20110221/build/469/include/amd64/ --with-nacl-libs=/home/me/somewhere/nacl-20110221/build/469/lib/amd64/
2013-08-30Fixed warnings and moved hex_string_to_bin to testing/irungentoo
2013-08-30Merge branch 'udp_connections' of https://github.com/vx-k/ProjectTox-Core ↵irungentoo
into vx-k-udp_connections
2013-08-30Fixed build errors.Kostya
2013-08-29Moved misc_tools from testing to toxcore.Anony Moose
2013-08-28Use defines instead of numbers in DHT_testirungentoo