summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Schütz <schuetzm@gmx.net>2014-06-30 21:30:41 +0200
committerMarc Schütz <schuetzm@gmx.net>2014-06-30 21:30:41 +0200
commit1494992a9f11a517413f9208bf97ef4b2797002d (patch)
tree204ecd721f5a69bc7fbea5656f8a6f4c8794e244
parent0aa0cbda4236940832bd5196987a75f2aea4721e (diff)
Const-correctness for onion.c
-rw-r--r--toxcore/onion.c6
-rw-r--r--toxcore/onion.h6
2 files changed, 6 insertions, 6 deletions
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)
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;
@@ -149,7 +149,7 @@ int create_onion_packet(uint8_t *packet, uint16_t max_packet_length, const Onion
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);
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 {
76 * return -1 on failure. 76 * return -1 on failure.
77 * return 0 on success. 77 * return 0 on success.
78 */ 78 */
79int create_onion_path(DHT *dht, Onion_Path *new_path, Node_format *nodes); 79int create_onion_path(const DHT *dht, Onion_Path *new_path, const Node_format *nodes);
80 80
81/* Create a onion packet. 81/* Create a onion packet.
82 * 82 *
@@ -98,7 +98,7 @@ int create_onion_packet(uint8_t *packet, uint16_t max_packet_length, const Onion
98 * return -1 on failure. 98 * return -1 on failure.
99 * return 0 on success. 99 * return 0 on success.
100 */ 100 */
101int send_onion_packet(Networking_Core *net, Onion_Path *path, IP_Port dest, uint8_t *data, uint32_t length); 101int send_onion_packet(Networking_Core *net, const Onion_Path *path, IP_Port dest, const uint8_t *data, uint32_t length);
102 102
103/* Create and send a onion response sent initially to dest with. 103/* Create and send a onion response sent initially to dest with.
104 * Maximum length of data is ONION_RESPONSE_MAX_DATA_SIZE. 104 * 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,
118 * Source family must be set to something else than AF_INET6 or AF_INET so that the callback gets called 118 * Source family must be set to something else than AF_INET6 or AF_INET so that the callback gets called
119 * when the response is received. 119 * when the response is received.
120 */ 120 */
121int onion_send_1(Onion *onion, uint8_t *plain, uint32_t len, IP_Port source, const uint8_t *nonce); 121int onion_send_1(const Onion *onion, const uint8_t *plain, uint32_t len, IP_Port source, const uint8_t *nonce);
122 122
123/* Set the callback to be called when the dest ip_port doesn't have AF_INET6 or AF_INET as the family. 123/* Set the callback to be called when the dest ip_port doesn't have AF_INET6 or AF_INET as the family.
124 * 124 *