summaryrefslogtreecommitdiff
path: root/toxcore/onion_announce.c
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2018-01-13 19:29:20 +0000
committeriphydf <iphydf@users.noreply.github.com>2018-01-14 14:20:20 +0000
commit4b54d14d9c35740140962942c48d964ee43b49ba (patch)
tree0656d08eb54af6fae7e427b0623c55e8c40a2af4 /toxcore/onion_announce.c
parent1e258a1915d62f63335987691b4216dd8c622247 (diff)
Make Onion_Announce a module-private type.
Diffstat (limited to 'toxcore/onion_announce.c')
-rw-r--r--toxcore/onion_announce.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/toxcore/onion_announce.c b/toxcore/onion_announce.c
index c0938007..d60c09c9 100644
--- a/toxcore/onion_announce.c
+++ b/toxcore/onion_announce.c
@@ -37,6 +37,34 @@
37#define DATA_REQUEST_MIN_SIZE ONION_DATA_REQUEST_MIN_SIZE 37#define DATA_REQUEST_MIN_SIZE ONION_DATA_REQUEST_MIN_SIZE
38#define DATA_REQUEST_MIN_SIZE_RECV (DATA_REQUEST_MIN_SIZE + ONION_RETURN_3) 38#define DATA_REQUEST_MIN_SIZE_RECV (DATA_REQUEST_MIN_SIZE + ONION_RETURN_3)
39 39
40typedef struct {
41 uint8_t public_key[CRYPTO_PUBLIC_KEY_SIZE];
42 IP_Port ret_ip_port;
43 uint8_t ret[ONION_RETURN_3];
44 uint8_t data_public_key[CRYPTO_PUBLIC_KEY_SIZE];
45 uint64_t time;
46} Onion_Announce_Entry;
47
48struct Onion_Announce {
49 DHT *dht;
50 Networking_Core *net;
51 Onion_Announce_Entry entries[ONION_ANNOUNCE_MAX_ENTRIES];
52 /* This is CRYPTO_SYMMETRIC_KEY_SIZE long just so we can use new_symmetric_key() to fill it */
53 uint8_t secret_bytes[CRYPTO_SYMMETRIC_KEY_SIZE];
54
55 Shared_Keys shared_keys_recv;
56};
57
58uint8_t *onion_announce_entry_public_key(Onion_Announce *onion_a, uint32_t entry)
59{
60 return onion_a->entries[entry].public_key;
61}
62
63void onion_announce_entry_set_time(Onion_Announce *onion_a, uint32_t entry, uint64_t time)
64{
65 onion_a->entries[entry].time = time;
66}
67
40/* Create an onion announce request packet in packet of max_packet_length (recommended size ONION_ANNOUNCE_REQUEST_SIZE). 68/* Create an onion announce request packet in packet of max_packet_length (recommended size ONION_ANNOUNCE_REQUEST_SIZE).
41 * 69 *
42 * dest_client_id is the public key of the node the packet will be sent to. 70 * dest_client_id is the public key of the node the packet will be sent to.