diff options
Diffstat (limited to 'include/osmocom/core/fsm.h')
-rw-r--r-- | include/osmocom/core/fsm.h | 90 |
1 files changed, 45 insertions, 45 deletions
diff --git a/include/osmocom/core/fsm.h b/include/osmocom/core/fsm.h index f42dd0c6..fb182f35 100644 --- a/include/osmocom/core/fsm.h +++ b/include/osmocom/core/fsm.h @@ -12,21 +12,21 @@ */ /*! \file fsm.h - * \brief Finite State Machine + * Finite State Machine */ struct osmo_fsm_inst; enum osmo_fsm_term_cause { - /*! \brief terminate because parent terminated */ + /*! terminate because parent terminated */ OSMO_FSM_TERM_PARENT, - /*! \brief terminate on explicit user request */ + /*! terminate on explicit user request */ OSMO_FSM_TERM_REQUEST, - /*! \brief regular termination of process */ + /*! regular termination of process */ OSMO_FSM_TERM_REGULAR, - /*! \brief erroneous termination of process */ + /*! erroneous termination of process */ OSMO_FSM_TERM_ERROR, - /*! \brief termination due to time-out */ + /*! termination due to time-out */ OSMO_FSM_TERM_TIMEOUT, }; @@ -37,80 +37,80 @@ static inline const char *osmo_fsm_term_cause_name(enum osmo_fsm_term_cause caus } -/*! \brief description of a rule in the FSM */ +/*! description of a rule in the FSM */ struct osmo_fsm_state { - /*! \brief bit-mask of permitted input events for this state */ + /*! bit-mask of permitted input events for this state */ uint32_t in_event_mask; - /*! \brief bit-mask to which other states this state may transiton */ + /*! bit-mask to which other states this state may transiton */ uint32_t out_state_mask; - /*! \brief human-readable name of this state */ + /*! human-readable name of this state */ const char *name; - /*! \brief function to be called for events arriving in this state */ + /*! function to be called for events arriving in this state */ void (*action)(struct osmo_fsm_inst *fi, uint32_t event, void *data); - /*! \brief function to be called just after entering the state */ + /*! function to be called just after entering the state */ void (*onenter)(struct osmo_fsm_inst *fi, uint32_t prev_state); - /*! \brief function to be called just before leaving the state */ + /*! function to be called just before leaving the state */ void (*onleave)(struct osmo_fsm_inst *fi, uint32_t next_state); }; -/*! \brief a description of an osmocom finite state machine */ +/*! a description of an osmocom finite state machine */ struct osmo_fsm { - /*! \brief global list */ + /*! global list */ struct llist_head list; - /*! \brief list of instances of this FSM */ + /*! list of instances of this FSM */ struct llist_head instances; - /*! \brief human readable name */ + /*! human readable name */ const char *name; - /*! \brief table of state transition rules */ + /*! table of state transition rules */ const struct osmo_fsm_state *states; - /*! \brief number of entries in \ref states */ + /*! number of entries in \ref states */ unsigned int num_states; - /*! \brief bit-mask of events permitted in all states */ + /*! bit-mask of events permitted in all states */ uint32_t allstate_event_mask; - /*! \brief function pointer to be called for allstate events */ + /*! function pointer to be called for allstate events */ void (*allstate_action)(struct osmo_fsm_inst *fi, uint32_t event, void *data); - /*! \brief clean-up function, called during termination */ + /*! clean-up function, called during termination */ void (*cleanup)(struct osmo_fsm_inst *fi, enum osmo_fsm_term_cause cause); - /*! \brief timer call-back for states with time-out. + /*! timer call-back for states with time-out. * \returns 1 to request termination, 0 to keep running. */ int (*timer_cb)(struct osmo_fsm_inst *fi); - /*! \brief logging sub-system for this FSM */ + /*! logging sub-system for this FSM */ int log_subsys; - /*! \brief human-readable names of events */ + /*! human-readable names of events */ const struct value_string *event_names; }; -/*! \brief a single instanceof an osmocom finite state machine */ +/*! a single instanceof an osmocom finite state machine */ struct osmo_fsm_inst { - /*! \brief member in the fsm->instances list */ + /*! member in the fsm->instances list */ struct llist_head list; - /*! \brief back-pointer to the FSM of which we are an instance */ + /*! back-pointer to the FSM of which we are an instance */ struct osmo_fsm *fsm; - /*! \brief human readable identifier */ + /*! human readable identifier */ const char *id; - /*! \brief human readable fully-qualified name */ + /*! human readable fully-qualified name */ const char *name; - /*! \brief some private data of this instance */ + /*! some private data of this instance */ void *priv; - /*! \brief logging level for this FSM */ + /*! logging level for this FSM */ int log_level; - /*! \brief current state of the FSM */ + /*! current state of the FSM */ uint32_t state; - /*! \brief timer number for states with time-out */ + /*! timer number for states with time-out */ int T; - /*! \brief timer back-end for states with time-out */ + /*! timer back-end for states with time-out */ struct osmo_timer_list timer; - /*! \brief support for fsm-based procedures */ + /*! support for fsm-based procedures */ struct { - /*! \brief the parent FSM that has created us */ + /*! the parent FSM that has created us */ struct osmo_fsm_inst *parent; - /*! \brief the event we should send upon termination */ + /*! the event we should send upon termination */ uint32_t parent_term_event; - /*! \brief a list of children processes */ + /*! a list of children processes */ struct llist_head children; - /*! \brief \ref llist_head linked to parent->proc.children */ + /*! \ref llist_head linked to parent->proc.children */ struct llist_head child; } proc; }; @@ -156,11 +156,11 @@ 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); -/*! \brief return the name of the state the FSM instance is currently in. */ +/*! return the name of the state the FSM instance is currently in. */ static inline const char *osmo_fsm_inst_state_name(struct osmo_fsm_inst *fi) { return osmo_fsm_state_name(fi->fsm, fi->state); } -/*! \brief perform a state change of the given FSM instance +/*! perform a state change of the given FSM instance * * This is a macro that calls _osmo_fsm_inst_state_chg() with the given * parameters as well as the caller's source file and line number for logging @@ -173,7 +173,7 @@ 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); -/*! \brief dispatch an event to an osmocom finite state machine instance +/*! dispatch an event to an osmocom finite state machine instance * * This is a macro that calls _osmo_fsm_inst_dispatch() with the given * parameters as well as the caller's source file and line number for logging @@ -184,7 +184,7 @@ int _osmo_fsm_inst_state_chg(struct osmo_fsm_inst *fi, uint32_t new_state, int _osmo_fsm_inst_dispatch(struct osmo_fsm_inst *fi, uint32_t event, void *data, const char *file, int line); -/*! \brief Terminate FSM instance with given cause +/*! Terminate FSM instance with given cause * * This is a macro that calls _osmo_fsm_inst_term() with the given parameters * as well as the caller's source file and line number for logging purposes. @@ -196,7 +196,7 @@ void _osmo_fsm_inst_term(struct osmo_fsm_inst *fi, enum osmo_fsm_term_cause cause, void *data, const char *file, int line); -/*! \brief Terminate all child FSM instances of an FSM instance. +/*! Terminate all child FSM instances of an FSM instance. * * This is a macro that calls _osmo_fsm_inst_term_children() with the given * parameters as well as the caller's source file and line number for logging |