summaryrefslogtreecommitdiff
path: root/toxcore/DHT.c
AgeCommit message (Collapse)Author
2018-01-14Add random_u16 function and rename the others to match.iphydf
2018-01-14Use apidsl to generate ping.h.iphydf
The ping.api.h file looks rather ugly, but it works. This is an exercise in finding the complete set of use cases needed from apidsl for toxcore. We'll try to make things work as much as possible, and then make apidsl better and make the .api.h files pretty.
2018-01-13Make Ping_Array a module-private type.iphydf
2018-01-10Fix formatting in some C files.iphydf
Also replace &(x) with &x for consistency.
2017-09-17reset hole-punching parameters after not punching for a whilezugz
2017-08-24Remove useless 'to_net_family' and 'to_host_family'Diadlo
2017-08-24Add platform independent constantsDiadlo
2017-08-24AF_INET -> TOX_AF_INETDiadlo
2017-06-05Change way to iterate through assocDiadlo
2017-06-05Make work with assoc more genericDiadlo
2017-06-05Improve formatting and syntaxDiadlo
2017-06-05Cleanup punch_holesDiadlo
2017-06-05Add using id_equalDiadlo
2017-06-05Update crypto_size and check indexDiadlo
2017-06-05Extract 'update_client_data' to reduce code duplicationDiadlo
2017-06-05Extract 'update_client_with_reset' function to reduce code duplicationDiadlo
2017-06-05Extract 'update_client' functionDiadlo
To make 'client_or_ip_port_in_list' code easy to read
2017-06-05Extract variablesDiadlo
2017-06-05Change return type to be the same as return value typeDiadlo
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-05Add using macros to improve codeDiadlo
2017-06-05Add 'index_of' functionsDiadlo
- Replace 'for' with long body - Replace friend_number function on index_of_friend_pk - Replace client_in_nodelist on index_of_node_pk
2017-06-05Extract SharedKey struct and use it as var instead of indexingDiadlo
2017-06-05Add using C99 'for' syntaxDiadlo
2017-06-04Add a monolith_test that includes all toxcore sources.iphydf
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-04-29check if already in close list in ping_node_from_getnodes_ok()zugz
fix index bounds check in add_to_close() and is_pk_in_close_list() add TODO to write test for bug which fixed by this commit
2017-03-26Add crypto_memzero for temp bufferDiadlo
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-02-21Use VLA macroMaxim Biro
2017-02-11remove statics used in onion comparison functionszugz
2017-01-28Add VLA compatibility macro for C89-ish compilers.iphydf
2017-01-26Replace redundant packet type check in handler with assert.Yuri
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-11Remove `TOX_DEBUG` and have asserts always enabled.iphydf
These are cheap asserts. I've also replaced the fprintf's with `LOGGER_ERROR` calls.
2017-01-11Fix logging condition for IPv6 client timestamp updates.iphydf
2017-01-07Replace make_quick_sort with qsortendoffile78
2017-01-06Eliminate dead return statement.iphydf
Previously, the `ipv6` variable was initialised to `-1`, but that value was never read. Either it was set to 0 or 1, or the function would return before it was read. Thus, I've changed it to uninitialised `bool is_ipv4` (inverted semantics to avoid negative conditions `if (!is_ipv6)`). The `pack_ip_port` function is a bit unfortunate, but I'm not rewriting it until we have a binary writer (I'd be rewriting it twice).
2016-12-22Improve documentation of crypto_core.iphydf
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-11-11Add DHT_create_packetendoffile78
2016-11-09Remove new_nonce function in favour of random_nonce.iphydf
`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-06Remove assocendoffile78
2016-11-03Move packing and unpacking DHT request packets to DHT module.iphydf
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-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-24Make toxcore code C++ compatible.iphydf
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-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-13Use <stdbool.h> and replace _Bool with bool.iphydf
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-13Add some astyle options to make it do more.iphydf
It now enforces a bit more formatting. In particular, padding inside parentheses is removed. I would like it to remove padding after unary operators, but there seems to be no option for that.
2016-09-13Group #include directives in 3-4 groups.iphydf
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.