2013-04-25 18:25:31 +00:00
|
|
|
/*
|
2015-03-11 16:38:20 +00:00
|
|
|
* res_pjsip_private.h
|
2013-04-25 18:25:31 +00:00
|
|
|
*
|
|
|
|
* Created on: Jan 25, 2013
|
|
|
|
* Author: mjordan
|
|
|
|
*/
|
|
|
|
|
2013-07-31 13:31:55 +00:00
|
|
|
#ifndef RES_PJSIP_PRIVATE_H_
|
|
|
|
#define RES_PJSIP_PRIVATE_H_
|
2013-04-25 18:25:31 +00:00
|
|
|
|
2015-03-11 16:38:20 +00:00
|
|
|
/*!
|
|
|
|
* \todo XXX Functions prototyped in this file that begin with "ast_sip_"
|
|
|
|
* need to be renamed so res_pjsip.so does not export the names outside
|
|
|
|
* of the module.
|
|
|
|
*/
|
|
|
|
|
2013-11-23 17:26:57 +00:00
|
|
|
#include "asterisk/module.h"
|
2014-01-28 20:47:15 +00:00
|
|
|
#include "asterisk/compat.h"
|
2013-11-23 17:26:57 +00:00
|
|
|
|
2013-04-25 18:25:31 +00:00
|
|
|
struct ao2_container;
|
Multiple revisions 399887,400138,400178,400180-400181
........
r399887 | dlee | 2013-09-26 10:41:47 -0500 (Thu, 26 Sep 2013) | 1 line
Minor performance bump by not allocate manager variable struct if we don't need it
........
r400138 | dlee | 2013-09-30 10:24:00 -0500 (Mon, 30 Sep 2013) | 23 lines
Stasis performance improvements
This patch addresses several performance problems that were found in
the initial performance testing of Asterisk 12.
The Stasis dispatch object was allocated as an AO2 object, even though
it has a very confined lifecycle. This was replaced with a straight
ast_malloc().
The Stasis message router was spending an inordinate amount of time
searching hash tables. In this case, most of our routers had 6 or
fewer routes in them to begin with. This was replaced with an array
that's searched linearly for the route.
We more heavily rely on AO2 objects in Asterisk 12, and the memset()
in ao2_ref() actually became noticeable on the profile. This was
#ifdef'ed to only run when AO2_DEBUG was enabled.
After being misled by an erroneous comment in taskprocessor.c during
profiling, the wrong comment was removed.
Review: https://reviewboard.asterisk.org/r/2873/
........
r400178 | dlee | 2013-09-30 13:26:27 -0500 (Mon, 30 Sep 2013) | 24 lines
Taskprocessor optimization; switch Stasis to use taskprocessors
This patch optimizes taskprocessor to use a semaphore for signaling,
which the OS can do a better job at managing contention and waiting
that we can with a mutex and condition.
The taskprocessor execution was also slightly optimized to reduce the
number of locks taken.
The only observable difference in the taskprocessor implementation is
that when the final reference to the taskprocessor goes away, it will
execute all tasks to completion instead of discarding the unexecuted
tasks.
For systems where unnamed semaphores are not supported, a really
simple semaphore implementation is provided. (Which gives identical
performance as the original taskprocessor implementation).
The way we ended up implementing Stasis caused the threadpool to be a
burden instead of a boost to performance. This was switched to just
use taskprocessors directly for subscriptions.
Review: https://reviewboard.asterisk.org/r/2881/
........
r400180 | dlee | 2013-09-30 13:39:34 -0500 (Mon, 30 Sep 2013) | 28 lines
Optimize how Stasis forwards are dispatched
This patch optimizes how forwards are dispatched in Stasis.
Originally, forwards were dispatched as subscriptions that are invoked
on the publishing thread. This did not account for the vast number of
forwards we would end up having in the system, and the amount of work it
would take to walk though the forward subscriptions.
This patch modifies Stasis so that rather than walking the tree of
forwards on every dispatch, when forwards and subscriptions are changed,
the subscriber list for every topic in the tree is changed.
This has a couple of benefits. First, this reduces the workload of
dispatching messages. It also reduces contention when dispatching to
different topics that happen to forward to the same aggregation topic
(as happens with all of the channel, bridge and endpoint topics).
Since forwards are no longer subscriptions, the bulk of this patch is
simply changing stasis_subscription objects to stasis_forward objects
(which, admittedly, I should have done in the first place.)
Since this required me to yet again put in a growing array, I finally
abstracted that out into a set of ast_vector macros in
asterisk/vector.h.
Review: https://reviewboard.asterisk.org/r/2883/
........
r400181 | dlee | 2013-09-30 13:48:57 -0500 (Mon, 30 Sep 2013) | 28 lines
Remove dispatch object allocation from Stasis publishing
While looking for areas for performance improvement, I realized that an
unused feature in Stasis was negatively impacting performance.
When a message is sent to a subscriber, a dispatch object is allocated
for the dispatch, containing the topic the message was published to, the
subscriber the message is being sent to, and the message itself.
The topic is actually unused by any subscriber in Asterisk today. And
the subscriber is associated with the taskprocessor the message is being
dispatched to.
First, this patch removes the unused topic parameter from Stasis
subscription callbacks.
Second, this patch introduces the concept of taskprocessor local data,
data that may be set on a taskprocessor and provided along with the data
pointer when a task is pushed using the ast_taskprocessor_push_local()
call. This allows the task to have both data specific to that
taskprocessor, in addition to data specific to that invocation.
With those two changes, the dispatch object can be removed completely,
and the message is simply refcounted and sent directly to the
taskprocessor.
Review: https://reviewboard.asterisk.org/r/2884/
........
Merged revisions 399887,400138,400178,400180-400181 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@400186 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2013-09-30 18:55:27 +00:00
|
|
|
struct ast_threadpool_options;
|
2015-04-09 22:03:17 +00:00
|
|
|
struct ast_sip_cli_context;
|
2013-04-25 18:25:31 +00:00
|
|
|
|
|
|
|
/*!
|
2015-03-11 16:38:20 +00:00
|
|
|
* \internal
|
2013-07-30 18:14:50 +00:00
|
|
|
* \brief Initialize the configuration for res_pjsip
|
2013-04-25 18:25:31 +00:00
|
|
|
*/
|
2013-11-23 17:26:57 +00:00
|
|
|
int ast_res_pjsip_initialize_configuration(const struct ast_module_info *ast_module_info);
|
2013-04-25 18:25:31 +00:00
|
|
|
|
|
|
|
/*!
|
2015-03-11 16:38:20 +00:00
|
|
|
* \internal
|
2013-04-25 18:25:31 +00:00
|
|
|
* \brief Annihilate the configuration objects
|
|
|
|
*/
|
2013-07-30 18:14:50 +00:00
|
|
|
void ast_res_pjsip_destroy_configuration(void);
|
2013-04-25 18:25:31 +00:00
|
|
|
|
|
|
|
/*!
|
2015-03-11 16:38:20 +00:00
|
|
|
* \internal
|
2013-04-25 18:25:31 +00:00
|
|
|
* \brief Reload the configuration
|
|
|
|
*/
|
2013-07-30 18:14:50 +00:00
|
|
|
int ast_res_pjsip_reload_configuration(void);
|
2013-04-25 18:25:31 +00:00
|
|
|
|
|
|
|
/*!
|
2015-03-11 16:38:20 +00:00
|
|
|
* \internal
|
|
|
|
* \brief Initialize transport support on a sorcery instance
|
|
|
|
*
|
|
|
|
* \retval -1 failure
|
|
|
|
* \retval 0 success
|
|
|
|
*/
|
|
|
|
int ast_sip_initialize_sorcery_transport(void);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Destroy transport support on a sorcery instance
|
|
|
|
*
|
|
|
|
* \retval -1 failure
|
|
|
|
* \retval 0 success
|
|
|
|
*/
|
|
|
|
int ast_sip_destroy_sorcery_transport(void);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Initialize qualify support on a sorcery instance
|
|
|
|
*
|
|
|
|
* \retval -1 failure
|
|
|
|
* \retval 0 success
|
|
|
|
*/
|
|
|
|
int ast_sip_initialize_sorcery_qualify(void);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Initialize location support on a sorcery instance
|
|
|
|
*
|
|
|
|
* \retval -1 failure
|
|
|
|
* \retval 0 success
|
|
|
|
*/
|
|
|
|
int ast_sip_initialize_sorcery_location(void);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Destroy location support on a sorcery instance
|
|
|
|
*
|
|
|
|
* \retval -1 failure
|
|
|
|
* \retval 0 success
|
|
|
|
*/
|
|
|
|
int ast_sip_destroy_sorcery_location(void);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Initialize domain aliases support on a sorcery instance
|
|
|
|
*
|
|
|
|
* \retval -1 failure
|
|
|
|
* \retval 0 success
|
|
|
|
*/
|
|
|
|
int ast_sip_initialize_sorcery_domain_alias(void);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Initialize authentication support on a sorcery instance
|
|
|
|
*
|
|
|
|
* \retval -1 failure
|
|
|
|
* \retval 0 success
|
|
|
|
*/
|
|
|
|
int ast_sip_initialize_sorcery_auth(void);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Destroy authentication support on a sorcery instance
|
|
|
|
*
|
|
|
|
* \retval -1 failure
|
|
|
|
* \retval 0 success
|
|
|
|
*/
|
|
|
|
int ast_sip_destroy_sorcery_auth(void);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Initialize the distributor module
|
|
|
|
*
|
|
|
|
* The distributor module is responsible for taking an incoming
|
|
|
|
* SIP message and placing it into the threadpool. Once in the threadpool,
|
|
|
|
* the distributor will perform endpoint lookups and authentication, and
|
|
|
|
* then distribute the message up the stack to any further modules.
|
|
|
|
*
|
|
|
|
* \retval -1 Failure
|
|
|
|
* \retval 0 Success
|
|
|
|
*/
|
|
|
|
int ast_sip_initialize_distributor(void);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Destruct the distributor module.
|
|
|
|
*
|
|
|
|
* Unregisters pjsip modules and cleans up any allocated resources.
|
|
|
|
*/
|
|
|
|
void ast_sip_destroy_distributor(void);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Initialize global type on a sorcery instance
|
|
|
|
*
|
|
|
|
* \retval -1 failure
|
|
|
|
* \retval 0 success
|
|
|
|
*/
|
|
|
|
int ast_sip_initialize_sorcery_global(void);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Destroy global type on a sorcery instance
|
|
|
|
* \since 13.3.0
|
|
|
|
*
|
|
|
|
* \retval -1 failure
|
|
|
|
* \retval 0 success
|
|
|
|
*/
|
|
|
|
int ast_sip_destroy_sorcery_global(void);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Initialize global headers support
|
|
|
|
*
|
|
|
|
* \return Nothing
|
|
|
|
*/
|
|
|
|
void ast_sip_initialize_global_headers(void);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Destroy global headers support
|
|
|
|
*
|
|
|
|
* \return Nothing
|
|
|
|
*/
|
|
|
|
void ast_sip_destroy_global_headers(void);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \internal
|
2013-04-25 18:25:31 +00:00
|
|
|
* \brief Initialize OPTIONS request handling.
|
|
|
|
*
|
|
|
|
* XXX This currently includes qualifying peers. It shouldn't.
|
|
|
|
* That should go into a registrar. When that occurs, we won't
|
|
|
|
* need the reload stuff.
|
|
|
|
*
|
|
|
|
* \param reload Reload options handling
|
|
|
|
*
|
|
|
|
* \retval 0 on success
|
|
|
|
* \retval other on failure
|
|
|
|
*/
|
2013-07-30 18:14:50 +00:00
|
|
|
int ast_res_pjsip_init_options_handling(int reload);
|
2013-04-25 18:25:31 +00:00
|
|
|
|
2016-09-19 11:13:21 +00:00
|
|
|
/*!
|
|
|
|
* \internal Initialize message IP updating handling.
|
|
|
|
*
|
|
|
|
* \retval 0 on success
|
|
|
|
* \retval other on failure
|
|
|
|
*/
|
|
|
|
int ast_res_pjsip_init_message_ip_updater(void);
|
|
|
|
|
2013-06-22 14:03:22 +00:00
|
|
|
/*!
|
2015-03-11 16:38:20 +00:00
|
|
|
* \internal
|
2013-06-22 14:03:22 +00:00
|
|
|
* \brief Initialize transport storage for contacts.
|
|
|
|
*
|
|
|
|
* \retval 0 on success
|
|
|
|
* \retval other on failure
|
|
|
|
*/
|
2013-07-30 18:14:50 +00:00
|
|
|
int ast_res_pjsip_init_contact_transports(void);
|
2013-06-22 14:03:22 +00:00
|
|
|
|
2013-04-25 18:25:31 +00:00
|
|
|
/*!
|
2015-03-11 16:38:20 +00:00
|
|
|
* \internal
|
2013-04-25 18:25:31 +00:00
|
|
|
* \brief Initialize outbound authentication support
|
|
|
|
*
|
|
|
|
* \retval 0 Success
|
|
|
|
* \retval non-zero Failure
|
|
|
|
*/
|
2015-01-27 19:08:44 +00:00
|
|
|
int internal_sip_initialize_outbound_authentication(void);
|
|
|
|
|
|
|
|
/*!
|
2015-03-11 16:38:20 +00:00
|
|
|
* \internal
|
2015-01-27 19:08:44 +00:00
|
|
|
* \brief Destroy outbound authentication support
|
|
|
|
*
|
|
|
|
* \retval 0 Success
|
|
|
|
* \retval non-zero Failure
|
|
|
|
*/
|
|
|
|
void internal_sip_destroy_outbound_authentication(void);
|
2013-04-25 18:25:31 +00:00
|
|
|
|
2013-07-18 19:25:51 +00:00
|
|
|
/*!
|
2015-03-11 16:38:20 +00:00
|
|
|
* \internal
|
2013-07-18 19:25:51 +00:00
|
|
|
* \brief Initialize system configuration
|
|
|
|
*
|
|
|
|
* \retval 0 Success
|
|
|
|
* \retval non-zero Failure
|
|
|
|
*/
|
|
|
|
int ast_sip_initialize_system(void);
|
|
|
|
|
2014-02-20 20:45:30 +00:00
|
|
|
/*!
|
2015-03-11 16:38:20 +00:00
|
|
|
* \internal
|
2014-02-20 20:45:30 +00:00
|
|
|
* \brief Destroy system configuration
|
|
|
|
*/
|
|
|
|
void ast_sip_destroy_system(void);
|
|
|
|
|
2014-03-17 22:54:32 +00:00
|
|
|
/*!
|
2015-03-11 16:38:20 +00:00
|
|
|
* \internal
|
2014-03-17 22:54:32 +00:00
|
|
|
* \brief Initialize nameserver configuration
|
|
|
|
*/
|
|
|
|
void ast_sip_initialize_dns(void);
|
|
|
|
|
2013-07-18 19:25:51 +00:00
|
|
|
/*!
|
2015-03-11 16:38:20 +00:00
|
|
|
* \internal
|
2013-07-18 19:25:51 +00:00
|
|
|
* \brief Initialize global configuration
|
|
|
|
*
|
|
|
|
* \retval 0 Success
|
|
|
|
* \retval non-zero Failure
|
|
|
|
*/
|
|
|
|
int ast_sip_initialize_global(void);
|
|
|
|
|
2013-08-02 12:40:03 +00:00
|
|
|
/*!
|
2015-03-11 16:38:20 +00:00
|
|
|
* \internal
|
2013-08-02 12:40:03 +00:00
|
|
|
* \brief Clean up res_pjsip options handling
|
|
|
|
*/
|
|
|
|
void ast_res_pjsip_cleanup_options_handling(void);
|
|
|
|
|
2016-09-19 11:13:21 +00:00
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Clean up res_pjsip message ip updating handling
|
|
|
|
*/
|
|
|
|
void ast_res_pjsip_cleanup_message_ip_updater(void);
|
|
|
|
|
2013-08-06 13:08:13 +00:00
|
|
|
/*!
|
2015-03-11 16:38:20 +00:00
|
|
|
* \internal
|
2013-08-06 13:08:13 +00:00
|
|
|
* \brief Get threadpool options
|
|
|
|
*/
|
|
|
|
void sip_get_threadpool_options(struct ast_threadpool_options *threadpool_options);
|
|
|
|
|
2013-12-11 20:24:50 +00:00
|
|
|
/*!
|
2015-03-11 16:38:20 +00:00
|
|
|
* \internal
|
2013-12-11 20:24:50 +00:00
|
|
|
* \brief Retrieve the name of the default outbound endpoint.
|
|
|
|
*
|
|
|
|
* \note This returns a memory allocated copy of the name that
|
|
|
|
* needs to be freed by the caller.
|
|
|
|
*
|
|
|
|
* \retval The name of the default outbound endpoint.
|
|
|
|
* \retval NULL if configuration not found.
|
|
|
|
*/
|
|
|
|
char *ast_sip_global_default_outbound_endpoint(void);
|
|
|
|
|
2013-12-20 21:32:13 +00:00
|
|
|
/*!
|
2015-03-11 16:38:20 +00:00
|
|
|
* \internal
|
2013-12-20 21:32:13 +00:00
|
|
|
* \brief Functions for initializing and destroying the CLI.
|
|
|
|
*/
|
2014-02-06 17:55:45 +00:00
|
|
|
int ast_sip_initialize_cli(void);
|
2013-12-20 21:32:13 +00:00
|
|
|
void ast_sip_destroy_cli(void);
|
|
|
|
|
2015-04-09 22:03:17 +00:00
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Add res_pjsip global configuration options to the cli context.
|
|
|
|
*
|
|
|
|
* \param context context to add options to
|
|
|
|
* \retval 0 Success, -1 on failure
|
|
|
|
*/
|
|
|
|
int sip_cli_print_global(struct ast_sip_cli_context *context);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Add res_pjsip system configuration options to the cli context.
|
|
|
|
*
|
|
|
|
* \param context context to add options to
|
|
|
|
* \retval 0 Success, -1 on failure
|
|
|
|
*/
|
|
|
|
int sip_cli_print_system(struct ast_sip_cli_context *context);
|
|
|
|
|
2015-01-27 19:08:44 +00:00
|
|
|
/*!
|
2015-03-11 16:38:20 +00:00
|
|
|
* \internal
|
|
|
|
* \brief Used by res_pjsip.so to register a service without adding a self reference
|
2015-01-27 19:08:44 +00:00
|
|
|
*/
|
|
|
|
int internal_sip_register_service(pjsip_module *module);
|
|
|
|
|
|
|
|
/*!
|
2015-03-11 16:38:20 +00:00
|
|
|
* \internal
|
|
|
|
* \brief Used by res_pjsip.so to unregister a service without removing a self reference
|
2015-01-27 19:08:44 +00:00
|
|
|
*/
|
|
|
|
int internal_sip_unregister_service(pjsip_module *module);
|
|
|
|
|
|
|
|
/*!
|
2015-03-11 16:38:20 +00:00
|
|
|
* \internal
|
|
|
|
* \brief Used by res_pjsip.so to register an endpoint formatter without adding a self reference
|
2015-01-27 19:08:44 +00:00
|
|
|
*/
|
|
|
|
void internal_sip_register_endpoint_formatter(struct ast_sip_endpoint_formatter *obj);
|
|
|
|
|
|
|
|
/*!
|
2015-03-11 16:38:20 +00:00
|
|
|
* \internal
|
|
|
|
* \brief Used by res_pjsip.so to unregister a endpoint formatter without removing a self reference
|
2015-01-27 19:08:44 +00:00
|
|
|
*/
|
|
|
|
int internal_sip_unregister_endpoint_formatter(struct ast_sip_endpoint_formatter *obj);
|
|
|
|
|
2015-04-27 11:11:40 -06:00
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Finds or creates contact_status for a contact
|
|
|
|
*/
|
|
|
|
struct ast_sip_contact_status *ast_res_pjsip_find_or_create_contact_status(const struct ast_sip_contact *contact);
|
2016-04-14 07:15:47 -05:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Validate that the uri meets pjproject length restrictions
|
|
|
|
*/
|
|
|
|
int ast_sip_validate_uri_length(const char *uri);
|
|
|
|
|
res_pjsip: Add serialized scheduler (res_pjsip/pjsip_scheduler.c)
There are several places that do scheduled tasks or periodic housecleaning,
each with its own implementation:
* res_pjsip_keepalive has a thread that sends keepalives.
* pjsip_distributor has a thread that cleans up expired unidentified requests.
* res_pjsip_registrar_expire has a thread that cleans up expired contacts.
* res_pjsip_pubsub uses ast_sched directly and then calls ast_sip_push_task.
* res_pjsip_sdp_rtp also uses ast_sched to send keepalives.
There are also places where we should be doing scheduled work but aren't.
A good example are the places we have sorcery observers to start registration
or qualify. These don't work when changes are made to a backend database
without a pjsip reload. We need to check periodically.
As a first step to solving these issues, a new ast_sip_sched facility has
been created.
ast_sip_sched wraps ast_sched but only uses ast_sched as a scheduled queue.
When a task is ready to run, ast_sip_task_pusk is called for it. This ensures
that the task is executed in a PJLIB registered thread and doesn't hold up the
ast_sched thread so it can immediately continue processing the queue. The
serializer used by ast_sip_sched is one of your choosing or a random one from
the res_pjsip pool if you don't choose one.
Another feature is the ability to automatically clean up the task_data when the
task expires (if ever). If it's an ao2 object, it will be dereferenced, if
it's a malloc'd object it will be freed. This is selectable when the task is
scheduled. Even if you choose to not auto dereference an ao2 task data object,
the scheduler itself maintains a reference to it while the task is under it's
control. This prevents the data from disappearing out from under the task.
There are two scheduling models.
AST_SIP_SCHED_TASK_PERIODIC specifies that the invocations of the task occur at
the specific interval. That is, every "interval" milliseconds, regardless of
how long the task takes. If the task takes longer than the interval, it will
be scheduled at the next available multiple of interval. For exmaple: If the
task has an interval of 60 secs and the task takes 70 secs (it better not),
the next invocation will happen at 120 seconds.
AST_SIP_SCHED_TASK_DELAY specifies that the next invocation of the task should
start "interval" milliseconds after the current invocation has finished.
Also, the same ast_sched facility for fixed or variable intervals exists. The
task's return code in conjunction with the AST_SIP_SCHED_TASK_FIXED or
AST_SIP_SCHED_TASK_VARIABLE flags controls the next invocation start time.
One res_pjsip.h housekeeping change was made. The pjsip header files were
added to the top. There have been a few cases lately where I've needed
res_pjsip.h just for ast_sip calls and had compiles fail spectacularly because
I didn't add the pjsip header files to my source even though I never referenced
any pjsip calls.
Finally, a few new convenience APIs were added to astobj2 to make things a
little easier in the scheduler. ao2_ref_and_lock() calls ao2_ref() and
ao2_lock() in one go. ao2_unlock_and_unref() does the reverse. A few macros
were also copied from res_phoneprov because I got tired of having to duplicate
the same hash, sort and compare functions over and over again. The
AO2_STRING_FIELD_(HASH|SORT|CMP)_FN macros will insert functions suitable for
aor_container_alloc into your source.
This facility can be used immediately for the situations where we already have
a thread that wakes up periodically or do some scheduled work. For the
registration and qualify issues, additional sorcery and schema changes would
need to be made so that we can easily detect changed objects on a periodic
basis without having to pull the entire database back to check. I'm thinking
of a last-updated timestamp on the rows but more on this later.
Change-Id: I7af6ad2b2d896ea68e478aa1ae201d6dd016ba1c
2016-03-17 11:28:26 -06:00
|
|
|
/*!
|
|
|
|
* \brief Initialize scheduler
|
|
|
|
* \since 13.9.0
|
|
|
|
*
|
|
|
|
* \retval -1 failure
|
|
|
|
* \retval 0 success
|
|
|
|
*/
|
|
|
|
int ast_sip_initialize_scheduler(void);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \internal
|
|
|
|
* \brief Destroy scheduler
|
|
|
|
* \since 13.9.0
|
|
|
|
*
|
|
|
|
* \retval -1 failure
|
|
|
|
* \retval 0 success
|
|
|
|
*/
|
|
|
|
int ast_sip_destroy_scheduler(void);
|
|
|
|
|
2013-07-31 13:31:55 +00:00
|
|
|
#endif /* RES_PJSIP_PRIVATE_H_ */
|