libosmovty  0.9.6.20170825
Osmocom VTY library
Finite State Machine abstraction

VTY interface for Osmocom FSM. More...

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"
 

Enumerations

enum  osmo_fsm_term_cause
 

Functions

static const char * osmo_fsm_term_cause_name (enum osmo_fsm_term_cause cause)
 
void osmo_fsm_log_addr (bool log_addr)
 
int osmo_fsm_register (struct osmo_fsm *fsm)
 
void osmo_fsm_unregister (struct osmo_fsm *fsm)
 
struct osmo_fsmosmo_fsm_find_by_name (const char *name)
 
struct osmo_fsm_instosmo_fsm_inst_find_by_name (const struct osmo_fsm *fsm, const char *name)
 
struct osmo_fsm_instosmo_fsm_inst_find_by_id (const struct osmo_fsm *fsm, const char *id)
 
struct osmo_fsm_instosmo_fsm_inst_alloc (struct osmo_fsm *fsm, void *ctx, void *priv, int log_level, const char *id)
 
struct osmo_fsm_instosmo_fsm_inst_alloc_child (struct osmo_fsm *fsm, struct osmo_fsm_inst *parent, uint32_t parent_term_event)
 
void osmo_fsm_inst_free (struct osmo_fsm_inst *fi)
 
const char * osmo_fsm_event_name (struct osmo_fsm *fsm, uint32_t event)
 
const char * osmo_fsm_inst_name (struct osmo_fsm_inst *fi)
 
const char * osmo_fsm_state_name (struct osmo_fsm *fsm, uint32_t state)
 
static const char * osmo_fsm_inst_state_name (struct osmo_fsm_inst *fi)
 
int _osmo_fsm_inst_state_chg (struct osmo_fsm_inst *fi, uint32_t new_state, unsigned long timeout_secs, int T, const char *file, int line)
 
int _osmo_fsm_inst_dispatch (struct osmo_fsm_inst *fi, uint32_t event, void *data, const char *file, int line)
 
void _osmo_fsm_inst_term (struct osmo_fsm_inst *fi, enum osmo_fsm_term_cause cause, void *data, const char *file, int line)
 
void _osmo_fsm_inst_term_children (struct osmo_fsm_inst *fi, enum osmo_fsm_term_cause cause, void *data, const char *file, int line)
 
 LLIST_HEAD (osmo_g_fsms)
 
static void fsm_tmr_cb (void *data)
 
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_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_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

 OSMO_FSM_TERM_PARENT
 
 OSMO_FSM_TERM_REQUEST
 
 OSMO_FSM_TERM_REGULAR
 
 OSMO_FSM_TERM_ERROR
 
 OSMO_FSM_TERM_TIMEOUT
 
const struct value_string osmo_fsm_term_cause_names []
 
static bool fsm_log_addr
 
const struct value_string osmo_fsm_term_cause_names []
 
struct llist_head osmo_g_fsms
 

Detailed Description

VTY interface for Osmocom FSM.

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

Macro Definition Documentation

#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"

Function Documentation

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_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.

Call this once from your application if you want to support those commands.

References install_element_ve().

void vty_out_fsm ( struct vty vty,
struct osmo_fsm fsm 
)

Print information about a FSM [class] to the given VTY.

Parameters
vtyThe VTY to which to print
[in]fsmThe FSM class to print

References osmo_fsm::event_names, osmo_fsm_state::in_event_mask, log_category_name(), osmo_fsm::log_subsys, osmo_fsm_state::name, osmo_fsm::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 DEFUN().

Variable Documentation

struct llist_head osmo_g_fsms

Referenced by DEFUN().