Commit Graph

38 Commits

Author SHA1 Message Date
Marc Schütz
99d5940140 Const correctness in various interdependent files 2014-06-10 20:54:48 +02:00
Marc Schütz
9e028b243a Const correctness for toxcore/util.c 2014-06-10 18:27:05 +02:00
irungentoo
1bad0b5eea
Fixed TOX_MAX_MESSAGE_LENGTH define.
Removed some useless code from toxcore.

Astyled core code with new version of astyle.
2014-06-01 18:55:52 -04:00
mannol
d7c1157375 Fixed byte order and removed log functions from misc_tools 2014-05-31 17:27:22 +02:00
mannol
a1f2a18ae4 Merge upstream and other stuff 2014-05-20 00:10:40 +02:00
mannol
42b25a4d3e Yeah many calls 2014-04-27 19:21:26 +02:00
irungentoo
cdcb8b8600 Added no_replay and added some things to the docs. 2014-01-19 09:44:33 -05:00
irungentoo
24974ef816 Code cleanups.
No functionality changed.
2013-12-15 18:57:10 -05:00
irungentoo
57763f2737 Merge branch 'master' into harden
Conflicts:
	toxcore/DHT.c
2013-11-10 14:32:46 -05:00
Coren[m]
03485a8d05
Behind #define LOGGING: Correct usage of now() to replacement unix_time(). 2013-11-06 15:26:08 +01:00
irungentoo
415835ce3d Merge branch 'master' into harden
Also removed some old, useless loading code.
2013-10-28 16:01:29 -04:00
Coren[m]
065495cd7c Merge remote-tracking branch 'upstream/master' into cleanup_unix_time_id_eq_cpy_is_timeout
Conflicts:
	toxcore/net_crypto.c
2013-10-24 22:47:23 +02:00
irungentoo
2fdc412e36 Astyled some files. 2013-10-24 16:37:39 -04:00
Coren[m]
0a4c3d7e2e Move unix_time(), id_cpy()/id_eq(), is_timeout() to util.*
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-24 22:32:28 +02:00
irungentoo
a67b4f8c6d Code cleanups. 2013-10-23 14:32:09 -04:00
Coren[m]
a0f08839bd Main: Eliminate TOX_ENABLE_IPV6 (then always on), CLIENT_ONETOONE_IP (then 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-20 16:56:12 +02:00
mannol
5bc2560904 tox A/V: integration of A/V code into tox
Also-by: Sergey 'Jin' Bostandzhyan <jin@mediatomb.cc>
2013-10-13 16:40:15 +02:00
Coren[m]
2af0d43ce8 Add tox_wait() for socket, allow tox.h include in tox.c
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-10-02 16:38:54 +02:00
irungentoo
2dd1c5515c Astyled the code. 2013-09-27 22:03:38 -04:00
Coren[m]
88e80dc88f Allow loginit() to be delayed, store loglog() data in intermediate buffer 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-18 16:25:55 +02:00
Coren[m]
1c57a3a3de Tests of state loading/saving lead to two fixes for DHT.c and util.c
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-17 01:08:57 +02:00
irungentoo
1d2f4465bf Toxcore should never print anything when built normally. 2013-09-16 11:22:01 -04:00
irungentoo
98fb06c1b7 Merge pull request #576 from FullName/MessengerLoadSave
State loading/saving: Instead of a blob, segment into sections marked with tags.
2013-09-16 08:11:56 -07:00
Coren[m]
ab2805a23b Fix warnings of -Wall -Wextra 2013-09-16 10:37:22 +02:00
Coren[m]
a069f67ab3 additional length >= size checks
Messenger.c:
- additional size checks
- removed one pointless copying of data, instead using it directly

util.c:
- lost a newline vs. master
2013-09-16 09:40:47 +02:00
Coren[m]
57d10f0a80 Merge remote-tracking branch 'upstream/master' into MessengerLoadSave
Conflicts:
	toxcore/Messenger.c
	toxcore/util.c
	toxcore/util.h
2013-09-16 09:29:08 +02:00
Coren[m]
a341b259b6 Change sublength to 32 bits. Someone might have more than (sizeof(Friends) / 65536) friends... 2013-09-14 10:43:09 +02:00
Coren[m]
87f5f9d4eb State loading/saving: Instead of a blob, segment into sections marked with tags.
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-13 18:05:11 +02:00
Coren[m]
ec3734fc5d TOX_ENABLE_IPV6 is now #define'd per default. Added some logging and error messages. 2013-09-13 08:50:46 +02:00
Coren[m]
513e37815d tox.h, DHT.h:
- 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-11 20:50:15 +02:00
Coren[m]
d35fee43ba toxcore/util.h:
- moved cmdline_parsefor_ipv46() to testing/misc_tools.c
2013-09-11 15:19:39 +02:00
Coren[m]
4cf0d857bc cmdline parsing of --ipv4/6 plucked into util 2013-09-11 00:14:20 +02:00
Coren[m]
3ae7460853 util.*:
- 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-10 20:55:05 +02:00
Coren[m]
bcb283cf45 big push, putting all the infrastructure in place behind TOX_ENABLE_IPV6 2013-09-10 16:36:20 +02:00
Jin^eLD
e092eee869 Allow to build vs nacl instead of libsodium
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-09-06 22:54:45 +03:00
Kostya
25563ac070 Fixed build errors. 2013-08-30 03:28:50 -04:00
irungentoo
df4b1c6ee5 Removed packet structs.
They were causing problems on certain compiler configurations.
2013-08-29 19:06:09 -04:00
jin-eld
e658892793 Rename core directory because of autoconf name clash
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.
2013-08-24 03:25:07 +03:00