fsm_vty.c File Reference

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

struct llist_head | osmo_g_fsms

## Detailed Description

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

## Macro Definition Documentation

## SH_FSM_STR

#define SH_FSM_STR SHOW_STR "Show information about finite state machines\n"

## SH_FSMI_STR

#define SH_FSMI_STR SHOW_STR "Show information about finite state machine instances\n"

## Function Documentation

## DEFUN() [1/4]

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() [2/4]

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

References argv, CMD_SUCCESS, CMD_WARNING, osmo_fsm_inst::fsm, osmo_fsm::instances, list, llist_for_each_entry, osmo_fsm_find_by_name(), VTY_NEWLINE, vty_out(), and vty_out_fsm_inst().

## DEFUN() [3/4]

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() [4/4]

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().

## osmo_fsm_vty_add_cmds()

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().

## vty_out_fsm()

void vty_out_fsm | ( | struct vty * | vty,
|  | struct osmo_fsm * | fsm
| ) |  |

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

Parameters

  | vty | The VTY to which to print
  [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_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().

## vty_out_fsm_inst()

void vty_out_fsm_inst | ( | struct vty * | vty,
|  | struct osmo_fsm_inst * | fsmi
| ) |  |

Print a FSM instance to the given VTY.

Parameters

  | vty | The VTY to which to print
  [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 DEFUN().

## Variable Documentation

## osmo_g_fsms

struct llist_head osmo_g_fsms

extern

Referenced by DEFUN().