| 
    libosmo-sigtran 1.9.0.3-fc4c
    
   Osmocom SIGTRAN library 
   | 
 
#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 <osmocom/sigtran/xua_msg.h>#include <osmocom/sigtran/protocol/sua.h>#include "xua_asp_fsm.h"#include "xua_as_fsm.h"#include "xua_internal.h"Data Structures | |
| struct | xua_asp_fsm_priv | 
| struct | ipa_asp_fsm_priv | 
Macros | |
| #define | S(x) (1 << (x)) | 
| #define | XUA_T_ACK_SEC 2 | 
| #define | ENSURE_ASP_OR_IPSP(fi, event) | 
| #define | ENSURE_SG_OR_IPSP(fi, event) | 
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 | |
| struct osmo_xlm_prim * | xua_xlm_prim_alloc (enum osmo_xlm_prim_type prim_type, enum osmo_prim_operation op) | 
| void | xua_asp_send_xlm_prim (struct osmo_ss7_asp *asp, struct osmo_xlm_prim *prim) | 
| void | xua_asp_send_xlm_prim_simple (struct osmo_ss7_asp *asp, enum osmo_xlm_prim_type prim_type, enum osmo_prim_operation op) | 
| static void | send_xlm_prim_simple (struct osmo_fsm_inst *fi, enum osmo_xlm_prim_type prim_type, enum osmo_prim_operation op) | 
| static int | determine_traf_mode (struct osmo_ss7_asp *asp) | 
| static int | xua_msg_add_asp_rctx (struct xua_msg *xua, 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 (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) | 
| static void | check_stop_t_ack (struct osmo_fsm_inst *fi, uint32_t event) | 
| 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 struct osmo_fsm_inst * | ipa_asp_fsm_start (struct osmo_ss7_asp *asp, enum osmo_ss7_asp_role role, int log_level) | 
| Start a new ASP finite state machine for given ASP.  More... | |
| struct osmo_fsm_inst * | xua_asp_fsm_start (struct osmo_ss7_asp *asp, enum osmo_ss7_asp_role role, int log_level) | 
| Start a new ASP finite stae machine for given ASP.  More... | |
| static int | get_fd_from_iafp (struct ipa_asp_fsm_priv *iafp) | 
| 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_allstate (struct osmo_fsm_inst *fi, uint32_t event, void *data) | 
| static void | ipa_pong_timer_cb (void *_fi) | 
| static int | ipa_asp_fsm_timer_cb (struct osmo_fsm_inst *fi) | 
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 | 
| #define ENSURE_ASP_OR_IPSP | ( | fi, | |
| event | |||
| ) | 
| #define ENSURE_SG_OR_IPSP | ( | fi, | |
| event | |||
| ) | 
| #define S | ( | x | ) | (1 << (x)) | 
| #define XUA_T_ACK_SEC 2 | 
| enum ipa_asp_fsm_t | 
| enum ipa_asp_state | 
      
  | 
  static | 
References evt_ack_map, xua_asp_fsm_priv::out_event, xua_asp_fsm_priv::t_ack, and xua_asp_fsm_priv::timer.
Referenced by xua_asp_fsm_active(), xua_asp_fsm_down(), and xua_asp_fsm_inactive().
      
  | 
  static | 
References osmo_ss7_instance::as_list, osmo_ss7_as::cfg, osmo_ss7_asp::inst, osmo_ss7_as::list, osmo_ss7_as::mode, osmo_ss7_as::mode_set_by_vty, and osmo_ss7_as_has_asp().
Referenced by peer_send().
      
  | 
  static | 
References osmo_ss7_instance::as_list, xua_asp_fsm_priv::asp, osmo_ss7_as::fi, osmo_ss7_as::inst, osmo_ss7_asp::inst, osmo_ss7_as::list, and osmo_ss7_as_has_asp().
Referenced by ipa_asp_fsm_active_onenter(), ipa_asp_fsm_inactive_onenter(), xua_asp_fsm_active_onenter(), xua_asp_fsm_down_onenter(), and xua_asp_fsm_inactive_onenter().
      
  | 
  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().
      
  | 
  static | 
References osmo_ss7_as::cfg, data, osmo_ss7_as::fi, get_fd_from_iafp(), IPA_ASP_S_DOWN, ipa_asp_fsm_priv::ipa_unit, osmo_ss7_as::name, OSMO_SS7_ASP_ROLE_ASP, OSMO_XLM_PRIM_M_ASP_DOWN, ipa_asp_fsm_priv::pong_timer, ipa_asp_fsm_priv::role, send_xlm_prim_simple(), 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.
      
  | 
  static | 
References IPA_ASP_S_DOWN, XUA_ASP_E_M_ASP_DOWN_REQ, and XUA_ASP_E_M_ASP_INACTIVE_REQ.
      
  | 
  static | 
References dispatch_to_all_as(), XUA_ASPAS_ASP_ACTIVE_IND, and XUA_ASPAS_ASP_INACTIVE_IND.
      
  | 
  static | 
      
  | 
  static | 
References IPA_ASP_S_DOWN, and XUA_ASP_E_M_ASP_DOWN_REQ.
      
  | 
  static | 
References dispatch_to_all_as(), and XUA_ASPAS_ASP_INACTIVE_IND.
      
  | 
  static | 
Start a new ASP finite state machine for given ASP.
| [in] | asp | Application Server Process for which to start FSM | 
| [in] | role | Role (ASP, SG, IPSP) of this FSM | 
| [in] | log_level | Logging Level for ASP FSM logging | 
References ipa_asp_fsm_priv::asp, osmo_ss7_as::cfg, osmo_ss7_asp::cfg, osmo_ss7_asp::dyn_allocated, osmo_ss7_as::fi, ipa_asp_fsm, ipa_find_as_for_asp(), ipa_pong_timer_cb(), ipa_asp_fsm_priv::ipa_unit, osmo_ss7_as::name, osmo_ss7_asp::name, OSMO_SS7_ASP_ROLE_ASP, ipa_asp_fsm_priv::pong_timer, ipa_asp_fsm_priv::role, and XUA_ASP_E_M_ASP_UP_REQ.
Referenced by xua_asp_fsm_start().
      
  | 
  static | 
References ipa_asp_fsm_priv::asp, and osmo_ss7_asp_disconnect().
      
  | 
  static | 
References get_fd_from_iafp(), IPA_ASP_E_ID_ACK, and IPA_ASP_S_ACTIVE.
      
  | 
  static | 
References IPA_ASP_E_ID_ACK, and IPA_ASP_S_ACTIVE.
      
  | 
  static | 
      
  | 
  static | 
References ipa_asp_fsm_priv::asp, 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_asp::name, osmo_ss7_as_add_asp(), osmo_ss7_as_find_by_name(), osmo_ss7_asp_disconnect(), and T_WAIT_ID_ACK.
      
  | 
  static | 
References ipa_asp_fsm_priv::asp, and osmo_ss7_asp_disconnect().
Referenced by ipa_asp_fsm_start().
      
  | 
  static | 
References xua_asp_fsm_priv::asp, osmo_ss7_asp::asp_id, osmo_ss7_asp::asp_id_present, determine_traf_mode(), xua_msg::hdr, M3UA_IEI_HEARDBT_DATA, M3UA_IEI_ROUTE_CTX, M3UA_IEI_TRAF_MODE_TYP, osmo_ss7_asp_send(), osmo_ss7_tmode_to_xua(), 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(), and xua_t_ack_cb().
      
  | 
  static | 
References xua_asp_fsm_priv::out_event, peer_send(), xua_asp_fsm_priv::t_ack, xua_asp_fsm_priv::timer, xua_t_ack_cb(), and XUA_T_ACK_SEC.
Referenced by xua_asp_fsm_active(), xua_asp_fsm_down(), and xua_asp_fsm_inactive().
      
  | 
  static | 
References xua_asp_fsm_priv::asp, xua_msg::hdr, m3ua_err_names, 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_u32(), xua_msg_alloc(), xua_msg_free(), and xua_to_msg().
Referenced by xua_asp_fsm_active(), and xua_asp_fsm_inactive().
      
  | 
  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().
      
  | 
  static | 
      
  | 
  static | 
References check_stop_t_ack(), data, ENSURE_ASP_OR_IPSP, ENSURE_SG_OR_IPSP, M3UA_ERR_UNEXPECTED_MSG, 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.
      
  | 
  static | 
References dispatch_to_all_as(), and XUA_ASPAS_ASP_ACTIVE_IND.
      
  | 
  static | 
References xua_asp_fsm_priv::t_ack, and xua_asp_fsm_priv::timer.
      
  | 
  static | 
References xua_asp_fsm_priv::asp, osmo_ss7_asp::asp_id, osmo_ss7_asp::asp_id_present, check_stop_t_ack(), data, ENSURE_ASP_OR_IPSP, ENSURE_SG_OR_IPSP, osmo_ss7_asp::lm, OSMO_XLM_PRIM_M_ASP_UP, peer_send(), peer_send_and_start_t_ack(), send_xlm_prim_simple(), 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_ACTIVE_REQ, 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().
      
  | 
  static | 
References dispatch_to_all_as(), and XUA_ASPAS_ASP_DOWN_IND.
      
  | 
  static | 
References osmo_ss7_instance::as_list, xua_asp_fsm_priv::asp, osmo_ss7_as::cfg, check_stop_t_ack(), xua_msg_part::dat, data, ENSURE_ASP_OR_IPSP, ENSURE_SG_OR_IPSP, osmo_ss7_asp::inst, xua_msg_part::len, LOGPAS, 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, osmo_ss7_as_find_by_rctx(), osmo_ss7_as_has_asp(), 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, 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_ACTIVE_REQ, XUA_ASP_E_M_ASP_DOWN_REQ, XUA_ASP_S_ACTIVE, XUA_ASP_S_DOWN, xua_msg_find_tag(), and xua_msg_get_u32().
      
  | 
  static | 
References dispatch_to_all_as(), and XUA_ASPAS_ASP_INACTIVE_IND.
| struct osmo_fsm_inst * xua_asp_fsm_start | ( | struct osmo_ss7_asp * | asp, | 
| enum osmo_ss7_asp_role | role, | ||
| int | log_level | ||
| ) | 
Start a new ASP finite stae machine for given ASP.
| [in] | asp | Application Server Process for which to start FSM | 
| [in] | role | Role (ASP, SG, IPSP) of this FSM | 
| [in] | log_level | Logging Level for ASP FSM logging | 
References xua_asp_fsm_priv::asp, osmo_ss7_asp::cfg, ipa_asp_fsm_start(), osmo_ss7_asp::name, OSMO_SS7_ASP_PROT_IPA, osmo_ss7_asp::proto, xua_asp_fsm_priv::role, and xua_asp_fsm.
Referenced by osmo_ss7_asp_restart().
      
  | 
  static | 
| void xua_asp_send_xlm_prim | ( | struct osmo_ss7_asp * | asp, | 
| struct osmo_xlm_prim * | prim | ||
| ) | 
| void xua_asp_send_xlm_prim_simple | ( | struct osmo_ss7_asp * | asp, | 
| enum osmo_xlm_prim_type | prim_type, | ||
| enum osmo_prim_operation | op | ||
| ) | 
References xua_asp_send_xlm_prim(), and xua_xlm_prim_alloc().
Referenced by send_xlm_prim_simple(), ss7_asp_xua_srv_conn_closed_cb(), ss7_asp_xua_srv_conn_rx_cb(), xua_accept_cb(), xua_cli_close(), xua_cli_connect_cb(), and xua_cli_read_cb().
      
  | 
  static | 
      
  | 
  static | 
References data, xua_asp_fsm_priv::out_event, peer_send(), xua_asp_fsm_priv::t_ack, xua_asp_fsm_priv::timer, and XUA_T_ACK_SEC.
Referenced by peer_send_and_start_t_ack().
| struct osmo_xlm_prim * xua_xlm_prim_alloc | ( | enum osmo_xlm_prim_type | prim_type, | 
| enum osmo_prim_operation | op | ||
| ) | 
References osmo_xlm_prim::oph, and XUA_SAP_LM.
Referenced by handle_rkey_dereg_resp(), handle_rkey_reg_resp(), lm_timer_cb(), m3ua_rx_mgmt_err(), m3ua_rx_mgmt_ntfy(), and xua_asp_send_xlm_prim_simple().
      
  | 
  static | 
Referenced by check_stop_t_ack().
| struct osmo_fsm ipa_asp_fsm | 
Referenced by ipa_asp_fsm_start(), and osmo_ss7_init().
      
  | 
  static | 
      
  | 
  static | 
| struct osmo_fsm xua_asp_fsm | 
Referenced by osmo_ss7_init(), and xua_asp_fsm_start().
      
  | 
  static |