mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 20:20:07 +00:00
Update config framework/sorcery with types/options without documentation
There are times when a configuration option should not have documentation. 1. Some options are registered with a particular object merely as a warning to users. These options aren't even really 'deprecated' - which has its own separate API call - they are actually provided by a different configuration file. The options are merely registered so that the user gets a warning that a different configuration file provides the item. 2. Some object types - most notably some used by modules that use sorcery - are completely internal and should never be shown to the user. 3. Sorcery itself has several 'hidden' fields that should never be shown to a user. This patch updates the configuration framework and sorcery with additional API calls that allow a module to register types as internal and options as not requiring documentation. This bypasses the XML documentation checking. This patch also re-enables the strict XML documentation checking in trunk, as well as updates some documentation that was missing. Review: https://reviewboard.asterisk.org/r/2785/ (closes issue ASTERISK-22359) Reported by: Matt Jordan (closes issue ASTERISK-22112) Reported by: Rusty Newton git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397524 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -116,6 +116,7 @@ struct aco_type {
|
|||||||
aco_matchvalue_func matchfunc; /*!< A function for determing whether the option value matches (i.e. hassip= requires ast_true()) */
|
aco_matchvalue_func matchfunc; /*!< A function for determing whether the option value matches (i.e. hassip= requires ast_true()) */
|
||||||
enum aco_category_op category_match; /*!< Whether the following category regex is a whitelist or blacklist */
|
enum aco_category_op category_match; /*!< Whether the following category regex is a whitelist or blacklist */
|
||||||
size_t item_offset; /*!< The offset in the config snapshot for the global config or item config container */
|
size_t item_offset; /*!< The offset in the config snapshot for the global config or item config container */
|
||||||
|
unsigned int hidden; /*!< Type is for internal purposes only and it and all options should not be visible to users */
|
||||||
|
|
||||||
/* non-global callbacks */
|
/* non-global callbacks */
|
||||||
aco_type_item_alloc item_alloc; /*!< An allocation function for item associated with this type */
|
aco_type_item_alloc item_alloc; /*!< An allocation function for item associated with this type */
|
||||||
@@ -528,6 +529,7 @@ int aco_set_defaults(struct aco_type *type, const char *category, void *obj);
|
|||||||
* \param type The option type (only for default handlers)
|
* \param type The option type (only for default handlers)
|
||||||
* \param handler The handler function for the option (only for non-default types)
|
* \param handler The handler function for the option (only for non-default types)
|
||||||
* \param flags a type specific flags, stored in the option and available to the handler
|
* \param flags a type specific flags, stored in the option and available to the handler
|
||||||
|
* \param no_doc if non-zero, this option should not have documentation
|
||||||
* \param argc The number for variadic arguments
|
* \param argc The number for variadic arguments
|
||||||
* \param ... field offsets to store for default handlers
|
* \param ... field offsets to store for default handlers
|
||||||
*
|
*
|
||||||
@@ -535,7 +537,7 @@ int aco_set_defaults(struct aco_type *type, const char *category, void *obj);
|
|||||||
* \retval -1 failure
|
* \retval -1 failure
|
||||||
*/
|
*/
|
||||||
int __aco_option_register(struct aco_info *info, const char *name, enum aco_matchtype match_type, struct aco_type **types,
|
int __aco_option_register(struct aco_info *info, const char *name, enum aco_matchtype match_type, struct aco_type **types,
|
||||||
const char *default_val, enum aco_option_type type, aco_option_handler handler, unsigned int flags, size_t argc, ...);
|
const char *default_val, enum aco_option_type type, aco_option_handler handler, unsigned int flags, unsigned int no_doc, size_t argc, ...);
|
||||||
|
|
||||||
/*! \brief Register a config option
|
/*! \brief Register a config option
|
||||||
* \param info A pointer to the aco_info struct
|
* \param info A pointer to the aco_info struct
|
||||||
@@ -551,7 +553,7 @@ int __aco_option_register(struct aco_info *info, const char *name, enum aco_matc
|
|||||||
* \retval -1 Failure
|
* \retval -1 Failure
|
||||||
*/
|
*/
|
||||||
#define aco_option_register(info, name, matchtype, types, default_val, opt_type, flags, ...) \
|
#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__);
|
__aco_option_register(info, name, matchtype, types, default_val, opt_type, NULL, flags, 0, VA_NARGS(__VA_ARGS__), __VA_ARGS__);
|
||||||
|
|
||||||
/*! \brief Register a config option
|
/*! \brief Register a config option
|
||||||
* \param info A pointer to the aco_info struct
|
* \param info A pointer to the aco_info struct
|
||||||
@@ -566,7 +568,25 @@ int __aco_option_register(struct aco_info *info, const char *name, enum aco_matc
|
|||||||
* \retval -1 Failure
|
* \retval -1 Failure
|
||||||
*/
|
*/
|
||||||
#define aco_option_register_custom(info, name, matchtype, types, default_val, handler, flags) \
|
#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);
|
__aco_option_register(info, name, matchtype, types, default_val, OPT_CUSTOM_T, handler, flags, 0, 0);
|
||||||
|
|
||||||
|
/*! \brief Register a config option with no expected documentation
|
||||||
|
* \param info A pointer to the aco_info struct
|
||||||
|
* \param name The name of the option
|
||||||
|
* \param matchtype
|
||||||
|
* \param types An array of valid option types for matching categories to the correct struct type
|
||||||
|
* \param default_val The default value of the option in the same format as defined in a config file
|
||||||
|
* \param handler The handler callback for the option
|
||||||
|
* \param flags \a type specific flags, stored in the option and available to the handler
|
||||||
|
*
|
||||||
|
* \note This is used primarily with custom options that only have internal purposes
|
||||||
|
* and that should be ignored by the user.
|
||||||
|
*
|
||||||
|
* \retval 0 Success
|
||||||
|
* \retval -1 Failure
|
||||||
|
*/
|
||||||
|
#define aco_option_register_custom_nodoc(info, name, matchtype, types, default_val, handler, flags) \
|
||||||
|
__aco_option_register(info, name, matchtype, types, default_val, OPT_CUSTOM_T, handler, flags, 1, 0);
|
||||||
|
|
||||||
/*! \brief Register a deprecated (and aliased) config option
|
/*! \brief Register a deprecated (and aliased) config option
|
||||||
* \param info A pointer to the aco_info struct
|
* \param info A pointer to the aco_info struct
|
||||||
|
@@ -340,6 +340,24 @@ int __ast_sorcery_apply_default(struct ast_sorcery *sorcery, const char *type, c
|
|||||||
#define ast_sorcery_apply_default(sorcery, type, name, data) \
|
#define ast_sorcery_apply_default(sorcery, type, name, data) \
|
||||||
__ast_sorcery_apply_default((sorcery), (type), AST_MODULE, (name), (data))
|
__ast_sorcery_apply_default((sorcery), (type), AST_MODULE, (name), (data))
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Register an object type
|
||||||
|
*
|
||||||
|
* \param sorcery Pointer to a sorcery structure
|
||||||
|
* \param type Type of object
|
||||||
|
* \param hidden All objects of this type are internal and should not be manipulated by users
|
||||||
|
* \param alloc Required object allocation callback
|
||||||
|
* \param transform Optional transformation callback
|
||||||
|
* \param apply Optional object set apply callback
|
||||||
|
*
|
||||||
|
* \note In general, this function should not be used directly. One of the various
|
||||||
|
* macro'd versions should be used instead.
|
||||||
|
*
|
||||||
|
* \retval 0 success
|
||||||
|
* \retval -1 failure
|
||||||
|
*/
|
||||||
|
int __ast_sorcery_object_register(struct ast_sorcery *sorcery, const char *type, unsigned int hidden, aco_type_item_alloc alloc, sorcery_transform_handler transform, sorcery_apply_handler apply);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Register an object type
|
* \brief Register an object type
|
||||||
*
|
*
|
||||||
@@ -352,7 +370,23 @@ int __ast_sorcery_apply_default(struct ast_sorcery *sorcery, const char *type, c
|
|||||||
* \retval 0 success
|
* \retval 0 success
|
||||||
* \retval -1 failure
|
* \retval -1 failure
|
||||||
*/
|
*/
|
||||||
int ast_sorcery_object_register(struct ast_sorcery *sorcery, const char *type, aco_type_item_alloc alloc, sorcery_transform_handler transform, sorcery_apply_handler apply);
|
#define ast_sorcery_object_register(sorcery, type, alloc, transform, apply) \
|
||||||
|
__ast_sorcery_object_register((sorcery), (type), 0, (alloc), (transform), (apply))
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Register an internal, hidden object type
|
||||||
|
*
|
||||||
|
* \param sorcery Pointer to a sorcery structure
|
||||||
|
* \param type Type of object
|
||||||
|
* \param alloc Required object allocation callback
|
||||||
|
* \param transform Optional transformation callback
|
||||||
|
* \param apply Optional object set apply callback
|
||||||
|
*
|
||||||
|
* \retval 0 success
|
||||||
|
* \retval -1 failure
|
||||||
|
*/
|
||||||
|
#define ast_sorcery_internal_object_register(sorcery, type, alloc, transform, apply) \
|
||||||
|
__ast_sorcery_object_register((sorcery), (type), 1, (alloc), (transform), (apply))
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Set the copy handler for an object type
|
* \brief Set the copy handler for an object type
|
||||||
@@ -401,7 +435,8 @@ int ast_sorcery_object_fields_register(struct ast_sorcery *sorcery, const char *
|
|||||||
* \retval -1 failure
|
* \retval -1 failure
|
||||||
*/
|
*/
|
||||||
int __ast_sorcery_object_field_register(struct ast_sorcery *sorcery, const char *type, const char *name, const char *default_val, enum aco_option_type opt_type,
|
int __ast_sorcery_object_field_register(struct ast_sorcery *sorcery, const char *type, const char *name, const char *default_val, enum aco_option_type opt_type,
|
||||||
aco_option_handler config_handler, sorcery_field_handler sorcery_handler, unsigned int flags, size_t argc, ...);
|
aco_option_handler config_handler, sorcery_field_handler sorcery_handler, unsigned int flags, unsigned int no_doc,
|
||||||
|
size_t argc, ...);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Register a field within an object
|
* \brief Register a field within an object
|
||||||
@@ -417,7 +452,23 @@ int __ast_sorcery_object_field_register(struct ast_sorcery *sorcery, const char
|
|||||||
* \retval -1 failure
|
* \retval -1 failure
|
||||||
*/
|
*/
|
||||||
#define ast_sorcery_object_field_register(sorcery, type, name, default_val, opt_type, flags, ...) \
|
#define ast_sorcery_object_field_register(sorcery, type, name, default_val, opt_type, flags, ...) \
|
||||||
__ast_sorcery_object_field_register(sorcery, type, name, default_val, opt_type, NULL, NULL, flags, VA_NARGS(__VA_ARGS__), __VA_ARGS__)
|
__ast_sorcery_object_field_register(sorcery, type, name, default_val, opt_type, NULL, NULL, flags, 0, VA_NARGS(__VA_ARGS__), __VA_ARGS__)
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Register a field within an object without documentation
|
||||||
|
*
|
||||||
|
* \param sorcery Pointer to a sorcery structure
|
||||||
|
* \param type Type of object
|
||||||
|
* \param name Name of the field
|
||||||
|
* \param default_val Default value of the field
|
||||||
|
* \param opt_type Option type
|
||||||
|
* \param flags Option type specific flags
|
||||||
|
*
|
||||||
|
* \retval 0 success
|
||||||
|
* \retval -1 failure
|
||||||
|
*/
|
||||||
|
#define ast_sorcery_object_field_register_nodoc(sorcery, type, name, default_val, opt_type, flags, ...) \
|
||||||
|
__ast_sorcery_object_field_register(sorcery, type, name, default_val, opt_type, NULL, NULL, flags, 1, VA_NARGS(__VA_ARGS__), __VA_ARGS__)
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Register a field within an object with custom handlers
|
* \brief Register a field within an object with custom handlers
|
||||||
|
@@ -69,6 +69,7 @@ struct aco_option {
|
|||||||
enum aco_option_type type;
|
enum aco_option_type type;
|
||||||
aco_option_handler handler;
|
aco_option_handler handler;
|
||||||
unsigned int flags;
|
unsigned int flags;
|
||||||
|
unsigned int no_doc:1;
|
||||||
unsigned char deprecated:1;
|
unsigned char deprecated:1;
|
||||||
size_t argc;
|
size_t argc;
|
||||||
intptr_t args[0];
|
intptr_t args[0];
|
||||||
@@ -183,7 +184,7 @@ static int link_option_to_types(struct aco_info *info, struct aco_type **types,
|
|||||||
}
|
}
|
||||||
if (!ao2_link(type->internal->opts, opt)
|
if (!ao2_link(type->internal->opts, opt)
|
||||||
#ifdef AST_XML_DOCS
|
#ifdef AST_XML_DOCS
|
||||||
|| xmldoc_update_config_option(types, info->module, opt->name, type->name, opt->default_val, opt->match_type == ACO_REGEX, opt->type)
|
|| (!opt->no_doc && xmldoc_update_config_option(types, info->module, opt->name, type->name, opt->default_val, opt->match_type == ACO_REGEX, opt->type))
|
||||||
#endif /* AST_XML_DOCS */
|
#endif /* AST_XML_DOCS */
|
||||||
) {
|
) {
|
||||||
do {
|
do {
|
||||||
@@ -276,7 +277,8 @@ static struct ast_xml_doc_item *find_xmldoc_type(struct ast_xml_doc_item *config
|
|||||||
#endif /* AST_XML_DOCS */
|
#endif /* AST_XML_DOCS */
|
||||||
|
|
||||||
int __aco_option_register(struct aco_info *info, const char *name, enum aco_matchtype matchtype, struct aco_type **types,
|
int __aco_option_register(struct aco_info *info, const char *name, enum aco_matchtype matchtype, struct aco_type **types,
|
||||||
const char *default_val, enum aco_option_type kind, aco_option_handler handler, unsigned int flags, size_t argc, ...)
|
const char *default_val, enum aco_option_type kind, aco_option_handler handler, unsigned int flags,
|
||||||
|
unsigned int no_doc, size_t argc, ...)
|
||||||
{
|
{
|
||||||
struct aco_option *opt;
|
struct aco_option *opt;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
@@ -313,6 +315,7 @@ int __aco_option_register(struct aco_info *info, const char *name, enum aco_matc
|
|||||||
opt->handler = handler;
|
opt->handler = handler;
|
||||||
opt->flags = flags;
|
opt->flags = flags;
|
||||||
opt->argc = argc;
|
opt->argc = argc;
|
||||||
|
opt->no_doc = no_doc;
|
||||||
|
|
||||||
if (!opt->handler && !(opt->handler = ast_config_option_default_handler(opt->type))) {
|
if (!opt->handler && !(opt->handler = ast_config_option_default_handler(opt->type))) {
|
||||||
/* This should never happen */
|
/* This should never happen */
|
||||||
@@ -765,7 +768,7 @@ int aco_info_init(struct aco_info *info)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
#ifdef AST_XML_DOCS
|
#ifdef AST_XML_DOCS
|
||||||
if (xmldoc_update_config_type(info->module, type->name, type->category, type->matchfield, type->matchvalue, type->category_match == ACO_WHITELIST)) {
|
if (!type->hidden && xmldoc_update_config_type(info->module, type->name, type->category, type->matchfield, type->matchvalue, type->category_match == ACO_WHITELIST)) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
#endif /* AST_XML_DOCS */
|
#endif /* AST_XML_DOCS */
|
||||||
@@ -917,7 +920,7 @@ static char *complete_config_option(const char *module, const char *option, cons
|
|||||||
/* Define as 0 if we want to allow configurations to be registered without
|
/* Define as 0 if we want to allow configurations to be registered without
|
||||||
* documentation
|
* documentation
|
||||||
*/
|
*/
|
||||||
#define XMLDOC_STRICT 0
|
#define XMLDOC_STRICT 1
|
||||||
|
|
||||||
/*! \internal
|
/*! \internal
|
||||||
* \brief Update the XML documentation for a config type based on its registration
|
* \brief Update the XML documentation for a config type based on its registration
|
||||||
|
@@ -1654,39 +1654,39 @@ static int load_config(void)
|
|||||||
aco_option_register_custom(&cfg_info, "pickupfailsound", ACO_EXACT, global_options,
|
aco_option_register_custom(&cfg_info, "pickupfailsound", ACO_EXACT, global_options,
|
||||||
DEFAULT_PICKUPFAILSOUND, pickup_handler, 0);
|
DEFAULT_PICKUPFAILSOUND, pickup_handler, 0);
|
||||||
|
|
||||||
aco_option_register_custom(&cfg_info, "context", ACO_EXACT, global_options,
|
aco_option_register_custom_nodoc(&cfg_info, "context", ACO_EXACT, global_options,
|
||||||
"", unsupported_handler, 0);
|
"", unsupported_handler, 0);
|
||||||
aco_option_register_custom(&cfg_info, "parkext", ACO_EXACT, global_options,
|
aco_option_register_custom_nodoc(&cfg_info, "parkext", ACO_EXACT, global_options,
|
||||||
"", unsupported_handler, 0);
|
"", unsupported_handler, 0);
|
||||||
aco_option_register_custom(&cfg_info, "parkext_exclusive", ACO_EXACT, global_options,
|
aco_option_register_custom_nodoc(&cfg_info, "parkext_exclusive", ACO_EXACT, global_options,
|
||||||
"", unsupported_handler, 0);
|
"", unsupported_handler, 0);
|
||||||
aco_option_register_custom(&cfg_info, "parkinghints", ACO_EXACT, global_options,
|
aco_option_register_custom_nodoc(&cfg_info, "parkinghints", ACO_EXACT, global_options,
|
||||||
"", unsupported_handler, 0);
|
"", unsupported_handler, 0);
|
||||||
aco_option_register_custom(&cfg_info, "parkedmusicclass", ACO_EXACT, global_options,
|
aco_option_register_custom_nodoc(&cfg_info, "parkedmusicclass", ACO_EXACT, global_options,
|
||||||
"", unsupported_handler, 0);
|
"", unsupported_handler, 0);
|
||||||
aco_option_register_custom(&cfg_info, "parkingtime", ACO_EXACT, global_options,
|
aco_option_register_custom_nodoc(&cfg_info, "parkingtime", ACO_EXACT, global_options,
|
||||||
"", unsupported_handler, 0);
|
"", unsupported_handler, 0);
|
||||||
aco_option_register_custom(&cfg_info, "parkpos", ACO_EXACT, global_options,
|
aco_option_register_custom_nodoc(&cfg_info, "parkpos", ACO_EXACT, global_options,
|
||||||
"", unsupported_handler, 0);
|
"", unsupported_handler, 0);
|
||||||
aco_option_register_custom(&cfg_info, "findslot", ACO_EXACT, global_options,
|
aco_option_register_custom_nodoc(&cfg_info, "findslot", ACO_EXACT, global_options,
|
||||||
"", unsupported_handler, 0);
|
"", unsupported_handler, 0);
|
||||||
aco_option_register_custom(&cfg_info, "parkedcalltransfers", ACO_EXACT, global_options,
|
aco_option_register_custom_nodoc(&cfg_info, "parkedcalltransfers", ACO_EXACT, global_options,
|
||||||
"", unsupported_handler, 0);
|
"", unsupported_handler, 0);
|
||||||
aco_option_register_custom(&cfg_info, "parkedcallreparking", ACO_EXACT, global_options,
|
aco_option_register_custom_nodoc(&cfg_info, "parkedcallreparking", ACO_EXACT, global_options,
|
||||||
"", unsupported_handler, 0);
|
"", unsupported_handler, 0);
|
||||||
aco_option_register_custom(&cfg_info, "parkedcallhangup", ACO_EXACT, global_options,
|
aco_option_register_custom_nodoc(&cfg_info, "parkedcallhangup", ACO_EXACT, global_options,
|
||||||
"", unsupported_handler, 0);
|
"", unsupported_handler, 0);
|
||||||
aco_option_register_custom(&cfg_info, "parkedcallrecording", ACO_EXACT, global_options,
|
aco_option_register_custom_nodoc(&cfg_info, "parkedcallrecording", ACO_EXACT, global_options,
|
||||||
"", unsupported_handler, 0);
|
"", unsupported_handler, 0);
|
||||||
aco_option_register_custom(&cfg_info, "comebackcontext", ACO_EXACT, global_options,
|
aco_option_register_custom_nodoc(&cfg_info, "comebackcontext", ACO_EXACT, global_options,
|
||||||
"", unsupported_handler, 0);
|
"", unsupported_handler, 0);
|
||||||
aco_option_register_custom(&cfg_info, "comebacktoorigin", ACO_EXACT, global_options,
|
aco_option_register_custom_nodoc(&cfg_info, "comebacktoorigin", ACO_EXACT, global_options,
|
||||||
"", unsupported_handler, 0);
|
"", unsupported_handler, 0);
|
||||||
aco_option_register_custom(&cfg_info, "comebackdialtime", ACO_EXACT, global_options,
|
aco_option_register_custom_nodoc(&cfg_info, "comebackdialtime", ACO_EXACT, global_options,
|
||||||
"", unsupported_handler, 0);
|
"", unsupported_handler, 0);
|
||||||
aco_option_register_custom(&cfg_info, "parkeddynamic", ACO_EXACT, global_options,
|
aco_option_register_custom_nodoc(&cfg_info, "parkeddynamic", ACO_EXACT, global_options,
|
||||||
"", unsupported_handler, 0);
|
"", unsupported_handler, 0);
|
||||||
aco_option_register_custom(&cfg_info, "adsipark", ACO_EXACT, global_options,
|
aco_option_register_custom_nodoc(&cfg_info, "adsipark", ACO_EXACT, global_options,
|
||||||
"", unsupported_handler, 0);
|
"", unsupported_handler, 0);
|
||||||
|
|
||||||
aco_option_register_custom(&cfg_info, "blindxfer", ACO_EXACT, featuremap_options,
|
aco_option_register_custom(&cfg_info, "blindxfer", ACO_EXACT, featuremap_options,
|
||||||
|
@@ -575,7 +575,7 @@ static int sorcery_extended_fields_handler(const void *obj, struct ast_variable
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ast_sorcery_object_register(struct ast_sorcery *sorcery, const char *type, aco_type_item_alloc alloc, sorcery_transform_handler transform, sorcery_apply_handler apply)
|
int __ast_sorcery_object_register(struct ast_sorcery *sorcery, const char *type, unsigned int hidden, aco_type_item_alloc alloc, sorcery_transform_handler transform, sorcery_apply_handler apply)
|
||||||
{
|
{
|
||||||
RAII_VAR(struct ast_sorcery_object_type *, object_type, ao2_find(sorcery->types, type, OBJ_KEY), ao2_cleanup);
|
RAII_VAR(struct ast_sorcery_object_type *, object_type, ao2_find(sorcery->types, type, OBJ_KEY), ao2_cleanup);
|
||||||
|
|
||||||
@@ -587,6 +587,7 @@ int ast_sorcery_object_register(struct ast_sorcery *sorcery, const char *type, a
|
|||||||
object_type->type.type = ACO_ITEM;
|
object_type->type.type = ACO_ITEM;
|
||||||
object_type->type.category = ".?";
|
object_type->type.category = ".?";
|
||||||
object_type->type.item_alloc = alloc;
|
object_type->type.item_alloc = alloc;
|
||||||
|
object_type->type.hidden = hidden;
|
||||||
|
|
||||||
object_type->transform = transform;
|
object_type->transform = transform;
|
||||||
object_type->apply = apply;
|
object_type->apply = apply;
|
||||||
@@ -639,13 +640,13 @@ int ast_sorcery_object_fields_register(struct ast_sorcery *sorcery, const char *
|
|||||||
object_field->multiple_handler = sorcery_handler;
|
object_field->multiple_handler = sorcery_handler;
|
||||||
|
|
||||||
ao2_link(object_type->fields, object_field);
|
ao2_link(object_type->fields, object_field);
|
||||||
__aco_option_register(object_type->info, regex, ACO_REGEX, object_type->file->types, "", OPT_CUSTOM_T, config_handler, 0, 0);
|
__aco_option_register(object_type->info, regex, ACO_REGEX, object_type->file->types, "", OPT_CUSTOM_T, config_handler, 0, 1, 0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int __ast_sorcery_object_field_register(struct ast_sorcery *sorcery, const char *type, const char *name, const char *default_val, enum aco_option_type opt_type,
|
int __ast_sorcery_object_field_register(struct ast_sorcery *sorcery, const char *type, const char *name, const char *default_val, enum aco_option_type opt_type,
|
||||||
aco_option_handler config_handler, sorcery_field_handler sorcery_handler, unsigned int flags, size_t argc, ...)
|
aco_option_handler config_handler, sorcery_field_handler sorcery_handler, unsigned int flags, unsigned int no_doc, size_t argc, ...)
|
||||||
{
|
{
|
||||||
RAII_VAR(struct ast_sorcery_object_type *, object_type, ao2_find(sorcery->types, type, OBJ_KEY), ao2_cleanup);
|
RAII_VAR(struct ast_sorcery_object_type *, object_type, ao2_find(sorcery->types, type, OBJ_KEY), ao2_cleanup);
|
||||||
RAII_VAR(struct ast_sorcery_object_field *, object_field, NULL, ao2_cleanup);
|
RAII_VAR(struct ast_sorcery_object_field *, object_field, NULL, ao2_cleanup);
|
||||||
@@ -677,15 +678,15 @@ int __ast_sorcery_object_field_register(struct ast_sorcery *sorcery, const char
|
|||||||
|
|
||||||
/* TODO: Improve this hack */
|
/* TODO: Improve this hack */
|
||||||
if (!argc) {
|
if (!argc) {
|
||||||
__aco_option_register(object_type->info, name, ACO_EXACT, object_type->file->types, default_val, opt_type, config_handler, flags, argc);
|
__aco_option_register(object_type->info, name, ACO_EXACT, object_type->file->types, default_val, opt_type, config_handler, flags, no_doc, argc);
|
||||||
} else if (argc == 1) {
|
} else if (argc == 1) {
|
||||||
__aco_option_register(object_type->info, name, ACO_EXACT, object_type->file->types, default_val, opt_type, config_handler, flags, argc,
|
__aco_option_register(object_type->info, name, ACO_EXACT, object_type->file->types, default_val, opt_type, config_handler, flags, no_doc, argc,
|
||||||
object_field->args[0]);
|
object_field->args[0]);
|
||||||
} else if (argc == 2) {
|
} else if (argc == 2) {
|
||||||
__aco_option_register(object_type->info, name, ACO_EXACT, object_type->file->types, default_val, opt_type, config_handler, flags, argc,
|
__aco_option_register(object_type->info, name, ACO_EXACT, object_type->file->types, default_val, opt_type, config_handler, flags, no_doc, argc,
|
||||||
object_field->args[0], object_field->args[1]);
|
object_field->args[0], object_field->args[1]);
|
||||||
} else if (argc == 3) {
|
} else if (argc == 3) {
|
||||||
__aco_option_register(object_type->info, name, ACO_EXACT, object_type->file->types, default_val, opt_type, config_handler, flags, argc,
|
__aco_option_register(object_type->info, name, ACO_EXACT, object_type->file->types, default_val, opt_type, config_handler, flags, no_doc, argc,
|
||||||
object_field->args[0], object_field->args[1], object_field->args[2]);
|
object_field->args[0], object_field->args[1], object_field->args[2]);
|
||||||
} else {
|
} else {
|
||||||
ast_assert(0); /* The hack... she does us no good for this */
|
ast_assert(0); /* The hack... she does us no good for this */
|
||||||
|
@@ -256,6 +256,10 @@
|
|||||||
<configOption name="rtp_symmetric" default="no">
|
<configOption name="rtp_symmetric" default="no">
|
||||||
<synopsis>Enforce that RTP must be symmetric</synopsis>
|
<synopsis>Enforce that RTP must be symmetric</synopsis>
|
||||||
</configOption>
|
</configOption>
|
||||||
|
<configOption name="send_diversion" default="yes">
|
||||||
|
<synopsis>Send the Diversion header, conveying the diversion
|
||||||
|
information to the called user agent</synopsis>
|
||||||
|
</configOption>
|
||||||
<configOption name="send_pai" default="no">
|
<configOption name="send_pai" default="no">
|
||||||
<synopsis>Send the P-Asserted-Identity header</synopsis>
|
<synopsis>Send the P-Asserted-Identity header</synopsis>
|
||||||
</configOption>
|
</configOption>
|
||||||
@@ -670,15 +674,6 @@
|
|||||||
<synopsis>Username to use for account</synopsis>
|
<synopsis>Username to use for account</synopsis>
|
||||||
</configOption>
|
</configOption>
|
||||||
</configObject>
|
</configObject>
|
||||||
<configObject name="nat_hook">
|
|
||||||
<synopsis>XXX This exists only to prevent XML documentation errors.</synopsis>
|
|
||||||
<configOption name="external_media_address">
|
|
||||||
<synopsis>I should be undocumented or hidden</synopsis>
|
|
||||||
</configOption>
|
|
||||||
<configOption name="method">
|
|
||||||
<synopsis>I should be undocumented or hidden</synopsis>
|
|
||||||
</configOption>
|
|
||||||
</configObject>
|
|
||||||
<configObject name="domain_alias">
|
<configObject name="domain_alias">
|
||||||
<synopsis>Domain Alias</synopsis>
|
<synopsis>Domain Alias</synopsis>
|
||||||
<description><para>
|
<description><para>
|
||||||
@@ -769,6 +764,8 @@
|
|||||||
<enum name="udp" />
|
<enum name="udp" />
|
||||||
<enum name="tcp" />
|
<enum name="tcp" />
|
||||||
<enum name="tls" />
|
<enum name="tls" />
|
||||||
|
<enum name="ws" />
|
||||||
|
<enum name="wss" />
|
||||||
</enumlist>
|
</enumlist>
|
||||||
</description>
|
</description>
|
||||||
</configOption>
|
</configOption>
|
||||||
@@ -784,6 +781,24 @@
|
|||||||
<configOption name="verify_server" default="false">
|
<configOption name="verify_server" default="false">
|
||||||
<synopsis>Require verification of server certificate (TLS ONLY)</synopsis>
|
<synopsis>Require verification of server certificate (TLS ONLY)</synopsis>
|
||||||
</configOption>
|
</configOption>
|
||||||
|
<configOption name="tos" default="false">
|
||||||
|
<synopsis>Enable TOS for the signalling sent over this transport</synopsis>
|
||||||
|
<description>
|
||||||
|
<para>See <literal>https://wiki.asterisk.org/wiki/display/AST/IP+Quality+of+Service</literal>
|
||||||
|
for more information on this parameter.</para>
|
||||||
|
<note><para>This option does not apply to the <replaceable>ws</replaceable>
|
||||||
|
or the <replaceable>wss</replaceable> protocols.</para></note>
|
||||||
|
</description>
|
||||||
|
</configOption>
|
||||||
|
<configOption name="cos" default="false">
|
||||||
|
<synopsis>Enable COS for the signalling sent over this transport</synopsis>
|
||||||
|
<description>
|
||||||
|
<para>See <literal>https://wiki.asterisk.org/wiki/display/AST/IP+Quality+of+Service</literal>
|
||||||
|
for more information on this parameter.</para>
|
||||||
|
<note><para>This option does not apply to the <replaceable>ws</replaceable>
|
||||||
|
or the <replaceable>wss</replaceable> protocols.</para></note>
|
||||||
|
</description>
|
||||||
|
</configOption>
|
||||||
</configObject>
|
</configObject>
|
||||||
<configObject name="contact">
|
<configObject name="contact">
|
||||||
<synopsis>A way of creating an aliased name to a SIP URI</synopsis>
|
<synopsis>A way of creating an aliased name to a SIP URI</synopsis>
|
||||||
@@ -812,28 +827,6 @@
|
|||||||
</para></description>
|
</para></description>
|
||||||
</configOption>
|
</configOption>
|
||||||
</configObject>
|
</configObject>
|
||||||
<configObject name="contact_status">
|
|
||||||
<synopsis>Status for a contact</synopsis>
|
|
||||||
<description><para>
|
|
||||||
The contact status keeps track of whether or not a contact is reachable
|
|
||||||
and how long it took to qualify the contact (round trip time).
|
|
||||||
</para></description>
|
|
||||||
<configOption name="status">
|
|
||||||
<synopsis>A contact's status</synopsis>
|
|
||||||
<description>
|
|
||||||
<enumlist>
|
|
||||||
<enum name="AVAILABLE" />
|
|
||||||
<enum name="UNAVAILABLE" />
|
|
||||||
</enumlist>
|
|
||||||
</description>
|
|
||||||
</configOption>
|
|
||||||
<configOption name="rtt">
|
|
||||||
<synopsis>Round trip time</synopsis>
|
|
||||||
<description><para>
|
|
||||||
The time, in microseconds, it took to qualify the contact.
|
|
||||||
</para></description>
|
|
||||||
</configOption>
|
|
||||||
</configObject>
|
|
||||||
<configObject name="aor">
|
<configObject name="aor">
|
||||||
<synopsis>The configuration for a location of an endpoint</synopsis>
|
<synopsis>The configuration for a location of an endpoint</synopsis>
|
||||||
<description><para>
|
<description><para>
|
||||||
@@ -984,12 +977,12 @@
|
|||||||
<configOption name="maxforwards" default="70">
|
<configOption name="maxforwards" default="70">
|
||||||
<synopsis>Value used in Max-Forwards header for SIP requests.</synopsis>
|
<synopsis>Value used in Max-Forwards header for SIP requests.</synopsis>
|
||||||
</configOption>
|
</configOption>
|
||||||
<configOption name="useragent" default="Asterisk <Asterisk Version>">
|
|
||||||
<synopsis>Value used in User-Agent header for SIP requests and Server header for SIP responses.</synopsis>
|
|
||||||
</configOption>
|
|
||||||
<configOption name="type">
|
<configOption name="type">
|
||||||
<synopsis>Must be of type 'global'.</synopsis>
|
<synopsis>Must be of type 'global'.</synopsis>
|
||||||
</configOption>
|
</configOption>
|
||||||
|
<configOption name="useragent" default="Asterisk <Asterisk Version>">
|
||||||
|
<synopsis>Value used in User-Agent header for SIP requests and Server header for SIP responses.</synopsis>
|
||||||
|
</configOption>
|
||||||
</configObject>
|
</configObject>
|
||||||
</configFile>
|
</configFile>
|
||||||
</configInfo>
|
</configInfo>
|
||||||
|
@@ -628,7 +628,7 @@ int ast_res_pjsip_initialize_configuration(void)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ast_sorcery_object_register(sip_sorcery, "nat_hook", sip_nat_hook_alloc, NULL, NULL);
|
ast_sorcery_internal_object_register(sip_sorcery, "nat_hook", sip_nat_hook_alloc, NULL, NULL);
|
||||||
|
|
||||||
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "type", "", OPT_NOOP_T, 0, 0);
|
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "type", "", OPT_NOOP_T, 0, 0);
|
||||||
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "context", "default", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, context));
|
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "context", "default", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, context));
|
||||||
@@ -696,7 +696,6 @@ int ast_res_pjsip_initialize_configuration(void)
|
|||||||
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "cos_video", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, media.cos_video));
|
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "cos_video", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, media.cos_video));
|
||||||
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "allowsubscribe", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, subscription.allow));
|
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "allowsubscribe", "yes", OPT_BOOL_T, 1, FLDSET(struct ast_sip_endpoint, subscription.allow));
|
||||||
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "subminexpiry", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, subscription.minexpiry));
|
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "subminexpiry", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, subscription.minexpiry));
|
||||||
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "subminexpirey", "0", OPT_UINT_T, 0, FLDSET(struct ast_sip_endpoint, subscription.minexpiry));
|
|
||||||
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "fromuser", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, fromuser));
|
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "fromuser", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, fromuser));
|
||||||
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "fromdomain", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, fromdomain));
|
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "fromdomain", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, fromdomain));
|
||||||
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "mwifromuser", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, subscription.mwi.fromuser));
|
ast_sorcery_object_field_register(sip_sorcery, "endpoint", "mwifromuser", "", OPT_STRINGFIELD_T, 0, STRFLDSET(struct ast_sip_endpoint, subscription.mwi.fromuser));
|
||||||
|
@@ -734,15 +734,15 @@ int ast_sip_initialize_sorcery_qualify(struct ast_sorcery *sorcery)
|
|||||||
/* initialize sorcery ast_sip_contact_status resource */
|
/* initialize sorcery ast_sip_contact_status resource */
|
||||||
ast_sorcery_apply_default(sorcery, CONTACT_STATUS, "memory", NULL);
|
ast_sorcery_apply_default(sorcery, CONTACT_STATUS, "memory", NULL);
|
||||||
|
|
||||||
if (ast_sorcery_object_register(sorcery, CONTACT_STATUS,
|
if (ast_sorcery_internal_object_register(sorcery, CONTACT_STATUS,
|
||||||
contact_status_alloc, NULL, NULL)) {
|
contact_status_alloc, NULL, NULL)) {
|
||||||
ast_log(LOG_ERROR, "Unable to register ast_sip_contact_status in sorcery\n");
|
ast_log(LOG_ERROR, "Unable to register ast_sip_contact_status in sorcery\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ast_sorcery_object_field_register(sorcery, CONTACT_STATUS, "rtt", "0", OPT_UINT_T,
|
ast_sorcery_object_field_register_nodoc(sorcery, CONTACT_STATUS, "rtt", "0", OPT_UINT_T,
|
||||||
1, FLDSET(struct ast_sip_contact_status, status));
|
1, FLDSET(struct ast_sip_contact_status, status));
|
||||||
ast_sorcery_object_field_register(sorcery, CONTACT_STATUS, "rtt", "0", OPT_UINT_T,
|
ast_sorcery_object_field_register_nodoc(sorcery, CONTACT_STATUS, "rtt", "0", OPT_UINT_T,
|
||||||
1, FLDSET(struct ast_sip_contact_status, rtt));
|
1, FLDSET(struct ast_sip_contact_status, rtt));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user