summaryrefslogtreecommitdiff
path: root/main/channel.c
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2012-09-12 21:02:29 +0000
committerRichard Mudgett <rmudgett@digium.com>2012-09-12 21:02:29 +0000
commitfb1d9a90a4e67c832486f35c54dab5b99ef62941 (patch)
tree667bde49b2a70ea07f608e7ed24220284f842d7f /main/channel.c
parent189249cc73d66948957884494ed23da738ab4cd1 (diff)
Enhance astobj2 to support other types of containers.
The new API allows for sorted containers, insertion options, duplicate handling options, and traversal order options. * Adds the ability for containers to be sorted when they are created. * Adds container creation options to handle duplicates when they are inserted. * Adds container creation option to insert objects at the beginning or end of the container traversal order. * Adds OBJ_PARTIAL_KEY to allow searching with a partial key. The partial key works similarly to the OBJ_KEY flag. (The real search speed improvement with this flag will come when red-black trees are added.) * Adds container traversal and iteration order options: Ascending and Descending. * Adds an AST_DEVMODE compile feature to check the stats and integrity of registered containers using the CLI "astobj2 container stats <name>" and "astobj2 container check <name>". The channels container is normally registered since it is one of the most important containers in the system. * Adds ao2_iterator_restart() to allow iteration to be restarted from the beginning. * Changes the generic container object to have a v_method table pointer to support other types of containers. * Changes the container nodes holding objects to be ref counted. The ref counted nodes and v_method table pointer changes pave the way to allow other types of containers. * Includes a large astobj2 unit test enhancement that tests the new features. (closes issue ASTERISK-19969) Reported by: rmudgett Review: https://reviewboard.asterisk.org/r/2078/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@372997 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/channel.c')
-rw-r--r--main/channel.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/main/channel.c b/main/channel.c
index 0faf165f1..d62f34239 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -8508,6 +8508,9 @@ void ast_channels_init(void)
{
channels = ao2_container_alloc(NUM_CHANNEL_BUCKETS,
ast_channel_hash_cb, ast_channel_cmp_cb);
+ if (channels) {
+ ao2_container_register("channels", channels);
+ }
ast_cli_register_multiple(cli_channel, ARRAY_LEN(cli_channel));