ffi-tox 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ProjectTox-Core/CMakeLists.txt +28 -0
- data/ProjectTox-Core/COPYING +674 -0
- data/ProjectTox-Core/INSTALL.md +91 -0
- data/ProjectTox-Core/README.md +54 -0
- data/ProjectTox-Core/core/CMakeLists.txt +17 -0
- data/ProjectTox-Core/core/DHT.c +1104 -0
- data/ProjectTox-Core/core/DHT.h +111 -0
- data/ProjectTox-Core/core/LAN_discovery.c +79 -0
- data/ProjectTox-Core/core/LAN_discovery.h +50 -0
- data/ProjectTox-Core/core/Lossless_UDP.c +749 -0
- data/ProjectTox-Core/core/Lossless_UDP.h +106 -0
- data/ProjectTox-Core/core/Messenger.c +581 -0
- data/ProjectTox-Core/core/Messenger.h +157 -0
- data/ProjectTox-Core/core/friend_requests.c +131 -0
- data/ProjectTox-Core/core/friend_requests.h +51 -0
- data/ProjectTox-Core/core/net_crypto.c +564 -0
- data/ProjectTox-Core/core/net_crypto.h +134 -0
- data/ProjectTox-Core/core/network.c +188 -0
- data/ProjectTox-Core/core/network.h +134 -0
- data/ProjectTox-Core/other/CMakeLists.txt +9 -0
- data/ProjectTox-Core/other/DHT_bootstrap.c +139 -0
- data/ProjectTox-Core/testing/CMakeLists.txt +18 -0
- data/ProjectTox-Core/testing/DHT_cryptosendfiletest.c +228 -0
- data/ProjectTox-Core/testing/DHT_sendfiletest.c +176 -0
- data/ProjectTox-Core/testing/DHT_test.c +182 -0
- data/ProjectTox-Core/testing/Lossless_UDP_testclient.c +214 -0
- data/ProjectTox-Core/testing/Lossless_UDP_testserver.c +201 -0
- data/ProjectTox-Core/testing/Messenger_test.c +145 -0
- data/ProjectTox-Core/testing/misc_tools.c +40 -0
- data/ProjectTox-Core/testing/misc_tools.h +29 -0
- data/ProjectTox-Core/testing/nTox.c +381 -0
- data/ProjectTox-Core/testing/nTox.h +50 -0
- data/ProjectTox-Core/testing/nTox_win32.c +323 -0
- data/ProjectTox-Core/testing/nTox_win32.h +31 -0
- data/ProjectTox-Core/testing/rect.py +45 -0
- data/ext/ffi-tox/extconf.rb +16 -0
- data/interfaces/libtox.i +18 -0
- data/lib/ffi-tox/libtox.rb +37 -0
- data/lib/ffi-tox.rb +1 -0
- metadata +116 -0
@@ -0,0 +1,323 @@
|
|
1
|
+
/* nTox_win32.c
|
2
|
+
*
|
3
|
+
* Textual frontend for Tox - Windows version
|
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
|
+
#include "nTox_win32.h"
|
25
|
+
#include "misc_tools.h"
|
26
|
+
|
27
|
+
#include <process.h>
|
28
|
+
|
29
|
+
uint8_t pending_requests[256][CLIENT_ID_SIZE];
|
30
|
+
uint8_t num_requests;
|
31
|
+
|
32
|
+
char line[STRING_LENGTH];
|
33
|
+
char users_id[200];
|
34
|
+
|
35
|
+
void do_header()
|
36
|
+
{
|
37
|
+
system("cls");
|
38
|
+
printf(users_id);
|
39
|
+
printf("\n---------------------------------");
|
40
|
+
printf("\n[i] commands: /f ID (to add friend), /m friendnumber message (to send message), /s status (to change status), /n nick (to change nickname), /l (lists friends), /d friendnumber (deletes friend), /q (to quit), /r (reset screen)");
|
41
|
+
printf("\n---------------------------------");
|
42
|
+
}
|
43
|
+
|
44
|
+
void print_request(uint8_t *public_key, uint8_t *data, uint16_t length)
|
45
|
+
{
|
46
|
+
printf("\n\n[i] received friend request with message\n");
|
47
|
+
printf((char *)data);
|
48
|
+
char numchar[100];
|
49
|
+
sprintf(numchar, "\n\n[i] accept request with /a %u\n\n", num_requests);
|
50
|
+
printf(numchar);
|
51
|
+
memcpy(pending_requests[num_requests], public_key, CLIENT_ID_SIZE);
|
52
|
+
++num_requests;
|
53
|
+
}
|
54
|
+
|
55
|
+
void print_message(int friendnumber, uint8_t * string, uint16_t length)
|
56
|
+
{
|
57
|
+
char name[MAX_NAME_LENGTH];
|
58
|
+
getname(friendnumber, (uint8_t*)name);
|
59
|
+
char msg[100+length+strlen(name)+1];
|
60
|
+
time_t rawtime;
|
61
|
+
struct tm * timeinfo;
|
62
|
+
time (&rawtime);
|
63
|
+
timeinfo = localtime (&rawtime);
|
64
|
+
char* temp = asctime(timeinfo);
|
65
|
+
size_t len = strlen(temp);
|
66
|
+
temp[len-1]='\0';
|
67
|
+
sprintf(msg, "\n[%d] %s <%s> %s\n\n", friendnumber, temp, name, string); // timestamp
|
68
|
+
printf(msg);
|
69
|
+
}
|
70
|
+
|
71
|
+
void print_nickchange(int friendnumber, uint8_t *string, uint16_t length)
|
72
|
+
{
|
73
|
+
char name[MAX_NAME_LENGTH];
|
74
|
+
getname(friendnumber, (uint8_t*)name);
|
75
|
+
char msg[100+length];
|
76
|
+
sprintf(msg, "\n\n[i] [%d] %s is now known as %s.\n\n", friendnumber, name, string);
|
77
|
+
printf(msg);
|
78
|
+
}
|
79
|
+
|
80
|
+
void print_statuschange(int friendnumber, uint8_t *string, uint16_t length) {
|
81
|
+
char name[MAX_NAME_LENGTH];
|
82
|
+
getname(friendnumber, (uint8_t*)name);
|
83
|
+
char msg[100+length+strlen(name)+1];
|
84
|
+
sprintf(msg, "\n\n[i] [%d] %s's status changed to %s.\n", friendnumber, name, string);
|
85
|
+
printf(msg);
|
86
|
+
}
|
87
|
+
|
88
|
+
void load_key()
|
89
|
+
{
|
90
|
+
FILE *data_file = NULL;
|
91
|
+
|
92
|
+
if ((data_file = fopen("data", "r"))) {
|
93
|
+
fseek(data_file, 0, SEEK_END);
|
94
|
+
int size = ftell(data_file);
|
95
|
+
fseek(data_file, 0, SEEK_SET);
|
96
|
+
uint8_t data[size];
|
97
|
+
|
98
|
+
if(fread(data, sizeof(uint8_t), size, data_file) != size) {
|
99
|
+
printf("\n[i] Could not read the data file. Exiting.");
|
100
|
+
exit(1);
|
101
|
+
}
|
102
|
+
|
103
|
+
Messenger_load(data, size);
|
104
|
+
} else {
|
105
|
+
int size = Messenger_size();
|
106
|
+
uint8_t data[size];
|
107
|
+
Messenger_save(data);
|
108
|
+
data_file = fopen("data", "w");
|
109
|
+
|
110
|
+
if(fwrite(data, sizeof(uint8_t), size, data_file) != size) {
|
111
|
+
printf("\n[i] Could not write data to file. Exiting.");
|
112
|
+
exit(1);
|
113
|
+
}
|
114
|
+
}
|
115
|
+
|
116
|
+
fclose(data_file);
|
117
|
+
}
|
118
|
+
|
119
|
+
void line_eval(char* line)
|
120
|
+
{
|
121
|
+
if(line[0] == '/') {
|
122
|
+
/* Add friend */
|
123
|
+
if(line[1] == 'f') {
|
124
|
+
int i;
|
125
|
+
char temp_id[128];
|
126
|
+
for (i=0; i<128; i++)
|
127
|
+
temp_id[i] = line[i+3];
|
128
|
+
int num = m_addfriend(hex_string_to_bin(temp_id), (uint8_t*)"Install Gentoo", sizeof("Install Gentoo"));
|
129
|
+
char numstring[100];
|
130
|
+
sprintf(numstring, "\n[i] added friend %d\n\n", num);
|
131
|
+
printf(numstring);
|
132
|
+
}
|
133
|
+
|
134
|
+
else if (line[1] == 'r') {
|
135
|
+
do_header();
|
136
|
+
printf("\n\n");
|
137
|
+
}
|
138
|
+
|
139
|
+
else if (line[1] == 'l') {
|
140
|
+
printf("\n[i] Friend List | Total: %d\n\n", getnumfriends());
|
141
|
+
|
142
|
+
int i;
|
143
|
+
|
144
|
+
for (i=0; i < getnumfriends(); i++) {
|
145
|
+
char name[MAX_NAME_LENGTH];
|
146
|
+
getname(i, (uint8_t*)name);
|
147
|
+
printf("[%d] %s\n\n", i, (uint8_t*)name);
|
148
|
+
}
|
149
|
+
}
|
150
|
+
|
151
|
+
else if (line[1] == 'd') {
|
152
|
+
size_t len = strlen(line);
|
153
|
+
char numstring[len-3];
|
154
|
+
int i;
|
155
|
+
for (i=0; i<len; i++) {
|
156
|
+
if (line[i+3] != ' ') {
|
157
|
+
numstring[i] = line[i+3];
|
158
|
+
}
|
159
|
+
}
|
160
|
+
int num = atoi(numstring);
|
161
|
+
m_delfriend(num);
|
162
|
+
}
|
163
|
+
/* Send message to friend */
|
164
|
+
else if (line[1] == 'm') {
|
165
|
+
int i;
|
166
|
+
size_t len = strlen(line);
|
167
|
+
char numstring[len-3];
|
168
|
+
char message[len-3];
|
169
|
+
for (i=0; i<len; i++) {
|
170
|
+
if (line[i+3] != ' ') {
|
171
|
+
numstring[i] = line[i+3];
|
172
|
+
} else {
|
173
|
+
int j;
|
174
|
+
for (j=i+1; j<len; j++)
|
175
|
+
message[j-i-1] = line[j+3];
|
176
|
+
break;
|
177
|
+
}
|
178
|
+
}
|
179
|
+
int num = atoi(numstring);
|
180
|
+
if(m_sendmessage(num, (uint8_t*) message, sizeof(message)) != 1) {
|
181
|
+
printf("\n[i] could not send message: %s\n", message);
|
182
|
+
} else {
|
183
|
+
//simply for aesthetics
|
184
|
+
printf("\n");
|
185
|
+
}
|
186
|
+
}
|
187
|
+
|
188
|
+
else if (line[1] == 'n') {
|
189
|
+
uint8_t name[MAX_NAME_LENGTH];
|
190
|
+
int i = 0;
|
191
|
+
size_t len = strlen(line);
|
192
|
+
for (i=3; i<len; i++) {
|
193
|
+
if (line[i] == 0 || line[i] == '\n') break;
|
194
|
+
name[i - 3] = line[i];
|
195
|
+
}
|
196
|
+
name[i - 3] = 0;
|
197
|
+
setname(name, i);
|
198
|
+
char numstring[100];
|
199
|
+
sprintf(numstring, "\n[i] changed nick to %s\n\n", (char*)name);
|
200
|
+
printf(numstring);
|
201
|
+
}
|
202
|
+
|
203
|
+
else if (line[1] == 's') {
|
204
|
+
uint8_t status[MAX_USERSTATUS_LENGTH];
|
205
|
+
int i = 0;
|
206
|
+
size_t len = strlen(line);
|
207
|
+
for (i=3; i<len; i++) {
|
208
|
+
if (line[i] == 0 || line[i] == '\n') break;
|
209
|
+
status[i - 3] = line[i];
|
210
|
+
}
|
211
|
+
status[i - 3] = 0;
|
212
|
+
m_set_userstatus(status, strlen((char*)status));
|
213
|
+
char numstring[100];
|
214
|
+
sprintf(numstring, "\n[i] changed status to %s\n\n", (char*)status);
|
215
|
+
printf(numstring);
|
216
|
+
}
|
217
|
+
|
218
|
+
else if (line[1] == 'a') {
|
219
|
+
uint8_t numf = atoi(line + 3);
|
220
|
+
char numchar[100];
|
221
|
+
sprintf(numchar, "\n[i] friend request %u accepted\n\n", numf);
|
222
|
+
printf(numchar);
|
223
|
+
int num = m_addfriend_norequest(pending_requests[numf]);
|
224
|
+
sprintf(numchar, "\n[i] added friendnumber %d\n\n", num);
|
225
|
+
printf(numchar);
|
226
|
+
}
|
227
|
+
/* EXIT */
|
228
|
+
else if (line[1] == 'q') {
|
229
|
+
exit(EXIT_SUCCESS);
|
230
|
+
}
|
231
|
+
}
|
232
|
+
|
233
|
+
else {
|
234
|
+
//nothing atm
|
235
|
+
}
|
236
|
+
}
|
237
|
+
|
238
|
+
void get_input()
|
239
|
+
{
|
240
|
+
while(1) {
|
241
|
+
fgets(line, STRING_LENGTH, stdin);
|
242
|
+
line_eval(line);
|
243
|
+
strcpy(line, "");
|
244
|
+
}
|
245
|
+
}
|
246
|
+
|
247
|
+
int main(int argc, char *argv[])
|
248
|
+
{
|
249
|
+
if (argc < 4) {
|
250
|
+
printf("[!] Usage: %s [IP] [port] [public_key] <nokey>\n", argv[0]);
|
251
|
+
exit(0);
|
252
|
+
}
|
253
|
+
|
254
|
+
if (initMessenger() == -1) {
|
255
|
+
printf("initMessenger failed");
|
256
|
+
exit(0);
|
257
|
+
}
|
258
|
+
|
259
|
+
if (argc > 4) {
|
260
|
+
if(strncmp(argv[4], "nokey", 6) < 0) {
|
261
|
+
}
|
262
|
+
} else {
|
263
|
+
load_key();
|
264
|
+
}
|
265
|
+
|
266
|
+
m_callback_friendrequest(print_request);
|
267
|
+
m_callback_friendmessage(print_message);
|
268
|
+
m_callback_namechange(print_nickchange);
|
269
|
+
m_callback_userstatus(print_statuschange);
|
270
|
+
|
271
|
+
char idstring1[32][5];
|
272
|
+
char idstring2[32][5];
|
273
|
+
uint32_t i;
|
274
|
+
for(i = 0; i < 32; i++)
|
275
|
+
{
|
276
|
+
if(self_public_key[i] < 16)
|
277
|
+
strcpy(idstring1[i],"0");
|
278
|
+
else
|
279
|
+
strcpy(idstring1[i], "");
|
280
|
+
sprintf(idstring2[i], "%hhX",self_public_key[i]);
|
281
|
+
}
|
282
|
+
strcpy(users_id,"[i] your ID: ");
|
283
|
+
for (i=0; i<32; i++) {
|
284
|
+
strcat(users_id,idstring1[i]);
|
285
|
+
strcat(users_id,idstring2[i]);
|
286
|
+
}
|
287
|
+
|
288
|
+
do_header();
|
289
|
+
|
290
|
+
IP_Port bootstrap_ip_port;
|
291
|
+
bootstrap_ip_port.port = htons(atoi(argv[2]));
|
292
|
+
int resolved_address = resolve_addr(argv[1]);
|
293
|
+
if (resolved_address != -1)
|
294
|
+
bootstrap_ip_port.ip.i = resolved_address;
|
295
|
+
else
|
296
|
+
exit(1);
|
297
|
+
|
298
|
+
DHT_bootstrap(bootstrap_ip_port, hex_string_to_bin(argv[3]));
|
299
|
+
|
300
|
+
int c;
|
301
|
+
int on = 0;
|
302
|
+
|
303
|
+
_beginthread(get_input, 0, NULL);
|
304
|
+
|
305
|
+
while(1) {
|
306
|
+
if (on == 1 && DHT_isconnected() == -1) {
|
307
|
+
printf("\n---------------------------------");
|
308
|
+
printf("\n[i] Disconnected from the DHT");
|
309
|
+
printf("\n---------------------------------\n\n");
|
310
|
+
on = 0;
|
311
|
+
}
|
312
|
+
|
313
|
+
if (on == 0 && DHT_isconnected()) {
|
314
|
+
printf("\n[i] Connected to DHT");
|
315
|
+
printf("\n---------------------------------\n\n");
|
316
|
+
on = 1;
|
317
|
+
}
|
318
|
+
|
319
|
+
doMessenger();
|
320
|
+
}
|
321
|
+
|
322
|
+
return 0;
|
323
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
/* nTox_win32.h
|
2
|
+
*
|
3
|
+
* Textual frontend for Tox - Windows version
|
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
|
+
#ifndef NTOX_WIN32_H
|
24
|
+
#define NTOX_WIN32_H
|
25
|
+
|
26
|
+
#include "../core/Messenger.h"
|
27
|
+
#include "../core/network.h"
|
28
|
+
|
29
|
+
#define STRING_LENGTH 256
|
30
|
+
|
31
|
+
#endif
|
@@ -0,0 +1,45 @@
|
|
1
|
+
#basic python UDP script
|
2
|
+
#for testing only
|
3
|
+
import socket
|
4
|
+
import random
|
5
|
+
|
6
|
+
UDP_IP = "127.0.0.1"
|
7
|
+
UDP_PORT = 5004
|
8
|
+
|
9
|
+
sock = socket.socket(socket.AF_INET, # Internet
|
10
|
+
socket.SOCK_DGRAM) # UDP
|
11
|
+
sock.bind((UDP_IP, UDP_PORT))
|
12
|
+
|
13
|
+
#our client_id
|
14
|
+
client_id = str(''.join(random.choice("abcdefghijklmnopqrstuvwxyz") for x in range(32)))
|
15
|
+
|
16
|
+
print client_id
|
17
|
+
a = 1;
|
18
|
+
#send ping request to our DHT on localhost.
|
19
|
+
sock.sendto("0012345678".decode("hex") + client_id, ('127.0.0.1', 33445))
|
20
|
+
|
21
|
+
#print all packets recieved and respond to ping requests properly
|
22
|
+
while True:
|
23
|
+
data, addr = sock.recvfrom(1024) # buffer size is 1024 bytes
|
24
|
+
print "received message:", data.encode('hex'), " From:", addr
|
25
|
+
#if we recieve a ping request.
|
26
|
+
print data[0].encode('hex')
|
27
|
+
if data[0] == "00".decode('hex'):
|
28
|
+
print "Sending ping resp"
|
29
|
+
sock.sendto("01".decode('hex') + data[1:5] + client_id, addr)
|
30
|
+
|
31
|
+
#if we recieve a get_nodes request.
|
32
|
+
if data[0] == "02".decode('hex'):
|
33
|
+
print "Sending getn resp"
|
34
|
+
#send send nodes packet with a couple 127.0.0.1 ips and ports.
|
35
|
+
#127.0.0.1:5000, 127.0.0.1:5001, 127.0.0.1:5002
|
36
|
+
sock.sendto("03".decode('hex') + data[1:5] + client_id + ("HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH" + "7F00000113880000".decode('hex') + "HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH" + "7F00000113890000".decode('hex') + "HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH" + "7F000001138A0000".decode('hex')), addr)
|
37
|
+
|
38
|
+
if data[0] == "10".decode('hex'):
|
39
|
+
print "Sending handshake resp"
|
40
|
+
sock.sendto("10".decode('hex') + data[1:5] + client_id[:4], addr)
|
41
|
+
if data[0] == "11".decode('hex'):
|
42
|
+
print "Sending SYNC resp"
|
43
|
+
a+=1
|
44
|
+
sock.sendto("11".decode('hex') + chr(a) + data[1:9], addr)
|
45
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'ffi-swig-generator'
|
2
|
+
|
3
|
+
cmake_file = '../../ProjectTox-Core/core/CMakeLists.txt'
|
4
|
+
|
5
|
+
cmake_list = File.read(cmake_file)
|
6
|
+
|
7
|
+
if not cmake_list.include? 'tox'
|
8
|
+
cmake_list += "\nadd_library(tox SHARED ${core_sources})\ntarget_link_libraries(tox sodium)\ninstall()"
|
9
|
+
File.write cmake_file, cmake_list
|
10
|
+
end
|
11
|
+
|
12
|
+
`cmake ../../ProjectTox-Core/core`
|
13
|
+
|
14
|
+
# Rubygems requires a make install rule.
|
15
|
+
make_file = "Makefile"
|
16
|
+
File.write(make_file, File.read(make_file)+"\ninstall:\n.PHONY : install\n")
|
data/interfaces/libtox.i
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
%module tox
|
2
|
+
%{
|
3
|
+
require 'ffi'
|
4
|
+
module Tox
|
5
|
+
module Messenger
|
6
|
+
extend FFI::Library
|
7
|
+
ffi_lib File.absolute_path(File.join(__FILE__,"../../../ext/ffi-tox/libtox.so"))
|
8
|
+
uint16_t = :uint16
|
9
|
+
uint32_t = :uint32
|
10
|
+
%}
|
11
|
+
|
12
|
+
/* Parse the header file to generate wrappers */
|
13
|
+
%include "../ProjectTox-Core/core/Messenger.h"
|
14
|
+
|
15
|
+
%{
|
16
|
+
end
|
17
|
+
end
|
18
|
+
%}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
|
2
|
+
require 'ffi'
|
3
|
+
module Tox
|
4
|
+
module Messenger
|
5
|
+
extend FFI::Library
|
6
|
+
ffi_lib File.absolute_path(File.join(__FILE__,"../../../ext/ffi-tox/libtox.so"))
|
7
|
+
uint16_t = :uint16
|
8
|
+
uint32_t = :uint32
|
9
|
+
MAX_NAME_LENGTH = 128
|
10
|
+
MAX_USERSTATUS_LENGTH = 128
|
11
|
+
PACKET_ID_NICKNAME = 48
|
12
|
+
PACKET_ID_USERSTATUS = 49
|
13
|
+
PACKET_ID_MESSAGE = 64
|
14
|
+
attach_function :m_addfriend, [ :pointer, :pointer, uint16_t ], :int
|
15
|
+
attach_function :m_addfriend_norequest, [ :pointer ], :int
|
16
|
+
attach_function :getfriend_id, [ :pointer ], :int
|
17
|
+
attach_function :getclient_id, [ :int, :pointer ], :int
|
18
|
+
attach_function :m_delfriend, [ :int ], :int
|
19
|
+
attach_function :m_friendstatus, [ :int ], :int
|
20
|
+
attach_function :m_sendmessage, [ :int, :pointer, uint32_t ], :int
|
21
|
+
attach_function :setname, [ :pointer, uint16_t ], :int
|
22
|
+
attach_function :getname, [ :int, :pointer ], :int
|
23
|
+
attach_function :m_set_userstatus, [ :pointer, uint16_t ], :int
|
24
|
+
attach_function :m_get_userstatus_size, [ :int ], :int
|
25
|
+
attach_function :m_copy_userstatus, [ :int, :pointer, uint32_t ], :int
|
26
|
+
attach_function :m_callback_friendrequest, [ callback([ :pointer, :pointer, uint16_t ], :void) ], :void
|
27
|
+
attach_function :m_callback_friendmessage, [ callback([ :int, :pointer, uint16_t ], :void) ], :void
|
28
|
+
attach_function :m_callback_namechange, [ callback([ :int, :pointer, uint16_t ], :void) ], :void
|
29
|
+
attach_function :m_callback_userstatus, [ callback([ :int, :pointer, uint16_t ], :void) ], :void
|
30
|
+
attach_function :initMessenger, [ ], :int
|
31
|
+
attach_function :doMessenger, [ ], :void
|
32
|
+
attach_function :Messenger_size, [ ], uint32_t
|
33
|
+
attach_function :Messenger_save, [ :pointer ], :void
|
34
|
+
attach_function :Messenger_load, [ :pointer, uint32_t ], :int
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
data/lib/ffi-tox.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'ffi-tox/libtox.rb'
|
metadata
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ffi-tox
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Tristan Rice
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-07-30 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: ffi
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.9.0
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.9.0
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: ffi-swig-generator
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 0.3.2
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.3.2
|
46
|
+
description: Ruby FFI bindings to Tox
|
47
|
+
email: rice@outerearth.net
|
48
|
+
executables: []
|
49
|
+
extensions:
|
50
|
+
- ext/ffi-tox/extconf.rb
|
51
|
+
extra_rdoc_files: []
|
52
|
+
files:
|
53
|
+
- lib/ffi-tox.rb
|
54
|
+
- lib/ffi-tox/libtox.rb
|
55
|
+
- interfaces/libtox.i
|
56
|
+
- ProjectTox-Core/CMakeLists.txt
|
57
|
+
- ProjectTox-Core/COPYING
|
58
|
+
- ProjectTox-Core/INSTALL.md
|
59
|
+
- ProjectTox-Core/README.md
|
60
|
+
- ProjectTox-Core/core/CMakeLists.txt
|
61
|
+
- ProjectTox-Core/core/DHT.c
|
62
|
+
- ProjectTox-Core/core/DHT.h
|
63
|
+
- ProjectTox-Core/core/LAN_discovery.c
|
64
|
+
- ProjectTox-Core/core/LAN_discovery.h
|
65
|
+
- ProjectTox-Core/core/Lossless_UDP.c
|
66
|
+
- ProjectTox-Core/core/Lossless_UDP.h
|
67
|
+
- ProjectTox-Core/core/Messenger.c
|
68
|
+
- ProjectTox-Core/core/Messenger.h
|
69
|
+
- ProjectTox-Core/core/friend_requests.c
|
70
|
+
- ProjectTox-Core/core/friend_requests.h
|
71
|
+
- ProjectTox-Core/core/net_crypto.c
|
72
|
+
- ProjectTox-Core/core/net_crypto.h
|
73
|
+
- ProjectTox-Core/core/network.c
|
74
|
+
- ProjectTox-Core/core/network.h
|
75
|
+
- ProjectTox-Core/other/CMakeLists.txt
|
76
|
+
- ProjectTox-Core/other/DHT_bootstrap.c
|
77
|
+
- ProjectTox-Core/testing/CMakeLists.txt
|
78
|
+
- ProjectTox-Core/testing/DHT_cryptosendfiletest.c
|
79
|
+
- ProjectTox-Core/testing/DHT_sendfiletest.c
|
80
|
+
- ProjectTox-Core/testing/DHT_test.c
|
81
|
+
- ProjectTox-Core/testing/Lossless_UDP_testclient.c
|
82
|
+
- ProjectTox-Core/testing/Lossless_UDP_testserver.c
|
83
|
+
- ProjectTox-Core/testing/Messenger_test.c
|
84
|
+
- ProjectTox-Core/testing/misc_tools.c
|
85
|
+
- ProjectTox-Core/testing/misc_tools.h
|
86
|
+
- ProjectTox-Core/testing/nTox.c
|
87
|
+
- ProjectTox-Core/testing/nTox.h
|
88
|
+
- ProjectTox-Core/testing/nTox_win32.c
|
89
|
+
- ProjectTox-Core/testing/nTox_win32.h
|
90
|
+
- ProjectTox-Core/testing/rect.py
|
91
|
+
- ext/ffi-tox/extconf.rb
|
92
|
+
homepage: http://github.com/d4l3k/ffi-tox
|
93
|
+
licenses: []
|
94
|
+
post_install_message:
|
95
|
+
rdoc_options: []
|
96
|
+
require_paths:
|
97
|
+
- lib
|
98
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
99
|
+
none: false
|
100
|
+
requirements:
|
101
|
+
- - ! '>='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
requirements: []
|
111
|
+
rubyforge_project:
|
112
|
+
rubygems_version: 1.8.24
|
113
|
+
signing_key:
|
114
|
+
specification_version: 3
|
115
|
+
summary: Tox bindings
|
116
|
+
test_files: []
|