libosmo-sigtran  1.8.0.67-fb30
Osmocom SIGTRAN library
xua_as_fsm.c File Reference
#include <string.h>
#include <arpa/inet.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/sigtran/osmo_ss7.h>
#include <osmocom/sigtran/sigtran_sap.h>
#include <osmocom/sigtran/xua_msg.h>
#include <osmocom/sigtran/protocol/sua.h>
#include <osmocom/sigtran/protocol/m3ua.h>
#include "xua_asp_fsm.h"
#include "xua_as_fsm.h"
#include "xua_internal.h"

Data Structures

struct  xua_as_fsm_priv
 

Macros

#define S(x)   (1 << (x))
 
#define MSEC_TO_S_US(x)   (x/1000), ((x%1000)*10)
 

Functions

static struct msgb * encode_notify (const struct osmo_xlm_prim_notify *npar)
 
static int as_notify_all_asp (struct osmo_ss7_as *as, struct osmo_xlm_prim_notify *npar)
 
static int get_local_role (struct osmo_ss7_as *as)
 
static struct osmo_ss7_aspxua_as_select_asp_override (struct osmo_ss7_as *as)
 
static struct osmo_ss7_aspxua_as_select_asp_roundrobin (struct osmo_ss7_as *as)
 
int xua_as_transmit_msg_broadcast (struct osmo_ss7_as *as, struct msgb *msg)
 
int xua_as_transmit_msg (struct osmo_ss7_as *as, struct msgb *msg)
 
static bool is_single_ipa_asp (struct osmo_ss7_as *as)
 
static void ipa_add_route (struct osmo_fsm_inst *fi)
 
static void ipa_del_route (struct osmo_fsm_inst *fi)
 
static bool check_any_other_asp_not_down (struct osmo_ss7_as *as, struct osmo_ss7_asp *asp_cmp)
 
static bool check_any_other_asp_in_active (struct osmo_ss7_as *as, struct osmo_ss7_asp *asp_cmp)
 
static void notify_any_other_active_asp_as_inactive (struct osmo_ss7_as *as, struct osmo_ss7_asp *asp_cmp)
 
static void t_r_callback (void *_fi)
 
static void xua_as_fsm_down (struct osmo_fsm_inst *fi, uint32_t event, void *data)
 
static void xua_as_fsm_onenter (struct osmo_fsm_inst *fi, uint32_t old_state)
 
static void xua_as_fsm_inactive (struct osmo_fsm_inst *fi, uint32_t event, void *data)
 
static void xua_as_fsm_active (struct osmo_fsm_inst *fi, uint32_t event, void *data)
 
static void xua_as_fsm_pending (struct osmo_fsm_inst *fi, uint32_t event, void *data)
 
static void xua_as_fsm_cleanup (struct osmo_fsm_inst *fi, enum osmo_fsm_term_cause cause)
 
struct osmo_fsm_inst * xua_as_fsm_start (struct osmo_ss7_as *as, int log_level)
 Start an AS FSM for a given Application Server. More...
 

Variables

static const struct value_string xua_as_event_names []
 
static const struct osmo_fsm_state xua_as_fsm_states []
 
struct osmo_fsm xua_as_fsm
 

Macro Definition Documentation

◆ MSEC_TO_S_US

#define MSEC_TO_S_US (   x)    (x/1000), ((x%1000)*10)

Referenced by xua_as_fsm_active().

◆ S

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

Function Documentation

◆ as_notify_all_asp()

◆ check_any_other_asp_in_active()

static bool check_any_other_asp_in_active ( struct osmo_ss7_as as,
struct osmo_ss7_asp asp_cmp 
)
static

◆ check_any_other_asp_not_down()

static bool check_any_other_asp_not_down ( struct osmo_ss7_as as,
struct osmo_ss7_asp asp_cmp 
)
static

◆ encode_notify()

static struct msgb* encode_notify ( const struct osmo_xlm_prim_notify npar)
static

◆ get_local_role()

static int get_local_role ( struct osmo_ss7_as as)
static

◆ ipa_add_route()

◆ ipa_del_route()

◆ is_single_ipa_asp()

static bool is_single_ipa_asp ( struct osmo_ss7_as as)
static

◆ notify_any_other_active_asp_as_inactive()

◆ t_r_callback()

static void t_r_callback ( void *  _fi)
static

References XUA_AS_E_RECOVERY_EXPD.

Referenced by xua_as_fsm_start().

◆ xua_as_fsm_active()

◆ xua_as_fsm_cleanup()

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

◆ xua_as_fsm_down()

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

◆ xua_as_fsm_inactive()

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

◆ xua_as_fsm_onenter()

static void xua_as_fsm_onenter ( struct osmo_fsm_inst *  fi,
uint32_t  old_state 
)
static

◆ xua_as_fsm_pending()

◆ xua_as_fsm_start()

struct osmo_fsm_inst* xua_as_fsm_start ( struct osmo_ss7_as as,
int  log_level 
)

Start an AS FSM for a given Application Server.

Parameters
[in]asApplication Server for which to start the AS FSM
[in]log_levelLogging level for logging of this FSM
Returns
FSM instance in case of success; NULL in case of error

References xua_as_fsm_priv::as, osmo_ss7_as::cfg, osmo_ss7_as::name, xua_as_fsm_priv::queued_msgs, xua_as_fsm_priv::recovery, xua_as_fsm_priv::t_r, and t_r_callback().

Referenced by ss7_as_alloc().

◆ xua_as_select_asp_override()

static struct osmo_ss7_asp* xua_as_select_asp_override ( struct osmo_ss7_as as)
static

◆ xua_as_select_asp_roundrobin()

static struct osmo_ss7_asp* xua_as_select_asp_roundrobin ( struct osmo_ss7_as as)
static

◆ xua_as_transmit_msg()

◆ xua_as_transmit_msg_broadcast()

int xua_as_transmit_msg_broadcast ( struct osmo_ss7_as as,
struct msgb *  msg 
)

Variable Documentation

◆ xua_as_event_names

const struct value_string xua_as_event_names[]
static
Initial value:
= {
{ XUA_ASPAS_ASP_INACTIVE_IND, "ASPAS-ASP_INACTIVE.ind" },
{ XUA_ASPAS_ASP_DOWN_IND, "ASPAS-ASP_DOWN.ind" },
{ XUA_ASPAS_ASP_ACTIVE_IND, "ASPAS-ASP_ACTIVE.ind" },
{ XUA_AS_E_RECOVERY_EXPD, "AS-T_REC_EXPD.ind" },
{ XUA_AS_E_TRANSFER_REQ, "AS-TRANSFER.req" },
{ 0, NULL }
}
Definition: xua_as_fsm.h:14
Definition: xua_as_fsm.h:15
Definition: xua_as_fsm.h:16
Definition: xua_as_fsm.h:13
Definition: xua_as_fsm.h:17

◆ xua_as_fsm

struct osmo_fsm xua_as_fsm
Initial value:
= {
.name = "XUA_AS",
.states = xua_as_fsm_states,
.num_states = ARRAY_SIZE(xua_as_fsm_states),
.log_subsys = DLSS7,
.event_names = xua_as_event_names,
.cleanup = xua_as_fsm_cleanup,
}
static const struct value_string xua_as_event_names[]
Definition: xua_as_fsm.c:190
static void xua_as_fsm_cleanup(struct osmo_fsm_inst *fi, enum osmo_fsm_term_cause cause)
Definition: xua_as_fsm.c:525
static const struct osmo_fsm_state xua_as_fsm_states[]
Definition: xua_as_fsm.c:532

Referenced by osmo_ss7_init().

◆ xua_as_fsm_states

const struct osmo_fsm_state xua_as_fsm_states[]
static