Asterisk - The Open Source Telephony Project
18.5.0
|
WebSocket support for the Asterisk internal HTTP server. More...
#include "asterisk.h"
#include "asterisk/module.h"
#include "asterisk/http.h"
#include "asterisk/astobj2.h"
#include "asterisk/strings.h"
#include "asterisk/file.h"
#include "asterisk/unaligned.h"
#include "asterisk/uri.h"
#include "asterisk/uuid.h"
#include "asterisk/http_websocket.h"
Go to the source code of this file.
Data Structures | |
struct | ast_websocket |
Structure definition for session. More... | |
struct | ast_websocket_server |
Structure for a WebSocket server. More... | |
struct | websocket_client |
Macros | |
#define | AST_API_MODULE |
#define | CLIENT_KEY_SIZE 16 |
Length of a websocket's client key. More... | |
#define | DEFAULT_RECONSTRUCTION_CEILING MAXIMUM_FRAME_SIZE |
Default reconstruction size for multi-frame payload reconstruction. If exceeded the next frame will start a payload. More... | |
#define | MAX_PROTOCOL_BUCKETS 7 |
Number of buckets for registered protocols. More... | |
#define | MAX_WS_HDR_SZ 14 |
Maximum size of a websocket frame header 1 byte flags and opcode 1 byte mask flag + payload len 8 bytes max extended length 4 bytes optional masking key ... payload follows ... More... | |
#define | MAXIMUM_FRAME_SIZE 65535 |
Size of the pre-determined buffer for WebSocket frames. More... | |
#define | MAXIMUM_RECONSTRUCTION_CEILING MAXIMUM_FRAME_SIZE |
Maximum reconstruction size for multi-frame payload reconstruction. More... | |
#define | MIN_WS_HDR_SZ 2 |
#define | WEBSOCKET_GUID "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" |
GUID used to compute the accept key, defined in the specifications. More... | |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER , .description = "HTTP WebSocket Support" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "30ef0c93b36035ec78c9cfd712d36d9b" , .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_CHANNEL_DEPEND, .requires = "http", } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static const char * | opcode_map [] |
static struct ast_http_uri | websocketuri |
WebSocket support for the Asterisk internal HTTP server.
Definition in file res_http_websocket.c.
#define AST_API_MODULE |
Definition at line 41 of file res_http_websocket.c.
#define CLIENT_KEY_SIZE 16 |
Length of a websocket's client key.
Definition at line 48 of file res_http_websocket.c.
Referenced by websocket_client_create_key().
#define DEFAULT_RECONSTRUCTION_CEILING MAXIMUM_FRAME_SIZE |
Default reconstruction size for multi-frame payload reconstruction. If exceeded the next frame will start a payload.
Definition at line 71 of file res_http_websocket.c.
Referenced by ast_websocket_uri_cb(), and websocket_client_create().
#define MAX_PROTOCOL_BUCKETS 7 |
Number of buckets for registered protocols.
Definition at line 51 of file res_http_websocket.c.
Referenced by websocket_server_create_impl().
#define MAX_WS_HDR_SZ 14 |
Maximum size of a websocket frame header 1 byte flags and opcode 1 byte mask flag + payload len 8 bytes max extended length 4 bytes optional masking key ... payload follows ...
Definition at line 84 of file res_http_websocket.c.
#define MAXIMUM_FRAME_SIZE 65535 |
Size of the pre-determined buffer for WebSocket frames.
Definition at line 66 of file res_http_websocket.c.
Referenced by ast_websocket_read().
#define MAXIMUM_RECONSTRUCTION_CEILING MAXIMUM_FRAME_SIZE |
Maximum reconstruction size for multi-frame payload reconstruction.
Definition at line 74 of file res_http_websocket.c.
Referenced by ast_websocket_reconstruct_enable().
#define MIN_WS_HDR_SZ 2 |
Definition at line 85 of file res_http_websocket.c.
Referenced by ast_websocket_read().
#define WEBSOCKET_GUID "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" |
GUID used to compute the accept key, defined in the specifications.
Definition at line 45 of file res_http_websocket.c.
Referenced by ast_websocket_uri_cb(), and websocket_combine_key().
|
static |
Definition at line 1529 of file res_http_websocket.c.
|
static |
Definition at line 1529 of file res_http_websocket.c.
struct ast_module* AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 1529 of file res_http_websocket.c.
int AST_OPTIONAL_API_NAME() ast_websocket_add_protocol | ( | const char * | name, |
ast_websocket_callback | callback | ||
) |
Definition at line 1052 of file res_http_websocket.c.
References name, and websocket_add_protocol_internal().
Referenced by load_module(), and reload_config().
int AST_OPTIONAL_API_NAME() ast_websocket_add_protocol2 | ( | struct ast_websocket_protocol * | protocol | ) |
Definition at line 1057 of file res_http_websocket.c.
References ast_websocket_server_add_protocol2(), and ast_http_uri::data.
const char* AST_OPTIONAL_API_NAME() ast_websocket_client_accept_protocol | ( | struct ast_websocket * | ws | ) |
Definition at line 1270 of file res_http_websocket.c.
Referenced by __stub__ast_websocket_client_create(), and AST_TEST_DEFINE().
struct ast_websocket* AST_OPTIONAL_API_NAME() ast_websocket_client_create | ( | const char * | uri, |
const char * | protocols, | ||
struct ast_tls_config * | tls_cfg, | ||
enum ast_websocket_result * | result | ||
) |
Definition at line 1421 of file res_http_websocket.c.
References ao2_ref, AST_OPTIONAL_API_NAME, ast_websocket_read_string(), NULL, result, websocket_client_connect(), websocket_client_create(), and WS_OK.
Referenced by AST_TEST_DEFINE(), and websocket_client_connect().
int AST_OPTIONAL_API_NAME() ast_websocket_close | ( | struct ast_websocket * | session, |
uint16_t | reason | ||
) |
Close function for websocket session.
Definition at line 308 of file res_http_websocket.c.
References ao2_lock, ao2_unlock, ast_iostream_close(), ast_iostream_set_timeout_disable(), ast_iostream_set_timeout_inactivity(), ast_iostream_write(), ast_sockaddr_stringify(), ast_verb, AST_WEBSOCKET_OPCODE_CLOSE, ast_websocket::client, ast_websocket::close_sent, ast_websocket::closing, NULL, ast_websocket::opcode, put_unaligned_uint16(), ast_websocket::remote_address, ast_websocket::stream, ast_websocket::timeout, and websocket_mask_payload().
Referenced by ast_websocket_read(), ast_websocket_write(), session_destroy_fn(), and ws_destroy().
int AST_OPTIONAL_API_NAME() ast_websocket_fd | ( | struct ast_websocket * | session | ) |
Definition at line 461 of file res_http_websocket.c.
References ast_iostream_get_fd(), ast_websocket::closing, and ast_websocket::stream.
Referenced by ast_ari_websocket_session_read(), sip_prepare_socket(), sip_websocket_callback(), websocket_echo_callback(), and ws_destroy().
int AST_OPTIONAL_API_NAME() ast_websocket_is_secure | ( | struct ast_websocket * | session | ) |
Definition at line 481 of file res_http_websocket.c.
References ast_websocket::secure.
Referenced by sip_websocket_callback(), and transport_create().
struct ast_sockaddr* AST_OPTIONAL_API_NAME() ast_websocket_local_address | ( | struct ast_websocket * | session | ) |
Definition at line 476 of file res_http_websocket.c.
References ast_websocket::local_address.
Referenced by transport_create().
int AST_OPTIONAL_API_NAME() ast_websocket_read | ( | struct ast_websocket * | session, |
char ** | payload, | ||
uint64_t * | payload_len, | ||
enum ast_websocket_opcode * | opcode, | ||
int * | fragmented | ||
) |
Definition at line 602 of file res_http_websocket.c.
References ast_free, ast_log, ast_realloc, ast_websocket_close(), AST_WEBSOCKET_OPCODE_BINARY, AST_WEBSOCKET_OPCODE_CLOSE, AST_WEBSOCKET_OPCODE_CONTINUATION, AST_WEBSOCKET_OPCODE_PING, AST_WEBSOCKET_OPCODE_PONG, AST_WEBSOCKET_OPCODE_TEXT, ast_websocket_write(), ast_websocket::buf, ast_websocket::close_status_code, ast_websocket::closing, frame_size, get_unaligned_uint16(), get_unaligned_uint64(), LOG_WARNING, MAXIMUM_FRAME_SIZE, MIN_WS_HDR_SZ, ntohll(), NULL, ast_websocket::opcode, ast_websocket::payload, ast_websocket::payload_len, ast_websocket::reconstruct, and ws_safe_read().
Referenced by ast_ari_websocket_session_read(), ast_websocket_read_string(), sip_websocket_callback(), websocket_cb(), and websocket_echo_callback().
int AST_OPTIONAL_API_NAME() ast_websocket_read_string | ( | struct ast_websocket * | ws, |
char ** | buf | ||
) |
Definition at line 1440 of file res_http_websocket.c.
References ast_log, AST_OPTIONAL_API_NAME, ast_strndup, AST_WEBSOCKET_OPCODE_CLOSE, AST_WEBSOCKET_OPCODE_CONTINUATION, AST_WEBSOCKET_OPCODE_PING, AST_WEBSOCKET_OPCODE_TEXT, ast_websocket_read(), ast_websocket_write_string(), ast_websocket::buf, LOG_ERROR, ast_websocket::opcode, ast_websocket::payload, and ast_websocket::payload_len.
Referenced by __stub__ast_websocket_read(), AST_TEST_DEFINE(), and ast_websocket_client_create().
void AST_OPTIONAL_API_NAME() ast_websocket_reconstruct_disable | ( | struct ast_websocket * | session | ) |
void AST_OPTIONAL_API_NAME() ast_websocket_reconstruct_enable | ( | struct ast_websocket * | session, |
size_t | bytes | ||
) |
Definition at line 441 of file res_http_websocket.c.
References MAXIMUM_RECONSTRUCTION_CEILING, MIN, and ast_websocket::reconstruct.
void AST_OPTIONAL_API_NAME() ast_websocket_ref | ( | struct ast_websocket * | session | ) |
Definition at line 451 of file res_http_websocket.c.
References ao2_ref.
Referenced by copy_socket_data(), and transport_create().
struct ast_sockaddr* AST_OPTIONAL_API_NAME() ast_websocket_remote_address | ( | struct ast_websocket * | session | ) |
Definition at line 471 of file res_http_websocket.c.
References ast_websocket::remote_address.
Referenced by ast_ari_websocket_session_get_remote_addr(), sip_websocket_callback(), transport_create(), and transport_read().
int AST_OPTIONAL_API_NAME() ast_websocket_remove_protocol | ( | const char * | name, |
ast_websocket_callback | callback | ||
) |
Definition at line 1081 of file res_http_websocket.c.
References name, and websocket_remove_protocol_internal().
Referenced by reload_config(), and unload_module().
int AST_OPTIONAL_API_NAME() ast_websocket_server_add_protocol | ( | struct ast_websocket_server * | server, |
const char * | name, | ||
ast_websocket_callback | callback | ||
) |
Definition at line 210 of file res_http_websocket.c.
References ao2_ref, ast_websocket_server_add_protocol2(), ast_websocket_sub_protocol_alloc(), name, ast_websocket_server::protocols, and ast_websocket_protocol::session_established.
Referenced by websocket_add_protocol_internal().
int AST_OPTIONAL_API_NAME() ast_websocket_server_add_protocol2 | ( | struct ast_websocket_server * | server, |
struct ast_websocket_protocol * | protocol | ||
) |
Definition at line 232 of file res_http_websocket.c.
References ao2_find, ao2_link_flags, ao2_lock, ao2_ref, ao2_unlock, ast_log, ast_verb, AST_WEBSOCKET_PROTOCOL_VERSION, LOG_WARNING, OBJ_KEY, OBJ_NOLOCK, and ast_websocket_server::protocols.
Referenced by ast_websocket_add_protocol2(), ast_websocket_server_add_protocol(), and load_module().
struct ast_websocket_server* AST_OPTIONAL_API_NAME() ast_websocket_server_create | ( | void | ) |
Definition at line 167 of file res_http_websocket.c.
References websocket_server_create_impl().
Referenced by load_module().
int AST_OPTIONAL_API_NAME() ast_websocket_server_remove_protocol | ( | struct ast_websocket_server * | server, |
const char * | name, | ||
ast_websocket_callback | callback | ||
) |
Definition at line 266 of file res_http_websocket.c.
References ao2_find, ao2_ref, ao2_unlink, ast_verb, name, OBJ_KEY, ast_websocket_server::protocols, and ast_websocket_protocol::session_established.
Referenced by websocket_remove_protocol_internal().
const char* AST_OPTIONAL_API_NAME() ast_websocket_session_id | ( | struct ast_websocket * | session | ) |
Definition at line 500 of file res_http_websocket.c.
References ast_websocket::session_id.
Referenced by ast_ari_websocket_session_id().
int AST_OPTIONAL_API_NAME() ast_websocket_set_nonblock | ( | struct ast_websocket * | session | ) |
Definition at line 486 of file res_http_websocket.c.
References ast_iostream_nonblock(), ast_iostream_set_exclusive_input(), and ast_websocket::stream.
Referenced by ast_ari_websocket_session_create(), sip_websocket_callback(), and websocket_cb().
int AST_OPTIONAL_API_NAME() ast_websocket_set_timeout | ( | struct ast_websocket * | session, |
int | timeout | ||
) |
Definition at line 493 of file res_http_websocket.c.
References ast_websocket::timeout.
Referenced by ast_ari_websocket_session_create(), sip_websocket_callback(), and websocket_cb().
struct ast_websocket_protocol* AST_OPTIONAL_API_NAME() ast_websocket_sub_protocol_alloc | ( | const char * | name | ) |
Definition at line 191 of file res_http_websocket.c.
References ao2_alloc, ao2_ref, ast_strdup, AST_WEBSOCKET_PROTOCOL_VERSION, name, ast_websocket_protocol::name, NULL, protocol_destroy_fn(), and ast_websocket_protocol::version.
Referenced by ast_websocket_server_add_protocol(), and load_module().
void AST_OPTIONAL_API_NAME() ast_websocket_unref | ( | struct ast_websocket * | session | ) |
Definition at line 456 of file res_http_websocket.c.
References ao2_cleanup.
Referenced by ast_ari_events_event_websocket_ws_established_cb(), copy_socket_data(), expire_register(), parse_moved_contact(), set_socket_transport(), sip_destroy_peer(), sip_pvt_dtor(), sip_websocket_callback(), transport_dtor(), websocket_cb(), websocket_echo_callback(), and websocket_session_dtor().
int AST_OPTIONAL_API_NAME() ast_websocket_uri_cb | ( | struct ast_tcptls_session_instance * | ser, |
const struct ast_http_uri * | urih, | ||
const char * | uri, | ||
enum ast_http_method | method, | ||
struct ast_variable * | get_vars, | ||
struct ast_variable * | headers | ||
) |
Definition at line 790 of file res_http_websocket.c.
References ao2_alloc, ao2_find, ao2_ref, ast_debug, AST_DEFAULT_WEBSOCKET_WRITE_TIMEOUT, ast_getsockname(), ast_http_body_discard(), ast_http_error(), AST_HTTP_GET, ast_iostream_get_fd(), ast_iostream_get_ssl(), ast_iostream_printf(), ast_iostream_set_exclusive_input(), ast_log, ast_sockaddr_copy(), ast_sockaddr_stringify(), ast_strdupa, ast_strip(), ast_strlen_zero, ast_uuid_generate_str(), AST_UUID_STR_LEN, ast_verb, base64, ast_http_uri::data, DEFAULT_RECONSTRUCTION_CEILING, ast_websocket::local_address, LOG_WARNING, method, ast_variable::name, ast_websocket_protocol::name, ast_variable::next, NULL, OBJ_KEY, one_protocol(), ast_websocket::opcode, ast_websocket_server::protocols, ast_websocket::reconstruct, ast_websocket::remote_address, ast_tcptls_session_instance::remote_address, SCOPED_MODULE_USE, ast_websocket::secure, ast_module_info::self, session, ast_websocket_protocol::session_attempted, session_destroy_fn(), ast_websocket_protocol::session_established, ast_websocket::session_id, ast_websocket::stream, ast_tcptls_session_instance::stream, strsep(), ast_websocket::timeout, 210693f3123d_create_cdr_table::upgrade(), ast_variable::value, version, websocket_bad_request(), websocket_combine_key(), and WEBSOCKET_GUID.
Referenced by ari_handle_websocket().
int AST_OPTIONAL_API_NAME() ast_websocket_wait_for_input | ( | struct ast_websocket * | session, |
int | timeout | ||
) |
Definition at line 466 of file res_http_websocket.c.
References ast_iostream_wait_for_input(), ast_websocket::closing, ast_websocket::stream, and ast_websocket::timeout.
Referenced by websocket_cb(), and websocket_echo_callback().
int AST_OPTIONAL_API_NAME() ast_websocket_write | ( | struct ast_websocket * | session, |
enum ast_websocket_opcode | opcode, | ||
char * | payload, | ||
uint64_t | payload_size | ||
) |
Write function for websocket traffic.
Definition at line 374 of file res_http_websocket.c.
References ao2_lock, ao2_unlock, ast_alloca, ast_debug, ast_iostream_set_timeout_disable(), ast_iostream_set_timeout_sequence(), ast_iostream_write(), ast_tvnow(), ast_websocket_close(), ast_websocket::client, ast_websocket::closing, frame_size, htonll(), ast_websocket::opcode, ast_websocket::payload, put_unaligned_uint16(), put_unaligned_uint64(), ast_websocket::stream, ast_websocket::timeout, websocket_mask_payload(), and websocket_opcode2str().
Referenced by ast_ari_events_event_websocket_ws_established_cb(), ast_websocket_read(), ast_websocket_write_string(), websocket_echo_callback(), and ws_send_msg().
int AST_OPTIONAL_API_NAME() ast_websocket_write_string | ( | struct ast_websocket * | ws, |
const char * | buf | ||
) |
Definition at line 1484 of file res_http_websocket.c.
References ast_debug, AST_WEBSOCKET_OPCODE_TEXT, ast_websocket_write(), ast_websocket::buf, and len().
Referenced by __sip_xmit(), __stub__ast_websocket_write(), ast_ari_websocket_session_write(), AST_TEST_DEFINE(), and ast_websocket_read_string().
|
static |
Definition at line 1501 of file res_http_websocket.c.
References ast_http_uri_link(), AST_MODULE_LOAD_DECLINE, ast_http_uri::data, websocket_add_protocol_internal(), websocket_echo_callback(), and websocket_server_internal_create().
Referenced by unload_module().
|
static |
If the server has exactly one configured protocol, return it.
Definition at line 752 of file res_http_websocket.c.
References ao2_callback, ao2_container_count(), lock, NULL, OBJ_NOLOCK, ast_websocket_server::protocols, and SCOPED_AO2LOCK.
Referenced by ast_websocket_uri_cb().
|
static |
Comparison function for protocols.
Definition at line 116 of file res_http_websocket.c.
References CMP_MATCH, CMP_STOP, ast_websocket_protocol::name, and OBJ_KEY.
Referenced by websocket_server_create_impl().
|
static |
Destructor function for protocols.
Definition at line 125 of file res_http_websocket.c.
References ast_free, and ast_websocket_protocol::name.
Referenced by ast_websocket_sub_protocol_alloc().
|
static |
Hashing function for protocols.
Definition at line 107 of file res_http_websocket.c.
References ast_str_case_hash(), name, ast_websocket_protocol::name, and OBJ_KEY.
Referenced by websocket_server_create_impl().
|
static |
Destructor function for sessions.
Definition at line 173 of file res_http_websocket.c.
References ao2_cleanup, ast_free, ast_iostream_close(), ast_sockaddr_stringify(), ast_verb, ast_websocket_close(), ast_websocket::client, ast_websocket::close_status_code, NULL, ast_websocket::payload, ast_websocket::remote_address, session, and ast_websocket::stream.
Referenced by ast_websocket_uri_cb(), and websocket_client_create().
|
static |
Definition at line 1513 of file res_http_websocket.c.
References ao2_ref, ast_http_uri_unlink(), AST_MODFLAG_GLOBAL_SYMBOLS, AST_MODFLAG_LOAD_ORDER, AST_MODPRI_CHANNEL_DEPEND, AST_MODULE_INFO(), AST_MODULE_SUPPORT_CORE, ASTERISK_GPL_KEY, ast_http_uri::data, load_module(), NULL, websocket_echo_callback(), and websocket_remove_protocol_internal().
|
static |
Definition at line 1043 of file res_http_websocket.c.
References ast_websocket_server_add_protocol(), and ast_http_uri::data.
Referenced by ast_websocket_add_protocol(), and load_module().
|
static |
Definition at line 777 of file res_http_websocket.c.
References ast_http_error(), ast_http_request_close_on_completion(), ast_http_send(), AST_HTTP_UNKNOWN, ast_str_create, ast_str_set(), and NULL.
Referenced by ast_websocket_uri_cb().
|
static |
Definition at line 1139 of file res_http_websocket.c.
References ast_tcptls_session_args::accept_fd, ao2_alloc, ao2_ref, args, ast_free, ast_log, ast_sockaddr_copy(), ast_sockaddr_resolve(), LOG_ERROR, ast_tcptls_session_args::name, NULL, ast_tcptls_session_args::remote_address, ast_tcptls_session_args::tls_cfg, websocket_client_args_destroy(), WS_ALLOCATE_ERROR, and WS_URI_RESOLVE_ERROR.
Referenced by websocket_client_create().
|
static |
Definition at line 1123 of file res_http_websocket.c.
References args, ast_free, ast_ssl_teardown(), ast_tls_config::cafile, ast_tls_config::capath, ast_tls_config::certfile, ast_tls_config::cipher, ast_tls_config::pvtfile, and ast_tcptls_session_args::tls_cfg.
Referenced by websocket_client_args_create().
|
static |
Definition at line 1397 of file res_http_websocket.c.
References ao2_ref, websocket_client::args, ast_iostream_get_ssl(), AST_OPTIONAL_API_NAME, ast_sockaddr_copy(), ast_tcptls_client_create(), ast_tcptls_client_start(), ast_websocket_client_create(), ast_websocket::client, NULL, ast_websocket::remote_address, ast_tcptls_session_instance::remote_address, ast_websocket::secure, websocket_client::ser, ast_websocket::stream, ast_tcptls_session_instance::stream, websocket_client_handshake(), WS_CLIENT_START_ERROR, and WS_OK.
Referenced by ast_websocket_client_create().
|
static |
Definition at line 1224 of file res_http_websocket.c.
References ao2_alloc, ao2_ref, websocket_client::args, ast_log, AST_OPTIONAL_API_NAME, ast_strdup, ast_websocket::client, DEFAULT_RECONSTRUCTION_CEILING, websocket_client::host, websocket_client::key, LOG_ERROR, NULL, ast_websocket::opcode, websocket_client::protocols, ast_websocket::reconstruct, websocket_client::resource_name, session_destroy_fn(), websocket_client::version, websocket_client_args_create(), websocket_client_create_key(), websocket_client_destroy(), websocket_client_parse_uri(), WS_ALLOCATE_ERROR, WS_KEY_ERROR, and WS_URI_PARSE_ERROR.
Referenced by ast_websocket_client_create().
|
static |
Definition at line 1168 of file res_http_websocket.c.
References ast_base64encode(), ast_log, ast_malloc, ast_random(), CLIENT_KEY_SIZE, LOG_ERROR, and NULL.
Referenced by websocket_client_create().
|
static |
Definition at line 1210 of file res_http_websocket.c.
References websocket_client::accept_protocol, ao2_cleanup, websocket_client::args, ast_free, ast_websocket::client, websocket_client::host, websocket_client::key, websocket_client::protocols, websocket_client::resource_name, and websocket_client::ser.
Referenced by websocket_client_create().
|
static |
Definition at line 1275 of file res_http_websocket.c.
References ast_log, websocket_client::host, LOG_ERROR, WS_BAD_REQUEST, WS_INVALID_RESPONSE, and WS_URL_NOT_FOUND.
Referenced by websocket_client_handshake_get_response().
|
static |
Definition at line 1367 of file res_http_websocket.c.
References ast_iostream_printf(), ast_log, ast_str_buffer(), ast_strlen_zero, websocket_client::host, websocket_client::key, LOG_ERROR, websocket_client::protocols, websocket_client::resource_name, websocket_client::ser, ast_tcptls_session_instance::stream, websocket_client::version, websocket_client_handshake_get_response(), and WS_WRITE_ERROR.
Referenced by websocket_client_connect().
|
static |
Definition at line 1300 of file res_http_websocket.c.
References websocket_client::accept_protocol, ast_http_header_match(), ast_http_header_match_in(), ast_http_header_parse(), ast_http_response_status_line(), ast_iostream_gets(), ast_log, ast_strdup, base64, ast_websocket::buf, websocket_client::key, LOG_ERROR, name, websocket_client::protocols, websocket_client::ser, ast_tcptls_session_instance::stream, value, websocket_client_handle_response_code(), websocket_combine_key(), WS_BAD_STATUS, WS_HEADER_MISMATCH, WS_HEADER_MISSING, WS_NOT_SUPPORTED, and WS_OK.
Referenced by websocket_client_handshake().
|
static |
Parse the given uri into a path and remote address.
Expected uri form: [ws[s]]://<host>[:port][/<path>]
The returned host will contain the address and optional port while path will contain everything after the address/port if included.
Definition at line 1093 of file res_http_websocket.c.
References ao2_ref, ast_str_append(), ast_str_create, ast_str_set(), ast_uri_make_host_with_port(), ast_uri_parse_websocket(), ast_uri_path(), and ast_uri_query().
Referenced by websocket_client_create().
|
static |
Definition at line 764 of file res_http_websocket.c.
References ast_alloca, ast_base64encode(), ast_sha1_hash_uint(), and WEBSOCKET_GUID.
Referenced by ast_websocket_uri_cb(), and websocket_client_handshake_get_response().
|
static |
Simple echo implementation which echoes received text and binary frames.
Definition at line 1007 of file res_http_websocket.c.
References ast_debug, ast_fd_set_flags, ast_log, ast_websocket_fd(), AST_WEBSOCKET_OPCODE_BINARY, AST_WEBSOCKET_OPCODE_CLOSE, AST_WEBSOCKET_OPCODE_TEXT, ast_websocket_read(), ast_websocket_unref(), ast_websocket_wait_for_input(), ast_websocket_write(), end, LOG_WARNING, ast_websocket::opcode, ast_websocket::payload, and ast_websocket::payload_len.
Referenced by load_module(), and unload_module().
|
static |
Perform payload masking for client sessions.
Definition at line 288 of file res_http_websocket.c.
References ast_random(), ast_websocket::client, and put_unaligned_uint32().
Referenced by ast_websocket_close(), and ast_websocket_write().
|
static |
Definition at line 363 of file res_http_websocket.c.
References AST_WEBSOCKET_OPCODE_CONTINUATION, AST_WEBSOCKET_OPCODE_PONG, ast_websocket::opcode, and opcode_map.
Referenced by ast_websocket_write().
|
static |
Definition at line 1072 of file res_http_websocket.c.
References ast_websocket_server_remove_protocol(), and ast_http_uri::data.
Referenced by ast_websocket_remove_protocol(), and unload_module().
|
static |
Definition at line 143 of file res_http_websocket.c.
References ao2_alloc, AO2_ALLOC_OPT_LOCK_MUTEX, ao2_cleanup, ao2_container_alloc_hash, ao2_ref, MAX_PROTOCOL_BUCKETS, NULL, protocol_cmp_fn(), protocol_hash_fn(), RAII_VAR, and websocket_server_dtor().
Referenced by ast_websocket_server_create(), and websocket_server_internal_create().
|
static |
Definition at line 136 of file res_http_websocket.c.
References ao2_cleanup, NULL, and ast_websocket_server::protocols.
Referenced by websocket_server_create_impl().
|
static |
Definition at line 162 of file res_http_websocket.c.
References websocket_server_create_impl().
Referenced by load_module().
|
inlinestatic |
Definition at line 534 of file res_http_websocket.c.
References ao2_lock, ao2_unlock, ast_assert, ast_iostream_read(), ast_iostream_wait_for_input(), ast_log, AST_WEBSOCKET_OPCODE_CLOSE, ast_websocket::buf, ast_websocket::closing, errno, len(), LOG_ERROR, LOG_WARNING, and ast_websocket::stream.
Referenced by ast_websocket_read().
|
static |
Definition at line 1529 of file res_http_websocket.c.
|
static |
Definition at line 1529 of file res_http_websocket.c.
|
static |
Definition at line 354 of file res_http_websocket.c.
Referenced by websocket_opcode2str().
|
static |
Definition at line 997 of file res_http_websocket.c.