Merge branch 'master' into encrypted_data

This commit is contained in:
Dubslow 2014-09-10 17:57:56 -05:00
commit b0fabd1caa
16 changed files with 35 additions and 37 deletions

View File

@ -27,7 +27,7 @@ Every peer is represented as a [byte string][String] (the public key [Tox ID] of
We want Tox to be as simple as possible while remaining as secure as possible.
### Why are you doing this? There are already a bunch of free Skype alternatives.
The goal of this project is to create a configuration-free P2P Skype replacement. Configuration-free means that the user will simply have to open the program and without any account configuration will be capable of adding people to his or her's friends list and start conversing with them. There are many so-called Skype replacements and all of them are either hard to configure for the normal user or suffer from being way too centralized.
The goal of this project is to create a configuration-free P2P Skype replacement. Configuration-free means that the user will simply have to open the program and will be capable of adding people and communicating with them without having to set up an account. There are many so-called Skype replacements, but all of them are either hard to configure for the normal user or suffer from being way too centralized.
## TODO:
- [TODO](/docs/TODO)

View File

@ -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]
[(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)
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:
[uint8_t packet id (134)][nonce][temporary just generated public key]

View File

@ -43,13 +43,13 @@ cookie request packet:
bytes)][Encrypted message containing: [Senders real public key (32
bytes)][padding (32 bytes)][uint64_t number (must be sent
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.
cookie response packet:
[uint8_t 25][Random nonce (24 bytes)][Encrypted message containing:
[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.
The Cookie should be basically:
@ -111,8 +111,8 @@ num]...[uint8_t num]
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
from the packet, substract 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
from the packet, subtract 1 to it and put it in packet_num then start from 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
has requested we send this packet again to them then continue to the next num in
the list.

View File

@ -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);
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);
break;
}

View File

@ -618,7 +618,7 @@ static void *timer_poll( void *arg )
LOGGER_ERROR("Failed to execute timer at: %d!", handler->timers[0]->timeout);
free(args);
} 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);
@ -1436,7 +1436,7 @@ static void msi_handle_packet ( Messenger *messenger, int source, const uint8_t
MSIMessage *msg;
if ( !length ) {
LOGGER_WARNING("Lenght param negative");
LOGGER_WARNING("Length param negative");
return;
}
@ -1552,6 +1552,7 @@ MSISession *msi_init_session ( Messenger *messenger, int32_t max_calls )
if (retu == NULL) {
LOGGER_ERROR("Allocation failed! Program might misbehave!");
timer_terminate_session(handler);
return NULL;
}
@ -1561,6 +1562,7 @@ MSISession *msi_init_session ( Messenger *messenger, int32_t max_calls )
if (!(retu->calls = calloc( sizeof (MSICall *), max_calls ))) {
LOGGER_ERROR("Allocation failed! Program might misbehave!");
timer_terminate_session(handler);
free(retu);
return NULL;
}

View File

@ -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
* @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
* @return void
@ -1091,7 +1091,7 @@ void toxav_handle_packet(RTPSession *_session, RTPMessage *_msg)
if (i == 0) {
/* piece of current frame */
} 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);
if (p) {

View File

@ -167,7 +167,7 @@ void toxav_kill(ToxAv *av);
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 callback The callback
@ -177,7 +177,7 @@ void toxav_register_audio_recv_callback (ToxAv *av, void (*callback)(ToxAv *, in
void *user_data);
/**
* @brief Register callback for recieving video data
* @brief Register callback for receiving video data
*
* @param av Handler.
* @param callback The callback

View File

@ -65,11 +65,6 @@
/* Number of get node requests to send to quickly find close nodes. */
#define MAX_BOOTSTRAP_TIMES 10
Client_data *DHT_get_close_list(DHT *dht)
{
return dht->close_clientlist;
}
/* Compares client_id1 and client_id2 with client_id.
*
* return 0 if both are same distance.

View File

@ -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) {
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.
*/
f->friendrequest_timeout *= 2;

View File

@ -210,7 +210,7 @@ void new_nonce(uint8_t *nonce)
/* Create a request to peer.
* 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.
* 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).

View File

@ -129,7 +129,7 @@ void new_nonce(uint8_t *nonce);
/* Create a request to peer.
* 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.
* 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).

View File

@ -469,7 +469,7 @@ static int handle_sendnodes(Group_Chat *chat, IP_Port source, int peernum, const
}
}
int ok = add_closepeer(chat, chat->group[peernum].client_id, source);
add_closepeer(chat, chat->group[peernum].client_id, source);
return 0;
}

View File

@ -657,7 +657,7 @@ static int generate_request_packet(uint8_t *data, uint16_t length, const Packets
}
/* 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 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));
}
/* Handle a recieved data packet.
/* Handle a received data packet.
*
* return -1 on failure.
* return 0 on success.
@ -1181,7 +1181,7 @@ static int handle_data_packet_helper(const Net_Crypto *c, int crypt_connection_i
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 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.
* 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 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;
}
/* 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,
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;
}
/* The dT for the average packet recieving rate calculations.
/* The dT for the average packet receiving rate calculations.
Also used as the */
#define PACKET_COUNTER_AVERAGE_INTERVAL 100

View File

@ -56,7 +56,7 @@
before giving up. */
#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 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);
/* 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,
uint16_t length), void *object);

View File

@ -95,7 +95,7 @@ void tox_dns3_kill(void *dns3_object)
* This is what the string returned looks like:
* 4haaaaipr1o3mz0bxweox541airydbovqlbju51mb4p0ebxq.rlqdj4kkisbep2ks3fj2nvtmk4daduqiueabmexqva1jc
*
* returns length of string on sucess.
* returns length of string on success.
* returns -1 on failure.
*/
int tox_generate_dns3_string(void *dns3_object, uint8_t *string, uint16_t string_max_len, uint32_t *request_id,

View File

@ -61,7 +61,7 @@ void tox_dns3_kill(void *dns3_object);
* This is what the string returned looks like:
* 4haaaaipr1o3mz0bxweox541airydbovqlbju51mb4p0ebxq.rlqdj4kkisbep2ks3fj2nvtmk4daduqiueabmexqva1jc
*
* returns length of string on sucess.
* returns length of string on success.
* returns -1 on failure.
*/
int tox_generate_dns3_string(void *dns3_object, uint8_t *string, uint16_t string_max_len, uint32_t *request_id,