summaryrefslogtreecommitdiff
path: root/toxcore/onion_announce.h
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2014-01-05 19:22:38 -0500
committerirungentoo <irungentoo@gmail.com>2014-01-05 19:22:38 -0500
commit6cd1e7fb707e20681e066b0a7e452e15c227c280 (patch)
treed36892dd4affaedbd47e90f5066b2dc6cda630da /toxcore/onion_announce.h
parent7e2d21271a549347575a38e5c3859d7374d496ed (diff)
Tests added and some fixes for the onion part.
Diffstat (limited to 'toxcore/onion_announce.h')
-rw-r--r--toxcore/onion_announce.h23
1 files changed, 18 insertions, 5 deletions
diff --git a/toxcore/onion_announce.h b/toxcore/onion_announce.h
index c8d9b442..66a8702d 100644
--- a/toxcore/onion_announce.h
+++ b/toxcore/onion_announce.h
@@ -29,10 +29,10 @@
29#define ONION_ANNOUNCE_TIMEOUT 300 29#define ONION_ANNOUNCE_TIMEOUT 300
30 30
31typedef struct { 31typedef struct {
32 uint8_t public_key[crypto_box_PUBLICKEYBYTES]; 32 uint8_t public_key[crypto_box_PUBLICKEYBYTES];
33 IP_Port ret_ip_port; 33 IP_Port ret_ip_port;
34 uint8_t ret[ONION_RETURN_3]; 34 uint8_t ret[ONION_RETURN_3];
35 uint64_t time; 35 uint64_t time;
36} Onion_Announce_Entry; 36} Onion_Announce_Entry;
37 37
38typedef struct { 38typedef struct {
@@ -43,7 +43,20 @@ typedef struct {
43 uint8_t secret_bytes[crypto_secretbox_KEYBYTES]; 43 uint8_t secret_bytes[crypto_secretbox_KEYBYTES];
44} Onion_Announce; 44} Onion_Announce;
45 45
46 46/* Create and send an onion announce request packet.
47 *
48 * nodes is a list of 4 nodes, the packet will route through nodes 0, 1, 2 and the data
49 * with length length will arrive at 3.
50 *
51 * public_key and secret_key is the kepair which will be used to encrypt the request.
52 * ping_id is the ping id that will be sent in the request.
53 * client_id is the client id of the node we are searching for.
54 *
55 * return -1 on failure.
56 * return 0 on success.
57 */
58int send_announce_request(DHT *dht, Node_format *nodes, uint8_t *public_key, uint8_t *secret_key, uint8_t *ping_id,
59 uint8_t *client_id);
47 60
48Onion_Announce *new_onion_announce(DHT *dht); 61Onion_Announce *new_onion_announce(DHT *dht);
49 62