summaryrefslogtreecommitdiff
path: root/toxcore/onion.c
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2014-07-02 15:41:59 -0400
committerirungentoo <irungentoo@gmail.com>2014-07-02 15:41:59 -0400
commit6d4fdb3597ce334d6f63437deeb1b7338bb87759 (patch)
tree7f195de1654b8bd79baf9807bd771ca17361e51d /toxcore/onion.c
parentd6b6ae4b48ab2387a29b0f9e4753cc57908733df (diff)
parent53d731b4f16be75a5289fd53267444abb0f732e9 (diff)
Merge branch 'const_correctness' of https://github.com/schuetzm/ProjectTox-Core
Diffstat (limited to 'toxcore/onion.c')
-rw-r--r--toxcore/onion.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/toxcore/onion.c b/toxcore/onion.c
index ac654689..1915324f 100644
--- a/toxcore/onion.c
+++ b/toxcore/onion.c
@@ -54,7 +54,7 @@ static void change_symmetric_key(Onion *onion)
54 * return -1 on failure. 54 * return -1 on failure.
55 * return 0 on success. 55 * return 0 on success.
56 */ 56 */
57int create_onion_path(DHT *dht, Onion_Path *new_path, Node_format *nodes) 57int create_onion_path(const DHT *dht, Onion_Path *new_path, const Node_format *nodes)
58{ 58{
59 if (!new_path || !nodes) 59 if (!new_path || !nodes)
60 return -1; 60 return -1;
@@ -93,8 +93,8 @@ int create_onion_path(DHT *dht, Onion_Path *new_path, Node_format *nodes)
93 * return -1 on failure. 93 * return -1 on failure.
94 * return length of created packet on success. 94 * return length of created packet on success.
95 */ 95 */
96int create_onion_packet(uint8_t *packet, uint16_t max_packet_length, Onion_Path *path, IP_Port dest, uint8_t *data, 96int create_onion_packet(uint8_t *packet, uint16_t max_packet_length, const Onion_Path *path, IP_Port dest,
97 uint32_t length) 97 const uint8_t *data, uint32_t length)
98{ 98{
99 if (1 + length + SEND_1 > max_packet_length || length == 0) 99 if (1 + length + SEND_1 > max_packet_length || length == 0)
100 return -1; 100 return -1;
@@ -149,7 +149,7 @@ int create_onion_packet(uint8_t *packet, uint16_t max_packet_length, Onion_Path
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_packet(Networking_Core *net, Onion_Path *path, IP_Port dest, uint8_t *data, uint32_t length) 152int send_onion_packet(Networking_Core *net, const Onion_Path *path, IP_Port dest, const uint8_t *data, uint32_t length)
153{ 153{
154 uint8_t packet[ONION_MAX_PACKET_SIZE]; 154 uint8_t packet[ONION_MAX_PACKET_SIZE];
155 int len = create_onion_packet(packet, sizeof(packet), path, dest, data, length); 155 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
209 return onion_send_1(onion, plain, len, source, packet + 1); 209 return onion_send_1(onion, plain, len, source, packet + 1);
210} 210}
211 211
212int onion_send_1(Onion *onion, uint8_t *plain, uint32_t len, IP_Port source, const uint8_t *nonce) 212int onion_send_1(const Onion *onion, const uint8_t *plain, uint32_t len, IP_Port source, const uint8_t *nonce)
213{ 213{
214 IP_Port send_to; 214 IP_Port send_to;
215 ipport_unpack(&send_to, plain); 215 ipport_unpack(&send_to, plain);