From d416b15c52c470417de96569cc7b94930a6b6df3 Mon Sep 17 00:00:00 2001 From: Richard Mudgett Date: Thu, 27 Jun 2013 02:55:16 +0000 Subject: Add config framework non-empty string validation requirement option. Add config framework OPT_CHAR_ARRAY_T and OPT_STRINGFIELD_T non-empty requirement option. There are cases were you don't want a config option string to be empty. To require the option string to be non-empty, just set the aco_option_register() flags parameter to non-zero. * Updated some config framework enum aco_option_type comments. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393034 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- include/asterisk/config_options.h | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'include/asterisk') diff --git a/include/asterisk/config_options.h b/include/asterisk/config_options.h index b73b276e8..6b444466f 100644 --- a/include/asterisk/config_options.h +++ b/include/asterisk/config_options.h @@ -265,7 +265,7 @@ enum aco_option_type { * struct test_item { * int enabled; * }; - aco_option_register(&cfg_info, "enabled", ACO_EXACT, my_types, "no", OPT_BOOL_T, 1, FLDSET(struct test_item, enabled)); + * aco_option_register(&cfg_info, "enabled", ACO_EXACT, my_types, "no", OPT_BOOL_T, 1, FLDSET(struct test_item, enabled)); * {endcode} */ OPT_BOOL_T, @@ -284,13 +284,15 @@ enum aco_option_type { * struct test_item { * unsigned int flags; * }; - aco_option_register(&cfg_info, "quiet", ACO_EXACT, my_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct test_item, flags), MY_TYPE_ISQUIET); + * aco_option_register(&cfg_info, "quiet", ACO_EXACT, my_types, "no", OPT_BOOLFLAG_T, 1, FLDSET(struct test_item, flags), MY_TYPE_ISQUIET); * {endcode} */ - OPT_BOOLFLAG_T, - /*! \brief Type for default option handler for character arrays + /*! \brief Type for default option handler for character array strings + * \note aco_option_register flags: + * non-zero : String cannot be empty. + * 0 : String can be empty. * \note aco_option_register varargs: * CHARFLDSET macro with a field of type char[] * @@ -299,7 +301,7 @@ enum aco_option_type { * struct test_item { * char description[128]; * }; - * aco_option_register(&cfg_info, "description", ACO_EXACT, my_types, "none", OPT_CHAR_ARRAY_T, CHARFLDSET(struct test_item, description)); + * aco_option_register(&cfg_info, "description", ACO_EXACT, my_types, "none", OPT_CHAR_ARRAY_T, 0, CHARFLDSET(struct test_item, description)); * {endcode} */ OPT_CHAR_ARRAY_T, @@ -338,7 +340,7 @@ enum aco_option_type { * double dub; * }; * {code} - * aco_option_register(&cfg_info, "doubleopt", ACO_EXACT, my_types, "3", OPT_DOUBLE_T, FLDSET(struct test_item, dub)); + * aco_option_register(&cfg_info, "doubleopt", ACO_EXACT, my_types, "3", OPT_DOUBLE_T, 0, FLDSET(struct test_item, dub)); * {endcode} */ OPT_DOUBLE_T, @@ -393,7 +395,8 @@ enum aco_option_type { /*! \brief Type for default option handler for stringfields * \note aco_option_register flags: - * none + * non-zero : String cannot be empty. + * 0 : String can be empty. * aco_option_register varargs: * STRFLDSET macro with the field being the field created by AST_STRING_FIELD * -- cgit v1.2.3