ffi-tox 0.1.1 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. checksums.yaml +4 -4
  2. data/ProjectTox-Core/AUTHORS +0 -0
  3. data/ProjectTox-Core/ChangeLog +0 -0
  4. data/ProjectTox-Core/INSTALL +370 -0
  5. data/ProjectTox-Core/INSTALL.md +455 -56
  6. data/ProjectTox-Core/Makefile.am +35 -0
  7. data/ProjectTox-Core/NEWS +0 -0
  8. data/ProjectTox-Core/README +43 -0
  9. data/ProjectTox-Core/README.md +34 -44
  10. data/ProjectTox-Core/auto_tests/Makefile.inc +110 -0
  11. data/ProjectTox-Core/auto_tests/TCP_test.c +519 -0
  12. data/ProjectTox-Core/auto_tests/assoc_test.c +160 -0
  13. data/ProjectTox-Core/auto_tests/crypto_test.c +302 -0
  14. data/ProjectTox-Core/auto_tests/dht_test.c +362 -0
  15. data/ProjectTox-Core/auto_tests/encryptsave_test.c +104 -0
  16. data/ProjectTox-Core/auto_tests/friends_test.c +238 -0
  17. data/ProjectTox-Core/auto_tests/helpers.h +15 -0
  18. data/ProjectTox-Core/auto_tests/messenger_test.c +365 -0
  19. data/ProjectTox-Core/auto_tests/network_test.c +171 -0
  20. data/ProjectTox-Core/auto_tests/onion_test.c +363 -0
  21. data/ProjectTox-Core/auto_tests/skeleton_test.c +49 -0
  22. data/ProjectTox-Core/auto_tests/tox_test.c +454 -0
  23. data/ProjectTox-Core/auto_tests/toxav_basic_test.c +597 -0
  24. data/ProjectTox-Core/auto_tests/toxav_many_test.c +402 -0
  25. data/ProjectTox-Core/autogen.sh +6 -0
  26. data/ProjectTox-Core/build/Makefile.am +14 -0
  27. data/ProjectTox-Core/configure.ac +694 -0
  28. data/ProjectTox-Core/dist-build/android-arm.sh +3 -0
  29. data/ProjectTox-Core/dist-build/android-armv7.sh +3 -0
  30. data/ProjectTox-Core/dist-build/android-build.sh +59 -0
  31. data/ProjectTox-Core/dist-build/android-mips.sh +3 -0
  32. data/ProjectTox-Core/dist-build/android-x86.sh +3 -0
  33. data/ProjectTox-Core/docs/Group-Chats.md +71 -0
  34. data/ProjectTox-Core/docs/Hardening.txt +60 -0
  35. data/ProjectTox-Core/docs/Hardening_docs.txt +30 -0
  36. data/ProjectTox-Core/docs/Prevent_Tracking.txt +160 -0
  37. data/ProjectTox-Core/docs/TCP_Network.txt +154 -0
  38. data/ProjectTox-Core/docs/TODO +62 -0
  39. data/ProjectTox-Core/docs/Tox_middle_level_network_protocol.txt +120 -0
  40. data/ProjectTox-Core/docs/av_api.md +194 -0
  41. data/ProjectTox-Core/libtoxav.pc.in +11 -0
  42. data/ProjectTox-Core/libtoxcore.pc.in +11 -0
  43. data/ProjectTox-Core/m4/ax_have_epoll.m4 +104 -0
  44. data/ProjectTox-Core/m4/ax_pthread.m4 +317 -0
  45. data/ProjectTox-Core/m4/pkg.m4 +199 -0
  46. data/ProjectTox-Core/other/DHT_bootstrap.c +121 -58
  47. data/ProjectTox-Core/other/DHTnodes +3 -0
  48. data/ProjectTox-Core/other/Makefile.inc +20 -0
  49. data/ProjectTox-Core/other/bootstrap_node_packets.c +65 -0
  50. data/ProjectTox-Core/other/tox.png +0 -0
  51. data/ProjectTox-Core/testing/DHT_test.c +170 -98
  52. data/ProjectTox-Core/testing/Makefile.inc +112 -0
  53. data/ProjectTox-Core/testing/Messenger_test.c +133 -69
  54. data/ProjectTox-Core/testing/dns3_test.c +115 -0
  55. data/ProjectTox-Core/testing/misc_tools.c +59 -13
  56. data/ProjectTox-Core/testing/nTox.c +1127 -264
  57. data/ProjectTox-Core/testing/nTox.h +10 -19
  58. data/ProjectTox-Core/testing/tox_shell.c +159 -0
  59. data/ProjectTox-Core/testing/tox_sync.c +299 -0
  60. data/ProjectTox-Core/tools/README +11 -0
  61. data/ProjectTox-Core/tools/astylerc +11 -0
  62. data/ProjectTox-Core/tools/pre-commit +17 -0
  63. data/ProjectTox-Core/toxav/Makefile.inc +36 -0
  64. data/ProjectTox-Core/toxav/codec.c +357 -0
  65. data/ProjectTox-Core/toxav/codec.h +116 -0
  66. data/ProjectTox-Core/toxav/msi.c +1949 -0
  67. data/ProjectTox-Core/toxav/msi.h +267 -0
  68. data/ProjectTox-Core/toxav/rtp.c +600 -0
  69. data/ProjectTox-Core/toxav/rtp.h +196 -0
  70. data/ProjectTox-Core/toxav/toxav.c +1148 -0
  71. data/ProjectTox-Core/toxav/toxav.h +389 -0
  72. data/ProjectTox-Core/toxcore/DHT.c +2521 -0
  73. data/ProjectTox-Core/toxcore/DHT.h +412 -0
  74. data/ProjectTox-Core/toxcore/LAN_discovery.c +322 -0
  75. data/ProjectTox-Core/{core → toxcore}/LAN_discovery.h +17 -12
  76. data/ProjectTox-Core/toxcore/Makefile.inc +67 -0
  77. data/ProjectTox-Core/toxcore/Messenger.c +3006 -0
  78. data/ProjectTox-Core/toxcore/Messenger.h +818 -0
  79. data/ProjectTox-Core/toxcore/TCP_client.c +858 -0
  80. data/ProjectTox-Core/toxcore/TCP_client.h +156 -0
  81. data/ProjectTox-Core/toxcore/TCP_server.c +1332 -0
  82. data/ProjectTox-Core/toxcore/TCP_server.h +181 -0
  83. data/ProjectTox-Core/toxcore/assoc.c +1033 -0
  84. data/ProjectTox-Core/toxcore/assoc.h +104 -0
  85. data/ProjectTox-Core/toxcore/crypto_core.c +278 -0
  86. data/ProjectTox-Core/toxcore/crypto_core.h +151 -0
  87. data/ProjectTox-Core/toxcore/friend_requests.c +175 -0
  88. data/ProjectTox-Core/toxcore/friend_requests.h +83 -0
  89. data/ProjectTox-Core/toxcore/group_chats.c +837 -0
  90. data/ProjectTox-Core/toxcore/group_chats.h +199 -0
  91. data/ProjectTox-Core/toxcore/list.c +256 -0
  92. data/ProjectTox-Core/toxcore/list.h +85 -0
  93. data/ProjectTox-Core/toxcore/logger.c +153 -0
  94. data/ProjectTox-Core/toxcore/logger.h +84 -0
  95. data/ProjectTox-Core/toxcore/misc_tools.h +70 -0
  96. data/ProjectTox-Core/toxcore/net_crypto.c +2753 -0
  97. data/ProjectTox-Core/toxcore/net_crypto.h +410 -0
  98. data/ProjectTox-Core/toxcore/network.c +979 -0
  99. data/ProjectTox-Core/toxcore/network.h +367 -0
  100. data/ProjectTox-Core/toxcore/onion.c +540 -0
  101. data/ProjectTox-Core/toxcore/onion.h +150 -0
  102. data/ProjectTox-Core/toxcore/onion_announce.c +433 -0
  103. data/ProjectTox-Core/toxcore/onion_announce.h +139 -0
  104. data/ProjectTox-Core/toxcore/onion_client.c +1347 -0
  105. data/ProjectTox-Core/toxcore/onion_client.h +253 -0
  106. data/ProjectTox-Core/toxcore/ping.c +346 -0
  107. data/ProjectTox-Core/toxcore/ping.h +47 -0
  108. data/ProjectTox-Core/toxcore/ping_array.c +162 -0
  109. data/ProjectTox-Core/toxcore/ping_array.h +75 -0
  110. data/ProjectTox-Core/toxcore/tox.c +940 -0
  111. data/ProjectTox-Core/toxcore/tox.h +734 -0
  112. data/ProjectTox-Core/toxcore/util.c +193 -0
  113. data/ProjectTox-Core/toxcore/util.h +63 -0
  114. data/ProjectTox-Core/toxdns/Makefile.inc +29 -0
  115. data/ProjectTox-Core/toxdns/toxdns.c +238 -0
  116. data/ProjectTox-Core/toxdns/toxdns.h +88 -0
  117. data/ProjectTox-Core/toxencryptsave/Makefile.inc +45 -0
  118. data/ProjectTox-Core/toxencryptsave/toxencryptsave.c +179 -0
  119. data/ProjectTox-Core/toxencryptsave/toxencryptsave.h +74 -0
  120. data/interfaces/libtox.i +2 -6
  121. data/lib/ffi-tox/libtox.rb +406 -28
  122. metadata +124 -46
  123. data/ProjectTox-Core/CMakeLists.txt +0 -50
  124. data/ProjectTox-Core/cmake/FindLIBCONFIG.cmake +0 -15
  125. data/ProjectTox-Core/cmake/FindNaCl.cmake +0 -17
  126. data/ProjectTox-Core/cmake/FindSODIUM.cmake +0 -15
  127. data/ProjectTox-Core/core/CMakeLists.txt +0 -19
  128. data/ProjectTox-Core/core/DHT.c +0 -1104
  129. data/ProjectTox-Core/core/DHT.h +0 -111
  130. data/ProjectTox-Core/core/LAN_discovery.c +0 -79
  131. data/ProjectTox-Core/core/Lossless_UDP.c +0 -755
  132. data/ProjectTox-Core/core/Lossless_UDP.h +0 -106
  133. data/ProjectTox-Core/core/Messenger.c +0 -596
  134. data/ProjectTox-Core/core/Messenger.h +0 -165
  135. data/ProjectTox-Core/core/friend_requests.c +0 -131
  136. data/ProjectTox-Core/core/friend_requests.h +0 -51
  137. data/ProjectTox-Core/core/net_crypto.c +0 -575
  138. data/ProjectTox-Core/core/net_crypto.h +0 -134
  139. data/ProjectTox-Core/core/network.c +0 -205
  140. data/ProjectTox-Core/core/network.h +0 -134
  141. data/ProjectTox-Core/docs/commands.md +0 -25
  142. data/ProjectTox-Core/docs/start_guide.de.md +0 -40
  143. data/ProjectTox-Core/docs/start_guide.md +0 -38
  144. data/ProjectTox-Core/other/CMakeLists.txt +0 -9
  145. data/ProjectTox-Core/testing/CMakeLists.txt +0 -18
  146. data/ProjectTox-Core/testing/DHT_cryptosendfiletest.c +0 -228
  147. data/ProjectTox-Core/testing/DHT_sendfiletest.c +0 -176
  148. data/ProjectTox-Core/testing/Lossless_UDP_testclient.c +0 -214
  149. data/ProjectTox-Core/testing/Lossless_UDP_testserver.c +0 -201
  150. data/ProjectTox-Core/testing/misc_tools.h +0 -29
  151. data/ProjectTox-Core/testing/nTox_win32.c +0 -387
  152. data/ProjectTox-Core/testing/nTox_win32.h +0 -40
  153. data/ProjectTox-Core/testing/rect.py +0 -45
@@ -0,0 +1,88 @@
1
+ /* toxdns.h
2
+ *
3
+ * Tox secure username DNS toxid resolving functions.
4
+ *
5
+ * Copyright (C) 2014 Tox project All Rights Reserved.
6
+ *
7
+ * This file is part of Tox.
8
+ *
9
+ * Tox is free software: you can redistribute it and/or modify
10
+ * it under the terms of the GNU General Public License as published by
11
+ * the Free Software Foundation, either version 3 of the License, or
12
+ * (at your option) any later version.
13
+ *
14
+ * Tox is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
+ * GNU General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU General Public License
20
+ * along with Tox. If not, see <http://www.gnu.org/licenses/>.
21
+ *
22
+ */
23
+
24
+ #ifndef TOXDNS_H
25
+ #define TOXDNS_H
26
+
27
+ #include <stdint.h>
28
+
29
+ /* Clients are encouraged to set this as the maximum length names can have. */
30
+ #define TOXDNS_MAX_RECOMMENDED_NAME_LENGTH 32
31
+
32
+ /* How to use this api to make secure tox dns3 requests:
33
+ *
34
+ * 1. Get the public key of a server that supports tox dns3.
35
+ * 2. use tox_dns3_new() to create a new object to create DNS requests
36
+ * and handle responses for that server.
37
+ * 3. Use tox_generate_dns3_string() to generate a string based on the name we want to query and a request_id
38
+ * that must be stored somewhere for when we want to decrypt the response.
39
+ * 4. take the string and use it for your DNS request like this:
40
+ * _4haaaaipr1o3mz0bxweox541airydbovqlbju51mb4p0ebxq.rlqdj4kkisbep2ks3fj2nvtmk4daduqiueabmexqva1jc._tox.utox.org
41
+ * 5. The TXT in the DNS you receive should look like this:
42
+ * v=tox3;id=2vgcxuycbuctvauik3plsv3d3aadv4zfjfhi3thaizwxinelrvigchv0ah3qjcsx5qhmaksb2lv2hm5cwbtx0yp
43
+ * 6. Take the id string and use it with tox_decrypt_dns3_TXT() and the request_id corresponding to the
44
+ * request we stored earlier to get the Tox id returned by the DNS server.
45
+ */
46
+
47
+ /* Create a new tox_dns3 object for server with server_public_key of size TOX_CLIENT_ID_SIZE.
48
+ *
49
+ * return Null on failure.
50
+ * return pointer object on success.
51
+ */
52
+ void *tox_dns3_new(uint8_t *server_public_key);
53
+
54
+ /* Destroy the tox dns3 object.
55
+ */
56
+ void tox_dns3_kill(void *dns3_object);
57
+
58
+ /* Generate a dns3 string of string_max_len used to query the dns server referred to by to
59
+ * dns3_object for a tox id registered to user with name of name_len.
60
+ *
61
+ * the uint32_t pointed by request_id will be set to the request id which must be passed to
62
+ * tox_decrypt_dns3_TXT() to correctly decode the response.
63
+ *
64
+ * This is what the string returned looks like:
65
+ * 4haaaaipr1o3mz0bxweox541airydbovqlbju51mb4p0ebxq.rlqdj4kkisbep2ks3fj2nvtmk4daduqiueabmexqva1jc
66
+ *
67
+ * returns length of string on success.
68
+ * returns -1 on failure.
69
+ */
70
+ int tox_generate_dns3_string(void *dns3_object, uint8_t *string, uint16_t string_max_len, uint32_t *request_id,
71
+ uint8_t *name, uint8_t name_len);
72
+
73
+ /* Decode and decrypt the id_record returned of length id_record_len into
74
+ * tox_id (needs to be at least TOX_FRIEND_ADDRESS_SIZE).
75
+ *
76
+ * request_id is the request id given by tox_generate_dns3_string() when creating the request.
77
+ *
78
+ * the id_record passed to this function should look somewhat like this:
79
+ * 2vgcxuycbuctvauik3plsv3d3aadv4zfjfhi3thaizwxinelrvigchv0ah3qjcsx5qhmaksb2lv2hm5cwbtx0yp
80
+ *
81
+ * returns -1 on failure.
82
+ * returns 0 on success.
83
+ *
84
+ */
85
+ int tox_decrypt_dns3_TXT(void *dns3_object, uint8_t *tox_id, uint8_t *id_record, uint32_t id_record_len,
86
+ uint32_t request_id);
87
+
88
+ #endif
@@ -0,0 +1,45 @@
1
+ lib_LTLIBRARIES += libtoxencryptsave.la
2
+
3
+ libtoxencryptsave_la_include_HEADERS = \
4
+ ../toxencryptsave/toxencryptsave.h
5
+
6
+ libtoxencryptsave_la_includedir = $(includedir)/tox
7
+
8
+ libtoxencryptsave_la_SOURCES = ../toxencryptsave/crypto_pwhash_scryptsalsa208sha256/crypto_pwhash_scryptsalsa208sha256.h \
9
+ ../toxencryptsave/crypto_pwhash_scryptsalsa208sha256/crypto_scrypt.h \
10
+ ../toxencryptsave/crypto_pwhash_scryptsalsa208sha256/pbkdf2-sha256.c \
11
+ ../toxencryptsave/crypto_pwhash_scryptsalsa208sha256/pwhash_scryptsalsa208sha256.c \
12
+ ../toxencryptsave/crypto_pwhash_scryptsalsa208sha256/runtime.h \
13
+ ../toxencryptsave/crypto_pwhash_scryptsalsa208sha256/utils.c \
14
+ ../toxencryptsave/crypto_pwhash_scryptsalsa208sha256/crypto_scrypt-common.c \
15
+ ../toxencryptsave/crypto_pwhash_scryptsalsa208sha256/export.h \
16
+ ../toxencryptsave/crypto_pwhash_scryptsalsa208sha256/pbkdf2-sha256.h \
17
+ ../toxencryptsave/crypto_pwhash_scryptsalsa208sha256/runtime.c \
18
+ ../toxencryptsave/crypto_pwhash_scryptsalsa208sha256/scrypt_platform.c \
19
+ ../toxencryptsave/crypto_pwhash_scryptsalsa208sha256/sysendian.h \
20
+ ../toxencryptsave/crypto_pwhash_scryptsalsa208sha256/utils.h \
21
+ ../toxencryptsave/crypto_pwhash_scryptsalsa208sha256/nosse/pwhash_scryptsalsa208sha256_nosse.c \
22
+ ../toxencryptsave/crypto_pwhash_scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c \
23
+ ../toxencryptsave/toxencryptsave.h \
24
+ ../toxencryptsave/toxencryptsave.c
25
+
26
+
27
+ libtoxencryptsave_la_CFLAGS = -I$(top_srcdir) \
28
+ -I$(top_srcdir)/toxcore \
29
+ $(LIBSODIUM_CFLAGS) \
30
+ $(NACL_CFLAGS) \
31
+ $(PTHREAD_CFLAGS)
32
+
33
+ libtoxencryptsave_la_LDFLAGS = $(TOXCORE_LT_LDFLAGS) \
34
+ $(EXTRA_LT_LDFLAGS) \
35
+ $(LIBSODIUM_LDFLAGS) \
36
+ $(NACL_LDFLAGS) \
37
+ $(MATH_LDFLAGS) \
38
+ $(RT_LIBS) \
39
+ $(WINSOCK2_LIBS)
40
+
41
+ libtoxencryptsave_la_LIBADD = $(LIBSODIUM_LIBS) \
42
+ $(NACL_OBJECTS) \
43
+ $(NAC_LIBS) \
44
+ $(PTHREAD_LIBS) \
45
+ libtoxcore.la
@@ -0,0 +1,179 @@
1
+ /* toxencryptsave.c
2
+ *
3
+ * The Tox encrypted save functions.
4
+ *
5
+ * Copyright (C) 2013 Tox project All Rights Reserved.
6
+ *
7
+ * This file is part of Tox.
8
+ *
9
+ * Tox is free software: you can redistribute it and/or modify
10
+ * it under the terms of the GNU General Public License as published by
11
+ * the Free Software Foundation, either version 3 of the License, or
12
+ * (at your option) any later version.
13
+ *
14
+ * Tox is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
+ * GNU General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU General Public License
20
+ * along with Tox. If not, see <http://www.gnu.org/licenses/>.
21
+ *
22
+ */
23
+
24
+ #ifdef HAVE_CONFIG_H
25
+ #include "config.h"
26
+ #endif
27
+
28
+ #include "toxencryptsave.h"
29
+ #include "../toxcore/crypto_core.h"
30
+ #include "../toxcore/tox.h"
31
+
32
+ #ifdef VANILLA_NACL
33
+ #include "crypto_pwhash_scryptsalsa208sha256/crypto_pwhash_scryptsalsa208sha256.h"
34
+ #include "crypto_pwhash_scryptsalsa208sha256/utils.h" /* sodium_memzero */
35
+ #include <crypto_hash_sha256.h>
36
+ #endif
37
+
38
+ /* This "module" provides functions analogous to tox_load and tox_save in toxcore
39
+ * Clients should consider alerting their users that, unlike plain data, if even one bit
40
+ * becomes corrupted, the data will be entirely unrecoverable.
41
+ * Ditto if they forget their password, there is no way to recover the data.
42
+ */
43
+
44
+ /* return size of the messenger data (for encrypted saving). */
45
+ uint32_t tox_encrypted_size(const Tox *tox)
46
+ {
47
+ return tox_size(tox) + crypto_box_MACBYTES + crypto_box_NONCEBYTES
48
+ + crypto_pwhash_scryptsalsa208sha256_SALTBYTES + TOX_ENC_SAVE_MAGIC_LENGTH;
49
+ }
50
+
51
+ /* Save the messenger data encrypted with the given password.
52
+ * data must be at least tox_encrypted_size().
53
+ *
54
+ * returns 0 on success
55
+ * returns -1 on failure
56
+ */
57
+ int tox_encrypted_save(const Tox *tox, uint8_t *data, uint8_t *passphrase, uint32_t pplength)
58
+ {
59
+ if (pplength == 0)
60
+ return -1;
61
+
62
+ uint8_t passkey[crypto_hash_sha256_BYTES];
63
+ crypto_hash_sha256(passkey, passphrase, pplength);
64
+ /* First derive a key from the password */
65
+ /* http://doc.libsodium.org/key_derivation/README.html */
66
+ /* note that, according to the documentation, a generic pwhash interface will be created
67
+ * once the pwhash competition (https://password-hashing.net/) is over */
68
+ uint8_t salt[crypto_pwhash_scryptsalsa208sha256_SALTBYTES];
69
+ uint8_t key[crypto_box_KEYBYTES];
70
+ randombytes(salt, sizeof salt);
71
+
72
+ if (crypto_pwhash_scryptsalsa208sha256(
73
+ key, sizeof(key), passkey, sizeof(passkey), salt,
74
+ crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE * 2, /* slightly stronger */
75
+ crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE) != 0) {
76
+ /* out of memory most likely */
77
+ return -1;
78
+ }
79
+
80
+ sodium_memzero(passkey, crypto_hash_sha256_BYTES); /* wipe plaintext pw */
81
+
82
+ /* next get plain save data */
83
+ uint32_t temp_size = tox_size(tox);
84
+ uint8_t temp_data[temp_size];
85
+ tox_save(tox, temp_data);
86
+
87
+ /* the output data consists of, in order:
88
+ * magic number, salt, nonce, mac, enc_data
89
+ * where the mac is automatically prepended by the encrypt()
90
+ * the magic+salt+nonce is called the prefix
91
+ * I'm not sure what else I'm supposed to do with the salt and nonce, since we
92
+ * need them to decrypt the data
93
+ */
94
+
95
+ /* first add the prefix */
96
+ uint8_t nonce[crypto_box_NONCEBYTES];
97
+ random_nonce(nonce);
98
+
99
+ memcpy(data, TOX_ENC_SAVE_MAGIC_NUMBER, TOX_ENC_SAVE_MAGIC_LENGTH);
100
+ data += TOX_ENC_SAVE_MAGIC_LENGTH;
101
+ memcpy(data, salt, crypto_pwhash_scryptsalsa208sha256_SALTBYTES);
102
+ data += crypto_pwhash_scryptsalsa208sha256_SALTBYTES;
103
+ memcpy(data, nonce, crypto_box_NONCEBYTES);
104
+ data += crypto_box_NONCEBYTES;
105
+
106
+ /* now encrypt */
107
+ if (encrypt_data_symmetric(key, nonce, temp_data, temp_size, data)
108
+ != temp_size + crypto_box_MACBYTES) {
109
+ return -1;
110
+ }
111
+
112
+ return 0;
113
+ }
114
+
115
+ /* Load the messenger from encrypted data of size length.
116
+ *
117
+ * returns 0 on success
118
+ * returns -1 on failure
119
+ */
120
+ int tox_encrypted_load(Tox *tox, const uint8_t *data, uint32_t length, uint8_t *passphrase, uint32_t pplength)
121
+ {
122
+ if (length <= crypto_box_MACBYTES + crypto_box_NONCEBYTES + crypto_pwhash_scryptsalsa208sha256_SALTBYTES +
123
+ TOX_ENC_SAVE_MAGIC_LENGTH)
124
+ return -1;
125
+
126
+ if (memcmp(data, TOX_ENC_SAVE_MAGIC_NUMBER, TOX_ENC_SAVE_MAGIC_LENGTH) != 0)
127
+ return -1;
128
+
129
+ data += TOX_ENC_SAVE_MAGIC_LENGTH;
130
+
131
+ uint32_t decrypt_length = length - crypto_box_MACBYTES - crypto_box_NONCEBYTES
132
+ - crypto_pwhash_scryptsalsa208sha256_SALTBYTES - TOX_ENC_SAVE_MAGIC_LENGTH;
133
+ uint8_t salt[crypto_pwhash_scryptsalsa208sha256_SALTBYTES];
134
+ uint8_t nonce[crypto_box_NONCEBYTES];
135
+
136
+ uint8_t passkey[crypto_hash_sha256_BYTES];
137
+ crypto_hash_sha256(passkey, passphrase, pplength);
138
+
139
+ memcpy(salt, data, crypto_pwhash_scryptsalsa208sha256_SALTBYTES);
140
+ data += crypto_pwhash_scryptsalsa208sha256_SALTBYTES;
141
+ memcpy(nonce, data, crypto_box_NONCEBYTES);
142
+ data += crypto_box_NONCEBYTES;
143
+
144
+ /* derive the key */
145
+ uint8_t key[crypto_box_KEYBYTES];
146
+
147
+ if (crypto_pwhash_scryptsalsa208sha256(
148
+ key, sizeof(key), passkey, sizeof(passkey), salt,
149
+ crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE * 2, /* slightly stronger */
150
+ crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE) != 0) {
151
+ /* out of memory most likely */
152
+ return -1;
153
+ }
154
+
155
+ sodium_memzero(passkey, crypto_hash_sha256_BYTES); /* wipe plaintext pw */
156
+
157
+ /* decrypt the data */
158
+ uint8_t temp_data[decrypt_length];
159
+
160
+ if (decrypt_data_symmetric(key, nonce, data, decrypt_length + crypto_box_MACBYTES, temp_data)
161
+ != decrypt_length) {
162
+ return -1;
163
+ }
164
+
165
+ return tox_load(tox, temp_data, decrypt_length);
166
+ }
167
+
168
+ /* Determines whether or not the given data is encrypted (by checking the magic number)
169
+ *
170
+ * returns 1 if it is encrypted
171
+ * returns 0 otherwise
172
+ */
173
+ int tox_is_data_encrypted(const uint8_t *data)
174
+ {
175
+ if (memcmp(data, TOX_ENC_SAVE_MAGIC_NUMBER, TOX_ENC_SAVE_MAGIC_LENGTH) == 0)
176
+ return 1;
177
+ else
178
+ return 0;
179
+ }
@@ -0,0 +1,74 @@
1
+ /* toxencryptsave.h
2
+ *
3
+ * The Tox encrypted save functions.
4
+ *
5
+ * Copyright (C) 2013 Tox project All Rights Reserved.
6
+ *
7
+ * This file is part of Tox.
8
+ *
9
+ * Tox is free software: you can redistribute it and/or modify
10
+ * it under the terms of the GNU General Public License as published by
11
+ * the Free Software Foundation, either version 3 of the License, or
12
+ * (at your option) any later version.
13
+ *
14
+ * Tox is distributed in the hope that it will be useful,
15
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
+ * GNU General Public License for more details.
18
+ *
19
+ * You should have received a copy of the GNU General Public License
20
+ * along with Tox. If not, see <http://www.gnu.org/licenses/>.
21
+ *
22
+ */
23
+
24
+ #ifndef TOXENCRYPTSAVE_H
25
+ #define TOXENCRYPTSAVE_H
26
+
27
+ #ifdef __cplusplus
28
+ extern "C" {
29
+ #endif
30
+
31
+ #include <stdint.h>
32
+
33
+ #ifndef __TOX_DEFINED__
34
+ #define __TOX_DEFINED__
35
+ typedef struct Tox Tox;
36
+ #endif
37
+
38
+
39
+ /* This "module" provides functions analogous to tox_load and tox_save in toxcore
40
+ * Clients should consider alerting their users that, unlike plain data, if even one bit
41
+ * becomes corrupted, the data will be entirely unrecoverable.
42
+ * Ditto if they forget their password, there is no way to recover the data.
43
+ */
44
+
45
+ /* return size of the messenger data (for encrypted saving). */
46
+ uint32_t tox_encrypted_size(const Tox *tox);
47
+
48
+ /* Save the messenger data encrypted with the given password.
49
+ * data must be at least tox_encrypted_size().
50
+ *
51
+ * returns 0 on success
52
+ * returns -1 on failure
53
+ */
54
+ int tox_encrypted_save(const Tox *tox, uint8_t *data, uint8_t *passphrase, uint32_t pplength);
55
+
56
+ /* Load the messenger from encrypted data of size length.
57
+ *
58
+ * returns 0 on success
59
+ * returns -1 on failure
60
+ */
61
+ int tox_encrypted_load(Tox *tox, const uint8_t *data, uint32_t length, uint8_t *passphrase, uint32_t pplength);
62
+
63
+ /* Determines whether or not the given data is encrypted (by checking the magic number)
64
+ *
65
+ * returns 1 if it is encrypted
66
+ * returns 0 otherwise
67
+ */
68
+ int tox_is_data_encrypted(const uint8_t *data);
69
+
70
+ #ifdef __cplusplus
71
+ }
72
+ #endif
73
+
74
+ #endif
@@ -8,15 +8,11 @@ module Tox
8
8
  uint16_t = :uint16
9
9
  uint32_t = :uint32
10
10
  attach_variable 'self_public_key', FFI::ArrayType.new(FFI::TYPE_UINT8,32)
11
- # attach_variable 'self_name', :uint8
12
- # attach_variable 'self_name_length', :uint16
13
- # attach_variable 'self_userstatus', :pointer
14
- # attach_variable 'self_userstatus_len', :uint16
15
- # attach_variable 'numfriends', :uint32
11
+ attach_function 'getnumfriends', [], :int
16
12
  %}
17
13
 
18
14
  /* Parse the header file to generate wrappers */
19
- %include "../ProjectTox-Core/core/Messenger.h"
15
+ %include "../ProjectTox-Core/toxcore/Messenger.h"
20
16
 
21
17
  %{
22
18
  end
@@ -7,37 +7,415 @@ module Tox
7
7
  uint16_t = :uint16
8
8
  uint32_t = :uint32
9
9
  attach_variable 'self_public_key', FFI::ArrayType.new(FFI::TYPE_UINT8,32)
10
- # attach_variable 'self_name', :uint8
11
- # attach_variable 'self_name_length', :uint16
12
- # attach_variable 'self_userstatus', :pointer
13
- # attach_variable 'self_userstatus_len', :uint16
14
- # attach_variable 'numfriends', :uint32
10
+ attach_function 'getnumfriends', [], :int
15
11
  MAX_NAME_LENGTH = 128
16
- MAX_USERSTATUS_LENGTH = 128
12
+ MAX_STATUSMESSAGE_LENGTH = 1007
13
+ PACKET_ID_ALIVE = 16
14
+ PACKET_ID_SHARE_RELAYS = 17
17
15
  PACKET_ID_NICKNAME = 48
18
- PACKET_ID_USERSTATUS = 49
16
+ PACKET_ID_STATUSMESSAGE = 49
17
+ PACKET_ID_USERSTATUS = 50
18
+ PACKET_ID_TYPING = 51
19
+ PACKET_ID_RECEIPT = 63
19
20
  PACKET_ID_MESSAGE = 64
20
- attach_function :m_addfriend, [ :pointer, :pointer, uint16_t ], :int
21
- attach_function :m_addfriend_norequest, [ :pointer ], :int
22
- attach_function :getfriend_id, [ :pointer ], :int
23
- attach_function :getclient_id, [ :int, :pointer ], :int
24
- attach_function :m_delfriend, [ :int ], :int
25
- attach_function :m_friendstatus, [ :int ], :int
26
- attach_function :m_sendmessage, [ :int, :pointer, uint32_t ], :int
27
- attach_function :setname, [ :pointer, uint16_t ], :int
28
- attach_function :getname, [ :int, :pointer ], :int
29
- attach_function :m_set_userstatus, [ :pointer, uint16_t ], :int
30
- attach_function :m_get_userstatus_size, [ :int ], :int
31
- attach_function :m_copy_userstatus, [ :int, :pointer, uint32_t ], :int
32
- attach_function :m_callback_friendrequest, [ callback([ :pointer, :pointer, uint16_t ], :void) ], :void
33
- attach_function :m_callback_friendmessage, [ callback([ :int, :pointer, uint16_t ], :void) ], :void
34
- attach_function :m_callback_namechange, [ callback([ :int, :pointer, uint16_t ], :void) ], :void
35
- attach_function :m_callback_userstatus, [ callback([ :int, :pointer, uint16_t ], :void) ], :void
36
- attach_function :initMessenger, [ ], :int
37
- attach_function :doMessenger, [ ], :void
38
- attach_function :Messenger_size, [ ], uint32_t
39
- attach_function :Messenger_save, [ :pointer ], :void
40
- attach_function :Messenger_load, [ :pointer, uint32_t ], :int
21
+ PACKET_ID_ACTION = 65
22
+ PACKET_ID_MSI = 69
23
+ PACKET_ID_FILE_SENDREQUEST = 80
24
+ PACKET_ID_FILE_CONTROL = 81
25
+ PACKET_ID_FILE_DATA = 82
26
+ PACKET_ID_INVITE_GROUPCHAT = 144
27
+ PACKET_ID_JOIN_GROUPCHAT = 145
28
+ PACKET_ID_ACCEPT_GROUPCHAT = 146
29
+ MAX_INVITED_GROUPS = 64
30
+ MAX_SHARED_RELAYS = 16
31
+ PACKET_ID_LOSSLESS_RANGE_START = 160
32
+ PACKET_ID_LOSSLESS_RANGE_SIZE = 32
33
+ class MessengerOptions < FFI::Struct
34
+ layout(
35
+ :ipv6enabled, uint8_t,
36
+ :udp_disabled, uint8_t,
37
+ :proxy_enabled, uint8_t,
38
+ :proxy_info, TCP_Proxy_Info
39
+ )
40
+ end
41
+ NOFRIEND = 0
42
+ FRIEND_ADDED = 1
43
+ FRIEND_REQUESTED = 2
44
+ FRIEND_CONFIRMED = 3
45
+ FRIEND_ONLINE = 4
46
+
47
+ FAERR_TOOLONG = -1
48
+ FAERR_NOMESSAGE = -2
49
+ FAERR_OWNKEY = -3
50
+ FAERR_ALREADYSENT = -4
51
+ FAERR_UNKNOWN = -5
52
+ FAERR_BADCHECKSUM = -6
53
+ FAERR_SETNEWNOSPAM = -7
54
+ FAERR_NOMEM = -8
55
+
56
+ FRIENDREQUEST_TIMEOUT = 5
57
+ FRIEND_PING_INTERVAL = 6
58
+ FRIEND_SHARE_RELAYS_INTERVAL = (5*60)
59
+ FRIEND_CONNECTION_TIMEOUT = (6*3)
60
+ USERSTATUS_NONE = 0
61
+ USERSTATUS_AWAY = 1
62
+ USERSTATUS_BUSY = 2
63
+ USERSTATUS_INVALID = 3
64
+
65
+ class FileTransfers < FFI::Struct
66
+ layout(
67
+ :size, uint64_t,
68
+ :transferred, uint64_t,
69
+ :status, uint8_t
70
+ )
71
+ end
72
+ FILESTATUS_NONE = 0
73
+ FILESTATUS_NOT_ACCEPTED = 1
74
+ FILESTATUS_PAUSED_BY_OTHER = 2
75
+ FILESTATUS_TRANSFERRING = 3
76
+ FILESTATUS_BROKEN = 4
77
+ FILESTATUS_PAUSED_BY_US = 5
78
+ FILESTATUS_TEMPORARY = 6
79
+
80
+ MAX_CONCURRENT_FILE_PIPES = 256
81
+ FILECONTROL_ACCEPT = 0
82
+ FILECONTROL_PAUSE = 1
83
+ FILECONTROL_KILL = 2
84
+ FILECONTROL_FINISHED = 3
85
+ FILECONTROL_RESUME_BROKEN = 4
86
+
87
+ class Friend < FFI::Struct
88
+ layout(
89
+ :client_id, a(CLIENT_ID_SIZE).uint8_t,
90
+ :onion_friendnum, uint32_t,
91
+ :crypt_connection_id, :int,
92
+ :friendrequest_lastsent, uint64_t,
93
+ :friendrequest_timeout, uint32_t,
94
+ :status, uint8_t,
95
+ :info, a(MAX_FRIEND_REQUEST_DATA_SIZE).uint8_t,
96
+ :name, [uint8_t, 128],
97
+ :name_length, uint16_t,
98
+ :name_sent, uint8_t,
99
+ :statusmessage, :pointer,
100
+ :statusmessage_length, uint16_t,
101
+ :statusmessage_sent, uint8_t,
102
+ :userstatus, :int,
103
+ :userstatus_sent, uint8_t,
104
+ :user_istyping, uint8_t,
105
+ :user_istyping_sent, uint8_t,
106
+ :is_typing, uint8_t,
107
+ :info_size, uint16_t,
108
+ :message_id, uint32_t,
109
+ :receives_read_receipts, uint8_t,
110
+ :friendrequest_nospam, uint32_t,
111
+ :ping_lastrecv, uint64_t,
112
+ :ping_lastsent, uint64_t,
113
+ :share_relays_lastsent, uint64_t,
114
+ :file_sending, [FileTransfers, 256],
115
+ :file_receiving, [FileTransfers, 256],
116
+ :invited_groups, [:int, 64],
117
+ :invited_groups_num, uint16_t,
118
+ :lossy_packethandlers, a(PACKET_ID_LOSSY_RANGE_SIZE).Friend_lossy_packethandlers,
119
+ :lossless_packethandlers, [Friend_lossless_packethandlers, 32]
120
+ )
121
+ end
122
+ class FriendLosslessPackethandlers < FFI::Struct
123
+ layout(
124
+ :function, callback([ :pointer, :pointer, uint32_t ], :int),
125
+ :object, :pointer
126
+ )
127
+ def function=(cb)
128
+ @function = cb
129
+ self[:function] = @function
130
+ end
131
+ def function
132
+ @function
133
+ end
134
+
135
+ end
136
+ class FriendLossyPackethandlers < FFI::Struct
137
+ layout(
138
+ :function, callback([ :pointer, :pointer, uint32_t ], :int),
139
+ :object, :pointer
140
+ )
141
+ def function=(cb)
142
+ @function = cb
143
+ self[:function] = @function
144
+ end
145
+ def function
146
+ @function
147
+ end
148
+
149
+ end
150
+ NUM_SAVED_TCP_RELAYS = 8
151
+ class Messenger < FFI::Struct
152
+ layout(
153
+ :net, :pointer,
154
+ :net_crypto, :pointer,
155
+ :dht, :pointer,
156
+ :onion, :pointer,
157
+ :onion_a, :pointer,
158
+ :onion_c, :pointer,
159
+ :fr, Friend_Requests,
160
+ :name, [uint8_t, 128],
161
+ :name_length, uint16_t,
162
+ :statusmessage, [uint8_t, 1007],
163
+ :statusmessage_length, uint16_t,
164
+ :userstatus, :int,
165
+ :friendlist, :pointer,
166
+ :numfriends, uint32_t,
167
+ :numonline_friends, uint32_t,
168
+ :chats, :pointer,
169
+ :numchats, uint32_t,
170
+ :last_LANdiscovery, uint64_t,
171
+ :has_added_relays, uint8_t,
172
+ :loaded_relays, [Node_format, 8],
173
+ :friend_message, callback([ :pointer, int32_t, :pointer, uint16_t, :pointer ], :void),
174
+ :friend_message_userdata, :pointer,
175
+ :friend_action, callback([ :pointer, int32_t, :pointer, uint16_t, :pointer ], :void),
176
+ :friend_action_userdata, :pointer,
177
+ :friend_namechange, callback([ :pointer, int32_t, :pointer, uint16_t, :pointer ], :void),
178
+ :friend_namechange_userdata, :pointer,
179
+ :friend_statusmessagechange, callback([ :pointer, int32_t, :pointer, uint16_t, :pointer ], :void),
180
+ :friend_statusmessagechange_userdata, :pointer,
181
+ :friend_userstatuschange, callback([ :pointer, int32_t, uint8_t, :pointer ], :void),
182
+ :friend_userstatuschange_userdata, :pointer,
183
+ :friend_typingchange, callback([ :pointer, int32_t, uint8_t, :pointer ], :void),
184
+ :friend_typingchange_userdata, :pointer,
185
+ :read_receipt, callback([ :pointer, int32_t, uint32_t, :pointer ], :void),
186
+ :read_receipt_userdata, :pointer,
187
+ :friend_statuschange, callback([ :pointer, int32_t, uint8_t, :pointer ], :void),
188
+ :friend_statuschange_userdata, :pointer,
189
+ :friend_connectionstatuschange, callback([ :pointer, int32_t, uint8_t, :pointer ], :void),
190
+ :friend_connectionstatuschange_userdata, :pointer,
191
+ :friend_connectionstatuschange_internal, callback([ :pointer, int32_t, uint8_t, :pointer ], :void),
192
+ :friend_connectionstatuschange_internal_userdata, :pointer,
193
+ :group_invite, callback([ :pointer, int32_t, :pointer, :pointer ], :void),
194
+ :group_invite_userdata, :pointer,
195
+ :group_message, callback([ :pointer, :int, :int, :pointer, uint16_t, :pointer ], :void),
196
+ :group_message_userdata, :pointer,
197
+ :group_action, callback([ :pointer, :int, :int, :pointer, uint16_t, :pointer ], :void),
198
+ :group_action_userdata, :pointer,
199
+ :group_namelistchange, callback([ :pointer, :int, :int, uint8_t, :pointer ], :void),
200
+ :group_namelistchange_userdata, :pointer,
201
+ :file_sendrequest, callback([ :pointer, int32_t, uint8_t, uint64_t, :pointer, uint16_t, :pointer ], :void),
202
+ :file_sendrequest_userdata, :pointer,
203
+ :file_filecontrol, callback([ :pointer, int32_t, uint8_t, uint8_t, uint8_t, :pointer, uint16_t, :pointer ], :void),
204
+ :file_filecontrol_userdata, :pointer,
205
+ :file_filedata, callback([ :pointer, int32_t, uint8_t, :pointer, uint16_t, :pointer ], :void),
206
+ :file_filedata_userdata, :pointer,
207
+ :msi_packet, callback([ :pointer, int32_t, :pointer, uint16_t, :pointer ], :void),
208
+ :msi_packet_userdata, :pointer,
209
+ :options, MessengerOptions
210
+ )
211
+ def friend_message=(cb)
212
+ @friend_message = cb
213
+ self[:friend_message] = @friend_message
214
+ end
215
+ def friend_message
216
+ @friend_message
217
+ end
218
+ def friend_action=(cb)
219
+ @friend_action = cb
220
+ self[:friend_action] = @friend_action
221
+ end
222
+ def friend_action
223
+ @friend_action
224
+ end
225
+ def friend_namechange=(cb)
226
+ @friend_namechange = cb
227
+ self[:friend_namechange] = @friend_namechange
228
+ end
229
+ def friend_namechange
230
+ @friend_namechange
231
+ end
232
+ def friend_statusmessagechange=(cb)
233
+ @friend_statusmessagechange = cb
234
+ self[:friend_statusmessagechange] = @friend_statusmessagechange
235
+ end
236
+ def friend_statusmessagechange
237
+ @friend_statusmessagechange
238
+ end
239
+ def friend_userstatuschange=(cb)
240
+ @friend_userstatuschange = cb
241
+ self[:friend_userstatuschange] = @friend_userstatuschange
242
+ end
243
+ def friend_userstatuschange
244
+ @friend_userstatuschange
245
+ end
246
+ def friend_typingchange=(cb)
247
+ @friend_typingchange = cb
248
+ self[:friend_typingchange] = @friend_typingchange
249
+ end
250
+ def friend_typingchange
251
+ @friend_typingchange
252
+ end
253
+ def read_receipt=(cb)
254
+ @read_receipt = cb
255
+ self[:read_receipt] = @read_receipt
256
+ end
257
+ def read_receipt
258
+ @read_receipt
259
+ end
260
+ def friend_statuschange=(cb)
261
+ @friend_statuschange = cb
262
+ self[:friend_statuschange] = @friend_statuschange
263
+ end
264
+ def friend_statuschange
265
+ @friend_statuschange
266
+ end
267
+ def friend_connectionstatuschange=(cb)
268
+ @friend_connectionstatuschange = cb
269
+ self[:friend_connectionstatuschange] = @friend_connectionstatuschange
270
+ end
271
+ def friend_connectionstatuschange
272
+ @friend_connectionstatuschange
273
+ end
274
+ def friend_connectionstatuschange_internal=(cb)
275
+ @friend_connectionstatuschange_internal = cb
276
+ self[:friend_connectionstatuschange_internal] = @friend_connectionstatuschange_internal
277
+ end
278
+ def friend_connectionstatuschange_internal
279
+ @friend_connectionstatuschange_internal
280
+ end
281
+ def group_invite=(cb)
282
+ @group_invite = cb
283
+ self[:group_invite] = @group_invite
284
+ end
285
+ def group_invite
286
+ @group_invite
287
+ end
288
+ def group_message=(cb)
289
+ @group_message = cb
290
+ self[:group_message] = @group_message
291
+ end
292
+ def group_message
293
+ @group_message
294
+ end
295
+ def group_action=(cb)
296
+ @group_action = cb
297
+ self[:group_action] = @group_action
298
+ end
299
+ def group_action
300
+ @group_action
301
+ end
302
+ def group_namelistchange=(cb)
303
+ @group_namelistchange = cb
304
+ self[:group_namelistchange] = @group_namelistchange
305
+ end
306
+ def group_namelistchange
307
+ @group_namelistchange
308
+ end
309
+ def file_sendrequest=(cb)
310
+ @file_sendrequest = cb
311
+ self[:file_sendrequest] = @file_sendrequest
312
+ end
313
+ def file_sendrequest
314
+ @file_sendrequest
315
+ end
316
+ def file_filecontrol=(cb)
317
+ @file_filecontrol = cb
318
+ self[:file_filecontrol] = @file_filecontrol
319
+ end
320
+ def file_filecontrol
321
+ @file_filecontrol
322
+ end
323
+ def file_filedata=(cb)
324
+ @file_filedata = cb
325
+ self[:file_filedata] = @file_filedata
326
+ end
327
+ def file_filedata
328
+ @file_filedata
329
+ end
330
+ def msi_packet=(cb)
331
+ @msi_packet = cb
332
+ self[:msi_packet] = @msi_packet
333
+ end
334
+ def msi_packet
335
+ @msi_packet
336
+ end
337
+
338
+ end
339
+ attach_function :getaddress, [ :pointer, :pointer ], :void
340
+ attach_function :m_addfriend, [ :pointer, :pointer, :pointer, uint16_t ], int32_t
341
+ attach_function :m_addfriend_norequest, [ :pointer, :pointer ], int32_t
342
+ attach_function :getfriend_id, [ :pointer, :pointer ], int32_t
343
+ attach_function :getclient_id, [ :pointer, int32_t, :pointer ], :int
344
+ attach_function :m_delfriend, [ :pointer, int32_t ], :int
345
+ attach_function :m_get_friend_connectionstatus, [ :pointer, int32_t ], :int
346
+ attach_function :m_friend_exists, [ :pointer, int32_t ], :int
347
+ attach_function :m_sendmessage, [ :pointer, int32_t, :pointer, uint32_t ], uint32_t
348
+ attach_function :m_sendmessage_withid, [ :pointer, int32_t, uint32_t, :pointer, uint32_t ], uint32_t
349
+ attach_function :m_sendaction, [ :pointer, int32_t, :pointer, uint32_t ], uint32_t
350
+ attach_function :m_sendaction_withid, [ :pointer, int32_t, uint32_t, :pointer, uint32_t ], uint32_t
351
+ attach_function :setfriendname, [ :pointer, int32_t, :pointer, uint16_t ], :int
352
+ attach_function :setname, [ :pointer, :pointer, uint16_t ], :int
353
+ attach_function :getself_name, [ :pointer, :pointer ], uint16_t
354
+ attach_function :getname, [ :pointer, int32_t, :pointer ], :int
355
+ attach_function :m_get_name_size, [ :pointer, int32_t ], :int
356
+ attach_function :m_get_self_name_size, [ :pointer ], :int
357
+ attach_function :m_set_statusmessage, [ :pointer, :pointer, uint16_t ], :int
358
+ attach_function :m_set_userstatus, [ :pointer, uint8_t ], :int
359
+ attach_function :m_get_statusmessage_size, [ :pointer, int32_t ], :int
360
+ attach_function :m_get_self_statusmessage_size, [ :pointer ], :int
361
+ attach_function :m_copy_statusmessage, [ :pointer, int32_t, :pointer, uint32_t ], :int
362
+ attach_function :m_copy_self_statusmessage, [ :pointer, :pointer, uint32_t ], :int
363
+ attach_function :m_get_userstatus, [ :pointer, int32_t ], uint8_t
364
+ attach_function :m_get_self_userstatus, [ :pointer ], uint8_t
365
+ attach_function :m_get_last_online, [ :pointer, int32_t ], uint64_t
366
+ attach_function :m_set_usertyping, [ :pointer, int32_t, uint8_t ], :int
367
+ attach_function :m_get_istyping, [ :pointer, int32_t ], uint8_t
368
+ attach_function :m_set_sends_receipts, [ :pointer, int32_t, :int ], :void
369
+ attach_function :m_callback_friendrequest, [ :pointer, callback([ :pointer, :pointer, :pointer, uint16_t, :pointer ], :void), :pointer ], :void
370
+ attach_function :m_callback_friendmessage, [ :pointer, callback([ :pointer, int32_t, :pointer, uint16_t, :pointer ], :void), :pointer ], :void
371
+ attach_function :m_callback_action, [ :pointer, callback([ :pointer, int32_t, :pointer, uint16_t, :pointer ], :void), :pointer ], :void
372
+ attach_function :m_callback_namechange, [ :pointer, callback([ :pointer, int32_t, :pointer, uint16_t, :pointer ], :void), :pointer ], :void
373
+ attach_function :m_callback_statusmessage, [ :pointer, callback([ :pointer, int32_t, :pointer, uint16_t, :pointer ], :void), :pointer ], :void
374
+ attach_function :m_callback_userstatus, [ :pointer, callback([ :pointer, int32_t, uint8_t, :pointer ], :void), :pointer ], :void
375
+ attach_function :m_callback_typingchange, [ :pointer, callback([ :pointer, int32_t, uint8_t, :pointer ], :void), :pointer ], :void
376
+ attach_function :m_callback_read_receipt, [ :pointer, callback([ :pointer, int32_t, uint32_t, :pointer ], :void), :pointer ], :void
377
+ attach_function :m_callback_connectionstatus, [ :pointer, callback([ :pointer, int32_t, uint8_t, :pointer ], :void), :pointer ], :void
378
+ attach_function :m_callback_connectionstatus_internal_av, [ :pointer, callback([ :pointer, int32_t, uint8_t, :pointer ], :void), :pointer ], :void
379
+ attach_function :m_callback_group_invite, [ :pointer, callback([ :pointer, int32_t, :pointer, :pointer ], :void), :pointer ], :void
380
+ attach_function :m_callback_group_message, [ :pointer, callback([ :pointer, :int, :int, :pointer, uint16_t, :pointer ], :void), :pointer ], :void
381
+ attach_function :m_callback_group_action, [ :pointer, callback([ :pointer, :int, :int, :pointer, uint16_t, :pointer ], :void), :pointer ], :void
382
+ attach_function :m_callback_group_namelistchange, [ :pointer, callback([ :pointer, :int, :int, uint8_t, :pointer ], :void), :pointer ], :void
383
+ attach_function :add_groupchat, [ :pointer ], :int
384
+ attach_function :del_groupchat, [ :pointer, :int ], :int
385
+ attach_function :m_group_peername, [ :pointer, :int, :int, :pointer ], :int
386
+ attach_function :invite_friend, [ :pointer, int32_t, :int ], :int
387
+ attach_function :join_groupchat, [ :pointer, int32_t, :pointer ], :int
388
+ attach_function :group_message_send, [ :pointer, :int, :pointer, uint32_t ], :int
389
+ attach_function :group_action_send, [ :pointer, :int, :pointer, uint32_t ], :int
390
+ attach_function :group_number_peers, [ :pointer, :int ], :int
391
+ attach_function :group_names, [ :pointer, :int, a().a(MAX_NICK_BYTES).uint8_t, a().uint16_t, uint16_t ], :int
392
+ attach_function :callback_file_sendrequest, [ :pointer, callback([ :pointer, int32_t, uint8_t, uint64_t, :pointer, uint16_t, :pointer ], :void), :pointer ], :void
393
+ attach_function :callback_file_control, [ :pointer, callback([ :pointer, int32_t, uint8_t, uint8_t, uint8_t, :pointer, uint16_t, :pointer ], :void), :pointer ], :void
394
+ attach_function :callback_file_data, [ :pointer, callback([ :pointer, int32_t, uint8_t, :pointer, uint16_t, :pointer ], :void), :pointer ], :void
395
+ attach_function :file_sendrequest, [ :pointer, int32_t, uint8_t, uint64_t, :pointer, uint16_t ], :int
396
+ attach_function :new_filesender, [ :pointer, int32_t, uint64_t, :pointer, uint16_t ], :int
397
+ attach_function :file_control, [ :pointer, int32_t, uint8_t, uint8_t, uint8_t, :pointer, uint16_t ], :int
398
+ attach_function :file_data, [ :pointer, int32_t, uint8_t, :pointer, uint16_t ], :int
399
+ attach_function :file_dataremaining, [ :pointer, int32_t, uint8_t, uint8_t ], uint64_t
400
+ attach_function :m_callback_msi_packet, [ :pointer, callback([ :pointer, int32_t, :pointer, uint16_t, :pointer ], :void), :pointer ], :void
401
+ attach_function :m_msi_packet, [ :pointer, int32_t, :pointer, uint16_t ], :int
402
+ attach_function :custom_lossy_packet_registerhandler, [ :pointer, int32_t, uint8_t, callback([ :pointer, :pointer, uint32_t ], :int), :pointer ], :int
403
+ attach_function :send_custom_lossy_packet, [ :pointer, int32_t, :pointer, uint32_t ], :int
404
+ attach_function :custom_lossless_packet_registerhandler, [ :pointer, int32_t, uint8_t, callback([ :pointer, :pointer, uint32_t ], :int), :pointer ], :int
405
+ attach_function :send_custom_lossless_packet, [ :pointer, int32_t, :pointer, uint32_t ], :int
406
+ attach_function :new_messenger, [ :pointer ], :pointer
407
+ attach_function :kill_messenger, [ :pointer ], :void
408
+ attach_function :do_messenger, [ :pointer ], :void
409
+ attach_function :messenger_run_interval, [ :pointer ], uint32_t
410
+ attach_function :messenger_size, [ :pointer ], uint32_t
411
+ attach_function :messenger_save, [ :pointer, :pointer ], :void
412
+ attach_function :messenger_load, [ :pointer, :pointer, uint32_t ], :int
413
+ attach_function :count_friendlist, [ :pointer ], uint32_t
414
+ attach_function :get_num_online_friends, [ :pointer ], uint32_t
415
+ attach_function :copy_friendlist, [ :pointer, :pointer, uint32_t ], uint32_t
416
+ attach_function :get_friendlist, [ :pointer, :pointer, :pointer ], :int
417
+ attach_function :count_chatlist, [ :pointer ], uint32_t
418
+ attach_function :copy_chatlist, [ :pointer, :pointer, uint32_t ], uint32_t
41
419
 
42
420
  end
43
421
  end