summaryrefslogtreecommitdiff
path: root/toxcore/network.h
AgeCommit message (Collapse)Author
2018-09-14Standardise header guards.iphydf
Using the full path including the repo name.
2018-08-26Use `bool` in place of 0/1 int values.iphydf
2018-08-26Update copyright to 2018.iphydf
2018-07-21Synchronise parameter names in headers with those in the implementation.iphydf
2018-07-12Style fixes in TCP code; remove MIN and PAIR from util.h.iphydf
* Moved PAIR to toxav, where it's used (but really this should die). * Replace most MIN calls with typed `min_*` calls. Didn't replace the ones where the desired semantics are unclear. Moved the MIN macro to the one place where it's still used. * Avoid assignments in `while` loops. Instead, factored out the loop body into a separate `bool`-returning function. * Use named types for callbacks (`_cb` types). * Avoid assignments in `if` conditions. * Removed `MAKE_REALLOC` and expanded its two calls. We can't have templates in C, and this fake templating is ugly and hard to analyse and debug (it expands on a single line). * Moved epoll system include to the .c file, out of the .h file. * Avoid assignments in expressions (`a = b = c;`). * Avoid multiple declarators per struct member declaration. * Fix naming inconsistencies. * Replace `net_to_host` macro with function.
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-06-24Add Logger to various net_crypto functions.iphydf
In preparation for adding log statements. Also, fix an uninitialised variable warning in cppcheck.
2018-05-20Finish @Diadlo's network Family abstraction.iphydf
The Family stuff in toxcore is a big mess. I'm sure I saw a bunch of bugs on the way, but I'm not verifying that code now, so the bugs stay.
2018-05-20Move system header includes from network.h to network.ciphydf
2018-04-17Improve network error reporting on WindowsMaxim Biro
Windows doesn't report network errors though errno, it has its own facilities.
2018-02-24Fix a bunch of compiler warnings and remove suppressions.iphydf
2018-02-14Get rid of the only GNU extension we used.iphydf
2018-02-01Manually serialise RTPHeader struct instead of memcpy.iphydf
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-16Use apidsl to generate LAN_discovery.h.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-11Move Networking_Core struct into the .c file.iphydf
To make it an abstract type everywhere except in network.c.
2017-12-29Remove deprecated ToxDNSiphydf
Based on #331. Fixes #42.
2017-11-15Fix IPv4 and IPv6 loopbacksDiadlo
2017-08-27Remove 'in_addr' and 'addrinfo' mention from network.hDiadlo
2017-08-24Add loopback and broadcast constantsDiadlo
2017-08-24Add platform independent constantsDiadlo
2017-08-24AF_INET -> TOX_AF_INETDiadlo
2017-04-22Revert "Implement tox_loop"Maxim Biro
This reverts commit 5ff099763b1f56414572e1c12eb2f003117db5a0.
2017-04-12Added missing includes: <netinet/in.h> and <sys/socket.h>Yuri
Found these missing includes while compiling on FreeBSD 11.
2017-04-01Implement tox_loopAnsa89
2017-03-26Fix network malloc(0) bugDiadlo
2017-03-04Fix formatting with astyleDiadlo
Fix #494
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-28Add VLA compatibility macro for C89-ish compilers.iphydf
2017-01-26Add platform-independent Socket and IP implementationDiadlo
2017-01-22Add appveyor build for native windows tests.iphydf
It doesn't compile, yet. A few changes (like VLA support) need to be made before we can enable appveyor as a required PR check.
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".
2016-11-06Change packet kind enum to use hex constants.iphydf
Hex constants make it clearer that you can only use 2 nibbles (the two digits of the number, displayed as two columns in the source code), i.e. 1 byte, for the packet kind. It also makes the bit representation easier to see.
2016-11-05Convert series of NET_PACKET_* defines into a typedef enumGregory Mullen (grayhatter)
fixup! TravisCI shorten IRC message
2016-09-08Fix compilation for Windows.iphydf
- Mingw32 didn't read MSDN, so behaves badly despite lean and mean. - Avoid alignment issues on windows with packed bitfields in the RTP header. This change makes the program ill-formed in C99, but I don't know the correct fix at the moment, and I don't want to keep the Windows build broken for too long.
2016-09-07Prevent <winsock.h> inclusion by <windows.h>.iphydf
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-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-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
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-02-27Allow for specifying the port range to use in Tox_Optionssaneki
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-31Removed now useless packet id.irungentoo