summaryrefslogtreecommitdiff
path: root/other/DHT_bootstrap.c
AgeCommit message (Collapse)Author
2018-10-16Use `bool` for IPv6 flag in test programs and `DHT_bootstrap`.iphydf
2018-08-30Use our own logging facility to log toxcore's logsMaxim Biro
2018-08-30Feature bootstrap trace/debug log outputcotox
Don't know why codes with macro dosen't work. As it's only a few expensive, just code it without macro for now. \#if (MIN_LOGGER_LEVEL == LOG_TRACE) || (MIN_LOGGER_LEVEL == LOG_DEBUG) fprintf(stderr, "[%s] %s:%d(%s) %s\n", strlevel, file, line, func, message); \#endif
2018-08-26Update copyright to 2018.iphydf
2018-08-16Use per-instance `Mono_Time` for Messenger and onion.iphydf
2018-08-16Reduce the number of times `unix_time_update` is called.iphydf
Reduced by, e.g.: * `file_transfer_test`: 33% of the `clock_gettime` calls. * `tox_many_test`: 53% of the `clock_gettime` calls. Other tests will see similar improvements. Real world applications will be closer to 40-50% improvement, since tox_many_test has 100 nodes, while file_transfer_test has 2 nodes.
2018-07-21Avoid implementations in .h files or #including .c files.iphydf
Also, avoid the need for putting `_XOPEN_SOURCE` in every test file.
2018-07-09Factor out time keeping code into its own module: mono_time.c.iphydf
It turns out, `unix_time` is also monotonic, and is used as such, so I've renamed the new functions to `mono_time_*`. 2018-07-08: ``` 00:01 <@irungentoo> the idea used to be that the unix_time() function could go backward in time but I think I might have started using it like if it could not after I changed it so that it would never go back in time ```
2018-07-05Make tox.c unambiguously parseable.iphydf
Rules: 1. Constants are uppercase names: THE_CONSTANT. 2. SUE[1] types start with an uppercase letter and have at least one lowercase letter in it: The_Type, THE_Type. 3. Function types end in "_cb": tox_friend_connection_cb. 4. Variable and function names are all lowercase: the_function. This makes it easier for humans reading the code to determine what an identifier means. I'm not convinced by the enum type name change, but I don't know a better rule. Currently, a lot of enum types are spelled like constants, which is confusing. [1] struct/union/enum
2018-05-22Fix bootstrap loggercotox
TODO: need a meanful log output
2018-05-20Add empty logger to DHT bootstrap daemons.iphydf
These should register a proper logging callback so the messages don't go devnull, but this at least ensures a logger is available.
2018-05-10fix DHT_bootstrap key loadingAnthony Bilinski
Introduced by 643eea60bb9dcf4ecb33d64666b1bc77cbfd7438
2018-03-16Remove the use of the 'hh' format specifier.iphydf
It's not supported in mingw. See https://github.com/TokTok/c-toxcore/issues/786.
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
2018-01-16Use apidsl to generate LAN_discovery.h.iphydf
2018-01-14Fix some memory or file descriptor leaks in test code.iphydf
Also some missing return value checks for `fopen`.
2018-01-11Move Networking_Core struct into the .c file.iphydf
To make it an abstract type everywhere except in network.c.
2017-03-25Move c_sleep to helpers.h and misc_tools.hDiadlo
Also fix a mistake with forgotten braces around parameter
2017-03-01Remove dependency on strings.hMaxim Biro
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-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-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-06Improve C standard compliance.iphydf
- Don't cast between object and function pointers. - Use standard compliant `__VA_ARGS__` in macros. - Add explicit `__extension__` on unnamed union in struct (it's a GNU extension). - Remove ; after function definitions. - Replace `const T foo = 3;` for integral types `T` with `enum { foo = 3 };`. Folding integral constants like that as compile time constants is a GNU extension. Arrays allocated with `foo` as dimension are VLAs on strictly compliant C99 compilers. - Replace empty initialiser list `{}` with zero-initialiser-list `{0}`. The former is a GNU extension meaning the latter. - Cast `T*` (where `T != void`) to `void *` in format arguments. While any object pointer can be implicitly converted to and from `void *`, this conversion does not happen in variadic function calls. - Replace arithmetic on `void *` with arithmetic on `char *`. The former is non-compliant. - Replace non-`int`-derived types (like `uint16_t`, which is `short`-derived) in bit fields with `int`-derived types. Using any type other than `int` or `unsigned int` (or any of their aliases) in bit fields is a GNU extension.
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-01Put config-related functions in a separate fileMaxim Biro
bootstrap_node_packets.c was giving an error as it was being included twice and there were no include guards, so part of it was split into bootstrap_node_packets.h.
2015-06-28Removed useless parameter from new_TCP_server()irungentoo
2014-11-29Check if key file was opened correctly in DHT_bootstrap.cirungentoo
Warn the user if it wasn't.
2014-04-23Updated some files so that they could build with latest core.irungentoo
Fixed some issues.
2014-04-16DHT_bootstrap.c now has TCP server functionality enabled.irungentoo
Fixed a regression (same type as last commit).
2014-04-13TCP_client pretty much done?irungentoo
Now next step is integrating it in tox. Added TCP server functionality to bootstrap server (define TCP_RELAY_ENABLED to enable it.)
2014-02-22Renamed dht server to dht nodeMaxim Biro
2014-02-01Added DHT bootstrap server info packets.irungentoo
define DHT_SERVER_EXTRA_PACKETS to enable.
2014-01-20Enabled onion in bootstrap_serverdaemon.irungentoo
2014-01-20Merge branch 'onion'irungentoo
2014-01-19proper windows preprocessor detectionBen Iofel
2014-01-17Onion servers are now DHT ready.irungentoo
2013-10-24Move unix_time(), id_cpy()/id_eq(), is_timeout() to util.*Coren[m]
unix_time(): - returns local value for current epoch - value is updated explicitly with unix_time_update() called at new_DHT()/doMessenger()/do_DHT() is_timeout(): - uses the local value for current epoch id_cpy()/id_eq() => id_copy()/id_equal(): - centralized duplicate definitions - replaced (most) memcpy()/memcmp() of (*, *, CLIENT_ID_SIZE) with id_copy()/id_equal()
2013-10-10Update DHT_bootstrap.cfr0sty
Removed deprecated compilation instructions
2013-09-14astyled everything.irungentoo
2013-09-13Merge remote-tracking branch 'upstream/master' into IntegrationCoren[m]