diff options
Diffstat (limited to 'toxcore/onion_announce.c')
-rw-r--r-- | toxcore/onion_announce.c | 28 |
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 | ||
40 | typedef 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 | |||
48 | struct 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 | |||
58 | uint8_t *onion_announce_entry_public_key(Onion_Announce *onion_a, uint32_t entry) | ||
59 | { | ||
60 | return onion_a->entries[entry].public_key; | ||
61 | } | ||
62 | |||
63 | void 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. |