diff options
author | Terry Wilson <twilson@digium.com> | 2012-06-28 01:12:06 +0000 |
---|---|---|
committer | Terry Wilson <twilson@digium.com> | 2012-06-28 01:12:06 +0000 |
commit | 1609fca6bb0bb85ac3c423aa7507bb489f7616e9 (patch) | |
tree | 1313e845503f782464e8b5a14289d6d02ddc470c /include | |
parent | 7d9e0158c3bc528e4e59b225604fb4f39ebd653e (diff) |
Add the ability to set flags via the config options api
Allows the setting of flags via the config options api.
For example, code like this:
#define OPT1 1 << 0
#define OPT2 1 << 1
#define OPT3 1 << 2
struct thing {
unsigned int flags;
};
and a config like this:
[blah]
opt1=yes
opt2=no
opt3=yes
Review: https://reviewboard.asterisk.org/r/2004/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369454 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include')
-rw-r--r-- | include/asterisk/config_options.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/asterisk/config_options.h b/include/asterisk/config_options.h index 1bbf27025..c65e5d07a 100644 --- a/include/asterisk/config_options.h +++ b/include/asterisk/config_options.h @@ -261,6 +261,26 @@ enum aco_option_type { */ OPT_BOOL_T, + /*! \brief Type for default option handler for bools (ast_true/ast_false) that are stored in a flag + * \note aco_option_register flags: + * non-zero : process via ast_true + * 0 : process via ast_false + * aco_option_register varargs: + * FLDSET macro with the field of type of unsigned int. + * The flag to set + * + * Example: + * {code} + * #define MY_TYPE_ISQUIET 1 << 4 + * 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); + * {endcode} + */ + + OPT_BOOLFLAG_T, + /*! \brief Type for default option handler for codec preferences/capabilities * \note aco_option_register flags: * non-zero : This is an "allow" style option |