summaryrefslogtreecommitdiff
path: root/main/config.c
AgeCommit message (Collapse)Author
2007-11-19another bunch of include removals (errno.h and asterisk/logger.h)Luigi Rizzo
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89425 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-17trim more redundant headersLuigi Rizzo
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89384 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-16Start untangling header inclusion in a way that does not affectLuigi Rizzo
build times - tested, there is no measureable difference before and after this commit. In this change: use asterisk/compat.h to include a small set of system headers: inttypes.h, unistd.h, stddef.h, stddint.h, sys/types.h, stdarg.h, stdlib.h, alloca.h, stdio.h Where available, the inclusion is conditional on HAVE_FOO_H as determined by autoconf. Normally, source files should not include any of the above system headers, and instead use either "asterisk.h" or "asterisk/compat.h" which does it better. For the time being I have left alone second-level directories (main/db1-ast, etc.). git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89333 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-16add a small new function to retrieve variables from a configLuigi Rizzo
once we have a pointer to the category. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89322 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-14One more typo in config.c; and missed conversions due to the constifying of ↵Tilghman Lesher
ast_variable_new parameters git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89270 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-14TypoTilghman Lesher
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89269 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-14make the 'name' and 'value' fields in ast_variable const char *Luigi Rizzo
This prevents modifying the strings in the stored variables, and catched a few instances where this was actually done. Given the differences between trunk and 1.4 (and the fact that this is effectively an API change) it is better to fix 1.4 independently. These are chan_sip.c::sip_register() chan_skinny.c:: near line 2847 config.c:: near line 1774 logger.c::make_components() res_adsi.c:: near line 1049 I may have missed some instances for modules that do not build here. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89268 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-09This is the perhaps the biggest, boldest, most daring change I've ever ↵Steve Murphy
committed to trunk. Forgive me in advance any disruption this may cause, and please, report any problems via the bugtracker. The upside is that this can speed up large dialplans by 20 times (or more). Context, extension, and priority matching are all fairly constant-time searches. I introduce here my hashtables (hashtabs), and a regression for them. I would have used the ast_obj2 tables, but mine are resizeable, and don't need the object destruction capability. The hashtab stuff is well tested and stable. I introduce a data structure, a trie, for extension pattern matching, in which knowledge of all patterns is accumulated, and all matches can be found via a single traversal of the tree. This is per-context. The trie is formed on the first lookup attempt, and stored in the context for future lookups. Destruction routines are in place for hashtabs and the pattern match trie. You can see the contents of the pattern match trie by using the 'dialplan show' cli command when 'core set debug' has been done to put it in debug mode. The pattern tree traversal only traverses those parts of the tree that are interesting. It uses a scoreboard sort of approach to find the best match. The speed of the traversal is more a function of the length of the pattern than the number of patterns in the tree. The tree also contains the CID matching patterns. See the source code comments for details on how everything works. I believe the approach general enough that any issues that might come up involving fine points in the pattern matching algorithm, can be solved by just tweaking things. We shall see. The current pattern matcher is fairly involved, and replicating every nuance of it is difficult. If you find and report problems, I will try to resolve than as quickly as I can. The trie and hashtabs are added to the existing context and exten structs, and none of the old machinery has been removed for the sake of the multitude of functions that use them. In the future, we can (maybe) weed out the linked lists and save some space. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89129 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-08improve linked-list macros in two ways:Kevin P. Fleming
- the *_CURRENT macros no longer need the list head pointer argument - add AST_LIST_MOVE_CURRENT to encapsulate the remove/add operation when moving entries between lists git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89106 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-06Merged revisions 89036 via svnmerge from Steve Murphy
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r89036 | murf | 2007-11-06 10:52:50 -0700 (Tue, 06 Nov 2007) | 1 line closes issue #8786 - where the [catname](!) and [catname](othercat1,othercat2,...) notation gets dropped across a ConfigUpdate (or any other thing that would cause a config file to be written). While I was at it, I also cleaned up some of the destroy routines to free up comments, which was not being done. Made sure the new struct I introduced is also cleaned up properly at destruction time. My code handles multiple template inclusions. Many thanks to ssokol for his patch, which, while not literally used in the final merge, served as a foundation for the fix. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@89062 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-11-02Don't re-cache the filename, but check to see if it already existsTilghman Lesher
Reported by: jamesgolovich Patch by: jamesgolovich Closes issue #11144 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@88212 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-22Switch from AST_CLI (formerly NEW_CLI) to AST_CLI_DEFINE, since the former ↵Jason Parker
didn't make much sense git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@86820 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-19Convert NEW_CLI to AST_CLI.Jason Parker
Closes issue #11039, as suggested by seanbright. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@86536 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-10-19More changes to NEW_CLI.Jason Parker
Also fixes a few cli messages and some minor formatting. (closes issue #11001) Reported by: seanbright Patches: newcli.1.patch uploaded by seanbright (license 71) newcli.2.patch uploaded by seanbright (license 71) newcli.4.patch uploaded by seanbright (license 71) newcli.5.patch uploaded by seanbright (license 71) newcli.6.patch uploaded by seanbright (license 71) newcli.7.patch uploaded by seanbright (license 71) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@86534 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-20Fix memory leaks in pbx_dundi, cdr_pgsql, and the configuration file parser.Joshua Colp
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@83229 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-12This fix closes issue #10642 -- it's not perfect, but should retain most ↵Steve Murphy
blank lines in config files, via read/write cycles. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@82288 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-11remove unused functions that made this file not build under dev modeRussell Bryant
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@82270 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-11This solves an unreported solaris compile problem (missing -lnsl -lsocket).Steve Murphy
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@82268 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-05this set of changes fixes issue # 10643 by keeping track of the last object ↵Steve Murphy
defined in a file, and attaching any accumulated comments to that object (category header or variable declaration). The file_save routine also had to be upgraded to output these trailing comments. Config.h was modified to include the trailing comment list on categories and variables. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@81519 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-03Once we get past the file checks, we're loading, so clear the FILEUNCHANGED ↵Tilghman Lesher
flag (fixes #include) (closes issue #10629) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@81432 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-09-02We shouldn't use a filename blindly without checking to make sure it's ↵Tilghman Lesher
unused first git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@81430 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-29init newer so compile won't complain.Steve Murphy
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@81363 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-29make trunk build again. murf will have to review this to see if it was the ↵Russell Bryant
right fix, as it is related to his last change. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@81362 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-29This code was in team/murf/bug8684-trunk; it should fix bug 8684 in trunk. I ↵Steve Murphy
didn't add it to 1.4 yet, because it's not entirely clear to me if this is a bug fix or an enhancement. A lot of files were affected by small changes like ast_variable_new getting an added arg, for the file name the var was defined in; ast_category_new gets added args of filename and lineno; ast_category and ast_variable structures now record file and lineno for each entry; a list of all #include and #execs in a config file (or any of its inclusions are now kept in the ast_config struct; at save time, each entry is put back into its proper file of origin, in order. #include and #exec directives are folded in properly. Headers indicating that the file was generated, are generated also for each included file. Some changes to main/manager.c to take care of file renaming, via the UpdateConfig command. Multiple inclusions of the same file are handled by exploding these into multiple include files, uniquely named. There's probably more, but I can't remember it right now. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@81361 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-17Change this flag... might not otherwise unlock in an OOM situationTilghman Lesher
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@79885 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-16Don't reload a configuration file if nothing has changed.Tilghman Lesher
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@79747 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-06Merged revisions 78103 via svnmerge from Mark Michelson
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r78103 | mmichelson | 2007-08-03 15:25:22 -0500 (Fri, 03 Aug 2007) | 7 lines Changed the behavior of sip's realtime_peer function to match the corresponding way of matching for non-realtime peers. Now matches are made on both the IP address and port number, or if the insecure setting is set to "port" then just match on the IP address. In order to accomplish this, I also added a new API call, ast_category_root, which returns the first variable of an ast_category struct ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@78186 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-08-06Merged revisions 78180 via svnmerge from Jason Parker
https://origsvn.digium.com/svn/asterisk/branches/1.4 (closes issue #9938) ........ r78180 | qwell | 2007-08-06 11:30:51 -0500 (Mon, 06 Aug 2007) | 5 lines Fix an issue with using UpdateConfig (manager action) where escaped semicolons in a config would be converted to just semicolons (\; to ;) Issue 9938 ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@78181 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-26Do a massive conversion for using the ast_verb() macroRussell Bryant
(closes issue #10277, patches by mvanbaak) Basically, this changes ... if (option_verbose > 2) ast_verbose(VERBOSE_PREFIX_3, "Something\n"); to ... ast_verb(3, "Something\n"); git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@77299 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-07-17Introduce ast_parse_arg() , a generic function to parse stringsLuigi Rizzo
in a consistent way. This is meant to replace the custom code which is repeated all over the place in the various files when parsing config files, CLI entries and other string information. Right now the code supports parsing int32, uint32 and sockaddr_in with optional default values and bound checks. It contains minimal error checking, but that can be easily extended as the need arises. Being a new API i am introducing this only in trunk, though I believe that once the interface has been ironed out it might become a worthwhile addition to 1.4 as well - basically, the first time we will need to fix a piece of argument parsing code, we might as well bring in this change and use the new API instead. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@75379 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-06-14Merged revisions 69470 via svnmerge from Jason Parker
https://origsvn.digium.com/svn/asterisk/branches/1.4 ................ r69470 | qwell | 2007-06-14 18:22:51 -0500 (Thu, 14 Jun 2007) | 12 lines Merged revisions 69469 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r69469 | qwell | 2007-06-14 18:21:45 -0500 (Thu, 14 Jun 2007) | 4 lines Fix an issue where the line number in an unterminated comment block error message would show the wrong line number. "Reported" to me on #asterisk (somebody posted an error message, and I happened to catch it) ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@69471 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-06-14Add a massive set of changes for converting to use the ast_debug() macro.Russell Bryant
(issue #9957, patches from mvanbaak, caio1982, critch, and dimas) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@69327 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-06-06Issue 9869 - replace malloc and memset with ast_calloc, and other coding ↵Tilghman Lesher
guidelines changes git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@67864 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-05-07Merged revisions 63254 via svnmerge from Olle Johansson
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r63254 | oej | 2007-05-07 22:05:15 +0200 (Mon, 07 May 2007) | 2 lines Don't remove configuration from memory just because one section failed. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@63255 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-04-26Merged revisions 61959 via svnmerge from Joshua Colp
https://origsvn.digium.com/svn/asterisk/branches/1.4 ................ r61959 | file | 2007-04-25 21:27:18 -0400 (Wed, 25 Apr 2007) | 10 lines Merged revisions 61958 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r61958 | file | 2007-04-25 21:25:03 -0400 (Wed, 25 Apr 2007) | 2 lines Don't count failed include attempts against the configuration include level. (issue #9593 reported by mostyn) ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@61960 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-04-20Merged revisions 61690 via svnmerge from Russell Bryant
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r61690 | russell | 2007-04-20 13:19:18 -0500 (Fri, 20 Apr 2007) | 4 lines Fix the UpdateConfig manager action to properly treat "variables" and "objects" differently (a=b versus a=>b). (issue #9568, reported by pari, patch by me) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@61691 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-04-11via 8118, a RealTime upgrade to make RT a complete storage abstraction. The ↵Steve Murphy
store/destroy mechanisms needed these missing peices. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@61374 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-03-26Merged revisions 59225 via svnmerge from Steve Murphy
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r59225 | murf | 2007-03-26 14:06:12 -0600 (Mon, 26 Mar 2007) | 1 line Fix for 9257; by eliminating the globals in main/config.c, we make it thread-safe, which is a minimum requirement. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@59226 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-02-24Doxygen additions, correctionsOlle Johansson
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@56665 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-02-14New CLI command "Core show settings" to list some core settingsOlle Johansson
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@54464 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-02-02Merged revisions 53118 via svnmerge from Joshua Colp
https://origsvn.digium.com/svn/asterisk/branches/1.4 ................ r53118 | file | 2007-02-02 10:59:53 -0600 (Fri, 02 Feb 2007) | 10 lines Merged revisions 53117 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r53117 | file | 2007-02-02 10:58:09 -0600 (Fri, 02 Feb 2007) | 2 lines Pass the glob expanded filename to process_text_line so that error messages contain the actual filename, not the original include one. (issue #8959 reported by tzafrir) ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@53119 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-01-23Cosmetic changes. Make main source files better conform to coding guidelines ↵Joshua Colp
and standards. (issue #8679 reported by johann8384) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@51486 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-01-16Merged revisions 51057 via svnmerge from Russell Bryant
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r51057 | russell | 2007-01-15 19:15:44 -0600 (Mon, 15 Jan 2007) | 3 lines It is possible for the config pointer to be NULL here, so it needs to be checked before dereferencing it. ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@51058 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-01-14Bug 8803 - Fix crash in APITilghman Lesher
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@50784 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-01-10Merged revisions 50405 via svnmerge from Joshua Colp
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r50405 | file | 2007-01-10 14:46:29 -0500 (Wed, 10 Jan 2007) | 2 lines Fix parsing when using something like ldap settings. (done by anthonyl) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@50406 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-01-07When calling the Realtime app more than once, unset fields which wereTilghman Lesher
previously set are erroneously still set (Bug 6701). After discussion, it was determined this should only be changed in trunk. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@49801 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-01-05a little more const-ificationKevin P. Fleming
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@49727 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-01-05Merged revisions 49676 via svnmerge from Kevin P. Fleming
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r49676 | kpfleming | 2007-01-05 16:16:33 -0600 (Fri, 05 Jan 2007) | 2 lines reduce stack consumption for AMI and AMI/HTTP requests by nearly 20K in most cases ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@49678 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2007-01-04Merged revisions 49551 via svnmerge from Joshua Colp
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r49551 | file | 2007-01-04 17:28:29 -0500 (Thu, 04 Jan 2007) | 2 lines Only free comments and line buffer once we reach the first level. (issue #8678 reported by ssokol, fixed by anthonyl) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@49552 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2006-11-15Merged revisions 47690 via svnmerge from Kevin P. Fleming
https://origsvn.digium.com/svn/asterisk/branches/1.4 ................ r47690 | kpfleming | 2006-11-15 14:01:22 -0600 (Wed, 15 Nov 2006) | 20 lines Merged revisions 47686,47688-47689 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r47686 | kpfleming | 2006-11-15 13:42:05 -0600 (Wed, 15 Nov 2006) | 2 lines clear the category's variable tail pointer as well when variables are detached from it ........ r47688 | kpfleming | 2006-11-15 13:47:43 -0600 (Wed, 15 Nov 2006) | 2 lines when appending a list of variable to a category, ensure the tail pointer points to the last variable in the list ........ r47689 | kpfleming | 2006-11-15 13:58:46 -0600 (Wed, 15 Nov 2006) | 2 lines when re-writing the config file, don't repeat the path if it hasn't changed ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47691 65c4cc65-6c06-0410-ace0-fbb531ad65f3