summaryrefslogtreecommitdiff
path: root/include/asterisk/config.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asterisk/config.h')
-rw-r--r--include/asterisk/config.h43
1 files changed, 22 insertions, 21 deletions
diff --git a/include/asterisk/config.h b/include/asterisk/config.h
index 86c2bb5dd..5e71d80b1 100644
--- a/include/asterisk/config.h
+++ b/include/asterisk/config.h
@@ -644,8 +644,9 @@ enum ast_parse_flags {
* the range (inclusive). An error is returned if the value
* is outside or inside the range, respectively.
*/
- PARSE_IN_RANGE = 0x0020, /* accept values inside a range */
- PARSE_OUT_RANGE = 0x0040, /* accept values outside a range */
+ PARSE_IN_RANGE = 0x0020, /* accept values inside a range */
+ PARSE_OUT_RANGE = 0x0040, /* accept values outside a range */
+ PARSE_RANGE_DEFAULTS = 0x0080, /* default to range min/max on range error */
/* Port handling, for ast_sockaddr. accept/ignore/require/forbid
* port number after the hostname or address.
@@ -661,32 +662,32 @@ enum ast_parse_flags {
*
* \param arg the string to parse. It is not modified.
* \param flags combination of ast_parse_flags to specify the
- * return type and additional checks.
+ * return type and additional checks.
* \param result pointer to the result. NULL is valid here, and can
- * be used to perform only the validity checks.
+ * be used to perform only the validity checks.
* \param ... extra arguments are required according to flags.
*
* \retval 0 in case of success, != 0 otherwise.
* \retval result returns the parsed value in case of success,
- * the default value in case of error, or it is left unchanged
- * in case of error and no default specified. Note that in certain
- * cases (e.g. sockaddr_in, with multi-field return values) some
- * of the fields in result may be changed even if an error occurs.
+ * the default value in case of error, or it is left unchanged
+ * in case of error and no default specified. Note that in certain
+ * cases (e.g. sockaddr_in, with multi-field return values) some
+ * of the fields in result may be changed even if an error occurs.
*
* \details
* Examples of use:
- * ast_parse_arg("223", PARSE_INT32|PARSE_IN_RANGE,
- * &a, -1000, 1000);
- * returns 0, a = 223
- * ast_parse_arg("22345", PARSE_INT32|PARSE_IN_RANGE|PARSE_DEFAULT,
- * &a, 9999, 10, 100);
- * returns 1, a = 9999
- * ast_parse_arg("22345ssf", PARSE_UINT32|PARSE_IN_RANGE, &b, 10, 100);
- * returns 1, b unchanged
- * 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);
- * returns 1 because port is missing, sa contains address
+ * ast_parse_arg("223", PARSE_INT32|PARSE_IN_RANGE, &a, -1000, 1000);
+ * returns 0, a = 223
+ * ast_parse_arg("22345", PARSE_INT32|PARSE_IN_RANGE|PARSE_DEFAULT, &a, 9999, 10, 100);
+ * returns 1, a = 9999
+ * ast_parse_arg("22345ssf", PARSE_UINT32|PARSE_IN_RANGE, &b, 10, 100);
+ * 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("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);
+ * returns 1 because port is missing, sa contains address
*/
int ast_parse_arg(const char *arg, enum ast_parse_flags flags,
void *result, ...);
@@ -696,7 +697,7 @@ int ast_parse_arg(const char *arg, enum ast_parse_flags flags,
* string in a switch() statement, yet we need a similar behaviour, with many
* branches and a break on a matching one.
* The following somehow simplifies the job: we create a block using
- * the CV_START and CV_END macros, and then within the block we can run
+ * the CV_START and CV_END macros, and then within the block we can run
* actions such as "if (condition) { body; break; }"
* Additional macros are present to run simple functions (e.g. ast_copy_string)
* or to pass arguments to ast_parse_arg()