25 #if defined(OPTIONAL_API) 69 #define USER_OPTIONAL_REF_CMP(ele, value) (ele->optional_ref == value) 70 #define OPTIONAL_API_SYMNAME_CMP(ele, value) (!strcmp(ele->symname, value)) 97 size_t size =
sizeof(*user) + strlen(module) + 1;
108 strcpy(user->
module, module);
138 api =
ast_calloc(1,
sizeof(*api) + strlen(symname) + 1);
146 strcpy(api->symname, symname);
199 ast_optional_fn
impl)
252 optional_api_user_destroy(user);
#define AST_VECTOR_FREE(vec)
Deallocates this vector.
AST_VECTOR(struct optional_api *)
Free an optional_api_user.
void ast_optional_api_provide(const char *symname, ast_optional_fn impl)
Asterisk main include file. File version handling, generic pbx functions.
Optional API function macros.
#define AST_VECTOR_REMOVE_CMP_UNORDERED(vec, value, cmp, cleanup)
Remove an element from a vector that matches the given comparison.
static struct optional_api_user * optional_api_user_create(ast_optional_fn *optional_ref, ast_optional_fn stub, const char *module)
Create an optional_api_user.
#define AST_VECTOR_ELEM_DEFAULT_CMP(elem, value)
Default comparator for AST_VECTOR_REMOVE_ELEM_UNORDERED()
A user of an optional API.
#define AST_VECTOR_APPEND(vec, elem)
Append an element to a vector, growing the vector if needed.
static struct optional_api * optional_api_create(const char *symname)
Create and link an optional_api.
static void optional_api_set_impl(struct optional_api *api, ast_optional_fn impl)
Sets the implementation function pointer for an api.
static void optional_api_destroy(struct optional_api *api)
Free an optional_api.
#define AST_VECTOR_ELEM_CLEANUP_NOOP(elem)
Vector element cleanup that does nothing.
void ast_optional_api_unprovide(const char *symname, ast_optional_fn impl)
#define USER_OPTIONAL_REF_CMP(ele, value)
struct ao2_container * users
void DO_CRASH_NORETURN ast_do_crash(void)
Force a crash if DO_CRASH is defined.
void ast_optional_api_use(const char *symname, ast_optional_fn *optional_ref, ast_optional_fn stub, const char *module)
static void optional_api_user_relink(struct optional_api_user *user, struct optional_api *api)
Re-links a given user against its associated api.
#define ast_calloc(num, len)
A wrapper for calloc()
void ast_optional_api_unuse(const char *symname, ast_optional_fn *optional_ref, const char *module)
Vector container support.
#define AST_VECTOR_GET_CMP(vec, value, cmp)
Get an element from a vector that matches the given comparison.
structure to hold users read from users.conf
ast_optional_fn * optional_ref
#define OPTIONAL_API_SYMNAME_CMP(ele, value)
static struct optional_api * get_api(const char *symname)
Gets (or creates) the optional_api for the given function.
#define AST_VECTOR_SIZE(vec)
Get the number of elements in a vector.
#define AST_VECTOR_CALLBACK_VOID(vec, callback,...)
Execute a callback on every element in a vector disregarding callback return.