Commit Graph

443 Commits

Author SHA1 Message Date
irungentoo
71f7a49402 Auto delete inactive peers in the group chat. 2013-11-05 20:41:33 -05:00
irungentoo
78793140ef Send ping packets in group chats every 30 seconds. 2013-11-04 21:03:27 -05:00
irungentoo
2e6250ee44 The group chats we invite a friend to are now stored. 2013-11-03 17:39:49 -05:00
irungentoo
41e083c173 Fixed possible issue. 2013-11-02 23:14:56 -04:00
irungentoo
91c9dc2464 Get node testing response packets are now handled. 2013-11-02 23:04:03 -04:00
irungentoo
beaa31bebc Testing requests are now sent. 2013-10-30 19:50:06 -04:00
irungentoo
415835ce3d Merge branch 'master' into harden
Also removed some old, useless loading code.
2013-10-28 16:01:29 -04:00
irungentoo
988922bdeb Removed some now useless code. 2013-10-28 15:52:46 -04:00
irungentoo
d2ab13c611 Cleaned up some code/fixed some warnings.
I'm sure nobody has any of the old save files anymore so I removed the
functions.
2013-10-27 20:25:31 -04:00
irungentoo
f607d66f39 Added some hardening functions to test get nodes. 2013-10-27 20:13:20 -04:00
irungentoo
f7040726a1 Increased port range. 2013-10-26 23:17:11 -04:00
irungentoo
05a5184dc0 Clarified a comment. 2013-10-26 18:11:55 -04:00
irungentoo
a6edd9dad6 Base of hardening stuff. 2013-10-26 17:35:55 -04:00
irungentoo
bbef18ab4e Update time before running functions for recieved packets. 2013-10-25 14:55:46 -04:00
irungentoo
9ccdac0e82 All modules using unix_time should run unix_time_update() 2013-10-25 14:47:34 -04:00
irungentoo
b891446c31 For security reasons, keep memcpy's and memcmp's in crypto functions. 2013-10-25 14:43:47 -04:00
irungentoo
bb0ec76de3 Fixed build error with libsodium. 2013-10-24 19:13:19 -04:00
irungentoo
55692665dc Removed now useless ping_id from send/get node packets. 2013-10-24 18:59:00 -04:00
irungentoo
f7b90f1060 Adding encrypted data to send/getnode packets now done. 2013-10-24 17:39:14 -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
bba10544e7 Added symmetric crypto functions to net_crypto. 2013-10-24 15:55:52 -04:00
irungentoo
9bef5f5bff Adding encrypted data to send/getnode packets part 1. 2013-10-24 14:10:55 -04:00
irungentoo
8e0ab68d30 Removed define that could become confusing. 2013-10-24 13:34:04 -04:00
irungentoo
2e75648f51 Code cleanups. 2013-10-23 14:42:39 -04:00
irungentoo
a67b4f8c6d Code cleanups. 2013-10-23 14:32:09 -04:00
Bahkuh
f581e20233 This squash should work now. 2013-10-22 20:24:48 +02:00
irungentoo
be06888517 Fixed possible bug. 2013-10-20 16:00:30 -04:00
irungentoo
9303c18b0c Merge branch 'Cleanup-defines' of https://github.com/FullName/ProjectTox-Core into FullName-Cleanup-defines 2013-10-20 15:12:46 -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
irungentoo
1ad9e6d8ac Merge branch 'master' of https://github.com/irungentoo/ProjectTox-Core 2013-10-19 22:30:23 -04:00
irungentoo
147d820ad2 Fixed connection sometimes being too slow and some other possible problems. 2013-10-19 22:29:48 -04:00
Antonio Montes
3df81b07f3 fixed build errors on windows 2013-10-19 11:14:03 -07:00
irungentoo
368231b4f8 Removed bad function from public API (This breaks toxic.) 2013-10-18 22:42:12 -04:00
Bahkuh
ff11e7398b Fixed minor typo. 2013-10-17 14:25:44 +02:00
irungentoo
6952daa042 Updated public api. 2013-10-15 17:34:22 -04:00
irungentoo
0aa6ba8e28 Added resume support if the connection breaks during file sending. 2013-10-15 17:23:00 -04:00
irungentoo
a81b708eb5 A/V integration in progress.
Added functions to send/receive msi packets via secure messenger
connections.

Made function to get the ip/port of a friend in Messenger.c public
2013-10-13 22:07:30 -04:00
irungentoo
dc1c019a2d Small fix. 2013-10-13 10:43:53 -04: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
irungentoo
f2497b6589 Improved hole punching. 2013-10-12 18:51:59 -04:00
Maxim Biro
571412f911 Added message ids to action messages 2013-10-10 22:27:51 -04:00
naxuroqa
a60ffa9591 fix for missing EAGAIN definition on windows 2013-10-09 10:49:27 +02:00
irungentoo
4aa507b664 Added function to get the piece size for sending files. 2013-10-08 18:55:35 -04:00
irungentoo
3658c372a4 Merge pull request #609 from FullName/wait
Add tox_wait() for socket, allow tox.h include in tox.c
2013-10-07 14:13:07 -07:00
irungentoo
94691bfe0e Code cleanups. 2013-10-06 17:44:31 -04:00
irungentoo
6ef2b5ead6 Code cleanups. 2013-10-06 17:40:23 -04:00
Coren[m]
24e4a70105 Oops. Didn't pass along the results from inside to outside... 2013-10-06 17:22:40 +02:00
Coren[m]
40e020b958 Merge remote-tracking branch 'upstream/master' into wait: replace void *tox with Tox *tox in tox.c (which now includes the declarations from tox.h) 2013-10-06 16:53:13 +02:00
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