summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2018-07-08 14:55:26 +0000
committeriphydf <iphydf@users.noreply.github.com>2018-07-08 18:23:45 +0000
commitebdc43285a4fdf1f9d76f8839a9ba572a35cbb80 (patch)
tree780093381841fcccbed8138d5a8fe1cc99923c03
parent819fe534ea62b07340b20f18841d1ed93cf5caff (diff)
Use named types for onion callbacks.
This is now a style rule: you can only use typedef'd function types. Previous rules now applied in `onion_*.c`: * `struct`s must have a name (typedef of unnamed struct is not allowed). * `++i` for increment-stmt, not `i++`, e.g. in loops. * Only a single declarator per struct member declaration. * Type_Names vs. variable_names.
-rw-r--r--toxcore/onion.c2
-rw-r--r--toxcore/onion.h5
-rw-r--r--toxcore/onion_announce.c8
-rw-r--r--toxcore/onion_client.c65
-rw-r--r--toxcore/onion_client.h17
5 files changed, 52 insertions, 45 deletions
diff --git a/toxcore/onion.c b/toxcore/onion.c
index 5bbc7f75..cfe12a05 100644
--- a/toxcore/onion.c
+++ b/toxcore/onion.c
@@ -655,7 +655,7 @@ static int handle_recv_1(void *object, IP_Port source, const uint8_t *packet, ui
655 return 0; 655 return 0;
656} 656}
657 657
658void set_callback_handle_recv_1(Onion *onion, int (*function)(void *, IP_Port, const uint8_t *, uint16_t), void *object) 658void set_callback_handle_recv_1(Onion *onion, onion_recv_1_cb *function, void *object)
659{ 659{
660 onion->recv_1_function = function; 660 onion->recv_1_function = function;
661 onion->callback_object = object; 661 onion->callback_object = object;
diff --git a/toxcore/onion.h b/toxcore/onion.h
index e81b3a52..8762d1e1 100644
--- a/toxcore/onion.h
+++ b/toxcore/onion.h
@@ -150,12 +150,13 @@ int send_onion_response(Networking_Core *net, IP_Port dest, const uint8_t *data,
150 */ 150 */
151int onion_send_1(const Onion *onion, const uint8_t *plain, uint16_t len, IP_Port source, const uint8_t *nonce); 151int onion_send_1(const Onion *onion, const uint8_t *plain, uint16_t len, IP_Port source, const uint8_t *nonce);
152 152
153typedef int onion_recv_1_cb(void *, IP_Port, const uint8_t *, uint16_t);
154
153/* Set the callback to be called when the dest ip_port doesn't have TOX_AF_INET6 or TOX_AF_INET as the family. 155/* Set the callback to be called when the dest ip_port doesn't have TOX_AF_INET6 or TOX_AF_INET as the family.
154 * 156 *
155 * Format: function(void *object, IP_Port dest, uint8_t *data, uint16_t length) 157 * Format: function(void *object, IP_Port dest, uint8_t *data, uint16_t length)
156 */ 158 */
157void set_callback_handle_recv_1(Onion *onion, int (*function)(void *, IP_Port, const uint8_t *, uint16_t), 159void set_callback_handle_recv_1(Onion *onion, onion_recv_1_cb *function, void *object);
158 void *object);
159 160
160Onion *new_onion(DHT *dht); 161Onion *new_onion(DHT *dht);
161 162
diff --git a/toxcore/onion_announce.c b/toxcore/onion_announce.c
index 6c9e8659..8f122fe6 100644
--- a/toxcore/onion_announce.c
+++ b/toxcore/onion_announce.c
@@ -40,7 +40,7 @@
40#define DATA_REQUEST_MIN_SIZE ONION_DATA_REQUEST_MIN_SIZE 40#define DATA_REQUEST_MIN_SIZE ONION_DATA_REQUEST_MIN_SIZE
41#define DATA_REQUEST_MIN_SIZE_RECV (DATA_REQUEST_MIN_SIZE + ONION_RETURN_3) 41#define DATA_REQUEST_MIN_SIZE_RECV (DATA_REQUEST_MIN_SIZE + ONION_RETURN_3)
42 42
43typedef struct { 43typedef struct Onion_Announce_Entry {
44 uint8_t public_key[CRYPTO_PUBLIC_KEY_SIZE]; 44 uint8_t public_key[CRYPTO_PUBLIC_KEY_SIZE];
45 IP_Port ret_ip_port; 45 IP_Port ret_ip_port;
46 uint8_t ret[ONION_RETURN_3]; 46 uint8_t ret[ONION_RETURN_3];
@@ -264,7 +264,7 @@ static int in_entries(const Onion_Announce *onion_a, const uint8_t *public_key)
264 return -1; 264 return -1;
265} 265}
266 266
267typedef struct { 267typedef struct Cmp_data {
268 const uint8_t *base_public_key; 268 const uint8_t *base_public_key;
269 Onion_Announce_Entry entry; 269 Onion_Announce_Entry entry;
270} Cmp_data; 270} Cmp_data;
@@ -312,14 +312,14 @@ static void sort_onion_announce_list(Onion_Announce_Entry *list, unsigned int le
312 // comparison function can use it as the base of comparison. 312 // comparison function can use it as the base of comparison.
313 VLA(Cmp_data, cmp_list, length); 313 VLA(Cmp_data, cmp_list, length);
314 314
315 for (uint32_t i = 0; i < length; i++) { 315 for (uint32_t i = 0; i < length; ++i) {
316 cmp_list[i].base_public_key = comp_public_key; 316 cmp_list[i].base_public_key = comp_public_key;
317 cmp_list[i].entry = list[i]; 317 cmp_list[i].entry = list[i];
318 } 318 }
319 319
320 qsort(cmp_list, length, sizeof(Cmp_data), cmp_entry); 320 qsort(cmp_list, length, sizeof(Cmp_data), cmp_entry);
321 321
322 for (uint32_t i = 0; i < length; i++) { 322 for (uint32_t i = 0; i < length; ++i) {
323 list[i] = cmp_list[i].entry; 323 list[i] = cmp_list[i].entry;
324 } 324 }
325} 325}
diff --git a/toxcore/onion_client.c b/toxcore/onion_client.c
index 35e725b7..483d6409 100644
--- a/toxcore/onion_client.c
+++ b/toxcore/onion_client.c
@@ -39,7 +39,7 @@
39#define ANNOUNCE_ARRAY_SIZE 256 39#define ANNOUNCE_ARRAY_SIZE 256
40#define ANNOUNCE_TIMEOUT 10 40#define ANNOUNCE_TIMEOUT 10
41 41
42typedef struct { 42typedef struct Onion_Node {
43 uint8_t public_key[CRYPTO_PUBLIC_KEY_SIZE]; 43 uint8_t public_key[CRYPTO_PUBLIC_KEY_SIZE];
44 IP_Port ip_port; 44 IP_Port ip_port;
45 uint8_t ping_id[ONION_PING_ID_SIZE]; 45 uint8_t ping_id[ONION_PING_ID_SIZE];
@@ -57,7 +57,7 @@ typedef struct {
57 uint32_t path_used; 57 uint32_t path_used;
58} Onion_Node; 58} Onion_Node;
59 59
60typedef struct { 60typedef struct Onion_Client_Paths {
61 Onion_Path paths[NUMBER_ONION_PATHS]; 61 Onion_Path paths[NUMBER_ONION_PATHS];
62 uint64_t last_path_success[NUMBER_ONION_PATHS]; 62 uint64_t last_path_success[NUMBER_ONION_PATHS];
63 uint64_t last_path_used[NUMBER_ONION_PATHS]; 63 uint64_t last_path_used[NUMBER_ONION_PATHS];
@@ -66,12 +66,12 @@ typedef struct {
66 unsigned int last_path_used_times[NUMBER_ONION_PATHS]; 66 unsigned int last_path_used_times[NUMBER_ONION_PATHS];
67} Onion_Client_Paths; 67} Onion_Client_Paths;
68 68
69typedef struct { 69typedef struct Last_Pinged {
70 uint8_t public_key[CRYPTO_PUBLIC_KEY_SIZE]; 70 uint8_t public_key[CRYPTO_PUBLIC_KEY_SIZE];
71 uint64_t timestamp; 71 uint64_t timestamp;
72} Last_Pinged; 72} Last_Pinged;
73 73
74typedef struct { 74typedef struct Onion_Friend {
75 uint8_t status; /* 0 if friend is not valid, 1 if friend is valid.*/ 75 uint8_t status; /* 0 if friend is not valid, 1 if friend is valid.*/
76 uint8_t is_online; /* Set by the onion_set_friend_status function. */ 76 uint8_t is_online; /* Set by the onion_set_friend_status function. */
77 77
@@ -95,17 +95,22 @@ typedef struct {
95 Last_Pinged last_pinged[MAX_STORED_PINGED_NODES]; 95 Last_Pinged last_pinged[MAX_STORED_PINGED_NODES];
96 uint8_t last_pinged_index; 96 uint8_t last_pinged_index;
97 97
98 int (*tcp_relay_node_callback)(void *object, uint32_t number, IP_Port ip_port, const uint8_t *public_key); 98 recv_tcp_relay_cb *tcp_relay_node_callback;
99 void *tcp_relay_node_callback_object; 99 void *tcp_relay_node_callback_object;
100 uint32_t tcp_relay_node_callback_number; 100 uint32_t tcp_relay_node_callback_number;
101 101
102 void (*dht_pk_callback)(void *data, int32_t number, const uint8_t *dht_public_key, void *userdata); 102 onion_dht_pk_cb *dht_pk_callback;
103 void *dht_pk_callback_object; 103 void *dht_pk_callback_object;
104 uint32_t dht_pk_callback_number; 104 uint32_t dht_pk_callback_number;
105 105
106 uint32_t run_count; 106 uint32_t run_count;
107} Onion_Friend; 107} Onion_Friend;
108 108
109typedef struct Onion_Data_Handler {
110 oniondata_handler_cb *function;
111 void *object;
112} Onion_Data_Handler;
113
109struct Onion_Client { 114struct Onion_Client {
110 DHT *dht; 115 DHT *dht;
111 Net_Crypto *c; 116 Net_Crypto *c;
@@ -120,7 +125,8 @@ struct Onion_Client {
120 Onion_Client_Paths onion_paths_friends; 125 Onion_Client_Paths onion_paths_friends;
121 126
122 uint8_t secret_symmetric_key[CRYPTO_SYMMETRIC_KEY_SIZE]; 127 uint8_t secret_symmetric_key[CRYPTO_SYMMETRIC_KEY_SIZE];
123 uint64_t last_run, first_run; 128 uint64_t last_run;
129 uint64_t first_run;
124 130
125 uint8_t temp_public_key[CRYPTO_PUBLIC_KEY_SIZE]; 131 uint8_t temp_public_key[CRYPTO_PUBLIC_KEY_SIZE];
126 uint8_t temp_secret_key[CRYPTO_SECRET_KEY_SIZE]; 132 uint8_t temp_secret_key[CRYPTO_SECRET_KEY_SIZE];
@@ -135,15 +141,12 @@ struct Onion_Client {
135 141
136 Ping_Array *announce_ping_array; 142 Ping_Array *announce_ping_array;
137 uint8_t last_pinged_index; 143 uint8_t last_pinged_index;
138 struct { 144 Onion_Data_Handler onion_data_handlers[256];
139 oniondata_handler_callback function;
140 void *object;
141 } Onion_Data_Handlers[256];
142 145
143 uint64_t last_packet_recv; 146 uint64_t last_packet_recv;
144 147
145 unsigned int onion_connected; 148 unsigned int onion_connected;
146 bool UDP_connected; 149 bool udp_connected;
147}; 150};
148 151
149DHT *onion_get_dht(const Onion_Client *onion_c) 152DHT *onion_get_dht(const Onion_Client *onion_c)
@@ -265,7 +268,7 @@ static uint16_t random_nodes_path_onion(const Onion_Client *onion_c, Node_format
265 268
266 unsigned int num_nodes = (onion_c->path_nodes_index < MAX_PATH_NODES) ? onion_c->path_nodes_index : MAX_PATH_NODES; 269 unsigned int num_nodes = (onion_c->path_nodes_index < MAX_PATH_NODES) ? onion_c->path_nodes_index : MAX_PATH_NODES;
267 270
268 //if (dht_non_lan_connected(onion_c->dht)) { 271 // if (dht_non_lan_connected(onion_c->dht)) {
269 if (dht_isconnected(onion_c->dht)) { 272 if (dht_isconnected(onion_c->dht)) {
270 if (num_nodes == 0) { 273 if (num_nodes == 0) {
271 return 0; 274 return 0;
@@ -606,7 +609,7 @@ static int client_send_announce_request(Onion_Client *onion_c, uint32_t num, IP_
606 return send_onion_packet_tcp_udp(onion_c, &path, dest, request, len); 609 return send_onion_packet_tcp_udp(onion_c, &path, dest, request, len);
607} 610}
608 611
609typedef struct { 612typedef struct Onion_Client_Cmp_data {
610 const uint8_t *base_public_key; 613 const uint8_t *base_public_key;
611 Onion_Node entry; 614 Onion_Node entry;
612} Onion_Client_Cmp_data; 615} Onion_Client_Cmp_data;
@@ -654,14 +657,14 @@ static void sort_onion_node_list(Onion_Node *list, unsigned int length, const ui
654 // comparison function can use it as the base of comparison. 657 // comparison function can use it as the base of comparison.
655 VLA(Onion_Client_Cmp_data, cmp_list, length); 658 VLA(Onion_Client_Cmp_data, cmp_list, length);
656 659
657 for (uint32_t i = 0; i < length; i++) { 660 for (uint32_t i = 0; i < length; ++i) {
658 cmp_list[i].base_public_key = comp_public_key; 661 cmp_list[i].base_public_key = comp_public_key;
659 cmp_list[i].entry = list[i]; 662 cmp_list[i].entry = list[i];
660 } 663 }
661 664
662 qsort(cmp_list, length, sizeof(Onion_Client_Cmp_data), onion_client_cmp_entry); 665 qsort(cmp_list, length, sizeof(Onion_Client_Cmp_data), onion_client_cmp_entry);
663 666
664 for (uint32_t i = 0; i < length; i++) { 667 for (uint32_t i = 0; i < length; ++i) {
665 list[i] = cmp_list[i].entry; 668 list[i] = cmp_list[i].entry;
666 } 669 }
667} 670}
@@ -926,11 +929,11 @@ static int handle_data_response(void *object, IP_Port source, const uint8_t *pac
926 return 1; 929 return 1;
927 } 930 }
928 931
929 if (!onion_c->Onion_Data_Handlers[plain[0]].function) { 932 if (!onion_c->onion_data_handlers[plain[0]].function) {
930 return 1; 933 return 1;
931 } 934 }
932 935
933 return onion_c->Onion_Data_Handlers[plain[0]].function(onion_c->Onion_Data_Handlers[plain[0]].object, temp_plain, plain, 936 return onion_c->onion_data_handlers[plain[0]].function(onion_c->onion_data_handlers[plain[0]].object, temp_plain, plain,
934 SIZEOF_VLA(plain), userdata); 937 SIZEOF_VLA(plain), userdata);
935} 938}
936 939
@@ -1025,7 +1028,7 @@ static int handle_tcp_onion(void *object, const uint8_t *data, uint16_t length,
1025} 1028}
1026 1029
1027/* Send data of length length to friendnum. 1030/* Send data of length length to friendnum.
1028 * This data will be received by the friend using the Onion_Data_Handlers callbacks. 1031 * This data will be received by the friend using the onion_data_handlers callbacks.
1029 * 1032 *
1030 * Even if this function succeeds, the friend might not receive any data. 1033 * Even if this function succeeds, the friend might not receive any data.
1031 * 1034 *
@@ -1359,8 +1362,8 @@ int onion_delfriend(Onion_Client *onion_c, int friend_num)
1359 * return -1 on failure. 1362 * return -1 on failure.
1360 * return 0 on success. 1363 * return 0 on success.
1361 */ 1364 */
1362int recv_tcp_relay_handler(Onion_Client *onion_c, int friend_num, int (*callback)(void *object, 1365int recv_tcp_relay_handler(Onion_Client *onion_c, int friend_num,
1363 uint32_t number, IP_Port ip_port, const uint8_t *public_key), void *object, uint32_t number) 1366 recv_tcp_relay_cb *callback, void *object, uint32_t number)
1364{ 1367{
1365 if ((uint32_t)friend_num >= onion_c->num_friends) { 1368 if ((uint32_t)friend_num >= onion_c->num_friends) {
1366 return -1; 1369 return -1;
@@ -1380,8 +1383,8 @@ int recv_tcp_relay_handler(Onion_Client *onion_c, int friend_num, int (*callback
1380 * return -1 on failure. 1383 * return -1 on failure.
1381 * return 0 on success. 1384 * return 0 on success.
1382 */ 1385 */
1383int onion_dht_pk_callback(Onion_Client *onion_c, int friend_num, void (*function)(void *data, int32_t number, 1386int onion_dht_pk_callback(Onion_Client *onion_c, int friend_num,
1384 const uint8_t *dht_public_key, void *userdata), void *object, uint32_t number) 1387 onion_dht_pk_cb *function, void *object, uint32_t number)
1385{ 1388{
1386 if ((uint32_t)friend_num >= onion_c->num_friends) { 1389 if ((uint32_t)friend_num >= onion_c->num_friends) {
1387 return -1; 1390 return -1;
@@ -1512,7 +1515,7 @@ static void populate_path_nodes_tcp(Onion_Client *onion_c)
1512{ 1515{
1513 Node_format nodes_list[MAX_SENT_NODES]; 1516 Node_format nodes_list[MAX_SENT_NODES];
1514 1517
1515 unsigned int num_nodes = copy_connected_tcp_relays(onion_c->c, nodes_list, MAX_SENT_NODES);; 1518 unsigned int num_nodes = copy_connected_tcp_relays(onion_c->c, nodes_list, MAX_SENT_NODES);
1516 unsigned int i; 1519 unsigned int i;
1517 1520
1518 for (i = 0; i < num_nodes; ++i) { 1521 for (i = 0; i < num_nodes; ++i) {
@@ -1646,10 +1649,10 @@ static void do_friend(Onion_Client *onion_c, uint16_t friendnum)
1646 1649
1647 1650
1648/* Function to call when onion data packet with contents beginning with byte is received. */ 1651/* Function to call when onion data packet with contents beginning with byte is received. */
1649void oniondata_registerhandler(Onion_Client *onion_c, uint8_t byte, oniondata_handler_callback cb, void *object) 1652void oniondata_registerhandler(Onion_Client *onion_c, uint8_t byte, oniondata_handler_cb *cb, void *object)
1650{ 1653{
1651 onion_c->Onion_Data_Handlers[byte].function = cb; 1654 onion_c->onion_data_handlers[byte].function = cb;
1652 onion_c->Onion_Data_Handlers[byte].object = object; 1655 onion_c->onion_data_handlers[byte].object = object;
1653} 1656}
1654 1657
1655#define ANNOUNCE_INTERVAL_NOT_ANNOUNCED 3 1658#define ANNOUNCE_INTERVAL_NOT_ANNOUNCED 3
@@ -1796,7 +1799,7 @@ static int onion_isconnected(const Onion_Client *onion_c)
1796unsigned int onion_connection_status(const Onion_Client *onion_c) 1799unsigned int onion_connection_status(const Onion_Client *onion_c)
1797{ 1800{
1798 if (onion_c->onion_connected >= ONION_CONNECTION_SECONDS) { 1801 if (onion_c->onion_connected >= ONION_CONNECTION_SECONDS) {
1799 if (onion_c->UDP_connected) { 1802 if (onion_c->udp_connected) {
1800 return 2; 1803 return 2;
1801 } 1804 }
1802 1805
@@ -1829,13 +1832,13 @@ void do_onion_client(Onion_Client *onion_c)
1829 } 1832 }
1830 } 1833 }
1831 1834
1832 bool UDP_connected = dht_non_lan_connected(onion_c->dht); 1835 bool udp_connected = dht_non_lan_connected(onion_c->dht);
1833 1836
1834 if (is_timeout(onion_c->first_run, ONION_CONNECTION_SECONDS * 2)) { 1837 if (is_timeout(onion_c->first_run, ONION_CONNECTION_SECONDS * 2)) {
1835 set_tcp_onion_status(nc_get_tcp_c(onion_c->c), !UDP_connected); 1838 set_tcp_onion_status(nc_get_tcp_c(onion_c->c), !udp_connected);
1836 } 1839 }
1837 1840
1838 onion_c->UDP_connected = UDP_connected 1841 onion_c->udp_connected = udp_connected
1839 || get_random_tcp_onion_conn_number(nc_get_tcp_c(onion_c->c)) == -1; /* Check if connected to any TCP relays. */ 1842 || get_random_tcp_onion_conn_number(nc_get_tcp_c(onion_c->c)) == -1; /* Check if connected to any TCP relays. */
1840 1843
1841 if (onion_connection_status(onion_c)) { 1844 if (onion_connection_status(onion_c)) {
diff --git a/toxcore/onion_client.h b/toxcore/onion_client.h
index 327d4923..560c2851 100644
--- a/toxcore/onion_client.h
+++ b/toxcore/onion_client.h
@@ -124,6 +124,8 @@ int onion_set_friend_online(Onion_Client *onion_c, int friend_num, uint8_t is_on
124 */ 124 */
125int onion_getfriendip(const Onion_Client *onion_c, int friend_num, IP_Port *ip_port); 125int onion_getfriendip(const Onion_Client *onion_c, int friend_num, IP_Port *ip_port);
126 126
127typedef int recv_tcp_relay_cb(void *object, uint32_t number, IP_Port ip_port, const uint8_t *public_key);
128
127/* Set the function for this friend that will be callbacked with object and number 129/* Set the function for this friend that will be callbacked with object and number
128 * when that friends gives us one of the TCP relays he is connected to. 130 * when that friends gives us one of the TCP relays he is connected to.
129 * 131 *
@@ -132,9 +134,10 @@ int onion_getfriendip(const Onion_Client *onion_c, int friend_num, IP_Port *ip_p
132 * return -1 on failure. 134 * return -1 on failure.
133 * return 0 on success. 135 * return 0 on success.
134 */ 136 */
135int recv_tcp_relay_handler(Onion_Client *onion_c, int friend_num, int (*tcp_relay_node_callback)(void *object, 137int recv_tcp_relay_handler(Onion_Client *onion_c, int friend_num,
136 uint32_t number, IP_Port ip_port, const uint8_t *public_key), void *object, uint32_t number); 138 recv_tcp_relay_cb *tcp_relay_node_callback, void *object, uint32_t number);
137 139
140typedef void onion_dht_pk_cb(void *data, int32_t number, const uint8_t *dht_public_key, void *userdata);
138 141
139/* Set the function for this friend that will be callbacked with object and number 142/* Set the function for this friend that will be callbacked with object and number
140 * when that friend gives us his DHT temporary public key. 143 * when that friend gives us his DHT temporary public key.
@@ -144,8 +147,8 @@ int recv_tcp_relay_handler(Onion_Client *onion_c, int friend_num, int (*tcp_rela
144 * return -1 on failure. 147 * return -1 on failure.
145 * return 0 on success. 148 * return 0 on success.
146 */ 149 */
147int onion_dht_pk_callback(Onion_Client *onion_c, int friend_num, void (*function)(void *data, int32_t number, 150int onion_dht_pk_callback(Onion_Client *onion_c, int friend_num, onion_dht_pk_cb *function, void *object,
148 const uint8_t *dht_public_key, void *userdata), void *object, uint32_t number); 151 uint32_t number);
149 152
150/* Set a friends DHT public key. 153/* Set a friends DHT public key.
151 * timestamp is the time (current_time_monotonic()) at which the key was last confirmed belonging to 154 * timestamp is the time (current_time_monotonic()) at which the key was last confirmed belonging to
@@ -177,11 +180,11 @@ unsigned int onion_getfriend_DHT_pubkey(const Onion_Client *onion_c, int friend_
177 */ 180 */
178int send_onion_data(Onion_Client *onion_c, int friend_num, const uint8_t *data, uint16_t length); 181int send_onion_data(Onion_Client *onion_c, int friend_num, const uint8_t *data, uint16_t length);
179 182
180typedef int (*oniondata_handler_callback)(void *object, const uint8_t *source_pubkey, const uint8_t *data, 183typedef int oniondata_handler_cb(void *object, const uint8_t *source_pubkey, const uint8_t *data,
181 uint16_t len, void *userdata); 184 uint16_t len, void *userdata);
182 185
183/* Function to call when onion data packet with contents beginning with byte is received. */ 186/* Function to call when onion data packet with contents beginning with byte is received. */
184void oniondata_registerhandler(Onion_Client *onion_c, uint8_t byte, oniondata_handler_callback cb, void *object); 187void oniondata_registerhandler(Onion_Client *onion_c, uint8_t byte, oniondata_handler_cb *cb, void *object);
185 188
186void do_onion_client(Onion_Client *onion_c); 189void do_onion_client(Onion_Client *onion_c);
187 190