summaryrefslogtreecommitdiff
path: root/toxcore/onion.c
diff options
context:
space:
mode:
Diffstat (limited to 'toxcore/onion.c')
-rw-r--r--toxcore/onion.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/toxcore/onion.c b/toxcore/onion.c
index 479c6209..194178f3 100644
--- a/toxcore/onion.c
+++ b/toxcore/onion.c
@@ -149,7 +149,7 @@ int send_onion_packet(Networking_Core *net, Onion_Path *path, IP_Port dest, uint
149 * return -1 on failure. 149 * return -1 on failure.
150 * return 0 on success. 150 * return 0 on success.
151 */ 151 */
152int send_onion_response(Networking_Core *net, IP_Port dest, uint8_t *data, uint32_t length, uint8_t *ret) 152int send_onion_response(Networking_Core *net, IP_Port dest, const uint8_t *data, uint32_t length, const uint8_t *ret)
153{ 153{
154 if (length > ONION_RESPONSE_MAX_DATA_SIZE || length == 0) 154 if (length > ONION_RESPONSE_MAX_DATA_SIZE || length == 0)
155 return -1; 155 return -1;
@@ -165,7 +165,7 @@ int send_onion_response(Networking_Core *net, IP_Port dest, uint8_t *data, uint3
165 return 0; 165 return 0;
166} 166}
167 167
168static int handle_send_initial(void *object, IP_Port source, uint8_t *packet, uint32_t length) 168static int handle_send_initial(void *object, IP_Port source, const uint8_t *packet, uint32_t length)
169{ 169{
170 Onion *onion = object; 170 Onion *onion = object;
171 171
@@ -189,7 +189,7 @@ static int handle_send_initial(void *object, IP_Port source, uint8_t *packet, ui
189 return onion_send_1(onion, plain, len, source, packet + 1); 189 return onion_send_1(onion, plain, len, source, packet + 1);
190} 190}
191 191
192int onion_send_1(Onion *onion, uint8_t *plain, uint32_t len, IP_Port source, uint8_t *nonce) 192int onion_send_1(Onion *onion, uint8_t *plain, uint32_t len, IP_Port source, const uint8_t *nonce)
193{ 193{
194 IP_Port send_to; 194 IP_Port send_to;
195 ipport_unpack(&send_to, plain); 195 ipport_unpack(&send_to, plain);
@@ -219,7 +219,7 @@ int onion_send_1(Onion *onion, uint8_t *plain, uint32_t len, IP_Port source, uin
219 return 0; 219 return 0;
220} 220}
221 221
222static int handle_send_1(void *object, IP_Port source, uint8_t *packet, uint32_t length) 222static int handle_send_1(void *object, IP_Port source, const uint8_t *packet, uint32_t length)
223{ 223{
224 Onion *onion = object; 224 Onion *onion = object;
225 225
@@ -268,7 +268,7 @@ static int handle_send_1(void *object, IP_Port source, uint8_t *packet, uint32_t
268 return 0; 268 return 0;
269} 269}
270 270
271static int handle_send_2(void *object, IP_Port source, uint8_t *packet, uint32_t length) 271static int handle_send_2(void *object, IP_Port source, const uint8_t *packet, uint32_t length)
272{ 272{
273 Onion *onion = object; 273 Onion *onion = object;
274 274
@@ -316,7 +316,7 @@ static int handle_send_2(void *object, IP_Port source, uint8_t *packet, uint32_t
316} 316}
317 317
318 318
319static int handle_recv_3(void *object, IP_Port source, uint8_t *packet, uint32_t length) 319static int handle_recv_3(void *object, IP_Port source, const uint8_t *packet, uint32_t length)
320{ 320{
321 Onion *onion = object; 321 Onion *onion = object;
322 322
@@ -350,7 +350,7 @@ static int handle_recv_3(void *object, IP_Port source, uint8_t *packet, uint32_t
350 return 0; 350 return 0;
351} 351}
352 352
353static int handle_recv_2(void *object, IP_Port source, uint8_t *packet, uint32_t length) 353static int handle_recv_2(void *object, IP_Port source, const uint8_t *packet, uint32_t length)
354{ 354{
355 Onion *onion = object; 355 Onion *onion = object;
356 356
@@ -384,7 +384,7 @@ static int handle_recv_2(void *object, IP_Port source, uint8_t *packet, uint32_t
384 return 0; 384 return 0;
385} 385}
386 386
387static int handle_recv_1(void *object, IP_Port source, uint8_t *packet, uint32_t length) 387static int handle_recv_1(void *object, IP_Port source, const uint8_t *packet, uint32_t length)
388{ 388{
389 Onion *onion = object; 389 Onion *onion = object;
390 390
@@ -417,7 +417,7 @@ static int handle_recv_1(void *object, IP_Port source, uint8_t *packet, uint32_t
417 return 0; 417 return 0;
418} 418}
419 419
420void set_callback_handle_recv_1(Onion *onion, int (*function)(void *, IP_Port, uint8_t *, uint16_t), void *object) 420void set_callback_handle_recv_1(Onion *onion, int (*function)(void *, IP_Port, const uint8_t *, uint16_t), void *object)
421{ 421{
422 onion->recv_1_function = function; 422 onion->recv_1_function = function;
423 onion->callback_object = object; 423 onion->callback_object = object;