Asterisk - The Open Source Telephony Project GIT-master-5782b03
Data Structures | Macros | Functions | Variables
pjsip_transport_events.c File Reference

Manages the global transport event notification callbacks. More...

#include "asterisk.h"
#include "asterisk/res_pjsip.h"
#include "asterisk/res_pjsip_cli.h"
#include "include/res_pjsip_private.h"
#include "asterisk/linkedlists.h"
#include "asterisk/vector.h"
Include dependency graph for pjsip_transport_events.c:

Go to the source code of this file.

Data Structures

struct  callback_data
 
struct  transport_monitor
 Structure for transport to be monitored. More...
 
struct  transport_monitor_notifier
 

Macros

#define ACTIVE_TRANSPORTS_BUCKETS   127
 Number of buckets for monitored active transports. More...
 

Functions

static AO2_GLOBAL_OBJ_STATIC (active_transports)
 Global container of active reliable transports. More...
 
 AO2_STRING_FIELD_CMP_FN (transport_monitor, key)
 Comparison function for struct transport_monitor. More...
 
 AO2_STRING_FIELD_HASH_FN (transport_monitor, key)
 Hashing function for struct transport_monitor. More...
 
 AO2_STRING_FIELD_SORT_FN (transport_monitor, key)
 Sort function for struct transport_monitor. More...
 
void ast_sip_destroy_transport_events (void)
 
int ast_sip_initialize_transport_events (void)
 
enum ast_transport_monitor_reg ast_sip_transport_monitor_register (pjsip_transport *transport, ast_transport_monitor_shutdown_cb cb, void *ao2_data)
 Register a reliable transport shutdown monitor callback. More...
 
enum ast_transport_monitor_reg ast_sip_transport_monitor_register_key (const char *transport_key, ast_transport_monitor_shutdown_cb cb, void *ao2_data)
 Register a reliable transport shutdown monitor callback. More...
 
enum ast_transport_monitor_reg ast_sip_transport_monitor_register_replace (pjsip_transport *transport, ast_transport_monitor_shutdown_cb cb, void *ao2_data, ast_transport_monitor_data_matcher matches)
 Register a reliable transport shutdown monitor callback replacing any duplicate. More...
 
enum ast_transport_monitor_reg ast_sip_transport_monitor_register_replace_key (const char *transport_key, ast_transport_monitor_shutdown_cb cb, void *ao2_data, ast_transport_monitor_data_matcher matches)
 Register a reliable transport shutdown monitor callback replacing any duplicate. More...
 
void ast_sip_transport_monitor_unregister (pjsip_transport *transport, ast_transport_monitor_shutdown_cb cb, void *data, ast_transport_monitor_data_matcher matches)
 Unregister a reliable transport shutdown monitor. More...
 
void ast_sip_transport_monitor_unregister_all (ast_transport_monitor_shutdown_cb cb, void *data, ast_transport_monitor_data_matcher matches)
 Unregister a transport shutdown monitor from all reliable transports. More...
 
void ast_sip_transport_monitor_unregister_key (const char *transport_key, ast_transport_monitor_shutdown_cb cb, void *data, ast_transport_monitor_data_matcher matches)
 Unregister a reliable transport shutdown monitor. More...
 
void ast_sip_transport_state_register (struct ast_sip_tpmgr_state_callback *element)
 Register a transport state notification callback element. More...
 
void ast_sip_transport_state_unregister (struct ast_sip_tpmgr_state_callback *element)
 Unregister a transport state notification callback element. More...
 
static char * cli_show_monitors (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 
static int ptr_matcher (void *a, void *b)
 
static void transport_monitor_dtor (void *vdoomed)
 
static int transport_monitor_unregister_cb (void *obj, void *arg, int flags)
 
static const char * transport_state2str (pjsip_transport_state state)
 
static void transport_state_callback (pjsip_transport *transport, pjsip_transport_state state, const pjsip_transport_state_info *info)
 Callback invoked when transport state changes occur. More...
 
static void transport_state_do_reg_callbacks (struct ao2_container *transports, pjsip_transport *transport)
 
static int transport_tls_verify (const pjsip_transport *transport, const pjsip_tls_state_info *state_info)
 
static int verify_cert_name (const pj_str_t *local, const pj_str_t *remote)
 
static int verify_cert_names (const pj_str_t *host, const pj_ssl_cert_info *remote)
 
static void verify_log_result (int log_level, const pjsip_transport *transport, pj_uint32_t verify_status)
 

Variables

static struct ast_cli_entry cli_commands []
 
static pjsip_tp_state_callback tpmgr_state_callback
 Existing transport events callback that we need to invoke. More...
 
struct {
   struct ast_sip_tpmgr_state_callback *   first
 
   struct ast_sip_tpmgr_state_callback *   last
 
   ast_rwlock_t   lock
 
transport_state_list
 

Detailed Description

Manages the global transport event notification callbacks.

Author
Richard Mudgett rmudg.nosp@m.ett@.nosp@m.digiu.nosp@m.m.co.nosp@m.m See Also:

Definition in file pjsip_transport_events.c.

Macro Definition Documentation

◆ ACTIVE_TRANSPORTS_BUCKETS

#define ACTIVE_TRANSPORTS_BUCKETS   127

Number of buckets for monitored active transports.

Definition at line 41 of file pjsip_transport_events.c.

Function Documentation

◆ AO2_GLOBAL_OBJ_STATIC()

static AO2_GLOBAL_OBJ_STATIC ( active_transports  )
static

Global container of active reliable transports.

◆ AO2_STRING_FIELD_CMP_FN()

AO2_STRING_FIELD_CMP_FN ( transport_monitor  ,
key   
)

Comparison function for struct transport_monitor.

◆ AO2_STRING_FIELD_HASH_FN()

AO2_STRING_FIELD_HASH_FN ( transport_monitor  ,
key   
)

Hashing function for struct transport_monitor.

◆ AO2_STRING_FIELD_SORT_FN()

AO2_STRING_FIELD_SORT_FN ( transport_monitor  ,
key   
)

Sort function for struct transport_monitor.

◆ ast_sip_destroy_transport_events()

void ast_sip_destroy_transport_events ( void  )

Definition at line 671 of file pjsip_transport_events.c.

672{
673 pjsip_tpmgr *tpmgr;
674
676
677 tpmgr = pjsip_endpt_get_tpmgr(ast_sip_get_pjsip_endpoint());
678 if (tpmgr) {
679 pjsip_tpmgr_set_state_cb(tpmgr, tpmgr_state_callback);
680 }
681
682 ao2_global_obj_release(active_transports);
683}
#define ao2_global_obj_release(holder)
Release the ao2 object held in the global holder.
Definition: astobj2.h:859
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
Definition: clicompat.c:30
static struct ast_cli_entry cli_commands[]
static pjsip_tp_state_callback tpmgr_state_callback
Existing transport events callback that we need to invoke.
pjsip_endpoint * ast_sip_get_pjsip_endpoint(void)
Get a pointer to the PJSIP endpoint.
Definition: res_pjsip.c:520
#define ARRAY_LEN(a)
Definition: utils.h:666

References ao2_global_obj_release, ARRAY_LEN, ast_cli_unregister_multiple(), ast_sip_get_pjsip_endpoint(), cli_commands, and tpmgr_state_callback.

Referenced by unload_pjsip().

◆ ast_sip_initialize_transport_events()

int ast_sip_initialize_transport_events ( void  )

Definition at line 685 of file pjsip_transport_events.c.

686{
687 pjsip_tpmgr *tpmgr;
688 struct ao2_container *transports;
689
690 tpmgr = pjsip_endpt_get_tpmgr(ast_sip_get_pjsip_endpoint());
691 if (!tpmgr) {
692 return -1;
693 }
694
696 ACTIVE_TRANSPORTS_BUCKETS, transport_monitor_hash_fn, transport_monitor_sort_fn,
697 transport_monitor_cmp_fn);
698 if (!transports) {
699 return -1;
700 }
701 ao2_global_obj_replace_unref(active_transports, transports);
702 ao2_ref(transports, -1);
703
704 tpmgr_state_callback = pjsip_tpmgr_get_state_cb(tpmgr);
705 pjsip_tpmgr_set_state_cb(tpmgr, &transport_state_callback);
706
708
709
710 return 0;
711}
@ AO2_ALLOC_OPT_LOCK_MUTEX
Definition: astobj2.h:363
#define ao2_global_obj_replace_unref(holder, obj)
Replace an ao2 object in the global holder, throwing away any old object.
Definition: astobj2.h:901
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
Definition: astobj2.h:459
#define ao2_container_alloc_hash(ao2_options, container_options, n_buckets, hash_fn, sort_fn, cmp_fn)
Allocate and initialize a hash container with the desired number of buckets.
Definition: astobj2.h:1303
#define ast_cli_register_multiple(e, len)
Register multiple commands.
Definition: cli.h:265
static void transport_state_callback(pjsip_transport *transport, pjsip_transport_state state, const pjsip_transport_state_info *info)
Callback invoked when transport state changes occur.
#define ACTIVE_TRANSPORTS_BUCKETS
Number of buckets for monitored active transports.
Generic container type.

References ACTIVE_TRANSPORTS_BUCKETS, AO2_ALLOC_OPT_LOCK_MUTEX, ao2_container_alloc_hash, ao2_global_obj_replace_unref, ao2_ref, ARRAY_LEN, ast_cli_register_multiple, ast_sip_get_pjsip_endpoint(), cli_commands, tpmgr_state_callback, and transport_state_callback().

Referenced by load_module().

◆ ast_sip_transport_monitor_register()

enum ast_transport_monitor_reg ast_sip_transport_monitor_register ( pjsip_transport *  transport,
ast_transport_monitor_shutdown_cb  cb,
void *  ao2_data 
)

Register a reliable transport shutdown monitor callback.

Deprecated:
Replaced with ast_sip_transport_monitor_register_key().
Since
13.20.0
Parameters
transportTransport to monitor for shutdown.
cbWho to call when transport is shutdown.
ao2_dataData to pass with the callback.
Note
The data object passed will have its reference count automatically incremented by this call and automatically decremented after the callback runs or when the callback is unregistered.

There is no checking for duplicate registrations.

Returns
enum ast_transport_monitor_reg

Definition at line 466 of file pjsip_transport_events.c.

468{
471
472 return ast_sip_transport_monitor_register_replace_key(key, cb, ao2_data, NULL);
473}
enum ast_transport_monitor_reg ast_sip_transport_monitor_register_replace_key(const char *transport_key, ast_transport_monitor_shutdown_cb cb, void *ao2_data, ast_transport_monitor_data_matcher matches)
Register a reliable transport shutdown monitor callback replacing any duplicate.
#define AST_SIP_MAKE_REMOTE_IPADDR_PORT_STR(_transport, _dest)
Fill a buffer with a pjsip transport's remote ip address and port.
Definition: res_pjsip.h:90
#define IP6ADDR_COLON_PORT_BUFLEN
Definition: res_pjsip.h:82
#define NULL
Definition: resample.c:96

References AST_SIP_MAKE_REMOTE_IPADDR_PORT_STR, ast_sip_transport_monitor_register_replace_key(), callback_data::cb, IP6ADDR_COLON_PORT_BUFLEN, and NULL.

◆ ast_sip_transport_monitor_register_key()

enum ast_transport_monitor_reg ast_sip_transport_monitor_register_key ( const char *  transport_key,
ast_transport_monitor_shutdown_cb  cb,
void *  ao2_data 
)

Register a reliable transport shutdown monitor callback.

Parameters
transport_keyKey for the transport to monitor for shutdown. Create the key with AST_SIP_MAKE_REMOTE_IPADDR_PORT_STR.
cbWho to call when transport is shutdown.
ao2_dataData to pass with the callback.
Note
The data object passed will have its reference count automatically incremented by this call and automatically decremented after the callback runs or when the callback is unregistered.

There is no checking for duplicate registrations.

Returns
enum ast_transport_monitor_reg

Definition at line 475 of file pjsip_transport_events.c.

477{
478 return ast_sip_transport_monitor_register_replace_key(transport_key, cb, ao2_data, NULL);
479}

References ast_sip_transport_monitor_register_replace_key(), callback_data::cb, and NULL.

Referenced by subscription_persistence_update().

◆ ast_sip_transport_monitor_register_replace()

enum ast_transport_monitor_reg ast_sip_transport_monitor_register_replace ( pjsip_transport *  transport,
ast_transport_monitor_shutdown_cb  cb,
void *  ao2_data,
ast_transport_monitor_data_matcher  matches 
)

Register a reliable transport shutdown monitor callback replacing any duplicate.

Deprecated:
Replaced with ast_sip_transport_monitor_register_replace_key().
Since
13.26.0
16.3.0
Parameters
transportTransport to monitor for shutdown.
cbWho to call when transport is shutdown.
ao2_dataData to pass with the callback.
matchesMatcher function that returns true if data matches a previously registered data object
Note
The data object passed will have its reference count automatically incremented by this call and automatically decremented after the callback runs or when the callback is unregistered.

This function checks for duplicates, and overwrites/replaces the old monitor with the given one.

Returns
enum ast_transport_monitor_reg

Definition at line 481 of file pjsip_transport_events.c.

483{
485
487 return ast_sip_transport_monitor_register_replace_key(key, cb, ao2_data, NULL);
488}

References AST_SIP_MAKE_REMOTE_IPADDR_PORT_STR, ast_sip_transport_monitor_register_replace_key(), callback_data::cb, IP6ADDR_COLON_PORT_BUFLEN, and NULL.

◆ ast_sip_transport_monitor_register_replace_key()

enum ast_transport_monitor_reg ast_sip_transport_monitor_register_replace_key ( const char *  transport_key,
ast_transport_monitor_shutdown_cb  cb,
void *  ao2_data,
ast_transport_monitor_data_matcher  matches 
)

Register a reliable transport shutdown monitor callback replacing any duplicate.

Parameters
transport_keyKey for the transport to monitor for shutdown. Create the key with AST_SIP_MAKE_REMOTE_IPADDR_PORT_STR.
cbWho to call when transport is shutdown.
ao2_dataData to pass with the callback.
matchesMatcher function that returns true if data matches a previously registered data object
Note
The data object passed will have its reference count automatically incremented by this call and automatically decremented after the callback runs or when the callback is unregistered.

This function checks for duplicates, and overwrites/replaces the old monitor with the given one.

Returns
enum ast_transport_monitor_reg

Definition at line 490 of file pjsip_transport_events.c.

492{
493 struct ao2_container *transports;
494 struct transport_monitor *monitored;
496
497 ast_assert(transport_key != NULL && cb != NULL);
498
499 transports = ao2_global_obj_ref(active_transports);
500 if (!transports) {
501 return res;
502 }
503
504 ao2_lock(transports);
505 monitored = ao2_find(transports, transport_key, OBJ_SEARCH_KEY | OBJ_NOLOCK);
506 if (monitored) {
507 struct transport_monitor_notifier new_monitor;
508 struct callback_data cb_data = {
509 .cb = cb,
510 .data = ao2_data,
511 .matches = matches ?: ptr_matcher,
512 };
513
514 transport_monitor_unregister_cb(monitored, &cb_data, 0);
515
516 /* Add new monitor to vector */
517 new_monitor.cb = cb;
518 new_monitor.data = ao2_bump(ao2_data);
519 if (AST_VECTOR_APPEND(&monitored->monitors, new_monitor)) {
520 ao2_cleanup(ao2_data);
522 ast_debug(3, "Transport %s(%s) RefCnt: %ld : Monitor registration failed %p(%p)\n",
523 monitored->key, monitored->transport_obj_name,
524 pj_atomic_get(monitored->transport->ref_cnt), cb, ao2_data);
525 } else {
527 ast_debug(3, "Transport %s(%s,%s) RefCnt: %ld : Registered monitor %p(%p)\n",
528 monitored->key, monitored->transport_obj_name,
529 monitored->transport->type_name,
530 pj_atomic_get(monitored->transport->ref_cnt), cb, ao2_data);
531 }
532
533 ao2_ref(monitored, -1);
534 }
535 ao2_unlock(transports);
536 ao2_ref(transports, -1);
537 return res;
538}
#define ao2_cleanup(obj)
Definition: astobj2.h:1934
#define ao2_global_obj_ref(holder)
Get a reference to the object stored in the global holder.
Definition: astobj2.h:918
#define ao2_find(container, arg, flags)
Definition: astobj2.h:1736
#define ao2_unlock(a)
Definition: astobj2.h:729
#define ao2_lock(a)
Definition: astobj2.h:717
#define ao2_bump(obj)
Bump refcount on an AO2 object by one, returning the object.
Definition: astobj2.h:480
@ OBJ_NOLOCK
Assume that the ao2_container is already locked.
Definition: astobj2.h:1063
@ OBJ_SEARCH_KEY
The arg parameter is a search key, but is not an object.
Definition: astobj2.h:1101
#define ast_debug(level,...)
Log a DEBUG message.
static int ptr_matcher(void *a, void *b)
static int transport_monitor_unregister_cb(void *obj, void *arg, int flags)
ast_transport_monitor_reg
Definition: res_pjsip.h:3935
@ AST_TRANSPORT_MONITOR_REG_NOT_FOUND
Transport not found to monitor.
Definition: res_pjsip.h:3944
@ AST_TRANSPORT_MONITOR_REG_FAILED
Error while registering transport monitor.
Definition: res_pjsip.h:3946
@ AST_TRANSPORT_MONITOR_REG_SUCCESS
Successfully registered the transport monitor.
Definition: res_pjsip.h:3937
ast_transport_monitor_data_matcher matches
ast_transport_monitor_shutdown_cb cb
Structure for transport to be monitored.
pjsip_transport * transport
The underlying PJSIP transport.
char key[IP6ADDR_COLON_PORT_BUFLEN]
Key <ipaddr>:<port>
struct transport_monitor::@456 monitors
#define ast_assert(a)
Definition: utils.h:739
#define AST_VECTOR_APPEND(vec, elem)
Append an element to a vector, growing the vector if needed.
Definition: vector.h:256

References ao2_bump, ao2_cleanup, ao2_find, ao2_global_obj_ref, ao2_lock, ao2_ref, ao2_unlock, ast_assert, ast_debug, AST_TRANSPORT_MONITOR_REG_FAILED, AST_TRANSPORT_MONITOR_REG_NOT_FOUND, AST_TRANSPORT_MONITOR_REG_SUCCESS, AST_VECTOR_APPEND, transport_monitor_notifier::cb, callback_data::cb, transport_monitor_notifier::data, transport_monitor::key, callback_data::matches, transport_monitor::monitors, NULL, OBJ_NOLOCK, OBJ_SEARCH_KEY, ptr_matcher(), transport_monitor::transport, transport_monitor_unregister_cb(), and transport_monitor::transport_obj_name.

Referenced by ast_sip_transport_monitor_register(), ast_sip_transport_monitor_register_key(), ast_sip_transport_monitor_register_replace(), and registration_transport_monitor_setup().

◆ ast_sip_transport_monitor_unregister()

void ast_sip_transport_monitor_unregister ( pjsip_transport *  transport,
ast_transport_monitor_shutdown_cb  cb,
void *  data,
ast_transport_monitor_data_matcher  matches 
)

Unregister a reliable transport shutdown monitor.

Deprecated:
Replaced with ast_sip_transport_monitor_unregister_key().
Since
13.20.0
Parameters
transportTransport to monitor for shutdown.
cbThe callback that was used for the original register.
dataData to pass to the matcher. May be NULL and does NOT need to be an ao2 object. If NULL, all monitors with the provided callback are unregistered.
matchesMatcher function that returns true if data matches the previously registered data object. If NULL, a simple pointer comparison is done.
Note
The data object passed into the original register will have its reference count automatically decremented.

Definition at line 429 of file pjsip_transport_events.c.

431{
434 ast_sip_transport_monitor_unregister_key(key, cb, data, matches);
435}
void ast_sip_transport_monitor_unregister_key(const char *transport_key, ast_transport_monitor_shutdown_cb cb, void *data, ast_transport_monitor_data_matcher matches)
Unregister a reliable transport shutdown monitor.

References AST_SIP_MAKE_REMOTE_IPADDR_PORT_STR, ast_sip_transport_monitor_unregister_key(), callback_data::cb, callback_data::data, IP6ADDR_COLON_PORT_BUFLEN, and callback_data::matches.

Referenced by registrar_contact_delete().

◆ ast_sip_transport_monitor_unregister_all()

void ast_sip_transport_monitor_unregister_all ( ast_transport_monitor_shutdown_cb  cb,
void *  data,
ast_transport_monitor_data_matcher  matches 
)

Unregister a transport shutdown monitor from all reliable transports.

Since
13.20.0
Parameters
cbThe callback that was used for the original register.
dataData to pass to the matcher. May be NULL and does NOT need to be an ao2 object. If NULL, all monitors with the provided callback are unregistered.
matchesMatcher function that returns true if ao2_data matches the previously registered data object. If NULL, a simple pointer comparison is done.
Note
The data object passed into the original register will have its reference count automatically decremented.

Definition at line 409 of file pjsip_transport_events.c.

411{
412 struct ao2_container *transports;
413 struct callback_data cb_data = {
414 .cb = cb,
415 .data = data,
416 .matches = matches ?: ptr_matcher,
417 };
418
419 ast_assert(cb != NULL);
420
421 transports = ao2_global_obj_ref(active_transports);
422 if (!transports) {
423 return;
424 }
426 ao2_ref(transports, -1);
427}
#define ao2_callback(c, flags, cb_fn, arg)
ao2_callback() is a generic function that applies cb_fn() to all objects in a container,...
Definition: astobj2.h:1693
@ OBJ_NODATA
Definition: astobj2.h:1044
@ OBJ_MULTIPLE
Definition: astobj2.h:1049

References ao2_callback, ao2_global_obj_ref, ao2_ref, ast_assert, callback_data::cb, callback_data::data, callback_data::matches, NULL, OBJ_MULTIPLE, OBJ_NODATA, ptr_matcher(), and transport_monitor_unregister_cb().

Referenced by registrar_contact_delete(), and unload_module().

◆ ast_sip_transport_monitor_unregister_key()

void ast_sip_transport_monitor_unregister_key ( const char *  transport_key,
ast_transport_monitor_shutdown_cb  cb,
void *  data,
ast_transport_monitor_data_matcher  matches 
)

Unregister a reliable transport shutdown monitor.

Parameters
transport_keyKey for the transport to monitor for shutdown. Create the key with AST_SIP_MAKE_REMOTE_IPADDR_PORT_STR.
cbThe callback that was used for the original register.
dataData to pass to the matcher. May be NULL and does NOT need to be an ao2 object. If NULL, all monitors with the provided callback are unregistered.
matchesMatcher function that returns true if data matches the previously registered data object. If NULL, a simple pointer comparison is done.
Note
The data object passed into the original register will have its reference count automatically decremented.

Definition at line 437 of file pjsip_transport_events.c.

439{
440 struct ao2_container *transports;
441 struct transport_monitor *monitored;
442
443 ast_assert(transport_key != NULL && cb != NULL);
444
445 transports = ao2_global_obj_ref(active_transports);
446 if (!transports) {
447 return;
448 }
449
450 ao2_lock(transports);
451 monitored = ao2_find(transports, transport_key, OBJ_SEARCH_KEY | OBJ_NOLOCK);
452 if (monitored) {
453 struct callback_data cb_data = {
454 .cb = cb,
455 .data = data,
456 .matches = matches ?: ptr_matcher,
457 };
458
459 transport_monitor_unregister_cb(monitored, &cb_data, 0);
460 ao2_ref(monitored, -1);
461 }
462 ao2_unlock(transports);
463 ao2_ref(transports, -1);
464}

References ao2_find, ao2_global_obj_ref, ao2_lock, ao2_ref, ao2_unlock, ast_assert, callback_data::cb, callback_data::data, callback_data::matches, NULL, OBJ_NOLOCK, OBJ_SEARCH_KEY, ptr_matcher(), and transport_monitor_unregister_cb().

Referenced by ast_sip_transport_monitor_unregister(), handle_registration_response(), and subscription_persistence_remove().

◆ ast_sip_transport_state_register()

void ast_sip_transport_state_register ( struct ast_sip_tpmgr_state_callback element)

Register a transport state notification callback element.

Since
13.18.0
Parameters
elementWhat we are registering.

Definition at line 547 of file pjsip_transport_events.c.

548{
549 struct ast_sip_tpmgr_state_callback *tpmgr_notifier;
550
552 AST_LIST_TRAVERSE(&transport_state_list, tpmgr_notifier, node) {
553 if (element == tpmgr_notifier) {
554 /* Already registered. */
556 return;
557 }
558 }
561}
#define AST_RWLIST_WRLOCK(head)
Write locks a list.
Definition: linkedlists.h:52
#define AST_RWLIST_UNLOCK(head)
Attempts to unlock a read/write based list.
Definition: linkedlists.h:151
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
Definition: linkedlists.h:491
#define AST_LIST_INSERT_HEAD(head, elm, field)
Inserts a list entry at the head of a list.
Definition: linkedlists.h:711
static struct @455 transport_state_list
Definition: test_heap.c:38

References AST_LIST_INSERT_HEAD, AST_LIST_TRAVERSE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, and transport_state_list.

Referenced by ast_sip_initialize_transport_management().

◆ ast_sip_transport_state_unregister()

void ast_sip_transport_state_unregister ( struct ast_sip_tpmgr_state_callback element)

Unregister a transport state notification callback element.

Since
13.18.0
Parameters
elementWhat we are unregistering.

Definition at line 540 of file pjsip_transport_events.c.

541{
545}
#define AST_LIST_REMOVE(head, elm, field)
Removes a specific entry from a list.
Definition: linkedlists.h:856

References AST_LIST_REMOVE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, and transport_state_list.

Referenced by ast_sip_destroy_transport_management().

◆ cli_show_monitors()

static char * cli_show_monitors ( struct ast_cli_entry e,
int  cmd,
struct ast_cli_args a 
)
static

Definition at line 563 of file pjsip_transport_events.c.

564{
565 char *cli_rc = CLI_FAILURE;
566 int rc = 0;
567 int using_regex = 0;
568 regex_t regex = { 0, };
569 int container_count;
570 struct ao2_iterator iter;
571 struct ao2_container *sorted_monitors = NULL;
572 struct ao2_container *transports;
573 struct transport_monitor *monitored;
574
575 switch (cmd) {
576 case CLI_INIT:
577 e->command = "pjsip show transport-monitors";
578 e->usage = "Usage: pjsip show transport-monitors [ like <pattern> ]\n"
579 " Show pjsip transport monitors\n";
580 return NULL;
581 case CLI_GENERATE:
582 return NULL;
583 }
584
585 if (a->argc != 3 && a->argc != 5) {
586 return CLI_SHOWUSAGE;
587 }
588
589 if (a->argc == 5) {
590 int regrc;
591 if (strcasecmp(a->argv[3], "like")) {
592 return CLI_SHOWUSAGE;
593 }
594 regrc = regcomp(&regex, a->argv[4], REG_EXTENDED | REG_ICASE | REG_NOSUB);
595 if (regrc) {
596 char err[256];
597 regerror(regrc, &regex, err, 256);
598 ast_cli(a->fd, "PJSIP Transport Monitor: Error: %s\n", err);
599 return CLI_FAILURE;
600 }
601 using_regex = 1;
602 }
603
604 /* Get a sorted snapshot of the scheduled tasks */
606 transport_monitor_sort_fn, NULL);
607 if (!sorted_monitors) {
608 ast_cli(a->fd, "PJSIP Transport Monitor: Unable to allocate temporary container\n");
609 goto error;
610 }
611
612 transports = ao2_global_obj_ref(active_transports);
613 if (!transports) {
614 ast_cli(a->fd, "PJSIP Transport Monitor: Unable to get transports\n");
615 goto error;
616 }
617
618 ao2_lock(transports);
619 rc = ao2_container_dup(sorted_monitors, transports, 0);
620 ao2_unlock(transports);
621 ao2_ref(transports, -1);
622 if (rc != 0) {
623 ast_cli(a->fd, "PJSIP Transport Monitors: Unable to sort temporary container\n");
624 goto error;
625 }
626 container_count = ao2_container_count(sorted_monitors);
627
628 ast_cli(a->fd, "PJSIP Transport Monitors:\n\n");
629
630 ast_cli(a->fd,
631 "<Remote Host...................................> <State.....> <Direction> <RefCnt> <Monitors> <ObjName............>\n");
632
633 iter = ao2_iterator_init(sorted_monitors, AO2_ITERATOR_UNLINK);
634 for (; (monitored = ao2_iterator_next(&iter)); ao2_ref(monitored, -1)) {
635 char *state;
636
637 if (using_regex && regexec(&regex, monitored->key, 0, NULL, 0) == REG_NOMATCH) {
638 continue;
639 }
640
641 if (monitored->transport->is_destroying) {
642 state = "DESTROYING";
643 } else if (monitored->transport->is_shutdown) {
644 state = "SHUTDOWN";
645 } else {
646 state = "ACTIVE";
647 }
648
649 ast_cli(a->fd, " %-46.46s %-10s %-9s %6ld %8zu %s\n",
650 monitored->key, state,
651 monitored->transport->dir == PJSIP_TP_DIR_OUTGOING ? "Outgoing" : "Incoming",
652 pj_atomic_get(monitored->transport->ref_cnt),
653 AST_VECTOR_SIZE(&monitored->monitors), monitored->transport->obj_name);
654 }
656 ast_cli(a->fd, "\nTotal Transport Monitors: %d\n\n", container_count);
657 cli_rc = CLI_SUCCESS;
658error:
659 if (using_regex) {
660 regfree(&regex);
661 }
662 ao2_cleanup(sorted_monitors);
663
664 return cli_rc;
665}
int ao2_container_dup(struct ao2_container *dest, struct ao2_container *src, enum search_flags flags)
Copy all object references in the src container into the dest container.
#define ao2_iterator_next(iter)
Definition: astobj2.h:1911
@ AO2_ALLOC_OPT_LOCK_NOLOCK
Definition: astobj2.h:367
int ao2_container_count(struct ao2_container *c)
Returns the number of elements in a container.
@ AO2_ITERATOR_UNLINK
Definition: astobj2.h:1863
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.
#define ao2_container_alloc_rbtree(ao2_options, container_options, sort_fn, cmp_fn)
Allocate and initialize a red-black tree container.
Definition: astobj2.h:1349
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
enum cc_state state
Definition: ccss.c:393
#define CLI_SHOWUSAGE
Definition: cli.h:45
#define CLI_SUCCESS
Definition: cli.h:44
void ast_cli(int fd, const char *fmt,...)
Definition: clicompat.c:6
@ CLI_INIT
Definition: cli.h:152
@ CLI_GENERATE
Definition: cli.h:153
#define CLI_FAILURE
Definition: cli.h:46
static int regex(struct ast_channel *chan, const char *cmd, char *parse, char *buf, size_t len)
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
Definition: astobj2.h:1821
char * command
Definition: cli.h:186
const char * usage
Definition: cli.h:177
static struct test_val a
int error(const char *format,...)
Definition: utils/frame.c:999
#define AST_VECTOR_SIZE(vec)
Get the number of elements in a vector.
Definition: vector.h:609

References a, AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_cleanup, ao2_container_alloc_rbtree, ao2_container_count(), ao2_container_dup(), ao2_global_obj_ref, ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, AO2_ITERATOR_UNLINK, ao2_lock, ao2_ref, ao2_unlock, ast_cli(), AST_VECTOR_SIZE, CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, error(), transport_monitor::key, transport_monitor::monitors, NULL, regex(), state, transport_monitor::transport, and ast_cli_entry::usage.

◆ ptr_matcher()

static int ptr_matcher ( void *  a,
void *  b 
)
static

Definition at line 404 of file pjsip_transport_events.c.

405{
406 return a == b;
407}
static struct test_val b

References a, and b.

Referenced by ast_sip_transport_monitor_register_replace_key(), ast_sip_transport_monitor_unregister_all(), and ast_sip_transport_monitor_unregister_key().

◆ transport_monitor_dtor()

static void transport_monitor_dtor ( void *  vdoomed)
static

Definition at line 112 of file pjsip_transport_events.c.

113{
114 struct transport_monitor *monitored = vdoomed;
115 int idx;
116
117 for (idx = AST_VECTOR_SIZE(&monitored->monitors); idx--;) {
118 struct transport_monitor_notifier *notifier;
119
120 notifier = AST_VECTOR_GET_ADDR(&monitored->monitors, idx);
121 ao2_cleanup(notifier->data);
122 }
123 AST_VECTOR_FREE(&monitored->monitors);
124 ast_debug(3, "Transport %s(%s,%s) RefCnt: %ld : state:MONITOR_DESTROYED\n",
125 monitored->key, monitored->transport->obj_name,
126 monitored->transport->type_name,pj_atomic_get(monitored->transport->ref_cnt));
127 ast_free(monitored->transport_obj_name);
128 pjsip_transport_dec_ref(monitored->transport);
129}
#define ast_free(a)
Definition: astmm.h:180
#define AST_VECTOR_FREE(vec)
Deallocates this vector.
Definition: vector.h:174
#define AST_VECTOR_GET_ADDR(vec, idx)
Get an address of element in a vector.
Definition: vector.h:668

References ao2_cleanup, ast_debug, ast_free, AST_VECTOR_FREE, AST_VECTOR_GET_ADDR, AST_VECTOR_SIZE, transport_monitor_notifier::data, transport_monitor::key, transport_monitor::monitors, transport_monitor::transport, and transport_monitor::transport_obj_name.

Referenced by transport_state_callback().

◆ transport_monitor_unregister_cb()

static int transport_monitor_unregister_cb ( void *  obj,
void *  arg,
int  flags 
)
static

Definition at line 381 of file pjsip_transport_events.c.

382{
383 struct transport_monitor *monitored = obj;
384 struct callback_data *cb_data = arg;
385 int idx;
386
387 for (idx = AST_VECTOR_SIZE(&monitored->monitors); idx--;) {
388 struct transport_monitor_notifier *notifier;
389
390 notifier = AST_VECTOR_GET_ADDR(&monitored->monitors, idx);
391 if (notifier->cb == cb_data->cb && (!cb_data->data
392 || cb_data->matches(cb_data->data, notifier->data))) {
393 ao2_cleanup(notifier->data);
394 AST_VECTOR_REMOVE_UNORDERED(&monitored->monitors, idx);
395 ast_debug(3, "Transport %s(%s,%s) RefCnt: %ld : Unregistered monitor %p(%p)\n",
396 monitored->key, monitored->transport_obj_name,
397 monitored->transport->type_name,
398 pj_atomic_get(monitored->transport->ref_cnt), notifier->cb, notifier->data);
399 }
400 }
401 return 0;
402}
ast_transport_monitor_shutdown_cb cb
#define AST_VECTOR_REMOVE_UNORDERED(vec, idx)
Remove an element from an unordered vector by index.
Definition: vector.h:438

References ao2_cleanup, ast_debug, AST_VECTOR_GET_ADDR, AST_VECTOR_REMOVE_UNORDERED, AST_VECTOR_SIZE, transport_monitor_notifier::cb, callback_data::cb, transport_monitor_notifier::data, callback_data::data, transport_monitor::key, callback_data::matches, transport_monitor::monitors, transport_monitor::transport, and transport_monitor::transport_obj_name.

Referenced by ast_sip_transport_monitor_register_replace_key(), ast_sip_transport_monitor_unregister_all(), and ast_sip_transport_monitor_unregister_key().

◆ transport_state2str()

static const char * transport_state2str ( pjsip_transport_state  state)
static

Definition at line 83 of file pjsip_transport_events.c.

84{
85 const char *name;
86
87 switch (state) {
88 case PJSIP_TP_STATE_CONNECTED:
89 name = "CONNECTED";
90 break;
91 case PJSIP_TP_STATE_DISCONNECTED:
92 name = "DISCONNECTED";
93 break;
94 case PJSIP_TP_STATE_SHUTDOWN:
95 name = "SHUTDOWN";
96 break;
97 case PJSIP_TP_STATE_DESTROY:
98 name = "DESTROY";
99 break;
100 default:
101 /*
102 * We have to have a default case because the enum is
103 * defined by a third-party library.
104 */
105 ast_assert(0);
106 name = "<unknown>";
107 break;
108 }
109 return name;
110}
static const char name[]
Definition: format_mp3.c:68

References ast_assert, and name.

Referenced by transport_state_callback().

◆ transport_state_callback()

static void transport_state_callback ( pjsip_transport *  transport,
pjsip_transport_state  state,
const pjsip_transport_state_info *  info 
)
static

Callback invoked when transport state changes occur.

Definition at line 281 of file pjsip_transport_events.c.

283{
284 struct ao2_container *transports;
285
286 /* We only care about monitoring reliable transports */
287 if (PJSIP_TRANSPORT_IS_RELIABLE(transport)
288 && (transports = ao2_global_obj_ref(active_transports))) {
289 struct transport_monitor *monitored;
290
291 ast_debug(3, "Transport " PJSTR_PRINTF_SPEC ":%d(%s,%s): RefCnt: %ld state:%s\n",
292 PJSTR_PRINTF_VAR(transport->remote_name.host),
293 transport->remote_name.port, transport->obj_name,
294 transport->type_name,
295 pj_atomic_get(transport->ref_cnt), transport_state2str(state));
296 switch (state) {
297 case PJSIP_TP_STATE_CONNECTED:
298 if (PJSIP_TRANSPORT_IS_SECURE(transport) &&
299 !transport_tls_verify(transport, info->ext_info)) {
300 pjsip_transport_shutdown(transport);
301 return;
302 }
303
304 monitored = ao2_alloc_options(sizeof(*monitored),
306 if (!monitored) {
307 break;
308 }
309 monitored->transport = transport;
311 monitored->transport_obj_name = ast_strdup(transport->obj_name);
312
313 if (AST_VECTOR_INIT(&monitored->monitors, 5)) {
314 ao2_ref(monitored, -1);
315 break;
316 }
317 pjsip_transport_add_ref(monitored->transport);
318 ast_debug(3, "Transport %s(%s,%s): RefCnt: %ld state:MONITOR_CREATED\n",
319 monitored->key, monitored->transport_obj_name,
320 monitored->transport->type_name,
321 pj_atomic_get(monitored->transport->ref_cnt));
322
323 ao2_link(transports, monitored);
324 ao2_ref(monitored, -1);
325 break;
326 case PJSIP_TP_STATE_DISCONNECTED:
327 if (!transport->is_shutdown) {
328 pjsip_transport_shutdown(transport);
329 }
331 break;
332 case PJSIP_TP_STATE_SHUTDOWN:
333 /*
334 * Set shutdown flag early so we can force a new transport to be
335 * created if a monitor callback needs to reestablish a link.
336 * PJPROJECT sets the flag after this routine returns even though
337 * it has already called the transport's shutdown routine.
338 */
339 transport->is_shutdown = PJ_TRUE;
340
342 break;
343 case PJSIP_TP_STATE_DESTROY:
345 break;
346 default:
347 /*
348 * We have to have a default case because the enum is
349 * defined by a third-party library.
350 */
351 ast_assert(0);
352 break;
353 }
354
355 ao2_ref(transports, -1);
356 }
357
358 /* Loop over other transport state callbacks registered with us. */
360 struct ast_sip_tpmgr_state_callback *tpmgr_notifier;
361
363 AST_LIST_TRAVERSE(&transport_state_list, tpmgr_notifier, node) {
364 tpmgr_notifier->cb(transport, state, info);
365 }
367 }
368
369 /* Forward to the old state callback if present */
371 tpmgr_state_callback(transport, state, info);
372 }
373}
#define ast_strdup(str)
A wrapper for strdup()
Definition: astmm.h:241
#define ao2_link(container, obj)
Add an object to a container.
Definition: astobj2.h:1532
#define ao2_alloc_options(data_size, destructor_fn, options)
Definition: astobj2.h:404
#define AST_RWLIST_RDLOCK(head)
Read locks a list.
Definition: linkedlists.h:78
#define AST_LIST_EMPTY(head)
Checks whether the specified list contains any entries.
Definition: linkedlists.h:450
def info(msg)
static void transport_state_do_reg_callbacks(struct ao2_container *transports, pjsip_transport *transport)
static void transport_monitor_dtor(void *vdoomed)
static int transport_tls_verify(const pjsip_transport *transport, const pjsip_tls_state_info *state_info)
static const char * transport_state2str(pjsip_transport_state state)
#define PJSTR_PRINTF_VAR(_v)
Definition: res_pjsip.h:72
#define PJSTR_PRINTF_SPEC
Definition: res_pjsip.h:71
pjsip_tp_state_callback cb
Definition: res_pjsip.h:4090
#define AST_VECTOR_INIT(vec, size)
Initialize a vector.
Definition: vector.h:113

References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_alloc_options, ao2_global_obj_ref, ao2_link, ao2_ref, ast_assert, ast_debug, AST_LIST_EMPTY, AST_LIST_TRAVERSE, AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, AST_SIP_MAKE_REMOTE_IPADDR_PORT_STR, ast_strdup, AST_VECTOR_INIT, ast_sip_tpmgr_state_callback::cb, sip_to_pjsip::info(), transport_monitor::key, transport_monitor::monitors, PJSTR_PRINTF_SPEC, PJSTR_PRINTF_VAR, tpmgr_state_callback, transport_monitor::transport, transport_monitor_dtor(), transport_monitor::transport_obj_name, transport_state2str(), transport_state_do_reg_callbacks(), transport_state_list, and transport_tls_verify().

Referenced by ast_sip_initialize_transport_events().

◆ transport_state_do_reg_callbacks()

static void transport_state_do_reg_callbacks ( struct ao2_container transports,
pjsip_transport *  transport 
)
static

Definition at line 139 of file pjsip_transport_events.c.

140{
141 struct transport_monitor *monitored;
143
145
146 monitored = ao2_find(transports, key, OBJ_SEARCH_KEY | OBJ_UNLINK);
147 if (monitored) {
148 int idx;
149
150 for (idx = AST_VECTOR_SIZE(&monitored->monitors); idx--;) {
151 struct transport_monitor_notifier *notifier;
152
153 notifier = AST_VECTOR_GET_ADDR(&monitored->monitors, idx);
154 ast_debug(3, "Transport %s(%s,%s) RefCnt: %ld : running callback %p(%p)\n",
155 monitored->key, monitored->transport->obj_name,
156 monitored->transport->type_name,
157 pj_atomic_get(monitored->transport->ref_cnt), notifier->cb, notifier->data);
158 notifier->cb(notifier->data);
159 }
160 ao2_ref(monitored, -1);
161 }
162}
@ OBJ_UNLINK
Definition: astobj2.h:1039

References ao2_find, ao2_ref, ast_debug, AST_SIP_MAKE_REMOTE_IPADDR_PORT_STR, AST_VECTOR_GET_ADDR, AST_VECTOR_SIZE, transport_monitor_notifier::cb, transport_monitor_notifier::data, IP6ADDR_COLON_PORT_BUFLEN, transport_monitor::key, transport_monitor::monitors, OBJ_SEARCH_KEY, OBJ_UNLINK, and transport_monitor::transport.

Referenced by transport_state_callback().

◆ transport_tls_verify()

static int transport_tls_verify ( const pjsip_transport *  transport,
const pjsip_tls_state_info *  state_info 
)
static

Definition at line 231 of file pjsip_transport_events.c.

233{
234 pj_uint32_t verify_status;
235 const struct ast_sip_transport_state *state;
236
237 if (transport->dir == PJSIP_TP_DIR_INCOMING) {
238 return 1;
239 }
240
241 /* transport_id should always be in factory info (see config_transport) */
242 ast_assert(!ast_strlen_zero(transport->factory->info));
243
245 if (!state) {
246 /*
247 * There should always be an associated state, but if for some
248 * reason there is not then fail verification
249 */
250 ast_log(LOG_ERROR, "Transport state not found for '%s'\n", transport->factory->info);
251 return 0;
252 }
253
254 verify_status = state_info->ssl_sock_info->verify_status;
255
256 /*
257 * By this point pjsip has already completed its verification process. If
258 * there was a name matching error it could be because they disallow wildcards.
259 * If this transport has been configured to allow wildcards then we'll need
260 * to re-check the name(s) for such.
261 */
262 if (state->allow_wildcard_certs &&
263 (verify_status & PJ_SSL_CERT_EIDENTITY_NOT_MATCH)) {
264 if (verify_cert_names(&transport->remote_name.host,
265 state_info->ssl_sock_info->remote_cert_info)) {
266 /* A name matched a wildcard, so clear the error */
267 verify_status &= ~PJ_SSL_CERT_EIDENTITY_NOT_MATCH;
268 }
269 }
270
271 if (state->verify_server && verify_status != PJ_SSL_CERT_ESUCCESS) {
272 verify_log_result(__LOG_ERROR, transport, verify_status);
273 return 0;
274 }
275
277 return 1;
278}
#define ast_log
Definition: astobj2.c:42
#define __LOG_ERROR
#define __LOG_NOTICE
#define LOG_ERROR
static void verify_log_result(int log_level, const pjsip_transport *transport, pj_uint32_t verify_status)
static int verify_cert_names(const pj_str_t *host, const pj_ssl_cert_info *remote)
struct ast_sip_transport_state * ast_sip_get_transport_state(const char *transport_id)
Retrieve transport state.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Definition: strings.h:65
Structure for SIP transport information.
Definition: res_pjsip.h:119
struct pjsip_transport * transport
Transport itself.
Definition: res_pjsip.h:121

References __LOG_ERROR, __LOG_NOTICE, ast_assert, ast_log, ast_sip_get_transport_state(), ast_strlen_zero(), LOG_ERROR, state, ast_sip_transport_state::transport, verify_cert_names(), and verify_log_result().

Referenced by transport_state_callback().

◆ verify_cert_name()

static int verify_cert_name ( const pj_str_t *  local,
const pj_str_t *  remote 
)
static

Definition at line 185 of file pjsip_transport_events.c.

186{
187 const char *p;
188 pj_ssize_t size;
189
190 ast_debug(3, "Verify certificate name: local = %.*s, remote = %.*s\n",
191 (unsigned int)pj_strlen(local), pj_strbuf(local),
192 (unsigned int)pj_strlen(remote), pj_strbuf(remote));
193
194 if (!pj_stricmp(remote, local)) {
195 return 1;
196 }
197
198 if (pj_strnicmp2(remote, "*.", 2)) {
199 return 0;
200 }
201
202 p = pj_strchr(local, '.');
203 if (!p) {
204 return 0;
205 }
206
207 size = pj_strbuf(local) + pj_strlen(local) - ++p;
208
209 return size == pj_strlen(remote) - 2 ?
210 !pj_memcmp(pj_strbuf(remote) + 2, p, size) : 0;
211}

References ast_debug.

Referenced by verify_cert_names().

◆ verify_cert_names()

static int verify_cert_names ( const pj_str_t *  host,
const pj_ssl_cert_info *  remote 
)
static

Definition at line 213 of file pjsip_transport_events.c.

214{
215 unsigned int i;
216
217 for (i = 0; i < remote->subj_alt_name.cnt; ++i) {
218 /*
219 * DNS is the only type we're matching wildcards against,
220 * so only recheck those.
221 */
222 if (remote->subj_alt_name.entry[i].type == PJ_SSL_CERT_NAME_DNS
223 && verify_cert_name(host, &remote->subj_alt_name.entry[i].name)) {
224 return 1;
225 }
226 }
227
228 return verify_cert_name(host, &remote->subject.cn);
229}
static int verify_cert_name(const pj_str_t *local, const pj_str_t *remote)

References verify_cert_name().

Referenced by transport_tls_verify().

◆ verify_log_result()

static void verify_log_result ( int  log_level,
const pjsip_transport *  transport,
pj_uint32_t  verify_status 
)
static

Definition at line 164 of file pjsip_transport_events.c.

166{
167 const char *status[32];
168 unsigned int count;
169 unsigned int i;
170
171 count = ARRAY_LEN(status);
172
173 if (pj_ssl_cert_get_verify_status_strings(verify_status, status, &count) != PJ_SUCCESS) {
174 ast_log(LOG_ERROR, "Error retrieving certificate verification result(s)\n");
175 return;
176 }
177
178 for (i = 0; i < count; ++i) {
179 ast_log(log_level, _A_, "Transport '%s' to remote '%.*s' - %s\n", transport->factory->info,
180 (int)pj_strlen(&transport->remote_name.host), pj_strbuf(&transport->remote_name.host),
181 status[i]);
182 }
183}
jack_status_t status
Definition: app_jack.c:146
#define _A_
static int log_level
Log level for history output.

References _A_, ARRAY_LEN, ast_log, LOG_ERROR, log_level, and status.

Referenced by transport_tls_verify().

Variable Documentation

◆ cli_commands

struct ast_cli_entry cli_commands[]
static
Initial value:
= {
{ .handler = cli_show_monitors , .summary = "Show pjsip transport monitors" ,},
}
static char * cli_show_monitors(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)

Definition at line 667 of file pjsip_transport_events.c.

Referenced by ast_sip_destroy_transport_events(), and ast_sip_initialize_transport_events().

◆ first

Definition at line 72 of file pjsip_transport_events.c.

◆ last

Definition at line 72 of file pjsip_transport_events.c.

◆ lock

Definition at line 72 of file pjsip_transport_events.c.

◆ tpmgr_state_callback

pjsip_tp_state_callback tpmgr_state_callback
static

Existing transport events callback that we need to invoke.

Definition at line 69 of file pjsip_transport_events.c.

Referenced by ast_sip_destroy_transport_events(), ast_sip_initialize_transport_events(), and transport_state_callback().

◆ 

struct { ... } transport_state_list

List of registered transport state callbacks.

Referenced by ast_sip_transport_state_register(), ast_sip_transport_state_unregister(), and transport_state_callback().