summaryrefslogtreecommitdiff
path: root/toxcore/util.c
AgeCommit message (Collapse)Author
2014-10-24Portability saving fixes for big endian systems.irungentoo_trip
Saves should now be portable from big endian to little endian systems though I need someone to actually test it to be sure I didn't mess up.
2014-10-22Load file portability code for big endian.irungentoo_trip
Warning: only loads, doesn't save.
2014-09-30Rework toxav/rtp.c to use ntohl/htonl and ntohs/htonssin
Now we can also remove the helper routines from toxcore/util.[ch].
2014-06-10Const correctness in various interdependent filesMarc Schütz
2014-06-10Const correctness for toxcore/util.cMarc Schütz
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-31Fixed byte order and removed log functions from misc_toolsmannol
2014-05-20Merge upstream and other stuffmannol
2014-04-27Yeah many callsmannol
2014-01-19Added no_replay and added some things to the docs.irungentoo
2013-12-15Code cleanups.irungentoo
No functionality changed.
2013-11-10Merge branch 'master' into hardenirungentoo
Conflicts: toxcore/DHT.c
2013-11-06Behind #define LOGGING: Correct usage of now() to replacement unix_time().Coren[m]
2013-10-28Merge branch 'master' into hardenirungentoo
Also removed some old, useless loading code.
2013-10-24Merge remote-tracking branch 'upstream/master' into ↵Coren[m]
cleanup_unix_time_id_eq_cpy_is_timeout Conflicts: toxcore/net_crypto.c
2013-10-24Astyled some files.irungentoo
2013-10-24Move unix_time(), id_cpy()/id_eq(), is_timeout() to util.*Coren[m]
unix_time(): - returns local value for current epoch - value is updated explicitly with unix_time_update() called at new_DHT()/doMessenger()/do_DHT() is_timeout(): - uses the local value for current epoch id_cpy()/id_eq() => id_copy()/id_equal(): - centralized duplicate definitions - replaced (most) memcpy()/memcmp() of (*, *, CLIENT_ID_SIZE) with id_copy()/id_equal()
2013-10-23Code cleanups.irungentoo
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-13tox A/V: integration of A/V code into toxmannol
Also-by: Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>
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-27Astyled the code.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-17Tests of state loading/saving lead to two fixes for DHT.c and util.cCoren[m]
util.c: - fix in empty section at the end of the state, showed as bug when having an empty name DHT.c: - fix in saving less data than originally announced, showed as bug when not having reached any clients ever (no clients or only with timestamp of zero)
2013-09-16Toxcore should never print anything when built normally.irungentoo
2013-09-16Merge pull request #576 from FullName/MessengerLoadSaveirungentoo
State loading/saving: Instead of a blob, segment into sections marked with tags.
2013-09-16Fix warnings of -Wall -WextraCoren[m]
2013-09-16additional length >= size checksCoren[m]
Messenger.c: - additional size checks - removed one pointless copying of data, instead using it directly util.c: - lost a newline vs. master
2013-09-16Merge remote-tracking branch 'upstream/master' into MessengerLoadSaveCoren[m]
Conflicts: toxcore/Messenger.c toxcore/util.c toxcore/util.h
2013-09-14Change sublength to 32 bits. Someone might have more than (sizeof(Friends) / ↵Coren[m]
65536) friends...
2013-09-13State loading/saving: Instead of a blob, segment into sections marked with tags.Coren[m]
Primary rationale: The part that DHT saves changes if IP is expanded to IPv6. To let people keep their friends/name, change the datafile format now, while everybody is still on the same page. Loading/Saving rewritten to allow a part of the file to be incomprehensible to the loading routine. Added a magic cookie at the beginning to mark the file as tox's. Changes in some part of the datafile can be skipped and the remaining parts still be consumed. Allows a wide margin of forward compatibility (like the IP to IPv6 transition, but also e.g. a change in the key format). As long as the file is not completely garbled, the routine will read as much as possible. Only the KEY section is considered mandatory: a malformed key section leads to a negative result. util.*: - holds the driving function which jumps from section to section and calls back with section length and tag (type) Messenger.c,DHT.*: - new loading functions call the util-function with a callback, which subsequently consumes the sections - old routines are kept to fall back onto if the magic cookie at the beginning isn't present - saving is still done in one local routine
2013-09-13TOX_ENABLE_IPV6 is now #define'd per default. Added some logging and error ↵Coren[m]
messages.
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-11toxcore/util.h:Coren[m]
- moved cmdline_parsefor_ipv46() to testing/misc_tools.c
2013-09-11cmdline parsing of --ipv4/6 plucked into utilCoren[m]
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-10big push, putting all the infrastructure in place behind TOX_ENABLE_IPV6Coren[m]
2013-09-06Allow to build vs nacl instead of libsodiumJin^eLD
By default libsodium is used. Only if --enable-nacl is specified, then nacl will be used instead of libsodium. Pass locations of nacl headers and libraries by using the following options: --with-nacl-headers=/home/me/somewhere/nacl-20110221/build/469/include/amd64/ --with-nacl-libs=/home/me/somewhere/nacl-20110221/build/469/lib/amd64/
2013-08-30Fixed build errors.Kostya
2013-08-29Removed packet structs.irungentoo
They were causing problems on certain compiler configurations.
2013-08-24Rename core directory because of autoconf name clashjin-eld
While doing the checks configure might generate "core" files and will then try to remove them. Having a "core" directory generates an error while runing the configure script. There's no workaround but to rename the core directory.