diff --git a/toxcore/onion.c b/toxcore/onion.c index 3c4d2ad1..6c62b7bb 100644 --- a/toxcore/onion.c +++ b/toxcore/onion.c @@ -54,7 +54,7 @@ static void change_symmetric_key(Onion *onion) * return -1 on failure. * return 0 on success. */ -int create_onion_path(DHT *dht, Onion_Path *new_path, Node_format *nodes) +int create_onion_path(const DHT *dht, Onion_Path *new_path, const Node_format *nodes) { if (!new_path || !nodes) return -1; @@ -149,7 +149,7 @@ int create_onion_packet(uint8_t *packet, uint16_t max_packet_length, const Onion * return -1 on failure. * return 0 on success. */ -int send_onion_packet(Networking_Core *net, Onion_Path *path, IP_Port dest, uint8_t *data, uint32_t length) +int send_onion_packet(Networking_Core *net, const Onion_Path *path, IP_Port dest, const uint8_t *data, uint32_t length) { uint8_t packet[ONION_MAX_PACKET_SIZE]; int len = create_onion_packet(packet, sizeof(packet), path, dest, data, length); @@ -209,7 +209,7 @@ static int handle_send_initial(void *object, IP_Port source, const uint8_t *pack return onion_send_1(onion, plain, len, source, packet + 1); } -int onion_send_1(Onion *onion, uint8_t *plain, uint32_t len, IP_Port source, const uint8_t *nonce) +int onion_send_1(const Onion *onion, const uint8_t *plain, uint32_t len, IP_Port source, const uint8_t *nonce) { IP_Port send_to; ipport_unpack(&send_to, plain); diff --git a/toxcore/onion.h b/toxcore/onion.h index 0ba724c6..2e71db7e 100644 --- a/toxcore/onion.h +++ b/toxcore/onion.h @@ -76,7 +76,7 @@ typedef struct { * return -1 on failure. * return 0 on success. */ -int create_onion_path(DHT *dht, Onion_Path *new_path, Node_format *nodes); +int create_onion_path(const DHT *dht, Onion_Path *new_path, const Node_format *nodes); /* Create a onion packet. * @@ -98,7 +98,7 @@ int create_onion_packet(uint8_t *packet, uint16_t max_packet_length, const Onion * return -1 on failure. * return 0 on success. */ -int send_onion_packet(Networking_Core *net, Onion_Path *path, IP_Port dest, uint8_t *data, uint32_t length); +int send_onion_packet(Networking_Core *net, const Onion_Path *path, IP_Port dest, const uint8_t *data, uint32_t length); /* Create and send a onion response sent initially to dest with. * Maximum length of data is ONION_RESPONSE_MAX_DATA_SIZE. @@ -118,7 +118,7 @@ int send_onion_response(Networking_Core *net, IP_Port dest, const uint8_t *data, * Source family must be set to something else than AF_INET6 or AF_INET so that the callback gets called * when the response is received. */ -int onion_send_1(Onion *onion, uint8_t *plain, uint32_t len, IP_Port source, const uint8_t *nonce); +int onion_send_1(const Onion *onion, const uint8_t *plain, uint32_t len, IP_Port source, const uint8_t *nonce); /* Set the callback to be called when the dest ip_port doesn't have AF_INET6 or AF_INET as the family. *