diff options
author | SilentSand <edb881@gmail.com> | 2013-07-26 04:02:17 -0400 |
---|---|---|
committer | SilentSand <edb881@gmail.com> | 2013-07-26 04:02:17 -0400 |
commit | 59b34e423beb75fcd3e3c8abc2c05fe60aca26bc (patch) | |
tree | 6d1686d86da385579e862d8c761be9b59db92a48 /core/net_crypto.h | |
parent | b9169ff1b2a4e1dd13ed40f3902d06ed020eefb7 (diff) |
Formatting.
Many stylistic changes, mostly formatting code more closely to the
coding style.
Diffstat (limited to 'core/net_crypto.h')
-rw-r--r-- | core/net_crypto.h | 6 |
1 files changed, 0 insertions, 6 deletions
diff --git a/core/net_crypto.h b/core/net_crypto.h index 0dba0552..b5bab17a 100644 --- a/core/net_crypto.h +++ b/core/net_crypto.h | |||
@@ -55,13 +55,11 @@ int decrypt_data(uint8_t * public_key, uint8_t * secret_key, uint8_t * nonce, | |||
55 | /* fill the given nonce with random bytes. */ | 55 | /* fill the given nonce with random bytes. */ |
56 | void random_nonce(uint8_t * nonce); | 56 | void random_nonce(uint8_t * nonce); |
57 | 57 | ||
58 | |||
59 | /* return 0 if there is no received data in the buffer | 58 | /* return 0 if there is no received data in the buffer |
60 | return -1 if the packet was discarded. | 59 | return -1 if the packet was discarded. |
61 | return length of received data if successful */ | 60 | return length of received data if successful */ |
62 | int read_cryptpacket(int crypt_connection_id, uint8_t * data); | 61 | int read_cryptpacket(int crypt_connection_id, uint8_t * data); |
63 | 62 | ||
64 | |||
65 | /* return 0 if data could not be put in packet queue | 63 | /* return 0 if data could not be put in packet queue |
66 | return 1 if data was put into the queue */ | 64 | return 1 if data was put into the queue */ |
67 | int write_cryptpacket(int crypt_connection_id, uint8_t * data, uint32_t length); | 65 | int write_cryptpacket(int crypt_connection_id, uint8_t * data, uint32_t length); |
@@ -74,20 +72,17 @@ int write_cryptpacket(int crypt_connection_id, uint8_t * data, uint32_t length); | |||
74 | returns the length of the created packet on success */ | 72 | returns the length of the created packet on success */ |
75 | int create_request(uint8_t * packet, uint8_t * public_key, uint8_t * data, uint32_t length, uint8_t request_id); | 73 | int create_request(uint8_t * packet, uint8_t * public_key, uint8_t * data, uint32_t length, uint8_t request_id); |
76 | 74 | ||
77 | |||
78 | /* puts the senders public key in the request in public_key, the data from the request | 75 | /* puts the senders public key in the request in public_key, the data from the request |
79 | in data if a friend or ping request was sent to us and returns the length of the data. | 76 | in data if a friend or ping request was sent to us and returns the length of the data. |
80 | packet is the request packet and length is its length | 77 | packet is the request packet and length is its length |
81 | return -1 if not valid request. */ | 78 | return -1 if not valid request. */ |
82 | int handle_request(uint8_t * public_key, uint8_t * data, uint8_t * packet, uint16_t length); | 79 | int handle_request(uint8_t * public_key, uint8_t * data, uint8_t * packet, uint16_t length); |
83 | 80 | ||
84 | |||
85 | /* Start a secure connection with other peer who has public_key and ip_port | 81 | /* Start a secure connection with other peer who has public_key and ip_port |
86 | returns -1 if failure | 82 | returns -1 if failure |
87 | returns crypt_connection_id of the initialized connection if everything went well. */ | 83 | returns crypt_connection_id of the initialized connection if everything went well. */ |
88 | int crypto_connect(uint8_t * public_key, IP_Port ip_port); | 84 | int crypto_connect(uint8_t * public_key, IP_Port ip_port); |
89 | 85 | ||
90 | |||
91 | /* kill a crypto connection | 86 | /* kill a crypto connection |
92 | return 0 if killed successfully | 87 | return 0 if killed successfully |
93 | return 1 if there was a problem. */ | 88 | return 1 if there was a problem. */ |
@@ -102,7 +97,6 @@ int crypto_kill(int crypt_connection_id); | |||
102 | to refuse it just call kill_connection(...) on the connection id */ | 97 | to refuse it just call kill_connection(...) on the connection id */ |
103 | int crypto_inbound(uint8_t * public_key, uint8_t * secret_nonce, uint8_t * session_key); | 98 | int crypto_inbound(uint8_t * public_key, uint8_t * secret_nonce, uint8_t * session_key); |
104 | 99 | ||
105 | |||
106 | /* accept an incoming connection using the parameters provided by crypto_inbound | 100 | /* accept an incoming connection using the parameters provided by crypto_inbound |
107 | return -1 if not successful | 101 | return -1 if not successful |
108 | returns the crypt_connection_id if successful */ | 102 | returns the crypt_connection_id if successful */ |