diff options
author | iphydf <iphydf@users.noreply.github.com> | 2018-01-13 19:19:20 +0000 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2018-01-14 19:13:32 +0000 |
commit | bacd74c4dd1fc6edaaacf580b20a9292f3322532 (patch) | |
tree | 546a9fe5d7eca634410236038db1e7995974d7c5 /toxcore/TCP_client.h | |
parent | 7aca413e3231dfcfa7bc484bc44319c6780a4fc7 (diff) |
Make TCP_Client_Connection a module-private type.
Diffstat (limited to 'toxcore/TCP_client.h')
-rw-r--r-- | toxcore/TCP_client.h | 64 |
1 files changed, 12 insertions, 52 deletions
diff --git a/toxcore/TCP_client.h b/toxcore/TCP_client.h index 21254314..96e04d67 100644 --- a/toxcore/TCP_client.h +++ b/toxcore/TCP_client.h | |||
@@ -40,7 +40,7 @@ typedef struct { | |||
40 | uint8_t proxy_type; // a value from TCP_PROXY_TYPE | 40 | uint8_t proxy_type; // a value from TCP_PROXY_TYPE |
41 | } TCP_Proxy_Info; | 41 | } TCP_Proxy_Info; |
42 | 42 | ||
43 | enum { | 43 | typedef enum { |
44 | TCP_CLIENT_NO_STATUS, | 44 | TCP_CLIENT_NO_STATUS, |
45 | TCP_CLIENT_PROXY_HTTP_CONNECTING, | 45 | TCP_CLIENT_PROXY_HTTP_CONNECTING, |
46 | TCP_CLIENT_PROXY_SOCKS5_CONNECTING, | 46 | TCP_CLIENT_PROXY_SOCKS5_CONNECTING, |
@@ -49,57 +49,17 @@ enum { | |||
49 | TCP_CLIENT_UNCONFIRMED, | 49 | TCP_CLIENT_UNCONFIRMED, |
50 | TCP_CLIENT_CONFIRMED, | 50 | TCP_CLIENT_CONFIRMED, |
51 | TCP_CLIENT_DISCONNECTED, | 51 | TCP_CLIENT_DISCONNECTED, |
52 | }; | 52 | } TCP_CLIENT_STATUS; |
53 | typedef struct { | 53 | typedef struct TCP_Client_Connection TCP_Client_Connection; |
54 | uint8_t status; | 54 | |
55 | Socket sock; | 55 | const uint8_t *tcp_con_public_key(const TCP_Client_Connection *con); |
56 | uint8_t self_public_key[CRYPTO_PUBLIC_KEY_SIZE]; /* our public key */ | 56 | IP_Port tcp_con_ip_port(const TCP_Client_Connection *con); |
57 | uint8_t public_key[CRYPTO_PUBLIC_KEY_SIZE]; /* public key of the server */ | 57 | TCP_CLIENT_STATUS tcp_con_status(const TCP_Client_Connection *con); |
58 | IP_Port ip_port; /* The ip and port of the server */ | 58 | |
59 | TCP_Proxy_Info proxy_info; | 59 | void *tcp_con_custom_object(const TCP_Client_Connection *con); |
60 | uint8_t recv_nonce[CRYPTO_NONCE_SIZE]; /* Nonce of received packets. */ | 60 | uint32_t tcp_con_custom_uint(const TCP_Client_Connection *con); |
61 | uint8_t sent_nonce[CRYPTO_NONCE_SIZE]; /* Nonce of sent packets. */ | 61 | void tcp_con_set_custom_object(TCP_Client_Connection *con, void *object); |
62 | uint8_t shared_key[CRYPTO_SHARED_KEY_SIZE]; | 62 | void tcp_con_set_custom_uint(TCP_Client_Connection *con, uint32_t uint); |
63 | uint16_t next_packet_length; | ||
64 | |||
65 | uint8_t temp_secret_key[CRYPTO_SECRET_KEY_SIZE]; | ||
66 | |||
67 | uint8_t last_packet[2 + MAX_PACKET_SIZE]; | ||
68 | uint16_t last_packet_length; | ||
69 | uint16_t last_packet_sent; | ||
70 | |||
71 | TCP_Priority_List *priority_queue_start, *priority_queue_end; | ||
72 | |||
73 | uint64_t kill_at; | ||
74 | |||
75 | uint64_t last_pinged; | ||
76 | uint64_t ping_id; | ||
77 | |||
78 | uint64_t ping_response_id; | ||
79 | uint64_t ping_request_id; | ||
80 | |||
81 | struct { | ||
82 | uint8_t status; /* 0 if not used, 1 if other is offline, 2 if other is online. */ | ||
83 | uint8_t public_key[CRYPTO_PUBLIC_KEY_SIZE]; | ||
84 | uint32_t number; | ||
85 | } connections[NUM_CLIENT_CONNECTIONS]; | ||
86 | int (*response_callback)(void *object, uint8_t connection_id, const uint8_t *public_key); | ||
87 | void *response_callback_object; | ||
88 | int (*status_callback)(void *object, uint32_t number, uint8_t connection_id, uint8_t status); | ||
89 | void *status_callback_object; | ||
90 | int (*data_callback)(void *object, uint32_t number, uint8_t connection_id, const uint8_t *data, uint16_t length, | ||
91 | void *userdata); | ||
92 | void *data_callback_object; | ||
93 | int (*oob_data_callback)(void *object, const uint8_t *public_key, const uint8_t *data, uint16_t length, void *userdata); | ||
94 | void *oob_data_callback_object; | ||
95 | |||
96 | int (*onion_callback)(void *object, const uint8_t *data, uint16_t length, void *userdata); | ||
97 | void *onion_callback_object; | ||
98 | |||
99 | /* Can be used by user. */ | ||
100 | void *custom_object; | ||
101 | uint32_t custom_uint; | ||
102 | } TCP_Client_Connection; | ||
103 | 63 | ||
104 | /* Create new TCP connection to ip_port/public_key | 64 | /* Create new TCP connection to ip_port/public_key |
105 | */ | 65 | */ |