libosmo-sigtran 2.2.1.4-74d0 Osmocom SIGTRAN library

Data Structures | Macros | Enumerations | Functions | Variables
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_as * | find_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 | 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)
void | osmo_ss7_asp_remove_default_lm (struct osmo_ss7_asp *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, \
lm_fsm_timeouts, \
((struct lm_fsm_priv *)(fi->priv))->asp->cfg.T_defs_lm, \
-1)
lm_fsm_priv
Definition: xua_default_lm_fsm.c:119
lm_fsm_timeouts
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

References lm_event_map, osmo_ss7_asp::lm_priv, and osmo_xlm_prim_name().

## ◆ find_first_as_in_asp()

static struct osmo_ss7_as * find_first_as_in_asp | ( | struct osmo_ss7_asp * | asp | ) |
| static

References osmo_ss7_instance::as_list, osmo_ss7_as::asps, osmo_ss7_as::cfg, osmo_ss7_asp::inst, osmo_ss7_as::list, and NULL.

Referenced by lm_timer_cb().

## ◆ handle_reg_conf()

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

References lm_fsm_priv::asp, osmo_ss7_as::cfg, osmo_ss7_routing_key::context, osmo_ss7_as::fi, osmo_ss7_asp::inst, osmo_ss7_as_find_by_l_rk_id(), and osmo_ss7_as::routing_key.

Referenced by lm_rkm_reg().

## ◆ lm_active()

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

References lm_fsm_priv::asp, data, osmo_ss7_asp::fi, LM_E_AS_INACTIVE_IND, LM_E_NOTIFY_IND, lm_fsm_state_chg, M3UA_NOTIFY_I_AS_ACT, M3UA_NOTIFY_T_STATCHG, osmo_xlm_prim::notify, NULL, osmo_xlm_prim::oph, OSMO_XLM_PRIM_M_NOTIFY, S_IDLE, osmo_xlm_prim_notify::status_info, osmo_xlm_prim_notify::status_type, osmo_xlm_prim::u, and XUA_ASP_E_M_ASP_ACTIVE_REQ.

## ◆ lm_allstate()

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

References LM_E_SCTP_DISC_IND, lm_fsm_state_chg, and S_IDLE.

## ◆ lm_idle()

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

References lm_fsm_priv::asp, osmo_ss7_asp::fi, LM_E_SCTP_EST_IND, lm_fsm_state_chg, NULL, S_WAIT_ASP_UP, and XUA_ASP_E_M_ASP_UP_REQ.

## ◆ lm_rkm_reg()

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

References lm_fsm_priv::asp, osmo_ss7_asp::cfg, osmo_ss7_routing_key::context, data, handle_reg_conf(), osmo_xlm_prim_rk_reg::key, osmo_ss7_routing_key::l_rk_id, LM_E_RKM_REG_CONF, M3UA_RKM_REG_SUCCESS, osmo_xlm_prim::rk_reg, S_WAIT_NOTIFY, ss7_asp_disconnect_stream(), SS7_ASP_LM_T_WAIT_NOTIY_RKM, osmo_xlm_prim_rk_reg::status, osmo_ss7_asp::T_defs_lm, and osmo_xlm_prim::u.

## ◆ lm_timer_cb()

static int lm_timer_cb | ( | struct osmo_fsm_inst * | fi | ) |
| static

References lm_fsm_priv::asp, osmo_ss7_as::cfg, osmo_ss7_asp::cfg, osmo_ss7_as::fi, find_first_as_in_asp(), osmo_xlm_prim_rk_reg::key, LM_E_AS_INACTIVE_IND, lm_fsm_state_chg, osmo_ss7_as::mode, NULL, osmo_xlm_prim::oph, OSMO_SS7_ASP_QUIRK_NO_NOTIFY, OSMO_XLM_PRIM_M_RK_REG, osmo_xlm_sap_down(), osmo_ss7_asp::quirks, osmo_xlm_prim::rk_reg, osmo_ss7_as::routing_key, S_RKM_REG, ss7_asp_disconnect_stream(), SS7_ASP_LM_T_WAIT_ASP_UP, SS7_ASP_LM_T_WAIT_NOTIFY, SS7_ASP_LM_T_WAIT_NOTIY_RKM, SS7_ASP_LM_T_WAIT_RK_REG_RESP, osmo_xlm_prim_rk_reg::traf_mode, osmo_xlm_prim::u, and xua_xlm_prim_alloc().

## ◆ lm_wait_asp_up()

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

References LM_E_ASP_UP_CONF, lm_fsm_state_chg, and S_WAIT_NOTIFY.

## ◆ lm_wait_notify()

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

References lm_fsm_priv::asp, data, osmo_ss7_asp::fi, LM_E_AS_INACTIVE_IND, LM_E_NOTIFY_IND, lm_fsm_state_chg, M3UA_NOTIFY_I_AS_ACT, M3UA_NOTIFY_T_STATCHG, osmo_xlm_prim::notify, NULL, osmo_xlm_prim::oph, OSMO_SS7_AS_TMOD_OVERRIDE, OSMO_XLM_PRIM_M_NOTIFY, S_ACTIVE, ss7_asp_determine_traf_mode(), osmo_xlm_prim_notify::status_info, osmo_xlm_prim_notify::status_type, osmo_xlm_prim::u, and XUA_ASP_E_M_ASP_ACTIVE_REQ.

## ◆ osmo_ss7_asp_remove_default_lm()

void osmo_ss7_asp_remove_default_lm | ( | struct osmo_ss7_asp * | asp | ) |

References osmo_ss7_asp::lm_priv, and NULL.

Referenced by osmo_ss7_asp_restart().

## ◆ osmo_ss7_asp_use_default_lm()

int osmo_ss7_asp_use_default_lm | ( | struct osmo_ss7_asp * | asp,
|  | int | log_level
| ) |  |

References lm_fsm_priv::asp, osmo_ss7_asp::cfg, default_layer_manager, osmo_ss7_asp::lm, osmo_ss7_asp::lm_priv, osmo_ss7_asp::name, NULL, and xua_default_lm_fsm.

Referenced by osmo_ss7_asp_restart().

## ◆ 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 |
| ) |  |

## Variable Documentation

## ◆ default_layer_manager

const struct osmo_xua_layer_manager default_layer_manager
| static

Initial value:
= {
.prim_cb = default_lm_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:396

Referenced by osmo_ss7_asp_use_default_lm().

## ◆ lm_event_map

const struct osmo_prim_event_map lm_event_map[]
| static

Initial value:
= {
{ XUA_SAP_LM, OSMO_XLM_PRIM_M_SCTP_ESTABLISH, PRIM_OP_INDICATION, LM_E_SCTP_EST_IND },
{ XUA_SAP_LM, OSMO_XLM_PRIM_M_SCTP_RELEASE, PRIM_OP_INDICATION, LM_E_SCTP_DISC_IND },
{ XUA_SAP_LM, OSMO_XLM_PRIM_M_ASP_UP, PRIM_OP_CONFIRM, LM_E_ASP_UP_CONF },
{ XUA_SAP_LM, OSMO_XLM_PRIM_M_AS_STATUS, PRIM_OP_INDICATION, LM_E_AS_STATUS_IND },
{ XUA_SAP_LM, OSMO_XLM_PRIM_M_NOTIFY, PRIM_OP_INDICATION, LM_E_NOTIFY_IND },
{ XUA_SAP_LM, OSMO_XLM_PRIM_M_AS_INACTIVE, PRIM_OP_INDICATION, LM_E_AS_INACTIVE_IND },
{ XUA_SAP_LM, OSMO_XLM_PRIM_M_AS_ACTIVE, PRIM_OP_INDICATION, LM_E_AS_ACTIVE_IND },
{ XUA_SAP_LM, OSMO_XLM_PRIM_M_RK_REG, PRIM_OP_CONFIRM, LM_E_RKM_REG_CONF },
{ 0, 0, 0, OSMO_NO_EVENT },
}
OSMO_XLM_PRIM_M_AS_ACTIVE
@ OSMO_XLM_PRIM_M_AS_ACTIVE
Definition: sigtran_sap.h:26
OSMO_XLM_PRIM_M_SCTP_RELEASE
@ OSMO_XLM_PRIM_M_SCTP_RELEASE
Definition: sigtran_sap.h:15
OSMO_XLM_PRIM_M_SCTP_ESTABLISH
@ OSMO_XLM_PRIM_M_SCTP_ESTABLISH
Definition: sigtran_sap.h:14
OSMO_XLM_PRIM_M_RK_REG
@ OSMO_XLM_PRIM_M_RK_REG
Definition: sigtran_sap.h:30
OSMO_XLM_PRIM_M_ASP_UP
@ OSMO_XLM_PRIM_M_ASP_UP
Definition: sigtran_sap.h:22
OSMO_XLM_PRIM_M_NOTIFY
@ OSMO_XLM_PRIM_M_NOTIFY
Definition: sigtran_sap.h:20
OSMO_XLM_PRIM_M_AS_STATUS
@ OSMO_XLM_PRIM_M_AS_STATUS
Definition: sigtran_sap.h:19
OSMO_XLM_PRIM_M_AS_INACTIVE
@ OSMO_XLM_PRIM_M_AS_INACTIVE
Definition: sigtran_sap.h:27
XUA_SAP_LM
@ XUA_SAP_LM
Definition: sigtran_sap.h:9
LM_E_AS_INACTIVE_IND
@ LM_E_AS_INACTIVE_IND
Definition: xua_default_lm_fsm.c:63
LM_E_NOTIFY_IND
@ LM_E_NOTIFY_IND
Definition: xua_default_lm_fsm.c:62
LM_E_AS_STATUS_IND
@ LM_E_AS_STATUS_IND
Definition: xua_default_lm_fsm.c:65
LM_E_SCTP_DISC_IND
@ LM_E_SCTP_DISC_IND
Definition: xua_default_lm_fsm.c:67
LM_E_RKM_REG_CONF
@ LM_E_RKM_REG_CONF
Definition: xua_default_lm_fsm.c:66
LM_E_AS_ACTIVE_IND
@ LM_E_AS_ACTIVE_IND
Definition: xua_default_lm_fsm.c:64
LM_E_SCTP_EST_IND
@ LM_E_SCTP_EST_IND
Definition: xua_default_lm_fsm.c:60
LM_E_ASP_UP_CONF
@ 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 }
}
NULL
int and can be left NULL
Definition: osmo_ss7.h:364

## ◆ lm_fsm_timeouts

const struct osmo_tdef_state_timeout lm_fsm_timeouts[32]
| static

Initial value:
= {
[S_IDLE] = { },
[S_WAIT_ASP_UP] = { .T = SS7_ASP_LM_T_WAIT_ASP_UP },
[S_WAIT_NOTIFY] = { .T = SS7_ASP_LM_T_WAIT_NOTIFY },
[S_RKM_REG] = { .T = SS7_ASP_LM_T_WAIT_RK_REG_RESP },
[S_ACTIVE] = { },
}
S_WAIT_ASP_UP
@ S_WAIT_ASP_UP
Definition: xua_default_lm_fsm.c:50
S_WAIT_NOTIFY
@ S_WAIT_NOTIFY
Definition: xua_default_lm_fsm.c:52
S_IDLE
@ S_IDLE
Definition: xua_default_lm_fsm.c:48
S_RKM_REG
@ S_RKM_REG
Definition: xua_default_lm_fsm.c:54
S_ACTIVE
@ S_ACTIVE
Definition: xua_default_lm_fsm.c:56
SS7_ASP_LM_T_WAIT_ASP_UP
@ SS7_ASP_LM_T_WAIT_ASP_UP
Definition: xua_internal.h:114
SS7_ASP_LM_T_WAIT_NOTIFY
@ SS7_ASP_LM_T_WAIT_NOTIFY
Definition: xua_internal.h:115
SS7_ASP_LM_T_WAIT_RK_REG_RESP
@ SS7_ASP_LM_T_WAIT_RK_REG_RESP
Definition: xua_internal.h:117

## ◆ 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
@ SS7_ASP_LM_T_WAIT_NOTIY_RKM
Definition: xua_internal.h:116

Referenced by gen_asp_timer_lm_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_lm_cmd_strs(), ss7_asp_lm_timer_name(), and write_asp_timers_lm().

## ◆ 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,
}
lm_allstate
static void lm_allstate(struct osmo_fsm_inst *fi, uint32_t event, void *data)
Definition: xua_default_lm_fsm.c:320
lm_event_names
static const struct value_string lm_event_names[]
Definition: xua_default_lm_fsm.c:70
lm_states
static const struct osmo_fsm_state lm_states[]
Definition: xua_default_lm_fsm.c:329
lm_timer_cb
static int lm_timer_cb(struct osmo_fsm_inst *fi)
Definition: xua_default_lm_fsm.c:188
S
#define S(x)
Definition: xua_default_lm_fsm.c:44

Referenced by osmo_ss7_asp_use_default_lm(), and osmo_ss7_init().