libosmo-sigtran 2.1.0.190-7669 Osmocom SIGTRAN library

Macros | Functions | Variables
xua_rkm.c File Reference
`#include <string.h>`
`#include <arpa/inet.h>`
`#include <osmocom/core/logging.h>`
`#include <osmocom/core/linuxlist.h>`
`#include "xua_msg.h"`
`#include <osmocom/sigtran/osmo_ss7.h>`
`#include <osmocom/sigtran/protocol/m3ua.h>`
`#include "ss7_as.h"`
`#include "ss7_asp.h"`
`#include "ss7_internal.h"`
`#include "ss7_route.h"`
`#include "ss7_route_table.h"`
`#include "xua_internal.h"`
`#include "xua_as_fsm.h"`
`#include "xua_asp_fsm.h"`

## Macros
#define | MAX_NEW_AS 16

## Functions
static void | msgb_push_m3ua_hdr (struct msgb *msg, uint8_t msg_class, uint8_t msg_type)
static int | msgb_append_reg_res (struct msgb *msg, uint32_t local_rk_id, uint32_t status, uint32_t rctx)
static int | msgb_append_dereg_res (struct msgb *msg, uint32_t status, uint32_t rctx)
static void | xua_rkm_send_reg_req (struct osmo_ss7_asp *asp, const struct osmo_ss7_routing_key *rkey, enum osmo_ss7_as_traffic_mode traf_mode)
static void | xua_rkm_send_dereg_req (struct osmo_ss7_asp *asp, uint32_t route_ctx)
static bool | newly_assigned_as_in_array (struct osmo_ss7_as *const *newly_assigned_as, unsigned int num_newly_assigned_as, const struct osmo_ss7_as *as)
static int | handle_rkey_reg (struct osmo_ss7_asp *asp, struct xua_msg *inner, struct msgb *resp, struct osmo_ss7_as **newly_assigned_as, unsigned int max_nas_idx, unsigned int *nas_idx)
static int | m3ua_rx_rkm_reg_req (struct osmo_ss7_asp *asp, struct xua_msg *xua)
static int | handle_rkey_dereg (struct osmo_ss7_asp *asp, uint32_t rctx, struct msgb *resp)
static int | m3ua_rx_rkm_dereg_req (struct osmo_ss7_asp *asp, struct xua_msg *xua)
static int | handle_rkey_reg_resp (struct osmo_ss7_asp *asp, struct xua_msg *inner)
static int | m3ua_rx_rkm_reg_rsp (struct osmo_ss7_asp *asp, struct xua_msg *xua)
static int | handle_rkey_dereg_resp (struct osmo_ss7_asp *asp, struct xua_msg *inner)
static int | m3ua_rx_rkm_dereg_rsp (struct osmo_ss7_asp *asp, struct xua_msg *xua)
int | m3ua_rx_rkm (struct osmo_ss7_asp *asp, struct xua_msg *xua)
int | osmo_xlm_sap_down (struct osmo_ss7_asp *asp, struct osmo_prim_hdr *oph)
void | xua_rkm_cleanup_dyn_as_for_asp (struct osmo_ss7_asp *asp)

## Variables
const struct value_string | m3ua_rkm_reg_status_vals []
const struct value_string | m3ua_rkm_dereg_status_vals []

## Macro Definition Documentation

## ◆ MAX_NEW_AS

#define MAX_NEW_AS 16

## Function Documentation

## ◆ handle_rkey_dereg()

static int handle_rkey_dereg | ( | struct osmo_ss7_asp * | asp,
|  | uint32_t | rctx,
|  | struct msgb * | resp
| ) |  |
| static

References osmo_ss7_route::as, osmo_ss7_as::cfg, osmo_ss7_asp::cfg, osmo_ss7_as::fi, osmo_ss7_asp::fi, osmo_ss7_asp::inst, LOGPASP, M3UA_RKM_DEREG_ERR_ASP_ACTIVE, M3UA_RKM_DEREG_ERR_INVAL_RCTX, M3UA_RKM_DEREG_ERR_NOT_REGD, M3UA_RKM_DEREG_ERR_UNKNOWN, M3UA_RKM_DEREG_SUCCESS, msgb_append_dereg_res(), osmo_ss7_asp::name, osmo_ss7_as_del_asp(), osmo_ss7_as_destroy(), osmo_ss7_as_find_by_rctx(), osmo_ss7_as_has_asp(), osmo_ss7_pointcode_print(), osmo_ss7_routing_key::pc, osmo_ss7_as::rkm_dyn_allocated, osmo_ss7_as::routing_key, osmo_ss7_instance::rtable_system, ss7_route_destroy(), ss7_route_table_find_route_by_dpc_mask(), XUA_ASP_S_ACTIVE, and XUA_ASPAS_ASP_DOWN_IND.

Referenced by m3ua_rx_rkm_dereg_req().

## ◆ handle_rkey_dereg_resp()

static int handle_rkey_dereg_resp | ( | struct osmo_ss7_asp * | asp,
|  | struct xua_msg * | inner
| ) |  |
| static

References osmo_ss7_routing_key::context, osmo_xlm_prim_rk_reg::key, LOGPASP, M3UA_IEI_DEREG_STATUS, M3UA_IEI_ROUTE_CTX, m3ua_rkm_dereg_status_vals, OSMO_XLM_PRIM_M_RK_DEREG, osmo_xlm_prim::rk_dereg, osmo_xlm_prim::rk_reg, osmo_xlm_prim_rk_dereg::route_ctx, osmo_xlm_prim_rk_dereg::status, osmo_xlm_prim::u, xua_asp_send_xlm_prim(), xua_msg_find_tag(), xua_msg_get_u32(), and xua_xlm_prim_alloc().

Referenced by m3ua_rx_rkm_dereg_rsp().

## ◆ handle_rkey_reg()

static int handle_rkey_reg | ( | struct osmo_ss7_asp * | asp,
|  | struct xua_msg * | inner,
|  | struct msgb * | resp,
|  | struct osmo_ss7_as ** | newly_assigned_as,
|  | unsigned int | max_nas_idx,
|  | unsigned int * | nas_idx
| ) |  |
| static

References osmo_ss7_route::as, osmo_ss7_as::cfg, osmo_ss7_instance::cfg, osmo_ss7_routing_key::context, osmo_ss7_as::description, dpc, osmo_ss7_as::inst, osmo_ss7_asp::inst, LOGPAS, LOGPASP, M3UA_IEI_DEST_PC, M3UA_IEI_LOC_RKEY_ID, M3UA_IEI_NET_APPEAR, M3UA_IEI_ORIG_PC, M3UA_IEI_ROUTE_CTX, M3UA_IEI_SVC_IND, M3UA_IEI_TRAF_MODE_TYP, M3UA_RKM_REG_ERR_CANT_SUPP_UNQ_RT, M3UA_RKM_REG_ERR_INSUFF_RESRC, M3UA_RKM_REG_ERR_INVAL_NET_APPEAR, M3UA_RKM_REG_ERR_INVAL_RKEY, M3UA_RKM_REG_ERR_PERM_DENIED, M3UA_RKM_REG_ERR_UNSUPP_RK_PARAM, M3UA_RKM_REG_ERR_UNSUPP_TRAF_MODE, M3UA_RKM_REG_SUCCESS, 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, msgb_append_reg_res(), osmo_ss7_as::name, newly_assigned_as_in_array(), osmo_ss7_as_destroy(), osmo_ss7_as_find_by_rctx(), osmo_ss7_as_find_or_create(), osmo_ss7_as_tmode_compatible_xua(), osmo_ss7_as_traffic_mode_name(), OSMO_SS7_ASP_PROT_M3UA, osmo_ss7_find_free_rctx(), osmo_ss7_pointcode_print(), osmo_ss7_tmode_from_xua(), osmo_ss7_routing_key::pc, osmo_ss7_instance::permit_dyn_rkm_alloc, osmo_ss7_as::rkm_dyn_allocated, osmo_ss7_as::routing_key, osmo_ss7_instance::rtable_system, ss7_as_add_asp(), ss7_route_create(), xua_msg_find_tag(), and xua_msg_get_u32().

Referenced by m3ua_rx_rkm_reg_req().

## ◆ handle_rkey_reg_resp()

static int handle_rkey_reg_resp | ( | struct osmo_ss7_asp * | asp,
|  | struct xua_msg * | inner
| ) |  |
| static

References osmo_ss7_routing_key::context, osmo_xlm_prim_rk_reg::key, osmo_ss7_routing_key::l_rk_id, LOGPASP, M3UA_IEI_LOC_RKEY_ID, M3UA_IEI_REG_STATUS, M3UA_IEI_ROUTE_CTX, m3ua_rkm_reg_status_vals, OSMO_XLM_PRIM_M_RK_REG, osmo_xlm_prim::rk_reg, osmo_xlm_prim_rk_reg::status, osmo_xlm_prim::u, xua_asp_send_xlm_prim(), xua_msg_find_tag(), xua_msg_get_u32(), and xua_xlm_prim_alloc().

Referenced by m3ua_rx_rkm_reg_rsp().

## ◆ m3ua_rx_rkm()

int m3ua_rx_rkm | ( | struct osmo_ss7_asp * | asp,
|  | struct xua_msg * | xua
| ) |  |

References xua_msg::hdr, LOGPASP, M3UA_RKM_DEREG_REQ, M3UA_RKM_DEREG_RSP, M3UA_RKM_REG_REQ, M3UA_RKM_REG_RSP, m3ua_rx_rkm_dereg_req(), m3ua_rx_rkm_dereg_rsp(), m3ua_rx_rkm_reg_req(), m3ua_rx_rkm_reg_rsp(), xua_common_hdr::msg_type, and xua_msg_free().

Referenced by m3ua_rx_msg().

## ◆ m3ua_rx_rkm_dereg_req()

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

References xua_msg_part::dat, handle_rkey_dereg(), xua_msg_part::len, M3UA_IEI_ROUTE_CTX, m3ua_msgb_alloc(), M3UA_MSGC_RKM, M3UA_RKM_DEREG_RSP, msgb_push_m3ua_hdr(), osmo_ss7_asp_send(), and xua_msg_find_tag().

Referenced by m3ua_rx_rkm().

## ◆ m3ua_rx_rkm_dereg_rsp()

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

References xua_msg::entry, handle_rkey_dereg_resp(), xua_msg::headers, xua_msg_part::len, M3UA_IEI_DEREG_RESULT, NULL, xua_msg_part::tag, xua_from_nested(), and xua_msg_free().

Referenced by m3ua_rx_rkm().

## ◆ m3ua_rx_rkm_reg_req()

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

References xua_as_event_asp_inactive_ind_pars::asp, osmo_ss7_as::fi, handle_rkey_reg(), xua_msg::headers, LOGPASP, M3UA_IEI_ROUT_KEY, m3ua_msgb_alloc(), M3UA_MSGC_RKM, M3UA_RKM_REG_RSP, MAX_NEW_AS, msgb_push_m3ua_hdr(), osmo_ss7_asp_send(), xua_msg_part::tag, XUA_ASPAS_ASP_INACTIVE_IND, xua_from_nested(), and xua_msg_free().

Referenced by m3ua_rx_rkm().

## ◆ m3ua_rx_rkm_reg_rsp()

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

References xua_msg::entry, handle_rkey_reg_resp(), xua_msg::headers, xua_msg_part::len, M3UA_IEI_REG_RESULT, NULL, xua_msg_part::tag, xua_from_nested(), and xua_msg_free().

Referenced by m3ua_rx_rkm().

## ◆ msgb_append_dereg_res()

static int msgb_append_dereg_res | ( | struct msgb * | msg,
|  | uint32_t | status,
|  | uint32_t | rctx
| ) |  |
| static

References M3UA_IEI_DEREG_RESULT, M3UA_IEI_DEREG_STATUS, M3UA_IEI_ROUTE_CTX, and msgb_t16l16vp_put_u32().

Referenced by handle_rkey_dereg().

## ◆ msgb_append_reg_res()

static int msgb_append_reg_res | ( | struct msgb * | msg,
|  | uint32_t | local_rk_id,
|  | uint32_t | status,
|  | uint32_t | rctx
| ) |  |
| static

References M3UA_IEI_LOC_RKEY_ID, M3UA_IEI_REG_RESULT, M3UA_IEI_REG_STATUS, M3UA_IEI_ROUTE_CTX, and msgb_t16l16vp_put_u32().

Referenced by handle_rkey_reg().

## ◆ msgb_push_m3ua_hdr()

static void msgb_push_m3ua_hdr | ( | struct msgb * | msg,
|  | uint8_t | msg_class,
|  | uint8_t | msg_type
| ) |  |
| static

References M3UA_VERSION, msg_class, xua_common_hdr::msg_class, xua_common_hdr::msg_length, msg_type, xua_common_hdr::msg_type, xua_common_hdr::spare, and xua_common_hdr::version.

Referenced by m3ua_rx_rkm_dereg_req(), m3ua_rx_rkm_reg_req(), xua_rkm_send_dereg_req(), and xua_rkm_send_reg_req().

## ◆ newly_assigned_as_in_array()

static bool newly_assigned_as_in_array | ( | struct osmo_ss7_as *const * | newly_assigned_as,
|  | unsigned int | num_newly_assigned_as,
|  | const struct osmo_ss7_as * | as
| ) |  |
| static

Referenced by handle_rkey_reg().

## ◆ osmo_xlm_sap_down()

int osmo_xlm_sap_down | ( | struct osmo_ss7_asp * | asp,
|  | struct osmo_prim_hdr * | oph
| ) |  |

References osmo_xlm_prim_rk_reg::key, LOGPASP, osmo_xlm_prim::oph, OSMO_XLM_PRIM_M_RK_DEREG, OSMO_XLM_PRIM_M_RK_REG, osmo_xlm_prim_name(), osmo_xlm_prim::rk_dereg, osmo_xlm_prim::rk_reg, osmo_xlm_prim_rk_dereg::route_ctx, osmo_xlm_prim_rk_reg::traf_mode, osmo_xlm_prim::u, xua_rkm_send_dereg_req(), and xua_rkm_send_reg_req().

Referenced by lm_timer_cb().

## ◆ xua_rkm_cleanup_dyn_as_for_asp()

void xua_rkm_cleanup_dyn_as_for_asp | ( | struct osmo_ss7_asp * | asp | ) |

References osmo_ss7_instance::as_list, osmo_ss7_as::inst, osmo_ss7_asp::inst, osmo_ss7_as::list, osmo_ss7_as_count_asp(), osmo_ss7_as_destroy(), osmo_ss7_as_has_asp(), and osmo_ss7_as::rkm_dyn_allocated.

Referenced by ss7_asp_xua_srv_conn_closed_cb().

## ◆ xua_rkm_send_dereg_req()

static void xua_rkm_send_dereg_req | ( | struct osmo_ss7_asp * | asp,
|  | uint32_t | route_ctx
| ) |  |
| static

References M3UA_IEI_ROUTE_CTX, m3ua_msgb_alloc(), M3UA_MSGC_RKM, M3UA_RKM_DEREG_REQ, msgb_push_m3ua_hdr(), msgb_t16l16vp_put_u32(), and osmo_ss7_asp_send().

Referenced by osmo_xlm_sap_down().

## ◆ xua_rkm_send_reg_req()

static void xua_rkm_send_reg_req | ( | struct osmo_ss7_asp * | asp,
|  | const struct osmo_ss7_routing_key * | rkey,
|  | enum osmo_ss7_as_traffic_mode | traf_mode
| ) |  |
| static

References osmo_ss7_routing_key::context, osmo_ss7_routing_key::l_rk_id, M3UA_IEI_DEST_PC, M3UA_IEI_LOC_RKEY_ID, M3UA_IEI_ROUT_KEY, M3UA_IEI_ROUTE_CTX, M3UA_IEI_TRAF_MODE_TYP, m3ua_msgb_alloc(), M3UA_MSGC_RKM, M3UA_RKM_REG_REQ, msgb_push_m3ua_hdr(), msgb_t16l16vp_put_u32(), osmo_ss7_asp_send(), osmo_ss7_tmode_to_xua(), and osmo_ss7_routing_key::pc.

Referenced by osmo_xlm_sap_down().

## Variable Documentation

## ◆ m3ua_rkm_dereg_status_vals

const struct value_string m3ua_rkm_dereg_status_vals[]

Initial value:
= {
{ M3UA_RKM_DEREG_SUCCESS, "SUCCSS" },
{ M3UA_RKM_DEREG_ERR_UNKNOWN, "Unknown Error" },
{ M3UA_RKM_DEREG_ERR_INVAL_RCTX, "Invalid Routing Context" },
{ M3UA_RKM_DEREG_ERR_PERM_DENIED, "Permission Denied" },
{ M3UA_RKM_DEREG_ERR_NOT_REGD, "Error: Not Registered" },
{ M3UA_RKM_DEREG_ERR_ASP_ACTIVE, "Error: ASP Active" },
{ 0, NULL }
}
M3UA_RKM_DEREG_ERR_UNKNOWN
@ M3UA_RKM_DEREG_ERR_UNKNOWN
Definition: m3ua.h:138
M3UA_RKM_DEREG_ERR_INVAL_RCTX
@ M3UA_RKM_DEREG_ERR_INVAL_RCTX
Definition: m3ua.h:139
M3UA_RKM_DEREG_SUCCESS
@ M3UA_RKM_DEREG_SUCCESS
Definition: m3ua.h:137
M3UA_RKM_DEREG_ERR_PERM_DENIED
@ M3UA_RKM_DEREG_ERR_PERM_DENIED
Definition: m3ua.h:140
M3UA_RKM_DEREG_ERR_NOT_REGD
@ M3UA_RKM_DEREG_ERR_NOT_REGD
Definition: m3ua.h:141
M3UA_RKM_DEREG_ERR_ASP_ACTIVE
@ M3UA_RKM_DEREG_ERR_ASP_ACTIVE
Definition: m3ua.h:142
NULL
int and can be left NULL
Definition: osmo_ss7.h:364

Referenced by handle_rkey_dereg_resp().

## ◆ m3ua_rkm_reg_status_vals

const struct value_string m3ua_rkm_reg_status_vals[]

Initial value:
= {
{ M3UA_RKM_REG_SUCCESS, "SUCCESS" },
{ M3UA_RKM_REG_ERR_UNKNOWN, "Unknown Error" },
{ M3UA_RKM_REG_ERR_INVAL_DPC, "Invalid Destination Pointcode" },
{ M3UA_RKM_REG_ERR_INVAL_NET_APPEAR, "Invalid Network Appearance" },
{ M3UA_RKM_REG_ERR_INVAL_RKEY, "Invalid Routing Key" },
{ M3UA_RKM_REG_ERR_PERM_DENIED, "Permission Denied" },
{ M3UA_RKM_REG_ERR_CANT_SUPP_UNQ_RT, "Cannot Support Unique Routing" },
{ M3UA_RKM_REG_ERR_RKEY_NOT_PROVD, "Routing Key Not Provided" },
{ M3UA_RKM_REG_ERR_INSUFF_RESRC, "Insufficient Resources" },
{ M3UA_RKM_REG_ERR_UNSUPP_RK_PARAM, "Unsupported Routing Key Parameter" },
{ M3UA_RKM_REG_ERR_UNSUPP_TRAF_MODE, "Unsupported Traffic Mode Type" },
{ M3UA_RKM_REG_ERR_RKEY_CHG_REFUSED, "Routing Key Change Refused" },
{ M3UA_RKM_REG_ERR_RKEY_ALRDY_REGD, "Routing Key Already Registered" },
{ 0, NULL }
}
M3UA_RKM_REG_ERR_INVAL_RKEY
@ M3UA_RKM_REG_ERR_INVAL_RKEY
Definition: m3ua.h:125
M3UA_RKM_REG_ERR_UNSUPP_TRAF_MODE
@ M3UA_RKM_REG_ERR_UNSUPP_TRAF_MODE
Definition: m3ua.h:131
M3UA_RKM_REG_ERR_INVAL_NET_APPEAR
@ M3UA_RKM_REG_ERR_INVAL_NET_APPEAR
Definition: m3ua.h:124
M3UA_RKM_REG_ERR_RKEY_ALRDY_REGD
@ M3UA_RKM_REG_ERR_RKEY_ALRDY_REGD
Definition: m3ua.h:133
M3UA_RKM_REG_ERR_RKEY_NOT_PROVD
@ M3UA_RKM_REG_ERR_RKEY_NOT_PROVD
Definition: m3ua.h:128
M3UA_RKM_REG_SUCCESS
@ M3UA_RKM_REG_SUCCESS
Definition: m3ua.h:121
M3UA_RKM_REG_ERR_UNSUPP_RK_PARAM
@ M3UA_RKM_REG_ERR_UNSUPP_RK_PARAM
Definition: m3ua.h:130
M3UA_RKM_REG_ERR_CANT_SUPP_UNQ_RT
@ M3UA_RKM_REG_ERR_CANT_SUPP_UNQ_RT
Definition: m3ua.h:127
M3UA_RKM_REG_ERR_RKEY_CHG_REFUSED
@ M3UA_RKM_REG_ERR_RKEY_CHG_REFUSED
Definition: m3ua.h:132
M3UA_RKM_REG_ERR_PERM_DENIED
@ M3UA_RKM_REG_ERR_PERM_DENIED
Definition: m3ua.h:126
M3UA_RKM_REG_ERR_INSUFF_RESRC
@ M3UA_RKM_REG_ERR_INSUFF_RESRC
Definition: m3ua.h:129
M3UA_RKM_REG_ERR_INVAL_DPC
@ M3UA_RKM_REG_ERR_INVAL_DPC
Definition: m3ua.h:123
M3UA_RKM_REG_ERR_UNKNOWN
@ M3UA_RKM_REG_ERR_UNKNOWN
Definition: m3ua.h:122

Referenced by handle_rkey_reg_resp().