![]() |
UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
|
#include "control_socket.h"#include "compat/platform_pipe.h"#include <condition_variable>#include <mutex>#include <queue>#include <string>#include <thread>#include "debug.h"#include "host.h"#include "messaging.h"#include "module.h"#include "rtp/net_udp.h"#include "tv.h"#include "utils/net.h"#include "utils/thread.h"
Go to the source code of this file.
Classes | |
| struct | client |
| struct | control_state |
Macros | |
| #define | CONTROL_CLOSE_HANDLE -2 |
| #define | CONTROL_EXIT -1 |
| #define | is_internal_port(x) |
| #define | MAX_CLIENTS 16 |
| #define | MAX_STAT_EVENT_QUEUE 100 |
| #define | MSG_NOSIGNAL 0 |
| #define | prefix_matches(x, y) |
| #define | suffix(x, y) |
Typedefs | |
| typedef void * | sso_val_type |
Enumerations | |
| enum | connection_type { SERVER , CLIENT } |
Functions | |
| static struct client * | add_client (struct client *clients, fd_t fd) |
| ADD_TO_PARAM ("control-accept-global", "* control-accept-global\n" " Open control socket to public network.\n") | |
| ADD_TO_PARAM ("control-report-audio-ch-count", "* control-report-audio-ch-count=<count>\n" " The number of channels reported over control port.\n") | |
| int | control_audio_ch_report_count (struct control_state *state) |
| void | control_done (struct control_state *s) |
| int | control_init (int port, int connection_type, struct control_state **state, struct module *root_module, int force_ip_version) |
| void | control_report_event (struct control_state *s, const std::string &report_line) |
| void | control_report_stats (struct control_state *s, const std::string &report_line) |
| static void | control_report_stats_event (struct control_state *s, const std::string &report_line) |
| void | control_start (struct control_state *s) |
| bool | control_stats_enabled (struct control_state *s) |
| static void * | control_thread (void *args) |
| static void | new_message (struct module *m) |
| static bool | parse_msg (char *buffer, int buffer_len, char *message, int *new_buffer_len) |
| static void | print_control_help () |
| static struct response * | process_audio_message (struct module *root_module, const char *cmd) |
| static void | process_messages (struct control_state *s) |
| static int | process_msg (struct control_state *s, fd_t client_fd, char *message, struct client *clients) |
| static void | send_response (fd_t fd, struct response *resp) |
| static void | set_socket_nonblock (fd_t fd) |
| static void * | stat_event_thread (void *args) |
| static ssize_t | write_all (fd_t fd, const void *buf, size_t count) |
Definition in file control_socket.cpp.
| #define CONTROL_CLOSE_HANDLE -2 |
Definition at line 113 of file control_socket.cpp.
Referenced by control_thread(), and process_msg().
| #define CONTROL_EXIT -1 |
Definition at line 112 of file control_socket.cpp.
Referenced by control_thread(), and process_msg().
| #define is_internal_port | ( | x | ) |
Definition at line 314 of file control_socket.cpp.
Referenced by control_thread(), and process_msg().
| #define MAX_CLIENTS 16 |
Definition at line 62 of file control_socket.cpp.
Referenced by control_init().
| #define MAX_STAT_EVENT_QUEUE 100 |
Definition at line 86 of file control_socket.cpp.
Referenced by control_report_stats_event().
| #define MSG_NOSIGNAL 0 |
Definition at line 124 of file control_socket.cpp.
Referenced by write_all().
| #define prefix_matches | ( | x, | |
| y ) |
Definition at line 312 of file control_socket.cpp.
Referenced by process_audio_message(), and process_msg().
| #define suffix | ( | x, | |
| y ) |
Definition at line 313 of file control_socket.cpp.
Referenced by get_configured_capture_aliases(), get_interlacing_from_suffix(), get_nth_word(), initialize_import(), process_audio_message(), and process_msg().
| typedef void* sso_val_type |
Definition at line 67 of file control_socket.cpp.
| enum connection_type |
| Enumerator | |
|---|---|
| SERVER | |
| CLIENT | |
Definition at line 81 of file control_socket.cpp.
prepends itself at the head of the list
Definition at line 719 of file control_socket.cpp.
References client::buff_len, client::fd, client::next, and client::prev.
Referenced by control_thread().
| ADD_TO_PARAM | ( | "control-accept-global" | , |
| "* control-accept-global\n" " Open control socket to public network.\n" | ) |
| ADD_TO_PARAM | ( | "control-report-audio-ch-count" | ) |
| int control_audio_ch_report_count | ( | struct control_state * | state | ) |
Definition at line 1021 of file control_socket.cpp.
References state.
Referenced by decode_audio_frame().
| void control_done | ( | struct control_state * | s | ) |
Definition at line 953 of file control_socket.cpp.
References CLOSESOCKET, control_state::connection_type, control_state::control_thread_id, control_state::internal_fd, INVALID_SOCKET, control_state::mod, module_done(), platform_pipe_close(), SERVER, control_state::socket_fd, control_state::started, control_state::stat_event_cv, control_state::stat_event_queue, control_state::stat_event_thread_id, control_state::stats_lock, and write_all().
Referenced by hd_rum_translator_deinit(), and main().

| int control_init | ( | int | port, |
| int | connection_type, | ||
| struct control_state ** | state, | ||
| struct module * | root_module, | ||
| int | force_ip_version ) |
| [in] | force_ip_version | IP version to force (4 or 6). Use 0 to use default (both 4 and 6 if available) |
| 0 | if success |
Definition at line 159 of file control_socket.cpp.
References control_state::audio_channel_report_count, CLIENT, CLOSESOCKET, module::cls, control_state::connection_type, get_commandline_param(), INVALID_SOCKET, LOG_LEVEL_ERROR, log_msg(), MAX_CLIENTS, control_state::mod, MODULE_CLASS_CONTROL, module_init_default(), module_register(), control_state::network_port, module::new_message, new_message(), module::priv_data, control_state::root_module, SERVER, socket_error, control_state::socket_fd, control_state::started, state, and val.
Referenced by main(), and main().

| void control_report_event | ( | struct control_state * | s, |
| const std::string & | report_line ) |
Definition at line 1007 of file control_socket.cpp.
References control_report_stats_event().

| void control_report_stats | ( | struct control_state * | s, |
| const std::string & | report_line ) |
Definition at line 998 of file control_socket.cpp.
References control_report_stats_event(), and control_state::stats_on.
Referenced by decode_audio_frame(), filter(), and report_stats().

|
static |
Definition at line 985 of file control_socket.cpp.
References LOG_LEVEL_WARNING, log_msg(), MAX_STAT_EVENT_QUEUE, control_state::stat_event_cv, control_state::stat_event_queue, and control_state::stats_lock.
Referenced by control_report_event(), and control_report_stats().

| void control_start | ( | struct control_state * | s | ) |
Definition at line 296 of file control_socket.cpp.
References control_thread(), control_state::control_thread_id, control_state::internal_fd, LOG_LEVEL_NOTICE, log_msg(), platform_pipe_init(), control_state::socket_fd, socket_get_recv_port(), control_state::started, stat_event_thread(), and control_state::stat_event_thread_id.
Referenced by main(), and main().

| bool control_stats_enabled | ( | struct control_state * | s | ) |
Definition at line 1016 of file control_socket.cpp.
References control_state::stats_on.
Referenced by decode_audio_frame(), filter(), and report_stats().
|
static |
Definition at line 773 of file control_socket.cpp.
References add_client(), client::buff, client::buff_len, CLIENT, CLOSESOCKET, control_state::connection_type, CONTROL_CLOSE_HANDLE, CONTROL_EXIT, client::fd, get_commandline_param(), control_state::internal_fd, INVALID_SOCKET, is_addr_loopback(), is_internal_port, len, LOG_LEVEL_WARNING, log_msg(), max_fd, client::next, parse_msg(), platform_pipe_close(), PLATFORM_PIPE_READ, client::prev, process_messages(), process_msg(), SERVER, set_socket_nonblock(), set_thread_name(), socket_error, control_state::socket_fd, and write_all().
Referenced by control_start().

|
static |
Definition at line 145 of file control_socket.cpp.
References control_state::internal_fd, LOG_LEVEL_ERROR, log_msg(), module::priv_data, control_state::started, and write_all().
Referenced by compress_process_message(), control_init(), BasicRTSPOnlySubsession::deleteStream(), keyboard_control::impl::exec_external_commands(), keyboard_control::impl::info(), keycontrol_register_key(), keycontrol_send_key(), process_audio_message(), process_msg(), reconfigure_decoder(), keyboard_control::impl::run(), sdp_send_change_address_message(), h264_sdp_video_rxtx::send_frame(), set_fec(), BasicRTSPOnlySubsession::startStream(), Participant_manager::tick(), tx_update(), and vidcap_switcher_register_keyboard_ctl().

|
static |
Definition at line 684 of file control_socket.cpp.
References start().
Referenced by control_thread().

|
static |
Definition at line 1025 of file control_socket.cpp.
References color_printf(), and TBOLD.
Referenced by process_msg().

|
static |
Definition at line 317 of file control_socket.cpp.
References free_message(), new_message(), new_response(), prefix_matches, RECEIVER_MSG_DECREASE_VOLUME, RECEIVER_MSG_INCREASE_VOLUME, RECEIVER_MSG_MUTE, RECEIVER_MSG_MUTE_TOGGLE, RECEIVER_MSG_UNMUTE, RESPONSE_BAD_REQUEST, send_message(), SENDER_MSG_MUTE, SENDER_MSG_UNMUTE, STR_LEN, and suffix.
Referenced by process_msg().

|
static |
Definition at line 733 of file control_socket.cpp.
References check_message(), free_message(), LOG_LEVEL_WARNING, log_msg(), msg_universal::m, control_state::mod, msg, new_response(), process_msg(), RESPONSE_INT_SERV_ERR, RESPONSE_NOT_IMPL, RESPONSE_OK, control_state::socket_fd, socket_get_recv_port(), and msg_universal::text.
Referenced by control_thread().

|
static |
| -1 | exit thread |
| -2 | close handle |
Definition at line 374 of file control_socket.cpp.
References append_message_path(), CHANGE_COMPRESS, CHANGE_PARAMS, CONTROL_CLOSE_HANDLE, CONTROL_EXIT, dump_tree(), exit_uv(), client::fd, free_response(), is_internal_port, LOG_LEVEL_ERROR, LOG_LEVEL_WARNING, log_msg(), MODULE_CLASS_AUDIO, MODULE_CLASS_COMPRESS, module_class_name(), MODULE_CLASS_NONE, MODULE_CLASS_PORT, MODULE_CLASS_RECEIVER, MODULE_CLASS_SENDER, MODULE_CLASS_TX, MSG_UNIVERSAL_TAG_TX, new_message(), new_msg(), new_response(), msg_receiver::new_rx_port, client::next, prefix_matches, print_control_help(), process_audio_message(), RECEIVER_MSG_CHANGE_RX_PORT, RESPONSE_BAD_REQUEST, RESPONSE_INT_SERV_ERR, RESPONSE_NOT_FOUND, RESPONSE_OK, control_state::root_module, msg_sender::rx_port, send_message(), send_response(), SENDER_MSG_CHANGE_PORT, SENDER_MSG_CHANGE_RECEIVER, SENDER_MSG_RESET_SSRC, set_audio_delay(), control_state::stats_on, suffix, TX_MEDIA_AUDIO, TX_MEDIA_VIDEO, msg_sender::tx_port, msg_receiver::type, msg_sender::type, val, and write_all().
Referenced by control_thread(), and process_messages().

Definition at line 663 of file control_socket.cpp.
References free_response(), response_get_status(), response_get_text(), response_status_to_text(), socket_error, and write_all().
Referenced by process_msg().

|
static |
Definition at line 760 of file control_socket.cpp.
Referenced by control_thread().
|
static |
Definition at line 929 of file control_socket.cpp.
References control_state::internal_fd, set_thread_name(), control_state::stat_event_cv, control_state::stat_event_queue, control_state::stats_lock, and write_all().
Referenced by control_start().

|
static |
Definition at line 127 of file control_socket.cpp.
References count, and MSG_NOSIGNAL.
Referenced by control_done(), control_thread(), crash_signal_handler(), hang_signal_handler(), new_message(), print_backtrace(), process_msg(), send_response(), signal_handler(), and stat_event_thread().