summaryrefslogtreecommitdiff
path: root/toxcore/friend_connection.h
diff options
context:
space:
mode:
Diffstat (limited to 'toxcore/friend_connection.h')
-rw-r--r--toxcore/friend_connection.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/toxcore/friend_connection.h b/toxcore/friend_connection.h
index b814eb0c..641d2872 100644
--- a/toxcore/friend_connection.h
+++ b/toxcore/friend_connection.h
@@ -47,6 +47,7 @@
47/* Time before friend is removed from the DHT after last hearing about him. */ 47/* Time before friend is removed from the DHT after last hearing about him. */
48#define FRIEND_DHT_TIMEOUT BAD_NODE_TIMEOUT 48#define FRIEND_DHT_TIMEOUT BAD_NODE_TIMEOUT
49 49
50#define FRIEND_MAX_STORED_TCP_RELAYS (MAX_FRIEND_TCP_CONNECTIONS * 4)
50 51
51enum { 52enum {
52 FRIENDCONN_STATUS_NONE, 53 FRIENDCONN_STATUS_NONE,
@@ -61,7 +62,7 @@ typedef struct {
61 uint8_t dht_temp_pk[crypto_box_PUBLICKEYBYTES]; 62 uint8_t dht_temp_pk[crypto_box_PUBLICKEYBYTES];
62 uint16_t dht_lock; 63 uint16_t dht_lock;
63 IP_Port dht_ip_port; 64 IP_Port dht_ip_port;
64 uint64_t dht_ping_lastrecv, dht_ip_port_lastrecv; 65 uint64_t dht_pk_lastrecv, dht_ip_port_lastrecv;
65 66
66 int onion_friendnum; 67 int onion_friendnum;
67 int crypt_connection_id; 68 int crypt_connection_id;
@@ -83,6 +84,9 @@ typedef struct {
83 } callbacks[MAX_FRIEND_CONNECTION_CALLBACKS]; 84 } callbacks[MAX_FRIEND_CONNECTION_CALLBACKS];
84 85
85 uint16_t lock_count; 86 uint16_t lock_count;
87
88 Node_format tcp_relays[FRIEND_MAX_STORED_TCP_RELAYS];
89 uint16_t tcp_relay_counter;
86} Friend_Conn; 90} Friend_Conn;
87 91
88 92
@@ -127,6 +131,13 @@ int get_friendcon_public_keys(uint8_t *real_pk, uint8_t *dht_temp_pk, Friend_Con
127 */ 131 */
128void set_dht_temp_pk(Friend_Connections *fr_c, int friendcon_id, const uint8_t *dht_temp_pk); 132void set_dht_temp_pk(Friend_Connections *fr_c, int friendcon_id, const uint8_t *dht_temp_pk);
129 133
134/* Add a TCP relay associated to the friend.
135 *
136 * return -1 on failure.
137 * return 0 on success.
138 */
139int friend_add_tcp_relay(Friend_Connections *fr_c, int friendcon_id, IP_Port ip_port, const uint8_t *public_key);
140
130/* Set the callbacks for the friend connection. 141/* Set the callbacks for the friend connection.
131 * index is the index (0 to (MAX_FRIEND_CONNECTION_CALLBACKS - 1)) we want the callback to set in the array. 142 * index is the index (0 to (MAX_FRIEND_CONNECTION_CALLBACKS - 1)) we want the callback to set in the array.
132 * 143 *