OpenOCD
|
Go to the source code of this file.
Enumerations | |
enum | shutdown_reason { CONTINUE_MAIN_LOOP , SHUTDOWN_REQUESTED , SHUTDOWN_WITH_ERROR_CODE , SHUTDOWN_WITH_SIGNAL_CODE } |
Functions | |
static int | add_connection (struct service *service, struct command_context *cmd_ctx) |
int | add_service (const struct service_driver *driver, const char *port, int max_connections, void *priv) |
COMMAND_HANDLER (handle_bindto_command) | |
COMMAND_HANDLER (handle_poll_period_command) | |
COMMAND_HANDLER (handle_shutdown_command) | |
COMMAND_HELPER (server_pipe_command, char **out) | |
Defines an extended command handler function declaration to enable access to (and manipulation of) the server port number. More... | |
COMMAND_HELPER (server_port_command, unsigned short *out) | |
int | connection_read (struct connection *connection, void *data, int len) |
int | connection_write (struct connection *connection, const void *data, int len) |
void | exit_on_signal (int sig) |
static void | free_service (struct service *c) |
bool | openocd_is_shutdown_pending (void) |
static int | remove_connection (struct service *service, struct connection *connection) |
static void | remove_connections (struct service *service) |
int | remove_service (const char *name, const char *port) |
static int | remove_services (void) |
void | server_free (void) |
int | server_host_os_close (void) |
int | server_host_os_entry (void) |
int | server_init (struct command_context *cmd_ctx) |
void | server_keep_clients_alive (void) |
int | server_loop (struct command_context *command_context) |
int | server_preinit (void) |
int | server_quit (void) |
int | server_register_commands (struct command_context *cmd_ctx) |
static void | sig_handler (int sig) |
static void | sigkey_handler (int sig) |
Variables | |
static char * | bindto_name |
static int | last_signal |
static int | polling_period = 100 |
static const struct command_registration | server_command_handlers [] |
static struct service * | services |
static enum shutdown_reason | shutdown_openocd = CONTINUE_MAIN_LOOP |
enum shutdown_reason |
|
static |
Definition at line 56 of file server.c.
References alloc_printf(), close_socket(), connection::cmd_ctx, command_done(), CONNECTION_LIMIT_UNLIMITED, CONNECTION_PIPE, CONNECTION_STDINOUT, CONNECTION_TCP, service::connections, copy_command_context(), ERROR_FAIL, ERROR_OK, connection::fd, service::fd, connection::fd_out, flag, connection::input_pending, LOG_ERROR, LOG_INFO, service::max_connections, service::name, service::new_connection, connection::next, NULL, service::port, connection::priv, connection::service, connection::sin, service::sin, and service::type.
Referenced by server_loop().
int add_service | ( | const struct service_driver * | driver, |
const char * | port, | ||
int | max_connections, | ||
void * | priv | ||
) |
Definition at line 197 of file server.c.
References bindto_name, close_socket(), service::connection_closed, service_driver::connection_closed_handler, CONNECTION_PIPE, CONNECTION_STDINOUT, CONNECTION_TCP, service::connections, ERROR_FAIL, ERROR_OK, service::fd, free_service(), service::input, service_driver::input_handler, service::keep_client_alive, service_driver::keep_client_alive_handler, LOG_ERROR, LOG_INFO, LOG_WARNING, service::max_connections, service_driver::name, service::name, service::new_connection, service::new_connection_during_keep_alive, service_driver::new_connection_during_keep_alive_handler, service_driver::new_connection_handler, service::next, NULL, parse_long(), service::port, service::portnumber, priv, service::priv, services, service::sin, socket_nonblock(), and service::type.
Referenced by COMMAND_HANDLER(), gdb_target_start(), ipdbg_start(), jim_arm_tpiu_swo_enable(), jsp_init(), tcl_init(), and telnet_init().
COMMAND_HANDLER | ( | handle_bindto_command | ) |
Definition at line 786 of file server.c.
References bindto_name, CMD, CMD_ARGC, CMD_ARGV, command_print(), ERROR_COMMAND_SYNTAX_ERROR, and ERROR_OK.
COMMAND_HANDLER | ( | handle_poll_period_command | ) |
Definition at line 774 of file server.c.
References CMD_ARGC, CMD_ARGV, COMMAND_PARSE_NUMBER, ERROR_OK, LOG_INFO, LOG_WARNING, and polling_period.
COMMAND_HANDLER | ( | handle_shutdown_command | ) |
Definition at line 756 of file server.c.
References CMD_ARGC, CMD_ARGV, CMD_CTX, command_run_line(), ERROR_COMMAND_CLOSE_CONNECTION, ERROR_FAIL, LOG_USER, shutdown_openocd, SHUTDOWN_REQUESTED, and SHUTDOWN_WITH_ERROR_CODE.
COMMAND_HELPER | ( | server_pipe_command | , |
char ** | out | ||
) |
Defines an extended command handler function declaration to enable access to (and manipulation of) the server port number.
Call server_port like a normal COMMAND_HANDLER with an extra out parameter to receive the specified port number.
Definition at line 864 of file server.c.
References CMD, CMD_ARGC, CMD_ARGV, CMD_CTX, COMMAND_EXEC, command_print(), ERROR_COMMAND_ARGUMENT_INVALID, ERROR_COMMAND_SYNTAX_ERROR, ERROR_OK, and LOG_WARNING.
COMMAND_HELPER | ( | server_port_command | , |
unsigned short * | out | ||
) |
Definition at line 845 of file server.c.
References CMD, CMD_ARGC, CMD_ARGV, COMMAND_PARSE_NUMBER, command_print(), ERROR_COMMAND_SYNTAX_ERROR, and ERROR_OK.
int connection_read | ( | struct connection * | connection, |
void * | data, | ||
int | len | ||
) |
Definition at line 742 of file server.c.
References CONNECTION_TCP, connection::fd, read_socket(), connection::service, and service::type.
Referenced by arm_tpiu_swo_service_input(), ipdbg_on_connection_input(), jsp_input(), rtt_input(), semihosting_redirect_read(), semihosting_service_input_handler(), tcl_input(), and telnet_input().
int connection_write | ( | struct connection * | connection, |
const void * | data, | ||
int | len | ||
) |
Definition at line 730 of file server.c.
References CONNECTION_TCP, connection::fd_out, connection::service, service::type, and write_socket().
Referenced by arm_tpiu_swo_poll_trace(), gdb_write(), ipdbg_move_buffer_to_connection(), read_callback(), semihosting_redirect_write(), tcl_output(), and telnet_write().
void exit_on_signal | ( | int | sig | ) |
Definition at line 721 of file server.c.
Referenced by openocd_main().
|
static |
Definition at line 190 of file server.c.
References service::name, and service::port.
Referenced by add_service(), and remove_service().
bool openocd_is_shutdown_pending | ( | void | ) |
Definition at line 750 of file server.c.
References CONTINUE_MAIN_LOOP, and shutdown_openocd.
|
static |
Definition at line 155 of file server.c.
References close_socket(), connection::cmd_ctx, command_done(), service::connection_closed, CONNECTION_LIMIT_UNLIMITED, CONNECTION_PIPE, CONNECTION_TCP, service::connections, ERROR_OK, connection::fd, service::fd, service::max_connections, connection::next, connection::service, and service::type.
Referenced by remove_connections(), and server_loop().
|
static |
Definition at line 339 of file server.c.
References service::connections, connection::next, and remove_connection().
Referenced by remove_service(), and remove_services().
int remove_service | ( | const char * | name, |
const char * | port | ||
) |
Definition at line 354 of file server.c.
References close_socket(), CONNECTION_STDINOUT, ERROR_OK, service::fd, free_service(), service::name, name, service::next, service::port, service::priv, remove_connections(), services, and service::type.
Referenced by arm_tpiu_swo_close_output(), COMMAND_HANDLER(), and ipdbg_stop().
|
static |
Definition at line 383 of file server.c.
References CONNECTION_PIPE, ERROR_OK, service::fd, service::name, service::next, NULL, service::port, service::priv, remove_connections(), services, and service::type.
Referenced by server_init(), and server_quit().
void server_free | ( | void | ) |
Definition at line 712 of file server.c.
References bindto_name, jsp_service_free(), tcl_service_free(), and telnet_service_free().
Referenced by openocd_main().
int server_host_os_close | ( | void | ) |
int server_host_os_entry | ( | void | ) |
Definition at line 632 of file server.c.
References ERROR_FAIL, ERROR_OK, LOG_ERROR, and WORD.
Referenced by openocd_main().
int server_init | ( | struct command_context * | cmd_ctx | ) |
Definition at line 680 of file server.c.
References ERROR_OK, remove_services(), tcl_init(), and telnet_init().
Referenced by openocd_thread().
void server_keep_clients_alive | ( | void | ) |
Definition at line 413 of file server.c.
References connection::next, service::next, and services.
Referenced by keep_alive().
int server_loop | ( | struct command_context * | command_context | ) |
Definition at line 421 of file server.c.
References add_connection(), close_socket(), command_run_line(), CONNECTION_PIPE, CONNECTION_STDINOUT, CONNECTION_TCP, service::connections, CONTINUE_MAIN_LOOP, ERROR_FAIL, ERROR_OK, connection::fd, service::fd, service::input, connection::input_pending, LOG_ERROR, LOG_INFO, service::max_connections, MSG, service::name, connection::next, service::next, NULL, polling_period, process_jim_events(), remove_connection(), services, shutdown_openocd, SHUTDOWN_REQUESTED, SHUTDOWN_WITH_ERROR_CODE, SHUTDOWN_WITH_SIGNAL_CODE, service::sin, socket_select(), target_call_timer_callbacks(), target_got_message(), target_timer_next_event(), timeval_ms(), timeval::tv_sec, timeval::tv_usec, and service::type.
Referenced by openocd_thread().
int server_preinit | ( | void | ) |
Definition at line 660 of file server.c.
References ERROR_OK, sig_handler(), and sigkey_handler().
Referenced by openocd_thread().
int server_quit | ( | void | ) |
Definition at line 697 of file server.c.
References ERROR_OK, last_signal, remove_services(), and target_quit().
Referenced by openocd_thread().
int server_register_commands | ( | struct command_context * | cmd_ctx | ) |
Definition at line 828 of file server.c.
References ERROR_OK, jsp_register_commands(), NULL, register_commands(), server_command_handlers, tcl_register_commands(), and telnet_register_commands().
Referenced by setup_command_handler().
|
static |
Definition at line 601 of file server.c.
References CONTINUE_MAIN_LOOP, last_signal, LOG_DEBUG, shutdown_openocd, and SHUTDOWN_WITH_SIGNAL_CODE.
Referenced by server_preinit(), and sigkey_handler().
|
static |
Definition at line 620 of file server.c.
References LOG_DEBUG, and sig_handler().
Referenced by server_preinit().
|
static |
Definition at line 54 of file server.c.
Referenced by add_service(), COMMAND_HANDLER(), and server_free().
|
static |
Definition at line 48 of file server.c.
Referenced by openocd_thread(), server_quit(), and sig_handler().
|
static |
Definition at line 51 of file server.c.
Referenced by COMMAND_HANDLER(), and server_loop().
|
static |
Definition at line 786 of file server.c.
Referenced by server_register_commands().
|
static |
Definition at line 37 of file server.c.
Referenced by add_service(), remove_service(), remove_services(), server_keep_clients_alive(), and server_loop().
|
static |
Definition at line 37 of file server.c.
Referenced by COMMAND_HANDLER(), openocd_is_shutdown_pending(), server_loop(), and sig_handler().