libosmo-sigtran 2.0.0.52-6412
Osmocom SIGTRAN library
xua_default_lm_fsm.c File Reference
#include <errno.h>
#include <osmocom/core/fsm.h>
#include <osmocom/core/logging.h>
#include <osmocom/sigtran/osmo_ss7.h>
#include <osmocom/sigtran/sigtran_sap.h>
#include <osmocom/sigtran/protocol/m3ua.h>
#include "xua_internal.h"
#include "xua_asp_fsm.h"
#include "ss7_as.h"
#include "ss7_asp.h"
#include "ss7_xua_srv.h"

Data Structures

struct  lm_fsm_priv
 

Macros

#define S(x)   (1 << (x))
 
#define lm_fsm_state_chg(fi, NEXT_STATE)
 

Enumerations

enum  lm_state {
  S_IDLE , S_WAIT_ASP_UP , S_WAIT_NOTIFY , S_RKM_REG ,
  S_ACTIVE
}
 
enum  lm_event {
  LM_E_SCTP_EST_IND , LM_E_ASP_UP_CONF , LM_E_NOTIFY_IND , LM_E_AS_INACTIVE_IND ,
  LM_E_AS_ACTIVE_IND , LM_E_AS_STATUS_IND , LM_E_RKM_REG_CONF , LM_E_SCTP_DISC_IND
}
 

Functions

 osmo_static_assert (ARRAY_SIZE(ss7_asp_lm_timer_defaults)==(SS7_ASP_LM_TIMERS_LEN) &&ARRAY_SIZE(ss7_asp_lm_timer_names)==(SS7_ASP_LM_TIMERS_LEN), assert_ss7_asp_lm_timer_count)
 
static struct osmo_ss7_asfind_first_as_in_asp (struct osmo_ss7_asp *asp)
 
static int handle_reg_conf (struct osmo_fsm_inst *fi, uint32_t l_rk_id, uint32_t rctx)
 
static void restart_asp (struct osmo_fsm_inst *fi)
 
static void lm_idle (struct osmo_fsm_inst *fi, uint32_t event, void *data)
 
static void lm_wait_asp_up (struct osmo_fsm_inst *fi, uint32_t event, void *data)
 
static int lm_timer_cb (struct osmo_fsm_inst *fi)
 
static void lm_wait_notify (struct osmo_fsm_inst *fi, uint32_t event, void *data)
 
static void lm_rkm_reg (struct osmo_fsm_inst *fi, uint32_t event, void *data)
 
static void lm_active (struct osmo_fsm_inst *fi, uint32_t event, void *data)
 
static void lm_allstate (struct osmo_fsm_inst *fi, uint32_t event, void *data)
 
static int default_lm_prim_cb (struct osmo_prim_hdr *oph, void *_asp)
 
int osmo_ss7_asp_use_default_lm (struct osmo_ss7_asp *asp, int log_level)
 

Variables

static const struct value_string lm_event_names []
 
const struct osmo_tdef ss7_asp_lm_timer_defaults [SS7_ASP_LM_TIMERS_LEN]
 
const struct value_string ss7_asp_lm_timer_names []
 
static const struct osmo_tdef_state_timeout lm_fsm_timeouts [32]
 
static const struct osmo_fsm_state lm_states []
 
static const struct osmo_prim_event_map lm_event_map []
 
struct osmo_fsm xua_default_lm_fsm
 
static const struct osmo_xua_layer_manager default_layer_manager
 

Macro Definition Documentation

◆ lm_fsm_state_chg

#define lm_fsm_state_chg (   fi,
  NEXT_STATE 
)
Value:
osmo_tdef_fsm_inst_state_chg(fi, NEXT_STATE, \
((struct lm_fsm_priv *)(fi->priv))->asp->cfg.T_defs_lm, \
-1)
Definition: xua_default_lm_fsm.c:119
static const struct osmo_tdef_state_timeout lm_fsm_timeouts[32]
Definition: xua_default_lm_fsm.c:111

◆ S

#define S (   x)    (1 << (x))

Enumeration Type Documentation

◆ lm_event

enum lm_event
Enumerator
LM_E_SCTP_EST_IND 
LM_E_ASP_UP_CONF 
LM_E_NOTIFY_IND 
LM_E_AS_INACTIVE_IND 
LM_E_AS_ACTIVE_IND 
LM_E_AS_STATUS_IND 
LM_E_RKM_REG_CONF 
LM_E_SCTP_DISC_IND 

◆ lm_state

enum lm_state
Enumerator
S_IDLE 
S_WAIT_ASP_UP 
S_WAIT_NOTIFY 
S_RKM_REG 
S_ACTIVE 

Function Documentation

◆ default_lm_prim_cb()

static int default_lm_prim_cb ( struct osmo_prim_hdr *  oph,
void *  _asp 
)
static

◆ find_first_as_in_asp()

static struct osmo_ss7_as * find_first_as_in_asp ( struct osmo_ss7_asp asp)
static

◆ handle_reg_conf()

static int handle_reg_conf ( struct osmo_fsm_inst *  fi,
uint32_t  l_rk_id,
uint32_t  rctx 
)
static

◆ lm_active()

◆ lm_allstate()

static void lm_allstate ( struct osmo_fsm_inst *  fi,
uint32_t  event,
void *  data 
)
static

◆ lm_idle()

static void lm_idle ( struct osmo_fsm_inst *  fi,
uint32_t  event,
void *  data 
)
static

◆ lm_rkm_reg()

◆ lm_timer_cb()

◆ lm_wait_asp_up()

static void lm_wait_asp_up ( struct osmo_fsm_inst *  fi,
uint32_t  event,
void *  data 
)
static

◆ lm_wait_notify()

◆ osmo_ss7_asp_use_default_lm()

◆ osmo_static_assert()

osmo_static_assert ( ARRAY_SIZE(ss7_asp_lm_timer_defaults = =(SS7_ASP_LM_TIMERS_LEN) &&ARRAY_SIZE(ss7_asp_lm_timer_names)==(SS7_ASP_LM_TIMERS_LEN),
assert_ss7_asp_lm_timer_count   
)

◆ restart_asp()

static void restart_asp ( struct osmo_fsm_inst *  fi)
static

Variable Documentation

◆ default_layer_manager

const struct osmo_xua_layer_manager default_layer_manager
static
Initial value:
= {
.prim_cb = default_lm_prim_cb,
}
static int default_lm_prim_cb(struct osmo_prim_hdr *oph, void *_asp)
Definition: xua_default_lm_fsm.c:393

Referenced by osmo_ss7_asp_use_default_lm().

◆ lm_event_map

const struct osmo_prim_event_map lm_event_map[]
static
Initial value:
= {
{ 0, 0, 0, OSMO_NO_EVENT },
}
@ OSMO_XLM_PRIM_M_AS_ACTIVE
Definition: sigtran_sap.h:26
@ OSMO_XLM_PRIM_M_SCTP_RELEASE
Definition: sigtran_sap.h:15
@ OSMO_XLM_PRIM_M_SCTP_ESTABLISH
Definition: sigtran_sap.h:14
@ OSMO_XLM_PRIM_M_RK_REG
Definition: sigtran_sap.h:30
@ OSMO_XLM_PRIM_M_ASP_UP
Definition: sigtran_sap.h:22
@ OSMO_XLM_PRIM_M_NOTIFY
Definition: sigtran_sap.h:20
@ OSMO_XLM_PRIM_M_AS_STATUS
Definition: sigtran_sap.h:19
@ OSMO_XLM_PRIM_M_AS_INACTIVE
Definition: sigtran_sap.h:27
@ XUA_SAP_LM
Definition: sigtran_sap.h:9
@ LM_E_AS_INACTIVE_IND
Definition: xua_default_lm_fsm.c:63
@ LM_E_NOTIFY_IND
Definition: xua_default_lm_fsm.c:62
@ LM_E_AS_STATUS_IND
Definition: xua_default_lm_fsm.c:65
@ LM_E_SCTP_DISC_IND
Definition: xua_default_lm_fsm.c:67
@ LM_E_RKM_REG_CONF
Definition: xua_default_lm_fsm.c:66
@ LM_E_AS_ACTIVE_IND
Definition: xua_default_lm_fsm.c:64
@ LM_E_SCTP_EST_IND
Definition: xua_default_lm_fsm.c:60
@ LM_E_ASP_UP_CONF
Definition: xua_default_lm_fsm.c:61

Referenced by default_lm_prim_cb().

◆ lm_event_names

const struct value_string lm_event_names[]
static
Initial value:
= {
{ LM_E_SCTP_EST_IND, "SCTP-ESTABLISH.ind" },
{ LM_E_ASP_UP_CONF, "ASP-UP.conf" },
{ LM_E_NOTIFY_IND, "NOTIFY.ind" },
{ LM_E_AS_INACTIVE_IND, "AS-INACTIVE.ind" },
{ LM_E_AS_ACTIVE_IND, "AS-ACTIVE.ind" },
{ LM_E_AS_STATUS_IND, "AS-STATUS.ind" },
{ LM_E_RKM_REG_CONF, "RKM_REG.conf" },
{ LM_E_SCTP_DISC_IND, "SCTP-RELEASE.ind" },
{ 0, NULL }
}

◆ lm_fsm_timeouts

const struct osmo_tdef_state_timeout lm_fsm_timeouts[32]
static
Initial value:
= {
[S_IDLE] = { },
[S_ACTIVE] = { },
}
@ S_WAIT_ASP_UP
Definition: xua_default_lm_fsm.c:50
@ S_WAIT_NOTIFY
Definition: xua_default_lm_fsm.c:52
@ S_IDLE
Definition: xua_default_lm_fsm.c:48
@ S_RKM_REG
Definition: xua_default_lm_fsm.c:54
@ S_ACTIVE
Definition: xua_default_lm_fsm.c:56
@ SS7_ASP_LM_T_WAIT_ASP_UP
Definition: xua_internal.h:94
@ SS7_ASP_LM_T_WAIT_NOTIFY
Definition: xua_internal.h:95
@ SS7_ASP_LM_T_WAIT_RK_REG_RESP
Definition: xua_internal.h:97

◆ lm_states

const struct osmo_fsm_state lm_states[]
static

◆ ss7_asp_lm_timer_defaults

const struct osmo_tdef ss7_asp_lm_timer_defaults[SS7_ASP_LM_TIMERS_LEN]
Initial value:
= {
{ .T = SS7_ASP_LM_T_WAIT_ASP_UP, .default_val = 20, .unit = OSMO_TDEF_S,
.desc = "Restart ASP after timeout waiting for ASP UP (SG role) / ASP UP ACK (ASP role) (s)" },
{ .T = SS7_ASP_LM_T_WAIT_NOTIFY, .default_val = 2, .unit = OSMO_TDEF_S,
.desc = "Restart ASP after timeout waiting for NOTIFY (s)" },
{ .T = SS7_ASP_LM_T_WAIT_NOTIY_RKM, .default_val = 20, .unit = OSMO_TDEF_S,
.desc = "Restart ASP after timeout waiting for NOTIFY after RKM registration (s)" },
{ .T = SS7_ASP_LM_T_WAIT_RK_REG_RESP, .default_val = 10, .unit = OSMO_TDEF_S,
.desc = "Restart ASP after timeout waiting for RK_REG_RESP (s)" },
{}
}
@ SS7_ASP_LM_T_WAIT_NOTIY_RKM
Definition: xua_internal.h:96

Referenced by gen_asp_timer_cmd_strs(), and ss7_asp_alloc().

◆ ss7_asp_lm_timer_names

const struct value_string ss7_asp_lm_timer_names[]
Initial value:
= {
{ SS7_ASP_LM_T_WAIT_ASP_UP, "wait_asp_up" },
{ SS7_ASP_LM_T_WAIT_NOTIFY, "wait_notify" },
{ SS7_ASP_LM_T_WAIT_NOTIY_RKM, "wait_notify_rkm" },
{ SS7_ASP_LM_T_WAIT_RK_REG_RESP, "wait_rk_reg_resp" },
{}
}

Referenced by DEFUN_ATTR(), gen_asp_timer_cmd_strs(), ss7_asp_lm_timer_name(), and write_asp_timers().

◆ xua_default_lm_fsm

struct osmo_fsm xua_default_lm_fsm
Initial value:
= {
.name = "xua_default_lm",
.states = lm_states,
.num_states = ARRAY_SIZE(lm_states),
.timer_cb = lm_timer_cb,
.event_names = lm_event_names,
.allstate_event_mask = S(LM_E_SCTP_DISC_IND),
.allstate_action = lm_allstate,
.log_subsys = DLSS7,
}
static void lm_allstate(struct osmo_fsm_inst *fi, uint32_t event, void *data)
Definition: xua_default_lm_fsm.c:325
static const struct value_string lm_event_names[]
Definition: xua_default_lm_fsm.c:70
static const struct osmo_fsm_state lm_states[]
Definition: xua_default_lm_fsm.c:334
static int lm_timer_cb(struct osmo_fsm_inst *fi)
Definition: xua_default_lm_fsm.c:199
#define S(x)
Definition: xua_default_lm_fsm.c:44

Referenced by osmo_ss7_asp_use_default_lm(), and osmo_ss7_init().