Commit Graph

443 Commits

Author SHA1 Message Date
Coren[m]
355c55f745 sendqueue_length no longer determines if we check for socket-can-write, but 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-06 16:37:02 +02:00
irungentoo
b2c5e16132 Fixed file sending bug. 2013-10-05 10:55:28 -04:00
irungentoo
b0f9e6db6f m_addfriend_norequest now prevents you from adding your own id as friend. 2013-10-05 09:09:28 -04:00
Coren[m]
1331a32223 Broken *_wait() into *_wait_prepare() and *_wait_execute()
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-05 12:53:54 +02:00
irungentoo
edf799133c Fixed some possible bugs. 2013-10-04 11:20:47 -04:00
irungentoo
378a87d523 Code cleanups. 2013-10-03 12:42:29 -04:00
Coren[m]
1f92ee274d Only add write-ready to select() if we have packets queued
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-03 12:10:29 +02:00
irungentoo
c014cebbe5 Merge branch 'file-transfers'
File transfers are now working and in public api.
2013-10-02 20:53:48 -04:00
irungentoo
fbd494a8b4 File sending added to public api. 2013-10-02 20:53:24 -04:00
irungentoo
8a77211b43 Merge branch 'file-transfers' of https://github.com/irungentoo/ProjectTox-Core into file-transfers 2013-10-02 20:20:33 -04:00
irungentoo
6425cf3b53 File control packets can now be used by the person sending the file. 2013-10-02 20:08:14 -04: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
0fb3c9eeed Max length of filenames is now 255 bytes. 2013-10-02 10:28:08 -04:00
irungentoo
2467e6d592 Fixed bug. 2013-10-02 09:42:28 -04:00
irungentoo
efa3c79699 Removed useless ifdefs. 2013-10-01 19:01:15 -04:00
irungentoo
6182af8449 nTox updated with changes in core, some file sending things fixes. 2013-10-01 18:59:33 -04:00
irungentoo
6dbc8a5496 Core now takes better care of file transfers. 2013-10-01 16:48:32 -04:00
irungentoo
766cff692f File sending now works on bad wireless connections. 2013-10-01 11:44:27 -04:00
irungentoo
b9bffced7c Speeded up/fixed NAT hole punching and peer finding. 2013-09-30 17:20:35 -04:00
irungentoo
a0f94267ad File sending. 2013-09-30 09:35:17 -04:00
irungentoo
9f1080f8b4 Fixed connection bug. 2013-09-29 08:07:10 -04:00
irungentoo
aae9fae257 Fixed possible problem. 2013-09-28 20:50:54 -04:00
irungentoo
d4e42230bd Potential DoS fixed. 2013-09-28 19:03:29 -04:00
irungentoo
8adb34e6a9 Fixed possible bug. 2013-09-28 17:19:32 -04:00
irungentoo
abd4278fc4 Connection bug fixed. 2013-09-28 12:13:26 -04:00
irungentoo
e1bea734e0 Fixed small issue. 2013-09-28 10:39:45 -04:00
irungentoo
2b8d0d045a Behaviour with LAN ips is now better, also fixed possible bug. 2013-09-28 10:27:25 -04:00
irungentoo
92f89b9384 LAN ips can be sent to LAN ips. 2013-09-28 09:54:17 -04:00
irungentoo
ed07194eb6 friend_iplist and route_tofriend behaviour fixes. 2013-09-28 09:21:08 -04:00
irungentoo
d14ba73bc3 Fixed possible problem. 2013-09-27 23:10:33 -04:00
irungentoo
2dd1c5515c Astyled the code. 2013-09-27 22:03:38 -04:00
irungentoo
0e318af9e2 Merge branch 'ClientData46' of https://github.com/FullName/ProjectTox-Core into FullName-ClientData46 2013-09-27 21:10:34 -04:00
Coren[m]
f7f670bf7c don't lose globally valid addresses for locally valid ones 2013-09-27 21:34:13 +02:00
Coren[m]
483a6cc161 Logging loop corrected. 2013-09-27 19:50:42 +02:00
Coren[m]
06a85177e9 minimalistic increase in elegance ;)
DHT.c:
- loops over assoc4/6 slightly more elegant
2013-09-27 18:33:52 +02:00
Coren[m]
6fe25e4f6f Permit -Wshadow as useful warning. 2013-09-27 11:24:33 +02: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
beff2b6de6 Possible bug fixed. 2013-09-25 13:19:19 -04:00
irungentoo
3c78aefce0 Fixed bug where hole punching was attempted even though the
clients were connected.

Increased the number of ports tried per interval of time.

Also astyled the files.
2013-09-25 10:07:07 -04:00
irungentoo
83c665f2c4 Fixed possible bug. 2013-09-25 07:37:55 -04:00
irungentoo
370e36815e Merge pull request #596 from FullName/ping.moveandclean
moved stuff that belongs into ping.[ch] there
2013-09-24 17:51:23 -07:00
irungentoo
7c300370b0 Merge branch 'master' of https://github.com/irungentoo/ProjectTox-Core 2013-09-24 18:22:18 -04:00
irungentoo
4a3bed3e85 Possibly fixed the weird disconnecting/reconnecting bug. 2013-09-24 18:15:15 -04:00
irungentoo
1994c3cd89 Possible bug fixed. 2013-09-24 09:57:49 -04:00
irungentoo
05a3851e43 Fixed windows build. 2013-09-24 07:56:06 -04:00
irungentoo
b0149318fa Merge pull request #604 from JFreegman/master
made setfriendname() part of public api
2013-09-24 03:49:06 -07:00
Jfreegman
23e03b0ba9 check length of name 2013-09-23 15:40:25 -04:00
irungentoo
5d25bc100c Fixed typo. 2013-09-23 13:45:51 -04:00
Jfreegman
c4702985a5 made setfriendname part of public api 2013-09-23 04:30:24 -04:00
stal
bcba9b957b Fix bug.
This makes it build on OS X again...
2013-09-22 17:49:14 -07:00
Maks
f4163e324b Fix typo. "if (yesno != 0 || yesno != 1)" always true 2013-09-22 22:36:45 +03:00
irungentoo
bb6566e436 Astyled network.c 2013-09-22 14:37:04 -04:00
irungentoo
ed0071bcbc Merge branch 'win_inetpton' of https://github.com/BtbN/ProjectTox-Core 2013-09-22 14:29:37 -04:00
BtbN
a7eb9b2c34 Fix inet_pton/ntop on win32 2013-09-22 20:26:39 +02:00
irungentoo
757c958132 Merge branch 'master' of https://github.com/irungentoo/ProjectTox-Core 2013-09-22 14:26:24 -04:00
irungentoo
0d54a675ec Removed unused variables. 2013-09-22 14:25:52 -04:00
irungentoo
ba169b7c21 Keep the code consistent. 2013-09-22 14:24:38 -04:00
irungentoo
8b5d9dc13e Merge branch 'patch-9001' of https://github.com/stal888/ProjectTox-Core into stal888-patch-9001 2013-09-22 14:14:53 -04:00
irungentoo
115cb8af02 Merge pull request #600 from Jman012/master
Fixed a bug or two.
2013-09-22 10:53:00 -07:00
irungentoo
64150f4bde Merge pull request #590 from FullName/ipv6.yield50%toipv4
reserve half of client lists for ipv4 (take #2)
2013-09-22 09:17:16 -07:00
irungentoo
83c6e9dd35 Fixed the connection bug and cleaned up some stuff. 2013-09-22 11:08:23 -04:00
Jman012
bb0cd7da0c Fixed a bug or two.
Added breaks on the new packet handlers in doFriends for the switch statement, and added a default.
2013-09-21 23:50:14 -07:00
irungentoo
1cc47101fe Fix bug. 2013-09-21 23:15:40 -04:00
irungentoo
05477f77d3 Fixed bug. 2013-09-21 22:57:28 -04:00
irungentoo
e36f6c46d1 Fixed bug. 2013-09-21 19:27:53 -04:00
Sebastian Stal
cb68be00b0 Change tox_get_friendlist API.
tox_get_friendlist() -> tox_copy_friendlist().
You now have to allocate your own memory to pass into tox_copy_friendlist.
To help with this, tox_count_friendlist() has been added to get the length
of the friend list.
2013-09-21 14:47:30 -07:00
Coren[m]
88678e584a moved stuff that belongs into ping.[ch] there
DHT.*, ping.*:
- moved stuff from struct DHT into struct PING: toping, last_toping
- moved functions add_toping(), do_toping()
- made id_closest() publicly accessible
- send_ping_request(): killed (Net_Crypto *c) parameter in favor of copying it into (PING *) on new_ping()

group_chats.c:
- killed local 1:1 copy in favor of DHT.c::id_closest()
2013-09-21 15:39:15 +02:00
irungentoo
a6abf007cb Connection speed ups. 2013-09-21 09:33:44 -04:00
irungentoo
3e4599e33a Lossless UDP is now suitable for sending files.
Added some actual flow control and made send/recieve buffers grow when
necessary.
2013-09-21 09:03:54 -04:00
irungentoo
112c8dadf9 Merge branch 'master' of https://github.com/irungentoo/ProjectTox-Core 2013-09-21 08:55:14 -04:00
irungentoo
a07162bf92 Merge pull request #595 from FullName/MessengerLoadSave
Thou shalt not take singular commands after an if into #ifdef DEBUG...
2013-09-21 04:24:40 -07:00
Coren[m]
f56a8529a3 Thou shalt not take singular commands after an if into #ifdef DEBUG...
toxcore/Messenger.c:
- Messenger_load_old(): brackets around an #ifdef'ed line to avoid data pointer being only pushed forward properly in the error case
2013-09-21 10:07:16 +02:00
irungentoo
63126241eb Small fix in Lossless UDP. 2013-09-20 22:13:59 -04:00
Coren[m]
4e76ca432f honor the claim of sort_list(), that the result is in anti-intuitive order, and treat element zero as the furthest 2013-09-21 03:13:44 +02:00
Coren[m]
89005f1701 Merge branch 'master' of https://github.com/irungentoo/ProjectTox-Core.git into ipv6.yield50%toipv4 2013-09-21 01:27:53 +02:00
Coren[m]
13bd6aab18 reserving 50%+ for ipv4, take 2
DHT.c:
- we have to actually count the number of addresses in the field, because sort_list() will move the stuff around
- improved replace_good() substantially by throwing away the "furthest" client_id, not the one just a bit worse than the new one (but better than all the later ones in the field!)
2013-09-21 01:22:42 +02:00
BtbN
b9306d6d06 Fix compilation on windows for ipv6 code 2013-09-21 01:10:23 +02:00
irungentoo
20b6900fb1 Fixed bug. 2013-09-20 11:33:53 -04:00
irungentoo
53397f6077 Small fix in Lossless UDP. 2013-09-20 10:02:16 -04:00
irungentoo
524af7ef07 Increased the size of the UDP buffers. 2013-09-20 08:25:01 -04:00
irungentoo
7e5da03637 Fixed bug in Lossless UDP. 2013-09-19 10:18:43 -04:00
irungentoo
993554bdf6 Fixed bug in Lossless UDP. 2013-09-19 09:46:55 -04:00
Coren[m]
f10c94a17a reserve lower half of client lists for ipv4 for now
also rename client_in_list() to client_or_ip_port_in_list(), it also checks for an identical ip/port and replaces the client_id, recycling the entry

DHT.c:
- rename client_in_list() to client_or_ip_port_in_list()
- replace_bad(), replace_good(): if IPv6, only insert into the upper half of the given list
- addto_lists(): convert ipv4-in-ipv6 mapped to ipv4
2013-09-19 11:06:04 +02:00
irungentoo
e2e2719439 Merge pull request #588 from FullName/LoggingPreInitStoring
Allow loginit() to be delayed, store loglog() data in intermediate buffer...
2013-09-18 15:44:25 -07: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
irungentoo
7c5b98397a Merge branch 'group-chat' 2013-09-17 20:06:33 -04:00
irungentoo
5a83c1296c astyled everything. 2013-09-17 16:28:39 -04:00
Jfreegman
d4e135d763 numchats needs to be decremented 2013-09-17 06:52:02 -04:00
irungentoo
dd12d464de Functions to get name of peer in group chat added.
Group message callback modified.
2013-09-16 20:59:53 -04:00
Coren[m]
aa71dea96d Merge remote-tracking branch 'upstream/master' into MessengerLoadSave 2013-09-17 01:15:57 +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
67da01fb06 Fixed build. 2013-09-16 16:18:35 -04: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
irungentoo
b6377dfd25 Merge pull request #580 from FullName/networking_test
Fix in ip_equal, plus testing code which led to that fix...
2013-09-15 15:53:34 -07:00
Coren[m]
ee1cc34d55 Fix in ip_equal, plus testing code which led to that fix...
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-15 23:39:09 +02:00
Sebastian Stal
96d39de223 Fix leaks and null dereferences in net_crypto 2013-09-15 10:48:16 -07:00
irungentoo
decdb7aa8c more portability fixes. 2013-09-15 10:17:09 -04:00
irungentoo
bbeb6e15cd Fixed portability problems. 2013-09-15 09:47:17 -04:00
irungentoo
43b609d41c Fixed merge problems. 2013-09-15 09:35:46 -04:00
irungentoo
fca574a0e0 Merge branch 'master' of https://github.com/irungentoo/ProjectTox-Core 2013-09-15 09:31:46 -04:00
irungentoo
8c41244627 Fixed portablity problems.
struct in6_addr member names can differ per platform.
2013-09-15 09:31:27 -04:00
Coren[m]
16a6c9fb59 Merge remote-tracking branch 'upstream/master' into Integration 2013-09-15 08:54:14 +02:00
Coren[m]
1e1782a952 ip_equal(): handle embedded v4 vs. native v4 as equal
network.c:
- ip_equal(): on IPv4 vs. IPv6, check if the IPv6 is an embedded IPv4 and if true, compare that
2013-09-15 08:33:09 +02:00
Coren[m]
2092b5d936 addr_resolve() rewrite broke { (ipv6enabled == true) name => IPv4 address }
network.c:
- addr_resolve(): save AF_UNSPEC ip4 address into ip4, not into to->ip4
2013-09-15 08:20:37 +02:00
irungentoo
dde98eb345 DHT peer finding for new friends should now be slightly faster.
Also fixed the "[i] could not send message" bug in nTox.
2013-09-14 20:38:48 -04:00
irungentoo
20a8fb8a23 Fixed warnings. 2013-09-14 19:15:26 -04:00
irungentoo
04e7b0eb6c Fixed small problems, updated TODO. 2013-09-14 18:59:04 -04:00
irungentoo
18cfda2dc7 Small fixes. 2013-09-14 15:12:54 -04:00
irungentoo
46a99a8774 Fixed some warnings. 2013-09-14 12:57:41 -04:00
irungentoo
12d1c5199b astyled everything. 2013-09-14 12:42:17 -04:00
irungentoo
64d000cdfa Some fixes. 2013-09-14 12:41:14 -04:00
Coren[m]
36e5636406 DHT.c:
- get_close_nodes(): refactored the inner loop out into get_close_nodes_inner()
2013-09-14 17:10:10 +02:00
Coren[m]
a7d059a130 network.c:
- 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-14 17:09:03 +02:00
Coren[m]
d9965df382 LAN_discovery.c:
- LAN_ip(): use standard macro from IPv4-in-IPv6 test
2013-09-14 13:32:07 +02:00
Coren[m]
09cdd813c5 DHT.c:
- get_close_nodes()/sendnodes()/sendnodes_ipv6(): when selecting for SEND_NODES/SEND_NODES_IPV6, treat embedded IPv4-in-IPv6 addresses as being IPv4

Messenger.c:
- added a named constant for sixty seconds friend/client dump
- fix logging to convert client_id to printable before printing
2013-09-14 12:55:56 +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]
fa576e464e Merge remote-tracking branch 'upstream/master' into Integration 2013-09-13 19:44:14 +02:00
Coren[m]
d2603cf169 Merge remote-tracking branch 'upstream/master' into MessengerLoadSave 2013-09-13 18:43:04 +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
irungentoo
339dcd6070 Nonce generation changes.
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-13 10:42:14 -04:00
Coren[m]
e67a11dd04 Merge remote-tracking branch 'upstream/master' into Integration 2013-09-13 09:06:52 +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
irungentoo
f8b979a92a Put group chat functions in the public API.
Group chats are not complete, they seem to work very well though.

This means that the functions will change.
2013-09-12 20:29:30 -04:00
irungentoo
41b162eb18 Merge branch 'master' of https://github.com/irungentoo/ProjectTox-Core 2013-09-12 19:26:37 -04:00
irungentoo
91d7f4857f Very basic group chats, tested and working with nTox.
Please wait until the tox.h API is updated before integrating it into
your clients.

nTox:
/g
creates a new group chat

/i friendnum groupnum
invite friendnum to groupnum

/z groupnum message
send message to groupnum

NOTE: group chats currenly might not handle packet loss well if there are less than 6 participants.
2013-09-12 19:26:30 -04:00
Coren[m]
cdd5878bc4 Merge remote-tracking branch 'upstream/master' into Integration
Conflicts resolved:
	toxcore/Messenger.c
	toxcore/network.h
2013-09-12 19:55:51 +02:00
Coren[m]
d95df291f0 Merge remote-tracking branch 'upstream/master' into DHT_bootstrap
Conflicts:
	toxcore/Messenger.c
2013-09-12 19:39:21 +02:00
Coren[m]
b5db32585a Patch to allow DHT_bootstrap to also do LAN discovery.
This patch inserts LAN discovery in DHT_bootstrap, allowing it to find clients even if it's run parameterless (and clients don't connect to it directly, e.g. because the port is already bound to a different client).

- moves the #define of LAN_DISCOVERY_INTERVAL from Messenger.c to LAN_discovery.h
- includes LAN_discovery.h into DHT_bootstrap.c
- DHT_bootstrap.c sends and accepts LAN_discovery packets
2013-09-12 19:09:25 +02:00
Coren[m]
591d6c70c6 network.*:
- 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-12 18:39:21 +02:00
Coren[m]
0cfbe004ef Messenger.c:
- remove local PORT definition in favor of TOX_PORT_DEFAULT
2013-09-12 16:07:51 +02:00
Coren[m]
a74cfaea81 tox.h:
- #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-12 15:42:03 +02:00
irungentoo
b37b521cd5 Integration of group chats into messenger in progress. 2013-09-11 20:42:25 -04:00
irungentoo
9bd7e56db8 Some small work on group chats done. 2013-09-11 19:22:48 -04:00
Coren[m]
5e1523e61d network.c:
- removed almost unused variable without further use
2013-09-11 22:21:31 +02:00
Coren[m]
ef86109460 Messenger.c:
- unbroke Messenger_load(): lost a length adjustment
- addeditional check for enough data available
2013-09-11 21:22:43 +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]
d0f5ad34ae cleanup TravisCI warnings (missing exports/extraneous args to printf) 2013-09-11 16:57:26 +02:00
Coren[m]
be716af15d network.c:
- undo "fixing" the wrong variable
- fix the logging in receivepacket()
2013-09-11 15:47:29 +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]
a326e851ba Prettier fix to missing length initialization 2013-09-11 12:40:54 +02:00
Coren[m]
5e076e35d9 network.c: logging more details, fixing poll
LAN_discovery.c: IPv6: send both v6 multicast and v4 broadcast if socket allows
2013-09-11 11:44:05 +02:00
Coren[m]
85912418db cmdline parsing:
- add missing includes (autobuild warnings)
2013-09-11 10:54:47 +02:00
Coren[m]
5869057aba network.c:
- 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-11 00:44:05 +02:00
Coren[m]
0139f2838f Merge remote-tracking branch 'upstream/master' into Integration 2013-09-11 00:16:15 +02:00
Coren[m]
4cf0d857bc cmdline parsing of --ipv4/6 plucked into util 2013-09-11 00:14:20 +02:00
irungentoo
55499933be Fixed building with NaCl. 2013-09-10 17:15:26 -04: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]
e89dda5cea DHT.c:
- client_in_list: split loop in two to avoid inserting a client_id duplicate
- final pieces for IPv6 expansion: (handle_)sendnodes_ex(), called from hande_getnodes() resp. handler callback
2013-09-10 21:36:58 +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]
f267266bf6 fix: bad memset length in ip_init() 2013-09-10 17:38:53 +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
Coren[m]
bcf251ac31 group_chats.c:
- *->net->sock to *->net (like everywhere else :))
2013-09-09 21:37:07 +02:00
Coren[m]
b91b87f285 Merge branch 'master' into Integration 2013-09-09 21:31:11 +02:00
Coren[m]
05d7b157c6 tox.*, Messenger.*:
- initialisation: argument added to enable/disable ipv6 as socket

Messenger_test.c:
- initialisation: ipv4 hardcoded for now
- delegating IP resolution to DHT_bootstrap_ex()
2013-09-09 21:03:31 +02:00
irungentoo
1f5bfab327 Start of group chats integration into the core. 2013-09-09 14:44:43 -04:00
irungentoo
c137ec9d4d move group chats to /toxcore 2013-09-09 14:16:53 -04:00
Coren[m]
a77253c79b tox.*, DHT.*;
- second set of *_bootstrap_ex() functions to allow addresses instead of IPs

network.h:
- new message ID for sending/receiving IPv6 nodes

DHT.*:
- get_close_nodes():
  - additional parameter to select which kind of nodes: IPv4 or IPv6

- sendnodes()/handle_sendnodes():
  - the IPv4 message must remain intact even when the Node_format structure (which embeds IP_Port) is expanded
  - added Node4_format to keep the structure "alive"
  - copying in/out of wider to smaller format required in sendnodes()/handle_sendnodes()
  - switch of Node_format from Node4_format to Node46_format by define
2013-09-09 19:17:21 +02:00
Coren[m]
9a8dc575b7 - added missing include (autobuild warning) 2013-09-09 16:35:39 +02:00
Coren[m]
9439d296f1 caught by autobuild, missing net->sock to net change 2013-09-09 16:27:24 +02:00
Coren[m]
dbd75e903e network.*:
- IPAny_Port: analogous to IP_Port
- ipport_equal: moved from DHT.c and adapted

DHTc.:
- ipport_equal renamed to ip4port_equal
2013-09-09 16:12:50 +02:00
Coren[m]
180322293c network.h:
- added ipany_ntoa()

network.c:
- added ipany_ntoa()
- fixed formatting
2013-09-09 15:32:05 +02:00
Coren[m]
55214aa041 network.*:
- IP4: changed in_addr_t to struct in_addr for compatibility reasons
- IP6: added
- IPAny: added
- addr_resolve_or_parse_ip(): converts a string into an IPAny
2013-09-09 14:53:27 +02:00
Coren[m]
29d777ef67 network.h:
- IP: add in_addr_t as part of the union
- IP: rename IP to IP4
2013-09-09 14:16:40 +02:00
Coren[m]
a128e3ff8f network.h:
- global: added sock_t
- Networking_Core: added family (currently always AF_INET) and port
- sendpacket(): changed signature to require (Networking_Core *) instead of sock_t

*.c:
- sendpacket()-calls: replaced *->net->sock with *->net
2013-09-09 13:56:03 +02:00
Jfreegman
7e84ba4606 wrong type 2013-09-09 07:14:47 -04:00
Jfreegman
5a1897162b a better way 2013-09-09 07:11:30 -04:00
Jfreegman
3853a30acf initialize name_length 2013-09-09 06:41:33 -04:00
Maxim Biro
f5bf852400 Removed friendstatus from client API 2013-09-07 16:05:16 -04:00
irungentoo
220fb72121 Merge branch 'master' of https://github.com/irungentoo/ProjectTox-Core 2013-09-07 13:28:33 -04:00
irungentoo
bdf31fc6b5 Added TODO list and made m_copy*_statusmessage functions return length of copied buffer on success. 2013-09-07 13:27:44 -04: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
irungentoo
64570a1b12 Fixed autotest, increased MAX_STATUSMESSAGE_LENGTH. 2013-09-06 09:56:56 -04:00
irungentoo
7ecd809a59 Added name lengths to friend names. 2013-09-06 09:45:39 -04:00
irungentoo
bb35305d94 Merge branch 'group-chats' 2013-09-05 17:02:23 -04:00
irungentoo
c78b2352ab Merge pull request #559 from jin-eld/friendlist
Function for retreiving a list of friend numbers
2013-09-04 15:37:13 -07:00
Jin^eLD
b9455efd84 Function for retreiving a list of friend numbers
This should allow clients to sync the Tox friend list with their UI/etc.
lists.
2013-09-05 01:30:28 +03:00
irungentoo
efea6b9e82 Possibly fixed LAN discovery on some configurations. 2013-09-04 15:14:11 -04:00
irungentoo
31f43799e1 Fixed small problem. 2013-09-04 07:26:30 -04:00
irungentoo
36ac8e461e Merge branch 'master' of https://github.com/irungentoo/ProjectTox-Core 2013-09-03 14:30:49 -04:00
irungentoo
01365342fc Possible bugs fixed, all received strings now force NULL terminate. 2013-09-03 14:28:14 -04:00
Jin^eLD
c7c1b92724 Remove error printouts
A library should never print anything, so removing the perror()
printouts.
2013-09-03 20:25:18 +03:00
irungentoo
c59975dd7e Work in progress group chats.
Not done yet.
2013-09-03 08:53:07 -04:00
irungentoo
b73ba8244a Removed useless code, possibly fixed something. 2013-09-02 16:52:09 -04:00
irungentoo
7e8a34bee9 Fixed possible segfaults from bad input. 2013-09-02 16:35:23 -04:00
irungentoo
a4bf25801d Merge branch 'master' of https://github.com/JamoBox/ProjectTox-Core into JamoBox-master 2013-09-02 15:59:28 -04:00
JamoBox
61880ab938 last of the comment refactoring from toxcore 2013-09-02 17:25:28 +01:00
JamoBox
7b944e9c65 comment updates 2013-09-02 17:12:02 +01:00
irungentoo
25480852ac Merge pull request #554 from nurupo/master
Fixed missing field initializer warnings
2013-09-02 08:59:46 -07:00
Maxim Biro
7c11070b32 Fixed missing field initializers warnings 2013-09-02 11:41:10 -04:00
irungentoo
3857720658 Fixed some warnings. 2013-09-02 11:41:06 -04:00
irungentoo
5233656561 Properly fixed signed/unsigned comparisons. 2013-09-02 09:55:37 -04:00
JamoBox
433cc9c8b2 Even more comment updates. 2013-09-02 13:41:43 +01:00
JamoBox
925f63f493 More comment refactoring. 2013-09-02 13:31:00 +01:00
JamoBox
55621e9cea More comment refactoring - DHT.c 2013-09-02 13:27:00 +01:00
Tyler Bunnell
36a3b02f63 Merge branch 'master' of github.com:tylerb/ProjectTox-Core 2013-09-01 20:43:03 -06:00
Tyler Bunnell
d1c52788c5 Fix signed/unsigned comparison warnings 2013-09-01 20:42:59 -06:00
irungentoo
a1099d7f95 Fixed possible bug. 2013-09-01 22:29:51 -04:00
jin-eld
7d29bd23b9 Forward compatibility with automake 1.14
This update makes sure that the build still works with automake prior to
1.12 and at the same time does not give any warnings or errors with
automake 1.14
2013-09-01 20:39:02 +03:00
irungentoo
9ef4bab51d Fixed bug. 2013-08-31 12:23:20 -04:00
irungentoo
a93980e144 Cleaned up pull request. 2013-08-30 21:13:40 -04:00
redwire
ecddafd383 Made clang happy by taking definitions for the macro out of functions and adding declarations 2013-08-30 22:08:15 -02:30
redwire
4247eec969 Wrote a quicksort macro and modified sort_list to use it 2013-08-30 18:10:00 -02:30
irungentoo
dcabd6421c Merge branch 'master' of https://github.com/irungentoo/ProjectTox-Core 2013-08-30 14:22:12 -04:00
irungentoo
52c47a0820 Fixed possible crash. 2013-08-30 14:11:12 -04:00
irungentoo
0bd4edc0db Compiler fix. 2013-08-30 12:59:17 -04:00
irungentoo
bbc6b09579 put free_connections() back 2013-08-30 12:54:35 -04:00
irungentoo
41d4e02ca4 Fixed possible compiling problems on some compilers. 2013-08-30 12:34:57 -04:00
stal
0834e4ba31 Fix build error on non-linux machines. 2013-08-30 09:25:22 -07:00
irungentoo
f124cfaf46 Return values checking for tox_array_push_ptr in Lossless UDP. 2013-08-30 09:12:22 -04:00
irungentoo
ba5bd35a12 Fixed possible bugs in tox_array. 2013-08-30 08:52:53 -04:00
irungentoo
8f0bef5f20 Fixed warnings and moved hex_string_to_bin to testing/ 2013-08-30 08:16:34 -04:00
irungentoo
7441a234b7 Merge branch 'udp_connections' of https://github.com/vx-k/ProjectTox-Core into vx-k-udp_connections 2013-08-30 07:53:51 -04:00
Kostya
25563ac070 Fixed build errors. 2013-08-30 03:28:50 -04:00
Kostya
790867d984 Changed naming for IP union. 2013-08-30 03:02:11 -04:00
Kostya
8d71f67a72 Changed handshake code to use union IP_Port. 2013-08-30 02:58:30 -04:00
Kostya
d2d1af2ce9 Made IP_Port a union. 2013-08-30 02:51:15 -04:00
jin-eld
93e2e1eaa0 Sync makefile with source list
packets.h is now gone
2013-08-30 02:19:00 +03:00
irungentoo
0ed6ce80a0 Removed now useless file. 2013-08-29 19:09:30 -04:00
irungentoo
df4b1c6ee5 Removed packet structs.
They were causing problems on certain compiler configurations.
2013-08-29 19:06:09 -04:00
Anony Moose
eb33796e58 Moved misc_tools from testing to toxcore. 2013-08-29 22:54:54 +00:00
irungentoo
ea994606fe Merge branch 'master' of https://github.com/JamoBox/ProjectTox-Core into JamoBox-master
Conflicts:
	toxcore/LAN_discovery.h
2013-08-29 17:55:58 -04:00
pete
82b8927af7 Correct a lot of the grammar and spelling. Also spent a few hours fixing the comments so they follow a standard. 2013-08-29 22:17:51 +01:00
irungentoo
85940f94b2 Fixed bug. 2013-08-29 08:03:03 -04:00
irungentoo
1033c2d80e Fixed possible bug. 2013-08-28 20:51:01 -04:00
irungentoo
00507fadfd Removed some no longer needed ifdefs. 2013-08-28 18:23:37 -04:00
Anony Moose
31354d80d4 Fixed another thing in loop; added initialization for tox_array in lossless UDP. 2013-08-28 22:04:34 +00:00
Anony Moose
82a3eb9763
Fixed for loop counter errors. 2013-08-26 22:27:48 +00:00
Anony Moose
abaaef051c
Fixed several embarrassing errors and potential problems in tox_array. 2013-08-26 22:04:41 +00:00
Anony Moose
4e9d09f217 Merge branch 'master' of https://github.com/irungentoo/ProjectTox-Core into udp_connections 2013-08-26 21:02:34 +00:00
Anony Moose
fefa2bdea0 connection_id can be negative, so it shouldn't be uint32_t. 2013-08-26 20:36:32 +00:00
Anony Moose
79f759049b
Trying to fix memory leak. 2013-08-26 20:16:09 +00:00
jin-eld
ed1c130ebc Move extra libtool options into configure
This should allow to keep the libtool options all in one place and at
the same time define different options depending on the host.

Made sure that -no-undefined is set only on Win32. Although no side
effects on Linux and OSX have been observed so far, it's probably better
to play it safe; it does not seem to be needed/does not seem to matter on *nix,
only required for Win32.
2013-08-26 22:08:43 +03:00
jin-eld
634a67f627 Also generate a .dll in MinGW builds
Previously only static a static library was produced on MinGW builds,
this PR makes sure that we also build a proper .dll
2013-08-26 02:18:09 +03:00
Anony Moose
60bf9991b4 Made array stuff more readable. 2013-08-25 22:43:30 +00:00
Anony Moose
c23fbfa9f8
Removed commented code and fixed broken functions for Lossless_UDP tox_array. 2013-08-25 22:06:54 +00:00
Anony Moose
76761a605b Modified Lossless_UDP connections to work with tox_array. 2013-08-25 17:55:54 +00:00
jin-eld
1ec70337cf Remove cmake build system 2013-08-24 03:36:43 +03:00
jin-eld
50c8a820e5 Implemented autotools based build scripts
supported options:

--with-dependency-search=DIR    will tell configure to look for various
dependencies in DIR/include and DIR/lib

Alternatively you can also specify libsodium header and libs location
with --with-libsodium-headers and --with-libsodium-libs if it is
installed elsewhere.

Ncurses and libconfig are handled via the default pkg-config way, see
./configure --help=short for detailed information.

The tox library is compiled as libtoxcore in shared and static variants,
public headers are installed to ${prefix}/include/tox

A pkg-config libtoxcore.pc configuration file is provided.

Use ./configure --help for a full list of configure options or
./configure --help=short for the options that I added.

To generate the configure script after pulling from git use:
autoreconf -i

To generate a release tarball use:
make dist

Unit tests are handled by the libcheck library integration that is provided
by autotools, use:
make check

to compile and run the tests.

Unit tests are currently optional, i.e. - if the check library is not
found on the system, then tests will be disabled. Same goes for nTox and
DHT bootstrap daemon - they will be enabled or disabled depending on the
availability of ncurses (for nTox) or libconfig (for DHT bootstrap
daemon).

The above can be also tuned by:
--enable-tests / --disable-tests
--enable-ntox / --disable-ntox
--enable-dht-bootstrap-daemon / --disable-dht-bootstrap-daemon
2013-08-24 03:25:07 +03: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