OpenOCD
telnet_server.c File Reference
Include dependency graph for telnet_server.c:

Go to the source code of this file.

Macros

#define CTRL(c)   (c - '@')
 
#define TELNET_HISTORY   ".openocd_history"
 

Functions

 COMMAND_HANDLER (handle_telnet_port_command)
 
 COMMAND_HANDLER (handle_exit_command)
 
static void telnet_clear_line (struct connection *connection, struct telnet_connection *t_con)
 
static int telnet_connection_closed (struct connection *connection)
 
static void telnet_history_down (struct connection *connection)
 
static void telnet_history_go (struct connection *connection, int idx)
 
static void telnet_history_up (struct connection *connection)
 
int telnet_init (char *banner)
 
static int telnet_input (struct connection *connection)
 
static void telnet_load_history (struct telnet_connection *t_con)
 
static void telnet_log_callback (void *priv, const char *file, unsigned line, const char *function, const char *string)
 
static int telnet_new_connection (struct connection *connection)
 
static int telnet_output (struct command_context *cmd_ctx, const char *line)
 
static int telnet_outputline (struct connection *connection, const char *line)
 
static int telnet_prompt (struct connection *connection)
 
int telnet_register_commands (struct command_context *cmd_ctx)
 
static void telnet_save_history (struct telnet_connection *t_con)
 
static int telnet_write (struct connection *connection, const void *data, int len)
 

Variables

static char * negotiate
 
static const struct
command_registration 
telnet_command_handlers []
 
static char * telnet_port
 

Macro Definition Documentation

#define CTRL (   c)    (c - '@')

Definition at line 41 of file telnet_server.c.

Referenced by telnet_input().

#define TELNET_HISTORY   ".openocd_history"

Definition at line 42 of file telnet_server.c.

Referenced by telnet_load_history(), and telnet_save_history().

Function Documentation

COMMAND_HANDLER ( handle_telnet_port_command  )

Definition at line 649 of file telnet_server.c.

References CALL_COMMAND_HANDLER, and telnet_port.

COMMAND_HANDLER ( handle_exit_command  )

Definition at line 654 of file telnet_server.c.

References ERROR_COMMAND_CLOSE_CONNECTION.

static void telnet_clear_line ( struct connection connection,
struct telnet_connection t_con 
)
static
static void telnet_history_down ( struct connection connection)
static
static void telnet_history_up ( struct connection connection)
static
static void telnet_log_callback ( void *  priv,
const char *  file,
unsigned  line,
const char *  function,
const char *  string 
)
static
static int telnet_output ( struct command_context cmd_ctx,
const char *  line 
)
static

Definition at line 92 of file telnet_server.c.

References command_context::output_handler_priv, and telnet_outputline().

Referenced by telnet_new_connection().

static int telnet_outputline ( struct connection connection,
const char *  line 
)
static

Definition at line 68 of file telnet_server.c.

References ERROR_OK, telnet_connection::line, and telnet_write().

Referenced by telnet_log_callback(), and telnet_output().

static int telnet_prompt ( struct connection connection)
static
int telnet_register_commands ( struct command_context cmd_ctx)

Definition at line 679 of file telnet_server.c.

References NULL, register_commands(), and telnet_port.

Referenced by server_register_commands().

static void telnet_save_history ( struct telnet_connection t_con)
static
static int telnet_write ( struct connection connection,
const void *  data,
int  len 
)
static

Variable Documentation

char* negotiate
static
Initial value:
=
"\xFF\xFB\x03"
"\xFF\xFB\x01"
"\xFF\xFD\x03"
"\xFF\xFE\x01"

Definition at line 35 of file telnet_server.c.

Referenced by telnet_new_connection().

const struct command_registration telnet_command_handlers[]
static
Initial value:
= {
{
.name = "exit",
.handler = handle_exit_command,
.mode = COMMAND_EXEC,
.usage = "",
.help = "exit telnet session",
},
{
.name = "telnet_port",
.handler = handle_telnet_port_command,
.mode = COMMAND_ANY,
.help = "Specify port on which to listen "
"for incoming telnet connections. "
"Read help on 'gdb_port'.",
.usage = "[port_num]",
},
}
#define COMMAND_REGISTRATION_DONE
Use this as the last entry in an array of command_registration records.
Definition: command.h:222

Definition at line 659 of file telnet_server.c.

char* telnet_port
static

Definition at line 33 of file telnet_server.c.

Referenced by COMMAND_HANDLER(), telnet_init(), and telnet_register_commands().