diff options
Diffstat (limited to 'toxav/msi.c')
-rw-r--r-- | toxav/msi.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/toxav/msi.c b/toxav/msi.c index aad2bb2d..4772ac8a 100644 --- a/toxav/msi.c +++ b/toxav/msi.c | |||
@@ -309,13 +309,13 @@ int msi_change_capabilities(MSICall *call, uint8_t capabilities) | |||
309 | /** | 309 | /** |
310 | * Private functions | 310 | * Private functions |
311 | */ | 311 | */ |
312 | void msg_init(MSIMessage *dest, MSIRequest request) | 312 | static void msg_init(MSIMessage *dest, MSIRequest request) |
313 | { | 313 | { |
314 | memset(dest, 0, sizeof(*dest)); | 314 | memset(dest, 0, sizeof(*dest)); |
315 | dest->request.exists = true; | 315 | dest->request.exists = true; |
316 | dest->request.value = request; | 316 | dest->request.value = request; |
317 | } | 317 | } |
318 | int msg_parse_in(const Logger *log, MSIMessage *dest, const uint8_t *data, uint16_t length) | 318 | static int msg_parse_in(const Logger *log, MSIMessage *dest, const uint8_t *data, uint16_t length) |
319 | { | 319 | { |
320 | /* Parse raw data received from socket into MSIMessage struct */ | 320 | /* Parse raw data received from socket into MSIMessage struct */ |
321 | 321 | ||
@@ -394,7 +394,8 @@ int msg_parse_in(const Logger *log, MSIMessage *dest, const uint8_t *data, uint1 | |||
394 | 394 | ||
395 | return 0; | 395 | return 0; |
396 | } | 396 | } |
397 | uint8_t *msg_parse_header_out(MSIHeaderID id, uint8_t *dest, const void *value, uint8_t value_len, uint16_t *length) | 397 | static uint8_t *msg_parse_header_out(MSIHeaderID id, uint8_t *dest, const void *value, uint8_t value_len, |
398 | uint16_t *length) | ||
398 | { | 399 | { |
399 | /* Parse a single header for sending */ | 400 | /* Parse a single header for sending */ |
400 | assert(dest); | 401 | assert(dest); |
@@ -412,7 +413,7 @@ uint8_t *msg_parse_header_out(MSIHeaderID id, uint8_t *dest, const void *value, | |||
412 | 413 | ||
413 | return dest + value_len; /* Set to next position ready to be written */ | 414 | return dest + value_len; /* Set to next position ready to be written */ |
414 | } | 415 | } |
415 | int send_message(Messenger *m, uint32_t friend_number, const MSIMessage *msg) | 416 | static int send_message(Messenger *m, uint32_t friend_number, const MSIMessage *msg) |
416 | { | 417 | { |
417 | /* Parse and send message */ | 418 | /* Parse and send message */ |
418 | assert(m); | 419 | assert(m); |
@@ -457,7 +458,7 @@ int send_message(Messenger *m, uint32_t friend_number, const MSIMessage *msg) | |||
457 | 458 | ||
458 | return -1; | 459 | return -1; |
459 | } | 460 | } |
460 | int send_error(Messenger *m, uint32_t friend_number, MSIError error) | 461 | static int send_error(Messenger *m, uint32_t friend_number, MSIError error) |
461 | { | 462 | { |
462 | /* Send error message */ | 463 | /* Send error message */ |
463 | assert(m); | 464 | assert(m); |
@@ -473,7 +474,7 @@ int send_error(Messenger *m, uint32_t friend_number, MSIError error) | |||
473 | send_message(m, friend_number, &msg); | 474 | send_message(m, friend_number, &msg); |
474 | return 0; | 475 | return 0; |
475 | } | 476 | } |
476 | int invoke_callback(MSICall *call, MSICallbackID cb) | 477 | static int invoke_callback(MSICall *call, MSICallbackID cb) |
477 | { | 478 | { |
478 | assert(call); | 479 | assert(call); |
479 | 480 | ||
@@ -510,7 +511,7 @@ static MSICall *get_call(MSISession *session, uint32_t friend_number) | |||
510 | 511 | ||
511 | return session->calls[friend_number]; | 512 | return session->calls[friend_number]; |
512 | } | 513 | } |
513 | MSICall *new_call(MSISession *session, uint32_t friend_number) | 514 | static MSICall *new_call(MSISession *session, uint32_t friend_number) |
514 | { | 515 | { |
515 | assert(session); | 516 | assert(session); |
516 | 517 | ||
@@ -563,7 +564,7 @@ MSICall *new_call(MSISession *session, uint32_t friend_number) | |||
563 | session->calls[friend_number] = rc; | 564 | session->calls[friend_number] = rc; |
564 | return rc; | 565 | return rc; |
565 | } | 566 | } |
566 | void kill_call(MSICall *call) | 567 | static void kill_call(MSICall *call) |
567 | { | 568 | { |
568 | /* Assume that session mutex is locked */ | 569 | /* Assume that session mutex is locked */ |
569 | if (call == nullptr) { | 570 | if (call == nullptr) { |
@@ -604,7 +605,7 @@ CLEAR_CONTAINER: | |||
604 | free(call); | 605 | free(call); |
605 | session->calls = nullptr; | 606 | session->calls = nullptr; |
606 | } | 607 | } |
607 | void on_peer_status(Messenger *m, uint32_t friend_number, uint8_t status, void *data) | 608 | static void on_peer_status(Messenger *m, uint32_t friend_number, uint8_t status, void *data) |
608 | { | 609 | { |
609 | MSISession *session = (MSISession *)data; | 610 | MSISession *session = (MSISession *)data; |
610 | 611 | ||
@@ -630,7 +631,7 @@ void on_peer_status(Messenger *m, uint32_t friend_number, uint8_t status, void * | |||
630 | break; | 631 | break; |
631 | } | 632 | } |
632 | } | 633 | } |
633 | void handle_init(MSICall *call, const MSIMessage *msg) | 634 | static void handle_init(MSICall *call, const MSIMessage *msg) |
634 | { | 635 | { |
635 | assert(call); | 636 | assert(call); |
636 | LOGGER_DEBUG(call->session->messenger->log, | 637 | LOGGER_DEBUG(call->session->messenger->log, |
@@ -691,7 +692,7 @@ FAILURE: | |||
691 | send_error(call->session->messenger, call->friend_number, call->error); | 692 | send_error(call->session->messenger, call->friend_number, call->error); |
692 | kill_call(call); | 693 | kill_call(call); |
693 | } | 694 | } |
694 | void handle_push(MSICall *call, const MSIMessage *msg) | 695 | static void handle_push(MSICall *call, const MSIMessage *msg) |
695 | { | 696 | { |
696 | assert(call); | 697 | assert(call); |
697 | 698 | ||
@@ -746,7 +747,7 @@ FAILURE: | |||
746 | send_error(call->session->messenger, call->friend_number, call->error); | 747 | send_error(call->session->messenger, call->friend_number, call->error); |
747 | kill_call(call); | 748 | kill_call(call); |
748 | } | 749 | } |
749 | void handle_pop(MSICall *call, const MSIMessage *msg) | 750 | static void handle_pop(MSICall *call, const MSIMessage *msg) |
750 | { | 751 | { |
751 | assert(call); | 752 | assert(call); |
752 | 753 | ||
@@ -791,7 +792,7 @@ void handle_pop(MSICall *call, const MSIMessage *msg) | |||
791 | 792 | ||
792 | kill_call(call); | 793 | kill_call(call); |
793 | } | 794 | } |
794 | void handle_msi_packet(Messenger *m, uint32_t friend_number, const uint8_t *data, uint16_t length, void *object) | 795 | static void handle_msi_packet(Messenger *m, uint32_t friend_number, const uint8_t *data, uint16_t length, void *object) |
795 | { | 796 | { |
796 | LOGGER_DEBUG(m->log, "Got msi message"); | 797 | LOGGER_DEBUG(m->log, "Got msi message"); |
797 | 798 | ||