libosmocore 1.9.0.196-9975
Osmocom core library
tdef.h File Reference

API to define Tnnn timers globally and use for FSM state changes. More...

#include <stdint.h>
#include <osmocom/core/utils.h>

Go to the source code of this file.

Data Structures

struct  osmo_tdef
 Define a GSM timer of the form Tnnn, with unit, default value and doc string. More...
 
struct  osmo_tdef_state_timeout
 Using osmo_tdef for osmo_fsm_inst: array entry for a mapping of state numbers to timeout definitions. More...
 
struct  osmo_tdef_group
 Manage timer definitions in named groups. More...
 

Macros

#define osmo_tdef_for_each(t, tdefs)    for (t = tdefs; t && (t->T || t->default_val || t->desc); t++)
 Iterate an array of struct osmo_tdef, the last item should be fully zero, i.e. More...
 
#define osmo_tdef_fsm_inst_state_chg(fi, state, timeouts_array, tdefs, default_timeout)
 Call osmo_fsm_inst_state_chg[_ms]() or osmo_fsm_inst_state_chg_keep_timer[_ms](), depending on the timeouts_array, tdefs and default_timeout. More...
 
#define osmo_tdef_groups_for_each(g, tdef_groups)    for (g = tdef_groups; g && g->tdefs; g++)
 Iterate an array of struct osmo_tdef_group, the last item should be fully zero, i.e. More...
 

Enumerations

enum  osmo_tdef_unit {
  OSMO_TDEF_S = 0 ,
  OSMO_TDEF_MS ,
  OSMO_TDEF_M ,
  OSMO_TDEF_CUSTOM ,
  OSMO_TDEF_US
}
 

Functions

static const char * osmo_tdef_unit_name (enum osmo_tdef_unit val)
 
void osmo_tdefs_reset (struct osmo_tdef *tdefs)
 Set all osmo_tdef values to the default_val. More...
 
unsigned long osmo_tdef_get (const struct osmo_tdef *tdefs, int T, enum osmo_tdef_unit as_unit, long val_if_not_present)
 Return the value of a T timer from a list of osmo_tdef, in the given unit. More...
 
struct osmo_tdefosmo_tdef_get_entry (struct osmo_tdef *tdefs, int T)
 Find tdef entry matching T. More...
 
int osmo_tdef_set (struct osmo_tdef *tdefs, int T, unsigned long val, enum osmo_tdef_unit val_unit)
 Set value in entry matching T, converting val from val_unit to unit of T. More...
 
bool osmo_tdef_val_in_range (struct osmo_tdef *tdef, unsigned long new_val)
 Check if value new_val is in range of valid possible values for timer entry tdef. More...
 
int osmo_tdef_range_str_buf (char *buf, size_t buf_len, struct osmo_tdef *t)
 Write string representation of osmo_tdef range into buf. More...
 
const struct osmo_tdef_state_timeoutosmo_tdef_get_state_timeout (uint32_t state, const struct osmo_tdef_state_timeout *timeouts_array)
 Using osmo_tdef for osmo_fsm_inst: find a given state's osmo_tdef_state_timeout entry. More...
 
int _osmo_tdef_fsm_inst_state_chg (struct osmo_fsm_inst *fi, uint32_t state, const struct osmo_tdef_state_timeout *timeouts_array, const struct osmo_tdef *tdefs, signed long default_timeout, const char *file, int line)
 

Variables

const struct value_string osmo_tdef_unit_names []
 

Detailed Description

API to define Tnnn timers globally and use for FSM state changes.