libosmocore  1.0.1
Osmocom core library

Osmocom generic Finite State Machine implementation. More...

#include <errno.h>
#include <stdbool.h>
#include <string.h>
#include <inttypes.h>
#include <osmocom/core/fsm.h>
#include <osmocom/core/talloc.h>
#include <osmocom/core/logging.h>
#include <osmocom/core/utils.h>

Functions

 LLIST_HEAD (osmo_g_fsms)
 
void osmo_fsm_log_addr (bool log_addr)
 specify if FSM instance addresses should be logged or not More...
 
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)
 
int osmo_fsm_register (struct osmo_fsm *fsm)
 register a FSM with the core More...
 
void osmo_fsm_unregister (struct osmo_fsm *fsm)
 unregister a FSM from the core More...
 
static void fsm_tmr_cb (void *data)
 
int osmo_fsm_inst_update_id (struct osmo_fsm_inst *fi, const char *id)
 Change id of the FSM instance. More...
 
static void update_name (struct osmo_fsm_inst *fi)
 
int osmo_fsm_inst_update_id_f (struct osmo_fsm_inst *fi, const char *fmt,...)
 Change id of the FSM instance using a string format. More...
 
struct osmo_fsm_instosmo_fsm_inst_alloc (struct osmo_fsm *fsm, void *ctx, void *priv, int log_level, const char *id)
 allocate a new instance of a specified FSM More...
 
struct osmo_fsm_instosmo_fsm_inst_alloc_child (struct osmo_fsm *fsm, struct osmo_fsm_inst *parent, uint32_t parent_term_event)
 allocate a new instance of a specified FSM as child of other FSM instance More...
 
void osmo_fsm_inst_unlink_parent (struct osmo_fsm_inst *fi, void *ctx)
 unlink child FSM from its parent FSM. More...
 
void osmo_fsm_inst_change_parent (struct osmo_fsm_inst *fi, struct osmo_fsm_inst *new_parent, uint32_t new_parent_term_event)
 change parent instance of an FSM. More...
 
void osmo_fsm_inst_free (struct osmo_fsm_inst *fi)
 delete a given instance of a FSM More...
 
const char * osmo_fsm_event_name (struct osmo_fsm *fsm, uint32_t event)
 get human-readable name of FSM event More...
 
const char * osmo_fsm_inst_name (struct osmo_fsm_inst *fi)
 get human-readable name of FSM instance More...
 
const char * osmo_fsm_state_name (struct osmo_fsm *fsm, uint32_t state)
 get human-readable name of FSM state More...
 
static int state_chg (struct osmo_fsm_inst *fi, uint32_t new_state, bool keep_timer, unsigned long timeout_secs, int T, const char *file, int line)
 
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)
 perform a state change of the given FSM instance More...
 
int _osmo_fsm_inst_state_chg_keep_timer (struct osmo_fsm_inst *fi, uint32_t new_state, const char *file, int line)
 perform a state change while keeping the current timer running. More...
 
int _osmo_fsm_inst_dispatch (struct osmo_fsm_inst *fi, uint32_t event, void *data, const char *file, int line)
 dispatch an event to an osmocom finite state machine instance More...
 
void _osmo_fsm_inst_term (struct osmo_fsm_inst *fi, enum osmo_fsm_term_cause cause, void *data, const char *file, int line)
 Terminate FSM instance with given cause. More...
 
void _osmo_fsm_inst_term_children (struct osmo_fsm_inst *fi, enum osmo_fsm_term_cause cause, void *data, const char *file, int line)
 Terminate all child FSM instances of an FSM instance. More...
 

Variables

static bool fsm_log_addr = true
 
const struct value_string osmo_fsm_term_cause_names []
 

Detailed Description

Osmocom generic Finite State Machine implementation.