libosmo-sigtran 2.1.0.194-89e3 Osmocom SIGTRAN library

Functions | Variables
xua_msg.c File Reference
`#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)
struct xua_msg * | xua_msg_copy (const struct xua_msg *xua_in)
int | xua_msg_add_data (struct xua_msg *msg, uint16_t tag, uint16_t len, const uint8_t *dat)
int | xua_msg_add_u32_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 (const 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 (const struct xua_msg *xua, const struct xua_dialect *dialect)

## Variables
static void * | tall_xua = NULL

## Function Documentation

## ◆ msgb_t16l16vp_put()

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().

## ◆ msgb_t16l16vp_put_u32()

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().

## ◆ osmo_xua_msg_tall_ctx_init()

void osmo_xua_msg_tall_ctx_init | ( | void * | ctx | ) |

References tall_xua.

## ◆ xua_class_iei_name()

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().

## ◆ xua_class_msg_name()

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 sccp_conn_opt_data_send_cache(), xua_dialect_check_all_mand_ies(), and xua_hdr_dump().

## ◆ xua_dialect_check_all_mand_ies()

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().

## ◆ xua_from_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, NULL, 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().

## ◆ xua_from_msg_common()

static int xua_from_msg_common | ( | struct xua_msg * | msg,
|  | const uint8_t * | data,
|  | uint16_t | pos,
|  | uint16_t | len
| ) |  |
| 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().

## ◆ xua_from_nested()

struct xua_msg * xua_from_nested | ( | struct xua_msg_part * | outer | ) |

References xua_msg_part::dat, xua_msg_part::len, NULL, 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().

## ◆ xua_hdr_dump()

char * xua_hdr_dump | ( | const 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, NULL, and xua_class_msg_name().

Referenced by ensure_opc_in_calling_ssn(), m3ua_rx_msg(), m3ua_rx_xfer(), osmo_sua_to_sccp(), sccp_conn_scu_gen_encode_and_send(), sccp_find_user(), sccp_rout_fail_enqueue(), sccp_sclc_rx_from_scrc(), sccp_sclc_rx_scrc_rout_fail(), 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(), sccp_scrc_rx_sclc_msg(), sccp_scrc_rx_scoc_conn_msg(), sclc_rx_cldr(), sclc_rx_cldt(), scoc_fsm_idle(), scrc_node_2(), scrc_rx_mtp_xfer_ind_xua(), sua_rx_msg(), and xua_msg_dump().

## ◆ xua_msg_add_data()

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(), xua_msg_copy(), and xua_msg_copy_part().

## ◆ xua_msg_add_sccp_addr()

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().

## ◆ xua_msg_add_u32()

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().

## ◆ xua_msg_add_u32_data()

int xua_msg_add_u32_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_notify().

## ◆ xua_msg_alloc()

struct xua_msg * xua_msg_alloc | ( | void |  | ) |

References xua_msg::headers, NULL, 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(), xua_gen_relre(), and xua_msg_copy().

## ◆ xua_msg_copy()

struct xua_msg * xua_msg_copy | ( | const struct xua_msg * | xua_in | ) |

References xua_msg_part::dat, xua_msg::entry, xua_msg::hdr, xua_msg::headers, xua_msg_part::len, xua_msg::mtp, NULL, xua_msg_part::tag, xua_msg_add_data(), and xua_msg_alloc().

Referenced by sccp_rout_fail_enqueue().

## ◆ xua_msg_copy_part()

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().

## ◆ xua_msg_dump()

char * xua_msg_dump | ( | const 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, NULL, 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().

## ◆ xua_msg_event_map()

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.

Parameters

  [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

Returns
  event >= 0; negative on error (no map found)

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().

## ◆ xua_msg_find_tag()

struct xua_msg_part * xua_msg_find_tag | ( | const struct xua_msg * | xua,
|  | uint16_t | tag
| ) |  |

References xua_msg_part::entry, xua_msg::headers, NULL, xua_msg_part::tag, and tag.

Referenced by data_hdr_from_m3ua(), handle_rkey_dereg_resp(), handle_rkey_reg(), handle_rkey_reg_resp(), ipa_to_msg(), m3ua_decode_notify(), m3ua_gen_error_msg(), m3ua_rx_rkm_dereg_req(), m3ua_rx_snm(), m3ua_rx_snm_asp(), m3ua_rx_snm_sg(), m3ua_rx_xfer(), m3ua_to_xfer_ind(), sccp_add_long_variable_part(), sccp_add_var_addr(), sccp_add_variable_part(), sccp_conn_scu_gen_encode_and_send(), sccp_scoc_rx_from_scrc(), sclc_rx_cldr(), sclc_rx_cldt(), scrc_rx_mtp_xfer_ind_xua(), 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().

## ◆ xua_msg_free()

void xua_msg_free | ( | struct xua_msg * | msg | ) |

Referenced by deliver_to_mtp_user(), encode_notify(), hmdt_message_for_distribution(), hmrt_message_for_routing(), m3ua_gen_error_msg(), m3ua_rx_asp(), m3ua_rx_mgmt(), m3ua_rx_msg(), m3ua_rx_rkm(), m3ua_rx_rkm_dereg_rsp(), m3ua_rx_rkm_reg_req(), m3ua_rx_rkm_reg_rsp(), m3ua_rx_snm(), m3ua_rx_xfer(), m3ua_tx_xua_as(), m3ua_tx_xua_asp(), mtp_user_prim_cb(), osmo_sccp_to_xua(), patch_sccp_with_pc(), peer_send(), peer_send_error(), rout_fail_pending_cb(), sccp_conn_xua_gen_encode_and_send(), sccp_conn_xua_gen_relre_and_send(), sccp_sclc_rx_scrc_rout_fail(), sccp_scoc_rx_scrc_rout_fail(), scoc_fsm_active(), sua_rx_msg(), sua_tx_xua_as(), sua_tx_xua_asp(), tx_coerr_from_xua(), tx_relco_from_xua(), tx_rlsd_from_xua_twoway(), xua_as_fsm_pending(), xua_as_transmit_msg(), xua_as_transmit_msg_broadcast(), xua_from_msg(), xua_from_nested(), xua_gen_encode_and_send(), xua_gen_msg_cl(), and xua_gen_msg_co().

## ◆ xua_msg_free_tag()

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().

## ◆ xua_msg_get_len()

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().

## ◆ xua_msg_get_str()

const char * xua_msg_get_str | ( | const struct xua_msg * | xua,
|  | uint16_t | iei
| ) |  |

References NULL, 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().

## ◆ xua_msg_get_u32()

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_conn_scu_gen_encode_and_send(), 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(), 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().

## ◆ xua_msg_get_u32p()

const uint32_t * xua_msg_get_u32p | ( | const struct xua_msg * | xua,
|  | uint16_t | iei,
|  | uint32_t * | out
| ) |  |

References NULL, 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().

## ◆ xua_msg_part_get_str()

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().

## ◆ xua_msg_part_get_u32()

uint32_t xua_msg_part_get_u32 | ( | const struct xua_msg_part * | part | ) |

References xua_msg_part::dat, and xua_msg_part::len.

Referenced by m3ua_decode_notify(), m3ua_rx_snm(), m3ua_rx_xfer(), sccp_msg_add_sua_opt(), scrc_rx_mtp_xfer_ind_xua(), xua_asp_fsm_down(), xua_find_as_for_asp(), xua_msg_get_u32(), xua_msg_get_u32p(), xua_snm_rx_dava(), and xua_snm_rx_duna().

## ◆ xua_part_add_gt()

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().

## ◆ xua_to_msg()

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, NULL, 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().

## Variable Documentation

## ◆ tall_xua

void* tall_xua = NULL
| static

Referenced by osmo_xua_msg_tall_ctx_init(), and xua_msg_alloc().