summaryrefslogtreecommitdiff
path: root/toxcore/network.h
AgeCommit message (Collapse)Author
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
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-10-12Fixed return value comment of new_networking functionMaxim Biro
2014-09-25More groupchats code written.irungentoo
2014-09-25Removed now useless atributes from structs.irungentoo
2014-09-25Removed groupchats from core.irungentoo
2014-09-17Reduce max udp packet size to 2K.irungentoo
2014-08-14Remove useless code.irungentoo
2014-07-21Don't set connection to established if packet is kill packet.irungentoo
Removed now useless defines in network.h
2014-07-20Added addr_parse_ip() to network.h header.irungentoo
Removed useless semicolons.
2014-06-13Const correctness for various packet callbacksMarc Schütz
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
2014-06-07IN6_ARE_ADDR_EQUAL was used only once, replaced it.irungentoo
2014-06-01Fixed TOX_MAX_MESSAGE_LENGTH define.irungentoo
Removed some useless code from toxcore. Astyled core code with new version of astyle.
2014-05-21Added functions to send and receive lossy encrypted packets overirungentoo
the Tox connection. A/V should now work over TCP.
2014-05-19function comments in headernotsecure
2014-05-19mistakesnotsecure
forgot to build before pushing
2014-05-19IP_Port packing unpacking in onion.cnotsecure
2014-05-18Fixed IP_Port packed struct being 1 byte too big on windows.irungentoo
2014-05-17Net_crypto can now handle packets sent as TCP OOB packets.irungentoo
Added timestamp to know which DHT public key is good in case onion_client and net_crypto report different ones.
2014-05-03All time in core is now monotonic.irungentoo
2014-05-01Random number functions belong in crypto_core.irungentoo
2014-05-01Improved the crypto_cmp function.irungentoo
It now uses the NaCl functions when the length is appropriate. Moved crypto defines to crypto_core.h
2014-04-29Some more work done on the middle network protocol.irungentoo
Handshake most likely has no more possible flaws to it, next thing to do is to do the same with the data packets. Wrote a couple more functions.
2014-04-28Added some packet defines.irungentoo
2014-04-22Decided pretty much how the handshake would work.irungentoo
Started writing the code. Astyled some files.
2014-04-21Crypto related cleanups.irungentoo
Moved Bunch of functions from net_crypto to crypto_core. decrypt_data_fast and decrypt_data_symmetric were the same thing therefore, removed decrypt_data_fast. Replaced all the crypto_secretbox_* defines with the equivalent crypto_box_* one. New define: crypto_box_KEYBYTES that is equal to crypto_box_BEFORENMBYTES.
2014-04-15Major protocol changes, this commit breaks all network compatibility.irungentoo
Removed a bunch of useless space from various structs. pack_nodes() and unpack_nodes() are now used to transmit lists of nodes for the DHT and onion parts. They provide a way to transmit both ipv6 and ipv4 nodes in the same packet in a portable way that takes as little space as possible without compression. Using pack_nodes, merged the send nodes and send nodes ipv6 packets into one packet greatly reducing the risk of amplification attacks.
2014-04-13sockets: support Mac OS X way of disabling SIGPIPE on a socketSteven Noonan
Mac OS X doesn't have MSG_NOSIGNAL, so we need to use SO_NOSIGPIPE. Signed-off-by: Steven Noonan <steven@uplinklabs.net>
2014-04-06Added TCP_client.irungentoo
Some work done on the TCP part.
2014-04-02Some code cleanups.irungentoo
2014-03-29TCP server now has onion functionality.irungentoo
All the IP/Port related structs now have __attribute__ ((__packed__))