summaryrefslogtreecommitdiff
path: root/toxcore/network.c
AgeCommit message (Collapse)Author
2014-01-20Update network.cbenwaffle
2014-01-19proper windows preprocessor detectionBen Iofel
2014-01-05Tests added and some fixes for the onion part.irungentoo
2013-12-15Code cleanups.irungentoo
No functionality changed.
2013-12-12Fixed arm bug.irungentoo
2013-11-29Add sodium_init() function to startup.irungentoo
2013-11-27Various changes to nTox including a potential crash (also possible from ↵Coren[m]
remote!), and a tiny change to toxcore. Crash stuff: nTox.c: - do_refresh(): avoid crashes (input a "%" and the client goes "boom!", send someone a string with embedded "%" and see him blow up...) Other stuff: toxcore: tox.h (doc.)/network.c (code): - networking_wait_prepare(): return -1 if lenptr was NULL and therefore not settable nTox.c: - fraddr_to_str(): function to convert a TOX_FRIEND_ADDRESS into a segmented (and therefore line-breakable) string - print_friendlist(): print index of friend on name line, print id on 2nd line - command /f: skip spaces (and +) inside a friend id - command /r (new): "/r #" to remove a friend - main(): reduce cpu consumption if we're not currently sending files
2013-11-16Fixed build error on windows.irungentoo
2013-10-25Update time before running functions for recieved packets.irungentoo
2013-10-20Merge branch 'Cleanup-defines' of ↵irungentoo
https://github.com/FullName/ProjectTox-Core into FullName-Cleanup-defines
2013-10-20Main: Eliminate TOX_ENABLE_IPV6 (then always on), CLIENT_ONETOONE_IP (then ↵Coren[m]
always off). Additionally (besides cleanups): network.h/tox.h: - WIN32: fix a strange sa_family_t definition - WIN32: define EWOULDBLOCK to WSAEWOULDBLOCK - WIN32: kill macro for an existing function (IN6_ADDR_EQUAL) network.c: - use EWOULDBLOCK instead of EAGAIN (same value, but EWOULDBLOCK is more "popular") - new_networking(): only try to enable IPv4-in-IPv6 if it's not already enabled per default - inet_ntop()/inet_pton(): WIN32: remove partial initializers in favor of a simple memset() - ip_equal(): WIN32: use an existing function - logging: networking_wait_execute(): only dump result if not timeout - logging: loglogdata(): kill an unused variable LAN_discovery.c: - send_broadcasts(): re-enabled, can only support IPv4 by principle, split into fetch_broadcast_info() (to fetch the addresses once) and send_broadcasts() (actual sending) DHT.c: - DHT_load_state_callback(): enclosed a fprintf(stderr, ...) into #ifdef DEBUG Lossless_UDP.c: - change_handshake(): harden against strange sa_family_t definitions Messenger.c: - logging: fix ID to string conversion util.c: - logging: eliminate a signed-warning
2013-10-19fixed build errors on windowsAntonio Montes
2013-10-13Small fix.irungentoo
2013-10-13tox A/V: integration of A/V code into toxmannol
Also-by: Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>
2013-10-09fix for missing EAGAIN definition on windowsnaxuroqa
2013-10-06sendqueue_length no longer determines if we check for socket-can-write, but ↵Coren[m]
sendpacket() sets a timestamp if it happened network.*: - sendpacket(): checks result and on EAGAIN, stores time of this event - networking_wait_prepare(): uses the time if set to check up to 500ms later for the socket to be writeable again - networking_wait_cleanup(): clears the time if the socket was writeable - fixed some accidental tabs Messenger.*, tox.*: - pass-through functions to reach networking_wait_cleanup() - fixed some accidental tabs
2013-10-05Broken *_wait() into *_wait_prepare() and *_wait_execute()Coren[m]
To allow the actual waiting to run without any locking, split it into preparing the data it uses and the execution of the wait. The caller must provide with the buffer to store whatever data it requires to wait. Completely eliminates any reliance on the existence of anything but that data in the actual wait routine. Also fixed a few argument type warnings inside LOGGING.
2013-10-03Only add write-ready to select() if we have packets queuedCoren[m]
Lossless_UDP.*: - sendqueue_total() sums sendqueue() across all connections network.*, Messenger.c: - sendqueue_total() is collected and then used in deciding if we select() on write-readiness
2013-10-02Add tox_wait() for socket, allow tox.h include in tox.cCoren[m]
tox.*, Messenger.*, network.*; - new function tox_wait() => waitMessenger() => networking_wait(): - waits for a given amount of time for any sort of socket activity - mustn't change anything inside, mustn't poll or do other stuff - the point is to be able to call this asynchronously from a second thread - the outside shall follow up with an immediate tox_do() when there's socket activity tox.*: - allow inclusion of tox.h into tox.c, ensuring that the outside interface and the internal always match util.c: - squished a few warnings about questionable format strings
2013-09-22Astyled network.cirungentoo
2013-09-22Fix inet_pton/ntop on win32BtbN
2013-09-21Fix compilation on windows for ipv6 codeBtbN
2013-09-20Increased the size of the UDP buffers.irungentoo
2013-09-18Allow loginit() to be delayed, store loglog() data in intermediate buffer ↵Coren[m]
and flush it out when loginit() is called util.c: - handle loglog() before loginit() by storing the lines into an expanding buffer - when loginit() is called, write out and kill the buffer network.c: - push loginit() to the point where we know the actually used port
2013-09-16Toxcore should never print anything when built normally.irungentoo
2013-09-16Fix warnings of -Wall -WextraCoren[m]
2013-09-15Fix in ip_equal, plus testing code which led to that fix...Coren[m]
network.c: - use the correct macro for IPv4-in-IPv6 test network_test.c: - bunch of tests for addr_resolve() and ip_equal()
2013-09-15more portability fixes.irungentoo
2013-09-15Fixed merge problems.irungentoo
2013-09-15Merge branch 'master' of https://github.com/irungentoo/ProjectTox-Coreirungentoo
2013-09-15Fixed portablity problems.irungentoo
struct in6_addr member names can differ per platform.
2013-09-15Merge remote-tracking branch 'upstream/master' into IntegrationCoren[m]
2013-09-15ip_equal(): handle embedded v4 vs. native v4 as equalCoren[m]
network.c: - ip_equal(): on IPv4 vs. IPv6, check if the IPv6 is an embedded IPv4 and if true, compare that
2013-09-15addr_resolve() rewrite broke { (ipv6enabled == true) name => IPv4 address }Coren[m]
network.c: - addr_resolve(): save AF_UNSPEC ip4 address into ip4, not into to->ip4
2013-09-14Small fixes.irungentoo
2013-09-14Fixed some warnings.irungentoo
2013-09-14Some fixes.irungentoo
2013-09-14network.c:Coren[m]
- addr_resolve(): for() instead of while(), flip conditions for a much neater function (suggested by Andreas Schneider) - ip_ntoa(): enforced termination: terminate at the maximum position, that's the one snprintf() may forget - networking_poll(): forgot tabs2spaces
2013-09-13Merge remote-tracking branch 'upstream/master' into IntegrationCoren[m]
2013-09-13Nonce generation changes.irungentoo
Nonces don't need to be random, only different. also random_int now gives same quality random numbers for both NaCl and libsodium.
2013-09-12network.*:Coren[m]
- addr_resolv(_or_parse_ip)(): added an optional parameter to return both an IPv6 and an IPv4 address if requested address family was AF_UNSPEC - logging of unhandled packets DHT.c: - bootstrap_from_address(): use the additional return from addr_resolv_or_parse_ip() to bootstrap in both network types at once Lossless_UDP_testclient.c: - main(): adapt to signature change of addr_resolve() Messenger.c. LAN_discovery.h: - lost a htons(), readded - moved LAN_DISCOVERY_INTERVAL #define into LAN_discovery.h LAN_discovery.c: - added IPv4-in-IPv6 local address test
2013-09-12tox.h:Coren[m]
- #define'd tox's network port (as range) - finally killed tox_new_ex() in favor of changing tox_new()'s signature - renamed tox_bootstrap() to tox_bootstrap_from_ip() network.h: - #define'd tox's network port (as range) - renamed SEND_NODES_EX to SEND_NODES_IPV6 - bind() loop uses #define'd port range DHT.c: - renamed SEND_NODES_EX to SEND_NODES_IPV6 - sending ipv6 node addresses even if can't use them ourselves nTox.c: - adapted to changed tox_new()
2013-09-11network.c:Coren[m]
- removed almost unused variable without further use
2013-09-11tox.h, DHT.h:Coren[m]
- tox_bootstrap_ex(), DHT_bootstrap_ex() renamed to tox_bootstrap_from_address(), DHT_bootstrap_from_address() - (handle_)sendnodes_ex() renamed to (handle_)sendnodes_ipv6() - only sending sendnodes_ipv6() if we're actually IPv6 enabled - changed comments to conform better nTox.c, Messenger_text.c, DHT_test.c, DHT_bootstrap.c: - fallout from *_ex() to *_from_address() DHT_bootstrap.c: - corrected a potentially wrong info message util.c: - fixed logfile name: now (funcptr) => now() (number) network.c: - addead comment about the necessity of bind() to succeed auto_test/messenger_test.c: - defaulting ipv6enabled to TOX_ENABLE_IPV6_DEFAULT LAN_discovery.c: - slight cleanup and comments for clarity
2013-09-11network.c:Coren[m]
- undo "fixing" the wrong variable - fix the logging in receivepacket()
2013-09-11Prettier fix to missing length initializationCoren[m]
2013-09-11network.c: logging more details, fixing pollCoren[m]
LAN_discovery.c: IPv6: send both v6 multicast and v4 broadcast if socket allows
2013-09-11network.c:Coren[m]
- reset errno from failed bind() calls if the last one succeeds DHT_bootstrap.c: - move the perror() output next to where it belongs to
2013-09-10util.*:Coren[m]
- added logging functions, default off tox.h: - added includes for sockaddr_in/6 network.c: - added logging functions, default off (#define in util.h) - IPv6: activating site-local all-nodes multicast address (i.e. IPv6 equivalent of broadcast)
2013-09-10fix: bad memset length in ip_init()Coren[m]