asterisk/main
Russell Bryant cba19c8a67 Convert the ast_channel data structure over to the astobj2 framework.
There is a lot that could be said about this, but the patch is a big 
improvement for performance, stability, code maintainability, 
and ease of future code development.

The channel list is no longer an unsorted linked list.  The main container 
for channels is an astobj2 hash table.  All of the code related to searching 
for channels or iterating active channels has been rewritten.  Let n be 
the number of active channels.  Iterating the channel list has gone from 
O(n^2) to O(n).  Searching for a channel by name went from O(n) to O(1).  
Searching for a channel by extension is still O(n), but uses a new method 
for doing so, which is more efficient.

The ast_channel object is now a reference counted object.  The benefits 
here are plentiful.  Some benefits directly related to issues in the 
previous code include:

1) When threads other than the channel thread owning a channel wanted 
   access to a channel, it had to hold the lock on it to ensure that it didn't 
   go away.  This is no longer a requirement.  Holding a reference is 
   sufficient.

2) There are places that now require less dealing with channel locks.

3) There are places where channel locks are held for much shorter periods 
   of time.

4) There are places where dealing with more than one channel at a time becomes 
   _MUCH_ easier.  ChanSpy is a great example of this.  Writing code in the 
   future that deals with multiple channels will be much easier.

Some additional information regarding channel locking and reference count 
handling can be found in channel.h, where a new section has been added that 
discusses some of the rules associated with it.

Mark Michelson also assisted with the development of this patch.  He did the 
conversion of ChanSpy and introduced a new API, ast_autochan, which makes it 
much easier to deal with holding on to a channel pointer for an extended period 
of time and having it get automatically updated if the channel gets masqueraded.
Mark was also a huge help in the code review process.

Thanks to David Vossel for his assistance with this branch, as well.  David 
did the conversion of the DAHDIScan application by making it become a wrapper 
for ChanSpy internally.

The changes come from the svn/asterisk/team/russell/ast_channel_ao2 branch.

Review: http://reviewboard.digium.com/r/203/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@190423 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2009-04-24 14:04:26 +00:00
..
db1-ast Merged revisions 189391 via svnmerge from 2009-04-20 19:28:16 +00:00
editline Merged revisions 179395 via svnmerge from 2009-03-02 20:16:51 +00:00
stdtime Use nanosleep instead of poll. 2009-04-20 22:10:25 +00:00
Makefile Convert the ast_channel data structure over to the astobj2 framework. 2009-04-24 14:04:26 +00:00
abstract_jb.c Spacing changes only 2009-03-04 20:48:42 +00:00
acl.c Spacing changes only 2009-03-04 20:48:42 +00:00
adsistub.c remove a bunch of useless #include "options.h" 2007-11-21 23:09:02 +00:00
aescrypt.c Spacing changes only 2009-03-04 20:48:42 +00:00
aeskey.c use the OpenSSL AES implementation if it's available (unless configured not to) 2007-05-24 22:07:50 +00:00
aesopt.h merge new_loader_completion branch, including (at least): 2006-08-21 02:11:39 +00:00
aestab.c use the OpenSSL AES implementation if it's available (unless configured not to) 2007-05-24 22:07:50 +00:00
alaw.c Spacing changes only 2009-03-04 20:48:42 +00:00
app.c Fix building of chan_h323 with gcc-3.3 2009-04-22 21:15:55 +00:00
ast_expr2.c Merged revisions 179807 via svnmerge from 2009-03-03 22:12:02 +00:00
ast_expr2.fl Merged revisions 179807 via svnmerge from 2009-03-03 22:12:02 +00:00
ast_expr2.h Merged revisions 179807 via svnmerge from 2009-03-03 22:12:02 +00:00
ast_expr2.y Merged revisions 179807 via svnmerge from 2009-03-03 22:12:02 +00:00
ast_expr2f.c Merge changes from str_substitution that are unrelated to that branch. 2009-04-01 20:13:28 +00:00
asterisk.c Fix copy/paste error with 'transmit silence' flag. 2009-04-17 19:36:38 +00:00
asterisk.exports Remove symbols I just added to main/asterisk.exports and instead rename the functions. 2009-03-20 16:24:20 +00:00
astfd.c Merged revisions 187300-187301 via svnmerge from 2009-04-09 04:59:05 +00:00
astmm.c Janitor, use ARRAY_LEN() when possible. 2008-12-05 10:31:25 +00:00
astobj2.c Support HTTP digest authentication for the http manager interface. 2009-04-23 20:36:35 +00:00
audiohook.c Modify headers and macros, according to Russell's suggestions on the -dev list 2009-04-10 03:55:27 +00:00
autochan.c Convert the ast_channel data structure over to the astobj2 framework. 2009-04-24 14:04:26 +00:00
autoservice.c Merged revisions 163448 via svnmerge from 2008-12-12 13:55:30 +00:00
bridging.c Modify headers and macros, according to Russell's suggestions on the -dev list 2009-04-10 03:55:27 +00:00
buildinfo.c fix a few small things found by using sparse 2008-10-30 16:49:02 +00:00
callerid.c This commit introduces COLP/CONP and Redirecting party information into Asterisk. 2009-04-03 22:41:46 +00:00
cdr.c Merge ast_str_opaque branch (discontinue usage of ast_str internals) 2008-12-13 08:36:35 +00:00
channel.c Convert the ast_channel data structure over to the astobj2 framework. 2009-04-24 14:04:26 +00:00
chanvars.c Add additional memory debugging to several core APIs, and fix several memory 2008-10-14 22:38:06 +00:00
cli.c Convert the ast_channel data structure over to the astobj2 framework. 2009-04-24 14:04:26 +00:00
config.c If there are no realtime engines, there's no reason to check for realtime families 2009-02-17 15:18:55 +00:00
cryptostub.c Don't include logger.h in asterisk.h by default as it is causing problems building 2008-10-10 00:42:13 +00:00
cygload.c Doxygen updates, formatting. 2007-12-11 22:20:22 +00:00
datastore.c make datastore creation and destruction a generic API since it is not really channel related, and add the ability to add/find/remove datastores to manager sessions 2008-08-05 16:56:11 +00:00
db.c Merged revisions 182449 via svnmerge from 2009-03-17 05:51:54 +00:00
devicestate.c Convert the ast_channel data structure over to the astobj2 framework. 2009-04-24 14:04:26 +00:00
dial.c This commit introduces COLP/CONP and Redirecting party information into Asterisk. 2009-04-03 22:41:46 +00:00
dns.c incorporates r159808 from branches/1.4: 2008-11-29 17:57:39 +00:00
dnsmgr.c Record the previous port in the temporary address structure so that the comparison does not treat the host as having changed even if it did not. This would have been uninitialized before and would have led to a baddddd port. 2008-12-22 16:08:13 +00:00
dsp.c Add an option, waitfordialtone, for UK analog lines which do not end a call 2008-11-25 22:45:59 +00:00
ecdisa.h merge new_loader_completion branch, including (at least): 2006-08-21 02:11:39 +00:00
enum.c Add Doxygen documentation for API changes from 1.6.0 to 1.6.1 2009-03-09 20:58:17 +00:00
event.c Change g_eid to ast_eid_default. 2009-03-27 14:00:18 +00:00
features.c Convert the ast_channel data structure over to the astobj2 framework. 2009-04-24 14:04:26 +00:00
file.c Merged revisions 188582 via svnmerge from 2009-04-15 20:17:33 +00:00
fixedjitterbuf.c Start untangling header inclusion in a way that does not affect 2007-11-16 20:04:58 +00:00
fixedjitterbuf.h Merged revisions 135841,135847,135850 via svnmerge from 2008-08-06 00:30:53 +00:00
frame.c Merged revisions 180372 via svnmerge from 2009-03-05 18:29:38 +00:00
fskmodem.c (Step 2 of 2) 2008-07-21 21:00:47 +00:00
fskmodem_float.c Optionally build integer-based routines for FSK tone decoding (but default 2008-07-21 20:59:03 +00:00
fskmodem_int.c Optionally build integer-based routines for FSK tone decoding (but default 2008-07-21 20:59:03 +00:00
global_datastores.c Merged revisions 172517 via svnmerge from 2009-01-30 21:29:12 +00:00
hashtab.c Add MALLOC_DEBUG to various utility APIs, so that memory leaks can be tracked back to their source. 2009-03-11 00:29:59 +00:00
heap.c Pass more useful information through to lock tracking when DEBUG_THREADS is on. 2009-03-27 01:35:56 +00:00
http.c Support HTTP digest authentication for the http manager interface. 2009-04-23 20:36:35 +00:00
image.c Whitespace changes only 2008-03-04 23:04:29 +00:00
indications.c Ensure there is a valid tone part before trying to play tones. 2009-02-26 15:40:10 +00:00
io.c Merged revisions 182810 via svnmerge from 2009-03-18 02:28:55 +00:00
jitterbuf.c Merged revisions 174583 via svnmerge from 2009-02-10 18:16:31 +00:00
loader.c Merge in the RTP engine API. 2009-04-02 17:20:52 +00:00
logger.c Convert the ast_channel data structure over to the astobj2 framework. 2009-04-24 14:04:26 +00:00
manager.c Convert the ast_channel data structure over to the astobj2 framework. 2009-04-24 14:04:26 +00:00
md5.c Start untangling header inclusion in a way that does not affect 2007-11-16 20:04:58 +00:00
netsock.c Make OpenBSD compile again 2008-06-19 20:25:37 +00:00
pbx.c Convert the ast_channel data structure over to the astobj2 framework. 2009-04-24 14:04:26 +00:00
plc.c Start untangling header inclusion in a way that does not affect 2007-11-16 20:04:58 +00:00
poll.c Merged revisions 182810 via svnmerge from 2009-03-18 02:28:55 +00:00
privacy.c remove a bunch of useless #include "options.h" 2007-11-21 23:09:02 +00:00
rtp_engine.c Change how we set the local and remote address. 2009-04-10 18:14:47 +00:00
say.c Fix a crash when saying certain numbers in Chinese 2009-01-21 22:10:02 +00:00
sched.c Fix a regression in scheduler entry ordering, and add a regression test for it. 2009-02-23 17:29:16 +00:00
sha1.c more header removal/normalization 2007-11-21 00:23:49 +00:00
slinfactory.c improve slinfactory API to remove implicit sample rate and require explicit sample rate selection by creator of the slinfactory 2009-02-10 19:38:26 +00:00
srv.c bump the verbosity of a message in srv.c up by one. It used to be 2009-01-12 23:12:30 +00:00
strcompat.c Whitespace changes only 2008-03-04 23:04:29 +00:00
strings.c Missed a common case for needing to extend the buffer. 2009-04-02 15:14:22 +00:00
stun.c This commit introduces COLP/CONP and Redirecting party information into Asterisk. 2009-04-03 22:41:46 +00:00
taskprocessor.c Merge changes from str_substitution that are unrelated to that branch. 2009-04-01 20:13:28 +00:00
tcptls.c Add Doxygen documentation for API changes from 1.6.0 to 1.6.1 2009-03-09 20:58:17 +00:00
tdd.c Merge changes from str_substitution that are unrelated to that branch. 2009-04-01 20:13:28 +00:00
term.c Merge changes from team/group/appdocsxml 2008-11-01 21:10:07 +00:00
threadstorage.c Merged revisions 164736 via svnmerge from 2008-12-16 17:14:01 +00:00
timing.c Improve timing interface to remember which provider provided a timer 2009-03-27 19:10:32 +00:00
translate.c Adjust translation table column widths based upon the translation times. 2009-03-12 17:32:13 +00:00
udptl.c Merged revisions 175311 via svnmerge from 2009-02-12 21:25:14 +00:00
ulaw.c another bunch of include removals (errno.h and asterisk/logger.h) 2007-11-19 19:09:03 +00:00
utils.c Support HTTP digest authentication for the http manager interface. 2009-04-23 20:36:35 +00:00
xml.c 1. Make OS X compile cleanly with app_stack. 2009-02-03 00:29:49 +00:00
xmldoc.c Making sure we have references to external libraries. 2009-04-14 14:20:10 +00:00