diff options
Diffstat (limited to 'toxcore/net_crypto.h')
-rw-r--r-- | toxcore/net_crypto.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/toxcore/net_crypto.h b/toxcore/net_crypto.h index 8dac937e..0d27ae4d 100644 --- a/toxcore/net_crypto.h +++ b/toxcore/net_crypto.h | |||
@@ -30,7 +30,7 @@ | |||
30 | #define CRYPTO_HANDSHAKE_TIMEOUT (CONNECTION_TIMEOUT * 2) | 30 | #define CRYPTO_HANDSHAKE_TIMEOUT (CONNECTION_TIMEOUT * 2) |
31 | 31 | ||
32 | #define CRYPTO_CONN_NO_CONNECTION 0 | 32 | #define CRYPTO_CONN_NO_CONNECTION 0 |
33 | #define CRYPTO_CONN_COOKIE_REQUESTED 1 //send cookie request packets | 33 | #define CRYPTO_CONN_COOKIE_REQUESTING 1 //send cookie request packets |
34 | #define CRYPTO_CONN_HANDSHAKE_SENT 2 //send handshake packets | 34 | #define CRYPTO_CONN_HANDSHAKE_SENT 2 //send handshake packets |
35 | #define CRYPTO_CONN_NOT_CONFIRMED 3 //send handshake packets | 35 | #define CRYPTO_CONN_NOT_CONFIRMED 3 //send handshake packets |
36 | #define CRYPTO_CONN_ESTABLISHED 4 | 36 | #define CRYPTO_CONN_ESTABLISHED 4 |
@@ -39,7 +39,7 @@ | |||
39 | #define CRYPTO_PACKET_BUFFER_SIZE 64 | 39 | #define CRYPTO_PACKET_BUFFER_SIZE 64 |
40 | 40 | ||
41 | #define MAX_CRYPTO_PACKET_SIZE 1400 | 41 | #define MAX_CRYPTO_PACKET_SIZE 1400 |
42 | 42 | #define MAX_CRYPTO_DATA_SIZE (MAX_CRYPTO_PACKET_SIZE - (1 + sizeof(uint16_t) + crypto_box_MACBYTES)) | |
43 | typedef struct { | 43 | typedef struct { |
44 | uint8_t public_key[crypto_box_PUBLICKEYBYTES]; /* The real public key of the peer. */ | 44 | uint8_t public_key[crypto_box_PUBLICKEYBYTES]; /* The real public key of the peer. */ |
45 | uint8_t recv_nonce[crypto_box_NONCEBYTES]; /* Nonce of received packets. */ | 45 | uint8_t recv_nonce[crypto_box_NONCEBYTES]; /* Nonce of received packets. */ |
@@ -58,6 +58,8 @@ typedef struct { | |||
58 | uint64_t timeout; | 58 | uint64_t timeout; |
59 | 59 | ||
60 | uint64_t cookie_request_number; /* number used in the cookie request packets for this connection */ | 60 | uint64_t cookie_request_number; /* number used in the cookie request packets for this connection */ |
61 | uint8_t dht_public_key[crypto_box_PUBLICKEYBYTES]; /* The dht public key of the peer */ | ||
62 | uint8_t dht_public_key_set; /* True if the dht public key is set, false if it isn't. */ | ||
61 | 63 | ||
62 | uint8_t *temp_packet; /* Where the cookie request/handshake packet is stored while it is being sent. */ | 64 | uint8_t *temp_packet; /* Where the cookie request/handshake packet is stored while it is being sent. */ |
63 | uint16_t temp_packet_length; | 65 | uint16_t temp_packet_length; |
@@ -65,6 +67,7 @@ typedef struct { | |||
65 | } Crypto_Connection; | 67 | } Crypto_Connection; |
66 | 68 | ||
67 | typedef struct { | 69 | typedef struct { |
70 | IP_Port source; | ||
68 | uint8_t public_key[crypto_box_PUBLICKEYBYTES]; /* The real public key of the peer. */ | 71 | uint8_t public_key[crypto_box_PUBLICKEYBYTES]; /* The real public key of the peer. */ |
69 | uint8_t recv_nonce[crypto_box_NONCEBYTES]; /* Nonce of received packets. */ | 72 | uint8_t recv_nonce[crypto_box_NONCEBYTES]; /* Nonce of received packets. */ |
70 | uint8_t peersessionpublic_key[crypto_box_PUBLICKEYBYTES]; /* The public key of the peer. */ | 73 | uint8_t peersessionpublic_key[crypto_box_PUBLICKEYBYTES]; /* The public key of the peer. */ |