FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
cli.c File Reference

Unix stdin/socket command line interface. Provides a command line interface so humans can interact with VPP. This is predominantly a debugging and testing mechanism. More...

+ Include dependency graph for cli.c:

Go to the source code of this file.

Data Structures

struct  unix_cli_banner_t
 A CLI banner line. More...
 
struct  unix_cli_pager_index_t
 Pager line index. More...
 
struct  unix_cli_file_t
 Unix CLI session. More...
 
struct  unix_cli_parse_actions_t
 Mapping of input buffer strings to action values. More...
 
struct  unix_cli_new_session_t
 Each new session is stored on a list with a deadline after which a prompt is issued, in case the session TELNET negotiation fails to complete. More...
 
struct  unix_cli_main_t
 CLI global state. More...
 

Macros

#define ESC   "\x1b"
 ANSI escape code. More...
 
#define CSI   ESC "["
 ANSI Control Sequence Introducer. More...
 
#define ANSI_CLEAR   CSI "2J" CSI "1;1H"
 ANSI clear screen. More...
 
#define ANSI_RESET   CSI "0m"
 ANSI reset color settings. More...
 
#define ANSI_BOLD   CSI "1m"
 ANSI Start bold text. More...
 
#define ANSI_DIM   CSI "2m"
 ANSI Stop bold text. More...
 
#define ANSI_DRED   ANSI_DIM CSI "31m"
 ANSI Start dark red text. More...
 
#define ANSI_BRED   ANSI_BOLD CSI "31m"
 ANSI Start bright red text. More...
 
#define ANSI_CLEARLINE   CSI "2K"
 ANSI clear line cursor is on. More...
 
#define ANSI_SCROLLDN   CSI "1T"
 ANSI scroll screen down one line. More...
 
#define ANSI_SAVECURSOR   CSI "s"
 ANSI save cursor position. More...
 
#define ANSI_RESTCURSOR   CSI "u"
 ANSI restore cursor position if previously saved. More...
 
#define UNIX_CLI_MAX_DEPTH_TELNET   32
 Maximum depth into a byte stream from which to compile a Telnet protocol message. More...
 
#define UNIX_CLI_MAX_TERMINAL_WIDTH   512
 Maximum terminal width we will accept. More...
 
#define UNIX_CLI_MAX_TERMINAL_HEIGHT   512
 Maximum terminal height we will accept. More...
 
#define UNIX_CLI_DEFAULT_TERMINAL_HEIGHT   24
 Default terminal height. More...
 
#define UNIX_CLI_DEFAULT_TERMINAL_WIDTH   80
 Default terminal width. More...
 
#define CTL(c)   (u8[]){ (c) - '@', 0 }
 Given a capital ASCII letter character return a NUL terminated string with the control code for that letter. More...
 
#define fl(x, y)   ( (x) ? toupper((y)) : tolower((y)) )
 
#define MAX_CLI_WAIT   86400
 

Enumerations

enum  unix_cli_parse_action_t {
  UNIX_CLI_PARSE_ACTION_NOACTION = 0, UNIX_CLI_PARSE_ACTION_CRLF, UNIX_CLI_PARSE_ACTION_TAB, UNIX_CLI_PARSE_ACTION_ERASE,
  UNIX_CLI_PARSE_ACTION_ERASERIGHT, UNIX_CLI_PARSE_ACTION_UP, UNIX_CLI_PARSE_ACTION_DOWN, UNIX_CLI_PARSE_ACTION_LEFT,
  UNIX_CLI_PARSE_ACTION_RIGHT, UNIX_CLI_PARSE_ACTION_HOME, UNIX_CLI_PARSE_ACTION_END, UNIX_CLI_PARSE_ACTION_WORDLEFT,
  UNIX_CLI_PARSE_ACTION_WORDRIGHT, UNIX_CLI_PARSE_ACTION_ERASELINELEFT, UNIX_CLI_PARSE_ACTION_ERASELINERIGHT, UNIX_CLI_PARSE_ACTION_ERASEWORDLEFT,
  UNIX_CLI_PARSE_ACTION_CLEAR, UNIX_CLI_PARSE_ACTION_REVSEARCH, UNIX_CLI_PARSE_ACTION_FWDSEARCH, UNIX_CLI_PARSE_ACTION_YANK,
  UNIX_CLI_PARSE_ACTION_TELNETIAC, UNIX_CLI_PARSE_ACTION_PAGER_CRLF, UNIX_CLI_PARSE_ACTION_PAGER_QUIT, UNIX_CLI_PARSE_ACTION_PAGER_NEXT,
  UNIX_CLI_PARSE_ACTION_PAGER_DN, UNIX_CLI_PARSE_ACTION_PAGER_UP, UNIX_CLI_PARSE_ACTION_PAGER_TOP, UNIX_CLI_PARSE_ACTION_PAGER_BOTTOM,
  UNIX_CLI_PARSE_ACTION_PAGER_PGDN, UNIX_CLI_PARSE_ACTION_PAGER_PGUP, UNIX_CLI_PARSE_ACTION_PAGER_REDRAW, UNIX_CLI_PARSE_ACTION_PAGER_SEARCH,
  UNIX_CLI_PARSE_ACTION_PARTIALMATCH, UNIX_CLI_PARSE_ACTION_NOMATCH
}
 CLI actions. More...
 
enum  unix_cli_timeout_event_type_t { UNIX_CLI_NEW_SESSION_EVENT_ADD }
 CLI session telnet negotiation timer events. More...
 

Functions

static void unix_cli_pager_reset (unix_cli_file_t *f)
 Resets the pager buffer and other data. More...
 
static void unix_cli_file_free (unix_cli_file_t *f)
 Release storage used by a CLI session. More...
 
static clib_macro_main_tget_macro_main (void)
 Return the macro main / tables we should use for this session. More...
 
static unix_cli_parse_action_t unix_cli_match_action (unix_cli_parse_actions_t *a, u8 *input, u32 ilen, i32 *matched)
 Search for a byte sequence in the action list. More...
 
static void unix_cli_add_pending_output (clib_file_t *uf, unix_cli_file_t *cf, u8 *buffer, uword buffer_bytes)
 Add bytes to the output vector and then flagg the I/O system that bytes are available to be sent. More...
 
static void unix_cli_del_pending_output (clib_file_t *uf, unix_cli_file_t *cf, uword n_bytes)
 Delete all bytes from the output vector and flag the I/O system that no more bytes are available to be sent. More...
 
static word unix_vlib_findchr (u8 chr, u8 *str, word len)
 A bit like strchr with a buffer length limit. More...
 
static void unix_vlib_cli_output_raw (unix_cli_file_t *cf, clib_file_t *uf, u8 *buffer, uword buffer_bytes)
 Send a buffer to the CLI stream if possible, enqueue it otherwise. More...
 
static void unix_vlib_cli_output_cooked (unix_cli_file_t *cf, clib_file_t *uf, u8 *buffer, uword buffer_bytes)
 Process a buffer for CRLF handling before outputting it to the CLI. More...
 
static void unix_vlib_cli_output_cursor_left (unix_cli_file_t *cf, clib_file_t *uf)
 Moves the terminal cursor one character to the left, with special handling when it reaches the left edge of the terminal window. More...
 
static void unix_cli_cli_prompt (unix_cli_file_t *cf, clib_file_t *uf)
 Output the CLI prompt. More...
 
static void unix_cli_pager_prompt (unix_cli_file_t *cf, clib_file_t *uf)
 Output a pager prompt and show number of buffered lines. More...
 
static void unix_cli_pager_message (unix_cli_file_t *cf, clib_file_t *uf, char *message, char *postfix)
 Output a pager "skipping" message. More...
 
static void unix_cli_pager_prompt_erase (unix_cli_file_t *cf, clib_file_t *uf)
 Erase the printed pager prompt. More...
 
static void unix_cli_ansi_cursor (unix_cli_file_t *cf, clib_file_t *uf, u16 x, u16 y)
 Uses an ANSI escape sequence to move the cursor. More...
 
static void unix_cli_pager_redraw (unix_cli_file_t *cf, clib_file_t *uf)
 Redraw the currently displayed page of text. More...
 
static void unix_cli_pager_add_line (unix_cli_file_t *cf, u8 *line, word len_or_index)
 Process and add a line to the pager index. More...
 
static void unix_cli_pager_reindex (unix_cli_file_t *cf)
 Reindex entire pager buffer. More...
 
static void unix_vlib_cli_output (uword cli_file_index, u8 *buffer, uword buffer_bytes)
 VLIB CLI output function. More...
 
static u8 unix_cli_terminal_type_ansi (u8 *term, uword len)
 Identify whether a terminal type is ANSI capable. More...
 
static u8 unix_cli_terminal_type_noninteractive (u8 *term, uword len)
 Identify whether a terminal type is non-interactive. More...
 
static void unix_cli_set_session_noninteractive (unix_cli_file_t *cf)
 Set a session to be non-interactive. More...
 
static void unix_cli_file_welcome (unix_cli_main_t *cm, unix_cli_file_t *cf)
 Emit initial welcome banner and prompt on a connection. More...
 
static uword unix_cli_new_session_process (vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
 A failsafe manager that ensures CLI sessions issue an initial prompt if TELNET negotiation fails. More...
 
static i32 unix_cli_process_telnet (unix_main_t *um, unix_cli_file_t *cf, clib_file_t *uf, u8 *input_vector, uword len)
 A mostly no-op Telnet state machine. More...
 
static int unix_cli_line_process_one (unix_cli_main_t *cm, unix_main_t *um, unix_cli_file_t *cf, clib_file_t *uf, u8 input, unix_cli_parse_action_t action)
 Process actionable input. More...
 
static int unix_cli_line_edit (unix_cli_main_t *cm, unix_main_t *um, clib_file_main_t *fm, unix_cli_file_t *cf)
 Process input bytes on a stream to provide line editing and command history in the CLI. More...
 
static void unix_cli_process_input (unix_cli_main_t *cm, uword cli_file_index)
 Process input to a CLI session. More...
 
static void unix_cli_kill (unix_cli_main_t *cm, uword cli_file_index)
 Destroy a CLI session. More...
 
static uword unix_cli_process (vlib_main_t *vm, vlib_node_runtime_t *rt, vlib_frame_t *f)
 Handle system events. More...
 
static clib_error_tunix_cli_write_ready (clib_file_t *uf)
 Called when a CLI session file descriptor can be written to without blocking. More...
 
static clib_error_tunix_cli_read_ready (clib_file_t *uf)
 Called when a CLI session file descriptor has data to be read. More...
 
static clib_error_tunix_cli_error_detected (clib_file_t *uf)
 Called when a CLI session file descriptor has an error condition. More...
 
static u32 unix_cli_file_add (unix_cli_main_t *cm, char *name, int fd)
 Store a new CLI session. More...
 
static clib_error_tunix_cli_listen_read_ready (clib_file_t *uf)
 Telnet listening socket has a new connection. More...
 
static void unix_cli_resize_interrupt (int signum)
 The system terminal has informed us that the window size has changed. More...
 
static clib_error_tunix_cli_config (vlib_main_t *vm, unformat_input_t *input)
 Handle configuration directives in the unix section. More...
 
static clib_error_tunix_cli_exit (vlib_main_t *vm)
 Called when VPP is shutting down, this restores the system terminal state if previously saved. More...
 
void vlib_unix_cli_set_prompt (char *prompt)
 Set the CLI prompt. More...
 
static unix_cli_file_tunix_cli_file_if_exists (unix_cli_main_t *cm)
 
static unix_cli_file_tunix_cli_file_if_interactive (unix_cli_main_t *cm)
 
static clib_error_tunix_cli_quit (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 CLI command to quit the terminal session. More...
 
static clib_error_tunix_cli_exec (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 CLI command to execute a VPP command script. More...
 
static clib_error_tunix_show_errors (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 CLI command to show various unix error statistics. More...
 
static clib_error_tunix_show_files (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 CLI command to show various unix error statistics. More...
 
static clib_error_tunix_cli_show_history (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 CLI command to show session command history. More...
 
static clib_error_tunix_cli_show_terminal (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 CLI command to show terminal status. More...
 
static clib_error_tunix_cli_show_cli_sessions (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 CLI command to display a list of CLI sessions. More...
 
static clib_error_tunix_cli_set_terminal_pager (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 CLI command to set terminal pager settings. More...
 
static clib_error_tunix_cli_set_terminal_history (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 CLI command to set terminal history settings. More...
 
static clib_error_tunix_cli_set_terminal_ansi (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 CLI command to set terminal ANSI settings. More...
 
static clib_error_tunix_wait_cmd (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 CLI command to wait <sec> seconds. More...
 
static clib_error_techo_cmd (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static clib_error_tdefine_cmd_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static clib_error_tundefine_cmd_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static clib_error_tshow_macro_cmd_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 
static clib_error_tunix_cli_init (vlib_main_t *vm)
 

Variables

static unix_cli_banner_t unix_cli_banner []
 Plain welcome banner. More...
 
static unix_cli_banner_t unix_cli_banner_color []
 ANSI color welcome banner. More...
 
static unix_cli_parse_actions_t unix_cli_parse_strings []
 Patterns to match on a CLI input stream. More...
 
static unix_cli_parse_actions_t unix_cli_parse_pager []
 Patterns to match when a CLI session is in the pager. More...
 
static unix_cli_main_t unix_cli_main
 CLI global state. More...
 
static vlib_cli_command_t unix_cli_quit_command
 (constructor) VLIB_CLI_COMMAND (unix_cli_quit_command) More...
 
static vlib_cli_command_t unix_cli_q_command
 (constructor) VLIB_CLI_COMMAND (unix_cli_q_command) More...
 
static vlib_cli_command_t cli_exec
 (constructor) VLIB_CLI_COMMAND (cli_exec) More...
 
static vlib_cli_command_t cli_unix_show_errors
 (constructor) VLIB_CLI_COMMAND (cli_unix_show_errors) More...
 
static vlib_cli_command_t cli_unix_show_files
 (constructor) VLIB_CLI_COMMAND (cli_unix_show_files) More...
 
static vlib_cli_command_t cli_unix_cli_show_history
 (constructor) VLIB_CLI_COMMAND (cli_unix_cli_show_history) More...
 
static vlib_cli_command_t cli_unix_cli_show_terminal
 (constructor) VLIB_CLI_COMMAND (cli_unix_cli_show_terminal) More...
 
static vlib_cli_command_t cli_unix_cli_show_cli_sessions
 (constructor) VLIB_CLI_COMMAND (cli_unix_cli_show_cli_sessions) More...
 
static vlib_cli_command_t cli_unix_cli_set_terminal_pager
 (constructor) VLIB_CLI_COMMAND (cli_unix_cli_set_terminal_pager) More...
 
static vlib_cli_command_t cli_unix_cli_set_terminal_history
 (constructor) VLIB_CLI_COMMAND (cli_unix_cli_set_terminal_history) More...
 
static vlib_cli_command_t cli_unix_cli_set_terminal_ansi
 (constructor) VLIB_CLI_COMMAND (cli_unix_cli_set_terminal_ansi) More...
 
static vlib_cli_command_t cli_unix_wait_cmd
 (constructor) VLIB_CLI_COMMAND (cli_unix_wait_cmd) More...
 
static vlib_cli_command_t cli_unix_echo_cmd
 (constructor) VLIB_CLI_COMMAND (cli_unix_echo_cmd) More...
 
static vlib_cli_command_t define_cmd
 (constructor) VLIB_CLI_COMMAND (define_cmd) More...
 
static vlib_cli_command_t undefine_cmd
 (constructor) VLIB_CLI_COMMAND (undefine_cmd) More...
 
static vlib_cli_command_t show_macro
 (constructor) VLIB_CLI_COMMAND (show_macro) More...
 

Detailed Description

Unix stdin/socket command line interface. Provides a command line interface so humans can interact with VPP. This is predominantly a debugging and testing mechanism.

Definition in file cli.c.

Macro Definition Documentation

◆ ANSI_BOLD

#define ANSI_BOLD   CSI "1m"

ANSI Start bold text.

Definition at line 77 of file cli.c.

◆ ANSI_BRED

#define ANSI_BRED   ANSI_BOLD CSI "31m"

ANSI Start bright red text.

Definition at line 83 of file cli.c.

◆ ANSI_CLEAR

#define ANSI_CLEAR   CSI "2J" CSI "1;1H"

ANSI clear screen.

Definition at line 73 of file cli.c.

◆ ANSI_CLEARLINE

#define ANSI_CLEARLINE   CSI "2K"

ANSI clear line cursor is on.

Definition at line 85 of file cli.c.

◆ ANSI_DIM

#define ANSI_DIM   CSI "2m"

ANSI Stop bold text.

Definition at line 79 of file cli.c.

◆ ANSI_DRED

#define ANSI_DRED   ANSI_DIM CSI "31m"

ANSI Start dark red text.

Definition at line 81 of file cli.c.

◆ ANSI_RESET

#define ANSI_RESET   CSI "0m"

ANSI reset color settings.

Definition at line 75 of file cli.c.

◆ ANSI_RESTCURSOR

#define ANSI_RESTCURSOR   CSI "u"

ANSI restore cursor position if previously saved.

Definition at line 91 of file cli.c.

◆ ANSI_SAVECURSOR

#define ANSI_SAVECURSOR   CSI "s"

ANSI save cursor position.

Definition at line 89 of file cli.c.

◆ ANSI_SCROLLDN

#define ANSI_SCROLLDN   CSI "1T"

ANSI scroll screen down one line.

Definition at line 87 of file cli.c.

◆ CSI

#define CSI   ESC "["

ANSI Control Sequence Introducer.

Definition at line 70 of file cli.c.

◆ CTL

#define CTL (   c)    (u8[]){ (c) - '@', 0 }

Given a capital ASCII letter character return a NUL terminated string with the control code for that letter.

Parameters
cAn ASCII character.
Returns
A NUL terminated string of type u8[].
Example
CTL('A') returns { 0x01, 0x00 } as a u8[].

Definition at line 342 of file cli.c.

◆ ESC

#define ESC   "\x1b"

ANSI escape code.

Definition at line 67 of file cli.c.

◆ fl

#define fl (   x,
 
)    ( (x) ? toupper((y)) : tolower((y)) )

◆ MAX_CLI_WAIT

#define MAX_CLI_WAIT   86400

Definition at line 3970 of file cli.c.

◆ UNIX_CLI_DEFAULT_TERMINAL_HEIGHT

#define UNIX_CLI_DEFAULT_TERMINAL_HEIGHT   24

Default terminal height.

Definition at line 102 of file cli.c.

◆ UNIX_CLI_DEFAULT_TERMINAL_WIDTH

#define UNIX_CLI_DEFAULT_TERMINAL_WIDTH   80

Default terminal width.

Definition at line 104 of file cli.c.

◆ UNIX_CLI_MAX_DEPTH_TELNET

#define UNIX_CLI_MAX_DEPTH_TELNET   32

Maximum depth into a byte stream from which to compile a Telnet protocol message.

This is a safety measure.

Definition at line 95 of file cli.c.

◆ UNIX_CLI_MAX_TERMINAL_HEIGHT

#define UNIX_CLI_MAX_TERMINAL_HEIGHT   512

Maximum terminal height we will accept.

Definition at line 100 of file cli.c.

◆ UNIX_CLI_MAX_TERMINAL_WIDTH

#define UNIX_CLI_MAX_TERMINAL_WIDTH   512

Maximum terminal width we will accept.

Definition at line 98 of file cli.c.

Enumeration Type Documentation

◆ unix_cli_parse_action_t

CLI actions.

Enumerator
UNIX_CLI_PARSE_ACTION_NOACTION 

No action.

UNIX_CLI_PARSE_ACTION_CRLF 

Carriage return, newline or enter.

UNIX_CLI_PARSE_ACTION_TAB 

Tab key.

UNIX_CLI_PARSE_ACTION_ERASE 

Erase cursor left.

UNIX_CLI_PARSE_ACTION_ERASERIGHT 

Erase cursor right.

UNIX_CLI_PARSE_ACTION_UP 

Up arrow.

UNIX_CLI_PARSE_ACTION_DOWN 

Down arrow.

UNIX_CLI_PARSE_ACTION_LEFT 

Left arrow.

UNIX_CLI_PARSE_ACTION_RIGHT 

Right arrow.

UNIX_CLI_PARSE_ACTION_HOME 

Home key (jump to start of line)

UNIX_CLI_PARSE_ACTION_END 

End key (jump to end of line)

UNIX_CLI_PARSE_ACTION_WORDLEFT 

Jump cursor to start of left word.

UNIX_CLI_PARSE_ACTION_WORDRIGHT 

Jump cursor to start of right word.

UNIX_CLI_PARSE_ACTION_ERASELINELEFT 

Erase line to left of cursor.

UNIX_CLI_PARSE_ACTION_ERASELINERIGHT 

Erase line to right & including cursor.

UNIX_CLI_PARSE_ACTION_ERASEWORDLEFT 

Erase word left.

UNIX_CLI_PARSE_ACTION_CLEAR 

Clear the terminal.

UNIX_CLI_PARSE_ACTION_REVSEARCH 

Search backwards in command history.

UNIX_CLI_PARSE_ACTION_FWDSEARCH 

Search forwards in command history.

UNIX_CLI_PARSE_ACTION_YANK 

Undo last erase action.

UNIX_CLI_PARSE_ACTION_TELNETIAC 

Telnet control code.

UNIX_CLI_PARSE_ACTION_PAGER_CRLF 

Enter pressed (CR, CRLF, LF, etc)

UNIX_CLI_PARSE_ACTION_PAGER_QUIT 

Exit the pager session.

UNIX_CLI_PARSE_ACTION_PAGER_NEXT 

Scroll to next page.

UNIX_CLI_PARSE_ACTION_PAGER_DN 

Scroll to next line.

UNIX_CLI_PARSE_ACTION_PAGER_UP 

Scroll to previous line.

UNIX_CLI_PARSE_ACTION_PAGER_TOP 

Scroll to first line.

UNIX_CLI_PARSE_ACTION_PAGER_BOTTOM 

Scroll to last line.

UNIX_CLI_PARSE_ACTION_PAGER_PGDN 

Scroll to next page.

UNIX_CLI_PARSE_ACTION_PAGER_PGUP 

Scroll to previous page.

UNIX_CLI_PARSE_ACTION_PAGER_REDRAW 

Clear and redraw the page on the terminal.

UNIX_CLI_PARSE_ACTION_PAGER_SEARCH 

Search the pager buffer.

UNIX_CLI_PARSE_ACTION_PARTIALMATCH 

Action parser found a partial match.

UNIX_CLI_PARSE_ACTION_NOMATCH 

Action parser did not find any match.

Definition at line 282 of file cli.c.

◆ unix_cli_timeout_event_type_t

CLI session telnet negotiation timer events.

Enumerator
UNIX_CLI_NEW_SESSION_EVENT_ADD 

Add a CLI session to the new session list.

Definition at line 453 of file cli.c.

Function Documentation

◆ define_cmd_fn()

static clib_error_t* define_cmd_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 4037 of file cli.c.

+ Here is the call graph for this function:

◆ echo_cmd()

static clib_error_t* echo_cmd ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 4010 of file cli.c.

+ Here is the call graph for this function:

◆ get_macro_main()

static clib_macro_main_t* get_macro_main ( void  )
static

Return the macro main / tables we should use for this session.

Definition at line 502 of file cli.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ show_macro_cmd_fn()

static clib_error_t* show_macro_cmd_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 4101 of file cli.c.

+ Here is the call graph for this function:

◆ undefine_cmd_fn()

static clib_error_t* undefine_cmd_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 4076 of file cli.c.

+ Here is the call graph for this function:

◆ unix_cli_add_pending_output()

static void unix_cli_add_pending_output ( clib_file_t uf,
unix_cli_file_t cf,
u8 buffer,
uword  buffer_bytes 
)
static

Add bytes to the output vector and then flagg the I/O system that bytes are available to be sent.

Definition at line 579 of file cli.c.

+ Here is the caller graph for this function:

◆ unix_cli_ansi_cursor()

static void unix_cli_ansi_cursor ( unix_cli_file_t cf,
clib_file_t uf,
u16  x,
u16  y 
)
static

Uses an ANSI escape sequence to move the cursor.

Definition at line 879 of file cli.c.

+ Here is the call graph for this function:

◆ unix_cli_cli_prompt()

static void unix_cli_cli_prompt ( unix_cli_file_t cf,
clib_file_t uf 
)
static

Output the CLI prompt.

Definition at line 807 of file cli.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unix_cli_config()

static clib_error_t* unix_cli_config ( vlib_main_t vm,
unformat_input_t input 
)
static

Handle configuration directives in the unix section.

Definition at line 3112 of file cli.c.

+ Here is the call graph for this function:

◆ unix_cli_del_pending_output()

static void unix_cli_del_pending_output ( clib_file_t uf,
unix_cli_file_t cf,
uword  n_bytes 
)
static

Delete all bytes from the output vector and flag the I/O system that no more bytes are available to be sent.

Definition at line 599 of file cli.c.

+ Here is the caller graph for this function:

◆ unix_cli_error_detected()

static clib_error_t* unix_cli_error_detected ( clib_file_t uf)
static

Called when a CLI session file descriptor has an error condition.

Definition at line 2851 of file cli.c.

+ Here is the call graph for this function:

◆ unix_cli_exec()

static clib_error_t* unix_cli_exec ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

CLI command to execute a VPP command script.

Definition at line 3363 of file cli.c.

+ Here is the call graph for this function:

◆ unix_cli_exit()

static clib_error_t* unix_cli_exit ( vlib_main_t vm)
static

Called when VPP is shutting down, this restores the system terminal state if previously saved.

Definition at line 3269 of file cli.c.

◆ unix_cli_file_add()

static u32 unix_cli_file_add ( unix_cli_main_t cm,
char *  name,
int  fd 
)
static

Store a new CLI session.

Parameters
nameThe name of the session.
fdThe file descriptor for the session I/O.
Returns
The session ID.

Definition at line 2873 of file cli.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unix_cli_file_free()

static void unix_cli_file_free ( unix_cli_file_t f)
inlinestatic

Release storage used by a CLI session.

Parameters
fThe CLI session whose storage needs to be released.

Definition at line 274 of file cli.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unix_cli_file_if_exists()

static unix_cli_file_t* unix_cli_file_if_exists ( unix_cli_main_t cm)
static

Definition at line 3298 of file cli.c.

+ Here is the caller graph for this function:

◆ unix_cli_file_if_interactive()

static unix_cli_file_t* unix_cli_file_if_interactive ( unix_cli_main_t cm)
static

Definition at line 3306 of file cli.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unix_cli_file_welcome()

static void unix_cli_file_welcome ( unix_cli_main_t cm,
unix_cli_file_t cf 
)
static

Emit initial welcome banner and prompt on a connection.

Definition at line 1238 of file cli.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unix_cli_init()

static clib_error_t* unix_cli_init ( vlib_main_t vm)
static

Definition at line 4125 of file cli.c.

+ Here is the call graph for this function:

◆ unix_cli_kill()

static void unix_cli_kill ( unix_cli_main_t cm,
uword  cli_file_index 
)
static

Destroy a CLI session.

Note
If we destroy the stdin session this additionally signals the shutdown of VPP.

Definition at line 2678 of file cli.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unix_cli_line_edit()

static int unix_cli_line_edit ( unix_cli_main_t cm,
unix_main_t um,
clib_file_main_t fm,
unix_cli_file_t cf 
)
static

Process input bytes on a stream to provide line editing and command history in the CLI.

Definition at line 2451 of file cli.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unix_cli_line_process_one()

static int unix_cli_line_process_one ( unix_cli_main_t cm,
unix_main_t um,
unix_cli_file_t cf,
clib_file_t uf,
u8  input,
unix_cli_parse_action_t  action 
)
static

Process actionable input.

Based on the action process the input; this typically involves searching the command history or editing the current command line.

Definition at line 1542 of file cli.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unix_cli_listen_read_ready()

static clib_error_t* unix_cli_listen_read_ready ( clib_file_t uf)
static

Telnet listening socket has a new connection.

Definition at line 2968 of file cli.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unix_cli_match_action()

static unix_cli_parse_action_t unix_cli_match_action ( unix_cli_parse_actions_t a,
u8 input,
u32  ilen,
i32 matched 
)
static

Search for a byte sequence in the action list.

Searches the unix_cli_parse_actions_t list in a for a match with the bytes in input of maximum length ilen bytes. When a match is made *matched indicates how many bytes were matched. Returns a value from the enum unix_cli_parse_action_t to indicate whether no match was found, a partial match was found or a complete match was found and what action, if any, should be taken.

Parameters
[in]aActions list to search within.
[in]inputString fragment to search for.
[in]ilenLength of the string in 'input'.
[out]matchedPointer to an integer that will contain the number of bytes matched when a complete match is found.
Returns
Action from unix_cli_parse_action_t that the string fragment matches. UNIX_CLI_PARSE_ACTION_PARTIALMATCH is returned when the whole input string matches the start of at least one action. UNIX_CLI_PARSE_ACTION_NOMATCH is returned when there is no match at all.

Definition at line 541 of file cli.c.

+ Here is the caller graph for this function:

◆ unix_cli_new_session_process()

static uword unix_cli_new_session_process ( vlib_main_t vm,
vlib_node_runtime_t rt,
vlib_frame_t f 
)
static

A failsafe manager that ensures CLI sessions issue an initial prompt if TELNET negotiation fails.

Definition at line 1289 of file cli.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unix_cli_pager_add_line()

static void unix_cli_pager_add_line ( unix_cli_file_t cf,
u8 line,
word  len_or_index 
)
static

Process and add a line to the pager index.

In normal operation this function will take the given character string found in line and with length len_or_index and iterates the over the contents, adding each line of text discovered within it to the pager index. Lines are identified by newlines ("<code>\\n</code>") and by strings longer than the width of the terminal.

If instead line is NULL then len_or_index is taken to mean the index of an existing line in the pager buffer; this simply means that the input line does not need to be cloned since we already have it. This is typical if we are reindexing the pager buffer.

Parameters
cfThe CLI session whose pager we are adding to.
lineThe string of text to be indexed into the pager buffer. If line is NULL then the mode of operation changes slightly; see the description above.
len_or_indexIf line is a pointer to a string then this parameter indicates the length of that string; Otherwise this value provides the index in the pager buffer of an existing string to be indexed.

Definition at line 956 of file cli.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unix_cli_pager_message()

static void unix_cli_pager_message ( unix_cli_file_t cf,
clib_file_t uf,
char *  message,
char *  postfix 
)
static

Output a pager "skipping" message.

Definition at line 841 of file cli.c.

+ Here is the call graph for this function:

◆ unix_cli_pager_prompt()

static void unix_cli_pager_prompt ( unix_cli_file_t cf,
clib_file_t uf 
)
static

Output a pager prompt and show number of buffered lines.

Definition at line 818 of file cli.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unix_cli_pager_prompt_erase()

static void unix_cli_pager_prompt_erase ( unix_cli_file_t cf,
clib_file_t uf 
)
static

Erase the printed pager prompt.

Definition at line 857 of file cli.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unix_cli_pager_redraw()

static void unix_cli_pager_redraw ( unix_cli_file_t cf,
clib_file_t uf 
)
static

Redraw the currently displayed page of text.

Parameters
cfCLI session to redraw the pager buffer of.
ufUnix file of the CLI session.

Definition at line 895 of file cli.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unix_cli_pager_reindex()

static void unix_cli_pager_reindex ( unix_cli_file_t cf)
static

Reindex entire pager buffer.

Resets the current pager index and then re-adds the lines in the pager buffer to the index.

Additionally this function attempts to retain the current page start line offset by searching for the same top-of-screen line in the new index.

Parameters
cfThe CLI session whose pager buffer should be reindexed.

Definition at line 1018 of file cli.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unix_cli_pager_reset()

static void unix_cli_pager_reset ( unix_cli_file_t f)
inlinestatic

Resets the pager buffer and other data.

Parameters
fThe CLI session whose pager needs to be reset.

Definition at line 253 of file cli.c.

+ Here is the caller graph for this function:

◆ unix_cli_process()

static uword unix_cli_process ( vlib_main_t vm,
vlib_node_runtime_t rt,
vlib_frame_t f 
)
static

Handle system events.

Definition at line 2726 of file cli.c.

+ Here is the call graph for this function:

◆ unix_cli_process_input()

static void unix_cli_process_input ( unix_cli_main_t cm,
uword  cli_file_index 
)
static

Process input to a CLI session.

Definition at line 2541 of file cli.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unix_cli_process_telnet()

static i32 unix_cli_process_telnet ( unix_main_t um,
unix_cli_file_t cf,
clib_file_t uf,
u8 input_vector,
uword  len 
)
static

A mostly no-op Telnet state machine.

Process Telnet command bytes in a way that ensures we're mostly transparent to the Telnet protocol. That is, it's mostly a no-op.

Returns
-1 if we need more bytes, otherwise a positive integer number of bytes to consume from the input_vector, not including the initial IAC byte.

Definition at line 1396 of file cli.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unix_cli_quit()

static clib_error_t* unix_cli_quit ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

CLI command to quit the terminal session.

Note
If this is a stdin session then this will shutdown VPP also.

Definition at line 3319 of file cli.c.

+ Here is the call graph for this function:

◆ unix_cli_read_ready()

static clib_error_t* unix_cli_read_ready ( clib_file_t uf)
static

Called when a CLI session file descriptor has data to be read.

Definition at line 2812 of file cli.c.

◆ unix_cli_resize_interrupt()

static void unix_cli_resize_interrupt ( int  signum)
static

The system terminal has informed us that the window size has changed.

Definition at line 3072 of file cli.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unix_cli_set_session_noninteractive()

static void unix_cli_set_session_noninteractive ( unix_cli_file_t cf)
static

Set a session to be non-interactive.

Definition at line 1226 of file cli.c.

+ Here is the caller graph for this function:

◆ unix_cli_set_terminal_ansi()

static clib_error_t* unix_cli_set_terminal_ansi ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

CLI command to set terminal ANSI settings.

Definition at line 3932 of file cli.c.

+ Here is the call graph for this function:

◆ unix_cli_set_terminal_history()

static clib_error_t* unix_cli_set_terminal_history ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

CLI command to set terminal history settings.

Definition at line 3861 of file cli.c.

+ Here is the call graph for this function:

◆ unix_cli_set_terminal_pager()

static clib_error_t* unix_cli_set_terminal_pager ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

CLI command to set terminal pager settings.

Definition at line 3804 of file cli.c.

+ Here is the call graph for this function:

◆ unix_cli_show_cli_sessions()

static clib_error_t* unix_cli_show_cli_sessions ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

CLI command to display a list of CLI sessions.

Definition at line 3724 of file cli.c.

+ Here is the call graph for this function:

◆ unix_cli_show_history()

static clib_error_t* unix_cli_show_history ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

CLI command to show session command history.

Definition at line 3615 of file cli.c.

+ Here is the call graph for this function:

◆ unix_cli_show_terminal()

static clib_error_t* unix_cli_show_terminal ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

CLI command to show terminal status.

Definition at line 3652 of file cli.c.

+ Here is the call graph for this function:

◆ unix_cli_terminal_type_ansi()

static u8 unix_cli_terminal_type_ansi ( u8 term,
uword  len 
)
static

Identify whether a terminal type is ANSI capable.

Compares the string given in term with a list of terminal types known to support ANSI escape sequences.

This list contains, for example, xterm, screen and ansi.

Parameters
termA string with a terminal type in it.
lenThe length of the string in term.
Returns
1 if the terminal type is recognized as supporting ANSI terminal sequences; 0 otherwise.

Definition at line 1179 of file cli.c.

+ Here is the caller graph for this function:

◆ unix_cli_terminal_type_noninteractive()

static u8 unix_cli_terminal_type_noninteractive ( u8 term,
uword  len 
)
static

Identify whether a terminal type is non-interactive.

Compares the string given in term with a list of terminal types known to be non-interactive, as send by tools such as vppctl .

This list contains, for example, vppctl.

Parameters
termA string with a terminal type in it.
lenThe length of the string in term.
Returns
1 if the terminal type is recognized as being non-interactive; 0 otherwise.

Definition at line 1211 of file cli.c.

+ Here is the caller graph for this function:

◆ unix_cli_write_ready()

static clib_error_t* unix_cli_write_ready ( clib_file_t uf)
static

Called when a CLI session file descriptor can be written to without blocking.

Definition at line 2770 of file cli.c.

+ Here is the call graph for this function:

◆ unix_show_errors()

static clib_error_t* unix_show_errors ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

CLI command to show various unix error statistics.

Definition at line 3497 of file cli.c.

+ Here is the call graph for this function:

◆ unix_show_files()

static clib_error_t* unix_show_files ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

CLI command to show various unix error statistics.

Definition at line 3572 of file cli.c.

+ Here is the call graph for this function:

◆ unix_vlib_cli_output()

static void unix_vlib_cli_output ( uword  cli_file_index,
u8 buffer,
uword  buffer_bytes 
)
static

VLIB CLI output function.

If the terminal has a pager configured then this function takes care of collating output into the pager buffer; ensuring only the first page is displayed and any lines in excess of the first page are buffered.

If the maximum number of index lines in the buffer is exceeded then the pager is cancelled and the contents of the current buffer are sent to the terminal.

If there is no pager configured then the output is sent directly to the terminal.

Parameters
cli_file_indexIndex of the CLI session where this output is directed.
bufferString of printabe bytes to be output.
buffer_bytesThe number of bytes in buffer to be output.

Definition at line 1091 of file cli.c.

+ Here is the call graph for this function:

◆ unix_vlib_cli_output_cooked()

static void unix_vlib_cli_output_cooked ( unix_cli_file_t cf,
clib_file_t uf,
u8 buffer,
uword  buffer_bytes 
)
static

Process a buffer for CRLF handling before outputting it to the CLI.

Parameters
cfUnix CLI session of the desired stream to write to.
ufThe Unix file structure of the desired stream to write to.
bufferPointer to the buffer that needs to be written.
buffer_bytesThe number of bytes from buffer to write.

Definition at line 707 of file cli.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unix_vlib_cli_output_cursor_left()

static void unix_vlib_cli_output_cursor_left ( unix_cli_file_t cf,
clib_file_t uf 
)
static

Moves the terminal cursor one character to the left, with special handling when it reaches the left edge of the terminal window.

Ordinarily we can simply send a '' to move the cursor left, however most terminals will not reverse-wrap to the end of the previous line if the cursor is in the left-most column. To counter this we must check the cursor position + prompt length modulo terminal width and if available use some other means, such as ANSI terminal escape sequences, to move the cursor.

Parameters
cfUnix CLI session of the desired stream to write to.
ufThe Unix file structure of the desired stream to write to.

Definition at line 760 of file cli.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unix_vlib_cli_output_raw()

static void unix_vlib_cli_output_raw ( unix_cli_file_t cf,
clib_file_t uf,
u8 buffer,
uword  buffer_bytes 
)
static

Send a buffer to the CLI stream if possible, enqueue it otherwise.

Attempts to write given buffer to the file descriptor of the given Unix CLI session. If that session already has data in the output buffer or if the write attempt tells us to try again later then the given buffer is appended to the pending output buffer instead.

This is typically called only from unix_vlib_cli_output_cooked since that is where CRLF handling occurs or from places where we explicitly do not want cooked handling.

Parameters
cfUnix CLI session of the desired stream to write to.
ufThe Unix file structure of the desired stream to write to.
bufferPointer to the buffer that needs to be written.
buffer_bytesThe number of bytes from buffer to write.

Definition at line 656 of file cli.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unix_vlib_findchr()

static word unix_vlib_findchr ( u8  chr,
u8 str,
word  len 
)
inlinestatic

A bit like strchr with a buffer length limit.

Search a buffer for the first instance of a character up to the limit of the buffer length. If found then return the position of that character.

The key departure from strchr is that if the character is not found then return the buffer length.

Parameters
chrThe byte value to search for.
strThe buffer in which to search for the value.
lenThe depth into the buffer to search.
Returns
The index of the first occurrence of chr. If chr is not found then len instead.

Definition at line 629 of file cli.c.

+ Here is the caller graph for this function:

◆ unix_wait_cmd()

static clib_error_t* unix_wait_cmd ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

CLI command to wait <sec> seconds.

Useful for exec script.

Definition at line 3973 of file cli.c.

+ Here is the call graph for this function:

◆ vlib_unix_cli_set_prompt()

void vlib_unix_cli_set_prompt ( char *  prompt)

Set the CLI prompt.

Parameters
promptThe C string to set the prompt to.
Note
This setting is global; it impacts all current and future CLI sessions.

Definition at line 3288 of file cli.c.

+ Here is the caller graph for this function:

Variable Documentation

◆ cli_exec

vlib_cli_command_t cli_exec
static
Initial value:
= {
.path = "exec",
.short_help = "exec <filename>",
.function = unix_cli_exec,
.is_mp_safe = 1,
}

(constructor) VLIB_CLI_COMMAND (cli_exec)

Definition at line 3487 of file cli.c.

◆ cli_unix_cli_set_terminal_ansi

vlib_cli_command_t cli_unix_cli_set_terminal_ansi
static
Initial value:
= {
.path = "set terminal ansi",
.short_help = "set terminal ansi [on|off]",
}

(constructor) VLIB_CLI_COMMAND (cli_unix_cli_set_terminal_ansi)

Definition at line 3962 of file cli.c.

◆ cli_unix_cli_set_terminal_history

vlib_cli_command_t cli_unix_cli_set_terminal_history
static
Initial value:
= {
.path = "set terminal history",
.short_help = "set terminal history [on|off] [limit <lines>]",
}

(constructor) VLIB_CLI_COMMAND (cli_unix_cli_set_terminal_history)

Definition at line 3923 of file cli.c.

◆ cli_unix_cli_set_terminal_pager

vlib_cli_command_t cli_unix_cli_set_terminal_pager
static
Initial value:
= {
.path = "set terminal pager",
.short_help = "set terminal pager [on|off] [limit <lines>]",
}

(constructor) VLIB_CLI_COMMAND (cli_unix_cli_set_terminal_pager)

Definition at line 3852 of file cli.c.

◆ cli_unix_cli_show_cli_sessions

vlib_cli_command_t cli_unix_cli_show_cli_sessions
static
Initial value:
= {
.path = "show cli-sessions",
.short_help = "Show current CLI sessions",
}

(constructor) VLIB_CLI_COMMAND (cli_unix_cli_show_cli_sessions)

Definition at line 3795 of file cli.c.

◆ cli_unix_cli_show_history

vlib_cli_command_t cli_unix_cli_show_history
static
Initial value:
= {
.path = "history",
.short_help = "Show current session command history",
.function = unix_cli_show_history,
}

(constructor) VLIB_CLI_COMMAND (cli_unix_cli_show_history)

Definition at line 3643 of file cli.c.

◆ cli_unix_cli_show_terminal

vlib_cli_command_t cli_unix_cli_show_terminal
static
Initial value:
= {
.path = "show terminal",
.short_help = "Show current session terminal settings",
}

(constructor) VLIB_CLI_COMMAND (cli_unix_cli_show_terminal)

Definition at line 3715 of file cli.c.

◆ cli_unix_echo_cmd

vlib_cli_command_t cli_unix_echo_cmd
static
Initial value:
= {
.path = "echo",
.short_help = "echo <rest-of-line>",
.function = echo_cmd,
}

(constructor) VLIB_CLI_COMMAND (cli_unix_echo_cmd)

Definition at line 4029 of file cli.c.

◆ cli_unix_show_errors

vlib_cli_command_t cli_unix_show_errors
static
Initial value:
= {
.path = "show unix errors",
.short_help = "Show Unix system call error history",
.function = unix_show_errors,
}

(constructor) VLIB_CLI_COMMAND (cli_unix_show_errors)

Definition at line 3563 of file cli.c.

◆ cli_unix_show_files

vlib_cli_command_t cli_unix_show_files
static
Initial value:
= {
.path = "show unix files",
.short_help = "Show Unix files in use",
.function = unix_show_files,
}

(constructor) VLIB_CLI_COMMAND (cli_unix_show_files)

Definition at line 3606 of file cli.c.

◆ cli_unix_wait_cmd

vlib_cli_command_t cli_unix_wait_cmd
static
Initial value:
= {
.path = "wait",
.short_help = "wait <sec>",
.function = unix_wait_cmd,
}

(constructor) VLIB_CLI_COMMAND (cli_unix_wait_cmd)

Definition at line 4002 of file cli.c.

◆ define_cmd

vlib_cli_command_t define_cmd
static
Initial value:
= {
.path = "define",
.short_help = "define <variable-name> <value>",
.function = define_cmd_fn,
}

(constructor) VLIB_CLI_COMMAND (define_cmd)

Definition at line 4067 of file cli.c.

◆ show_macro

vlib_cli_command_t show_macro
static
Initial value:
= {
.path = "show macro",
.short_help = "show macro [noevaluate]",
.function = show_macro_cmd_fn,
}

(constructor) VLIB_CLI_COMMAND (show_macro)

Definition at line 4117 of file cli.c.

◆ undefine_cmd

vlib_cli_command_t undefine_cmd
static
Initial value:
= {
.path = "undefine",
.short_help = "undefine <variable-name>",
.function = undefine_cmd_fn,
}

(constructor) VLIB_CLI_COMMAND (undefine_cmd)

Definition at line 4093 of file cli.c.

◆ unix_cli_banner

unix_cli_banner_t unix_cli_banner[]
static
Initial value:
= {
_(" _______ _ _ _____ ___ \n"),
_(" __/ __/ _ \\ (_)__ | | / / _ \\/ _ \\\n"),
_(" _/ _// // / / / _ \\ | |/ / ___/ ___/\n"),
_(" /_/ /____(_)_/\\___/ |___/_/ /_/ \n"),
_("\n")
}

Plain welcome banner.

Definition at line 115 of file cli.c.

◆ unix_cli_banner_color

unix_cli_banner_t unix_cli_banner_color[]
static
Initial value:
= {
_(ANSI_BRED " _______ _ " ANSI_RESET " _ _____ ___ \n"),
_(ANSI_BRED " __/ __/ _ \\ (_)__ " ANSI_RESET " | | / / _ \\/ _ \\\n"),
_(ANSI_BRED " _/ _// // / / / _ \\" ANSI_RESET " | |/ / ___/ ___/\n"),
_(ANSI_BRED " /_/ /____(_)_/\\___/" ANSI_RESET " |___/_/ /_/ \n"),
_("\n")
}

ANSI color welcome banner.

Definition at line 124 of file cli.c.

◆ unix_cli_main

unix_cli_main_t unix_cli_main
static

CLI global state.

Definition at line 497 of file cli.c.

◆ unix_cli_parse_pager

◆ unix_cli_parse_strings

unix_cli_parse_actions_t unix_cli_parse_strings[]
static
Initial value:
= {
}

Patterns to match on a CLI input stream.

Definition at line 349 of file cli.c.

◆ unix_cli_q_command

vlib_cli_command_t unix_cli_q_command
static
Initial value:
= {
.path = "q",
.short_help = "Exit CLI",
.function = unix_cli_quit,
}

(constructor) VLIB_CLI_COMMAND (unix_cli_q_command)

Definition at line 3354 of file cli.c.

◆ unix_cli_quit_command

vlib_cli_command_t unix_cli_quit_command
static
Initial value:
= {
.path = "quit",
.short_help = "Exit CLI",
.function = unix_cli_quit,
}

(constructor) VLIB_CLI_COMMAND (unix_cli_quit_command)

Definition at line 3346 of file cli.c.

UNIX_CLI_PARSE_ACTION_NOACTION
@ UNIX_CLI_PARSE_ACTION_NOACTION
No action.
Definition: cli.c:284
UNIX_CLI_PARSE_ACTION_ERASERIGHT
@ UNIX_CLI_PARSE_ACTION_ERASERIGHT
Erase cursor right.
Definition: cli.c:288
UNIX_CLI_PARSE_ACTION_REVSEARCH
@ UNIX_CLI_PARSE_ACTION_REVSEARCH
Search backwards in command history.
Definition: cli.c:301
UNIX_CLI_PARSE_ACTION_PAGER_QUIT
@ UNIX_CLI_PARSE_ACTION_PAGER_QUIT
Exit the pager session.
Definition: cli.c:307
UNIX_CLI_PARSE_ACTION_CRLF
@ UNIX_CLI_PARSE_ACTION_CRLF
Carriage return, newline or enter.
Definition: cli.c:285
UNIX_CLI_PARSE_ACTION_PAGER_CRLF
@ UNIX_CLI_PARSE_ACTION_PAGER_CRLF
Enter pressed (CR, CRLF, LF, etc)
Definition: cli.c:306
UNIX_CLI_PARSE_ACTION_END
@ UNIX_CLI_PARSE_ACTION_END
End key (jump to end of line)
Definition: cli.c:294
CTL
#define CTL(c)
Given a capital ASCII letter character return a NUL terminated string with the control code for that ...
Definition: cli.c:342
UNIX_CLI_PARSE_ACTION_PAGER_TOP
@ UNIX_CLI_PARSE_ACTION_PAGER_TOP
Scroll to first line.
Definition: cli.c:311
unix_cli_exec
static clib_error_t * unix_cli_exec(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI command to execute a VPP command script.
Definition: cli.c:3363
unix_show_files
static clib_error_t * unix_show_files(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI command to show various unix error statistics.
Definition: cli.c:3572
UNIX_CLI_PARSE_ACTION_UP
@ UNIX_CLI_PARSE_ACTION_UP
Up arrow.
Definition: cli.c:289
UNIX_CLI_PARSE_ACTION_ERASELINELEFT
@ UNIX_CLI_PARSE_ACTION_ERASELINELEFT
Erase line to left of cursor.
Definition: cli.c:297
ANSI_RESET
#define ANSI_RESET
ANSI reset color settings.
Definition: cli.c:75
UNIX_CLI_PARSE_ACTION_CLEAR
@ UNIX_CLI_PARSE_ACTION_CLEAR
Clear the terminal.
Definition: cli.c:300
UNIX_CLI_PARSE_ACTION_PAGER_SEARCH
@ UNIX_CLI_PARSE_ACTION_PAGER_SEARCH
Search the pager buffer.
Definition: cli.c:316
unix_show_errors
static clib_error_t * unix_show_errors(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI command to show various unix error statistics.
Definition: cli.c:3497
UNIX_CLI_PARSE_ACTION_ERASEWORDLEFT
@ UNIX_CLI_PARSE_ACTION_ERASEWORDLEFT
Erase word left.
Definition: cli.c:299
UNIX_CLI_PARSE_ACTION_HOME
@ UNIX_CLI_PARSE_ACTION_HOME
Home key (jump to start of line)
Definition: cli.c:293
UNIX_CLI_PARSE_ACTION_DOWN
@ UNIX_CLI_PARSE_ACTION_DOWN
Down arrow.
Definition: cli.c:290
UNIX_CLI_PARSE_ACTION_PAGER_PGUP
@ UNIX_CLI_PARSE_ACTION_PAGER_PGUP
Scroll to previous page.
Definition: cli.c:314
ANSI_BRED
#define ANSI_BRED
ANSI Start bright red text.
Definition: cli.c:83
unix_cli_show_history
static clib_error_t * unix_cli_show_history(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI command to show session command history.
Definition: cli.c:3615
UNIX_CLI_PARSE_ACTION_WORDRIGHT
@ UNIX_CLI_PARSE_ACTION_WORDRIGHT
Jump cursor to start of right word.
Definition: cli.c:296
unix_cli_set_terminal_ansi
static clib_error_t * unix_cli_set_terminal_ansi(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI command to set terminal ANSI settings.
Definition: cli.c:3932
UNIX_CLI_PARSE_ACTION_TAB
@ UNIX_CLI_PARSE_ACTION_TAB
Tab key.
Definition: cli.c:286
UNIX_CLI_PARSE_ACTION_PAGER_BOTTOM
@ UNIX_CLI_PARSE_ACTION_PAGER_BOTTOM
Scroll to last line.
Definition: cli.c:312
define_cmd_fn
static clib_error_t * define_cmd_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: cli.c:4037
echo_cmd
static clib_error_t * echo_cmd(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: cli.c:4010
UNIX_CLI_PARSE_ACTION_ERASELINERIGHT
@ UNIX_CLI_PARSE_ACTION_ERASELINERIGHT
Erase line to right & including cursor.
Definition: cli.c:298
unix_cli_show_terminal
static clib_error_t * unix_cli_show_terminal(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI command to show terminal status.
Definition: cli.c:3652
unix_cli_set_terminal_history
static clib_error_t * unix_cli_set_terminal_history(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI command to set terminal history settings.
Definition: cli.c:3861
UNIX_CLI_PARSE_ACTION_RIGHT
@ UNIX_CLI_PARSE_ACTION_RIGHT
Right arrow.
Definition: cli.c:292
ESC
#define ESC
ANSI escape code.
Definition: cli.c:67
show_macro_cmd_fn
static clib_error_t * show_macro_cmd_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: cli.c:4101
UNIX_CLI_PARSE_ACTION_PAGER_NEXT
@ UNIX_CLI_PARSE_ACTION_PAGER_NEXT
Scroll to next page.
Definition: cli.c:308
UNIX_CLI_PARSE_ACTION_PAGER_PGDN
@ UNIX_CLI_PARSE_ACTION_PAGER_PGDN
Scroll to next page.
Definition: cli.c:313
UNIX_CLI_PARSE_ACTION_FWDSEARCH
@ UNIX_CLI_PARSE_ACTION_FWDSEARCH
Search forwards in command history.
Definition: cli.c:302
UNIX_CLI_PARSE_ACTION_ERASE
@ UNIX_CLI_PARSE_ACTION_ERASE
Erase cursor left.
Definition: cli.c:287
unix_cli_set_terminal_pager
static clib_error_t * unix_cli_set_terminal_pager(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI command to set terminal pager settings.
Definition: cli.c:3804
UNIX_CLI_PARSE_ACTION_LEFT
@ UNIX_CLI_PARSE_ACTION_LEFT
Left arrow.
Definition: cli.c:291
UNIX_CLI_PARSE_ACTION_YANK
@ UNIX_CLI_PARSE_ACTION_YANK
Undo last erase action.
Definition: cli.c:303
UNIX_CLI_PARSE_ACTION_PAGER_REDRAW
@ UNIX_CLI_PARSE_ACTION_PAGER_REDRAW
Clear and redraw the page on the terminal.
Definition: cli.c:315
UNIX_CLI_PARSE_ACTION_NOMATCH
@ UNIX_CLI_PARSE_ACTION_NOMATCH
Action parser did not find any match.
Definition: cli.c:319
unix_cli_show_cli_sessions
static clib_error_t * unix_cli_show_cli_sessions(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI command to display a list of CLI sessions.
Definition: cli.c:3724
CSI
#define CSI
ANSI Control Sequence Introducer.
Definition: cli.c:70
unix_wait_cmd
static clib_error_t * unix_wait_cmd(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI command to wait <sec> seconds.
Definition: cli.c:3973
unix_cli_quit
static clib_error_t * unix_cli_quit(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
CLI command to quit the terminal session.
Definition: cli.c:3319
undefine_cmd_fn
static clib_error_t * undefine_cmd_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Definition: cli.c:4076
UNIX_CLI_PARSE_ACTION_WORDLEFT
@ UNIX_CLI_PARSE_ACTION_WORDLEFT
Jump cursor to start of left word.
Definition: cli.c:295
UNIX_CLI_PARSE_ACTION_PAGER_UP
@ UNIX_CLI_PARSE_ACTION_PAGER_UP
Scroll to previous line.
Definition: cli.c:310
UNIX_CLI_PARSE_ACTION_TELNETIAC
@ UNIX_CLI_PARSE_ACTION_TELNETIAC
Telnet control code.
Definition: cli.c:304
UNIX_CLI_PARSE_ACTION_PAGER_DN
@ UNIX_CLI_PARSE_ACTION_PAGER_DN
Scroll to next line.
Definition: cli.c:309