libosmo-sigtran 2.0.0.50-b59d
Osmocom SIGTRAN library
|
#include "xua_msg.h"
#include <osmocom/sigtran/protocol/sua.h>
#include <osmocom/sigtran/sccp_sap.h>
#include <osmocom/core/utils.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/logging.h>
#include <osmocom/core/talloc.h>
#include <arpa/inet.h>
#include <string.h>
#include <errno.h>
Functions | |
void | osmo_xua_msg_tall_ctx_init (void *ctx) |
struct xua_msg * | xua_msg_alloc (void) |
void | xua_msg_free (struct xua_msg *msg) |
int | xua_msg_add_data (struct xua_msg *msg, uint16_t tag, uint16_t len, const uint8_t *dat) |
struct xua_msg_part * | xua_msg_find_tag (const struct xua_msg *xua, uint16_t tag) |
int | xua_msg_free_tag (struct xua_msg *xua, uint16_t tag) |
int | xua_msg_copy_part (struct xua_msg *xua_out, uint16_t tag_out, const struct xua_msg *xua_in, uint16_t tag_in) |
static int | xua_from_msg_common (struct xua_msg *msg, const uint8_t *data, uint16_t pos, uint16_t len) |
struct xua_msg * | xua_from_msg (const int version, uint16_t len, uint8_t *data) |
struct xua_msg * | xua_from_nested (struct xua_msg_part *outer) |
struct msgb * | xua_to_msg (const int version, struct xua_msg *xua) |
int | msgb_t16l16vp_put (struct msgb *msg, uint16_t tag, uint16_t len, const uint8_t *data) |
int | msgb_t16l16vp_put_u32 (struct msgb *msg, uint16_t tag, uint32_t val) |
int | xua_msg_add_u32 (struct xua_msg *xua, uint16_t iei, uint32_t val) |
uint32_t | xua_msg_part_get_u32 (const struct xua_msg_part *part) |
uint32_t | xua_msg_get_u32 (const struct xua_msg *xua, uint16_t iei) |
const uint32_t * | xua_msg_get_u32p (const struct xua_msg *xua, uint16_t iei, uint32_t *out) |
const char * | xua_msg_part_get_str (const struct xua_msg_part *part) |
const char * | xua_msg_get_str (const struct xua_msg *xua, uint16_t iei) |
int | xua_msg_get_len (const struct xua_msg *xua, uint16_t iei) |
void | xua_part_add_gt (struct msgb *msg, const struct osmo_sccp_gt *gt) |
int | xua_msg_add_sccp_addr (struct xua_msg *xua, uint16_t iei, const struct osmo_sccp_addr *addr) |
int | xua_msg_event_map (const struct xua_msg *xua, const struct xua_msg_event_map *maps, unsigned int num_maps) |
Map from a xua_msg (class+type) to an event. More... | |
const char * | xua_class_msg_name (const struct xua_msg_class *xmc, uint16_t msg_type) |
const char * | xua_class_iei_name (const struct xua_msg_class *xmc, uint16_t iei) |
char * | xua_hdr_dump (struct xua_msg *xua, const struct xua_dialect *dialect) |
int | xua_dialect_check_all_mand_ies (const struct xua_dialect *dialect, struct xua_msg *xua) |
char * | xua_msg_dump (struct xua_msg *xua, const struct xua_dialect *dialect) |
Variables | |
static void * | tall_xua = NULL |
int msgb_t16l16vp_put | ( | struct msgb * | msg, |
uint16_t | tag, | ||
uint16_t | len, | ||
const uint8_t * | data | ||
) |
References data, len, and tag.
Referenced by msgb_t16l16vp_put_u32(), and xua_msg_add_sccp_addr().
int msgb_t16l16vp_put_u32 | ( | struct msgb * | msg, |
uint16_t | tag, | ||
uint32_t | val | ||
) |
References msgb_t16l16vp_put(), and tag.
Referenced by msgb_append_dereg_res(), msgb_append_reg_res(), xua_msg_add_sccp_addr(), xua_rkm_send_dereg_req(), and xua_rkm_send_reg_req().
void osmo_xua_msg_tall_ctx_init | ( | void * | ctx | ) |
References tall_xua.
const char * xua_class_iei_name | ( | const struct xua_msg_class * | xmc, |
uint16_t | iei | ||
) |
References xua_msg_class::iei_names.
Referenced by xua_dialect_check_all_mand_ies(), and xua_msg_dump().
const char * xua_class_msg_name | ( | const struct xua_msg_class * | xmc, |
uint16_t | msg_type | ||
) |
References msg_type, and xua_msg_class::msgt_names.
Referenced by xua_dialect_check_all_mand_ies(), xua_hdr_dump(), and xua_opt_data_send_cache().
int xua_dialect_check_all_mand_ies | ( | const struct xua_dialect * | dialect, |
struct xua_msg * | xua | ||
) |
References xua_dialect::class, xua_msg::hdr, xua_dialect::log_subsys, xua_msg_class::mand_ies, msg_class, xua_common_hdr::msg_class, msg_type, xua_common_hdr::msg_type, xua_msg_class::name, xua_dialect::name, xua_class_iei_name(), xua_class_msg_name(), and xua_msg_find_tag().
Referenced by m3ua_rx_msg(), and sua_rx_msg().
struct xua_msg * xua_from_msg | ( | const int | version, |
uint16_t | len, | ||
uint8_t * | data | ||
) |
References data, xua_msg::hdr, len, xua_common_hdr::msg_length, version, xua_common_hdr::version, xua_from_msg_common(), xua_msg_alloc(), and xua_msg_free().
Referenced by m3ua_gen_error_msg(), m3ua_rx_msg(), and sua_rx_msg().
|
static |
References data, xua_parameter_hdr::data, len, xua_parameter_hdr::len, xua_parameter_hdr::tag, and xua_msg_add_data().
Referenced by xua_from_msg(), and xua_from_nested().
struct xua_msg * xua_from_nested | ( | struct xua_msg_part * | outer | ) |
References xua_msg_part::dat, xua_msg_part::len, xua_from_msg_common(), xua_msg_alloc(), and xua_msg_free().
Referenced by m3ua_rx_rkm_dereg_rsp(), m3ua_rx_rkm_reg_req(), and m3ua_rx_rkm_reg_rsp().
char * xua_hdr_dump | ( | struct xua_msg * | xua, |
const struct xua_dialect * | dialect | ||
) |
References xua_dialect::class, xua_msg::hdr, xua_common_hdr::msg_class, xua_common_hdr::msg_type, xua_msg_class::name, and xua_class_msg_name().
Referenced by m3ua_rx_msg(), osmo_sua_to_sccp(), sccp_find_user(), sccp_sclc_rx_from_scrc(), sccp_scoc_rx_from_scrc(), sccp_scoc_rx_inval_opc(), sccp_scoc_rx_inval_src_ref(), sccp_scoc_rx_scrc_rout_fail(), sccp_scoc_rx_unass_local_ref(), sua_rx_msg(), and xua_msg_dump().
int xua_msg_add_data | ( | struct xua_msg * | msg, |
uint16_t | tag, | ||
uint16_t | len, | ||
const uint8_t * | dat | ||
) |
References xua_msg_part::dat, xua_msg_part::entry, xua_msg::headers, xua_msg_part::len, len, xua_msg_part::tag, and tag.
Referenced by m3ua_encode_duna(), m3ua_encode_dupu(), m3ua_encode_notify(), m3ua_gen_error_msg(), m3ua_tx_snm_congestion(), sccp_data_to_sua_ptr(), sccp_longdata_to_sua_ptr(), sua_encode_duna(), sua_encode_dupu(), sua_gen_error_msg(), sua_tx_snm_congestion(), xua_from_msg_common(), xua_gen_msg_cl(), xua_gen_msg_co(), xua_gen_relre(), xua_msg_add_asp_rctx(), xua_msg_add_sccp_addr(), xua_msg_add_sccp_opt(), xua_msg_add_u32(), and xua_msg_copy_part().
int xua_msg_add_sccp_addr | ( | struct xua_msg * | xua, |
uint16_t | iei, | ||
const struct osmo_sccp_addr * | addr | ||
) |
References osmo_sccp_addr::gt, osmo_sccp_addr::ip, msgb_t16l16vp_put(), msgb_t16l16vp_put_u32(), OSMO_SCCP_ADDR_T_GT, OSMO_SCCP_ADDR_T_IPv4, OSMO_SCCP_ADDR_T_IPv6, OSMO_SCCP_ADDR_T_PC, OSMO_SCCP_ADDR_T_SSN, OSMO_SCCP_RI_GT, OSMO_SCCP_RI_SSN_IP, OSMO_SCCP_RI_SSN_PC, osmo_sccp_addr::pc, osmo_sccp_addr::presence, osmo_sccp_addr::ri, osmo_sccp_addr::ssn, SUA_IEI_IPv4, SUA_IEI_IPv6, SUA_IEI_PC, SUA_IEI_SSN, SUA_RI_GT, SUA_RI_SSN_IP, SUA_RI_SSN_PC, osmo_sccp_addr::v4, osmo_sccp_addr::v6, xua_msg_add_data(), and xua_part_add_gt().
Referenced by ensure_opc_in_calling_ssn(), gen_ret_msg(), patch_sccp_with_pc(), sccp_addr_to_sua(), xua_gen_msg_cl(), and xua_gen_msg_co().
int xua_msg_add_u32 | ( | struct xua_msg * | xua, |
uint16_t | iei, | ||
uint32_t | val | ||
) |
References xua_msg_add_data().
Referenced by gen_coerr(), gen_coref_without_conn(), gen_relco(), gen_ret_msg(), gen_rlsd(), m3ua_encode_dupu(), m3ua_encode_notify(), m3ua_gen_error(), m3ua_tx_snm_congestion(), m3ua_tx_xua_as(), peer_send(), peer_send_error(), sccp_to_xua_cc(), sccp_to_xua_cr(), sccp_to_xua_cref(), sccp_to_xua_dt1(), sccp_to_xua_err(), sccp_to_xua_it(), sccp_to_xua_ludt(), sccp_to_xua_ludts(), sccp_to_xua_rlc(), sccp_to_xua_rlsd(), sccp_to_xua_udt(), sccp_to_xua_udts(), sccp_to_xua_xudt(), sccp_to_xua_xudts(), scoc_fsm_active(), sua_encode_duna(), sua_encode_dupu(), sua_gen_error(), sua_tx_snm_congestion(), sua_tx_xua_as(), xua_gen_msg_cl(), xua_gen_msg_co(), xua_gen_relre(), and xua_msg_add_sccp_opt().
struct xua_msg * xua_msg_alloc | ( | void | ) |
References xua_msg::headers, and tall_xua.
Referenced by gen_coerr(), gen_coref_without_conn(), gen_relco(), gen_ret_msg(), gen_rlsd(), m3ua_encode_duna(), m3ua_encode_dupu(), m3ua_encode_notify(), m3ua_gen_error(), m3ua_tx_snm_congestion(), m3ua_xfer_from_data(), osmo_sccp_to_xua(), peer_send(), peer_send_error(), scoc_fsm_active(), sua_encode_duna(), sua_encode_dupu(), sua_gen_error(), sua_tx_snm_congestion(), xua_from_msg(), xua_from_nested(), xua_gen_msg_cl(), xua_gen_msg_co(), and xua_gen_relre().
int xua_msg_copy_part | ( | struct xua_msg * | xua_out, |
uint16_t | tag_out, | ||
const struct xua_msg * | xua_in, | ||
uint16_t | tag_in | ||
) |
References xua_msg_part::dat, xua_msg_part::len, xua_msg_add_data(), and xua_msg_find_tag().
Referenced by gen_coref_without_conn(), gen_ret_msg(), and peer_send().
char * xua_msg_dump | ( | struct xua_msg * | xua, |
const struct xua_dialect * | dialect | ||
) |
References xua_dialect::class, xua_msg_part::dat, xua_msg::hdr, xua_msg::headers, xua_msg_part::len, xua_common_hdr::msg_class, xua_common_hdr::msg_length, xua_msg_part::tag, xua_common_hdr::version, xua_class_iei_name(), and xua_hdr_dump().
Referenced by m3ua_rx_mgmt_err(), sccp_scrc_rx_sclc_msg(), sccp_scrc_rx_scoc_conn_msg(), scrc_rx_mtp_xfer_ind_xua(), and sua_rx_mgmt_err().
int xua_msg_event_map | ( | const struct xua_msg * | xua, |
const struct xua_msg_event_map * | maps, | ||
unsigned int | num_maps | ||
) |
Map from a xua_msg (class+type) to an event.
[in] | xua | xUA message which is to be mapped |
[in] | maps | Table containing msg type+class -> event maps [aram[in] num_maps number of entries in maps |
References xua_msg_event_map::event, xua_msg::hdr, xua_msg_event_map::msg_class, xua_common_hdr::msg_class, xua_msg_event_map::msg_type, and xua_common_hdr::msg_type.
Referenced by m3ua_rx_asp(), sccp_scoc_rx_from_scrc(), and sua_rx_asp().
struct xua_msg_part * xua_msg_find_tag | ( | const struct xua_msg * | xua, |
uint16_t | tag | ||
) |
References xua_msg_part::entry, xua_msg::headers, xua_msg_part::tag, and tag.
Referenced by data_hdr_from_m3ua(), handle_rkey_dereg_resp(), handle_rkey_reg(), handle_rkey_reg_resp(), ipa_tx_xua_as(), m3ua_decode_notify(), m3ua_gen_error_msg(), m3ua_rx_rkm_dereg_req(), m3ua_rx_snm(), m3ua_rx_snm_asp(), m3ua_rx_xfer(), m3ua_to_xfer_ind(), sccp_add_long_variable_part(), sccp_add_var_addr(), sccp_add_variable_part(), sccp_scoc_rx_from_scrc(), sclc_rx_cldr(), sclc_rx_cldt(), scrc_rx_mtp_xfer_ind_xua(), scu_gen_encode_and_send(), sua_addr_parse(), sua_rx_cl(), sua_rx_co(), sua_rx_snm_asp(), sua_to_sccp_udt(), sua_to_sccp_udts(), xua_asp_fsm_down(), xua_asp_fsm_inactive(), xua_dialect_check_all_mand_ies(), xua_msg_copy_part(), xua_msg_get_len(), xua_msg_get_str(), xua_msg_get_u32(), xua_msg_get_u32p(), xua_snm_rx_daud(), xua_snm_rx_dava(), xua_snm_rx_duna(), and xua_snm_rx_scon().
void xua_msg_free | ( | struct xua_msg * | msg | ) |
Referenced by encode_notify(), ipa_rx_msg_sccp(), m3ua_gen_error_msg(), m3ua_rx_msg(), m3ua_rx_rkm_dereg_rsp(), m3ua_rx_rkm_reg_req(), m3ua_rx_rkm_reg_rsp(), m3ua_tx_dupu(), m3ua_tx_snm_available(), m3ua_tx_snm_congestion(), mtp_user_prim_cb(), osmo_sccp_to_xua(), osmo_ss7_user_mtp_xfer_req(), patch_sccp_with_pc(), peer_send(), peer_send_error(), sccp_sclc_rx_scrc_rout_fail(), sccp_scoc_rx_scrc_rout_fail(), sua_rx_msg(), tx_coerr_from_xua(), tx_relco_from_xua(), tx_rlsd_from_xua_twoway(), xua_from_msg(), xua_from_nested(), xua_gen_encode_and_send(), xua_gen_msg_cl(), xua_gen_msg_co(), and xua_gen_relre_and_send().
int xua_msg_free_tag | ( | struct xua_msg * | xua, |
uint16_t | tag | ||
) |
References xua_msg_part::entry, xua_msg::headers, xua_msg_part::tag, and tag.
Referenced by ensure_opc_in_calling_ssn(), gen_ret_msg(), m3ua_rx_xfer(), and patch_sccp_with_pc().
int xua_msg_get_len | ( | const struct xua_msg * | xua, |
uint16_t | iei | ||
) |
References xua_msg_part::len, and xua_msg_find_tag().
Referenced by sua_to_sccp_udt(), sua_to_sccp_udts(), and sua_to_sccp_xudt().
const char * xua_msg_get_str | ( | const struct xua_msg * | xua, |
uint16_t | iei | ||
) |
References xua_msg_find_tag(), and xua_msg_part_get_str().
Referenced by xua_snm_rx_daud(), xua_snm_rx_dava(), xua_snm_rx_duna(), xua_snm_rx_dupu(), and xua_snm_rx_scon().
uint32_t xua_msg_get_u32 | ( | const struct xua_msg * | xua, |
uint16_t | iei | ||
) |
References xua_msg_find_tag(), and xua_msg_part_get_u32().
Referenced by handle_rkey_dereg_resp(), handle_rkey_reg(), handle_rkey_reg_resp(), m3ua_rx_mgmt_err(), sccp_scoc_rx_from_scrc(), sccp_scoc_rx_scrc_rout_fail(), sclc_rx_cldr(), sclc_rx_cldt(), scoc_fsm_active(), scoc_fsm_conn_pend_out(), scoc_fsm_idle(), scoc_fsm_wait_conn_conf(), scrc_rx_mtp_xfer_ind_xua(), scu_gen_encode_and_send(), store_local_ref(), sua_rx_mgmt_err(), sua_to_sccp_cc(), sua_to_sccp_cr(), sua_to_sccp_cref(), sua_to_sccp_dt1(), sua_to_sccp_err(), sua_to_sccp_it(), sua_to_sccp_ludt(), sua_to_sccp_ludts(), sua_to_sccp_rlsd(), sua_to_sccp_udt(), sua_to_sccp_udts(), sua_to_sccp_xudt(), sua_to_sccp_xudts(), tx_coerr_from_xua(), tx_relco_from_xua(), tx_rlsd_from_xua_twoway(), xua_asp_fsm_inactive(), and xua_snm_rx_dupu().
const uint32_t * xua_msg_get_u32p | ( | const struct xua_msg * | xua, |
uint16_t | iei, | ||
uint32_t * | out | ||
) |
References xua_msg_find_tag(), and xua_msg_part_get_u32().
Referenced by xua_snm_rx_dava(), xua_snm_rx_duna(), and xua_snm_rx_scon().
const char * xua_msg_part_get_str | ( | const struct xua_msg_part * | part | ) |
References xua_msg_part::dat, and xua_msg_part::len.
Referenced by xua_msg_get_str().
uint32_t xua_msg_part_get_u32 | ( | const struct xua_msg_part * | part | ) |
void xua_part_add_gt | ( | struct msgb * | msg, |
const struct osmo_sccp_gt * | gt | ||
) |
References osmo_sccp_gt::digits, osmo_sccp_gt::gti, osmo_sccp_gt::nai, osmo_sccp_gt::npi, SUA_IEI_GT, and osmo_sccp_gt::tt.
Referenced by xua_msg_add_sccp_addr().
struct msgb * xua_to_msg | ( | const int | version, |
struct xua_msg * | xua | ||
) |
References xua_msg_part::dat, xua_msg::hdr, xua_msg::headers, xua_msg_part::len, xua_common_hdr::msg_length, xua_common_hdr::spare, xua_msg_part::tag, version, and xua_common_hdr::version.
Referenced by encode_notify(), m3ua_to_msg(), peer_send(), peer_send_error(), and sua_to_msg().
|
static |
Referenced by osmo_xua_msg_tall_ctx_init(), and xua_msg_alloc().