mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Astyled code.
This commit is contained in:
parent
a38d962b04
commit
750c75a47d
|
@ -68,9 +68,9 @@ typedef struct _EventHandler {
|
|||
|
||||
} EventHandler;
|
||||
|
||||
int throw_event( void * (func)(void *), void *arg );
|
||||
int throw_event( void *(func)(void *), void *arg );
|
||||
int reset_timer_event ( int id, uint32_t timeout );
|
||||
int throw_timer_event ( void * (func)(void *), void *arg, unsigned timeout);
|
||||
int throw_timer_event ( void *(func)(void *), void *arg, unsigned timeout);
|
||||
int cancel_timer_event ( int id );
|
||||
int execute_timer_event ( int id );
|
||||
|
||||
|
@ -142,7 +142,7 @@ int pop_id ( EventContainer **event_container, size_t *counter, int id )
|
|||
return -1;
|
||||
}
|
||||
|
||||
void push_event ( EventContainer **container, size_t *counter, void * (func)(void *), void *arg )
|
||||
void push_event ( EventContainer **container, size_t *counter, void *(func)(void *), void *arg )
|
||||
{
|
||||
EventContainer *_new = realloc((*container ), sizeof(EventContainer) * ((*counter ) + 1));
|
||||
|
||||
|
@ -230,7 +230,7 @@ void *event_poll( void *arg )
|
|||
pthread_exit(NULL);
|
||||
}
|
||||
|
||||
int throw_event( void * (func)(void *), void *arg )
|
||||
int throw_event( void *(func)(void *), void *arg )
|
||||
{
|
||||
pthread_t _tid;
|
||||
int _rc =
|
||||
|
@ -242,7 +242,7 @@ int throw_event( void * (func)(void *), void *arg )
|
|||
EventHandler event_handler;
|
||||
|
||||
/* Place and order array of timers */
|
||||
int throw_timer_event ( void * (func)(void *), void *arg, unsigned timeout)
|
||||
int throw_timer_event ( void *(func)(void *), void *arg, unsigned timeout)
|
||||
{
|
||||
static int _unique_id = 1;
|
||||
|
||||
|
|
|
@ -39,9 +39,9 @@
|
|||
*
|
||||
*/
|
||||
extern struct _Event {
|
||||
int (*rise) (void * ( func ) ( void * ), void *arg);
|
||||
int (*rise) (void *( func ) ( void *), void *arg);
|
||||
int (*timer_reset ) ( int id, unsigned timeout );
|
||||
int (*timer_alloc) (void * ( func ) ( void * ), void *arg, unsigned timeout);
|
||||
int (*timer_alloc) (void *( func ) ( void *), void *arg, unsigned timeout);
|
||||
int (*timer_release) (int id);
|
||||
int (*timer_now) ( int id );
|
||||
} event;
|
||||
|
|
88
toxav/msi.c
88
toxav/msi.c
|
@ -167,11 +167,11 @@ typedef enum {
|
|||
static inline__ const uint8_t *stringify_request ( MSIRequest request )
|
||||
{
|
||||
static const uint8_t *strings[] = {
|
||||
( uint8_t * ) "INVITE",
|
||||
( uint8_t * ) "START",
|
||||
( uint8_t * ) "CANCEL",
|
||||
( uint8_t * ) "REJECT",
|
||||
( uint8_t * ) "END"
|
||||
( uint8_t *) "INVITE",
|
||||
( uint8_t *) "START",
|
||||
( uint8_t *) "CANCEL",
|
||||
( uint8_t *) "REJECT",
|
||||
( uint8_t *) "END"
|
||||
};
|
||||
|
||||
return strings[request];
|
||||
|
@ -196,10 +196,10 @@ typedef enum {
|
|||
static inline__ const uint8_t *stringify_response ( MSIResponse response )
|
||||
{
|
||||
static const uint8_t *strings[] = {
|
||||
( uint8_t * ) "ringing",
|
||||
( uint8_t * ) "starting",
|
||||
( uint8_t * ) "ending",
|
||||
( uint8_t * ) "error"
|
||||
( uint8_t *) "ringing",
|
||||
( uint8_t *) "starting",
|
||||
( uint8_t *) "ending",
|
||||
( uint8_t *) "error"
|
||||
};
|
||||
|
||||
return strings[response];
|
||||
|
@ -243,7 +243,7 @@ iterator = iterator + 2 + _value_size; /* set iterator at new header or end_byte
|
|||
|
||||
const uint8_t *_it = data;
|
||||
uint16_t size_max = length;
|
||||
|
||||
|
||||
while ( *_it ) {/* until end_byte is hit */
|
||||
|
||||
uint16_t itedlen = (_it - data) + 2;
|
||||
|
@ -251,14 +251,14 @@ iterator = iterator + 2 + _value_size; /* set iterator at new header or end_byte
|
|||
if ( *_it == field_byte && itedlen < length ) {
|
||||
|
||||
uint16_t _size;
|
||||
memcpy(&_size, _it + 1, sizeof(_size));
|
||||
memcpy(&_size, _it + 1, sizeof(_size));
|
||||
_size = ntohs(_size);
|
||||
|
||||
|
||||
if ( itedlen + _size > length ) return -1;
|
||||
|
||||
_it += 3; /* place it at the field value beginning */
|
||||
size_max -= 3;
|
||||
|
||||
|
||||
switch ( _size ) { /* Compare the size of the hardcoded values ( vary fast and convenient ) */
|
||||
|
||||
case 4: { /* INFO header */
|
||||
|
@ -278,9 +278,9 @@ iterator = iterator + 2 + _value_size; /* set iterator at new header or end_byte
|
|||
|
||||
case 7: { /* Version, Request, Call-id headers */
|
||||
if ON_HEADER ( _it, size_max, msg->version, VERSION_FIELD, 7 )
|
||||
else if ON_HEADER ( _it, size_max, msg->request, REQUEST_FIELD, 7 )
|
||||
else if ON_HEADER ( _it, size_max, msg->callid, CALLID_FIELD, 7 )
|
||||
}
|
||||
else if ON_HEADER ( _it, size_max, msg->request, REQUEST_FIELD, 7 )
|
||||
else if ON_HEADER ( _it, size_max, msg->callid, CALLID_FIELD, 7 )
|
||||
}
|
||||
break;
|
||||
|
||||
case 8: { /* Response header */
|
||||
|
@ -513,9 +513,10 @@ uint8_t *append_header_to_string (
|
|||
|
||||
/* Now set the length of the field byte */
|
||||
uint16_t _convert;
|
||||
|
||||
|
||||
|
||||
|
||||
_convert = htons(_i);
|
||||
|
||||
memcpy(_getback_byte, &_convert, sizeof(_convert));
|
||||
|
||||
/* for value part do it regulary */
|
||||
|
@ -523,11 +524,12 @@ uint8_t *append_header_to_string (
|
|||
|
||||
dest++;
|
||||
|
||||
|
||||
|
||||
_convert = htons(value_len);
|
||||
|
||||
memcpy(dest, &_convert, sizeof(_convert));
|
||||
|
||||
dest+=2;
|
||||
|
||||
dest += 2;
|
||||
|
||||
for ( _i = value_len; _i; --_i ) {
|
||||
*dest = *_hvit;
|
||||
|
@ -645,13 +647,13 @@ typedef enum {
|
|||
static inline__ const uint8_t *stringify_error ( MSICallError error_code )
|
||||
{
|
||||
static const uint8_t *strings[] = {
|
||||
( uint8_t * ) "",
|
||||
( uint8_t * ) "Using dead call",
|
||||
( uint8_t * ) "Call id not set to any call",
|
||||
( uint8_t * ) "Call id not available",
|
||||
( uint8_t * ) "No active call in session",
|
||||
( uint8_t * ) "No Crypto-key set",
|
||||
( uint8_t * ) "Callee busy"
|
||||
( uint8_t *) "",
|
||||
( uint8_t *) "Using dead call",
|
||||
( uint8_t *) "Call id not set to any call",
|
||||
( uint8_t *) "Call id not available",
|
||||
( uint8_t *) "No active call in session",
|
||||
( uint8_t *) "No Crypto-key set",
|
||||
( uint8_t *) "Callee busy"
|
||||
};
|
||||
|
||||
return strings[error_code];
|
||||
|
@ -667,13 +669,13 @@ static inline__ const uint8_t *stringify_error ( MSICallError error_code )
|
|||
static inline__ const uint8_t *stringify_error_code ( MSICallError error_code )
|
||||
{
|
||||
static const uint8_t *strings[] = {
|
||||
( uint8_t * ) "",
|
||||
( uint8_t * ) "1",
|
||||
( uint8_t * ) "2",
|
||||
( uint8_t * ) "3",
|
||||
( uint8_t * ) "4",
|
||||
( uint8_t * ) "5",
|
||||
( uint8_t * ) "6"
|
||||
( uint8_t *) "",
|
||||
( uint8_t *) "1",
|
||||
( uint8_t *) "2",
|
||||
( uint8_t *) "3",
|
||||
( uint8_t *) "4",
|
||||
( uint8_t *) "5",
|
||||
( uint8_t *) "6"
|
||||
};
|
||||
|
||||
return strings[error_code];
|
||||
|
@ -756,10 +758,10 @@ void flush_peer_type ( MSICall *call, MSIMessage *msg, int peer_id )
|
|||
memcpy(hdrval, msg->calltype.header_value, msg->calltype.size);
|
||||
hdrval[msg->calltype.size] = '\0';
|
||||
|
||||
if ( strcmp ( ( const char * ) hdrval, CT_AUDIO_HEADER_VALUE ) == 0 ) {
|
||||
if ( strcmp ( ( const char *) hdrval, CT_AUDIO_HEADER_VALUE ) == 0 ) {
|
||||
call->type_peer[peer_id] = type_audio;
|
||||
|
||||
} else if ( strcmp ( ( const char * ) hdrval, CT_VIDEO_HEADER_VALUE ) == 0 ) {
|
||||
} else if ( strcmp ( ( const char *) hdrval, CT_VIDEO_HEADER_VALUE ) == 0 ) {
|
||||
call->type_peer[peer_id] = type_video;
|
||||
} else {} /* Error */
|
||||
} else {} /* Error */
|
||||
|
@ -831,7 +833,7 @@ int handle_error ( MSISession *session, MSICall *call, MSICallError errid, uint3
|
|||
|
||||
const uint8_t *_error_code_str = stringify_error_code ( errid );
|
||||
|
||||
msi_msg_set_reason ( _msg_error, _error_code_str, strlen ( ( const char * ) _error_code_str ) );
|
||||
msi_msg_set_reason ( _msg_error, _error_code_str, strlen ( ( const char *) _error_code_str ) );
|
||||
send_message ( session, call, _msg_error, to );
|
||||
free_message ( _msg_error );
|
||||
|
||||
|
@ -1325,7 +1327,7 @@ int handle_recv_error ( MSISession *session, MSICall *call, MSIMessage *msg )
|
|||
|
||||
/* Handle error accordingly */
|
||||
if ( msg->reason.header_value ) {
|
||||
session->last_error_id = atoi ( ( const char * ) msg->reason.header_value );
|
||||
session->last_error_id = atoi ( ( const char *) msg->reason.header_value );
|
||||
session->last_error_str = stringify_error ( session->last_error_id );
|
||||
LOGGER_DEBUG("Error reason: %s", session->last_error_str);
|
||||
}
|
||||
|
@ -1612,9 +1614,9 @@ int msi_invite ( MSISession *session, int32_t *call_index, MSICallType call_type
|
|||
|
||||
/* Do whatever with message */
|
||||
if ( call_type == type_audio ) {
|
||||
msi_msg_set_calltype ( _msg_invite, ( const uint8_t * ) CT_AUDIO_HEADER_VALUE, strlen ( CT_AUDIO_HEADER_VALUE ) );
|
||||
msi_msg_set_calltype ( _msg_invite, ( const uint8_t *) CT_AUDIO_HEADER_VALUE, strlen ( CT_AUDIO_HEADER_VALUE ) );
|
||||
} else {
|
||||
msi_msg_set_calltype ( _msg_invite, ( const uint8_t * ) CT_VIDEO_HEADER_VALUE, strlen ( CT_VIDEO_HEADER_VALUE ) );
|
||||
msi_msg_set_calltype ( _msg_invite, ( const uint8_t *) CT_VIDEO_HEADER_VALUE, strlen ( CT_VIDEO_HEADER_VALUE ) );
|
||||
}
|
||||
|
||||
send_message ( session, _call, _msg_invite, friend_id );
|
||||
|
@ -1702,10 +1704,10 @@ int msi_answer ( MSISession *session, int32_t call_index, MSICallType call_type
|
|||
|
||||
if ( call_type == type_audio ) {
|
||||
msi_msg_set_calltype
|
||||
( _msg_starting, ( const uint8_t * ) CT_AUDIO_HEADER_VALUE, strlen ( CT_AUDIO_HEADER_VALUE ) );
|
||||
( _msg_starting, ( const uint8_t *) CT_AUDIO_HEADER_VALUE, strlen ( CT_AUDIO_HEADER_VALUE ) );
|
||||
} else {
|
||||
msi_msg_set_calltype
|
||||
( _msg_starting, ( const uint8_t * ) CT_VIDEO_HEADER_VALUE, strlen ( CT_VIDEO_HEADER_VALUE ) );
|
||||
( _msg_starting, ( const uint8_t *) CT_VIDEO_HEADER_VALUE, strlen ( CT_VIDEO_HEADER_VALUE ) );
|
||||
}
|
||||
|
||||
/* Now set the local encryption key and pass it with STARTING message */
|
||||
|
|
|
@ -351,7 +351,7 @@ int toxav_prepare_transmission ( ToxAv *av, int32_t call_index, ToxAvCodecSettin
|
|||
int toxav_kill_transmission ( ToxAv *av, int32_t call_index )
|
||||
{
|
||||
if (cii(call_index, av->msi_session)) return ErrorNoCall;
|
||||
|
||||
|
||||
CallSpecific *call = &av->calls[call_index];
|
||||
|
||||
if ( call->crtps[audio_index] && -1 == rtp_terminate_session(call->crtps[audio_index], av->messenger) ) {
|
||||
|
@ -398,7 +398,7 @@ inline__ int toxav_send_rtp_payload ( ToxAv *av, int32_t call_index, ToxAvCallTy
|
|||
uint16_t length )
|
||||
{
|
||||
if (cii(call_index, av->msi_session)) return ErrorNoCall;
|
||||
|
||||
|
||||
if ( av->calls[call_index].crtps[type - TypeAudio] )
|
||||
return rtp_send_msg ( av->calls[call_index].crtps[type - TypeAudio], av->msi_session->messenger_handle, payload,
|
||||
length );
|
||||
|
@ -418,6 +418,7 @@ inline__ int toxav_send_rtp_payload ( ToxAv *av, int32_t call_index, ToxAvCallTy
|
|||
inline__ int toxav_recv_rtp_payload ( ToxAv *av, int32_t call_index, ToxAvCallType type, uint8_t *dest )
|
||||
{
|
||||
if ( !dest ) return ErrorInternal;
|
||||
|
||||
if (cii(call_index, av->msi_session)) return ErrorNoCall;
|
||||
|
||||
CallSpecific *call = &av->calls[call_index];
|
||||
|
@ -470,6 +471,7 @@ inline__ int toxav_recv_rtp_payload ( ToxAv *av, int32_t call_index, ToxAvCallTy
|
|||
inline__ int toxav_recv_video ( ToxAv *av, int32_t call_index, vpx_image_t **output)
|
||||
{
|
||||
if ( !output ) return ErrorInternal;
|
||||
|
||||
if (cii(call_index, av->msi_session)) return ErrorNoCall;
|
||||
|
||||
uint8_t packet [RTP_PAYLOAD_SIZE];
|
||||
|
@ -507,6 +509,7 @@ inline__ int toxav_recv_video ( ToxAv *av, int32_t call_index, vpx_image_t **out
|
|||
inline__ int toxav_send_video ( ToxAv *av, int32_t call_index, const uint8_t *frame, int frame_size)
|
||||
{
|
||||
if (cii(call_index, av->msi_session)) return ErrorNoCall;
|
||||
|
||||
return toxav_send_rtp_payload(av, call_index, TypeVideo, frame, frame_size);
|
||||
}
|
||||
|
||||
|
@ -524,7 +527,7 @@ inline__ int toxav_send_video ( ToxAv *av, int32_t call_index, const uint8_t *fr
|
|||
inline__ int toxav_prepare_video_frame(ToxAv *av, int32_t call_index, uint8_t *dest, int dest_max, vpx_image_t *input)
|
||||
{
|
||||
if (cii(call_index, av->msi_session)) return ErrorNoCall;
|
||||
|
||||
|
||||
CallSpecific *call = &av->calls[call_index];
|
||||
|
||||
int rc = vpx_codec_encode(&call->cs->v_encoder, input, call->cs->frame_counter, 1, 0, MAX_ENCODE_TIME_US);
|
||||
|
@ -567,6 +570,7 @@ inline__ int toxav_prepare_video_frame(ToxAv *av, int32_t call_index, uint8_t *d
|
|||
inline__ int toxav_recv_audio ( ToxAv *av, int32_t call_index, int frame_size, int16_t *dest )
|
||||
{
|
||||
if ( !dest ) return ErrorInternal;
|
||||
|
||||
if (cii(call_index, av->msi_session)) return ErrorNoCall;
|
||||
|
||||
CallSpecific *call = &av->calls[call_index];
|
||||
|
@ -609,6 +613,7 @@ inline__ int toxav_recv_audio ( ToxAv *av, int32_t call_index, int frame_size, i
|
|||
inline__ int toxav_send_audio ( ToxAv *av, int32_t call_index, const uint8_t *frame, int frame_size)
|
||||
{
|
||||
if (cii(call_index, av->msi_session)) return ErrorNoCall;
|
||||
|
||||
return toxav_send_rtp_payload(av, call_index, TypeAudio, frame, frame_size);
|
||||
}
|
||||
|
||||
|
@ -628,6 +633,7 @@ inline__ int toxav_prepare_audio_frame ( ToxAv *av, int32_t call_index, uint8_t
|
|||
const int16_t *frame, int frame_size)
|
||||
{
|
||||
if (cii(call_index, av->msi_session)) return ErrorNoCall;
|
||||
|
||||
int32_t rc = opus_encode(av->calls[call_index].cs->audio_encoder, frame, frame_size, dest, dest_max);
|
||||
|
||||
if (rc < 0) {
|
||||
|
@ -649,7 +655,8 @@ inline__ int toxav_prepare_audio_frame ( ToxAv *av, int32_t call_index, uint8_t
|
|||
*/
|
||||
int toxav_get_peer_transmission_type ( ToxAv *av, int32_t call_index, int peer )
|
||||
{
|
||||
if ( peer < 0 || cii(call_index, av->msi_session) || !av->msi_session->calls[call_index] || av->msi_session->calls[call_index]->peer_count <= peer )
|
||||
if ( peer < 0 || cii(call_index, av->msi_session) || !av->msi_session->calls[call_index]
|
||||
|| av->msi_session->calls[call_index]->peer_count <= peer )
|
||||
return ErrorInternal;
|
||||
|
||||
return av->msi_session->calls[call_index]->type_peer[peer];
|
||||
|
@ -667,7 +674,8 @@ int toxav_get_peer_id ( ToxAv *av, int32_t call_index, int peer )
|
|||
{
|
||||
assert(av->msi_session);
|
||||
|
||||
if ( peer < 0 || cii(call_index, av->msi_session) || !av->msi_session->calls[call_index] || av->msi_session->calls[call_index]->peer_count <= peer )
|
||||
if ( peer < 0 || cii(call_index, av->msi_session) || !av->msi_session->calls[call_index]
|
||||
|| av->msi_session->calls[call_index]->peer_count <= peer )
|
||||
return ErrorInternal;
|
||||
|
||||
return av->msi_session->calls[call_index]->peers[peer];
|
||||
|
|
|
@ -959,7 +959,8 @@ static int get_chat_num(Messenger *m, Group_Chat *chat)
|
|||
return -1;
|
||||
}
|
||||
|
||||
static void group_message_function(Group_Chat *chat, int peer_number, const uint8_t *message, uint16_t length, void *userdata)
|
||||
static void group_message_function(Group_Chat *chat, int peer_number, const uint8_t *message, uint16_t length,
|
||||
void *userdata)
|
||||
{
|
||||
Messenger *m = userdata;
|
||||
int i = get_chat_num(m, chat);
|
||||
|
@ -975,7 +976,8 @@ static void group_message_function(Group_Chat *chat, int peer_number, const uint
|
|||
(*m->group_message)(m, i, peer_number, message_terminated, length, m->group_message_userdata);
|
||||
}
|
||||
|
||||
static void group_action_function(Group_Chat *chat, int peer_number, const uint8_t *action, uint16_t length, void *userdata)
|
||||
static void group_action_function(Group_Chat *chat, int peer_number, const uint8_t *action, uint16_t length,
|
||||
void *userdata)
|
||||
{
|
||||
Messenger *m = userdata;
|
||||
int i = get_chat_num(m, chat);
|
||||
|
|
|
@ -315,8 +315,8 @@ static int entry_heard_store(Client_entry *entry, const IPPTs *ippts)
|
|||
}
|
||||
|
||||
/* maps Assoc callback signature to id_closest() */
|
||||
static int assoc_id_closest(const Assoc *assoc, void *callback_data, const uint8_t *client_id, const uint8_t *client_id1,
|
||||
const uint8_t *client_id2)
|
||||
static int assoc_id_closest(const Assoc *assoc, void *callback_data, const uint8_t *client_id,
|
||||
const uint8_t *client_id1, const uint8_t *client_id2)
|
||||
{
|
||||
return id_closest(client_id, client_id1, client_id2);
|
||||
}
|
||||
|
|
|
@ -35,7 +35,8 @@ typedef uint64_t (*Assoc_distance_absolute_callback)(const Assoc *assoc, void *c
|
|||
|
||||
/* Central entry point for new associations: add a new candidate to the cache
|
||||
* returns 1 if entry is stored, 2 if existing entry was updated, 0 else */
|
||||
uint8_t Assoc_add_entry(Assoc *assoc, const uint8_t *id, const IPPTs *ippts_send, const IP_Port *ipp_recv, uint8_t used);
|
||||
uint8_t Assoc_add_entry(Assoc *assoc, const uint8_t *id, const IPPTs *ippts_send, const IP_Port *ipp_recv,
|
||||
uint8_t used);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
|
@ -35,7 +35,8 @@
|
|||
* return 0 if it sent the friend request directly to the friend.
|
||||
* return the number of peers it was routed through if it did not send it directly.
|
||||
*/
|
||||
int send_friendrequest(const Onion_Client *onion_c, const uint8_t *public_key, uint32_t nospam_num, const uint8_t *data, uint32_t length)
|
||||
int send_friendrequest(const Onion_Client *onion_c, const uint8_t *public_key, uint32_t nospam_num, const uint8_t *data,
|
||||
uint32_t length)
|
||||
{
|
||||
if (1 + sizeof(nospam_num) + length > ONION_CLIENT_MAX_DATA_SIZE || length == 0)
|
||||
return -1;
|
||||
|
|
|
@ -51,7 +51,8 @@ typedef struct {
|
|||
* data is the data in the request and length is the length.
|
||||
* Maximum length of data is MAX_FRIEND_REQUEST_DATA_SIZE.
|
||||
*/
|
||||
int send_friendrequest(const Onion_Client *onion_c, const uint8_t *public_key, uint32_t nospam_num, const uint8_t *data, uint32_t length);
|
||||
int send_friendrequest(const Onion_Client *onion_c, const uint8_t *public_key, uint32_t nospam_num, const uint8_t *data,
|
||||
uint32_t length);
|
||||
/* Set and get the nospam variable used to prevent one type of friend request spam. */
|
||||
void set_nospam(Friend_Requests *fr, uint32_t num);
|
||||
uint32_t get_nospam(const Friend_Requests *fr);
|
||||
|
|
|
@ -175,8 +175,8 @@ static int add_closepeer(Group_Chat *chat, const uint8_t *client_id, IP_Port ip_
|
|||
return -1;
|
||||
}
|
||||
|
||||
static int send_groupchatpacket(const Group_Chat *chat, IP_Port ip_port, const uint8_t *public_key, const uint8_t *data, uint32_t length,
|
||||
uint8_t request_id)
|
||||
static int send_groupchatpacket(const Group_Chat *chat, IP_Port ip_port, const uint8_t *public_key, const uint8_t *data,
|
||||
uint32_t length, uint8_t request_id)
|
||||
{
|
||||
if (id_equal(chat->self_public_key, public_key))
|
||||
return -1;
|
||||
|
@ -718,7 +718,8 @@ uint32_t group_numpeers(const Group_Chat *chat)
|
|||
return chat->numpeers;
|
||||
}
|
||||
|
||||
uint32_t group_client_names(const Group_Chat *chat, uint8_t names[][MAX_NICK_BYTES], uint16_t lengths[], uint16_t length)
|
||||
uint32_t group_client_names(const Group_Chat *chat, uint8_t names[][MAX_NICK_BYTES], uint16_t lengths[],
|
||||
uint16_t length)
|
||||
{
|
||||
uint32_t i;
|
||||
|
||||
|
|
|
@ -172,7 +172,8 @@ uint32_t group_numpeers(const Group_Chat *chat);
|
|||
*
|
||||
* returns the number of peers.
|
||||
*/
|
||||
uint32_t group_client_names(const Group_Chat *chat, uint8_t names[][MAX_NICK_BYTES], uint16_t lengths[], uint16_t length);
|
||||
uint32_t group_client_names(const Group_Chat *chat, uint8_t names[][MAX_NICK_BYTES], uint16_t lengths[],
|
||||
uint16_t length);
|
||||
|
||||
/* Kill a group chat
|
||||
*
|
||||
|
|
|
@ -815,7 +815,8 @@ static uint16_t get_nonce_uint16(uint8_t *nonce)
|
|||
* return -1 on failure.
|
||||
* return length of data on success.
|
||||
*/
|
||||
static int handle_data_packet(Net_Crypto *c, int crypt_connection_id, uint8_t *data, const uint8_t *packet, uint16_t length)
|
||||
static int handle_data_packet(Net_Crypto *c, int crypt_connection_id, uint8_t *data, const uint8_t *packet,
|
||||
uint16_t length)
|
||||
{
|
||||
if (length <= (1 + sizeof(uint16_t) + crypto_box_MACBYTES) || length > MAX_CRYPTO_PACKET_SIZE)
|
||||
return -1;
|
||||
|
|
|
@ -112,7 +112,8 @@ int onion_send_1(Onion *onion, uint8_t *plain, uint32_t len, IP_Port source, con
|
|||
*
|
||||
* Format: function(void *object, IP_Port dest, uint8_t *data, uint32_t length)
|
||||
*/
|
||||
void set_callback_handle_recv_1(Onion *onion, int (*function)(void *, IP_Port, const uint8_t *, uint16_t), void *object);
|
||||
void set_callback_handle_recv_1(Onion *onion, int (*function)(void *, IP_Port, const uint8_t *, uint16_t),
|
||||
void *object);
|
||||
|
||||
Onion *new_onion(DHT *dht);
|
||||
|
||||
|
|
|
@ -179,8 +179,8 @@ static int cmp_entry(const void *a, const void *b)
|
|||
* return -1 if failure
|
||||
* return position if added
|
||||
*/
|
||||
static int add_to_entries(Onion_Announce *onion_a, IP_Port ret_ip_port, const uint8_t *public_key, const uint8_t *data_public_key,
|
||||
const uint8_t *ret)
|
||||
static int add_to_entries(Onion_Announce *onion_a, IP_Port ret_ip_port, const uint8_t *public_key,
|
||||
const uint8_t *data_public_key, const uint8_t *ret)
|
||||
{
|
||||
|
||||
int pos = in_entries(onion_a, public_key);
|
||||
|
|
|
@ -164,7 +164,8 @@ static int new_sendback(Onion_Client *onion_c, uint32_t num, uint8_t *public_key
|
|||
* return ~0 on failure
|
||||
* return num (see new_sendback(...)) on success
|
||||
*/
|
||||
static uint32_t check_sendback(Onion_Client *onion_c, const uint8_t *sendback, uint8_t *ret_pubkey, IP_Port *ret_ip_port)
|
||||
static uint32_t check_sendback(Onion_Client *onion_c, const uint8_t *sendback, uint8_t *ret_pubkey,
|
||||
IP_Port *ret_ip_port)
|
||||
{
|
||||
uint64_t sback;
|
||||
memcpy(&sback, sendback, sizeof(uint64_t));
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
* _4haaaaipr1o3mz0bxweox541airydbovqlbju51mb4p0ebxq.rlqdj4kkisbep2ks3fj2nvtmk4daduqiueabmexqva1jc._tox.utox.org
|
||||
* 5. The TXT in the DNS you receive should look like this:
|
||||
* v=tox3;id=2vgcxuycbuctvauik3plsv3d3aadv4zfjfhi3thaizwxinelrvigchv0ah3qjcsx5qhmaksb2lv2hm5cwbtx0yp
|
||||
* 6. Take the id string and use it with tox_decrypt_dns3_TXT() and the request_id corresponding to the
|
||||
* 6. Take the id string and use it with tox_decrypt_dns3_TXT() and the request_id corresponding to the
|
||||
* request we stored earlier to get the Tox id returned by the DNS server.
|
||||
*/
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user