Asterisk - The Open Source Telephony Project GIT-master-c7a8271
|
Internal API's for res_ari. More...
#include "asterisk/http.h"
#include "asterisk/json.h"
#include "asterisk/md5.h"
#include "asterisk/sorcery.h"
#include "asterisk/stringfields.h"
#include "asterisk/websocket_client.h"
#include "ari_websockets.h"
Go to the source code of this file.
Data Structures | |
struct | ari_conf_general |
Global configuration options for ARI. More... | |
struct | ari_conf_outbound_websocket |
struct | ari_conf_user |
Per-user configuration options. More... | |
Functions | |
int | ari_cli_register (void) |
Register CLI commands for ARI. More... | |
void | ari_cli_unregister (void) |
Unregister CLI commands for ARI. More... | |
void | ari_conf_destroy (void) |
Destroy the ARI configuration. More... | |
struct ari_conf_general * | ari_conf_get_general (void) |
struct ari_conf_outbound_websocket * | ari_conf_get_owc (const char *id) |
struct ari_conf_outbound_websocket * | ari_conf_get_owc_for_app (const char *app_name, unsigned int ws_type) |
Get the outbound websocket configuration for a Stasis app. More... | |
struct ao2_container * | ari_conf_get_owcs (void) |
struct ari_conf_user * | ari_conf_get_user (const char *username) |
struct ao2_container * | ari_conf_get_users (void) |
int | ari_conf_load (enum ari_conf_load_flags flags) |
(Re)load the ARI configuration More... | |
enum | ari_conf_load_flags { ARI_CONF_INIT = (1 << 0) , ARI_CONF_RELOAD = (1 << 1) , ARI_CONF_LOAD_GENERAL = (1 << 2) , ARI_CONF_LOAD_USER = (1 << 3) , ARI_CONF_LOAD_OWC = (1 << 4) , ARI_CONF_LOAD_ALL } |
enum ari_conf_owc_fields | ari_conf_owc_detect_changes (struct ari_conf_outbound_websocket *old_owc, struct ari_conf_outbound_websocket *new_owc) |
Detect changes between two outbound websocket configurations. More... | |
enum | ari_conf_owc_fields { ARI_OWC_FIELD_NONE = 0 , ARI_OWC_FIELD_WEBSOCKET_CONNECTION_ID = (1 << AST_WS_CLIENT_FIELD_USER_START) , ARI_OWC_FIELD_APPS = (1 << (AST_WS_CLIENT_FIELD_USER_START + 1)) , ARI_OWC_FIELD_LOCAL_ARI_USER = (1 << (AST_WS_CLIENT_FIELD_USER_START + 2)) , ARI_OWC_FIELD_LOCAL_ARI_PASSWORD = (1 << (AST_WS_CLIENT_FIELD_USER_START + 3)) , ARI_OWC_FIELD_SUBSCRIBE_ALL = (1 << (AST_WS_CLIENT_FIELD_USER_START + 4)) , ARI_OWC_NEEDS_RECONNECT , ARI_OWC_NEEDS_REREGISTER = ARI_OWC_FIELD_APPS | ARI_OWC_FIELD_SUBSCRIBE_ALL } |
enum ari_conf_owc_fields | ari_conf_owc_get_invalid_fields (const char *id) |
struct ari_conf_user * | ari_conf_validate_user (const char *username, const char *password) |
Validated a user's credentials. More... | |
int | ari_sorcery_observer_add (const char *object_type, const struct ast_sorcery_observer *callbacks) |
int | ari_sorcery_observer_remove (const char *object_type, const struct ast_sorcery_observer *callbacks) |
enum | ari_user_password_format { ARI_PASSWORD_FORMAT_PLAIN , ARI_PASSWORD_FORMAT_CRYPT } |
Password format. More... | |
const char * | ari_websocket_type_to_str (enum ast_websocket_type type) |
Internal API's for res_ari.
Definition in file internal.h.
enum ari_conf_load_flags |
Definition at line 145 of file internal.h.
enum ari_conf_owc_fields |
Definition at line 96 of file internal.h.
Password format.
Enumerator | |
---|---|
ARI_PASSWORD_FORMAT_PLAIN | Plaintext password. |
ARI_PASSWORD_FORMAT_CRYPT | crypt(3) password |
Definition at line 76 of file internal.h.
int ari_cli_register | ( | void | ) |
Register CLI commands for ARI.
Definition at line 699 of file res/ari/cli.c.
References ARRAY_LEN, ast_cli_register_multiple, and cli_ari.
Referenced by load_module().
void ari_cli_unregister | ( | void | ) |
Unregister CLI commands for ARI.
Definition at line 703 of file res/ari/cli.c.
References ARRAY_LEN, ast_cli_unregister_multiple(), and cli_ari.
Referenced by unload_module().
void ari_conf_destroy | ( | void | ) |
Destroy the ARI configuration.
Definition at line 789 of file res/ari/config.c.
References ao2_cleanup, ast_sorcery_unref, ast_websocket_client_observer_remove(), NULL, owc_states, sorcery, and ws_client_observer_callbacks.
Referenced by unload_module().
struct ari_conf_general * ari_conf_get_general | ( | void | ) |
Definition at line 477 of file res/ari/config.c.
References ast_sorcery_retrieve_by_id(), NULL, and sorcery.
Referenced by ari_show(), ast_ari_invoke(), ast_ari_json_format(), is_enabled(), origin_allowed(), and session_update().
struct ari_conf_outbound_websocket * ari_conf_get_owc | ( | const char * | id | ) |
Definition at line 308 of file res/ari/config.c.
References ast_sorcery_retrieve_by_id(), NULL, and sorcery.
Referenced by ari_show_owc(), ari_start_owc(), outbound_sessions_load(), and outbound_websocket_state_cleanup().
struct ari_conf_outbound_websocket * ari_conf_get_owc_for_app | ( | const char * | app_name, |
unsigned int | ws_type | ||
) |
Get the outbound websocket configuration for a Stasis app.
app_name | The application name to search for. |
ws_type | An OR'd list of ari_websocket_types or ARI_WS_TYPE_ANY. |
ARI | outbound websocket configuration object. |
NULL | if not found. |
Definition at line 317 of file res/ari/config.c.
References ao2_cleanup, ao2_container_count(), ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, app_name(), ari_conf_outbound_websocket::apps, ari_conf_get_owcs(), ast_debug, ast_in_delimited_string(), ast_sorcery_object_get_id(), ast_strlen_zero(), ast_websocket_client::connection_type, NULL, and ari_conf_outbound_websocket::websocket_client.
Referenced by ast_ari_create_per_call_websocket().
struct ao2_container * ari_conf_get_owcs | ( | void | ) |
Definition at line 298 of file res/ari/config.c.
References AST_RETRIEVE_FLAG_ALL, AST_RETRIEVE_FLAG_MULTIPLE, ast_sorcery_retrieve_by_fields(), NULL, and sorcery.
Referenced by ari_conf_get_owc_for_app(), ari_show_owc(), ari_show_owcs(), ari_start_owc(), outbound_sessions_load(), outbound_websocket_validate_cb(), and outbound_websockets_validate().
struct ari_conf_user * ari_conf_get_user | ( | const char * | username | ) |
Definition at line 578 of file res/ari/config.c.
References ast_sorcery_retrieve_by_id(), NULL, and sorcery.
Referenced by ari_show_user().
struct ao2_container * ari_conf_get_users | ( | void | ) |
Definition at line 568 of file res/ari/config.c.
References AST_RETRIEVE_FLAG_ALL, AST_RETRIEVE_FLAG_MULTIPLE, ast_sorcery_retrieve_by_fields(), NULL, and sorcery.
Referenced by ari_show_user(), and ari_show_users().
int ari_conf_load | ( | enum ari_conf_load_flags | flags | ) |
(Re)load the ARI configuration
Definition at line 745 of file res/ari/config.c.
References ari_conf_init(), ARI_CONF_INIT, ARI_CONF_LOAD_GENERAL, ARI_CONF_LOAD_OWC, ARI_CONF_LOAD_USER, ARI_CONF_RELOAD, ast_debug, ast_log, ast_sorcery_load_object(), ast_sorcery_reload_object(), ast_websocket_client_reload(), LOG_ERROR, sorcery, and type.
Referenced by load_module(), and reload_module().
enum ari_conf_owc_fields ari_conf_owc_detect_changes | ( | struct ari_conf_outbound_websocket * | old_owc, |
struct ari_conf_outbound_websocket * | new_owc | ||
) |
Detect changes between two outbound websocket configurations.
old_owc | The old outbound websocket configuration. |
new_owc | The new outbound websocket configuration. |
Definition at line 377 of file res/ari/config.c.
References ARI_OWC_FIELD_APPS, ARI_OWC_FIELD_LOCAL_ARI_PASSWORD, ARI_OWC_FIELD_LOCAL_ARI_USER, ARI_OWC_FIELD_NONE, ARI_OWC_FIELD_SUBSCRIBE_ALL, ast_debug, ast_log, ast_sorcery_diff(), ast_sorcery_object_get_id(), ast_strings_equal(), ast_variables_destroy(), ast_websocket_client_get_field_diff(), LOG_WARNING, ast_variable::name, ast_variable::next, NULL, RAII_VAR, sorcery, ast_variable::value, and ari_conf_outbound_websocket::websocket_client.
Referenced by outbound_session_apply_config().
enum ari_conf_owc_fields ari_conf_owc_get_invalid_fields | ( | const char * | id | ) |
Definition at line 158 of file res/ari/config.c.
References ao2_cleanup, ao2_find, ARI_OWC_FIELD_NONE, NULL, OBJ_SEARCH_KEY, owc_states, and RAII_VAR.
Referenced by ari_show_owc(), ast_ari_create_per_call_websocket(), outbound_session_create(), and show_owc_cb().
struct ari_conf_user * ari_conf_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 591 of file res/ari/config.c.
References ao2_cleanup, ARI_PASSWORD_FORMAT_CRYPT, ARI_PASSWORD_FORMAT_PLAIN, ast_crypt_validate(), ast_sorcery_retrieve_by_id(), ast_strlen_zero(), NULL, ari_conf_user::password, sorcery, and user.
Referenced by authenticate_api_key(), and authenticate_user().
int ari_sorcery_observer_add | ( | const char * | object_type, |
const struct ast_sorcery_observer * | callbacks | ||
) |
Definition at line 623 of file res/ari/config.c.
References ast_sorcery_observer_add(), callbacks, and sorcery.
Referenced by ari_websocket_load_module().
int ari_sorcery_observer_remove | ( | const char * | object_type, |
const struct ast_sorcery_observer * | callbacks | ||
) |
Definition at line 632 of file res/ari/config.c.
References ast_sorcery_observer_remove(), callbacks, and sorcery.
Referenced by ari_websocket_unload_module().
const char * ari_websocket_type_to_str | ( | enum ast_websocket_type | type | ) |
Definition at line 359 of file res/ari/config.c.