summaryrefslogtreecommitdiff
path: root/toxcore/net_crypto.h
AgeCommit message (Collapse)Author
2020-05-17Format comments according to tokstyle's requirements.iphydf
2020-03-14Fix up comments a bit to start being more uniform.iphydf
Tokstyle (check-cimple) will start enforcing comment formats at some point. It will not support arbitrary stuff in comments, and will parse them. The result can then be semantically analysed.
2020-03-14Use spdx license identifier instead of GPL blurb.iphydf
2019-12-23fix invalid use of mutexsudden6
- Moving a pthread_mutex in memory (e.g. via realloc()) is undefined behavior. - add a state for allocated but not yet used crypto connections - change crypto_connection_status signature
2018-09-14Standardise header guards.iphydf
Using the full path including the repo name.
2018-09-05Add mechanism for recovering from disconnections in conferenceszugz
* add freezing and unfreezing of peers * add rejoin packet * revise handling of temporary invited connections * rename "peer kill" packet to "peer leave" packet * test rejoining in conference test * use custom clock in conference test
2018-08-26Update copyright to 2018.iphydf
2018-08-25Change while-loop to for-loop to express for-each-frame.iphydf
* Assignments can't be used as expressions, therefore `while` loops should not be used as a `for-each` construct. Use `for`, instead.
2018-08-16Use per-instance `Mono_Time` for Messenger and onion.iphydf
2018-07-19Collect `PACKET_ID*` constants in `net_crypto.h`, cleanup their usesJan Malakhovski
2018-07-08Use named function types for callbacks in net_crypto.iphydf
Also: * compound statements (blocks, e.g. in if/else) must be non-empty. Comments don't count. * `=` is not allowed in subexpressions. We treat it as statement-only. * `++i` is preferred over `i++` in statements. * `Type_Names` are camelsnake-case.
2018-06-28Various minor cleanups in `net_crypto`.iphydf
* Consistently use `num_packets_array` to get the packet count in the packet buffer. * Use `const` in more places. * Typo fix: begginning. * Rewrite `length < 1` for unsigned int to `length == 0`. * Limit scope of some loop variables by using for-init-decl. * Use early return in error paths to reduce indentation and for clarity. * Use `net_unpack_*` instead of manual `ntohs`. * Fix an uninitialised stack variable copy. * Fix a potential null pointer dereference. * Consistently use `get_crypto_connection`. It was inlined in some places. I de-inlined it now. * Add Loggers to some functions in preparation for adding log statements.
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-06-22Make the net_crypto connection state an enum.iphydf
It was a list of #defines, but clearly this is a discrete and limited set of named values, so an enum is more appropriate.
2018-05-23Fix the often call of event tox_friend_connection_statusPavel Karelin
Fixes #868 Is made by: 1. Fix enumeration mechanism of Crypto_Connection instances in function send_crypto_packets() (this item solves the main problem); 2. Disruption of correlation between parameters of different dimensions (the parameters MAX_NUM_SENDPACKET_TRIES and UDP_DIRECT_TIMEOUT have different dimensions).
2018-01-16Make Net_Crypto a module-private type.iphydf
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-12-22Wrap all sodium/nacl functions in crypto_core.c.iphydf
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-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-10make the majority of the callbacks stateless and add some status to a testcasemichael bishop
2016-09-09Minor cleanups: header reordering, adding {}.iphydf
I hadn't done this for the "fun" code, yet. Also, we should include system headers after our own headers. "In general, a module should be implemented by one or more .cpp files. Each of these .cpp files should include the header that defines their interface first. This ensures that all of the dependences of the module header have been properly added to the module header itself, and are not implicit. System headers should be included after user headers for a translation unit." -- http://llvm.org/docs/CodingStandards.html#a-public-header-file-is-a-module
2016-09-06Make friend requests statelessGregory Mullen (grayhatter)
Messenger is slightly twisty when it comes to sending connection status callbacks It will very likely need at the very least a partial refactor to clean it up a bit. Toxcore shouldn't need void *userdata as deep as is currently does. (amend 1) Because of the nature of toxcore connection callbacks, I decided to change this commit from statelessness for connections changes to statelessness for friend requests. It's simpler this was and doesn't include doing anything foolish in the time between commits. group fixup because grayhatter doesn't want to do it "arguably correct" is not how you write security sensitive code Clear a compiler warning about types within a function.
2016-09-05Make packet data a ptr-to-const.iphydf
Ensure that nobody inadvertly modifies the temporary packet data buffer.
2016-09-01Sort #includes in all source files.iphydf
2016-09-01Match parameter names in declarations with their definitions.iphydf
The parameter names were taken from function definitions to update the names in function declarations (prototypes).
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.
2015-12-16Less packet spam.irungentoo
2015-11-21Increase max file transfer speed.irungentoo
Fix bug that limited it to 1K packets per second.
2015-11-21More file transfer improvements.irungentoo
2015-11-20File transfer fix.irungentoo
2015-11-19Send queue size should not affect the speed of packets being resent.irungentoo
2015-11-19Attempted fix of disconnect when switching from TCP to UDP.irungentoo
2015-11-11Attempted fix of UDP disconnect bug that happens when both ipv4 and ipv6 are ↵irungentoo
connected.
2015-11-11Lower chances of disconnect during file transfers.irungentoo
2015-11-09File transfer fixes.irungentoo
Fixed file transfers disconnecting tox clients from each other in some network conditions.
2015-06-23Added code to net_crypto to calculate rtt.irungentoo
2015-05-21Load only secret key from tox save, not public key.irungentoo
Calculate public key from it.
2015-05-17Some protocol efficiency improvements.irungentoo
Reduced the amount of waste from dropped packets.
2015-05-16Don't resend the same packet twice within a short timeframe.irungentoo
2015-05-04Fixed possible connection issue.irungentoo
2015-04-24Fixed a couple possible issues with the friend connection callback.irungentoo
A TCP callback could be received when only a UDP connection was present. Increased a UDP timeout to make it less likely to time out and switch to TCP.
2015-04-18Some changes to net crypto.irungentoo
Should fix certain connection issues that sometimes happen. The dht public key of the peer must be known to create the connection. If the dht pk of the peer changes when a connection is active, it is killed to make way for the new one.
2015-04-18Enable proxy support in TCP_connection.irungentoo
2015-04-15Made net_crypto use TCP_connection.irungentoo
TODO: -Reconnection. -If UDP connction is good, connect to less TCP relays. -Store some TCP relays in friend connection associated to each friend?
2015-04-03Attempted fix of on off UDP connection causing toxcore to disconnect fromirungentoo
the friend.
2015-03-13When link can't send packets anymore, stop the request chunk callback.irungentoo
Removed time variable in packet struct and replaced it with sent variable.
2015-01-17Attempted fix of Tox disconnecting during file transfers by tweakingirungentoo
some congestion control numbers.
2015-01-16Tox should work better on TCP only when some people have broken TCPirungentoo
nodes and don't update them. Paths now try to use the same TCP node for their entire lifetime.