[asterisk-commits] kmoore: branch kmoore/bridge_construction-cel_channels r389448 - in /team/kmo...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue May 21 16:39:09 CDT 2013
Author: kmoore
Date: Tue May 21 16:39:06 2013
New Revision: 389448
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=389448
Log:
Pull in config tweak from the CDR patch and refactor accordingly
Modified:
team/kmoore/bridge_construction-cel_channels/include/asterisk/config_options.h
team/kmoore/bridge_construction-cel_channels/main/cel.c
team/kmoore/bridge_construction-cel_channels/main/config_options.c
Modified: team/kmoore/bridge_construction-cel_channels/include/asterisk/config_options.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/bridge_construction-cel_channels/include/asterisk/config_options.h?view=diff&rev=389448&r1=389447&r2=389448
==============================================================================
--- team/kmoore/bridge_construction-cel_channels/include/asterisk/config_options.h (original)
+++ team/kmoore/bridge_construction-cel_channels/include/asterisk/config_options.h Tue May 21 16:39:06 2013
@@ -146,10 +146,11 @@
/*! \brief The representation of a single configuration file to be processed */
struct aco_file {
- const char *filename; /*!< \brief The filename to be processed */
- const char *alias; /*!< \brief An alias filename to be tried if 'filename' cannot be found */
- const char **preload; /*!< \brief A null-terminated oredered array of categories to be loaded first */
- struct aco_type *types[]; /*!< The list of types for this config. Required. Use a sentinel! */
+ const char *filename; /*!< The filename to be processed */
+ const char *alias; /*!< An alias filename to be tried if 'filename' cannot be found */
+ const char **preload; /*!< A null-terminated ordered array of categories to be loaded first */
+ const char *skip_category; /*!< A regular expression of categories to skip in the file. Use when a file is processed by multiple modules */
+ struct aco_type *types[]; /*!< The list of types for this config. Required. Use a sentinel! */
};
struct aco_info {
Modified: team/kmoore/bridge_construction-cel_channels/main/cel.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/bridge_construction-cel_channels/main/cel.c?view=diff&rev=389448&r1=389447&r2=389448
==============================================================================
--- team/kmoore/bridge_construction-cel_channels/main/cel.c (original)
+++ team/kmoore/bridge_construction-cel_channels/main/cel.c Tue May 21 16:39:06 2013
@@ -117,11 +117,6 @@
</description>
</configOption>
</configObject>
- <configObject name="ignored">
- <configOption name=".*">
- <synopsis>Dummy option used to ignore unused options in unused sections.</synopsis>
- </configOption>
- </configObject>
</configFile>
</configInfo>
***/
@@ -252,18 +247,11 @@
.category = "^general$",
};
-/*! \brief An aco_type structure to catch all the config secions that we don't care about */
-static struct aco_type ignore_option = {
- .type = ACO_GLOBAL,
- .name = "ignored",
- .category_match = ACO_WHITELIST,
- .category = "^.*$",
-};
-
/*! \brief The config file to be processed for the module. */
static struct aco_file cel_conf = {
- .filename = "cel.conf", /*!< The name of the config file */
- .types = ACO_TYPES(&general_option, &ignore_option), /*!< The mapping object types to be processed */
+ .filename = "cel.conf", /*!< The name of the config file */
+ .types = ACO_TYPES(&general_option), /*!< The mapping object types to be processed */
+ .skip_category = "(^manager$|^radius$)", /*!< Config sections used by existing modules. Do not add to this list. */
};
static int cel_pre_apply_config(void);
@@ -298,7 +286,6 @@
}
static struct aco_type *general_options[] = ACO_TYPES(&general_option);
-static struct aco_type *ignore_options[] = ACO_TYPES(&ignore_option);
/*!
* \brief Map of ast_cel_event_type to strings
@@ -1293,11 +1280,6 @@
bridge_primaries = NULL;
}
-static int ignore_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
-{
- return 0;
-}
-
int ast_cel_engine_init(void)
{
int ret = 0;
@@ -1317,7 +1299,6 @@
aco_option_register(&cel_cfg_info, "dateformat", ACO_EXACT, general_options, "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct cel_general_config, date_format));
aco_option_register_custom(&cel_cfg_info, "apps", ACO_EXACT, general_options, "", apps_handler, 0);
aco_option_register_custom(&cel_cfg_info, "events", ACO_EXACT, general_options, "", events_handler, 0);
- aco_option_register_custom(&cel_cfg_info, ".*", ACO_EXACT, ignore_options, "", ignore_handler, 0);
if (aco_process_config(&cel_cfg_info, 0)) {
return -1;
Modified: team/kmoore/bridge_construction-cel_channels/main/config_options.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/bridge_construction-cel_channels/main/config_options.c?view=diff&rev=389448&r1=389447&r2=389448
==============================================================================
--- team/kmoore/bridge_construction-cel_channels/main/config_options.c (original)
+++ team/kmoore/bridge_construction-cel_channels/main/config_options.c Tue May 21 16:39:06 2013
@@ -435,10 +435,21 @@
* We do not grab a reference to these objects, as the info already holds references to them. This
* pointer is just a convenience. Do not actually store it somewhere. */
void **field;
+ regex_t *regex_skip;
/* Skip preloaded categories if we aren't preloading */
if (!preload && is_preload(file, cat)) {
return 0;
+ }
+
+ /* Skip the category if we've been told to ignore it */
+ if (!ast_strlen_zero(file->skip_category)) {
+ regex_skip = build_regex(file->skip_category);
+ if (!regexec(regex_skip, cat, 0, NULL, 0)) {
+ ast_free(regex_skip);
+ return 0;
+ }
+ ast_free(regex_skip);
}
/* Find aco_type by category, if not found it is an error */
More information about the asterisk-commits
mailing list