3 Functions Interactive commands
Watersrc-stack edited this page 2026-10-14 04:00:21 +02:00

Interactive commands

What each key of the interactive mode does.

Generated by make docs from the source and GCC's call graph. Back to the Function explorer.

src/commands/cmd_analysis.c

The analysis view commands: a (switch view), n (renamings), N (online / offline)

view_command

void view_command(netotter_t *netotter)

src/commands/cmd_analysis.c:15 · non-static · both builds

'a' command: switches between the classic and the analysis view

Called by: process_keybind
Calls: my_putstr

rename_rm

static void rename_rm(netotter_t *netotter, char *arg)

src/commands/cmd_analysis.c:21 · static · both builds

Called by: rename_command
Calls: rename_set, my_putstr

rename_command

void rename_command(netotter_t *netotter, char *arg)

src/commands/cmd_analysis.c:32 · non-static · both builds

'n' command: arg is the rest of its line. "<text>,<new name>" renames text in the analysis view, "<text>" removes that renaming, nothing lists the renamings yet.

Called by: process_keybind
Calls: rename_rm, rename_set, renames_print, my_putstr, my_write
Library and system calls: strchr

online_command

void online_command(lib_common_t *os_lib, netotter_t *netotter)

src/commands/cmd_analysis.c:64 · non-static · both builds

'N' command: switches between online mode (reverse DNS lookups, the default) and offline mode (NetOtter sends nothing)

Called by: process_keybind
Calls: reverse_toggle_online, my_putstr

src/commands/cmd_display.c

The display commands: l (packet list), i (packet details), h (help)

list_command

int list_command(netotter_t *netotter)

src/commands/cmd_display.c:15 · non-static · both builds

'l' command: lists the packets with their ids. 0 if there is none.

Called by: process_keybind
Calls: filters_print, reverse_queue_lookups, view_begin, view_end, display_packets, my_putstr

info_command

int info_command(netotter_t *netotter)

src/commands/cmd_display.c:35 · non-static · both builds

'i' command: asks for a packet id and shows its details and payload. 1 if stdin closed, 0 otherwise.

Called by: process_keybind
Calls: print_packet_info, reverse_queue_lookups, view_begin, view_end, plist_find, store_read_payload, my_putstr, str_to_id, read_line

stats_command

void stats_command(netotter_t *netotter)

src/commands/cmd_display.c:64 · non-static · both builds

The interactive commands and the filters f / F take, shown at startup and by 'h'

Called by: process_keybind
Calls: view_begin, view_end, anomaly_stats

warnings_command

void warnings_command(netotter_t *netotter)

src/commands/cmd_display.c:72 · non-static · both builds

Called by: process_keybind
Calls: view_begin, view_end, anomaly_report

print_commands

void print_commands(void)

src/commands/cmd_display.c:80 · non-static · both builds

Called by: run_interactive, process_keybind
Calls: filters_print_names, my_putstr

src/commands/cmd_filter.c

The filter commands: f, F, r, c and m

apply_typed_filters

static void apply_typed_filters(netotter_t *netotter, filter_arg_t *typed)

src/commands/cmd_filter.c:14 · static · both builds

Applies the typed filters (toggles) and frees them, then shows the active filters

Called by: filter_command
Calls: filter_args_free, filters_print, filters_apply_args

filter_command

int filter_command(netotter_t *netotter)

src/commands/cmd_filter.c:23 · non-static · both builds

'f' command: reads one "<FILTER> <ARGUMENT>" line (a trailing ',' is optional) and toggles that filter. 1 if stdin closed, 0 otherwise.

Called by: process_keybind
Calls: apply_typed_filters, filter_args_from_text, my_putstr, read_line

filters_command

int filters_command(netotter_t *netotter)

src/commands/cmd_filter.c:44 · non-static · both builds

'F' command: reads "<FILTER> <ARGUMENT>," lines (several per line are fine) until a line starting with ',', or an empty pattern like the -F option, and toggles each filter as its line comes. Bad patterns are reported and skipped. 1 if stdin closed, 0 otherwise.

Called by: process_keybind
Calls: filter_args_free, filter_args_from_text, filter_text_end, filters_print, filters_apply_args, my_putstr, read_line

clear_command

void clear_command(netotter_t *netotter)

src/commands/cmd_filter.c:67 · non-static · both builds

'c' command: clears every active filter

Called by: process_keybind
Calls: filters_clear, my_putstr

remove_command

int remove_command(netotter_t *netotter)

src/commands/cmd_filter.c:77 · non-static · both builds

'r' command: lists the active filters with their ids, asks for one and removes that filter only. 1 if stdin closed, 0 otherwise.

Called by: process_keybind
Calls: filters_print, filters_print_numbered, filters_remove_at, my_putstr, str_to_id, read_line

mode_command

void mode_command(netotter_t *netotter)

src/commands/cmd_filter.c:97 · non-static · both builds

'm' command: switches the filters between OR and AND

Called by: process_keybind
Calls: filters_print, my_putstr

src/commands/cmd_io.c

The save commands: O (every packet) and o (the packets the filters show)

save_command

int save_command(netotter_t *netotter, int1 filtered)

src/commands/cmd_io.c:14 · non-static · both builds

'O' / 'o' command: asks for a file name and saves the packets in it (SAVE_EXT added when missing): all of them for 'O', only the ones the active filters show for 'o' (filtered). 1 if stdin closed, 0 otherwise.

Called by: process_keybind
Calls: save_to_file, my_putstr, read_line

src/keys.c

The interactive mode's keys: reads one, then runs its command

process_keybind

static int process_keybind(lib_common_t *os_lib, netotter_t *netotter, char key, char rest[])

src/keys.c:15 · static · both builds

Called by: handle_key
Calls: view_command, rename_command, online_command, list_command, info_command, stats_command, warnings_command, print_commands, filter_command, filters_command, clear_command, remove_command, mode_command, save_command, local_print, reverse_log_print, reverse_log_print_all, my_putstr

handle_key

int handle_key(lib_common_t *os_lib, netotter_t *netotter)

src/keys.c:102 · non-static · both builds

Reads one key: 1-9 toggles that interface, 0 disables them all, 'l', 'i', 'O', 'o', 'f', 'F', 'r', 'c', 'M', 'm', 'a', 'n', 'N', 'd', 'D', 's', 'w' and 'h' run their command. 1 when it's time to stop ('q' typed, or stdin closed).

Called by: run_interactive
Calls: process_keybind, limit_message, print_alert, my_putstr, read_line, disable_all, toggle_ifname, disable_all, toggle_ifname
Library and system calls: read, strchr