summaryrefslogtreecommitdiff
path: root/toxcore/TCP_connection.h
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2015-04-09 20:59:33 -0400
committerirungentoo <irungentoo@gmail.com>2015-04-09 20:59:33 -0400
commit4e1f49955a78dcee3fc34ddff814632ec79ddfea (patch)
tree902a3478f29f884bc4a3c23f7748d847bb3a55fd /toxcore/TCP_connection.h
parent3c87c842230be730dd35c625e9c010f0e8b57da6 (diff)
Some more work on TCP connection.
Diffstat (limited to 'toxcore/TCP_connection.h')
-rw-r--r--toxcore/TCP_connection.h28
1 files changed, 26 insertions, 2 deletions
diff --git a/toxcore/TCP_connection.h b/toxcore/TCP_connection.h
index ef33aeae..4156fd22 100644
--- a/toxcore/TCP_connection.h
+++ b/toxcore/TCP_connection.h
@@ -26,11 +26,27 @@
26 26
27#include "TCP_client.h" 27#include "TCP_client.h"
28 28
29#define TCP_CONN_STATUS_NONE 0 29#define TCP_CONN_NONE 0
30#define TCP_CONN_VALID 1
31
32#define TCP_CONNECTIONS_STATUS_NONE 0
33#define TCP_CONNECTIONS_STATUS_REGISTERED 1
34#define TCP_CONNECTIONS_STATUS_ONLINE 2
35
36#define MAX_FRIEND_TCP_CONNECTIONS 4
37
30 38
31typedef struct { 39typedef struct {
32 uint8_t status; 40 uint8_t status;
33 uint8_t dht_public_key[crypto_box_PUBLICKEYBYTES]; /* The dht public key of the peer */ 41 uint8_t public_key[crypto_box_PUBLICKEYBYTES]; /* The dht public key of the peer */
42
43 struct {
44 uint32_t tcp_connection;
45 unsigned int status;
46 unsigned int connection_id;
47 } connections[MAX_FRIEND_TCP_CONNECTIONS];
48
49 int id; /* id used in callbacks. */
34} TCP_Connection_to; 50} TCP_Connection_to;
35 51
36typedef struct { 52typedef struct {
@@ -48,7 +64,15 @@ typedef struct {
48 TCP_con *tcp_connections; 64 TCP_con *tcp_connections;
49 uint32_t tcp_connections_length; /* Length of tcp_connections array. */ 65 uint32_t tcp_connections_length; /* Length of tcp_connections array. */
50 66
67 int (*tcp_data_callback)(void *object, int id, const uint8_t *data, uint16_t length);
68 void *tcp_data_callback_object;
69
70 int (*tcp_oob_callback)(void *object, const uint8_t *public_key, const uint8_t *relay_pk, const uint8_t *data,
71 uint16_t length);
72 void *tcp_oob_callback_object;
51 73
74 int (*tcp_onion_callback)(void *object, const uint8_t *data, uint16_t length);
75 void *tcp_onion_callback_object;
52} TCP_Connections; 76} TCP_Connections;
53 77
54 78