42 .category =
"general",
54 if (!strcasecmp(
var->name,
"pretty")) {
70 if (strcasecmp(
var->value,
"plain") == 0) {
72 }
else if (strcasecmp(
var->value,
"crypt") == 0) {
98 ast_debug(3,
"Allocating user %s\n", cat);
107 if (!
user->username) {
116static int user_sort_cmp(
const void *obj_left,
const void *obj_right,
int flags)
120 const char *key_right = obj_right;
128 cmp = strcasecmp(user_left->
username, key_right);
135 cmp = strncasecmp(user_left->
username, key_right, strlen(key_right));
160 .category =
"general",
161 .matchfield =
"type",
162 .matchvalue =
"user",
214#define CONF_FILENAME "ari.conf"
256 "User '%s' missing password; authentication failed\n",
261 switch (
user->password_format) {
Asterisk main include file. File version handling, generic pbx functions.
#define ast_strdup(str)
A wrapper for strdup()
#define ast_strdupa(s)
duplicate a string in memory from the stack
@ AO2_ALLOC_OPT_LOCK_NOLOCK
#define ao2_callback(c, flags, cb_fn, arg)
ao2_callback() is a generic function that applies cb_fn() to all objects in a container,...
int ao2_container_count(struct ao2_container *c)
Returns the number of elements in a container.
#define ao2_global_obj_ref(holder)
Get a reference to the object stored in the global holder.
#define ao2_find(container, arg, flags)
#define ao2_container_alloc_rbtree(ao2_options, container_options, sort_fn, cmp_fn)
Allocate and initialize a red-black tree container.
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
#define ao2_alloc_options(data_size, destructor_fn, options)
#define ao2_global_obj_release(holder)
Release the ao2 object held in the global holder.
@ OBJ_SEARCH_PARTIAL_KEY
The arg parameter is a partial search key similar to OBJ_SEARCH_KEY.
@ OBJ_SEARCH_OBJECT
The arg parameter is an object of the same type.
@ OBJ_SEARCH_MASK
Search option field mask.
@ OBJ_SEARCH_KEY
The arg parameter is a search key, but is not an object.
@ AO2_CONTAINER_ALLOC_OPT_DUPS_REPLACE
Replace objects with duplicate keys in container.
General Asterisk PBX channel definitions.
void ast_channel_set_ari_vars(size_t varc, char **vars)
Sets the variables to be stored in the ari_vars field of all snapshots.
Configuration option-handling.
int aco_set_defaults(struct aco_type *type, const char *category, void *obj)
Set all default options of obj.
void aco_info_destroy(struct aco_info *info)
Destroy an initialized aco_info struct.
@ ACO_PROCESS_UNCHANGED
The config had not been edited and no changes applied.
@ ACO_PROCESS_ERROR
Their was an error and no changes were applied.
@ ACO_PROCESS_OK
The config was processed and applied.
#define STRFLDSET(type,...)
Convert a struct and a list of stringfield fields to an argument list of field offsets.
int aco_info_init(struct aco_info *info)
Initialize an aco_info structure.
#define FLDSET(type,...)
Convert a struct and list of fields to an argument list of field offsets.
#define aco_option_register(info, name, matchtype, types, default_val, opt_type, flags,...)
Register a config option.
@ OPT_NOOP_T
Type for a default handler that should do nothing.
@ OPT_BOOL_T
Type for default option handler for bools (ast_true/ast_false)
@ OPT_CHAR_ARRAY_T
Type for default option handler for character array strings.
@ OPT_INT_T
Type for default option handler for signed integers.
@ OPT_STRINGFIELD_T
Type for default option handler for stringfields.
#define aco_option_register_custom(info, name, matchtype, types, default_val, handler, flags)
Register a config option.
enum aco_process_status aco_process_config(struct aco_info *info, int reload)
Process a config info via the options registered with an aco_info.
#define ACO_TYPES(...)
A helper macro to ensure that aco_info types always have a sentinel.
Support for WebSocket connections within the Asterisk HTTP server and client WebSocket connections to...
#define AST_DEFAULT_WEBSOCKET_WRITE_TIMEOUT_STR
Default websocket write timeout, in ms (as a string)
Application convenience functions, designed to give consistent look and feel to Asterisk apps.
#define AST_APP_ARG(name)
Define an application argument.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
#define ast_debug(level,...)
Log a DEBUG message.
Internal API's for res_ari.
#define ARI_PASSWORD_LEN
User's password mx length.
#define ARI_AUTH_REALM_LEN
@ ARI_PASSWORD_FORMAT_CRYPT
@ ARI_PASSWORD_FORMAT_PLAIN
Plaintext password.
CONFIG_INFO_STANDARD(cfg_info, confs, conf_alloc,.files=ACO_FILES(&conf_file))
struct ast_ari_conf * ast_ari_config_get(void)
Get the current ARI configuration.
static int process_config(int reload)
Load (or reload) configuration.
static struct aco_type user_option
static void * conf_alloc(void)
Allocate an ast_ari_conf for config parsing.
int ast_ari_config_reload(void)
Reload the ARI configuration.
static AO2_GLOBAL_OBJ_STATIC(confs)
Locking container for safe configuration access.
static struct aco_file conf_file
The conf file that's processed for the module.
static void conf_general_dtor(void *obj)
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 void * user_alloc(const char *cat)
Allocate an ast_ari_conf_user for config parsing.
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 * global_user[]
static void conf_destructor(void *obj)
ast_ari_conf destructor.
static struct aco_type * general_options[]
int ast_ari_config_init(void)
Initialize the ARI configuration.
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 encoding_format_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
Encoding format handler converts from boolean to enum.
static int channelvars_handler(const struct aco_option *opt, struct ast_variable *var, void *obj)
struct ast_ari_conf_user * ast_ari_config_validate_user(const char *username, const char *password)
Validated a user's credentials.
void ast_ari_config_destroy(void)
Destroy the ARI configuration.
static int validate_user_cb(void *obj, void *arg, int flags)
Callback to validate a user object.
static void * user_find(struct ao2_container *tmp_container, const char *cat)
aco_type item_find function
static void user_dtor(void *obj)
Destructor for ast_ari_conf_user.
#define ast_string_field_init(x, size)
Initialize a field pool and fields.
#define ast_string_field_free_memory(x)
free all memory - to be called before destroying the object
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true"....
static force_inline int attribute_pure ast_strlen_zero(const char *s)
The representation of a single configuration file to be processed.
Type information about a category-level configurable object.
Global configuration options for ARI.
enum ast_json_encoding_format format
Per-user configuration options.
char password[ARI_PASSWORD_LEN]
All configuration options for ARI.
struct ao2_container * users
struct ast_ari_conf_general * general
Structure for variables, used for configurations and for channel variables.
All configuration options for http media cache.
struct conf_general_options * general
structure to hold users read from users.conf
list of users found in the config file
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
int ast_crypt_validate(const char *key, const char *expected)
Asterisk wrapper around crypt(3) for validating passwords.