Asterisk - The Open Source Telephony Project
21.4.1
|
Config framework stuffz for ARI. More...
#include "asterisk.h"
#include "asterisk/config_options.h"
#include "asterisk/http_websocket.h"
#include "asterisk/app.h"
#include "asterisk/channel.h"
#include "internal.h"
Go to the source code of this file.
Macros | |
#define | CONF_FILENAME "ari.conf" |
#define | MAX_VARS 128 |
Functions | |
static | AO2_GLOBAL_OBJ_STATIC (confs) |
Locking container for safe configuration access. | |
void | ast_ari_config_destroy (void) |
Destroy the ARI configuration. | |
struct ast_ari_conf * | ast_ari_config_get (void) |
Get the current ARI configuration. More... | |
int | ast_ari_config_init (void) |
Initialize the ARI configuration. | |
int | ast_ari_config_reload (void) |
Reload the ARI configuration. | |
struct ast_ari_conf_user * | ast_ari_config_validate_user (const char *username, const char *password) |
Validated a user's credentials. More... | |
static int | channelvars_handler (const struct aco_option *opt, struct ast_variable *var, void *obj) |
static void * | conf_alloc (void) |
Allocate an ast_ari_conf for config parsing. | |
static void | conf_destructor (void *obj) |
ast_ari_conf destructor. | |
static void | conf_general_dtor (void *obj) |
CONFIG_INFO_STANDARD (cfg_info, confs, conf_alloc,.files=ACO_FILES(&conf_file)) | |
static int | encoding_format_handler (const struct aco_option *opt, struct ast_variable *var, void *obj) |
Encoding format handler converts from boolean to enum. | |
static int | password_format_handler (const struct aco_option *opt, struct ast_variable *var, void *obj) |
Parses the ast_ari_password_format enum from a config file. | |
static int | process_config (int reload) |
Load (or reload) configuration. | |
static void * | user_alloc (const char *cat) |
Allocate an ast_ari_conf_user for config parsing. | |
static void | user_dtor (void *obj) |
Destructor for ast_ari_conf_user. | |
static void * | user_find (struct ao2_container *tmp_container, const char *cat) |
aco_type item_find function | |
static int | user_sort_cmp (const void *obj_left, const void *obj_right, int flags) |
Sorting function for use with red/black tree. | |
static int | validate_user_cb (void *obj, void *arg, int flags) |
Callback to validate a user object. | |
Variables | |
static struct aco_file | conf_file |
The conf file that's processed for the module. | |
static struct aco_type | general_option |
Mapping of the ARI conf struct's globals to the general context in the config file. | |
static struct aco_type * | general_options [] = ACO_TYPES(&general_option) |
static struct aco_type * | global_user [] = ACO_TYPES(&user_option) |
static struct aco_type | user_option |
Config framework stuffz for ARI.
Definition in file res/ari/config.c.
struct ast_ari_conf* ast_ari_config_get | ( | void | ) |
Get the current ARI configuration.
This is an immutable object, so don't modify it. It is AO2 managed, so ao2_cleanup() when you're done with it.
NULL | on error. |
Definition at line 227 of file res/ari/config.c.
References ao2_global_obj_ref.
Referenced by ast_ari_config_validate_user(), ast_ari_json_format(), ast_ari_websocket_session_create(), is_enabled(), and process_config().
struct ast_ari_conf_user* ast_ari_config_validate_user | ( | const char * | username, |
const char * | password | ||
) |
Validated a user's credentials.
username | Name of the user. |
password | User's password. |
NULL | if username or password is invalid. |
Definition at line 237 of file res/ari/config.c.
References ao2_ref, ARI_PASSWORD_FORMAT_CRYPT, ARI_PASSWORD_FORMAT_PLAIN, ast_ari_config_get(), ast_crypt_validate(), OBJ_SEARCH_KEY, and RAII_VAR.
Referenced by authenticate_api_key(), and authenticate_user().