summaryrefslogtreecommitdiff
path: root/toxcore/onion_announce.c
diff options
context:
space:
mode:
Diffstat (limited to 'toxcore/onion_announce.c')
-rw-r--r--toxcore/onion_announce.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/toxcore/onion_announce.c b/toxcore/onion_announce.c
index a9891b9c..a8f71a4e 100644
--- a/toxcore/onion_announce.c
+++ b/toxcore/onion_announce.c
@@ -115,7 +115,7 @@ int send_data_request(Networking_Core *net, Onion_Path *path, IP_Port dest, uint
115} 115}
116 116
117/* Generate a ping_id and put it in ping_id */ 117/* Generate a ping_id and put it in ping_id */
118static void generate_ping_id(Onion_Announce *onion_a, uint64_t time, uint8_t *public_key, IP_Port ret_ip_port, 118static void generate_ping_id(Onion_Announce *onion_a, uint64_t time, const uint8_t *public_key, IP_Port ret_ip_port,
119 uint8_t *ping_id) 119 uint8_t *ping_id)
120{ 120{
121 time /= PING_ID_TIMEOUT; 121 time /= PING_ID_TIMEOUT;
@@ -132,7 +132,7 @@ static void generate_ping_id(Onion_Announce *onion_a, uint64_t time, uint8_t *pu
132 * return -1 if no 132 * return -1 if no
133 * return position in list if yes 133 * return position in list if yes
134 */ 134 */
135static int in_entries(Onion_Announce *onion_a, uint8_t *public_key) 135static int in_entries(const Onion_Announce *onion_a, const uint8_t *public_key)
136{ 136{
137 uint32_t i; 137 uint32_t i;
138 138
@@ -179,8 +179,8 @@ static int cmp_entry(const void *a, const void *b)
179 * return -1 if failure 179 * return -1 if failure
180 * return position if added 180 * return position if added
181 */ 181 */
182static int add_to_entries(Onion_Announce *onion_a, IP_Port ret_ip_port, uint8_t *public_key, uint8_t *data_public_key, 182static int add_to_entries(Onion_Announce *onion_a, IP_Port ret_ip_port, const uint8_t *public_key, const uint8_t *data_public_key,
183 uint8_t *ret) 183 const uint8_t *ret)
184{ 184{
185 185
186 int pos = in_entries(onion_a, public_key); 186 int pos = in_entries(onion_a, public_key);
@@ -213,14 +213,14 @@ static int add_to_entries(Onion_Announce *onion_a, IP_Port ret_ip_port, uint8_t
213 return in_entries(onion_a, public_key); 213 return in_entries(onion_a, public_key);
214} 214}
215 215
216static int handle_announce_request(void *object, IP_Port source, uint8_t *packet, uint32_t length) 216static int handle_announce_request(void *object, IP_Port source, const uint8_t *packet, uint32_t length)
217{ 217{
218 Onion_Announce *onion_a = object; 218 Onion_Announce *onion_a = object;
219 219
220 if (length != ANNOUNCE_REQUEST_SIZE_RECV) 220 if (length != ANNOUNCE_REQUEST_SIZE_RECV)
221 return 1; 221 return 1;
222 222
223 uint8_t *packet_public_key = packet + 1 + crypto_box_NONCEBYTES; 223 const uint8_t *packet_public_key = packet + 1 + crypto_box_NONCEBYTES;
224 uint8_t shared_key[crypto_box_BEFORENMBYTES]; 224 uint8_t shared_key[crypto_box_BEFORENMBYTES];
225 get_shared_key(&onion_a->shared_keys_recv, shared_key, onion_a->dht->self_secret_key, packet_public_key); 225 get_shared_key(&onion_a->shared_keys_recv, shared_key, onion_a->dht->self_secret_key, packet_public_key);
226 226
@@ -302,7 +302,7 @@ static int handle_announce_request(void *object, IP_Port source, uint8_t *packet
302 return 0; 302 return 0;
303} 303}
304 304
305static int handle_data_request(void *object, IP_Port source, uint8_t *packet, uint32_t length) 305static int handle_data_request(void *object, IP_Port source, const uint8_t *packet, uint32_t length)
306{ 306{
307 Onion_Announce *onion_a = object; 307 Onion_Announce *onion_a = object;
308 308