diff options
author | irungentoo <irungentoo@gmail.com> | 2014-01-08 20:15:35 -0500 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2014-01-08 20:15:35 -0500 |
commit | 0fd8e49c386e357487ab9d68f2a9aa1d8a2356e0 (patch) | |
tree | 447b947694ca80b2b8cc583b362f9c62c374d7d0 /toxcore/onion_announce.h | |
parent | 5e6e5032014138e4d6659478085afe8d4a99188d (diff) |
Fixed problem in onion_announce.c
Added a way to know if a announce response is valid.
Diffstat (limited to 'toxcore/onion_announce.h')
-rw-r--r-- | toxcore/onion_announce.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/toxcore/onion_announce.h b/toxcore/onion_announce.h index 29cbaf58..2bc541a1 100644 --- a/toxcore/onion_announce.h +++ b/toxcore/onion_announce.h | |||
@@ -27,6 +27,9 @@ | |||
27 | 27 | ||
28 | #define ONION_ANNOUNCE_MAX_ENTRIES 32 | 28 | #define ONION_ANNOUNCE_MAX_ENTRIES 32 |
29 | #define ONION_ANNOUNCE_TIMEOUT 300 | 29 | #define ONION_ANNOUNCE_TIMEOUT 300 |
30 | #define ONION_PING_ID_SIZE crypto_hash_sha256_BYTES | ||
31 | |||
32 | #define ONION_ANNOUNCE_SENDBACK_DATA_LENGTH (crypto_secretbox_NONCEBYTES + sizeof(uint64_t) + crypto_box_PUBLICKEYBYTES + crypto_secretbox_MACBYTES) | ||
30 | 33 | ||
31 | typedef struct { | 34 | typedef struct { |
32 | uint8_t public_key[crypto_box_PUBLICKEYBYTES]; | 35 | uint8_t public_key[crypto_box_PUBLICKEYBYTES]; |
@@ -51,12 +54,14 @@ typedef struct { | |||
51 | * public_key and secret_key is the kepair which will be used to encrypt the request. | 54 | * 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. | 55 | * 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. | 56 | * client_id is the client id of the node we are searching for. |
57 | * sendback_data is the data of ONION_ANNOUNCE_SENDBACK_DATA_LENGTH length that we expect to | ||
58 | * receive back in the response. | ||
54 | * | 59 | * |
55 | * return -1 on failure. | 60 | * return -1 on failure. |
56 | * return 0 on success. | 61 | * return 0 on success. |
57 | */ | 62 | */ |
58 | int send_announce_request(DHT *dht, Node_format *nodes, uint8_t *public_key, uint8_t *secret_key, uint8_t *ping_id, | 63 | int 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); | 64 | uint8_t *client_id, uint8_t *sendback_data); |
60 | 65 | ||
61 | /* Create and send an onion data request packet. | 66 | /* Create and send an onion data request packet. |
62 | * | 67 | * |