libosmo-sigtran 2.3.0.35-e54c
Osmocom SIGTRAN library
xua_shared.c File Reference
#include <stdint.h>
#include <unistd.h>
#include <string.h>
#include <osmocom/core/utils.h>
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/logging.h>
#include "xua_msg.h"
#include <osmocom/sigtran/osmo_ss7.h>
#include <osmocom/sigtran/protocol/m3ua.h>
#include <osmocom/sigtran/protocol/sua.h>
#include "ss7_as.h"
#include "ss7_asp.h"
#include "ss7_internal.h"
#include "xua_internal.h"

Functions

 osmo_static_assert (M3UA_ERR_INVAL_ROUT_CTX==SUA_ERR_INVAL_ROUT_CTX, _err_rctx)
 
 osmo_static_assert (M3UA_ERR_NO_CONFGD_AS_FOR_ASP==SUA_ERR_NO_CONFGD_AS_FOR_ASP, _err_as_for_asp)
 
 osmo_static_assert (M3UA_ERR_PARAM_FIELD_ERR==SUA_ERR_PARAM_FIELD_ERR, _err_param_field_err)
 
 osmo_static_assert (M3UA_ERR_UNEXP_PARAM==SUA_ERR_UNEXP_PARAM, _err_unexp_param)
 
static int xua_find_as_for_asp_no_rctx (struct osmo_ss7_as **as, const struct osmo_ss7_asp *asp)
 
int xua_find_as_for_asp (struct osmo_ss7_as **as, const struct osmo_ss7_asp *asp, const struct xua_msg_part *rctx_ie)
 Find the AS for given ASP + optional routing context IE. More...
 
int xua_find_multiple_as_for_asp (struct osmo_ss7_as **as_array, unsigned int *as_array_count, unsigned int as_array_len, const struct osmo_ss7_asp *asp, const struct xua_msg_part *rctx_ie)
 Find multiple AS for given ASP + optional routing context IE. More...
 

Function Documentation

◆ osmo_static_assert() [1/4]

osmo_static_assert ( M3UA_ERR_INVAL_ROUT_CTX  = =SUA_ERR_INVAL_ROUT_CTX,
_err_rctx   
)

◆ osmo_static_assert() [2/4]

osmo_static_assert ( M3UA_ERR_NO_CONFGD_AS_FOR_ASP  = =SUA_ERR_NO_CONFGD_AS_FOR_ASP,
_err_as_for_asp   
)

◆ osmo_static_assert() [3/4]

osmo_static_assert ( M3UA_ERR_PARAM_FIELD_ERR  = =SUA_ERR_PARAM_FIELD_ERR,
_err_param_field_err   
)

◆ osmo_static_assert() [4/4]

osmo_static_assert ( M3UA_ERR_UNEXP_PARAM  = =SUA_ERR_UNEXP_PARAM,
_err_unexp_param   
)

◆ xua_find_as_for_asp()

int xua_find_as_for_asp ( struct osmo_ss7_as **  as,
const struct osmo_ss7_asp asp,
const struct xua_msg_part rctx_ie 
)

Find the AS for given ASP + optional routing context IE.

Parameters
[out]ascaller-provided address-of-pointer to store the found AS
[in]aspASP for which we want to look-up the AS
[in]rctx_ierouting context IE (may be NULL) to use for look-up
Returns
0 in case of success; {M3UA,SUA}_ERR_* code in case of error.

if rctx_ie == NULL, we assume that this ASP is only part of a single AS; if rctx_ie is given, then we look-up the AS on the ASP based on the routing context.

References xua_msg_part::len, LOGPASP, M3UA_ERR_NO_CONFGD_AS_FOR_ASP, M3UA_ERR_PARAM_FIELD_ERR, NULL, osmo_ss7_asp_get_log_subsys(), ss7_asp_find_as_by_rctx(), xua_find_as_for_asp_no_rctx(), and xua_msg_part_get_u32().

Referenced by m3ua_rx_xfer(), sua_rx_cl(), and sua_rx_co().

◆ xua_find_as_for_asp_no_rctx()

static int xua_find_as_for_asp_no_rctx ( struct osmo_ss7_as **  as,
const struct osmo_ss7_asp asp 
)
static

◆ xua_find_multiple_as_for_asp()

int xua_find_multiple_as_for_asp ( struct osmo_ss7_as **  as_array,
unsigned int *  as_array_count,
unsigned int  as_array_len,
const struct osmo_ss7_asp asp,
const struct xua_msg_part rctx_ie 
)

Find multiple AS for given ASP + optional routing context IE.

Parameters
[out]as_arraycaller-provided address of array to store the found ASs. Usually of OSMO_SS7_MAX_RCTX_COUNT elements.
[out]as_array_countfilled by the callee, contains number of elements filled in as_array
[in]as_array_lencaller provided, provides the amount of elements allocated in as_array. Usually OSMO_SS7_MAX_RCTX_COUNT.
[in]aspASP for which we want to look-up the AS
[in]rctx_ierouting context IE (may be NULL) to use for look-up
Returns
0 in case of success; {M3UA,SUA}_ERR_* code in case of error.

if rctx_ie == NULL, we assume that this ASP is only psart of a single AS; if rctx_ie is given, then we look-up the ASs on the ASP based on the routing contexts. This function always returns at least one AS in the as_array if it succeeds.

References xua_msg_part::dat, xua_msg_part::len, LOGPASP, M3UA_ERR_NO_CONFGD_AS_FOR_ASP, M3UA_ERR_PARAM_FIELD_ERR, M3UA_ERR_UNEXP_PARAM, osmo_ss7_asp_get_log_subsys(), ss7_asp_find_as_by_rctx(), and xua_find_as_for_asp_no_rctx().

Referenced by m3ua_rx_snm_asp(), m3ua_rx_snm_ipsp(), m3ua_rx_snm_sg(), sua_rx_snm_asp(), sua_rx_snm_ipsp(), and sua_rx_snm_sg().