40 #define ACTIVE_TRANSPORTS_BUCKETS 127 79 case PJSIP_TP_STATE_CONNECTED:
82 case PJSIP_TP_STATE_DISCONNECTED:
83 name =
"DISCONNECTED";
85 case PJSIP_TP_STATE_SHUTDOWN:
88 case PJSIP_TP_STATE_DESTROY:
139 ast_debug(3,
"running callback %p(%p) for transport %s\n",
140 notifier->
cb, notifier->
data, transport->obj_name);
141 notifier->
cb(notifier->
data);
149 pjsip_transport_state
state,
const pjsip_transport_state_info *
info)
154 if (PJSIP_TRANSPORT_IS_RELIABLE(transport)
158 ast_debug(3,
"Reliable transport '%s' state:%s\n",
161 case PJSIP_TP_STATE_CONNECTED:
176 case PJSIP_TP_STATE_DISCONNECTED:
177 if (!transport->is_shutdown) {
178 pjsip_transport_shutdown(transport);
182 case PJSIP_TP_STATE_SHUTDOWN:
189 transport->is_shutdown = PJ_TRUE;
193 case PJSIP_TP_STATE_DESTROY:
214 tpmgr_notifier->
cb(transport, state, info);
241 if (notifier->
cb == cb_data->
cb && (!cb_data->
data 245 ast_debug(3,
"Unregistered monitor %p(%p) from transport %s\n",
344 ast_debug(3,
"Register monitor %p(%p) to transport %s FAILED\n",
345 cb, ao2_data, transport->obj_name);
348 ast_debug(3,
"Registered monitor %p(%p) to transport %s\n",
349 cb, ao2_data, transport->obj_name);
372 if (element == tpmgr_notifier) {
406 transport_monitor_cmp_fn);
#define AST_VECTOR_FREE(vec)
Deallocates this vector.
Asterisk main include file. File version handling, generic pbx functions.
The arg parameter is a search key, but is not an object.
static pjsip_tp_state_callback tpmgr_state_callback
Existing transport events callback that we need to invoke.
#define AST_RWLIST_WRLOCK(head)
Write locks a list.
ast_transport_monitor_reg
#define ao2_callback(c, flags, cb_fn, arg)
#define ACTIVE_TRANSPORTS_BUCKETS
Number of buckets for monitored active transports.
#define AST_RWLIST_UNLOCK(head)
Attempts to unlock a read/write based list.
#define AST_VECTOR_APPEND(vec, elem)
Append an element to a vector, growing the vector if needed.
Assume that the ao2_container is already locked.
#define AST_VECTOR_REMOVE_UNORDERED(vec, idx)
Remove an element from an unordered vector by index.
#define ao2_global_obj_ref(holder)
#define AST_LIST_EMPTY(head)
Checks whether the specified list contains any entries.
#define ao2_alloc_options(data_size, destructor_fn, options)
void ast_sip_destroy_transport_events(void)
#define AST_LIST_REMOVE(head, elm, field)
Removes a specific entry from a list.
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 AST_RWLIST_RDLOCK(head)
Read locks a list.
#define ast_debug(level,...)
Log a DEBUG message.
Structure for transport to be monitored.
#define AST_VECTOR_INIT(vec, size)
Initialize a vector.
#define AST_VECTOR_GET_ADDR(vec, idx)
Get an address of element in a vector.
static const char * transport_state2str(pjsip_transport_state state)
ast_transport_monitor_data_matcher matches
AO2_STRING_FIELD_HASH_FN(transport_monitor, transport->obj_name)
Hashing function for struct transport_monitor.
#define ao2_ref(o, delta)
Successfully registered the transport monitor.
A set of macros to manage forward-linked lists.
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.
#define AST_VECTOR(name, type)
Define a vector structure.
static void transport_state_do_reg_callbacks(struct ao2_container *transports, pjsip_transport *transport)
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 not found to monitor.
#define ao2_container_alloc_hash(ao2_options, container_options, n_buckets, hash_fn, sort_fn, cmp_fn)
pjsip_transport * transport
The underlying PJSIP transport.
static int transport_monitor_unregister_cb(void *obj, void *arg, int flags)
#define ao2_global_obj_release(holder)
static struct @480 transport_state_list
int ast_sip_initialize_transport_events(void)
int(* ast_transport_monitor_data_matcher)(void *a, void *b)
Transport shutdown monitor data matcher.
static int ptr_matcher(void *a, void *b)
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
#define AST_LIST_INSERT_HEAD(head, elm, field)
Inserts a list entry at the head of a list.
static AO2_GLOBAL_OBJ_STATIC(active_transports)
Global container of active reliable transports.
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.
pjsip_tp_state_callback cb
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.
Vector container support.
#define ao2_find(container, arg, flags)
ast_transport_monitor_shutdown_cb cb
pjsip_endpoint * ast_sip_get_pjsip_endpoint(void)
Get a pointer to the PJSIP endpoint.
#define ao2_global_obj_replace_unref(holder, obj)
AO2_STRING_FIELD_CMP_FN(transport_monitor, transport->obj_name)
Comparison function for struct transport_monitor.
void ast_sip_transport_state_unregister(struct ast_sip_tpmgr_state_callback *element)
Unregister a transport state notification callback element.
Error while registering transport monitor.
#define AST_VECTOR_SIZE(vec)
Get the number of elements in a vector.
#define AST_RWLIST_HEAD(name, type)
Defines a structure to be used to hold a read/write list of specified type.
void ast_sip_transport_state_register(struct ast_sip_tpmgr_state_callback *element)
Register a transport state notification callback element.
static void transport_monitor_dtor(void *vdoomed)
ast_transport_monitor_shutdown_cb cb
void(* ast_transport_monitor_shutdown_cb)(void *data)
Transport shutdown monitor callback.
#define ao2_link(container, obj)