libosmo-sigtran 2.0.0.52-6412
Osmocom SIGTRAN library
|
#include <stdint.h>
#include <errno.h>
#include <unistd.h>
#include <string.h>
#include <osmocom/core/utils.h>
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/write_queue.h>
#include <osmocom/core/logging.h>
#include <osmocom/core/timer.h>
#include <osmocom/core/socket.h>
#include <osmocom/netif/stream.h>
#include "xua_msg.h"
#include <osmocom/sigtran/mtp_sap.h>
#include <osmocom/sigtran/sccp_sap.h>
#include <osmocom/sigtran/osmo_ss7.h>
#include <osmocom/sigtran/protocol/m3ua.h>
#include <osmocom/sigtran/protocol/sua.h>
#include "xua_as_fsm.h"
#include "xua_asp_fsm.h"
#include "xua_internal.h"
#include "ss7_as.h"
#include "ss7_asp.h"
#include "ss7_internal.h"
Macros | |
#define | M3UA_MSGB_SIZE 1500 |
#define | MAND_IES(msgt, ies) [msgt] = (ies) |
Functions | |
void | mtp_xfer_param_to_m3ua_dh (struct m3ua_data_hdr *mdh, const struct osmo_mtp_transfer_param *param) |
void | m3ua_dh_to_xfer_param (struct osmo_mtp_transfer_param *param, const struct m3ua_data_hdr *mdh) |
struct msgb * | m3ua_msgb_alloc (const char *name) |
struct xua_msg * | m3ua_xfer_from_data (const struct m3ua_data_hdr *data_hdr, const uint8_t *data, unsigned int data_len) |
static struct xua_msg * | m3ua_gen_error (uint32_t err_code) |
static struct xua_msg * | m3ua_gen_error_msg (uint32_t err_code, struct msgb *msg) |
struct xua_msg * | m3ua_encode_notify (const struct osmo_xlm_prim_notify *npar) |
int | m3ua_decode_notify (struct osmo_xlm_prim_notify *npar, void *ctx, const struct xua_msg *xua) |
static struct msgb * | m3ua_to_msg (struct xua_msg *xua) |
static int | m3ua_tx_xua_asp (struct osmo_ss7_asp *asp, struct xua_msg *xua) |
int | m3ua_tx_xua_as (struct osmo_ss7_as *as, struct xua_msg *xua) |
Send a given xUA message via a given M3UA Application Server. More... | |
struct m3ua_data_hdr * | data_hdr_from_m3ua (struct xua_msg *xua) |
static int | m3ua_rx_xfer (struct osmo_ss7_asp *asp, struct xua_msg *xua) |
static int | m3ua_rx_mgmt_err (struct osmo_ss7_asp *asp, struct xua_msg *xua) |
static int | m3ua_rx_mgmt_ntfy (struct osmo_ss7_asp *asp, struct xua_msg *xua) |
static int | m3ua_rx_mgmt (struct osmo_ss7_asp *asp, struct xua_msg *xua) |
static int | m3ua_rx_asp (struct osmo_ss7_asp *asp, struct xua_msg *xua) |
static int | m3ua_rx_snm (struct osmo_ss7_asp *asp, struct xua_msg *xua) |
int | m3ua_rx_msg (struct osmo_ss7_asp *asp, struct msgb *msg) |
process M3UA message received from socket More... | |
static struct xua_msg * | m3ua_encode_duna (const uint32_t *rctx, unsigned int num_rctx, const uint32_t *aff_pc, unsigned int num_aff_pc, const char *info_string) |
static struct xua_msg * | m3ua_encode_dava (const uint32_t *rctx, unsigned int num_rctx, const uint32_t *aff_pc, unsigned int num_aff_pc, const char *info_string) |
static struct xua_msg * | m3ua_encode_dupu (const uint32_t *rctx, unsigned int num_rctx, uint32_t dpc, uint16_t user, uint16_t cause, const char *info_string) |
void | m3ua_tx_snm_available (struct osmo_ss7_asp *asp, const uint32_t *rctx, unsigned int num_rctx, const uint32_t *aff_pc, unsigned int num_aff_pc, const char *info_string, bool available) |
Transmit SSNM DUNA/DAVA message indicating [un]availability of certain point code[s]. More... | |
void | m3ua_tx_snm_congestion (struct osmo_ss7_asp *asp, const uint32_t *rctx, unsigned int num_rctx, const uint32_t *aff_pc, unsigned int num_aff_pc, const uint32_t *concerned_dpc, const uint8_t *cong_level, const char *info_string) |
Transmit SSNM SCON message indicating congestion. More... | |
void | m3ua_tx_dupu (struct osmo_ss7_asp *asp, const uint32_t *rctx, unsigned int num_rctx, uint32_t dpc, uint16_t user, uint16_t cause, const char *info_str) |
Transmit SSNM DUPU message indicating user unavailability. More... | |
static int | m3ua_rx_snm_asp (struct osmo_ss7_asp *asp, struct xua_msg *xua) |
static int | m3ua_rx_snm_sg (struct osmo_ss7_asp *asp, struct xua_msg *xua) |
Variables | |
const struct value_string | m3ua_err_names [] |
const struct value_string | m3ua_ntfy_type_names [] |
const struct value_string | m3ua_ntfy_stchg_names [] |
const struct value_string | m3ua_ntfy_other_names [] |
static const struct value_string | m3ua_iei_names [] |
static const uint16_t | data_mand_ies [] |
static const struct value_string | m3ua_xfer_msgt_names [] |
static const struct xua_msg_class | msg_class_xfer |
static const uint16_t | duna_mand_ies [] |
static const uint16_t | dava_mand_ies [] |
static const uint16_t | daud_mand_ies [] |
static const uint16_t | scon_mand_ies [] |
static const uint16_t | dupu_mand_ies [] |
static const uint16_t | drst_mand_ies [] |
static const struct value_string | m3ua_snm_msgt_names [] |
const struct xua_msg_class | m3ua_msg_class_snm |
static const struct value_string | m3ua_aspsm_msgt_names [] |
const struct xua_msg_class | m3ua_msg_class_aspsm |
const struct value_string | m3ua_asptm_msgt_names [] |
const struct xua_msg_class | m3ua_msg_class_asptm |
static const uint16_t | err_req_ies [] |
static const uint16_t | ntfy_req_ies [] |
static const struct value_string | m3ua_mgmt_msgt_names [] |
const struct xua_msg_class | m3ua_msg_class_mgmt |
static const uint16_t | reg_req_ies [] |
static const uint16_t | reg_rsp_ies [] |
static const uint16_t | dereg_req_ies [] |
static const uint16_t | dereg_rsp_ies [] |
static const struct value_string | m3ua_rkm_msgt_names [] |
const struct xua_msg_class | m3ua_msg_class_rkm |
const struct xua_dialect | xua_dialect_m3ua |
static const struct xua_msg_event_map | m3ua_aspxm_map [] |
#define M3UA_MSGB_SIZE 1500 |
#define MAND_IES | ( | msgt, | |
ies | |||
) | [msgt] = (ies) |
struct m3ua_data_hdr * data_hdr_from_m3ua | ( | struct xua_msg * | xua | ) |
References xua_msg_part::dat, xua_msg::hdr, M3UA_IEI_PROT_DATA, M3UA_MSGC_XFER, M3UA_XFER_DATA, xua_common_hdr::msg_class, xua_common_hdr::msg_type, and xua_msg_find_tag().
Referenced by hmdt_message_for_distribution(), and m3ua_rx_xfer().
int m3ua_decode_notify | ( | struct osmo_xlm_prim_notify * | npar, |
void * | ctx, | ||
const struct xua_msg * | xua | ||
) |
References osmo_xlm_prim_notify::asp_id, xua_msg_part::dat, osmo_xlm_prim_notify::info_string, xua_msg_part::len, M3UA_IEI_ASP_ID, M3UA_IEI_INFO_STRING, M3UA_IEI_ROUTE_CTX, M3UA_IEI_STATUS, NOTIFY_PAR_P_ASP_ID, NOTIFY_PAR_P_ROUTE_CTX, osmo_xlm_prim_notify::presence, osmo_xlm_prim_notify::route_ctx, osmo_xlm_prim_notify::status_info, osmo_xlm_prim_notify::status_type, xua_msg_find_tag(), and xua_msg_part_get_u32().
Referenced by m3ua_rx_mgmt_ntfy(), and sua_rx_mgmt_ntfy().
void m3ua_dh_to_xfer_param | ( | struct osmo_mtp_transfer_param * | param, |
const struct m3ua_data_hdr * | mdh | ||
) |
References osmo_mtp_transfer_param::dpc, m3ua_data_hdr::dpc, m3ua_data_hdr::mp, m3ua_data_hdr::ni, osmo_mtp_transfer_param::opc, m3ua_data_hdr::opc, m3ua_data_hdr::si, osmo_mtp_transfer_param::sio, osmo_mtp_transfer_param::sls, and m3ua_data_hdr::sls.
Referenced by ipa_rx_msg_sccp(), m3ua_rx_xfer(), and m3ua_to_xfer_ind().
|
static |
References xua_msg::hdr, m3ua_encode_duna(), M3UA_SNM_DAVA, and xua_common_hdr::msg_type.
Referenced by m3ua_tx_snm_available().
|
static |
References xua_msg::hdr, M3UA_IEI_AFFECTED_PC, M3UA_IEI_INFO_STRING, M3UA_IEI_ROUTE_CTX, M3UA_MSGC_SNM, M3UA_SNM_DUNA, M3UA_VERSION, xua_common_hdr::version, XUA_HDR, xua_msg_add_data(), and xua_msg_alloc().
Referenced by m3ua_encode_dava(), and m3ua_tx_snm_available().
|
static |
References dpc, xua_msg::hdr, M3UA_IEI_AFFECTED_PC, M3UA_IEI_INFO_STRING, M3UA_IEI_ROUTE_CTX, M3UA_IEI_USER_CAUSE, M3UA_MSGC_SNM, M3UA_SNM_DUPU, M3UA_VERSION, xua_common_hdr::version, XUA_HDR, xua_msg_add_data(), xua_msg_add_u32(), and xua_msg_alloc().
Referenced by m3ua_tx_dupu().
struct xua_msg * m3ua_encode_notify | ( | const struct osmo_xlm_prim_notify * | npar | ) |
References osmo_xlm_prim_notify::asp_id, xua_msg::hdr, osmo_xlm_prim_notify::info_string, M3UA_IEI_ASP_ID, M3UA_IEI_INFO_STRING, M3UA_IEI_ROUTE_CTX, M3UA_IEI_STATUS, M3UA_MGMT_NTFY, M3UA_MSGC_MGMT, M3UA_NOTIFY, NOTIFY_PAR_P_ASP_ID, NOTIFY_PAR_P_ROUTE_CTX, osmo_xlm_prim_notify::presence, osmo_xlm_prim_notify::route_ctx, osmo_xlm_prim_notify::status_info, osmo_xlm_prim_notify::status_type, XUA_HDR, xua_msg_add_data(), xua_msg_add_u32(), and xua_msg_alloc().
Referenced by encode_notify().
|
static |
References xua_msg::hdr, M3UA_IEI_ERR_CODE, M3UA_MGMT_ERR, M3UA_MSGC_MGMT, M3UA_VERSION, xua_common_hdr::version, XUA_HDR, xua_msg_add_u32(), and xua_msg_alloc().
Referenced by m3ua_gen_error_msg().
|
static |
References xua_msg_part::dat, xua_msg_part::len, M3UA_ERR_INVAL_NET_APPEAR, m3ua_gen_error(), M3UA_IEI_DIAG_INFO, M3UA_IEI_NET_APPEAR, M3UA_VERSION, xua_from_msg(), xua_msg_add_data(), xua_msg_find_tag(), and xua_msg_free().
Referenced by m3ua_rx_msg().
struct msgb * m3ua_msgb_alloc | ( | const char * | name | ) |
References M3UA_MSG_HEADROOM, and M3UA_MSG_SIZE.
Referenced by m3ua_rx_rkm_dereg_req(), m3ua_rx_rkm_reg_req(), m3ua_to_xfer_ind(), xua_rkm_send_dereg_req(), and xua_rkm_send_reg_req().
|
static |
References xua_msg_event_map::event, osmo_ss7_asp::fi, m3ua_aspxm_map, M3UA_ERR_UNEXPECTED_MSG, M3UA_ERR_UNSUPP_MSG_TYPE, and xua_msg_event_map().
Referenced by m3ua_rx_msg().
|
static |
References xua_msg::hdr, M3UA_ERR_UNSUPP_MSG_TYPE, M3UA_MGMT_ERR, M3UA_MGMT_NTFY, m3ua_rx_mgmt_err(), m3ua_rx_mgmt_ntfy(), and xua_common_hdr::msg_type.
Referenced by m3ua_rx_msg().
|
static |
|
static |
References osmo_xlm_prim_notify::info_string, LOGPASP, m3ua_decode_notify(), M3UA_NOTIFY_T_OTHER, M3UA_NOTIFY_T_STATCHG, m3ua_ntfy_other_names, m3ua_ntfy_stchg_names, m3ua_ntfy_type_names, osmo_xlm_prim::notify, OSMO_XLM_PRIM_M_NOTIFY, osmo_xlm_prim_notify::status_info, osmo_xlm_prim_notify::status_type, osmo_xlm_prim::u, xua_asp_send_xlm_prim(), and xua_xlm_prim_alloc().
Referenced by m3ua_rx_mgmt().
int m3ua_rx_msg | ( | struct osmo_ss7_asp * | asp, |
struct msgb * | msg | ||
) |
process M3UA message received from socket
[in] | asp | Application Server Process receiving msg |
[in] | msg | received message buffer |
References osmo_ss7_asp::cfg, xua_common_hdr::data, xua_msg::hdr, LOGPASP, M3UA_ERR_INVAL_STREAM_ID, M3UA_ERR_INVALID_VERSION, M3UA_ERR_MISSING_PARAM, M3UA_ERR_PARAM_FIELD_ERR, M3UA_ERR_UNSUPP_MSG_CLASS, m3ua_gen_error_msg(), M3UA_MSGC_ASPSM, M3UA_MSGC_ASPTM, M3UA_MSGC_MGMT, M3UA_MSGC_RKM, M3UA_MSGC_SNM, M3UA_MSGC_XFER, m3ua_rx_asp(), m3ua_rx_mgmt(), m3ua_rx_rkm(), m3ua_rx_snm(), m3ua_rx_xfer(), m3ua_tx_xua_asp(), M3UA_VERSION, xua_common_hdr::msg_class, OSMO_SS7_ASP_PROT_M3UA, osmo_ss7_asp::proto, xua_common_hdr::version, xua_dialect_check_all_mand_ies(), xua_dialect_m3ua, xua_from_msg(), xua_hdr_dump(), and xua_msg_free().
Referenced by ss7_asp_m3ua_tcp_srv_conn_rx_cb(), ss7_asp_xua_srv_conn_rx_cb(), and xua_cli_read_cb().
|
static |
References osmo_ss7_asp::cfg, osmo_ss7_asp::fi, xua_msg::hdr, xua_msg_part::len, LOGPASP, M3UA_ERR_INVAL_NET_APPEAR, M3UA_ERR_PARAM_FIELD_ERR, M3UA_ERR_UNEXPECTED_MSG, M3UA_ERR_UNSUPP_MSG_CLASS, M3UA_IEI_NET_APPEAR, m3ua_rx_snm_asp(), m3ua_rx_snm_sg(), m3ua_xfer_msgt_names, xua_common_hdr::msg_type, OSMO_SS7_ASP_QUIRK_SNM_INACTIVE, OSMO_SS7_ASP_ROLE_ASP, OSMO_SS7_ASP_ROLE_SG, osmo_ss7_asp::quirks, osmo_ss7_asp::role, XUA_ASP_S_ACTIVE, XUA_ASP_S_INACTIVE, xua_msg_find_tag(), and xua_msg_part_get_u32().
Referenced by m3ua_rx_msg().
|
static |
References osmo_ss7_asp::cfg, xua_msg::hdr, LOGPASP, M3UA_ERR_UNSUPP_MSG_TYPE, M3UA_IEI_ROUTE_CTX, M3UA_SNM_DAUD, M3UA_SNM_DAVA, M3UA_SNM_DRST, M3UA_SNM_DUNA, M3UA_SNM_DUPU, M3UA_SNM_SCON, xua_common_hdr::msg_type, OSMO_SS7_ASP_QUIRK_DAUD_IN_ASP, osmo_ss7_asp::quirks, xua_find_as_for_asp(), xua_msg_find_tag(), xua_snm_rx_daud(), xua_snm_rx_dava(), xua_snm_rx_duna(), xua_snm_rx_dupu(), and xua_snm_rx_scon().
Referenced by m3ua_rx_snm().
|
static |
References xua_msg::hdr, M3UA_ERR_UNSUPP_MSG_TYPE, M3UA_SNM_DAUD, xua_common_hdr::msg_type, and xua_snm_rx_daud().
Referenced by m3ua_rx_snm().
|
static |
References osmo_ss7_as::ctrg, data_hdr_from_m3ua(), osmo_mtp_transfer_param::dpc, xua_msg::hdr, osmo_ss7_asp::inst, xua_msg_part::len, LOGPASP, m3ua_dh_to_xfer_param(), M3UA_ERR_INVAL_NET_APPEAR, M3UA_ERR_PARAM_FIELD_ERR, M3UA_ERR_UNSUPP_MSG_TYPE, m3ua_hmdc_rx_from_l2(), M3UA_IEI_NET_APPEAR, M3UA_IEI_ROUTE_CTX, M3UA_XFER_DATA, m3ua_xfer_msgt_names, xua_common_hdr::msg_type, xua_msg::mtp, osmo_mtp_transfer_param::opc, osmo_ss7_pointcode_print(), osmo_ss7_pointcode_print2(), SS7_AS_CTR_RX_MSU_TOTAL, xua_find_as_for_asp(), xua_msg_find_tag(), xua_msg_free_tag(), and xua_msg_part_get_u32().
Referenced by m3ua_rx_msg().
|
static |
References xua_msg::hdr, M3UA_MSGC_XFER, M3UA_PPID, M3UA_VERSION, xua_common_hdr::msg_class, and xua_to_msg().
Referenced by m3ua_tx_xua_as(), and m3ua_tx_xua_asp().
void m3ua_tx_dupu | ( | struct osmo_ss7_asp * | asp, |
const uint32_t * | rctx, | ||
unsigned int | num_rctx, | ||
uint32_t | dpc, | ||
uint16_t | user, | ||
uint16_t | cause, | ||
const char * | info_str | ||
) |
Transmit SSNM DUPU message indicating user unavailability.
[in] | asp | ASP through which to transmit message. Must be ACTIVE. |
[in] | rctx | array of Routing Contexts in network byte order. |
[in] | num_rctx | number of rctx |
[in] | dpc | affected point code |
[in] | user | the user (SI) that is unavailable |
[in] | cause | the cause of the user unavailability |
[in] | info_string | optional information string (can be NULL). |
References dpc, m3ua_encode_dupu(), m3ua_tx_xua_asp(), and xua_msg_free().
Referenced by xua_tx_upu().
void m3ua_tx_snm_available | ( | struct osmo_ss7_asp * | asp, |
const uint32_t * | rctx, | ||
unsigned int | num_rctx, | ||
const uint32_t * | aff_pc, | ||
unsigned int | num_aff_pc, | ||
const char * | info_string, | ||
bool | available | ||
) |
Transmit SSNM DUNA/DAVA message indicating [un]availability of certain point code[s].
[in] | asp | ASP through which to transmit message. Must be ACTIVE. |
[in] | rctx | array of Routing Contexts in network byte order. |
[in] | num_rctx | number of rctx |
[in] | aff_pc | array of 'Affected Point Code' in network byte order. |
[in] | num_aff_pc | number of aff_pc |
[in] | info_string | optional information string (can be NULL). |
[in] | available | are aff_pc now available (true) or unavailable (false) |
References m3ua_encode_dava(), m3ua_encode_duna(), m3ua_tx_xua_asp(), and xua_msg_free().
Referenced by xua_tx_snm_available().
void m3ua_tx_snm_congestion | ( | struct osmo_ss7_asp * | asp, |
const uint32_t * | rctx, | ||
unsigned int | num_rctx, | ||
const uint32_t * | aff_pc, | ||
unsigned int | num_aff_pc, | ||
const uint32_t * | concerned_dpc, | ||
const uint8_t * | cong_level, | ||
const char * | info_string | ||
) |
Transmit SSNM SCON message indicating congestion.
[in] | asp | ASP through which to transmit message. Must be ACTIVE. |
[in] | rctx | array of Routing Contexts in network byte order. |
[in] | num_rctx | number of rctx |
[in] | aff_pc | array of 'Affected Point Code' in network byte order. |
[in] | num_aff_pc | number of aff_pc |
[in] | concerned_dpc | optional concerned DPC (can be NULL) |
[in] | cong_level | optional congestion level (can be NULL) |
[in] | info_string | optional information string (can be NULL). |
References xua_msg::hdr, M3UA_IEI_AFFECTED_PC, M3UA_IEI_CONC_DEST, M3UA_IEI_CONG_IND, M3UA_IEI_INFO_STRING, M3UA_IEI_ROUTE_CTX, M3UA_MSGC_SNM, M3UA_SNM_SCON, m3ua_tx_xua_asp(), M3UA_VERSION, xua_common_hdr::version, XUA_HDR, xua_msg_add_data(), xua_msg_add_u32(), xua_msg_alloc(), and xua_msg_free().
Referenced by xua_tx_scon().
int m3ua_tx_xua_as | ( | struct osmo_ss7_as * | as, |
struct xua_msg * | xua | ||
) |
Send a given xUA message via a given M3UA Application Server.
[in] | as | Application Server through which to send xua |
[in] | xua | xUA message to be sent |
References osmo_ss7_as::cfg, osmo_ss7_routing_key::context, osmo_ss7_as::fi, M3UA_IEI_ROUTE_CTX, m3ua_to_msg(), OSMO_SS7_ASP_PROT_M3UA, osmo_ss7_as::proto, osmo_ss7_as::routing_key, XUA_AS_E_TRANSFER_REQ, and xua_msg_add_u32().
Referenced by hmrt_message_for_routing().
|
static |
References osmo_ss7_asp::cfg, m3ua_to_msg(), OSMO_SS7_ASP_PROT_M3UA, osmo_ss7_asp_send(), and osmo_ss7_asp::proto.
Referenced by m3ua_rx_msg(), m3ua_tx_dupu(), m3ua_tx_snm_available(), and m3ua_tx_snm_congestion().
struct xua_msg * m3ua_xfer_from_data | ( | const struct m3ua_data_hdr * | data_hdr, |
const uint8_t * | data, | ||
unsigned int | data_len | ||
) |
References xua_msg_part::dat, data, xua_msg_part::entry, xua_msg::hdr, xua_msg::headers, xua_msg_part::len, M3UA_IEI_PROT_DATA, M3UA_MSGC_XFER, M3UA_XFER_DATA, xua_msg_part::tag, XUA_HDR, and xua_msg_alloc().
Referenced by ipa_rx_msg_sccp(), and mtp_prim_to_m3ua().
void mtp_xfer_param_to_m3ua_dh | ( | struct m3ua_data_hdr * | mdh, |
const struct osmo_mtp_transfer_param * | param | ||
) |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
const struct value_string m3ua_asptm_msgt_names[] |
|
static |
Referenced by m3ua_rx_asp().
const struct value_string m3ua_err_names[] |
Referenced by m3ua_rx_mgmt_err(), peer_send_error(), and sua_rx_mgmt_err().
|
static |
|
static |
const struct xua_msg_class m3ua_msg_class_aspsm |
const struct xua_msg_class m3ua_msg_class_asptm |
const struct xua_msg_class m3ua_msg_class_mgmt |
const struct xua_msg_class m3ua_msg_class_rkm |
const struct xua_msg_class m3ua_msg_class_snm |
const struct value_string m3ua_ntfy_other_names[] |
Referenced by m3ua_rx_mgmt_ntfy(), and sua_rx_mgmt_ntfy().
const struct value_string m3ua_ntfy_stchg_names[] |
Referenced by m3ua_rx_mgmt_ntfy(), and sua_rx_mgmt_ntfy().
const struct value_string m3ua_ntfy_type_names[] |
Referenced by m3ua_rx_mgmt_ntfy(), and sua_rx_mgmt_ntfy().
|
static |
|
static |
|
static |
Referenced by m3ua_rx_snm(), and m3ua_rx_xfer().
|
static |
|
static |
|
static |
|
static |
|
static |
const struct xua_dialect xua_dialect_m3ua |
Referenced by m3ua_rx_mgmt_err(), and m3ua_rx_msg().