libosmo-sigtran 2.1.0.148-c8e68
Osmocom SIGTRAN library
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
sccp_scoc.c File Reference
#include <errno.h>
#include <string.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/utils.h>
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/linuxrbtree.h>
#include <osmocom/core/logging.h>
#include <osmocom/core/timer.h>
#include <osmocom/core/fsm.h>
#include <osmocom/sigtran/sccp_helpers.h>
#include <osmocom/sigtran/sccp_sap.h>
#include <osmocom/sigtran/protocol/sua.h>
#include <osmocom/sccp/sccp_types.h>
#include "xua_internal.h"
#include "sccp_connection.h"
#include "sccp_scoc_fsm.h"
#include "sccp_instance.h"
#include "sccp_internal.h"
#include "sccp_user.h"
#include "ss7_internal.h"
#include "ss7_instance.h"

Functions

struct sccp_connectionsccp_find_conn_by_id (const struct osmo_sccp_instance *inst, uint32_t id)
 
bool osmo_sccp_conn_id_exists (const struct osmo_sccp_instance *inst, uint32_t id)
 
int osmo_sccp_instance_next_conn_id (struct osmo_sccp_instance *sccp)
 
static struct sccp_connectionconn_create (struct osmo_sccp_user *user)
 
static struct xua_msgxua_gen_relre (struct sccp_connection *conn, uint32_t cause, struct osmo_scu_prim *prim)
 
int sccp_conn_xua_gen_relre_and_send (struct sccp_connection *conn, uint32_t cause, struct osmo_scu_prim *prim)
 
static bool xua_opt_data_check_drop (const struct osmo_scu_prim *prim, unsigned lim, const char *message)
 
static bool xua_opt_data_cache_keep (struct sccp_connection *conn, const struct osmo_scu_prim *prim, int msg_type)
 
static bool xua_opt_data_length_lim (struct sccp_connection *conn, const struct osmo_scu_prim *prim, int msg_type)
 
static struct xua_msgxua_gen_msg_co (struct sccp_connection *conn, uint32_t event, const struct osmo_scu_prim *prim, int msg_type)
 
int sccp_conn_xua_gen_encode_and_send (struct sccp_connection *conn, uint32_t event, const struct osmo_scu_prim *prim, int msg_type)
 
static uint8_t get_cref_cause_for_ret (uint8_t ret_cause)
 
static struct xua_msggen_coref_without_conn (struct osmo_sccp_instance *inst, struct xua_msg *xua_in, uint32_t ref_cause)
 
static struct osmo_sccp_usersccp_find_user (struct osmo_sccp_instance *inst, struct xua_msg *xua)
 
void sccp_scoc_rx_scrc_rout_fail (struct osmo_sccp_instance *inst, struct xua_msg *xua, uint32_t return_cause)
 SCOC: Receive SCRC Routing Failure. More...
 
static struct xua_msggen_coerr (uint32_t route_ctx, uint32_t dest_ref, uint32_t err_cause)
 
static void tx_coerr_from_xua (struct osmo_sccp_instance *inst, struct xua_msg *in, uint32_t err_cause)
 
static struct xua_msggen_relco (uint32_t route_ctx, uint32_t dest_ref, uint32_t src_ref)
 
static void tx_relco_from_xua (struct osmo_sccp_instance *inst, struct xua_msg *in)
 
static struct xua_msggen_rlsd (uint32_t route_ctx, uint32_t dest_ref, uint32_t src_ref)
 
static void tx_rlsd_from_xua_twoway (struct sccp_connection *conn, struct xua_msg *in)
 
static void sccp_scoc_rx_unass_local_ref (struct osmo_sccp_instance *inst, struct xua_msg *xua)
 
static void sccp_scoc_rx_inval_src_ref (struct sccp_connection *conn, struct xua_msg *xua, uint32_t inval_src_ref)
 
static void sccp_scoc_rx_inval_opc (struct sccp_connection *conn, struct xua_msg *xua)
 
void sccp_scoc_rx_from_scrc (struct osmo_sccp_instance *inst, struct xua_msg *xua)
 Main entrance function for primitives from the SCRC (Routing Control) More...
 

Variables

static const struct xua_msg_event_map sua_scoc_event_map []
 
static const uint8_t cause_map_cref []
 

Function Documentation

◆ conn_create()

◆ gen_coerr()

static struct xua_msg * gen_coerr ( uint32_t  route_ctx,
uint32_t  dest_ref,
uint32_t  err_cause 
)
static

◆ gen_coref_without_conn()

◆ gen_relco()

static struct xua_msg * gen_relco ( uint32_t  route_ctx,
uint32_t  dest_ref,
uint32_t  src_ref 
)
static

◆ gen_rlsd()

static struct xua_msg * gen_rlsd ( uint32_t  route_ctx,
uint32_t  dest_ref,
uint32_t  src_ref 
)
static

◆ get_cref_cause_for_ret()

static uint8_t get_cref_cause_for_ret ( uint8_t  ret_cause)
static

References cause_map_cref.

Referenced by sccp_scoc_rx_scrc_rout_fail().

◆ osmo_sccp_conn_id_exists()

bool osmo_sccp_conn_id_exists ( const struct osmo_sccp_instance inst,
uint32_t  id 
)

◆ osmo_sccp_instance_next_conn_id()

int osmo_sccp_instance_next_conn_id ( struct osmo_sccp_instance sccp)

◆ sccp_conn_xua_gen_encode_and_send()

int sccp_conn_xua_gen_encode_and_send ( struct sccp_connection conn,
uint32_t  event,
const struct osmo_scu_prim prim,
int  msg_type 
)

◆ sccp_conn_xua_gen_relre_and_send()

◆ sccp_find_conn_by_id()

◆ sccp_find_user()

◆ sccp_scoc_rx_from_scrc()

◆ sccp_scoc_rx_inval_opc()

◆ sccp_scoc_rx_inval_src_ref()

◆ sccp_scoc_rx_scrc_rout_fail()

void sccp_scoc_rx_scrc_rout_fail ( struct osmo_sccp_instance inst,
struct xua_msg xua,
uint32_t  return_cause 
)

SCOC: Receive SCRC Routing Failure.

Parameters
[in]instSCCP Instance on which we operate
[in]xuaSUA message that was failed to route
[in]return_causeReason (cause) for routing failure

References sccp_connection::conn_id, sccp_connection::fi, gen_coref_without_conn(), get_cref_cause_for_ret(), sccp_connection::inst, LOGPSCI, sccp_find_conn_by_id(), sccp_scrc_rx_scoc_conn_msg(), SCOC_E_RCOC_ROUT_FAIL_IND, SUA_IEI_SRC_REF, xua_dialect_sua, xua_hdr_dump(), xua_msg_free(), and xua_msg_get_u32().

Referenced by rout_fail_pending_cb().

◆ sccp_scoc_rx_unass_local_ref()

◆ tx_coerr_from_xua()

◆ tx_relco_from_xua()

◆ tx_rlsd_from_xua_twoway()

◆ xua_gen_msg_co()

◆ xua_gen_relre()

◆ xua_opt_data_cache_keep()

static bool xua_opt_data_cache_keep ( struct sccp_connection conn,
const struct osmo_scu_prim prim,
int  msg_type 
)
static

◆ xua_opt_data_check_drop()

static bool xua_opt_data_check_drop ( const struct osmo_scu_prim prim,
unsigned  lim,
const char *  message 
)
static

◆ xua_opt_data_length_lim()

Variable Documentation

◆ cause_map_cref

const uint8_t cause_map_cref[]
static
Initial value:
= {
[SCCP_RETURN_CAUSE_SUBSYSTEM_CONGESTION] =
SCCP_REFUSAL_SUBSYTEM_CONGESTION,
[SCCP_RETURN_CAUSE_SUBSYSTEM_FAILURE] =
SCCP_REFUSAL_SUBSYSTEM_FAILURE,
[SCCP_RETURN_CAUSE_UNEQUIPPED_USER] =
SCCP_REFUSAL_UNEQUIPPED_USER,
[SCCP_RETURN_CAUSE_UNQUALIFIED] =
SCCP_REFUSAL_UNQUALIFIED,
[SCCP_RETURN_CAUSE_SCCP_FAILURE] =
SCCP_REFUSAL_SCCP_FAILURE,
[SCCP_RETURN_CAUSE_HOP_COUNTER_VIOLATION] =
SCCP_REFUSAL_HOP_COUNTER_VIOLATION,
}

Referenced by get_cref_cause_for_ret().

◆ sua_scoc_event_map

const struct xua_msg_event_map sua_scoc_event_map[]
static
Initial value:
= {
}
@ SCOC_E_RCOC_RLSD_IND
Definition: sccp_scoc_fsm.h:29
@ SCOC_E_RCOC_CC_IND
Definition: sccp_scoc_fsm.h:32
@ SCOC_E_RCOC_REL_COMPL_IND
Definition: sccp_scoc_fsm.h:30
@ SCOC_E_RCOC_IT_IND
Definition: sccp_scoc_fsm.h:35
@ SCOC_E_RCOC_DT1_IND
Definition: sccp_scoc_fsm.h:33
@ SCOC_E_RCOC_CONN_IND
Definition: sccp_scoc_fsm.h:27
@ SCOC_E_RCOC_CREF_IND
Definition: sccp_scoc_fsm.h:31
@ SCOC_E_RCOC_ERROR_IND
Definition: sccp_scoc_fsm.h:37
#define SUA_CO_CORE
Definition: sua.h:71
#define SUA_CO_COREF
Definition: sua.h:73
#define SUA_MSGC_CO
Definition: sua.h:37
#define SUA_CO_RELCO
Definition: sua.h:75
#define SUA_CO_COIT
Definition: sua.h:81
#define SUA_CO_COERR
Definition: sua.h:80
#define SUA_CO_RELRE
Definition: sua.h:74
#define SUA_CO_CODT
Definition: sua.h:78
#define SUA_CO_COAK
Definition: sua.h:72

Referenced by sccp_scoc_rx_from_scrc().