summaryrefslogtreecommitdiff
path: root/toxcore/net_crypto.h
diff options
context:
space:
mode:
Diffstat (limited to 'toxcore/net_crypto.h')
-rw-r--r--toxcore/net_crypto.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/toxcore/net_crypto.h b/toxcore/net_crypto.h
index 07e9ef6a..b8236a0e 100644
--- a/toxcore/net_crypto.h
+++ b/toxcore/net_crypto.h
@@ -198,6 +198,9 @@ typedef struct {
198 uint32_t current_sleep_time; 198 uint32_t current_sleep_time;
199 199
200 BS_LIST ip_port_list; 200 BS_LIST ip_port_list;
201
202 int (*tcp_onion_callback)(void *object, const uint8_t *data, uint16_t length);
203 void *tcp_onion_callback_object;
201} Net_Crypto; 204} Net_Crypto;
202 205
203 206
@@ -321,6 +324,18 @@ int add_tcp_relay_peer(Net_Crypto *c, int crypt_connection_id, IP_Port ip_port,
321 */ 324 */
322int add_tcp_relay(Net_Crypto *c, IP_Port ip_port, const uint8_t *public_key); 325int add_tcp_relay(Net_Crypto *c, IP_Port ip_port, const uint8_t *public_key);
323 326
327/* Set the function to be called when an onion response packet is recieved by one of the TCP connections.
328 */
329void tcp_onion_response_handler(Net_Crypto *c, int (*tcp_onion_callback)(void *object, const uint8_t *data,
330 uint16_t length), void *object);
331
332/* Send an onion packet via a random connected TCP relay.
333 *
334 * return 0 on success.
335 * return -1 on failure.
336 */
337int send_tcp_onion_request(const Net_Crypto *c, const uint8_t *data, uint16_t length);
338
324/* Copy a maximum of num TCP relays we are connected to to tcp_relays. 339/* Copy a maximum of num TCP relays we are connected to to tcp_relays.
325 * NOTE that the family of the copied ip ports will be set to TCP_INET or TCP_INET6. 340 * NOTE that the family of the copied ip ports will be set to TCP_INET or TCP_INET6.
326 * 341 *