libosmovty 1.10.0.57-8972
Osmocom VTY library
|
Osmocom FSM introspection via VTY. More...
#include <stdlib.h>
#include <string.h>
#include "config.h"
#include <osmocom/vty/command.h>
#include <osmocom/vty/buffer.h>
#include <osmocom/vty/vty.h>
#include <osmocom/vty/telnet_interface.h>
#include <osmocom/vty/misc.h>
#include <osmocom/core/fsm.h>
#include <osmocom/core/logging.h>
#include <osmocom/core/linuxlist.h>
Macros | |
#define | SH_FSM_STR SHOW_STR "Show information about finite state machines\n" |
#define | SH_FSMI_STR SHOW_STR "Show information about finite state machine instances\n" |
Functions | |
void | vty_out_fsm2 (struct vty *vty, const char *prefix, struct osmo_fsm *fsm) |
Print information about a FSM [class] to the given VTY. More... | |
void | vty_out_fsm (struct vty *vty, struct osmo_fsm *fsm) |
Print information about a FSM [class] to the given VTY. More... | |
void | vty_out_fsm_inst2 (struct vty *vty, const char *prefix, struct osmo_fsm_inst *fsmi) |
Print a FSM instance to the given VTY. More... | |
void | vty_out_fsm_inst (struct vty *vty, struct osmo_fsm_inst *fsmi) |
Print a FSM instance to the given VTY. More... | |
DEFUN (show_fsms, show_fsms_cmd, "show fsm all", SH_FSM_STR "Display a list of all registered finite state machines\n") | |
DEFUN (show_fsm, show_fsm_cmd, "show fsm NAME", SH_FSM_STR "Display information about a single named finite state machine\n") | |
DEFUN (show_fsm_state_graph, show_fsm_state_graph_cmd, "show fsm-state-graph NAME", SHOW_STR "Generate a state transition graph (using DOT language)\n" "FSM name\n") | |
DEFUN (show_fsm_insts, show_fsm_insts_cmd, "show fsm-instances all", SH_FSMI_STR "Display a list of all FSM instances of all finite state machine") | |
DEFUN (show_fsm_inst, show_fsm_inst_cmd, "show fsm-instances NAME", SH_FSMI_STR "Display a list of all FSM instances of the named finite state machine") | |
void | osmo_fsm_vty_add_cmds (void) |
Install VTY commands for FSM introspection This installs a couple of VTY commands for introspection of FSM classes as well as FSM instances. More... | |
Variables | |
struct llist_head | osmo_g_fsms |
Osmocom FSM introspection via VTY.
This is code implementing generic VTY access to Osmocom FSMs from libosmocore. This means that any application can expose all state of all instances of all registered FSM classes by calling a single command during startup: osmo_fsm_vty_add_cmds
#define SH_FSM_STR SHOW_STR "Show information about finite state machines\n" |
#define SH_FSMI_STR SHOW_STR "Show information about finite state machine instances\n" |
DEFUN | ( | show_fsm | , |
show_fsm_cmd | , | ||
"show fsm NAME" | , | ||
SH_FSM_STR "Display information about a single named finite state machine\n" | |||
) |
References argv, CMD_SUCCESS, CMD_WARNING, osmo_fsm_find_by_name(), VTY_NEWLINE, vty_out(), and vty_out_fsm().
DEFUN | ( | show_fsm_inst | , |
show_fsm_inst_cmd | , | ||
"show fsm-instances NAME" | , | ||
SH_FSMI_STR "Display a list of all FSM instances of the named finite state machine" | |||
) |
DEFUN | ( | show_fsm_insts | , |
show_fsm_insts_cmd | , | ||
"show fsm-instances all" | , | ||
SH_FSMI_STR "Display a list of all FSM instances of all finite state machine" | |||
) |
References CMD_SUCCESS, osmo_fsm_inst::fsm, osmo_fsm::instances, list, llist_for_each_entry, osmo_g_fsms, and vty_out_fsm_inst().
DEFUN | ( | show_fsms | , |
show_fsms_cmd | , | ||
"show fsm all" | , | ||
SH_FSM_STR "Display a list of all registered finite state machines\n" | |||
) |
References CMD_SUCCESS, list, llist_for_each_entry, osmo_g_fsms, and vty_out_fsm().
void osmo_fsm_vty_add_cmds | ( | void | ) |
Install VTY commands for FSM introspection This installs a couple of VTY commands for introspection of FSM classes as well as FSM instances.
Call this once from your application if you want to support those commands.
References install_lib_element_ve().
Print information about a FSM [class] to the given VTY.
vty | The VTY to which to print | |
[in] | fsm | The FSM class to print |
References vty_out_fsm2().
Referenced by DEFUN().
Print information about a FSM [class] to the given VTY.
vty | The VTY to which to print | |
[in] | prefix | prefix to print at start of each line (typically indenting) |
[in] | fsm | The FSM class to print |
References osmo_fsm::event_names, osmo_fsm_state::in_event_mask, log_category_name(), osmo_fsm::log_subsys, osmo_fsm::name, osmo_fsm_state::name, osmo_fsm::num_states, osmo_fsm_state::out_state_mask, osmo_fsm::states, value_string::str, value_string::value, VTY_NEWLINE, and vty_out().
Referenced by vty_out_fsm().
void vty_out_fsm_inst | ( | struct vty * | vty, |
struct osmo_fsm_inst * | fsmi | ||
) |
Print a FSM instance to the given VTY.
vty | The VTY to which to print | |
[in] | fsmi | The FSM instance to print |
References vty_out_fsm_inst2().
Referenced by DEFUN().
void vty_out_fsm_inst2 | ( | struct vty * | vty, |
const char * | prefix, | ||
struct osmo_fsm_inst * | fsmi | ||
) |
Print a FSM instance to the given VTY.
vty | The VTY to which to print | |
[in] | prefix | prefix to print at start of each line (typically indenting) |
[in] | fsmi | The FSM instance to print |
References osmo_fsm_inst::child, osmo_fsm_inst::children, osmo_fsm_inst::fsm, osmo_fsm_inst::id, llist_for_each_entry, osmo_fsm_inst::log_level, log_level_str(), osmo_fsm_inst::name, osmo_fsm_event_name(), osmo_fsm_state_name(), osmo_fsm_inst::parent, osmo_fsm_inst::parent_term_event, osmo_fsm_inst::proc, osmo_fsm_inst::state, osmo_fsm_inst::T, VTY_NEWLINE, and vty_out().
Referenced by vty_out_fsm_inst().
|
extern |
Referenced by DEFUN().