mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
multiple spelling fixes
This commit is contained in:
parent
3835bc167b
commit
cf33c2f9ad
@ -21,18 +21,18 @@ See DHT, currently uses the IPv6 Node_format.
|
|||||||
Get nodes (Request):
|
Get nodes (Request):
|
||||||
Packet contents:
|
Packet contents:
|
||||||
```
|
```
|
||||||
[char with a value of 48][Bob's (The reciever's) Public key (client_id) (32 bytes))][Alice's (The sender's) Public key (client_id) (32 bytes)][Random nonce (24 bytes)][Encrypted with the nonce, private key of the sender and public key of the reciever:[char with a value of 48][random 8 byte (ping_id)]
|
[char with a value of 48][Bob's (The receiver's) Public key (client_id) (32 bytes))][Alice's (The sender's) Public key (client_id) (32 bytes)][Random nonce (24 bytes)][Encrypted with the nonce, private key of the sender and public key of the receiver:[char with a value of 48][random 8 byte (ping_id)]
|
||||||
```
|
```
|
||||||
Valid replies: a send_nodes packet
|
Valid replies: a send_nodes packet
|
||||||
|
|
||||||
Send_nodes (response):
|
Send_nodes (response):
|
||||||
```
|
```
|
||||||
[char with a value of 48][Bob's (The reciever's) Public key (client_id) (32 bytes))][Alice's (The sender's) Public key (client_id) (32 bytes)][Random nonce (24 bytes)][Encrypted with the nonce, private key of the sender and public key of the reciever:[char with a value of 49][random 8 byte (ping_id)][Nodes in node format, length=40 * (number of nodes (maximum of 6 nodes)) bytes]]
|
[char with a value of 48][Bob's (The receiver's) Public key (client_id) (32 bytes))][Alice's (The sender's) Public key (client_id) (32 bytes)][Random nonce (24 bytes)][Encrypted with the nonce, private key of the sender and public key of the receiver:[char with a value of 49][random 8 byte (ping_id)][Nodes in node format, length=40 * (number of nodes (maximum of 6 nodes)) bytes]]
|
||||||
```
|
```
|
||||||
|
|
||||||
Broadcast packet:
|
Broadcast packet:
|
||||||
```
|
```
|
||||||
[char with a value of 48][Bob's (The reciever's) Public key (client_id) (32 bytes))][Alice's (The sender's) Public key (client_id) (32 bytes)][nonce][Encrypted with the nonce, private key of the sender and public key of the reciever:[char with a value of 50][Data to send to everyone]]
|
[char with a value of 48][Bob's (The receiver's) Public key (client_id) (32 bytes))][Alice's (The sender's) Public key (client_id) (32 bytes)][nonce][Encrypted with the nonce, private key of the sender and public key of the receiver:[char with a value of 50][Data to send to everyone]]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
@ -110,7 +110,8 @@ encrypted with that temporary private key and the nonce and the public key from
|
|||||||
(if Node D contains the ret data for the node, it sends the stuff in this packet as a data to route response packet to the right node)
|
(if Node D contains the ret data for the node, it sends the stuff in this packet as a data to route response packet to the right node)
|
||||||
|
|
||||||
The data in the previous packet is in format: [real public key of sender]
|
The data in the previous packet is in format: [real public key of sender]
|
||||||
encrypted with real private key of the sender, the nonce in the data packet and the real public key of the reciever:[[uint8_t id][data (optional)]]
|
encrypted with real private key of the sender, the nonce in the data packet and
|
||||||
|
the real public key of the receiver:[[uint8_t id][data (optional)]]
|
||||||
|
|
||||||
Data sent to us:
|
Data sent to us:
|
||||||
announce response packet:
|
announce response packet:
|
||||||
@ -153,5 +154,5 @@ Data packets:
|
|||||||
|
|
||||||
To tell our friend what our DHT public key is so that he can connect to us we send a data packet
|
To tell our friend what our DHT public key is so that he can connect to us we send a data packet
|
||||||
with id 156 and the data being:[uint64_t (in network byte order) no_replay, the packet will only be
|
with id 156 and the data being:[uint64_t (in network byte order) no_replay, the packet will only be
|
||||||
accepted if this number is bigger than the last one recieved] [our dht public key][Node_Format * (
|
accepted if this number is bigger than the last one received] [our dht public key][Node_Format * (
|
||||||
maximum of 8) nodes closest to us so that the friend can find us faster]
|
maximum of 8) nodes closest to us so that the friend can find us faster]
|
||||||
|
@ -81,7 +81,7 @@ received
|
|||||||
client sent the server the public key and the public key we sent to the client,
|
client sent the server the public key and the public key we sent to the client,
|
||||||
the next with base nonce + 1...)
|
the next with base nonce + 1...)
|
||||||
|
|
||||||
The connection is set to an unconfirmed state until a packet is recieved and
|
The connection is set to an unconfirmed state until a packet is received and
|
||||||
decrypted correctly using the information in the handshake.
|
decrypted correctly using the information in the handshake.
|
||||||
|
|
||||||
each packet sent to/from the server has an id (the first byte of the plain text
|
each packet sent to/from the server has an id (the first byte of the plain text
|
||||||
@ -135,7 +135,7 @@ responses must be sent to the proper client.
|
|||||||
|
|
||||||
Ping responses must have the same ping_id as the request.
|
Ping responses must have the same ping_id as the request.
|
||||||
|
|
||||||
If the server recieves a ping packet he must respond with a ping response.
|
If the server receives a ping packet he must respond with a ping response.
|
||||||
|
|
||||||
The server will send a ping packet to clients every 30 seconds, they have 30
|
The server will send a ping packet to clients every 30 seconds, they have 30
|
||||||
seconds to respond, if they don't the connection is deleted.
|
seconds to respond, if they don't the connection is deleted.
|
||||||
|
@ -34,7 +34,7 @@ msi_session_t* - pointer to a newly created msi session handler.
|
|||||||
###msi_session_t reference:
|
###msi_session_t reference:
|
||||||
|
|
||||||
How to handle msi session:
|
How to handle msi session:
|
||||||
Controling is done via callbacks and action handlers.
|
Controlling is done via callbacks and action handlers.
|
||||||
First register callbacks for every state/action received and make sure
|
First register callbacks for every state/action received and make sure
|
||||||
NOT TO PLACE SOMETHING LIKE LOOPS THAT TAKES A LOT OF TIME TO EXECUTE; every callback is being called
|
NOT TO PLACE SOMETHING LIKE LOOPS THAT TAKES A LOT OF TIME TO EXECUTE; every callback is being called
|
||||||
directly from event loop. You can find examples in phone.c.
|
directly from event loop. You can find examples in phone.c.
|
||||||
|
@ -74,4 +74,4 @@ Crypto request packets
|
|||||||
|
|
||||||
The encrypted message is encrypted with crypto_box() (using Bobs public key, Alice's private key and the nonce (randomly generated 24 bytes)) and is a message from Alice in which she tells Bob who she is.
|
The encrypted message is encrypted with crypto_box() (using Bobs public key, Alice's private key and the nonce (randomly generated 24 bytes)) and is a message from Alice in which she tells Bob who she is.
|
||||||
|
|
||||||
Each node can route the request to the reciever if they are connected to him. This is to bypass bad NATs.
|
Each node can route the request to the receiver if they are connected to him. This is to bypass bad NATs.
|
||||||
|
@ -53,7 +53,7 @@ fi[]dnl
|
|||||||
# to PKG_CHECK_MODULES(), but does not set variables or print errors.
|
# to PKG_CHECK_MODULES(), but does not set variables or print errors.
|
||||||
#
|
#
|
||||||
# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
||||||
# only at the first occurence in configure.ac, so if the first place
|
# only at the first occurrence in configure.ac, so if the first place
|
||||||
# it's called might be skipped (such as if it is within an "if", you
|
# it's called might be skipped (such as if it is within an "if", you
|
||||||
# have to call PKG_CHECK_EXISTS manually
|
# have to call PKG_CHECK_EXISTS manually
|
||||||
# --------------------------------------------------------------
|
# --------------------------------------------------------------
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
As maintaining 2 seperate lists of the same information seemed redundant, this list has been phased out.
|
As maintaining 2 separate lists of the same information seemed redundant, this list has been phased out.
|
||||||
|
|
||||||
For a current DHT node list please visit http://wiki.tox.im/nodes
|
For a current DHT node list please visit http://wiki.tox.im/nodes
|
||||||
|
@ -32,7 +32,7 @@ void print_key(uint8_t *client_id)
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
printf("usage: ./cracker public_key(or beggining of one in hex format)\n");
|
printf("usage: ./cracker public_key(or beginning of one in hex format)\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
22
toxav/msi.c
22
toxav/msi.c
@ -206,7 +206,7 @@ static inline__ const uint8_t *stringify_response ( MSIResponse response )
|
|||||||
|
|
||||||
#define ON_HEADER(iterator, header, descriptor, size_const) \
|
#define ON_HEADER(iterator, header, descriptor, size_const) \
|
||||||
( memcmp(iterator, descriptor, size_const) == 0){ /* Okay */ \
|
( memcmp(iterator, descriptor, size_const) == 0){ /* Okay */ \
|
||||||
iterator += size_const; /* Set iterator at begining of value part */ \
|
iterator += size_const; /* Set iterator at beginning of value part */ \
|
||||||
if ( *iterator != value_byte ) { assert(0); return -1; }\
|
if ( *iterator != value_byte ) { assert(0); return -1; }\
|
||||||
iterator ++;\
|
iterator ++;\
|
||||||
uint16_t _value_size = (uint16_t) *(iterator ) << 8 | \
|
uint16_t _value_size = (uint16_t) *(iterator ) << 8 | \
|
||||||
@ -225,7 +225,7 @@ static inline__ const uint8_t *stringify_response ( MSIResponse response )
|
|||||||
* @param msg Container.
|
* @param msg Container.
|
||||||
* @param data The data.
|
* @param data The data.
|
||||||
* @return int
|
* @return int
|
||||||
* @retval -1 Error occured.
|
* @retval -1 Error occurred.
|
||||||
* @retval 0 Success.
|
* @retval 0 Success.
|
||||||
*/
|
*/
|
||||||
int parse_raw_data ( MSIMessage *msg, const uint8_t *data, uint16_t length )
|
int parse_raw_data ( MSIMessage *msg, const uint8_t *data, uint16_t length )
|
||||||
@ -338,7 +338,7 @@ void free_message ( MSIMessage *msg )
|
|||||||
* @param type Request or response.
|
* @param type Request or response.
|
||||||
* @param type_id Type of request/response.
|
* @param type_id Type of request/response.
|
||||||
* @return MSIMessage* Created message.
|
* @return MSIMessage* Created message.
|
||||||
* @retval NULL Error occured.
|
* @retval NULL Error occurred.
|
||||||
*/
|
*/
|
||||||
MSIMessage *msi_new_message ( uint8_t type, const uint8_t *type_id )
|
MSIMessage *msi_new_message ( uint8_t type, const uint8_t *type_id )
|
||||||
{
|
{
|
||||||
@ -367,7 +367,7 @@ MSIMessage *msi_new_message ( uint8_t type, const uint8_t *type_id )
|
|||||||
*
|
*
|
||||||
* @param data The data.
|
* @param data The data.
|
||||||
* @return MSIMessage* Parsed message.
|
* @return MSIMessage* Parsed message.
|
||||||
* @retval NULL Error occured.
|
* @retval NULL Error occurred.
|
||||||
*/
|
*/
|
||||||
MSIMessage *parse_message ( const uint8_t *data, uint16_t length )
|
MSIMessage *parse_message ( const uint8_t *data, uint16_t length )
|
||||||
{
|
{
|
||||||
@ -422,7 +422,7 @@ uint8_t *append_header_to_string (
|
|||||||
|
|
||||||
*dest = field_byte; /* Set the first byte */
|
*dest = field_byte; /* Set the first byte */
|
||||||
|
|
||||||
uint8_t *_getback_byte = dest + 1; /* remeber the byte we were on */
|
uint8_t *_getback_byte = dest + 1; /* remember the byte we were on */
|
||||||
dest += 3; /* swith to 4th byte where field value starts */
|
dest += 3; /* swith to 4th byte where field value starts */
|
||||||
|
|
||||||
/* Now set the field value and calculate it's length */
|
/* Now set the field value and calculate it's length */
|
||||||
@ -604,7 +604,7 @@ static inline__ const uint8_t *stringify_error_code ( MSICallError error_code )
|
|||||||
* @param msg The message.
|
* @param msg The message.
|
||||||
* @param to Where to.
|
* @param to Where to.
|
||||||
* @return int
|
* @return int
|
||||||
* @retval -1 Error occured.
|
* @retval -1 Error occurred.
|
||||||
* @retval 0 Success.
|
* @retval 0 Success.
|
||||||
*/
|
*/
|
||||||
int send_message ( MSISession *session, MSIMessage *msg, uint32_t to )
|
int send_message ( MSISession *session, MSIMessage *msg, uint32_t to )
|
||||||
@ -721,7 +721,7 @@ int handle_error ( MSISession *session, MSICallError errid, uint32_t to )
|
|||||||
* @param msg The message.
|
* @param msg The message.
|
||||||
* @return int
|
* @return int
|
||||||
* @retval -1 No error.
|
* @retval -1 No error.
|
||||||
* @retval 0 Error occured and response sent.
|
* @retval 0 Error occurred and response sent.
|
||||||
*/
|
*/
|
||||||
int has_call_error ( MSISession *session, MSIMessage *msg )
|
int has_call_error ( MSISession *session, MSIMessage *msg )
|
||||||
{
|
{
|
||||||
@ -830,7 +830,7 @@ MSICall *init_call ( MSISession *session, int peers, int ringing_timeout )
|
|||||||
*
|
*
|
||||||
* @param session Control session.
|
* @param session Control session.
|
||||||
* @return int
|
* @return int
|
||||||
* @retval -1 Error occured.
|
* @retval -1 Error occurred.
|
||||||
* @retval 0 Success.
|
* @retval 0 Success.
|
||||||
*/
|
*/
|
||||||
int terminate_call ( MSISession *session )
|
int terminate_call ( MSISession *session )
|
||||||
@ -882,7 +882,7 @@ int handle_recv_invite ( MSISession *session, MSIMessage *msg )
|
|||||||
* B calls A. Who has advantage is set bey calculating
|
* B calls A. Who has advantage is set bey calculating
|
||||||
* 'bigger' Call id and then that call id is being used in
|
* 'bigger' Call id and then that call id is being used in
|
||||||
* future. User with 'bigger' Call id has the advantage
|
* future. User with 'bigger' Call id has the advantage
|
||||||
* as in he will wait the reponse from the other.
|
* as in he will wait the response from the other.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( call_id_bigger (session->call->id, msg->callid.header_value) == 1 ) { /* Peer has advantage */
|
if ( call_id_bigger (session->call->id, msg->callid.header_value) == 1 ) { /* Peer has advantage */
|
||||||
@ -1250,7 +1250,7 @@ void msi_register_callback ( MSICallback callback, MSICallbackID id, void* userd
|
|||||||
* @param messenger Tox* object.
|
* @param messenger Tox* object.
|
||||||
* @param user_agent User agent, i.e. 'Venom'; 'QT-gui'
|
* @param user_agent User agent, i.e. 'Venom'; 'QT-gui'
|
||||||
* @return MSISession* The created session.
|
* @return MSISession* The created session.
|
||||||
* @retval NULL Error occured.
|
* @retval NULL Error occurred.
|
||||||
*/
|
*/
|
||||||
MSISession *msi_init_session ( Messenger* messenger )
|
MSISession *msi_init_session ( Messenger* messenger )
|
||||||
{
|
{
|
||||||
@ -1351,7 +1351,7 @@ int msi_invite ( MSISession *session, MSICallType call_type, uint32_t rngsec, ui
|
|||||||
*
|
*
|
||||||
* @param session Control session.
|
* @param session Control session.
|
||||||
* @return int
|
* @return int
|
||||||
* @retval -1 Error occured.
|
* @retval -1 Error occurred.
|
||||||
* @retval 0 Success.
|
* @retval 0 Success.
|
||||||
*/
|
*/
|
||||||
int msi_hangup ( MSISession *session )
|
int msi_hangup ( MSISession *session )
|
||||||
|
@ -82,7 +82,7 @@ typedef struct _MSICall { /* Call info structure */
|
|||||||
int ringing_timer_id; /* Timer id for ringing timeout */
|
int ringing_timer_id; /* Timer id for ringing timeout */
|
||||||
|
|
||||||
pthread_mutex_t mutex; /* It's to be assumed that call will have
|
pthread_mutex_t mutex; /* It's to be assumed that call will have
|
||||||
* seperate thread so add mutex
|
* separate thread so add mutex
|
||||||
*/
|
*/
|
||||||
uint32_t *peers;
|
uint32_t *peers;
|
||||||
uint16_t peer_count;
|
uint16_t peer_count;
|
||||||
@ -152,7 +152,7 @@ void msi_register_callback(MSICallback callback, MSICallbackID id, void* userdat
|
|||||||
*
|
*
|
||||||
* @param messenger Tox* object.
|
* @param messenger Tox* object.
|
||||||
* @return MSISession* The created session.
|
* @return MSISession* The created session.
|
||||||
* @retval NULL Error occured.
|
* @retval NULL Error occurred.
|
||||||
*/
|
*/
|
||||||
MSISession *msi_init_session ( Messenger *messenger );
|
MSISession *msi_init_session ( Messenger *messenger );
|
||||||
|
|
||||||
@ -183,7 +183,7 @@ int msi_invite ( MSISession *session, MSICallType call_type, uint32_t rngsec, ui
|
|||||||
*
|
*
|
||||||
* @param session Control session.
|
* @param session Control session.
|
||||||
* @return int
|
* @return int
|
||||||
* @retval -1 Error occured.
|
* @retval -1 Error occurred.
|
||||||
* @retval 0 Success.
|
* @retval 0 Success.
|
||||||
*/
|
*/
|
||||||
int msi_hangup ( MSISession *session );
|
int msi_hangup ( MSISession *session );
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* This file is for testing/reference purposes only, hence
|
* This file is for testing/reference purposes only, hence
|
||||||
* it is _poorly_ designed and it does not fully reflect the
|
* it is _poorly_ designed and it does not fully reflect the
|
||||||
* quaility of msi nor rtp. Although toxmsi* and toxrtp* are tested
|
* quaility of msi nor rtp. Although toxmsi* and toxrtp* are tested
|
||||||
* there is always possiblity of crashes. If crash occures,
|
* there is always possibility of crashes. If crash occures,
|
||||||
* contact me ( mannol ) on either irc channel #tox-dev @ freenode.net:6667
|
* contact me ( mannol ) on either irc channel #tox-dev @ freenode.net:6667
|
||||||
* or eniz_vukovic@hotmail.com
|
* or eniz_vukovic@hotmail.com
|
||||||
*
|
*
|
||||||
@ -612,7 +612,7 @@ void *decode_video_thread(void *arg)
|
|||||||
|
|
||||||
} //else {
|
} //else {
|
||||||
|
|
||||||
/* TODO: request the sender to create a new i-frame immediatly */
|
/* TODO: request the sender to create a new i-frame immediately */
|
||||||
//printf("Bad video packet\n");
|
//printf("Bad video packet\n");
|
||||||
//}
|
//}
|
||||||
//}
|
//}
|
||||||
|
@ -164,7 +164,7 @@ void get_shared_key(Shared_Keys *shared_keys, uint8_t *shared_key, uint8_t *secr
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Copy shared_key to decrypt DHT packet from client_id into shared_key
|
/* Copy shared_key to decrypt DHT packet from client_id into shared_key
|
||||||
* for packets that we recieve.
|
* for packets that we receive.
|
||||||
*/
|
*/
|
||||||
void DHT_get_shared_key_recv(DHT *dht, uint8_t *shared_key, uint8_t *client_id)
|
void DHT_get_shared_key_recv(DHT *dht, uint8_t *shared_key, uint8_t *client_id)
|
||||||
{
|
{
|
||||||
@ -600,7 +600,7 @@ static int replace_possible_bad( Client_data *list,
|
|||||||
|
|
||||||
sort_list(list, length, comp_client_id);
|
sort_list(list, length, comp_client_id);
|
||||||
|
|
||||||
/* TODO: decide if the folowing lines should stay commented or not.
|
/* TODO: decide if the following lines should stay commented or not.
|
||||||
if (id_closest(comp_client_id, list[0].client_id, client_id) == 1)
|
if (id_closest(comp_client_id, list[0].client_id, client_id) == 1)
|
||||||
return 0;*/
|
return 0;*/
|
||||||
|
|
||||||
@ -861,20 +861,20 @@ static int getnodes(DHT *dht, IP_Port ip_port, uint8_t *public_key, uint8_t *cli
|
|||||||
|
|
||||||
uint64_t temp_time = unix_time();
|
uint64_t temp_time = unix_time();
|
||||||
memcpy(plain_message, &temp_time, sizeof(temp_time));
|
memcpy(plain_message, &temp_time, sizeof(temp_time));
|
||||||
Node_format reciever;
|
Node_format receiver;
|
||||||
memcpy(reciever.client_id, public_key, CLIENT_ID_SIZE);
|
memcpy(receiver.client_id, public_key, CLIENT_ID_SIZE);
|
||||||
reciever.ip_port = ip_port;
|
receiver.ip_port = ip_port;
|
||||||
memcpy(plain_message + sizeof(temp_time), &reciever, sizeof(reciever));
|
memcpy(plain_message + sizeof(temp_time), &receiver, sizeof(receiver));
|
||||||
|
|
||||||
if (sendback_node != NULL)
|
if (sendback_node != NULL)
|
||||||
memcpy(plain_message + sizeof(temp_time) + sizeof(reciever), sendback_node, sizeof(Node_format));
|
memcpy(plain_message + sizeof(temp_time) + sizeof(receiver), sendback_node, sizeof(Node_format));
|
||||||
else
|
else
|
||||||
memset(plain_message + sizeof(temp_time) + sizeof(reciever), 0, sizeof(Node_format));
|
memset(plain_message + sizeof(temp_time) + sizeof(receiver), 0, sizeof(Node_format));
|
||||||
|
|
||||||
int len_m = encrypt_data_symmetric(dht->secret_symmetric_key,
|
int len_m = encrypt_data_symmetric(dht->secret_symmetric_key,
|
||||||
nonce,
|
nonce,
|
||||||
plain_message,
|
plain_message,
|
||||||
sizeof(temp_time) + sizeof(reciever) + sizeof(Node_format),
|
sizeof(temp_time) + sizeof(receiver) + sizeof(Node_format),
|
||||||
encrypted_message + crypto_secretbox_NONCEBYTES);
|
encrypted_message + crypto_secretbox_NONCEBYTES);
|
||||||
|
|
||||||
if (len_m != NODES_ENCRYPTED_MESSAGE_LENGTH - crypto_secretbox_NONCEBYTES)
|
if (len_m != NODES_ENCRYPTED_MESSAGE_LENGTH - crypto_secretbox_NONCEBYTES)
|
||||||
|
@ -192,7 +192,7 @@ typedef struct {
|
|||||||
void get_shared_key(Shared_Keys *shared_keys, uint8_t *shared_key, uint8_t *secret_key, uint8_t *client_id);
|
void get_shared_key(Shared_Keys *shared_keys, uint8_t *shared_key, uint8_t *secret_key, uint8_t *client_id);
|
||||||
|
|
||||||
/* Copy shared_key to decrypt DHT packet from client_id into shared_key
|
/* Copy shared_key to decrypt DHT packet from client_id into shared_key
|
||||||
* for packets that we recieve.
|
* for packets that we receive.
|
||||||
*/
|
*/
|
||||||
void DHT_get_shared_key_recv(DHT *dht, uint8_t *shared_key, uint8_t *client_id);
|
void DHT_get_shared_key_recv(DHT *dht, uint8_t *shared_key, uint8_t *client_id);
|
||||||
|
|
||||||
|
@ -292,7 +292,7 @@ static int new_inconnection(Lossless_UDP *ludp, IP_Port ip_port)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* return an integer corresponding to the next connection in our incoming connection list with at least numpackets in the recieve queue.
|
* return an integer corresponding to the next connection in our incoming connection list with at least numpackets in the receive queue.
|
||||||
* return -1 if there are no new incoming connections in the list.
|
* return -1 if there are no new incoming connections in the list.
|
||||||
*/
|
*/
|
||||||
int incoming_connection(Lossless_UDP *ludp, uint32_t numpackets)
|
int incoming_connection(Lossless_UDP *ludp, uint32_t numpackets)
|
||||||
|
@ -156,7 +156,7 @@ int new_connection(Lossless_UDP *ludp, IP_Port ip_port);
|
|||||||
int getconnection_id(Lossless_UDP *ludp, IP_Port ip_port);
|
int getconnection_id(Lossless_UDP *ludp, IP_Port ip_port);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* return an integer corresponding to the next connection in our incoming connection list with at least numpackets in the recieve queue.
|
* return an integer corresponding to the next connection in our incoming connection list with at least numpackets in the receive queue.
|
||||||
* return -1 if there are no new incoming connections in the list.
|
* return -1 if there are no new incoming connections in the list.
|
||||||
*/
|
*/
|
||||||
int incoming_connection(Lossless_UDP *ludp, uint32_t numpackets);
|
int incoming_connection(Lossless_UDP *ludp, uint32_t numpackets);
|
||||||
|
@ -2172,7 +2172,7 @@ void do_friends(Messenger *m)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (m->friendlist[i].ping_lastrecv + FRIEND_CONNECTION_TIMEOUT < temp_time) {
|
if (m->friendlist[i].ping_lastrecv + FRIEND_CONNECTION_TIMEOUT < temp_time) {
|
||||||
/* If we stopped recieving ping packets, kill it. */
|
/* If we stopped receiving ping packets, kill it. */
|
||||||
crypto_kill(m->net_crypto, m->friendlist[i].crypt_connection_id);
|
crypto_kill(m->net_crypto, m->friendlist[i].crypt_connection_id);
|
||||||
m->friendlist[i].crypt_connection_id = -1;
|
m->friendlist[i].crypt_connection_id = -1;
|
||||||
set_friend_status(m, i, FRIEND_CONFIRMED);
|
set_friend_status(m, i, FRIEND_CONFIRMED);
|
||||||
|
@ -90,7 +90,7 @@ enum {
|
|||||||
/* Interval between the sending of ping packets. */
|
/* Interval between the sending of ping packets. */
|
||||||
#define FRIEND_PING_INTERVAL 5
|
#define FRIEND_PING_INTERVAL 5
|
||||||
|
|
||||||
/* If no packets are recieved from friend in this time interval, kill the connection. */
|
/* If no packets are received from friend in this time interval, kill the connection. */
|
||||||
#define FRIEND_CONNECTION_TIMEOUT (FRIEND_PING_INTERVAL * 2)
|
#define FRIEND_CONNECTION_TIMEOUT (FRIEND_PING_INTERVAL * 2)
|
||||||
|
|
||||||
/* USERSTATUS -
|
/* USERSTATUS -
|
||||||
@ -354,7 +354,7 @@ int setname(Messenger *m, uint8_t *name, uint16_t length);
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Get your nickname.
|
* Get your nickname.
|
||||||
* m - The messanger context to use.
|
* m - The messenger context to use.
|
||||||
* name needs to be a valid memory location with a size of at least MAX_NAME_LENGTH bytes.
|
* name needs to be a valid memory location with a size of at least MAX_NAME_LENGTH bytes.
|
||||||
*
|
*
|
||||||
* return length of the name.
|
* return length of the name.
|
||||||
|
@ -224,7 +224,7 @@ int read_TCP_packet(sock_t sock, uint8_t *data, uint16_t length)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return length of recieved packet on success.
|
/* return length of received packet on success.
|
||||||
* return 0 if could not read any packet.
|
* return 0 if could not read any packet.
|
||||||
* return -1 on failure (connection must be killed).
|
* return -1 on failure (connection must be killed).
|
||||||
*/
|
*/
|
||||||
|
@ -140,7 +140,7 @@ uint16_t read_TCP_length(sock_t sock);
|
|||||||
*/
|
*/
|
||||||
int read_TCP_packet(sock_t sock, uint8_t *data, uint16_t length);
|
int read_TCP_packet(sock_t sock, uint8_t *data, uint16_t length);
|
||||||
|
|
||||||
/* return length of recieved packet on success.
|
/* return length of received packet on success.
|
||||||
* return 0 if could not read any packet.
|
* return 0 if could not read any packet.
|
||||||
* return -1 on failure (connection must be killed).
|
* return -1 on failure (connection must be killed).
|
||||||
*/
|
*/
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
* Candidates are kept in buckets of hash tables. The hash
|
* Candidates are kept in buckets of hash tables. The hash
|
||||||
* function is calculated from the client_id. Up to
|
* function is calculated from the client_id. Up to
|
||||||
* HASH_COLLIDE_COUNT alternative positions are tried if
|
* HASH_COLLIDE_COUNT alternative positions are tried if
|
||||||
* the inital position is already used by a different entry.
|
* the initial position is already used by a different entry.
|
||||||
* The collision function is multiplicative, not additive.
|
* The collision function is multiplicative, not additive.
|
||||||
*
|
*
|
||||||
* A new candidate can bump an existing candidate, if it is
|
* A new candidate can bump an existing candidate, if it is
|
||||||
|
@ -284,7 +284,7 @@ int write_cryptpacket(Net_Crypto *c, int crypt_connection_id, uint8_t *data, uin
|
|||||||
|
|
||||||
/* 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_DATA_SIZE big.
|
* packet must be an array of MAX_DATA_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).
|
||||||
|
@ -162,7 +162,7 @@ int write_cryptpacket(Net_Crypto *c, int crypt_connection_id, uint8_t *data, uin
|
|||||||
|
|
||||||
/* 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_DATA_SIZE big.
|
* packet must be an array of MAX_DATA_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).
|
||||||
|
@ -513,9 +513,9 @@ static int handle_fakeid_announce(void *object, uint8_t *source_pubkey, uint8_t
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* Send data of length length to friendnum.
|
/* Send data of length length to friendnum.
|
||||||
* This data will be recieved by the friend using the Onion_Data_Handlers callbacks.
|
* This data will be received by the friend using the Onion_Data_Handlers callbacks.
|
||||||
*
|
*
|
||||||
* Even if this function succeeds, the friend might not recieve any data.
|
* Even if this function succeeds, the friend might not receive any data.
|
||||||
*
|
*
|
||||||
* return the number of packets sent on success
|
* return the number of packets sent on success
|
||||||
* return -1 on failure.
|
* return -1 on failure.
|
||||||
@ -578,7 +578,7 @@ int send_onion_data(Onion_Client *onion_c, int friend_num, uint8_t *data, uint32
|
|||||||
|
|
||||||
/* Try to send the fakeid via the DHT instead of onion
|
/* Try to send the fakeid via the DHT instead of onion
|
||||||
*
|
*
|
||||||
* Even if this function succeeds, the friend might not recieve any data.
|
* Even if this function succeeds, the friend might not receive any data.
|
||||||
*
|
*
|
||||||
* return the number of packets sent on success
|
* return the number of packets sent on success
|
||||||
* return -1 on failure.
|
* return -1 on failure.
|
||||||
|
@ -172,9 +172,9 @@ int onion_getfriendip(Onion_Client *onion_c, int friend_num, IP_Port *ip_port);
|
|||||||
|
|
||||||
|
|
||||||
/* Send data of length length to friendnum.
|
/* Send data of length length to friendnum.
|
||||||
* This data will be recieved by the friend using the Onion_Data_Handlers callbacks.
|
* This data will be received by the friend using the Onion_Data_Handlers callbacks.
|
||||||
*
|
*
|
||||||
* Even if this function succeeds, the friend might not recieve any data.
|
* Even if this function succeeds, the friend might not receive any data.
|
||||||
*
|
*
|
||||||
* return the number of packets sent on success
|
* return the number of packets sent on success
|
||||||
* return -1 on failure.
|
* return -1 on failure.
|
||||||
|
@ -186,7 +186,7 @@ int tox_set_name(Tox *tox, uint8_t *name, uint16_t length)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Get your nickname.
|
/* Get your nickname.
|
||||||
* m - The messanger context to use.
|
* m - The messenger context to use.
|
||||||
* name - Pointer to a string for the name. (must be at least MAX_NAME_LENGTH)
|
* name - Pointer to a string for the name. (must be at least MAX_NAME_LENGTH)
|
||||||
*
|
*
|
||||||
* return length of the name.
|
* return length of the name.
|
||||||
|
@ -210,7 +210,7 @@ int tox_set_name(Tox *tox, uint8_t *name, uint16_t length);
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Get your nickname.
|
* Get your nickname.
|
||||||
* m - The messanger context to use.
|
* m - The messenger context to use.
|
||||||
* name - needs to be a valid memory location with a size of at least MAX_NAME_LENGTH (128) bytes.
|
* name - needs to be a valid memory location with a size of at least MAX_NAME_LENGTH (128) bytes.
|
||||||
*
|
*
|
||||||
* return length of name.
|
* return length of name.
|
||||||
@ -515,11 +515,11 @@ uint32_t tox_get_chatlist(Tox *tox, int *out_list, uint32_t list_size);
|
|||||||
* tox_file_data_remaining(...) can be used to know how many bytes are left to send/receive.
|
* tox_file_data_remaining(...) can be used to know how many bytes are left to send/receive.
|
||||||
*
|
*
|
||||||
* If the connection breaks during file sending (The other person goes offline without pausing the sending and then comes back)
|
* If the connection breaks during file sending (The other person goes offline without pausing the sending and then comes back)
|
||||||
* the reciever must send a control packet with receive_send == 0 message_id = TOX_FILECONTROL_RESUME_BROKEN and the data being
|
* the receiver must send a control packet with receive_send == 0 message_id = TOX_FILECONTROL_RESUME_BROKEN and the data being
|
||||||
* a uint64_t (in host byte order) containing the number of bytes recieved.
|
* a uint64_t (in host byte order) containing the number of bytes received.
|
||||||
*
|
*
|
||||||
* If the sender recieves this packet, he must send a control packet with receive_send == 1 and control_type == TOX_FILECONTROL_ACCEPT
|
* If the sender receives this packet, he must send a control packet with receive_send == 1 and control_type == TOX_FILECONTROL_ACCEPT
|
||||||
* then he must start sending file data from the position (data , uint64_t in host byte order) recieved in the TOX_FILECONTROL_RESUME_BROKEN packet.
|
* then he must start sending file data from the position (data , uint64_t in host byte order) received in the TOX_FILECONTROL_RESUME_BROKEN packet.
|
||||||
*
|
*
|
||||||
* More to come...
|
* More to come...
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user