diff options
author | Terry Wilson <twilson@digium.com> | 2012-07-12 21:43:09 +0000 |
---|---|---|
committer | Terry Wilson <twilson@digium.com> | 2012-07-12 21:43:09 +0000 |
commit | a7dfafdc56bf018e0acacdf0692d7c1eefd43d8d (patch) | |
tree | 49d810aa6e44b6d560daee3f776df732a2ada8d6 /include/asterisk/config_options.h | |
parent | 9773d2351b692a1639e02a1b7025f06e2f7775b7 (diff) |
Handle deprecated (aliased) option names with the config options api
Add a simple way to register "deprecated" option names that alias to a
different "current" name.
Review: https://reviewboard.asterisk.org/r/2026/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370043 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include/asterisk/config_options.h')
-rw-r--r-- | include/asterisk/config_options.h | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/include/asterisk/config_options.h b/include/asterisk/config_options.h index c65e5d07a..182740e02 100644 --- a/include/asterisk/config_options.h +++ b/include/asterisk/config_options.h @@ -496,7 +496,8 @@ int __aco_option_register(struct aco_info *info, const char *name, enum aco_matc * \param opt_type The option type for default option type handling * \param flags \a type specific flags, stored in the option and available to the handler * - * \returns An option on success, NULL on failure + * \retval 0 Success + * \retval -1 Failure */ #define aco_option_register(info, name, matchtype, types, default_val, opt_type, flags, ...) \ __aco_option_register(info, name, matchtype, types, default_val, opt_type, NULL, flags, VA_NARGS(__VA_ARGS__), __VA_ARGS__); @@ -509,10 +510,22 @@ int __aco_option_register(struct aco_info *info, const char *name, enum aco_matc * \param handler The handler callback for the option * \param flags \a type specific flags, stored in the option and available to the handler * - * \returns An option on success, NULL on failure + * \retval 0 Success + * \retval -1 Failure + */ +#define aco_option_register_custom(info, name, matchtype, types, default_val, handler, flags) \ + __aco_option_register(info, name, matchtype, types, default_val, OPT_CUSTOM_T, handler, flags, 0); + +/*! \brief Register a deprecated (and aliased) config option + * \param info A pointer to the aco_info struct + * \param name The name of the deprecated option + * \param types An array of valid option types for matching categories to the correct struct type + * \param aliased_to The name of the option that this deprecated option matches to + * + * \retval 0 Success + * \retval -1 Failure */ -#define aco_option_register_custom(info, name, matchtype, type, default_val, handler, flags) \ - __aco_option_register(info, name, matchtype, type, default_val, OPT_CUSTOM_T, handler, flags, 0); +int aco_option_register_deprecated(struct aco_info *info, const char *name, struct aco_type **types, const char *aliased_to); /*! \note Everything below this point is to handle converting varargs * containing field names, to varargs containing a count of args, followed |