summaryrefslogtreecommitdiff
path: root/toxcore/network.c
AgeCommit message (Collapse)Author
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-11-02Compile as C++ for windows builds.iphydf
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-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-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-16const-correctness in windows code.iphydf
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-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.
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-08-31Remove redundant `return` statements.iphydf
2016-08-31Add newlines because astyle wants them.iphydf
We'll revert this once we move to clang-format.
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-08-17Add missing DHT_bootstrap to CMakeLists.txt.iphydf
- This PR also adds a DEBUG cmake option that enables -DTOX_DEBUG. - We also remove `-Wall`, because there are too many warnings, and nobody really looks at them at the moment. We'll see about fixing them soon. We'll also want to enable `-Werror` at some point. - Finally, this PR enables `-O3` to make sure toxcore still works correctly under heavy compiler optimisations.
2016-08-11Fix a bug I introduced that would make toxcore fail to initialise a second time.iphydf
sodium_init returns 1 when the library was already initialised. Toxcore code wasn't prepared to handle sodium errors, so it thought it was an allocation error. This error is still not handled correctly. If crypto fails to initialise, it will think it's an allocation error. Fixing this requires too many code changes, so must be done later.
2016-08-10Silence/fix some compiler warnings.iphydf
Some of these (like the incompatible pointers one) are really annoying for later refactoring.
2016-02-27Move argument comments to the end of lineRoman Yepishev
2016-02-27Remove magic numbers from addr_resolveRoman Yepishev
* Add #defines for INET/INET6 returns * Remove magic number 3 - exact AF_INET/INET6 result found. * Updated network_test.c
2016-01-27 add: more comments into network.cRoman Proskuryakov
2015-10-10New Adaptive BR algorithm, cleanups and fixesEniz Vukovic
2015-05-02Small cleanups.irungentoo
2015-04-14Fixed windows warning.irungentoo
2015-04-13Make tox_new return TOX_ERR_NEW_PORT_ALLOC for all socket related errors.irungentoo
2015-04-11Enable SO_REUSEADDR on TCP server socket.irungentoo
2015-03-12tox_new now sets error to TOX_ERR_NEW_PORT_ALLOC when binding to port fails.irungentoo
2015-03-08Merge branch 'worfox-new_api' into new_apiirungentoo
2015-03-07Change LOGGER_DEBUG to LOGGER_ERROR for fail bindChristoffer Sterner
2015-03-07Change fprintf debug into LOGGER_DEBUG for consistencyChristoffer Sterner
2015-03-07Fixed debug fprintf.irungentoo
2015-03-02Merge branch 'port_range_option' of https://github.com/saneki/toxcore into ↵irungentoo
new_api
2015-02-27Allow for specifying the port range to use in Tox_Optionssaneki
2015-01-10Logger fixmannol
2015-01-01Code cleanups.irungentoo
Moved some functions to onion.c. Fixed possible portability issues.
2014-12-31Code cleanup.irungentoo
Added length checks to ipport_pack() function.
2014-12-13Added HTTP proxy supportMaxim Biro
2014-11-21Cleaned up packet length types in toxcore.irungentoo
They are now all uint16_t instead of sometimes being uint32_t. Replaced some other uint32_t with unsigned ints.
2014-09-03Fixed iOS possible SIGPIPE issue.irungentoo
Apparently on iOS UDP sockets can SIGPIPE (what the fuck apple?).
2014-08-14UDP can now be disabled.irungentoo
new_messenger() now takes an options struct as an argument.
2014-08-14Remove useless code.irungentoo
2014-07-20Added addr_parse_ip() to network.h header.irungentoo
Removed useless semicolons.
2014-06-28Merge branch 'mannol1-master'irungentoo
2014-06-27remove pointer type warnings when building with mingwnotsecure
2014-06-20Fix CppCheck style errorsTux3 / Mlkj / !Lev.uXFMLA
#if 0 the content of toxav/msi.c : int stringify_message(MSIMessage *msg, char *dest) This function has no effect and does not seem to be used for actively waiting. Fix various other style errors, reduce scope when possible, avoid redundant writes, clarify operator priorities, etc.
2014-06-10Astyle and fixes.irungentoo
2014-06-10Const correctness in toxcore/network.cMarc Schütz
2014-06-07Toxcore closer to building correctly with gcc -std=c99.irungentoo