Asterisk - The Open Source Telephony Project
21.4.1
|
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"
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. | |
Functions | |
static | AO2_GLOBAL_OBJ_STATIC (active_transports) |
Global container of active reliable transports. | |
AO2_STRING_FIELD_CMP_FN (transport_monitor, key) | |
Comparison function for struct transport_monitor. | |
AO2_STRING_FIELD_HASH_FN (transport_monitor, key) | |
Hashing function for struct transport_monitor. | |
AO2_STRING_FIELD_SORT_FN (transport_monitor, key) | |
Sort function for struct transport_monitor. | |
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. | |
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. | |
struct { | |
struct ast_sip_tpmgr_state_callback * first | |
struct ast_sip_tpmgr_state_callback * last | |
ast_rwlock_t lock | |
} | transport_state_list |
Manages the global transport event notification callbacks.
Definition in file pjsip_transport_events.c.
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.
transport | Transport to monitor for shutdown. |
cb | Who to call when transport is shutdown. |
ao2_data | Data to pass with the callback. |
There is no checking for duplicate registrations.
Definition at line 466 of file pjsip_transport_events.c.
References ast_sip_transport_monitor_register_replace_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.
transport_key | Key for the transport to monitor for shutdown. Create the key with AST_SIP_MAKE_REMOTE_IPADDR_PORT_STR. |
cb | Who to call when transport is shutdown. |
ao2_data | Data to pass with the callback. |
There is no checking for duplicate registrations.
Definition at line 475 of file pjsip_transport_events.c.
References ast_sip_transport_monitor_register_replace_key().
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.
transport | Transport to monitor for shutdown. |
cb | Who to call when transport is shutdown. |
ao2_data | Data to pass with the callback. |
matches | Matcher function that returns true if data matches a previously registered data object |
This function checks for duplicates, and overwrites/replaces the old monitor with the given one.
Definition at line 481 of file pjsip_transport_events.c.
References 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.
transport_key | Key for the transport to monitor for shutdown. Create the key with AST_SIP_MAKE_REMOTE_IPADDR_PORT_STR. |
cb | Who to call when transport is shutdown. |
ao2_data | Data to pass with the callback. |
matches | Matcher function that returns true if data matches a previously registered data object |
This function checks for duplicates, and overwrites/replaces the old monitor with the given one.
Definition at line 490 of file pjsip_transport_events.c.
References ao2_bump, ao2_global_obj_ref, ao2_ref, ast_debug, AST_VECTOR_APPEND, transport_monitor_notifier::cb, transport_monitor_notifier::data, transport_monitor::key, transport_monitor::monitors, OBJ_NOLOCK, OBJ_SEARCH_KEY, transport_monitor::transport, and transport_monitor::transport_obj_name.
Referenced by ast_sip_transport_monitor_register(), ast_sip_transport_monitor_register_key(), and ast_sip_transport_monitor_register_replace().
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.
transport | Transport to monitor for shutdown. |
cb | The callback that was used for the original register. |
data | Data 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. |
matches | Matcher function that returns true if data matches the previously registered data object. If NULL, a simple pointer comparison is done. |
Definition at line 429 of file pjsip_transport_events.c.
References ast_sip_transport_monitor_unregister_key().
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.
cb | The callback that was used for the original register. |
data | Data 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. |
matches | Matcher function that returns true if ao2_data matches the previously registered data object. If NULL, a simple pointer comparison is done. |
Definition at line 409 of file pjsip_transport_events.c.
References ao2_callback, ao2_global_obj_ref, ao2_ref, OBJ_MULTIPLE, and OBJ_NODATA.
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.
transport_key | Key for the transport to monitor for shutdown. Create the key with AST_SIP_MAKE_REMOTE_IPADDR_PORT_STR. |
cb | The callback that was used for the original register. |
data | Data 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. |
matches | Matcher function that returns true if data matches the previously registered data object. If NULL, a simple pointer comparison is done. |
Definition at line 437 of file pjsip_transport_events.c.
References ao2_global_obj_ref, ao2_ref, OBJ_NOLOCK, and OBJ_SEARCH_KEY.
Referenced by ast_sip_transport_monitor_unregister().
void ast_sip_transport_state_register | ( | struct ast_sip_tpmgr_state_callback * | element | ) |
Register a transport state notification callback element.
element | What we are registering. |
Definition at line 547 of file pjsip_transport_events.c.
References AST_LIST_INSERT_HEAD, AST_LIST_TRAVERSE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, and transport_state_list.
void ast_sip_transport_state_unregister | ( | struct ast_sip_tpmgr_state_callback * | element | ) |
Unregister a transport state notification callback element.
element | What we are unregistering. |
Definition at line 540 of file pjsip_transport_events.c.
References AST_LIST_REMOVE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, and transport_state_list.
|
static |
Definition at line 667 of file pjsip_transport_events.c.
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().