| Asterisk - The Open Source Telephony Project GIT-master-27fb039
    | 
#include "asterisk.h"#include "asterisk/module.h"#include "asterisk/astobj2.h"#include "asterisk/strings.h"#include "asterisk/vector.h"#include "asterisk/websocket_client.h"
Go to the source code of this file.
| Macros | |
| #define | DEFAULT_RECONNECT_ATTEMPTS -2147483648 | 
| Functions | |
| static void | __reg_module (void) | 
| static void | __unreg_module (void) | 
| struct ast_module * | AST_MODULE_SELF_SYM (void) | 
| void | ast_websocket_client_add_uri_params (struct ast_websocket_client *wc, const char *uri_params) | 
| Add additional parameters to the URI. | |
| struct ast_websocket * | ast_websocket_client_connect (struct ast_websocket_client *wc, void *lock_obj, const char *display_name, enum ast_websocket_result *result) | 
| Connect to a websocket server using the configured authentication, retry and TLS options. | |
| enum ast_ws_client_fields | ast_websocket_client_get_field_diff (struct ast_websocket_client *old_wc, struct ast_websocket_client *new_wc) | 
| Detect changes between two websocket client configurations. | |
| int | ast_websocket_client_observer_add (const struct ast_sorcery_observer *callbacks) | 
| Add sorcery observers for websocket client events. | |
| void | ast_websocket_client_observer_remove (const struct ast_sorcery_observer *callbacks) | 
| Remove sorcery observers for websocket client events. | |
| int | ast_websocket_client_reload (void) | 
| Force res_websocket_client to reload its configuration. | |
| struct ao2_container * | ast_websocket_client_retrieve_all (void) | 
| Retrieve a container of all websocket client objects. | |
| struct ast_websocket_client * | ast_websocket_client_retrieve_by_id (const char *id) | 
| Retrieve a websocket client object by ID. | |
| static int | load_module (void) | 
| static int | reload_module (void) | 
| static int | unload_module (void) | 
| static void * | wc_alloc (const char *id) | 
| static int | wc_apply (const struct ast_sorcery *sorcery, void *obj) | 
| static void | wc_dtor (void *obj) | 
| static int | websocket_client_connection_type_from_str (const struct aco_option *opt, struct ast_variable *var, void *obj) | 
| static int | websocket_client_connection_type_to_str (const void *obj, const intptr_t *args, char **buf) | 
| Variables | |
| static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER , .description = "WebSocket Client Support" , .key = ASTERISK_GPL_KEY , .buildopt_sum = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .reload = reload_module, .load_pri = AST_MODPRI_CHANNEL_DEPEND, .requires = "res_http_websocket", } | 
| static const struct ast_module_info * | ast_module_info = &__mod_info | 
| static struct ast_sorcery * | sorcery = NULL | 
| #define DEFAULT_RECONNECT_ATTEMPTS -2147483648 | 
Definition at line 426 of file res_websocket_client.c.
| 
 | static | 
Definition at line 643 of file res_websocket_client.c.
| 
 | static | 
Definition at line 643 of file res_websocket_client.c.
| struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) | 
Definition at line 643 of file res_websocket_client.c.
| void ast_websocket_client_add_uri_params | ( | struct ast_websocket_client * | wc, | 
| const char * | uri_params | ||
| ) | 
Add additional parameters to the URI.
| wc | A pointer to the ast_websocket_structure | 
| uri_params | A string containing URLENCODED parameters to append to the URI. | 
Definition at line 240 of file res_websocket_client.c.
References ast_string_field_set.
Referenced by webchan_call().
| struct ast_websocket * ast_websocket_client_connect | ( | struct ast_websocket_client * | wc, | 
| void * | lock_obj, | ||
| const char * | display_name, | ||
| enum ast_websocket_result * | result | ||
| ) | 
Connect to a websocket server using the configured authentication, retry and TLS options.
| wc | A pointer to the ast_websocket_structure | 
| lock_obj | A pointer to an ao2 object to lock while the connection is being attempted or NULL if no locking is needed. | 
| display_name | An id string to use for logging messages. If NULL or empty the connection's ID will be used. | 
| result | A pointer to an enum ast_websocket_result to store the result of the connection attempt. | 
Definition at line 246 of file res_websocket_client.c.
References ao2_lock, ao2_unlock, ast_alloca, ast_calloc, ast_log, ast_set2_flag, ast_sorcery_object_get_id(), AST_SSL_DONT_VERIFY_SERVER, AST_SSL_IGNORE_COMMON_NAME, ast_strdup, ast_strlen_zero(), ast_websocket_client_create_with_options(), ast_websocket_result_to_str(), AST_WS_TYPE_CLIENT_PERSISTENT, ast_websocket_client::ca_list_file, ast_websocket_client::ca_list_path, ast_websocket_client::cert_file, ast_websocket_client::connect_timeout, ast_websocket_client::connection_type, errno, LOG_WARNING, NULL, options, ast_websocket_client::password, ast_websocket_client::priv_key_file, ast_websocket_client::protocols, ast_websocket_client::reconnect_attempts, ast_websocket_client::reconnect_interval, result, S_OR, ast_websocket_client::tls_enabled, ast_websocket_client_options::uri, ast_websocket_client::uri, ast_websocket_client::username, ast_websocket_client::verify_server_cert, ast_websocket_client::verify_server_hostname, and WS_OK.
Referenced by outbound_session_handler_thread(), and webchan_call().
| enum ast_ws_client_fields ast_websocket_client_get_field_diff | ( | struct ast_websocket_client * | old_wc, | 
| struct ast_websocket_client * | new_wc | ||
| ) | 
Detect changes between two websocket client configurations.
| old_ow | The old websocket configuration. | 
| new_ow | The new websocket configuration. | 
Definition at line 477 of file res_websocket_client.c.
References ast_debug, ast_log, ast_sorcery_diff(), ast_sorcery_object_get_id(), ast_strings_equal(), ast_variables_destroy(), AST_WS_CLIENT_FIELD_CA_LIST_FILE, AST_WS_CLIENT_FIELD_CA_LIST_PATH, AST_WS_CLIENT_FIELD_CERT_FILE, AST_WS_CLIENT_FIELD_CONNECTION_TIMEOUT, AST_WS_CLIENT_FIELD_CONNECTION_TYPE, AST_WS_CLIENT_FIELD_NONE, AST_WS_CLIENT_FIELD_PASSWORD, AST_WS_CLIENT_FIELD_PRIV_KEY_FILE, AST_WS_CLIENT_FIELD_PROTOCOLS, AST_WS_CLIENT_FIELD_RECONNECT_ATTEMPTS, AST_WS_CLIENT_FIELD_RECONNECT_INTERVAL, AST_WS_CLIENT_FIELD_TLS_ENABLED, AST_WS_CLIENT_FIELD_URI, AST_WS_CLIENT_FIELD_USERNAME, AST_WS_CLIENT_FIELD_VERIFY_SERVER_CERT, AST_WS_CLIENT_FIELD_VERIFY_SERVER_HOSTNAME, LOG_WARNING, ast_variable::name, ast_variable::next, NULL, RAII_VAR, sorcery, and ast_variable::value.
Referenced by ari_conf_owc_detect_changes().
| int ast_websocket_client_observer_add | ( | const struct ast_sorcery_observer * | callbacks | ) | 
Add sorcery observers for websocket client events.
| callbacks | The observer callbacks to add. | 
Definition at line 542 of file res_websocket_client.c.
References ast_log, ast_sorcery_observer_add(), callbacks, LOG_ERROR, and sorcery.
Referenced by ari_conf_init().
| void ast_websocket_client_observer_remove | ( | const struct ast_sorcery_observer * | callbacks | ) | 
Remove sorcery observers for websocket client events.
| callbacks | The observer callbacks to remove. | 
Definition at line 556 of file res_websocket_client.c.
References ast_sorcery_observer_remove(), callbacks, and sorcery.
Referenced by ari_conf_destroy().
| int ast_websocket_client_reload | ( | void | ) | 
Force res_websocket_client to reload its configuration.
Definition at line 616 of file res_websocket_client.c.
References ast_debug, ast_sorcery_reload(), and sorcery.
Referenced by ari_conf_load().
| struct ao2_container * ast_websocket_client_retrieve_all | ( | void | ) | 
Retrieve a container of all websocket client objects.
Definition at line 458 of file res_websocket_client.c.
References AST_RETRIEVE_FLAG_ALL, AST_RETRIEVE_FLAG_MULTIPLE, ast_sorcery_retrieve_by_fields(), NULL, and sorcery.
| struct ast_websocket_client * ast_websocket_client_retrieve_by_id | ( | const char * | id | ) | 
Retrieve a websocket client object by ID.
| id | The ID of the websocket client object. | 
Definition at line 468 of file res_websocket_client.c.
References ast_sorcery_retrieve_by_id(), NULL, and sorcery.
Referenced by ast_ari_channels_external_media(), outbound_websocket_websocket_client_id_from_str(), and websocket_new().
| 
 | static | 
Definition at line 566 of file res_websocket_client.c.
References ast_debug, ast_log, ast_sorcery_apply_default, ast_sorcery_load(), ast_sorcery_object_field_register, ast_sorcery_object_register, ast_sorcery_open, ast_sorcery_register_bool, ast_sorcery_register_cust, ast_sorcery_register_int, ast_sorcery_register_sf, ast_sorcery_unref, LOG_ERROR, NULL, OPT_NOOP_T, sorcery, wc_alloc(), and wc_apply().
| 
 | static | 
Definition at line 608 of file res_websocket_client.c.
References ast_debug, ast_sorcery_reload(), and sorcery.
| 
 | static | 
Definition at line 626 of file res_websocket_client.c.
References ast_debug, ast_sorcery_unref, NULL, and sorcery.
| 
 | static | 
Definition at line 367 of file res_websocket_client.c.
References ao2_cleanup, ast_debug, ast_sorcery_generic_alloc(), ast_string_field_init, ast_string_field_init_extended, NULL, and wc_dtor().
Referenced by load_module().
| 
 | static | 
Definition at line 428 of file res_websocket_client.c.
References ast_debug, ast_log, ast_sorcery_object_get_id(), ast_strlen_zero(), AST_WS_TYPE_CLIENT_PERSISTENT, ast_websocket_client::connection_type, DEFAULT_RECONNECT_ATTEMPTS, LOG_WARNING, ast_websocket_client::reconnect_attempts, and ast_websocket_client::uri.
Referenced by load_module().
| 
 | static | 
Definition at line 358 of file res_websocket_client.c.
References ast_debug, ast_sorcery_object_get_id(), and ast_string_field_free_memory.
Referenced by wc_alloc().
| 
 | static | 
Definition at line 390 of file res_websocket_client.c.
References AST_WS_TYPE_CLIENT_PER_CALL_CONFIG, AST_WS_TYPE_CLIENT_PERSISTENT, ast_websocket_client::connection_type, and var.
| 
 | static | 
Definition at line 406 of file res_websocket_client.c.
References ast_strdup, AST_WS_TYPE_CLIENT_PER_CALL_CONFIG, AST_WS_TYPE_CLIENT_PERSISTENT, buf, and ast_websocket_client::connection_type.
| 
 | static | 
Definition at line 643 of file res_websocket_client.c.
| 
 | static | 
Definition at line 643 of file res_websocket_client.c.
| 
 | static | 
Definition at line 238 of file res_websocket_client.c.
Referenced by ast_websocket_client_get_field_diff(), ast_websocket_client_observer_add(), ast_websocket_client_observer_remove(), ast_websocket_client_reload(), ast_websocket_client_retrieve_all(), ast_websocket_client_retrieve_by_id(), load_module(), reload_module(), and unload_module().