summaryrefslogtreecommitdiff
path: root/include/asterisk/config_options.h
diff options
context:
space:
mode:
authorCorey Farrell <git@cfware.com>2017-07-10 15:04:58 -0400
committerCorey Farrell <git@cfware.com>2017-07-13 11:44:14 -0400
commit78a50b034368d3a21f81dfce0fc740021092d7f1 (patch)
tree56bf02121d7a13e674b39b68081325a0a46fd0df /include/asterisk/config_options.h
parentb0e184f0a7e70dc916c0bc982128934cd1fe7076 (diff)
core: Add PARSE_TIMELEN support to ast_parse_arg and ACO.
This adds support for parsing timelen values from config files. This includes support for all flags which apply to PARSE_INT32. Support for this parser is added to ACO via the OPT_TIMELEN_T option type. Fixes an issue where extra characters provided to ast_app_parse_timelen were ignored, they now cause an error. Testing is included. ASTERISK-27117 #close Change-Id: I6b333feca7e3f83b4ef5bf2636fc0fd613742554
Diffstat (limited to 'include/asterisk/config_options.h')
-rw-r--r--include/asterisk/config_options.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/asterisk/config_options.h b/include/asterisk/config_options.h
index f2a457eb5..f4c3db188 100644
--- a/include/asterisk/config_options.h
+++ b/include/asterisk/config_options.h
@@ -468,6 +468,30 @@ enum aco_option_type {
*/
OPT_YESNO_T,
+ /*! \brief Type for default option handler for time length signed integers
+ *
+ * \note aco_option_register flags:
+ * See flags available for use with the PARSE_TIMELEN type for the ast_parse_arg function
+ * aco_option_register varargs:
+ * FLDSET macro with the field of type int
+ * The remaining varargs for should be arguments compatible with the varargs for the
+ * ast_parse_arg function with the PARSE_TIMELEN type and the flags passed in the
+ * aco_option_register flags parameter.
+ *
+ * \note In most situations, it is preferable to not pass the PARSE_DEFAULT flag. If a config
+ * contains an invalid value, it is better to let the config loading fail with warnings so that
+ * the problem is fixed by the administrator.
+ *
+ * Example:
+ * struct test_item {
+ * int timelen;
+ * };
+ * {code}
+ * aco_option_register(&cfg_info, "timelen", ACO_EXACT, my_types, "3", OPT_TIMELEN_T, PARSE_IN_RANGE, FLDSET(struct test_item, intopt), TIMELEN_MILLISECONDS, -10, 10);
+ * {endcode}
+ */
+ OPT_TIMELEN_T,
+
};
/*! \brief A callback function for handling a particular option