aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2009-02-17 21:24:17 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2009-02-17 21:24:17 +0000
commitc0c66d61ca5950434dc9c9270d44a1870bbf48ab (patch)
tree85e8f6bd3f4d70b889f50e83754934c1352730a6 /include
parentb969191c13883a899a457d0944716d32fdc700b4 (diff)
Merged revisions 176666 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ........ r176666 | russell | 2009-02-17 15:22:40 -0600 (Tue, 17 Feb 2009) | 16 lines Update the timing API to have better support for multiple timing interfaces. 1) Add module use count handling so that timing modules can be unloaded. 2) Implement unload_module() functions for the timing interface modules. 3) Allow multiple timing modules to be loaded, and use the one with the highest priority value. 4) Report which timing module is being use in the "timing test" CLI command. (closes issue #14489) Reported by: russell Review: http://reviewboard.digium.com/r/162/ ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.1@176675 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include')
-rw-r--r--include/asterisk/timing.h35
1 files changed, 22 insertions, 13 deletions
diff --git a/include/asterisk/timing.h b/include/asterisk/timing.h
index 659eb7229..0bfb527f7 100644
--- a/include/asterisk/timing.h
+++ b/include/asterisk/timing.h
@@ -1,9 +1,10 @@
/*
* Asterisk -- An open source telephony toolkit.
*
- * Copyright (C) 2008, Digium, Inc.
+ * Copyright (C) 2008 - 2009, Digium, Inc.
*
* Kevin P. Fleming <kpfleming@digium.com>
+ * Russell Bryant <russell@digium.com>
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
@@ -20,6 +21,7 @@
\file timing.h
\brief Timing source management
\author Kevin P. Fleming <kpfleming@digium.com>
+ \author Russell Bryant <russell@digium.com>
Portions of Asterisk require a timing source, a periodic trigger
for media handling activities. The functions in this file allow
@@ -52,7 +54,7 @@
extern "C" {
#endif
-enum ast_timing_event {
+enum ast_timer_event {
AST_TIMING_EVENT_EXPIRED = 1,
AST_TIMING_EVENT_CONTINUOUS = 2,
};
@@ -64,37 +66,44 @@ enum ast_timing_event {
* So, the behavior of these calls should match the documentation of the
* public API calls.
*/
-struct ast_timing_functions {
+struct ast_timing_interface {
+ const char *name;
+ /*! This handles the case where multiple timing modules are loaded.
+ * The highest priority timing interface available will be used. */
+ unsigned int priority;
int (*timer_open)(void);
void (*timer_close)(int handle);
int (*timer_set_rate)(int handle, unsigned int rate);
void (*timer_ack)(int handle, unsigned int quantity);
int (*timer_enable_continuous)(int handle);
int (*timer_disable_continuous)(int handle);
- enum ast_timing_event (*timer_get_event)(int handle);
+ enum ast_timer_event (*timer_get_event)(int handle);
unsigned int (*timer_get_max_rate)(int handle);
};
/*!
- * \brief Install a set of timing functions.
+ * \brief Register a set of timing functions.
*
- * \param funcs An instance of the \c ast_timing_functions structure with pointers
+ * \param funcs An instance of the \c ast_timing_interfaces structure with pointers
* to the functions provided by the timing implementation.
*
* \retval NULL failure
- * \retval non-Null handle to be passed to ast_uninstall_timing_functions() on success
+ * \retval non-Null handle to be passed to ast_unregister_timing_interface() on success
*/
-void *ast_install_timing_functions(struct ast_timing_functions *funcs);
+#define ast_register_timing_interface(i) _ast_register_timing_interface(i, ast_module_info->self)
+void *_ast_register_timing_interface(struct ast_timing_interface *funcs,
+ struct ast_module *mod);
/*!
- * \brief Uninstall a previously-installed set of timing functions.
+ * \brief Unregister a previously registered timing interface.
*
* \param handle The handle returned from a prior successful call to
- * ast_install_timing_functions().
+ * ast_register_timing_interface().
*
- * \return nothing
+ * \retval 0 success
+ * \retval non-zero failure
*/
-void ast_uninstall_timing_functions(void *handle);
+int ast_unregister_timing_interface(void *handle);
/*!
* \brief Open a timing fd
@@ -174,7 +183,7 @@ int ast_timer_disable_continuous(int handle);
*
* \return which event triggered the timing fd
*/
-enum ast_timing_event ast_timer_get_event(int handle);
+enum ast_timer_event ast_timer_get_event(int handle);
/*!
* \brief Get maximum rate supported for a timing handle