Commit Graph

42 Commits

Author SHA1 Message Date
iphydf 8f96ca6d86 Update license headers and remove redundant file name comment.
"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".
2017-01-19 00:01:44 +00:00
iphydf 8b4eae4038 Remove TOX_DEBUG and have asserts always enabled.
These are cheap asserts. I've also replaced the fprintf's with
`LOGGER_ERROR` calls.
2017-01-11 19:43:08 +00:00
iphydf 1977d56caa Remove return after no-return situation (and other cleanups).
Cleanups:
- Fix header guards to not use reserved names.
- Avoid name shadowing.
- Removed an unused variable found by avoiding name shadowing.
2016-09-30 19:06:44 +01:00
iphydf f60900c4b8 Move ring buffer out of toxcore/util into toxav.
Toxcore itself doesn't use this data structure. Only toxav does, so now
toxav owns the code for it.
2016-09-24 23:36:50 +01:00
iphydf 51d18236c8 Revert "Make ToxAV stateless"
This reverts commit 21f8db12c4.

It is currently broken. Incoming call callbacks are not invoked, and
instead the client goes offline immediately.
2016-09-19 21:53:40 +01:00
Gregory Mullen (grayhatter) 21f8db12c4 Make ToxAV stateless 2016-09-17 14:05:51 -07:00
iphydf ad26560516 Improve static and const correctness.
- Any non-externally-visible declarations should be `static`.
- Casting away the `const` qualifier from pointers-to-const is
  dangerous. All but one instance of this are now correct. The one
  instance where we can't keep `const` is one where toxav code actually
  writes to a chunk of memory marked as `const`. This code also assumes
  4 byte alignment of data packets. I don't know whether that is a valid
  assumption, but it's likely unportable, and *not* obviously correct.
- Replaced empty parameter lists with `(void)` to avoid passing
  parameters to it. Empty parameter lists are old style declarations for
  unknown number and type of arguments.
- Commented out (as `#if DHT_HARDENING` block) the hardening code that
  was never executed.
- Minor style fix: don't use `default` in enum-switches unless the number
  of enumerators in the default case is very large. In this case, it was
  2, so we want to list them both explicitly to be warned about missing
  one if we add one in the future.
- Removed the only two function declarations from nTox.h and put them
  into nTox.c. They are not used outside and nTox is not a library.
2016-09-06 11:54:37 +01:00
iphydf 77db27331e Sort #includes in all source files. 2016-09-01 16:35:46 +01:00
irungentoo 6a494e2cbd Astyle. 2015-11-03 13:42:05 -05:00
Eniz Vukovic d6fdf16520 New Adaptive BR algorithm, cleanups and fixes 2015-10-10 23:54:23 +02:00
mannol c641b0fceb Updated with upstream 2015-08-09 12:39:21 +02:00
irungentoo 87b11024cd Save fixes. 2015-08-02 21:16:08 -04:00
mannol 2465f486ac Started custom RTCP 2015-04-13 01:45:53 +02:00
mannol 1450c22d01 Current progress 2015-01-24 23:29:54 +01:00
irungentoo 8deb032b2d Merge branch 'mutex-1' of https://github.com/mannol/toxcore 2014-11-29 16:09:24 -05:00
mannol e62ded3a6d More av cleanup 2014-11-29 13:42:19 +01:00
mannol 386c9748d4 av refactor 2014-11-18 00:46:46 +01:00
irungentoo_trip f73ad4ab05 Portability saving fixes for big endian systems.
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-24 18:04:27 -07:00
sin a46810a197 Rework toxav/rtp.c to use ntohl/htonl and ntohs/htons
Now we can also remove the helper routines from toxcore/util.[ch].
2014-09-30 13:18:28 -04:00
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
mannol d7c1157375 Fixed byte order and removed log functions from misc_tools 2014-05-31 17:27:22 +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 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] 9de295374d expanded Client_data to hold two addresses (IPv4, IPv6) instead of one
Compilerflag: CLIENT_ONETOONE_IP (to define in DHT.h, default unset i.e. NEW case: two addresses)

Every function in DHT{_test}.c working on Client_data has been rewritten to store IPv4 addresses in assoc4, IPv6 addresses in assoc6.
Loading/Storing of states defined with other compiler switch is transparently adjusting to the differences.

DHT.h, DHT.c:
- introduction and handling of the structure changes

DHT_test.c, Messenger.c:
- logging adapted to new structures

util.h:
- LOGGING isn't undefined per default anymore
2013-09-27 03:27:52 +02:00
irungentoo 5a83c1296c astyled everything. 2013-09-17 16:28:39 -04: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] 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] 64ca4b5db2 tox.*, DHT.*:
- return to the caller if the string could be resolved into an IP

other/DHT_bootstrap.c, testing/*_test.c, testing/nTox.c:
- parse cmdline for --ipv4/--ipv6 switch to allow user a choice

util.h:
- proper old-style C-comment
2013-09-10 22:59:33 +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
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