mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
Merge "core: Add PARSE_TIMELEN support to ast_parse_arg and ACO."
This commit is contained in:
@@ -1086,6 +1086,11 @@ enum ast_parse_flags {
|
||||
PARSE_UINT16 = 0x0005,
|
||||
#endif
|
||||
|
||||
/* Returns an int processed by ast_app_parse_timelen.
|
||||
* The first argument is an enum ast_timelen value (required).
|
||||
*/
|
||||
PARSE_TIMELEN = 0x0006,
|
||||
|
||||
/* Returns a struct ast_sockaddr, with optional default value
|
||||
* (passed by reference) and port handling (accept, ignore,
|
||||
* require, forbid). The format is 'ipaddress[:port]'. IPv6 address
|
||||
@@ -1152,6 +1157,12 @@ enum ast_parse_flags {
|
||||
* returns 1, b unchanged
|
||||
* ast_parse_arg("12", PARSE_UINT32|PARSE_IN_RANGE|PARSE_RANGE_DEFAULTS, &a, 1, 10);
|
||||
* returns 1, a = 10
|
||||
* ast_parse_arg("223", PARSE_TIMELEN|PARSE_IN_RANGE, &a, TIMELEN_SECONDS, -1000, 1000);
|
||||
* returns 0, a = 1000
|
||||
* ast_parse_arg("223", PARSE_TIMELEN|PARSE_IN_RANGE, &a, TIMELEN_SECONDS, -1000, 250000);
|
||||
* returns 0, a = 223000
|
||||
* ast_parse_arg("223", PARSE_TIMELEN|PARSE_IN_RANGE|PARSE_DEFAULT, &a, TIMELEN_SECONDS, 9999, -1000, 250000);
|
||||
* returns 0, a = 9999
|
||||
* ast_parse_arg("www.foo.biz:44", PARSE_INADDR, &sa);
|
||||
* returns 0, sa contains address and port
|
||||
* ast_parse_arg("www.foo.biz", PARSE_INADDR|PARSE_PORT_REQUIRE, &sa);
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user