mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Merge branch 'cgar-spelling'
This commit is contained in:
commit
d69a6843e7
|
@ -119,7 +119,8 @@ announce response packet:
|
||||||
encrypted with the DHT private key of Node D, the public key in the request and the nonce:[[uint8_t is_stored]
|
encrypted with the DHT private key of Node D, the public key in the request and the nonce:[[uint8_t is_stored]
|
||||||
[(32 bytes) ping_id if is_stored is 0 or 2, public key that must be used to send data packets if is_stored is 1][Node_Format * (maximum of 8)]]
|
[(32 bytes) ping_id if is_stored is 0 or 2, public key that must be used to send data packets if is_stored is 1][Node_Format * (maximum of 8)]]
|
||||||
(if the is_stored is not 0, it means the information to reach the client id we are searching for is stored on this node)
|
(if the is_stored is not 0, it means the information to reach the client id we are searching for is stored on this node)
|
||||||
is_stored is 2 as a response to a peer trying to announce himself to tell the peer that he is currently annouced successfully.
|
is_stored is 2 as a response to a peer trying to announce himself to tell the
|
||||||
|
peer that he is currently announced successfully.
|
||||||
|
|
||||||
data to route response packet:
|
data to route response packet:
|
||||||
[uint8_t packet id (134)][nonce][temporary just generated public key]
|
[uint8_t packet id (134)][nonce][temporary just generated public key]
|
||||||
|
|
|
@ -43,13 +43,13 @@ cookie request packet:
|
||||||
bytes)][Encrypted message containing: [Senders real public key (32
|
bytes)][Encrypted message containing: [Senders real public key (32
|
||||||
bytes)][padding (32 bytes)][uint64_t number (must be sent
|
bytes)][padding (32 bytes)][uint64_t number (must be sent
|
||||||
back untouched in cookie response)]]
|
back untouched in cookie response)]]
|
||||||
Encrypted message is encrypted with sender DHT private key, recievers DHT
|
Encrypted message is encrypted with sender DHT private key, receivers DHT
|
||||||
public key and the nonce.
|
public key and the nonce.
|
||||||
|
|
||||||
cookie response packet:
|
cookie response packet:
|
||||||
[uint8_t 25][Random nonce (24 bytes)][Encrypted message containing:
|
[uint8_t 25][Random nonce (24 bytes)][Encrypted message containing:
|
||||||
[Cookie][uint64_t number (that was sent in the request)]]
|
[Cookie][uint64_t number (that was sent in the request)]]
|
||||||
Encrypted message is encrypted with sender DHT private key, recievers DHT
|
Encrypted message is encrypted with sender DHT private key, receivers DHT
|
||||||
public key and the nonce.
|
public key and the nonce.
|
||||||
|
|
||||||
The Cookie should be basically:
|
The Cookie should be basically:
|
||||||
|
@ -110,11 +110,11 @@ packet request packet: [uint8_t (1)][uint8_t num][uint8_t num][uint8_t
|
||||||
num]...[uint8_t num]
|
num]...[uint8_t num]
|
||||||
|
|
||||||
the list of nums are a list of packet numbers the other is requesting.
|
the list of nums are a list of packet numbers the other is requesting.
|
||||||
to get the real packet numbers from this list take the recvbuffers buffer_start
|
to get the real packet numbers from this list take the recvbuffers buffer_start
|
||||||
from the packet, substract 1 to it and put it in packet_num then start from the
|
from the packet, subtract 1 to it and put it in packet_num then start from the
|
||||||
beggining of the num list: if num is zero, add 255 to packet_num then do the
|
beginning of the num list: if num is zero, add 255 to packet_num then do the
|
||||||
next num. if num isn't zero, add its value to packet_num, note that the other
|
next num. if num isn't zero, add its value to packet_num, note that the other
|
||||||
has requested we send this packet again to them then continue to the next num in
|
has requested we send this packet again to them then continue to the next num in
|
||||||
the list.
|
the list.
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -187,7 +187,7 @@ void parse_tcp_relay_ports_config(config_t *cfg, uint16_t **tcp_relay_ports, int
|
||||||
config_setting_t *elem = config_setting_get_elem(ports_array, i);
|
config_setting_t *elem = config_setting_get_elem(ports_array, i);
|
||||||
|
|
||||||
if (elem == NULL) {
|
if (elem == NULL) {
|
||||||
// it's NULL if `ports_array` is not an array (we have that check ealier) or if `i` is out of range, which should not be
|
// it's NULL if `ports_array` is not an array (we have that check earlier) or if `i` is out of range, which should not be
|
||||||
syslog(LOG_WARNING, "Port #%d: Something went wrong while parsing the port. Stopping reading ports.\n", i);
|
syslog(LOG_WARNING, "Port #%d: Something went wrong while parsing the port. Stopping reading ports.\n", i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -618,7 +618,7 @@ static void *timer_poll( void *arg )
|
||||||
LOGGER_ERROR("Failed to execute timer at: %d!", handler->timers[0]->timeout);
|
LOGGER_ERROR("Failed to execute timer at: %d!", handler->timers[0]->timeout);
|
||||||
free(args);
|
free(args);
|
||||||
} else {
|
} else {
|
||||||
LOGGER_DEBUG("Exectued timer assigned at: %d", handler->timers[0]->timeout);
|
LOGGER_DEBUG("Executed timer assigned at: %d", handler->timers[0]->timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
timer_release(handler, handler->timers[0]->idx, 0);
|
timer_release(handler, handler->timers[0]->idx, 0);
|
||||||
|
@ -1436,7 +1436,7 @@ static void msi_handle_packet ( Messenger *messenger, int source, const uint8_t
|
||||||
MSIMessage *msg;
|
MSIMessage *msg;
|
||||||
|
|
||||||
if ( !length ) {
|
if ( !length ) {
|
||||||
LOGGER_WARNING("Lenght param negative");
|
LOGGER_WARNING("Length param negative");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -230,7 +230,7 @@ void toxav_register_callstate_callback ( ToxAv *av, ToxAVCallback callback, ToxA
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Register callback for recieving audio data
|
* @brief Register callback for receiving audio data
|
||||||
*
|
*
|
||||||
* @param callback The callback
|
* @param callback The callback
|
||||||
* @return void
|
* @return void
|
||||||
|
@ -243,7 +243,7 @@ void toxav_register_audio_recv_callback (ToxAv *av, void (*callback)(ToxAv *, in
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Register callback for recieving video data
|
* @brief Register callback for receiving video data
|
||||||
*
|
*
|
||||||
* @param callback The callback
|
* @param callback The callback
|
||||||
* @return void
|
* @return void
|
||||||
|
@ -1091,7 +1091,7 @@ void toxav_handle_packet(RTPSession *_session, RTPMessage *_msg)
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
/* piece of current frame */
|
/* piece of current frame */
|
||||||
} else if (i > 0 && i < 128) {
|
} else if (i > 0 && i < 128) {
|
||||||
/* recieved a piece of a frame ahead, flush current frame and start reading this new frame */
|
/* received a piece of a frame ahead, flush current frame and start reading this new frame */
|
||||||
DECODE_PACKET *p = malloc(sizeof(DECODE_PACKET) + call->frame_limit);
|
DECODE_PACKET *p = malloc(sizeof(DECODE_PACKET) + call->frame_limit);
|
||||||
|
|
||||||
if (p) {
|
if (p) {
|
||||||
|
|
|
@ -167,7 +167,7 @@ void toxav_kill(ToxAv *av);
|
||||||
void toxav_register_callstate_callback (ToxAv *av, ToxAVCallback callback, ToxAvCallbackID id, void *userdata);
|
void toxav_register_callstate_callback (ToxAv *av, ToxAVCallback callback, ToxAvCallbackID id, void *userdata);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Register callback for recieving audio data
|
* @brief Register callback for receiving audio data
|
||||||
*
|
*
|
||||||
* @param av Handler.
|
* @param av Handler.
|
||||||
* @param callback The callback
|
* @param callback The callback
|
||||||
|
@ -177,7 +177,7 @@ void toxav_register_audio_recv_callback (ToxAv *av, void (*callback)(ToxAv *, in
|
||||||
void *user_data);
|
void *user_data);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Register callback for recieving video data
|
* @brief Register callback for receiving video data
|
||||||
*
|
*
|
||||||
* @param av Handler.
|
* @param av Handler.
|
||||||
* @param callback The callback
|
* @param callback The callback
|
||||||
|
|
|
@ -1949,7 +1949,7 @@ static void check_friend_request_timed_out(Messenger *m, uint32_t i, uint64_t t)
|
||||||
|
|
||||||
if (f->friendrequest_lastsent + f->friendrequest_timeout < t) {
|
if (f->friendrequest_lastsent + f->friendrequest_timeout < t) {
|
||||||
set_friend_status(m, i, FRIEND_ADDED);
|
set_friend_status(m, i, FRIEND_ADDED);
|
||||||
/* Double the default timeout everytime if friendrequest is assumed
|
/* Double the default timeout every time if friendrequest is assumed
|
||||||
* to have been sent unsuccessfully.
|
* to have been sent unsuccessfully.
|
||||||
*/
|
*/
|
||||||
f->friendrequest_timeout *= 2;
|
f->friendrequest_timeout *= 2;
|
||||||
|
|
|
@ -210,7 +210,7 @@ void new_nonce(uint8_t *nonce)
|
||||||
|
|
||||||
/* Create a request to peer.
|
/* Create a request to peer.
|
||||||
* send_public_key and send_secret_key are the pub/secret keys of the sender.
|
* send_public_key and send_secret_key are the pub/secret keys of the sender.
|
||||||
* recv_public_key is public key of reciever.
|
* recv_public_key is public key of receiver.
|
||||||
* packet must be an array of MAX_CRYPTO_REQUEST_SIZE big.
|
* packet must be an array of MAX_CRYPTO_REQUEST_SIZE big.
|
||||||
* Data represents the data we send with the request with length being the length of the data.
|
* Data represents the data we send with the request with length being the length of the data.
|
||||||
* request_id is the id of the request (32 = friend request, 254 = ping request).
|
* request_id is the id of the request (32 = friend request, 254 = ping request).
|
||||||
|
|
|
@ -129,7 +129,7 @@ void new_nonce(uint8_t *nonce);
|
||||||
|
|
||||||
/* Create a request to peer.
|
/* Create a request to peer.
|
||||||
* send_public_key and send_secret_key are the pub/secret keys of the sender.
|
* send_public_key and send_secret_key are the pub/secret keys of the sender.
|
||||||
* recv_public_key is public key of reciever.
|
* recv_public_key is public key of receiver.
|
||||||
* packet must be an array of MAX_CRYPTO_REQUEST_SIZE big.
|
* packet must be an array of MAX_CRYPTO_REQUEST_SIZE big.
|
||||||
* Data represents the data we send with the request with length being the length of the data.
|
* Data represents the data we send with the request with length being the length of the data.
|
||||||
* request_id is the id of the request (32 = friend request, 254 = ping request).
|
* request_id is the id of the request (32 = friend request, 254 = ping request).
|
||||||
|
|
|
@ -657,7 +657,7 @@ static int generate_request_packet(uint8_t *data, uint16_t length, const Packets
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Handle a request data packet.
|
/* Handle a request data packet.
|
||||||
* Remove all the packets the other recieved from the array.
|
* Remove all the packets the other received from the array.
|
||||||
*
|
*
|
||||||
* return -1 on failure.
|
* return -1 on failure.
|
||||||
* return number of requested packets on success.
|
* return number of requested packets on success.
|
||||||
|
@ -1084,7 +1084,7 @@ static int send_kill_packet(Net_Crypto *c, int crypt_connection_id)
|
||||||
&kill_packet, sizeof(kill_packet));
|
&kill_packet, sizeof(kill_packet));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Handle a recieved data packet.
|
/* Handle a received data packet.
|
||||||
*
|
*
|
||||||
* return -1 on failure.
|
* return -1 on failure.
|
||||||
* return 0 on success.
|
* return 0 on success.
|
||||||
|
@ -1181,7 +1181,7 @@ static int handle_data_packet_helper(const Net_Crypto *c, int crypt_connection_i
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Handle a packet that was recieved for the connection.
|
/* Handle a packet that was received for the connection.
|
||||||
*
|
*
|
||||||
* return -1 on failure.
|
* return -1 on failure.
|
||||||
* return 0 on success.
|
* return 0 on success.
|
||||||
|
@ -1387,7 +1387,7 @@ static int getcryptconnection_id_dht_pubkey(const Net_Crypto *c, const uint8_t *
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add a source to the crypto connection.
|
/* Add a source to the crypto connection.
|
||||||
* This is to be used only when we have recieved a packet from that source.
|
* This is to be used only when we have received a packet from that source.
|
||||||
*
|
*
|
||||||
* return -1 on failure.
|
* return -1 on failure.
|
||||||
* return positive number on success.
|
* return positive number on success.
|
||||||
|
@ -1990,7 +1990,7 @@ int send_tcp_onion_request(Net_Crypto *c, const uint8_t *data, uint16_t length)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the function to be called when an onion response packet is recieved by one of the TCP connections.
|
/* Set the function to be called when an onion response packet is received by one of the TCP connections.
|
||||||
*/
|
*/
|
||||||
void tcp_onion_response_handler(Net_Crypto *c, int (*tcp_onion_callback)(void *object, const uint8_t *data,
|
void tcp_onion_response_handler(Net_Crypto *c, int (*tcp_onion_callback)(void *object, const uint8_t *data,
|
||||||
uint16_t length), void *object)
|
uint16_t length), void *object)
|
||||||
|
@ -2290,7 +2290,7 @@ static int udp_handle_packet(void *object, IP_Port source, const uint8_t *packet
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The dT for the average packet recieving rate calculations.
|
/* The dT for the average packet receiving rate calculations.
|
||||||
Also used as the */
|
Also used as the */
|
||||||
#define PACKET_COUNTER_AVERAGE_INTERVAL 100
|
#define PACKET_COUNTER_AVERAGE_INTERVAL 100
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
before giving up. */
|
before giving up. */
|
||||||
#define MAX_NUM_SENDPACKET_TRIES 8
|
#define MAX_NUM_SENDPACKET_TRIES 8
|
||||||
|
|
||||||
/* The timeout of no recieved UDP packets before the direct UDP connection is considered dead. */
|
/* The timeout of no received UDP packets before the direct UDP connection is considered dead. */
|
||||||
#define UDP_DIRECT_TIMEOUT (MAX_NUM_SENDPACKET_TRIES * CRYPTO_SEND_PACKET_INTERVAL * 2)
|
#define UDP_DIRECT_TIMEOUT (MAX_NUM_SENDPACKET_TRIES * CRYPTO_SEND_PACKET_INTERVAL * 2)
|
||||||
|
|
||||||
#define PACKET_ID_PADDING 0
|
#define PACKET_ID_PADDING 0
|
||||||
|
@ -341,7 +341,7 @@ int add_tcp_relay_peer(Net_Crypto *c, int crypt_connection_id, IP_Port ip_port,
|
||||||
*/
|
*/
|
||||||
int add_tcp_relay(Net_Crypto *c, IP_Port ip_port, const uint8_t *public_key);
|
int add_tcp_relay(Net_Crypto *c, IP_Port ip_port, const uint8_t *public_key);
|
||||||
|
|
||||||
/* Set the function to be called when an onion response packet is recieved by one of the TCP connections.
|
/* Set the function to be called when an onion response packet is received by one of the TCP connections.
|
||||||
*/
|
*/
|
||||||
void tcp_onion_response_handler(Net_Crypto *c, int (*tcp_onion_callback)(void *object, const uint8_t *data,
|
void tcp_onion_response_handler(Net_Crypto *c, int (*tcp_onion_callback)(void *object, const uint8_t *data,
|
||||||
uint16_t length), void *object);
|
uint16_t length), void *object);
|
||||||
|
|
|
@ -95,7 +95,7 @@ void tox_dns3_kill(void *dns3_object)
|
||||||
* This is what the string returned looks like:
|
* This is what the string returned looks like:
|
||||||
* 4haaaaipr1o3mz0bxweox541airydbovqlbju51mb4p0ebxq.rlqdj4kkisbep2ks3fj2nvtmk4daduqiueabmexqva1jc
|
* 4haaaaipr1o3mz0bxweox541airydbovqlbju51mb4p0ebxq.rlqdj4kkisbep2ks3fj2nvtmk4daduqiueabmexqva1jc
|
||||||
*
|
*
|
||||||
* returns length of string on sucess.
|
* returns length of string on success.
|
||||||
* returns -1 on failure.
|
* returns -1 on failure.
|
||||||
*/
|
*/
|
||||||
int tox_generate_dns3_string(void *dns3_object, uint8_t *string, uint16_t string_max_len, uint32_t *request_id,
|
int tox_generate_dns3_string(void *dns3_object, uint8_t *string, uint16_t string_max_len, uint32_t *request_id,
|
||||||
|
|
|
@ -61,7 +61,7 @@ void tox_dns3_kill(void *dns3_object);
|
||||||
* This is what the string returned looks like:
|
* This is what the string returned looks like:
|
||||||
* 4haaaaipr1o3mz0bxweox541airydbovqlbju51mb4p0ebxq.rlqdj4kkisbep2ks3fj2nvtmk4daduqiueabmexqva1jc
|
* 4haaaaipr1o3mz0bxweox541airydbovqlbju51mb4p0ebxq.rlqdj4kkisbep2ks3fj2nvtmk4daduqiueabmexqva1jc
|
||||||
*
|
*
|
||||||
* returns length of string on sucess.
|
* returns length of string on success.
|
||||||
* returns -1 on failure.
|
* returns -1 on failure.
|
||||||
*/
|
*/
|
||||||
int tox_generate_dns3_string(void *dns3_object, uint8_t *string, uint16_t string_max_len, uint32_t *request_id,
|
int tox_generate_dns3_string(void *dns3_object, uint8_t *string, uint16_t string_max_len, uint32_t *request_id,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user