diff options
author | irungentoo <irungentoo@gmail.com> | 2014-04-13 20:40:48 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2014-04-13 20:40:48 -0400 |
commit | b16af69d9252faf730d12d3a452bcd76b2cc686f (patch) | |
tree | b09fdfb9ab7efdf807dbdce704e5c5844b1eb594 /toxcore/TCP_client.h | |
parent | ecf0ff3e7f4f5517ae1b66f01aec3325638f7761 (diff) |
TCP_client pretty much done?
Now next step is integrating it in tox.
Added TCP server functionality to bootstrap server (define TCP_RELAY_ENABLED to enable it.)
Diffstat (limited to 'toxcore/TCP_client.h')
-rw-r--r-- | toxcore/TCP_client.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/toxcore/TCP_client.h b/toxcore/TCP_client.h index e096ae62..66084a64 100644 --- a/toxcore/TCP_client.h +++ b/toxcore/TCP_client.h | |||
@@ -60,6 +60,12 @@ typedef struct { | |||
60 | uint8_t status; /* 0 if not used, 1 if other is offline, 2 if other is online. */ | 60 | uint8_t status; /* 0 if not used, 1 if other is offline, 2 if other is online. */ |
61 | uint8_t public_key[crypto_box_PUBLICKEYBYTES]; | 61 | uint8_t public_key[crypto_box_PUBLICKEYBYTES]; |
62 | } connections[NUM_CLIENT_CONNECTIONS]; | 62 | } connections[NUM_CLIENT_CONNECTIONS]; |
63 | int (*response_callback)(void *object, uint8_t connection_id, uint8_t *public_key); | ||
64 | void *response_callback_object; | ||
65 | int (*status_callback)(void *object, uint8_t connection_id, uint8_t status); | ||
66 | void *status_callback_object; | ||
67 | int (*data_callback)(void *object, uint8_t connection_id, uint8_t *data, uint16_t length); | ||
68 | void *data_callback_object; | ||
63 | 69 | ||
64 | int (*onion_callback)(void *object, uint8_t *data, uint16_t length); | 70 | int (*onion_callback)(void *object, uint8_t *data, uint16_t length); |
65 | void *onion_callback_object; | 71 | void *onion_callback_object; |
@@ -86,5 +92,16 @@ int send_onion_request(TCP_Client_Connection *con, uint8_t *data, uint16_t lengt | |||
86 | void onion_response_handler(TCP_Client_Connection *con, int (*onion_callback)(void *object, uint8_t *data, | 92 | void onion_response_handler(TCP_Client_Connection *con, int (*onion_callback)(void *object, uint8_t *data, |
87 | uint16_t length), void *object); | 93 | uint16_t length), void *object); |
88 | 94 | ||
95 | /* return 1 on success. | ||
96 | * return 0 if could not send packet. | ||
97 | * return -1 on failure (connection must be killed). | ||
98 | */ | ||
99 | int send_routing_request(TCP_Client_Connection *con, uint8_t *public_key); | ||
100 | void routing_response_handler(TCP_Client_Connection *con, int (*response_callback)(void *object, uint8_t connection_id, | ||
101 | uint8_t *public_key), void *object); | ||
102 | void routing_status_handler(TCP_Client_Connection *con, int (*status_callback)(void *object, uint8_t connection_id, | ||
103 | uint8_t status), void *object); | ||
104 | void routing_data_handler(TCP_Client_Connection *con, int (*data_callback)(void *object, uint8_t connection_id, | ||
105 | uint8_t *data, uint16_t length), void *object); | ||
89 | 106 | ||
90 | #endif | 107 | #endif |