diff options
author | irungentoo <irungentoo@gmail.com> | 2015-04-17 20:50:05 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2015-04-17 20:50:05 -0400 |
commit | 2a2390b5e772c94f0cb9a83c8ecaa6533ef33a22 (patch) | |
tree | 90215b10dfa896e38ee0f25192df55906eaba26f /toxcore/TCP_connection.h | |
parent | 92a708578f9aa4c2cff2d3a2de08e28ee61cda1b (diff) |
Assign some TCP relays for use with onion packets and keep them connected
for that purpose.
Diffstat (limited to 'toxcore/TCP_connection.h')
-rw-r--r-- | toxcore/TCP_connection.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/toxcore/TCP_connection.h b/toxcore/TCP_connection.h index 07d7820c..9b82e575 100644 --- a/toxcore/TCP_connection.h +++ b/toxcore/TCP_connection.h | |||
@@ -43,6 +43,9 @@ | |||
43 | NOTE: Must be at most (MAX_FRIEND_TCP_CONNECTIONS / 2) */ | 43 | NOTE: Must be at most (MAX_FRIEND_TCP_CONNECTIONS / 2) */ |
44 | #define RECOMMENDED_FRIEND_TCP_CONNECTIONS (MAX_FRIEND_TCP_CONNECTIONS / 2) | 44 | #define RECOMMENDED_FRIEND_TCP_CONNECTIONS (MAX_FRIEND_TCP_CONNECTIONS / 2) |
45 | 45 | ||
46 | /* Number of TCP connections used for onion purposes. */ | ||
47 | #define NUM_ONION_TCP_CONNECTIONS RECOMMENDED_FRIEND_TCP_CONNECTIONS | ||
48 | |||
46 | typedef struct { | 49 | typedef struct { |
47 | uint8_t status; | 50 | uint8_t status; |
48 | uint8_t public_key[crypto_box_PUBLICKEYBYTES]; /* The dht public key of the peer */ | 51 | uint8_t public_key[crypto_box_PUBLICKEYBYTES]; /* The dht public key of the peer */ |
@@ -61,6 +64,7 @@ typedef struct { | |||
61 | TCP_Client_Connection *connection; | 64 | TCP_Client_Connection *connection; |
62 | uint64_t connected_time; | 65 | uint64_t connected_time; |
63 | uint32_t lock_count; | 66 | uint32_t lock_count; |
67 | _Bool onion; | ||
64 | } TCP_con; | 68 | } TCP_con; |
65 | 69 | ||
66 | typedef struct { | 70 | typedef struct { |
@@ -83,6 +87,8 @@ typedef struct { | |||
83 | void *tcp_onion_callback_object; | 87 | void *tcp_onion_callback_object; |
84 | 88 | ||
85 | TCP_Proxy_Info proxy_info; | 89 | TCP_Proxy_Info proxy_info; |
90 | |||
91 | uint16_t onion_num_conns; | ||
86 | } TCP_Connections; | 92 | } TCP_Connections; |
87 | 93 | ||
88 | /* Send a packet to the TCP connection. | 94 | /* Send a packet to the TCP connection. |
@@ -100,7 +106,7 @@ int send_packet_tcp_connection(TCP_Connections *tcp_c, int connections_number, c | |||
100 | * return TCP connection number on success. | 106 | * return TCP connection number on success. |
101 | * return -1 on failure. | 107 | * return -1 on failure. |
102 | */ | 108 | */ |
103 | int get_random_tcp_conn_number(TCP_Connections *tcp_c); | 109 | int get_random_tcp_onion_conn_number(TCP_Connections *tcp_c); |
104 | 110 | ||
105 | /* Send an onion packet via the TCP relay corresponding to tcp_connections_number. | 111 | /* Send an onion packet via the TCP relay corresponding to tcp_connections_number. |
106 | * | 112 | * |