libosmo-sigtran 2.2.1.95-893c Osmocom SIGTRAN library

Data Structures | Macros | Enumerations | Functions | Variables
xua_asp_fsm.c File Reference
`#include "config.h"`
`#include <errno.h>`
`#include <osmocom/core/fsm.h>`
`#include <osmocom/core/utils.h>`
`#include <osmocom/core/timer.h>`
`#include <osmocom/core/prim.h>`
`#include <osmocom/core/logging.h>`
`#include <osmocom/core/select.h>`
`#include <osmocom/gsm/ipa.h>`
`#include <osmocom/netif/stream.h>`
`#include <osmocom/netif/ipa.h>`
`#include <osmocom/sigtran/osmo_ss7.h>`
`#include <osmocom/sigtran/sigtran_sap.h>`
`#include "xua_msg.h"`
`#include <osmocom/sigtran/protocol/sua.h>`
`#include "ss7_as.h"`
`#include "ss7_asp.h"`
`#include "ss7_internal.h"`
`#include "ss7_xua_srv.h"`
`#include "sccp_internal.h"`
`#include "xua_asp_fsm.h"`
`#include "xua_as_fsm.h"`
`#include "xua_lm_sap.h"`
`#include "xua_internal.h"`

## Data Structures
struct | xua_asp_fsm_priv
struct | ipa_asp_fsm_priv

## Macros
#define | S(x) (1 << (x))
#define | ENSURE_ROLE_COND(fi, event, cond)
#define | ENSURE_IPSP(fi, event) ENSURE_ROLE_COND(fi, event, _role == OSMO_SS7_ASP_ROLE_IPSP)
#define | ENSURE_ASP_OR_IPSP(fi, event) ENSURE_ROLE_COND(fi, event, _role == OSMO_SS7_ASP_ROLE_ASP || _role == OSMO_SS7_ASP_ROLE_IPSP)
#define | ENSURE_SG_OR_IPSP(fi, event) ENSURE_ROLE_COND(fi, event, _role == OSMO_SS7_ASP_ROLE_SG || _role == OSMO_SS7_ASP_ROLE_IPSP)

## Enumerations
enum | ipa_asp_state { IPA_ASP_S_DOWN = XUA_ASP_S_DOWN , IPA_ASP_S_INACTIVE = XUA_ASP_S_INACTIVE , IPA_ASP_S_ACTIVE = XUA_ASP_S_ACTIVE , IPA_ASP_S_WAIT_ID_RESP , IPA_ASP_S_WAIT_ID_GET , IPA_ASP_S_WAIT_ID_ACK , IPA_ASP_S_WAIT_ID_ACK2 }
enum | ipa_asp_fsm_t { T_WAIT_ID_RESP = 1 , T_WAIT_ID_ACK , T_WAIT_ID_GET }

## Functions
static void | send_xlm_prim_simple (struct osmo_fsm_inst *fi, enum osmo_xlm_prim_type prim_type, enum osmo_prim_operation op)
static void | xua_asp_tx_snm_daud_address_book (struct osmo_ss7_asp *asp)
static int | xua_msg_add_asp_rctx (struct xua_msg *xua, struct osmo_ss7_asp *asp)
static int | xua_asp_tx_unsolicited_aspia_ack (struct osmo_ss7_asp *asp)
static int | peer_send (struct osmo_fsm_inst *fi, int out_event, struct xua_msg *in)
static int | peer_send_error_ext (struct osmo_fsm_inst *fi, uint32_t err_code, const uint8_t *rctx_be, unsigned int rctx_size)
static int | peer_send_error (struct osmo_fsm_inst *fi, uint32_t err_code)
static void | xua_t_ack_cb (void *data)
static int | peer_send_and_start_t_ack (struct osmo_fsm_inst *fi, int out_event)
static void | dispatch_to_all_as (struct osmo_fsm_inst *fi, uint32_t event, void *data)
static void | stop_t_ack (struct osmo_fsm_inst *fi)
static void | check_stop_t_ack (struct osmo_fsm_inst *fi, uint32_t event)
static void | xua_t_beat_stop (struct osmo_fsm_inst *fi)
static void | xua_t_beat_send (struct osmo_fsm_inst *fi)
static void | xua_t_beat_cb (void *_fi)
static void | common_asp_fsm_down_onenter (struct osmo_ss7_asp *asp)
static void | xua_asp_fsm_down_onenter (struct osmo_fsm_inst *fi, uint32_t prev_state)
static void | xua_asp_fsm_down (struct osmo_fsm_inst *fi, uint32_t event, void *data)
static void | xua_asp_fsm_inactive_onenter (struct osmo_fsm_inst *fi, uint32_t prev_state)
static void | xua_asp_fsm_inactive (struct osmo_fsm_inst *fi, uint32_t event, void *data)
static void | xua_asp_fsm_active_onenter (struct osmo_fsm_inst *fi, uint32_t prev_state)
static void | xua_asp_fsm_active (struct osmo_fsm_inst *fi, uint32_t event, void *data)
static void | xua_asp_allstate (struct osmo_fsm_inst *fi, uint32_t event, void *data)
static int | xua_asp_fsm_timer_cb (struct osmo_fsm_inst *fi)
static void | xua_asp_fsm_cleanup (struct osmo_fsm_inst *fi, enum osmo_fsm_term_cause cause)
static int | ipa_asp_fsm_start (struct osmo_ss7_asp *asp, int log_level)
| Start a new ASP finite state machine for given ASP (stored on asp->fi) More...
int | xua_asp_fsm_start (struct osmo_ss7_asp *asp, int log_level)
| Start a new ASP finite state machine for given ASP (stored in asp->fi) More...
static int | get_fd_from_iafp (struct ipa_asp_fsm_priv *iafp)
static void | ipa_t_beat_stop (struct osmo_fsm_inst *fi)
static void | ipa_t_beat_send (struct osmo_fsm_inst *fi)
static void | ipa_t_beat_cb (void *_fi)
static void | ipa_asp_fsm_down_onenter (struct osmo_fsm_inst *fi, uint32_t prev_state)
static void | ipa_asp_fsm_down (struct osmo_fsm_inst *fi, uint32_t event, void *data)
static void | ipa_asp_fsm_wait_id_resp (struct osmo_fsm_inst *fi, uint32_t event, void *data)
static void | ipa_asp_fsm_wait_id_ack2 (struct osmo_fsm_inst *fi, uint32_t event, void *data)
static void | ipa_asp_fsm_wait_id_get (struct osmo_fsm_inst *fi, uint32_t event, void *data)
static void | ipa_asp_fsm_wait_id_ack (struct osmo_fsm_inst *fi, uint32_t event, void *data)
static void | ipa_asp_fsm_active_onenter (struct osmo_fsm_inst *fi, uint32_t prev_state)
static void | ipa_asp_fsm_active (struct osmo_fsm_inst *fi, uint32_t event, void *data)
static void | ipa_asp_fsm_inactive_onenter (struct osmo_fsm_inst *fi, uint32_t prev_state)
static void | ipa_asp_fsm_inactive (struct osmo_fsm_inst *fi, uint32_t event, void *data)
static void | _ipa_asp_pick_unused_sls (struct osmo_ss7_asp *asp, const struct osmo_ss7_as *as)
static void | ipa_asp_allstate (struct osmo_fsm_inst *fi, uint32_t event, void *data)
static int | ipa_asp_fsm_timer_cb (struct osmo_fsm_inst *fi)
static void | ipa_asp_fsm_cleanup (struct osmo_fsm_inst *fi, enum osmo_fsm_term_cause cause)

## Variables
static const struct value_string | xua_asp_event_names []
static const uint32_t | evt_ack_map [_NUM_XUA_ASP_E]
static const struct osmo_fsm_state | xua_asp_states []
struct osmo_fsm | xua_asp_fsm
static const struct osmo_fsm_state | ipa_asp_states []
struct osmo_fsm | ipa_asp_fsm

## Macro Definition Documentation

## ◆ ENSURE_ASP_OR_IPSP

#define ENSURE_ASP_OR_IPSP | ( |  | fi,
|  |  | event
| ) |  | ENSURE_ROLE_COND(fi, event, _role == OSMO_SS7_ASP_ROLE_ASP || _role == OSMO_SS7_ASP_ROLE_IPSP)

## ◆ ENSURE_IPSP

#define ENSURE_IPSP | ( |  | fi,
|  |  | event
| ) |  | ENSURE_ROLE_COND(fi, event, _role == OSMO_SS7_ASP_ROLE_IPSP)

## ◆ ENSURE_ROLE_COND

#define ENSURE_ROLE_COND | ( |  | fi,
|  |  | event,
|  |  | cond
| ) |  |

Value:
do { \
struct xua_asp_fsm_priv *_xafp = fi->priv; \
enum osmo_ss7_asp_role _role = _xafp->asp->cfg.role; \
if (!(cond)) { \
LOGPFSML(fi, LOGL_ERROR, "event %s not permitted " \
"in role %s\n", \
osmo_fsm_event_name(fi->fsm, event), \
get_value_string(osmo_ss7_asp_role_names, _role));\
return; \
} \
} while (0)
osmo_ss7_asp_role
osmo_ss7_asp_role
Definition: osmo_ss7.h:243
osmo_ss7_asp_role_names
const struct value_string osmo_ss7_asp_role_names[]
Definition: ss7_asp.c:153
osmo_ss7_asp::role
enum osmo_ss7_asp_role role
Definition: ss7_asp.h:122
osmo_ss7_asp::cfg
struct osmo_ss7_asp::@27 cfg
xua_asp_fsm_priv
Definition: xua_asp_fsm.c:91
xua_asp_fsm_priv::asp
struct osmo_ss7_asp * asp
Definition: xua_asp_fsm.c:93

## ◆ ENSURE_SG_OR_IPSP

#define ENSURE_SG_OR_IPSP | ( |  | fi,
|  |  | event
| ) |  | ENSURE_ROLE_COND(fi, event, _role == OSMO_SS7_ASP_ROLE_SG || _role == OSMO_SS7_ASP_ROLE_IPSP)

## ◆ S

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

## Enumeration Type Documentation

## ◆ ipa_asp_fsm_t

enum ipa_asp_fsm_t

Enumerator
T_WAIT_ID_RESP |
T_WAIT_ID_ACK |
T_WAIT_ID_GET |

## ◆ ipa_asp_state

enum ipa_asp_state

Enumerator
IPA_ASP_S_DOWN |
IPA_ASP_S_INACTIVE |
IPA_ASP_S_ACTIVE |
IPA_ASP_S_WAIT_ID_RESP |
IPA_ASP_S_WAIT_ID_GET |
IPA_ASP_S_WAIT_ID_ACK |
IPA_ASP_S_WAIT_ID_ACK2 |

## Function Documentation

## ◆ _ipa_asp_pick_unused_sls()

static void _ipa_asp_pick_unused_sls | ( | struct osmo_ss7_asp * | asp,
|  | const struct osmo_ss7_as * | as
| ) |  |
| static

References ss7_as_asp_assoc::as, ss7_as_asp_assoc::as_entry, ss7_as_asp_assoc::asp, osmo_ss7_as::assoc_asp_list, osmo_ss7_asp::ipa, LOGPASP, sls, osmo_ss7_asp::sls, and osmo_ss7_asp::sls_assigned.

Referenced by ipa_asp_allstate(), and ipa_asp_fsm_start().

## ◆ check_stop_t_ack()

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

References evt_ack_map, xua_asp_fsm_priv::out_event, stop_t_ack(), and xua_asp_fsm_priv::t_ack.

Referenced by xua_asp_fsm_active(), xua_asp_fsm_down(), and xua_asp_fsm_inactive().

## ◆ common_asp_fsm_down_onenter()

static void common_asp_fsm_down_onenter | ( | struct osmo_ss7_asp * | asp | ) |
| static

References ss7_as_asp_assoc::as, ss7_as_asp_assoc::asp, ss7_as_asp_assoc::asp_entry, osmo_ss7_asp::assoc_as_list, dispatch_to_all_as(), osmo_ss7_asp::fi, osmo_ss7_asp::remote_asp_id_present, osmo_ss7_as::rkm_dyn_allocated, ss7_as_del_asp(), tcap_as_del_asp(), and XUA_ASPAS_ASP_DOWN_IND.

Referenced by ipa_asp_fsm_down_onenter(), and xua_asp_fsm_down_onenter().

## ◆ dispatch_to_all_as()

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

References ss7_as_asp_assoc::as, ss7_as_asp_assoc::asp, xua_asp_fsm_priv::asp, ss7_as_asp_assoc::asp_entry, osmo_ss7_asp::assoc_as_list, data, and osmo_ss7_as::fi.

Referenced by common_asp_fsm_down_onenter(), ipa_asp_fsm_active_onenter(), ipa_asp_fsm_inactive_onenter(), xua_asp_fsm_active_onenter(), and xua_asp_fsm_inactive_onenter().

## ◆ get_fd_from_iafp()

static int get_fd_from_iafp | ( | struct ipa_asp_fsm_priv * | iafp | ) |
| static

References ipa_asp_fsm_priv::asp, osmo_ss7_asp::client, and osmo_ss7_asp::server.

Referenced by ipa_asp_allstate(), ipa_asp_fsm_down(), ipa_asp_fsm_wait_id_ack(), ipa_asp_fsm_wait_id_get(), and ipa_asp_fsm_wait_id_resp().

## ◆ ipa_asp_allstate()

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

References _ipa_asp_pick_unused_sls(), ipa_asp_fsm_priv::asp, osmo_ss7_as::cfg, osmo_ss7_asp::cfg, data, osmo_ss7_as::fi, get_fd_from_iafp(), IPA_ASP_S_DOWN, ipa_asp_fsm_priv::ipa_unit, osmo_ss7_as::name, NULL, OSMO_SS7_ASP_ROLE_ASP, OSMO_XLM_PRIM_M_ASP_DOWN, osmo_ss7_asp::role, send_xlm_prim_simple(), ipa_asp_fsm_priv::t_beat, ipa_asp_fsm_priv::unacked_beats, XUA_ASP_E_AS_ASSIGNED, XUA_ASP_E_ASPSM_BEAT, XUA_ASP_E_ASPSM_BEAT_ACK, XUA_ASP_E_M_ASP_UP_REQ, XUA_ASP_E_SCTP_COMM_DOWN_IND, and XUA_ASP_E_SCTP_RESTART_IND.

## ◆ ipa_asp_fsm_active()

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

References IPA_ASP_S_DOWN, XUA_ASP_E_M_ASP_DOWN_REQ, and XUA_ASP_E_M_ASP_INACTIVE_REQ.

## ◆ ipa_asp_fsm_active_onenter()

static void ipa_asp_fsm_active_onenter | ( | struct osmo_fsm_inst * | fi,
|  | uint32_t | prev_state
| ) |  |
| static

References xua_as_event_asp_inactive_ind_pars::asp, ipa_asp_fsm_priv::asp, dispatch_to_all_as(), ipa_t_beat_send(), XUA_ASPAS_ASP_ACTIVE_IND, and XUA_ASPAS_ASP_INACTIVE_IND.

## ◆ ipa_asp_fsm_cleanup()

static void ipa_asp_fsm_cleanup | ( | struct osmo_fsm_inst * | fi,
|  | enum osmo_fsm_term_cause | cause
| ) |  |
| static

References ipa_asp_fsm_priv::asp, osmo_ss7_asp::fi, ipa_t_beat_stop(), and NULL.

## ◆ ipa_asp_fsm_down()

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

References ipa_asp_fsm_priv::asp, osmo_ss7_asp::cfg, get_fd_from_iafp(), IPA_ASP_S_WAIT_ID_GET, IPA_ASP_S_WAIT_ID_RESP, OSMO_SS7_ASP_ROLE_SG, osmo_ss7_asp::role, T_WAIT_ID_GET, T_WAIT_ID_RESP, XUA_ASP_E_M_ASP_UP_REQ, and XUA_ASP_E_SCTP_EST_IND.

## ◆ ipa_asp_fsm_down_onenter()

static void ipa_asp_fsm_down_onenter | ( | struct osmo_fsm_inst * | fi,
|  | uint32_t | prev_state
| ) |  |
| static

References xua_asp_fsm_priv::asp, common_asp_fsm_down_onenter(), osmo_ss7_asp::fi, and ipa_t_beat_stop().

## ◆ ipa_asp_fsm_inactive()

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

References IPA_ASP_S_DOWN, and XUA_ASP_E_M_ASP_DOWN_REQ.

## ◆ ipa_asp_fsm_inactive_onenter()

static void ipa_asp_fsm_inactive_onenter | ( | struct osmo_fsm_inst * | fi,
|  | uint32_t | prev_state
| ) |  |
| static

References xua_as_event_asp_inactive_ind_pars::asp, ipa_asp_fsm_priv::asp, dispatch_to_all_as(), and XUA_ASPAS_ASP_INACTIVE_IND.

## ◆ ipa_asp_fsm_start()

static int ipa_asp_fsm_start | ( | struct osmo_ss7_asp * | asp,
|  | int | log_level
| ) |  |
| static

Start a new ASP finite state machine for given ASP (stored on asp->fi)

Parameters

  [in] | asp | Application Server Process for which to start FSM
  [in] | log_level | Logging Level for ASP FSM logging

Returns
  0 on success; negative on error

References _ipa_asp_pick_unused_sls(), ipa_asp_fsm_priv::asp, osmo_ss7_as::cfg, osmo_ss7_asp::cfg, osmo_ss7_asp::dyn_allocated, osmo_ss7_as::fi, osmo_ss7_asp::fi, ipa_asp_fsm, ipa_t_beat_cb(), ipa_asp_fsm_priv::ipa_unit, osmo_ss7_as::name, osmo_ss7_asp::name, NULL, OSMO_SS7_ASP_ROLE_ASP, osmo_ss7_asp::role, ss7_asp_get_first_as(), ipa_asp_fsm_priv::t_beat, ipa_asp_fsm_priv::timer, and XUA_ASP_E_M_ASP_UP_REQ.

Referenced by xua_asp_fsm_start().

## ◆ ipa_asp_fsm_timer_cb()

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

References ipa_asp_fsm_priv::asp, and osmo_ss7_asp_disconnect().

## ◆ ipa_asp_fsm_wait_id_ack()

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

References get_fd_from_iafp(), IPA_ASP_E_ID_ACK, and IPA_ASP_S_ACTIVE.

## ◆ ipa_asp_fsm_wait_id_ack2()

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

References IPA_ASP_E_ID_ACK, and IPA_ASP_S_ACTIVE.

## ◆ ipa_asp_fsm_wait_id_get()

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

References ipa_asp_fsm_priv::asp, data, get_fd_from_iafp(), IPA_ASP_E_ID_ACK, IPA_ASP_E_ID_GET, IPA_ASP_S_ACTIVE, IPA_ASP_S_WAIT_ID_ACK, ipa_asp_fsm_priv::ipa_unit, osmo_ss7_asp_send(), and T_WAIT_ID_ACK.

## ◆ ipa_asp_fsm_wait_id_resp()

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

References ipa_asp_fsm_priv::asp, osmo_ss7_as::cfg, osmo_ss7_asp::cfg, data, get_fd_from_iafp(), osmo_ss7_asp::inst, IPA_ASP_E_ID_ACK, IPA_ASP_E_ID_RESP, IPA_ASP_S_WAIT_ID_ACK2, ipa_asp_fsm_priv::ipa_id_ack_rcvd, ipa_asp_fsm_priv::ipa_unit, osmo_ss7_as::name, osmo_ss7_asp::name, NULL, osmo_ss7_as_find_by_name(), osmo_ss7_asp_disconnect(), ss7_as_add_asp(), and T_WAIT_ID_ACK.

## ◆ ipa_t_beat_cb()

static void ipa_t_beat_cb | ( | void * | _fi | ) |
| static

References ipa_asp_fsm_priv::asp, ipa_t_beat_send(), ss7_asp_disconnect_stream(), ipa_asp_fsm_priv::t_beat, and ipa_asp_fsm_priv::unacked_beats.

Referenced by ipa_asp_fsm_start().

## ◆ ipa_t_beat_send()

static void ipa_t_beat_send | ( | struct osmo_fsm_inst * | fi | ) |
| static

References ipa_asp_fsm_priv::asp, osmo_ss7_asp::cfg, ipa_gen_ping(), ipa_t_beat_stop(), osmo_ss7_asp_send(), SS7_ASP_XUA_T_BEAT, ipa_asp_fsm_priv::t_beat, osmo_ss7_asp::T_defs_xua, ipa_asp_fsm_priv::timer, and ipa_asp_fsm_priv::unacked_beats.

Referenced by ipa_asp_fsm_active_onenter(), and ipa_t_beat_cb().

## ◆ ipa_t_beat_stop()

static void ipa_t_beat_stop | ( | struct osmo_fsm_inst * | fi | ) |
| static

References ipa_asp_fsm_priv::t_beat, ipa_asp_fsm_priv::timer, and ipa_asp_fsm_priv::unacked_beats.

Referenced by ipa_asp_fsm_cleanup(), ipa_asp_fsm_down_onenter(), and ipa_t_beat_send().

## ◆ peer_send()

static int peer_send | ( | struct osmo_fsm_inst * | fi,
|  | int | out_event,
|  | struct xua_msg * | in
| ) |  |
| static

References xua_asp_fsm_priv::asp, osmo_ss7_asp::cfg, xua_msg::hdr, osmo_ss7_asp::local_asp_id, osmo_ss7_asp::local_asp_id_present, M3UA_IEI_HEARDBT_DATA, M3UA_IEI_ROUTE_CTX, M3UA_IEI_TRAF_MODE_TYP, osmo_ss7_asp_send(), osmo_ss7_tmode_to_xua(), ss7_asp_determine_traf_mode(), SUA_ASPSM_BEAT, SUA_ASPSM_BEAT_ACK, SUA_ASPSM_DOWN, SUA_ASPSM_DOWN_ACK, SUA_ASPSM_UP, SUA_ASPSM_UP_ACK, SUA_ASPTM_ACTIVE, SUA_ASPTM_ACTIVE_ACK, SUA_ASPTM_INACTIVE, SUA_ASPTM_INACTIVE_ACK, SUA_IEI_ASP_ID, SUA_MSGC_ASPSM, SUA_MSGC_ASPTM, SUA_VERSION, XUA_ASP_E_ASPSM_ASPDN, XUA_ASP_E_ASPSM_ASPDN_ACK, XUA_ASP_E_ASPSM_ASPUP, XUA_ASP_E_ASPSM_ASPUP_ACK, XUA_ASP_E_ASPSM_BEAT, XUA_ASP_E_ASPSM_BEAT_ACK, XUA_ASP_E_ASPTM_ASPAC, XUA_ASP_E_ASPTM_ASPAC_ACK, XUA_ASP_E_ASPTM_ASPIA, XUA_ASP_E_ASPTM_ASPIA_ACK, XUA_HDR, xua_msg_add_asp_rctx(), xua_msg_add_u32(), xua_msg_alloc(), xua_msg_copy_part(), xua_msg_free(), and xua_to_msg().

Referenced by peer_send_and_start_t_ack(), xua_asp_allstate(), xua_asp_fsm_active(), xua_asp_fsm_down(), xua_asp_fsm_inactive(), xua_t_ack_cb(), and xua_t_beat_send().

## ◆ peer_send_and_start_t_ack()

static int peer_send_and_start_t_ack | ( | struct osmo_fsm_inst * | fi,
|  | int | out_event
| ) |  |
| static

References xua_asp_fsm_priv::asp, osmo_ss7_asp::cfg, NULL, xua_asp_fsm_priv::out_event, peer_send(), SS7_ASP_XUA_T_ACK, xua_asp_fsm_priv::t_ack, osmo_ss7_asp::T_defs_xua, xua_asp_fsm_priv::timer, and xua_t_ack_cb().

Referenced by xua_asp_allstate(), xua_asp_fsm_active(), xua_asp_fsm_down(), and xua_asp_fsm_inactive().

## ◆ peer_send_error()

static int peer_send_error | ( | struct osmo_fsm_inst * | fi,
|  | uint32_t | err_code
| ) |  |
| static

References NULL, and peer_send_error_ext().

Referenced by xua_asp_fsm_active(), xua_asp_fsm_down(), and xua_asp_fsm_inactive().

## ◆ peer_send_error_ext()

static int peer_send_error_ext | ( | struct osmo_fsm_inst * | fi,
|  | uint32_t | err_code,
|  | const uint8_t * | rctx_be,
|  | unsigned int | rctx_size
| ) |  |
| static

References xua_asp_fsm_priv::asp, xua_msg::hdr, m3ua_err_names, M3UA_IEI_ROUTE_CTX, osmo_ss7_asp_send(), SUA_IEI_ERR_CODE, SUA_MGMT_ERR, SUA_MSGC_MGMT, SUA_VERSION, xua_common_hdr::version, XUA_HDR, xua_msg_add_data(), xua_msg_add_u32(), xua_msg_alloc(), xua_msg_free(), and xua_to_msg().

Referenced by peer_send_error(), and xua_asp_fsm_inactive().

## ◆ send_xlm_prim_simple()

static void send_xlm_prim_simple | ( | struct osmo_fsm_inst * | fi,
|  | enum osmo_xlm_prim_type | prim_type,
|  | enum osmo_prim_operation | op
| ) |  |
| static

References xua_asp_fsm_priv::asp, and xua_asp_send_xlm_prim_simple().

Referenced by ipa_asp_allstate(), xua_asp_allstate(), xua_asp_fsm_active(), xua_asp_fsm_down(), and xua_asp_fsm_inactive().

## ◆ stop_t_ack()

static void stop_t_ack | ( | struct osmo_fsm_inst * | fi | ) |
| static

References xua_asp_fsm_priv::t_ack, and xua_asp_fsm_priv::timer.

Referenced by check_stop_t_ack(), and xua_asp_allstate().

## ◆ xua_asp_allstate()

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

References xua_asp_fsm_priv::asp, osmo_ss7_asp::cfg, data, M3UA_IEI_ERR_CODE, OSMO_SS7_ASP_ROLE_ASP, OSMO_SS7_ASP_ROLE_IPSP, OSMO_SS7_ASP_ROLE_SG, OSMO_XLM_PRIM_M_ASP_DOWN, OSMO_XLM_PRIM_M_ASP_INACTIVE, peer_send(), peer_send_and_start_t_ack(), osmo_ss7_asp::role, send_xlm_prim_simple(), stop_t_ack(), xua_asp_fsm_priv::t_ack, xua_asp_fsm_priv::t_beat, xua_asp_fsm_priv::timer, xua_asp_fsm_priv::unacked_beats, XUA_ASP_E_ADM_BLOCKED, XUA_ASP_E_ADM_UNBLOCKED, XUA_ASP_E_AS_ASSIGNED, XUA_ASP_E_ASPSM_BEAT, XUA_ASP_E_ASPSM_BEAT_ACK, XUA_ASP_E_ASPTM_ASPIA, XUA_ASP_E_MGMT_ERROR, XUA_ASP_E_SCTP_COMM_DOWN_IND, XUA_ASP_E_SCTP_RESTART_IND, XUA_ASP_S_ACTIVE, XUA_ASP_S_DOWN, XUA_ASP_S_INACTIVE, xua_asp_send_xlm_prim(), xua_asp_tx_unsolicited_aspia_ack(), xua_msg_get_u32(), and xua_xlm_prim_alloc_m_error_ind().

## ◆ xua_asp_fsm_active()

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

References check_stop_t_ack(), data, ENSURE_ASP_OR_IPSP, ENSURE_IPSP, ENSURE_SG_OR_IPSP, M3UA_ERR_UNEXPECTED_MSG, NULL, OSMO_XLM_PRIM_M_ASP_ACTIVE, OSMO_XLM_PRIM_M_ASP_DOWN, OSMO_XLM_PRIM_M_ASP_INACTIVE, peer_send(), peer_send_and_start_t_ack(), peer_send_error(), send_xlm_prim_simple(), XUA_ASP_E_ASPSM_ASPDN, XUA_ASP_E_ASPSM_ASPDN_ACK, XUA_ASP_E_ASPSM_ASPUP, XUA_ASP_E_ASPSM_ASPUP_ACK, XUA_ASP_E_ASPTM_ASPAC, XUA_ASP_E_ASPTM_ASPAC_ACK, XUA_ASP_E_ASPTM_ASPIA, XUA_ASP_E_ASPTM_ASPIA_ACK, XUA_ASP_E_M_ASP_DOWN_REQ, XUA_ASP_E_M_ASP_INACTIVE_REQ, XUA_ASP_S_DOWN, and XUA_ASP_S_INACTIVE.

## ◆ xua_asp_fsm_active_onenter()

static void xua_asp_fsm_active_onenter | ( | struct osmo_fsm_inst * | fi,
|  | uint32_t | prev_state
| ) |  |
| static

References xua_asp_fsm_priv::asp, osmo_ss7_asp::cfg, osmo_ss7_asp::daud_act, dispatch_to_all_as(), osmo_ss7_asp::fi, OSMO_SS7_ASP_ROLE_ASP, osmo_ss7_asp::role, xua_asp_tx_snm_daud_address_book(), and XUA_ASPAS_ASP_ACTIVE_IND.

## ◆ xua_asp_fsm_cleanup()

static void xua_asp_fsm_cleanup | ( | struct osmo_fsm_inst * | fi,
|  | enum osmo_fsm_term_cause | cause
| ) |  |
| static

References xua_asp_fsm_priv::asp, osmo_ss7_asp::fi, NULL, xua_asp_fsm_priv::t_ack, xua_asp_fsm_priv::timer, and xua_t_beat_stop().

## ◆ xua_asp_fsm_down()

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

References xua_asp_fsm_priv::asp, osmo_ss7_asp::cfg, check_stop_t_ack(), data, ENSURE_ASP_OR_IPSP, ENSURE_SG_OR_IPSP, osmo_ss7_asp::local_asp_id, osmo_ss7_asp::local_asp_id_present, M3UA_ERR_ASP_ID_REQD, M3UA_ERR_INVAL_ASP_ID, NULL, OSMO_SS7_ASP_ROLE_SG, OSMO_XLM_PRIM_M_ASP_UP, peer_send(), peer_send_and_start_t_ack(), peer_send_error(), osmo_ss7_asp::remote_asp_id, osmo_ss7_asp::remote_asp_id_present, osmo_ss7_asp::role, send_xlm_prim_simple(), ss7_asp_check_remote_asp_id_unique(), SUA_IEI_ASP_ID, XUA_ASP_E_ASPSM_ASPDN, XUA_ASP_E_ASPSM_ASPDN_ACK, XUA_ASP_E_ASPSM_ASPUP, XUA_ASP_E_ASPSM_ASPUP_ACK, XUA_ASP_E_M_ASP_UP_REQ, XUA_ASP_E_SCTP_EST_IND, XUA_ASP_S_INACTIVE, xua_msg_find_tag(), and xua_msg_part_get_u32().

## ◆ xua_asp_fsm_down_onenter()

static void xua_asp_fsm_down_onenter | ( | struct osmo_fsm_inst * | fi,
|  | uint32_t | prev_state
| ) |  |
| static

References xua_asp_fsm_priv::asp, common_asp_fsm_down_onenter(), osmo_ss7_asp::fi, and xua_t_beat_stop().

## ◆ xua_asp_fsm_inactive()

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

References osmo_ss7_asp::adm_state, ss7_as_asp_assoc::as, xua_asp_fsm_priv::asp, osmo_ss7_asp::assoc_as_list, osmo_ss7_asp::blocked, osmo_ss7_as::cfg, osmo_ss7_asp::cfg, check_stop_t_ack(), xua_msg_part::dat, data, ENSURE_ASP_OR_IPSP, ENSURE_IPSP, ENSURE_SG_OR_IPSP, xua_msg_part::len, LOGPAS, M3UA_ERR_INVAL_ASP_ID, M3UA_ERR_INVAL_ROUT_CTX, M3UA_ERR_UNSUPP_TRAF_MOD_TYP, M3UA_IEI_ROUTE_CTX, M3UA_IEI_TRAF_MODE_TYP, M3UA_TMOD_BCAST, M3UA_TMOD_LOADSHARE, M3UA_TMOD_OVERRIDE, osmo_ss7_as::mode, osmo_ss7_as::mode_set_by_peer, osmo_ss7_as::mode_set_by_vty, NULL, osmo_ss7_as_tmode_compatible_xua(), osmo_ss7_as_traffic_mode_name(), osmo_ss7_tmode_from_xua(), OSMO_XLM_PRIM_M_ASP_ACTIVE, OSMO_XLM_PRIM_M_ASP_DOWN, OSMO_XLM_PRIM_M_ASP_UP, peer_send(), peer_send_and_start_t_ack(), peer_send_error(), peer_send_error_ext(), osmo_ss7_asp::remote_asp_id, osmo_ss7_asp::remote_asp_id_present, send_xlm_prim_simple(), ss7_asp_check_remote_asp_id_unique(), ss7_asp_find_as_by_rctx(), SUA_ERR_REFUSED_MGMT_BLOCKING, SUA_IEI_ASP_ID, XUA_ASP_E_ASPSM_ASPDN, XUA_ASP_E_ASPSM_ASPDN_ACK, XUA_ASP_E_ASPSM_ASPUP, XUA_ASP_E_ASPSM_ASPUP_ACK, XUA_ASP_E_ASPTM_ASPAC, XUA_ASP_E_ASPTM_ASPAC_ACK, XUA_ASP_E_ASPTM_ASPIA, XUA_ASP_E_ASPTM_ASPIA_ACK, XUA_ASP_E_M_ASP_ACTIVE_REQ, XUA_ASP_E_M_ASP_DOWN_REQ, XUA_ASP_S_ACTIVE, XUA_ASP_S_DOWN, xua_msg_find_tag(), xua_msg_get_u32(), and xua_msg_part_get_u32().

## ◆ xua_asp_fsm_inactive_onenter()

static void xua_asp_fsm_inactive_onenter | ( | struct osmo_fsm_inst * | fi,
|  | uint32_t | prev_state
| ) |  |
| static

References xua_as_event_asp_inactive_ind_pars::asp, xua_asp_fsm_priv::asp, osmo_ss7_asp::cfg, dispatch_to_all_as(), osmo_ss7_asp::fi, OSMO_SS7_ASP_ROLE_ASP, osmo_ss7_asp::role, XUA_ASP_S_DOWN, XUA_ASPAS_ASP_INACTIVE_IND, and xua_t_beat_send().

## ◆ xua_asp_fsm_start()

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

Start a new ASP finite state machine for given ASP (stored in asp->fi)

Parameters

  [in] | asp | Application Server Process for which to start FSM
  [in] | log_level | Logging Level for ASP FSM logging

Returns
  0 on success; negative on error

References xua_asp_fsm_priv::asp, osmo_ss7_asp::cfg, osmo_ss7_asp::fi, ipa_asp_fsm_start(), osmo_ss7_asp::name, NULL, OSMO_SS7_ASP_PROT_IPA, osmo_ss7_asp::proto, xua_asp_fsm_priv::t_beat, xua_asp_fsm_priv::timer, xua_asp_fsm, and xua_t_beat_cb().

Referenced by osmo_ss7_asp_restart(), and xua_accept_cb().

## ◆ xua_asp_fsm_timer_cb()

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

## ◆ xua_asp_tx_snm_daud_address_book()

static void xua_asp_tx_snm_daud_address_book | ( | struct osmo_ss7_asp * | asp | ) |
| static

References osmo_sccp_addr_entry::addr, osmo_ss7_instance::cfg, osmo_sccp_addr_entry::inst, osmo_ss7_asp::inst, osmo_sccp_addr_entry::list, LOGPASP, NULL, OSMO_SCCP_ADDR_T_PC, OSMO_SS7_MAX_RCTX_COUNT, osmo_ss7_pc_is_local(), osmo_ss7_pointcode_print2(), osmo_sccp_addr::pc, osmo_sccp_addr::presence, osmo_ss7_instance::sccp_address_book, ss7_asp_get_all_rctx_be(), and xua_tx_snm_daud().

Referenced by xua_asp_fsm_active_onenter().

## ◆ xua_asp_tx_unsolicited_aspia_ack()

static int xua_asp_tx_unsolicited_aspia_ack | ( | struct osmo_ss7_asp * | asp | ) |
| static

References xua_msg::hdr, osmo_ss7_asp_send(), SUA_ASPTM_INACTIVE_ACK, SUA_MSGC_ASPTM, SUA_VERSION, XUA_HDR, xua_msg_add_asp_rctx(), xua_msg_alloc(), xua_msg_free(), and xua_to_msg().

Referenced by xua_asp_allstate().

## ◆ xua_msg_add_asp_rctx()

static int xua_msg_add_asp_rctx | ( | struct xua_msg * | xua,
|  | struct osmo_ss7_asp * | asp
| ) |  |
| static

References M3UA_IEI_ROUTE_CTX, NULL, OSMO_SS7_MAX_RCTX_COUNT, ss7_asp_get_all_rctx_be(), and xua_msg_add_data().

Referenced by peer_send(), and xua_asp_tx_unsolicited_aspia_ack().

## ◆ xua_t_ack_cb()

static void xua_t_ack_cb | ( | void * | data | ) |
| static

References xua_asp_fsm_priv::asp, osmo_ss7_asp::cfg, data, NULL, xua_asp_fsm_priv::out_event, peer_send(), SS7_ASP_XUA_T_ACK, xua_asp_fsm_priv::t_ack, osmo_ss7_asp::T_defs_xua, and xua_asp_fsm_priv::timer.

Referenced by peer_send_and_start_t_ack().

## ◆ xua_t_beat_cb()

static void xua_t_beat_cb | ( | void * | _fi | ) |
| static

References xua_asp_fsm_priv::asp, ss7_asp_disconnect_stream(), xua_asp_fsm_priv::t_beat, xua_asp_fsm_priv::unacked_beats, and xua_t_beat_send().

Referenced by xua_asp_fsm_start().

## ◆ xua_t_beat_send()

static void xua_t_beat_send | ( | struct osmo_fsm_inst * | fi | ) |
| static

References xua_asp_fsm_priv::asp, osmo_ss7_asp::cfg, NULL, peer_send(), SS7_ASP_XUA_T_BEAT, xua_asp_fsm_priv::t_beat, osmo_ss7_asp::T_defs_xua, xua_asp_fsm_priv::timer, xua_asp_fsm_priv::unacked_beats, XUA_ASP_E_ASPSM_BEAT, and xua_t_beat_stop().

Referenced by xua_asp_fsm_inactive_onenter(), and xua_t_beat_cb().

## ◆ xua_t_beat_stop()

static void xua_t_beat_stop | ( | struct osmo_fsm_inst * | fi | ) |
| static

References xua_asp_fsm_priv::t_beat, xua_asp_fsm_priv::timer, and xua_asp_fsm_priv::unacked_beats.

Referenced by xua_asp_fsm_cleanup(), xua_asp_fsm_down_onenter(), and xua_t_beat_send().

## Variable Documentation

## ◆ evt_ack_map

const uint32_t evt_ack_map[_NUM_XUA_ASP_E]
| static

Initial value:
= {
[XUA_ASP_E_ASPSM_ASPUP] = XUA_ASP_E_ASPSM_ASPUP_ACK,
[XUA_ASP_E_ASPTM_ASPAC] = XUA_ASP_E_ASPTM_ASPAC_ACK,
[XUA_ASP_E_ASPSM_ASPDN] = XUA_ASP_E_ASPSM_ASPDN_ACK,
[XUA_ASP_E_ASPTM_ASPIA] = XUA_ASP_E_ASPTM_ASPIA_ACK,
[XUA_ASP_E_ASPSM_BEAT] = XUA_ASP_E_ASPSM_BEAT_ACK,
}
XUA_ASP_E_ASPTM_ASPAC_ACK
@ XUA_ASP_E_ASPTM_ASPAC_ACK
Definition: xua_asp_fsm.h:22
XUA_ASP_E_ASPSM_BEAT_ACK
@ XUA_ASP_E_ASPSM_BEAT_ACK
Definition: xua_asp_fsm.h:29
XUA_ASP_E_ASPSM_ASPDN
@ XUA_ASP_E_ASPSM_ASPDN
Definition: xua_asp_fsm.h:23
XUA_ASP_E_ASPSM_ASPUP
@ XUA_ASP_E_ASPSM_ASPUP
Definition: xua_asp_fsm.h:19
XUA_ASP_E_ASPSM_ASPDN_ACK
@ XUA_ASP_E_ASPSM_ASPDN_ACK
Definition: xua_asp_fsm.h:24
XUA_ASP_E_ASPSM_ASPUP_ACK
@ XUA_ASP_E_ASPSM_ASPUP_ACK
Definition: xua_asp_fsm.h:20
XUA_ASP_E_ASPTM_ASPAC
@ XUA_ASP_E_ASPTM_ASPAC
Definition: xua_asp_fsm.h:21
XUA_ASP_E_ASPTM_ASPIA_ACK
@ XUA_ASP_E_ASPTM_ASPIA_ACK
Definition: xua_asp_fsm.h:26
XUA_ASP_E_ASPTM_ASPIA
@ XUA_ASP_E_ASPTM_ASPIA
Definition: xua_asp_fsm.h:25
XUA_ASP_E_ASPSM_BEAT
@ XUA_ASP_E_ASPSM_BEAT
Definition: xua_asp_fsm.h:28

Referenced by check_stop_t_ack().

## ◆ ipa_asp_fsm

struct osmo_fsm ipa_asp_fsm

Initial value:
= {
.name = "IPA_ASP",
.states = ipa_asp_states,
.num_states = ARRAY_SIZE(ipa_asp_states),
.timer_cb = ipa_asp_fsm_timer_cb,
.log_subsys = DLSS7,
.event_names = xua_asp_event_names,
.allstate_event_mask = S(XUA_ASP_E_SCTP_COMM_DOWN_IND) |
S(XUA_ASP_E_SCTP_RESTART_IND) |
S(XUA_ASP_E_ASPSM_BEAT) |
S(XUA_ASP_E_ASPSM_BEAT_ACK) |
S(XUA_ASP_E_AS_ASSIGNED),
.allstate_action = ipa_asp_allstate,
.cleanup = ipa_asp_fsm_cleanup,
}
ipa_asp_allstate
static void ipa_asp_allstate(struct osmo_fsm_inst *fi, uint32_t event, void *data)
Definition: xua_asp_fsm.c:1470
ipa_asp_states
static const struct osmo_fsm_state ipa_asp_states[]
Definition: xua_asp_fsm.c:1533
ipa_asp_fsm_timer_cb
static int ipa_asp_fsm_timer_cb(struct osmo_fsm_inst *fi)
Definition: xua_asp_fsm.c:1510
S
#define S(x)
Definition: xua_asp_fsm.c:46
ipa_asp_fsm_cleanup
static void ipa_asp_fsm_cleanup(struct osmo_fsm_inst *fi, enum osmo_fsm_term_cause cause)
Definition: xua_asp_fsm.c:1520
xua_asp_event_names
static const struct value_string xua_asp_event_names[]
Definition: xua_asp_fsm.c:55
XUA_ASP_E_SCTP_RESTART_IND
@ XUA_ASP_E_SCTP_RESTART_IND
Definition: xua_asp_fsm.h:16
XUA_ASP_E_SCTP_COMM_DOWN_IND
@ XUA_ASP_E_SCTP_COMM_DOWN_IND
Definition: xua_asp_fsm.h:15
XUA_ASP_E_AS_ASSIGNED
@ XUA_ASP_E_AS_ASSIGNED
Definition: xua_asp_fsm.h:35

Referenced by ipa_asp_fsm_start(), and osmo_ss7_init().

## ◆ ipa_asp_states

const struct osmo_fsm_state ipa_asp_states[]
| static

## ◆ xua_asp_event_names

const struct value_string xua_asp_event_names[]
| static

## ◆ xua_asp_fsm

struct osmo_fsm xua_asp_fsm

Initial value:
= {
.name = "XUA_ASP",
.states = xua_asp_states,
.num_states = ARRAY_SIZE(xua_asp_states),
.timer_cb = xua_asp_fsm_timer_cb,
.log_subsys = DLSS7,
.event_names = xua_asp_event_names,
.allstate_event_mask = S(XUA_ASP_E_SCTP_COMM_DOWN_IND) |
S(XUA_ASP_E_SCTP_RESTART_IND) |
S(XUA_ASP_E_ASPSM_BEAT) |
S(XUA_ASP_E_ASPSM_BEAT_ACK) |
S(XUA_ASP_E_MGMT_ERROR) |
S(XUA_ASP_E_AS_ASSIGNED) |
S(XUA_ASP_E_ADM_BLOCKED) |
S(XUA_ASP_E_ADM_UNBLOCKED),
.allstate_action = xua_asp_allstate,
.cleanup = xua_asp_fsm_cleanup,
}
xua_asp_fsm_timer_cb
static int xua_asp_fsm_timer_cb(struct osmo_fsm_inst *fi)
Definition: xua_asp_fsm.c:970
xua_asp_allstate
static void xua_asp_allstate(struct osmo_fsm_inst *fi, uint32_t event, void *data)
Definition: xua_asp_fsm.c:880
xua_asp_fsm_cleanup
static void xua_asp_fsm_cleanup(struct osmo_fsm_inst *fi, enum osmo_fsm_term_cause cause)
Definition: xua_asp_fsm.c:977
xua_asp_states
static const struct osmo_fsm_state xua_asp_states[]
Definition: xua_asp_fsm.c:991
XUA_ASP_E_ADM_BLOCKED
@ XUA_ASP_E_ADM_BLOCKED
Definition: xua_asp_fsm.h:38
XUA_ASP_E_ADM_UNBLOCKED
@ XUA_ASP_E_ADM_UNBLOCKED
Definition: xua_asp_fsm.h:39
XUA_ASP_E_MGMT_ERROR
@ XUA_ASP_E_MGMT_ERROR
Definition: xua_asp_fsm.h:32

Referenced by osmo_ss7_init(), and xua_asp_fsm_start().

## ◆ xua_asp_states

const struct osmo_fsm_state xua_asp_states[]
| static