libosmo-sigtran 2.2.1 Osmocom SIGTRAN library

Macros | Functions | Variables
sccp2sua.c File Reference
`#include <stdbool.h>`
`#include <string.h>`
`#include <errno.h>`
`#include <inttypes.h>`
`#include <osmocom/sccp/sccp_types.h>`
`#include <osmocom/core/linuxlist.h>`
`#include <osmocom/core/logging.h>`
`#include <osmocom/sigtran/sccp_sap.h>`
`#include <osmocom/sigtran/sccp_helpers.h>`
`#include <osmocom/sigtran/protocol/sua.h>`
`#include "xua_msg.h"`
`#include "xua_internal.h"`
`#include "sccp_internal.h"`

## Macros
#define | MAX_IES 6
#define | NUM_SCCP_MSGT (SCCP_MSG_TYPE_LUDTS+1)

## Functions
static void | msgb_put_u24be (struct msgb *msg, uint32_t val)
static void | msgb_put_u16le (struct msgb *msg, uint16_t val)
static uint32_t | load_24be (const void *ptr)
| load a 24bit value as big-endian More...
int | osmo_isup_party_parse (char *out_digits, const uint8_t *in, unsigned int in_num_bytes, bool odd)
| Parse ISUP style address of BCD digets. More...
int | osmo_isup_party_encode (struct msgb *msg, const char *in_digits)
| Encode an ISUP style address of BCD digits. More...
int | osmo_sccp_addr_parse (struct osmo_sccp_addr *out, const uint8_t *addr, unsigned int addrlen)
| Parse wire-encoded SCCP address into osmo_sccp_addr. More...
int | osmo_sccp_addr_encode (struct msgb *msg, const struct osmo_sccp_addr *in)
| encode a SCCP address from parsed format to wire format More...
static int | sccp_addr_to_sua (struct xua_msg *xua, uint16_t iei, const uint8_t *addr, unsigned int addrlen)
| convert SCCP address to SUA address More...
static int | sccp_addr_to_sua_ptr (struct xua_msg *xua, uint16_t iei, const uint8_t *ptr_addr, bool ptr_addr_is_long)
| convenience wrapper around sccp_addr_to_sua() for variable mandatory addresses More...
static int | sua_addr_to_sccp (struct msgb *msg, const struct xua_msg_part *part)
| convert SUA address to SCCP address More...
static int | sccp_add_var_addr (struct msgb *msg, uint8_t *var_ptr, bool var_ptr_is_long, const struct xua_msg *xua, uint16_t iei)
| Add a "SCCP Variable Mandatory Part" (Address format) to the given msgb. More...
static int | sccp_add_variable_part (struct msgb *msg, uint8_t *var_ptr, const struct xua_msg *xua, uint16_t iei)
| Add a "SCCP Variable Mandatory Part" to the given msgb. More...
static int | sccp_add_long_variable_part (struct msgb *msg, uint8_t *var_ptr, const struct xua_msg *xua, uint16_t iei)
| Add a "SCCP Long Variable Mandatory Part" to the given msgb. More...
static bool | sccp_ptr_part_consistent (const struct msgb *msg, const uint8_t *ptr_addr)
| validate that SCCP part with pointer + length doesn't exceed msg tail More...
static bool | sccp_longptr_part_consistent (const struct msgb *msg, const uint8_t *ptr_addr, bool len_is_long)
| validate that SCCP part with long pointer (2 bytes) + length doesn't exceed msg tail More...
static int | sccp_data_to_sua_ptr (struct xua_msg *xua, uint16_t iei, const uint8_t *ptr_addr)
| convenience wrapper around xua_msg_add_data() for variable mandatory data More...
static int | sccp_longdata_to_sua_ptr (struct xua_msg *xua, uint16_t iei, const uint8_t *ptr_addr)
| convenience wrapper around xua_msg_add_data() for variable mandatory data More...
static int | xua_msg_add_sccp_opt (struct xua_msg *xua, uint8_t sccp_opt_type, uint16_t opt_len, const uint8_t *opt)
| Convert a given SCCP option to SUA and add it to given xua_msg. More...
static void | msgb_put_sccp_opt_hdr (struct msgb *msg, uint8_t pnc, uint8_t len)
| append a SCCP option header to the given message More...
static void | msgb_put_sccp_opt (struct msgb *msg, uint8_t pnc, uint8_t len, const uint8_t *data)
| append a SCCP option to the given message More...
static int | sccp_msg_add_sua_opt (enum sccp_message_types type, struct msgb *msg, const struct xua_msg_part *opt)
| Convert a given SUA option/IE to SCCP and add it to given * msgb. More...
static struct xua_msg * | sccp_to_xua_opt (const struct msgb *msg, const uint8_t *ptr_opt, bool ptr_opt_is_long, struct xua_msg *xua)
| convert SCCP optional part to list of SUA options More...
static bool | sccp_is_mandatory (enum sccp_message_types type, const struct xua_msg_part *part)
static bool | sccp_option_permitted (enum sccp_message_types type, const struct xua_msg_part *part)
static int | xua_ies_to_sccp_opts (struct msgb *msg, uint8_t *ptr_opt, bool ptr_opt_is_long, enum sccp_message_types type, const struct xua_msg *xua)
static int | store_local_ref (struct sccp_source_reference *local_ref, const struct xua_msg *xua, uint16_t iei)
static struct xua_msg * | sccp_to_xua_cr (const struct msgb *msg, struct xua_msg *xua)
static int | sua_to_sccp_cr (struct msgb *msg, const struct xua_msg *xua)
static struct xua_msg * | sccp_to_xua_cc (const struct msgb *msg, struct xua_msg *xua)
static int | sua_to_sccp_cc (struct msgb *msg, const struct xua_msg *xua)
static struct xua_msg * | sccp_to_xua_cref (const struct msgb *msg, struct xua_msg *xua)
static int | sua_to_sccp_cref (struct msgb *msg, const struct xua_msg *xua)
static struct xua_msg * | sccp_to_xua_rlsd (const struct msgb *msg, struct xua_msg *xua)
static int | sua_to_sccp_rlsd (struct msgb *msg, const struct xua_msg *xua)
static struct xua_msg * | sccp_to_xua_rlc (const struct msgb *msg, struct xua_msg *xua)
static int | sua_to_sccp_rlc (struct msgb *msg, const struct xua_msg *xua)
static struct xua_msg * | sccp_to_xua_dt1 (const struct msgb *msg, struct xua_msg *xua)
static int | sua_to_sccp_dt1 (struct msgb *msg, const struct xua_msg *xua)
static struct xua_msg * | sccp_to_xua_udt (const struct msgb *msg, struct xua_msg *xua)
static int | sua_to_sccp_xudt (struct msgb *msg, const struct xua_msg *xua)
static int | sua_to_sccp_ludt (struct msgb *msg, const struct xua_msg *xua)
static int | sua_to_sccp_udt (struct msgb *msg, const struct xua_msg *xua)
static struct xua_msg * | sccp_to_xua_xudt (const struct msgb *msg, struct xua_msg *xua)
static struct xua_msg * | sccp_to_xua_ludt (const struct msgb *msg, struct xua_msg *xua)
static struct xua_msg * | sccp_to_xua_udts (const struct msgb *msg, struct xua_msg *xua)
static int | sua_to_sccp_xudts (struct msgb *msg, const struct xua_msg *xua)
static int | sua_to_sccp_ludts (struct msgb *msg, const struct xua_msg *xua)
static int | sua_to_sccp_udts (struct msgb *msg, const struct xua_msg *xua)
static struct xua_msg * | sccp_to_xua_xudts (const struct msgb *msg, struct xua_msg *xua)
static struct xua_msg * | sccp_to_xua_ludts (const struct msgb *msg, struct xua_msg *xua)
static struct xua_msg * | sccp_to_xua_it (const struct msgb *msg, struct xua_msg *xua)
static int | sua_to_sccp_it (struct msgb *msg, const struct xua_msg *xua)
static struct xua_msg * | sccp_to_xua_err (const struct msgb *msg, struct xua_msg *xua)
static int | sua_to_sccp_err (struct msgb *msg, const struct xua_msg *xua)
struct xua_msg * | osmo_sccp_to_xua (const struct msgb *msg)
| convert SCCP message to a SUA message More...
struct msgb * | osmo_sua_to_sccp (const struct xua_msg *xua)
| convert parsed SUA message to SCCP message More...

## Variables
static const uint16_t | sccp_mandatory [NUM_SCCP_MSGT][MAX_IES]
static const uint16_t | sccp_optional [NUM_SCCP_MSGT][MAX_IES]

## Macro Definition Documentation

## ◆ MAX_IES

#define MAX_IES 6

## ◆ NUM_SCCP_MSGT

#define NUM_SCCP_MSGT (SCCP_MSG_TYPE_LUDTS+1)

## Function Documentation

## ◆ load_24be()

static uint32_t load_24be | ( | const void * | ptr | ) |
| static

load a 24bit value as big-endian

References data.

Referenced by 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_rlc(), sccp_to_xua_rlsd(), and xua_msg_add_sccp_opt().

## ◆ msgb_put_sccp_opt()

static void msgb_put_sccp_opt | ( | struct msgb * | msg,
|  | uint8_t | pnc,
|  | uint8_t | len,
|  | const uint8_t * | data
| ) |  |
| static

append a SCCP option to the given message

Parameters

  | msg | Message to which option is to be appended
  [in] | pnc | PNC of the option header
  [in] | len | length of the option, excluding the header
  [in] | data | actual data to be appended

References data, len, and msgb_put_sccp_opt_hdr().

Referenced by sccp_msg_add_sua_opt().

## ◆ msgb_put_sccp_opt_hdr()

static void msgb_put_sccp_opt_hdr | ( | struct msgb * | msg,
|  | uint8_t | pnc,
|  | uint8_t | len
| ) |  |
| static

append a SCCP option header to the given message

Parameters

  | msg | Message to which header is to be appended
  [in] | pnc | PNC of the option header
  [in] | len | length of the option, excluding the header

References len.

Referenced by msgb_put_sccp_opt(), and sccp_msg_add_sua_opt().

## ◆ msgb_put_u16le()

static void msgb_put_u16le | ( | struct msgb * | msg,
|  | uint16_t | val
| ) |  |
| static

Referenced by osmo_sccp_addr_encode().

## ◆ msgb_put_u24be()

static void msgb_put_u24be | ( | struct msgb * | msg,
|  | uint32_t | val
| ) |  |
| static

Referenced by sccp_msg_add_sua_opt().

## ◆ osmo_isup_party_encode()

int osmo_isup_party_encode | ( | struct msgb * | msg,
|  | const char * | in_digits
| ) |  |

Encode an ISUP style address of BCD digits.

Parameters

  [out] | msg | Message to which the encoded address is appended
  [in] | in_digits | NUL-terminated ASCII string of digits

Returns
  number of octets used for encoding in_digits

Referenced by osmo_sccp_addr_encode().

## ◆ osmo_isup_party_parse()

int osmo_isup_party_parse | ( | char * | out_digits,
|  | const uint8_t * | in,
|  | unsigned int | in_num_bytes,
|  | bool | odd
| ) |  |

Parse ISUP style address of BCD digets.

Parameters

  [out] | out_digits | user-allocated buffer for ASCII digits
  [in] | in | BCD-encoded digits
  [in] | in_num_bytes | Size of in in bytes
  [in] | odd | Odd (true) or even (false) number of digits

Returns
  number of digits generated

Referenced by osmo_sccp_addr_parse().

## ◆ osmo_sccp_addr_encode()

int osmo_sccp_addr_encode | ( | struct msgb * | msg,
|  | const struct osmo_sccp_addr * | in
| ) |  |

encode a SCCP address from parsed format to wire format

Parameters

  [out] | msg | message buffer to which address is to be appended
  [in] | in | data structure describing SCCP address

Returns
  number of bytes written to msg

References osmo_sccp_gt::digits, osmo_sccp_addr::gt, osmo_sccp_gt::gti, msgb_put_u16le(), osmo_sccp_gt::nai, osmo_sccp_gt::npi, osmo_isup_party_encode(), OSMO_SCCP_ADDR_T_GT, OSMO_SCCP_ADDR_T_PC, OSMO_SCCP_ADDR_T_SSN, OSMO_SCCP_GTI_NAI_ONLY, OSMO_SCCP_GTI_NO_GT, OSMO_SCCP_GTI_TT_NPL_ENC, OSMO_SCCP_GTI_TT_NPL_ENC_NAI, OSMO_SCCP_GTI_TT_ONLY, OSMO_SCCP_RI_GT, OSMO_SCCP_RI_SSN_PC, osmo_sccp_addr::pc, osmo_sccp_addr::presence, osmo_sccp_addr::ri, osmo_sccp_addr::ssn, and osmo_sccp_gt::tt.

Referenced by sua_addr_to_sccp().

## ◆ osmo_sccp_addr_parse()

int osmo_sccp_addr_parse | ( | struct osmo_sccp_addr * | out,
|  | const uint8_t * | addr,
|  | unsigned int | addrlen
| ) |  |

Parse wire-encoded SCCP address into osmo_sccp_addr.

Parameters

  [out] | out | user-allocated output data structure
  [in] | addr | wire-encoded SCCP address
  [in] | addrlen | Size of addr in bytes

Returns
  0 in case of success, negative on error According to Q.713/3.4 and RFC3868/3.10.2

References osmo_sccp_gt::digits, osmo_sccp_addr::gt, osmo_sccp_gt::gti, osmo_sccp_gt::nai, osmo_sccp_gt::npi, osmo_isup_party_parse(), OSMO_SCCP_ADDR_T_GT, OSMO_SCCP_ADDR_T_PC, OSMO_SCCP_ADDR_T_SSN, OSMO_SCCP_GTI_NAI_ONLY, OSMO_SCCP_GTI_NO_GT, OSMO_SCCP_GTI_TT_NPL_ENC, OSMO_SCCP_GTI_TT_NPL_ENC_NAI, OSMO_SCCP_GTI_TT_ONLY, OSMO_SCCP_RI_GT, OSMO_SCCP_RI_SSN_PC, osmo_sccp_addr::pc, osmo_sccp_addr::presence, osmo_sccp_addr::ri, osmo_sccp_addr::ssn, and osmo_sccp_gt::tt.

Referenced by sccp_addr_to_sua().

## ◆ osmo_sccp_to_xua()

struct xua_msg * osmo_sccp_to_xua | ( | const struct msgb * | msg | ) |

convert SCCP message to a SUA message

Parameters

  [in] | msg | message buffer holding SCCP message at l2h

Returns
  callee-allocated xUA message on success; NULL on error

References xua_msg::hdr, NULL, 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(), SUA_CL_CLDR, SUA_CL_CLDT, SUA_CO_COAK, SUA_CO_CODT, SUA_CO_COERR, SUA_CO_COIT, SUA_CO_CORE, SUA_CO_COREF, SUA_CO_RELCO, SUA_CO_RELRE, SUA_MSGC_CL, SUA_MSGC_CO, XUA_HDR, xua_msg_alloc(), and xua_msg_free().

Referenced by asp_loadshare_tcap_sccp(), mtp_user_prim_cb(), patch_sccp_with_pc(), and tcap_as_rx_sccp_asp().

## ◆ osmo_sua_to_sccp()

struct msgb * osmo_sua_to_sccp | ( | const struct xua_msg * | xua | ) |

convert parsed SUA message to SCCP message

Parameters

  [in] | xua | parsed SUA message to be converted

Returns
  callee-allocated msgb containing encoded SCCP message

References xua_msg::hdr, xua_common_hdr::msg_class, xua_common_hdr::msg_type, NULL, sccp_msgb_alloc(), SUA_CL_CLDR, SUA_CL_CLDT, SUA_CO_COAK, SUA_CO_CODT, SUA_CO_COERR, SUA_CO_COIT, SUA_CO_CORE, SUA_CO_COREF, SUA_CO_RELCO, SUA_CO_RELRE, SUA_MSGC_CL, SUA_MSGC_CO, 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_rlc(), sua_to_sccp_rlsd(), sua_to_sccp_udt(), sua_to_sccp_udts(), xua_dialect_sua, and xua_hdr_dump().

Referenced by patch_sccp_with_pc(), send_back_udts(), and sua2sccp_tx_m3ua().

## ◆ sccp_add_long_variable_part()

static int sccp_add_long_variable_part | ( | struct msgb * | msg,
|  | uint8_t * | var_ptr,
|  | const struct xua_msg * | xua,
|  | uint16_t | iei
| ) |  |
| static

Add a "SCCP Long Variable Mandatory Part" to the given msgb.

Parameters

  | msg | Message buffer to which part shall be added
  [out] | var_ptr | pointer to relative pointer in SCCP header
  [in] | xua | xUA message from which to use source data
  [in] | iei | xUA information element identifier of source data

References xua_msg_part::dat, xua_msg_part::len, and xua_msg_find_tag().

Referenced by sua_to_sccp_ludt(), and sua_to_sccp_ludts().

## ◆ sccp_add_var_addr()

static int sccp_add_var_addr | ( | struct msgb * | msg,
|  | uint8_t * | var_ptr,
|  | bool | var_ptr_is_long,
|  | const struct xua_msg * | xua,
|  | uint16_t | iei
| ) |  |
| static

Add a "SCCP Variable Mandatory Part" (Address format) to the given msgb.

Parameters

  | msg | Message buffer to which part shall be added
  [out] | var_ptr | pointer to relative pointer in SCCP header
  [in] | var_ptr_is_long | Whether the var_ptr field is 2 bytes long (network order)
  [in] | xua | xUA message from which to use address
  [in] | iei | xUA information element identifier of address

References sua_addr_to_sccp(), and xua_msg_find_tag().

Referenced by sua_to_sccp_cr(), sua_to_sccp_ludt(), sua_to_sccp_ludts(), sua_to_sccp_udt(), sua_to_sccp_udts(), sua_to_sccp_xudt(), and sua_to_sccp_xudts().

## ◆ sccp_add_variable_part()

static int sccp_add_variable_part | ( | struct msgb * | msg,
|  | uint8_t * | var_ptr,
|  | const struct xua_msg * | xua,
|  | uint16_t | iei
| ) |  |
| static

Add a "SCCP Variable Mandatory Part" to the given msgb.

Parameters

  | msg | Message buffer to which part shall be added
  [out] | var_ptr | pointer to relative pointer in SCCP header
  [in] | xua | xUA message from which to use source data
  [in] | iei | xUA information element identifier of source data

References xua_msg_part::dat, xua_msg_part::len, and xua_msg_find_tag().

Referenced by sua_to_sccp_dt1(), sua_to_sccp_udt(), sua_to_sccp_udts(), sua_to_sccp_xudt(), and sua_to_sccp_xudts().

## ◆ sccp_addr_to_sua()

static int sccp_addr_to_sua | ( | struct xua_msg * | xua,
|  | uint16_t | iei,
|  | const uint8_t * | addr,
|  | unsigned int | addrlen
| ) |  |
| static

convert SCCP address to SUA address

Parameters

  | xua | user-provided xUA message to which address shall be added
  [in] | iei | SUA Information Element Identifier for address
  [in] | addr | SCCP wire format binary address
  [in] | addrlen | Size of addr in bytes

Returns
  0 in case of success; negative on error

References osmo_sccp_addr_dump(), osmo_sccp_addr_parse(), and xua_msg_add_sccp_addr().

Referenced by sccp_addr_to_sua_ptr(), and xua_msg_add_sccp_opt().

## ◆ sccp_addr_to_sua_ptr()

static int sccp_addr_to_sua_ptr | ( | struct xua_msg * | xua,
|  | uint16_t | iei,
|  | const uint8_t * | ptr_addr,
|  | bool | ptr_addr_is_long
| ) |  |
| static

convenience wrapper around sccp_addr_to_sua() for variable mandatory addresses

References sccp_addr_to_sua().

Referenced by sccp_to_xua_cr(), sccp_to_xua_ludt(), sccp_to_xua_ludts(), sccp_to_xua_udt(), sccp_to_xua_udts(), sccp_to_xua_xudt(), and sccp_to_xua_xudts().

## ◆ sccp_data_to_sua_ptr()

static int sccp_data_to_sua_ptr | ( | struct xua_msg * | xua,
|  | uint16_t | iei,
|  | const uint8_t * | ptr_addr
| ) |  |
| static

convenience wrapper around xua_msg_add_data() for variable mandatory data

References xua_msg_add_data().

Referenced by sccp_to_xua_dt1(), sccp_to_xua_udt(), sccp_to_xua_udts(), sccp_to_xua_xudt(), and sccp_to_xua_xudts().

## ◆ sccp_is_mandatory()

static bool sccp_is_mandatory | ( | enum sccp_message_types | type,
|  | const struct xua_msg_part * | part
| ) |  |
| static

References MAX_IES, sccp_mandatory, and xua_msg_part::tag.

Referenced by xua_ies_to_sccp_opts().

## ◆ sccp_longdata_to_sua_ptr()

static int sccp_longdata_to_sua_ptr | ( | struct xua_msg * | xua,
|  | uint16_t | iei,
|  | const uint8_t * | ptr_addr
| ) |  |
| static

convenience wrapper around xua_msg_add_data() for variable mandatory data

References xua_msg_add_data().

Referenced by sccp_to_xua_ludt(), and sccp_to_xua_ludts().

## ◆ sccp_longptr_part_consistent()

static bool sccp_longptr_part_consistent | ( | const struct msgb * | msg,
|  | const uint8_t * | ptr_addr,
|  | bool | len_is_long
| ) |  |
| static

validate that SCCP part with long pointer (2 bytes) + length doesn't exceed msg tail

Parameters

  [in] | msg | Message containing SCCP address (LUDT or LUDTS)
  [in] | ptr_addr | pointer to byte with relative SCCP long pointer (uint16_t, 2 bytes in network order)
  [in] | len_is_long | whether the length field at the starting of the value field pointer to by ptr_addr is 2 bytes long.

Returns
  true if OK; false if message inconsistent

References data, and len.

Referenced by sccp_to_xua_ludt(), and sccp_to_xua_ludts().

## ◆ sccp_msg_add_sua_opt()

static int sccp_msg_add_sua_opt | ( | enum sccp_message_types | type,
|  | struct msgb * | msg,
|  | const struct xua_msg_part * | opt
| ) |  |
| static

Convert a given SUA option/IE to SCCP and add it to given * msgb.

Parameters

  | msg | caller-provided message buffer to which option is to be appended
  [in] | opt | xUA option/IE (messge part) to be converted+added

Returns
  0 in case of success; negative on error

References xua_msg_part::dat, xua_msg_part::len, msgb_put_sccp_opt(), msgb_put_sccp_opt_hdr(), msgb_put_u24be(), sua_addr_to_sccp(), SUA_CAUSE_T_ERROR, SUA_CAUSE_T_MASK, SUA_CAUSE_T_REFUSAL, SUA_CAUSE_T_RELEASE, SUA_CAUSE_T_RESET, SUA_CAUSE_T_RETURN, SUA_IEI_CAUSE, SUA_IEI_CREDIT, SUA_IEI_DATA, SUA_IEI_DEST_ADDR, SUA_IEI_DEST_REF, SUA_IEI_IMPORTANCE, SUA_IEI_PROTO_CLASS, SUA_IEI_ROUTE_CTX, SUA_IEI_S7_HOP_CTR, SUA_IEI_SEQ_CTRL, SUA_IEI_SRC_ADDR, SUA_IEI_SRC_REF, xua_msg_part::tag, and xua_msg_part_get_u32().

Referenced by xua_ies_to_sccp_opts().

## ◆ sccp_option_permitted()

static bool sccp_option_permitted | ( | enum sccp_message_types | type,
|  | const struct xua_msg_part * | part
| ) |  |
| static

References MAX_IES, sccp_optional, and xua_msg_part::tag.

Referenced by xua_ies_to_sccp_opts().

## ◆ sccp_ptr_part_consistent()

static bool sccp_ptr_part_consistent | ( | const struct msgb * | msg,
|  | const uint8_t * | ptr_addr
| ) |  |
| static

validate that SCCP part with pointer + length doesn't exceed msg tail

Parameters

  [in] | msg | Message containing SCCP address
  [in] | ptr_addr | pointer to byte with relative SCCP pointer

Returns
  true if OK; false if message inconsistent

References data.

Referenced by sccp_to_xua_cr(), sccp_to_xua_dt1(), sccp_to_xua_udt(), sccp_to_xua_udts(), sccp_to_xua_xudt(), and sccp_to_xua_xudts().

## ◆ sccp_to_xua_cc()

static struct xua_msg * sccp_to_xua_cc | ( | const struct msgb * | msg,
|  | struct xua_msg * | xua
| ) |  |
| static

Returns
  xua in case of success, NULL on error (xua not freed!)

References load_24be(), sccp_to_xua_opt(), SUA_IEI_DEST_REF, SUA_IEI_PROTO_CLASS, SUA_IEI_SRC_REF, and xua_msg_add_u32().

Referenced by osmo_sccp_to_xua().

## ◆ sccp_to_xua_cr()

static struct xua_msg * sccp_to_xua_cr | ( | const struct msgb * | msg,
|  | struct xua_msg * | xua
| ) |  |
| static

Returns
  xua in case of success, NULL on error (xua not freed!)

References load_24be(), NULL, sccp_addr_to_sua_ptr(), sccp_ptr_part_consistent(), sccp_to_xua_opt(), SUA_IEI_DEST_ADDR, SUA_IEI_PROTO_CLASS, SUA_IEI_SRC_REF, and xua_msg_add_u32().

Referenced by osmo_sccp_to_xua().

## ◆ sccp_to_xua_cref()

static struct xua_msg * sccp_to_xua_cref | ( | const struct msgb * | msg,
|  | struct xua_msg * | xua
| ) |  |
| static

Returns
  xua in case of success, NULL on error (xua not freed!)

References load_24be(), sccp_to_xua_opt(), SUA_CAUSE_T_REFUSAL, SUA_IEI_CAUSE, SUA_IEI_DEST_REF, and xua_msg_add_u32().

Referenced by osmo_sccp_to_xua().

## ◆ sccp_to_xua_dt1()

static struct xua_msg * sccp_to_xua_dt1 | ( | const struct msgb * | msg,
|  | struct xua_msg * | xua
| ) |  |
| static

Returns
  xua in case of success, NULL on error (xua not freed!)

References load_24be(), NULL, sccp_data_to_sua_ptr(), sccp_ptr_part_consistent(), SUA_IEI_DATA, SUA_IEI_DEST_REF, SUA_IEI_SEGMENTATION, and xua_msg_add_u32().

Referenced by osmo_sccp_to_xua().

## ◆ sccp_to_xua_err()

static struct xua_msg * sccp_to_xua_err | ( | const struct msgb * | msg,
|  | struct xua_msg * | xua
| ) |  |
| static

Returns
  xua in case of success, NULL on error (xua not freed!)

References err, load_24be(), SUA_CAUSE_T_ERROR, SUA_IEI_CAUSE, SUA_IEI_DEST_REF, and xua_msg_add_u32().

Referenced by osmo_sccp_to_xua().

## ◆ sccp_to_xua_it()

static struct xua_msg * sccp_to_xua_it | ( | const struct msgb * | msg,
|  | struct xua_msg * | xua
| ) |  |
| static

Returns
  xua in case of success, NULL on error (xua not freed!)

References load_24be(), SUA_IEI_CREDIT, SUA_IEI_DEST_REF, SUA_IEI_PROTO_CLASS, SUA_IEI_SRC_REF, and xua_msg_add_u32().

Referenced by osmo_sccp_to_xua().

## ◆ sccp_to_xua_ludt()

static struct xua_msg * sccp_to_xua_ludt | ( | const struct msgb * | msg,
|  | struct xua_msg * | xua
| ) |  |
| static

Returns
  xua in case of success, NULL on error (xua not freed!)

References NULL, sccp_addr_to_sua_ptr(), sccp_longdata_to_sua_ptr(), sccp_longptr_part_consistent(), sccp_to_xua_opt(), SUA_IEI_DATA, SUA_IEI_DEST_ADDR, SUA_IEI_PROTO_CLASS, SUA_IEI_S7_HOP_CTR, SUA_IEI_SRC_ADDR, and xua_msg_add_u32().

Referenced by osmo_sccp_to_xua().

## ◆ sccp_to_xua_ludts()

static struct xua_msg * sccp_to_xua_ludts | ( | const struct msgb * | msg,
|  | struct xua_msg * | xua
| ) |  |
| static

Returns
  xua in case of success, NULL on error (xua not freed!)

References NULL, sccp_addr_to_sua_ptr(), sccp_longdata_to_sua_ptr(), sccp_longptr_part_consistent(), sccp_to_xua_opt(), SUA_CAUSE_T_RETURN, SUA_IEI_CAUSE, SUA_IEI_DATA, SUA_IEI_DEST_ADDR, SUA_IEI_S7_HOP_CTR, SUA_IEI_SRC_ADDR, and xua_msg_add_u32().

Referenced by osmo_sccp_to_xua().

## ◆ sccp_to_xua_opt()

static struct xua_msg * sccp_to_xua_opt | ( | const struct msgb * | msg,
|  | const uint8_t * | ptr_opt,
|  | bool | ptr_opt_is_long,
|  | struct xua_msg * | xua
| ) |  |
| static

convert SCCP optional part to list of SUA options

Parameters

  [in] | msg | Message buffer holding SCCP message
  [in] | ptr_opt | address of relative pointer to optional part
  [in] | ptr_opt_is_long | whether ptr_opt is a long pointer (2 bytes, network order)
  | xua | caller-provided xUA message to which options are added

Returns
  xua in case of success, NULL on error (xua not freed!)

References data, NULL, and xua_msg_add_sccp_opt().

Referenced by sccp_to_xua_cc(), sccp_to_xua_cr(), sccp_to_xua_cref(), sccp_to_xua_ludt(), sccp_to_xua_ludts(), sccp_to_xua_rlsd(), sccp_to_xua_xudt(), and sccp_to_xua_xudts().

## ◆ sccp_to_xua_rlc()

static struct xua_msg * sccp_to_xua_rlc | ( | const struct msgb * | msg,
|  | struct xua_msg * | xua
| ) |  |
| static

Returns
  xua in case of success, NULL on error (xua not freed!)

References load_24be(), SUA_IEI_DEST_REF, SUA_IEI_SRC_REF, and xua_msg_add_u32().

Referenced by osmo_sccp_to_xua().

## ◆ sccp_to_xua_rlsd()

static struct xua_msg * sccp_to_xua_rlsd | ( | const struct msgb * | msg,
|  | struct xua_msg * | xua
| ) |  |
| static

Returns
  xua in case of success, NULL on error (xua not freed!)

References load_24be(), sccp_to_xua_opt(), SUA_CAUSE_T_RELEASE, SUA_IEI_CAUSE, SUA_IEI_DEST_REF, SUA_IEI_SRC_REF, and xua_msg_add_u32().

Referenced by osmo_sccp_to_xua().

## ◆ sccp_to_xua_udt()

static struct xua_msg * sccp_to_xua_udt | ( | const struct msgb * | msg,
|  | struct xua_msg * | xua
| ) |  |
| static

Returns
  xua in case of success, NULL on error (xua not freed!)

References NULL, sccp_addr_to_sua_ptr(), sccp_data_to_sua_ptr(), sccp_ptr_part_consistent(), SUA_IEI_DATA, SUA_IEI_DEST_ADDR, SUA_IEI_PROTO_CLASS, SUA_IEI_SRC_ADDR, and xua_msg_add_u32().

Referenced by osmo_sccp_to_xua().

## ◆ sccp_to_xua_udts()

static struct xua_msg * sccp_to_xua_udts | ( | const struct msgb * | msg,
|  | struct xua_msg * | xua
| ) |  |
| static

Returns
  xua in case of success, NULL on error (xua not freed!)

References NULL, sccp_addr_to_sua_ptr(), sccp_data_to_sua_ptr(), sccp_ptr_part_consistent(), SUA_CAUSE_T_RETURN, SUA_IEI_CAUSE, SUA_IEI_DATA, SUA_IEI_DEST_ADDR, SUA_IEI_SRC_ADDR, and xua_msg_add_u32().

Referenced by osmo_sccp_to_xua().

## ◆ sccp_to_xua_xudt()

static struct xua_msg * sccp_to_xua_xudt | ( | const struct msgb * | msg,
|  | struct xua_msg * | xua
| ) |  |
| static

Returns
  xua in case of success, NULL on error (xua not freed!)

References NULL, sccp_addr_to_sua_ptr(), sccp_data_to_sua_ptr(), sccp_ptr_part_consistent(), sccp_to_xua_opt(), SUA_IEI_DATA, SUA_IEI_DEST_ADDR, SUA_IEI_PROTO_CLASS, SUA_IEI_S7_HOP_CTR, SUA_IEI_SRC_ADDR, and xua_msg_add_u32().

Referenced by osmo_sccp_to_xua().

## ◆ sccp_to_xua_xudts()

static struct xua_msg * sccp_to_xua_xudts | ( | const struct msgb * | msg,
|  | struct xua_msg * | xua
| ) |  |
| static

Returns
  xua in case of success, NULL on error (xua not freed!)

References NULL, sccp_addr_to_sua_ptr(), sccp_data_to_sua_ptr(), sccp_ptr_part_consistent(), sccp_to_xua_opt(), SUA_CAUSE_T_RETURN, SUA_IEI_CAUSE, SUA_IEI_DATA, SUA_IEI_DEST_ADDR, SUA_IEI_S7_HOP_CTR, SUA_IEI_SRC_ADDR, and xua_msg_add_u32().

Referenced by osmo_sccp_to_xua().

## ◆ store_local_ref()

static int store_local_ref | ( | struct sccp_source_reference * | local_ref,
|  | const struct xua_msg * | xua,
|  | uint16_t | iei
| ) |  |
| static

References xua_msg_get_u32().

Referenced by 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_rlc(), and sua_to_sccp_rlsd().

## ◆ sua_addr_to_sccp()

static int sua_addr_to_sccp | ( | struct msgb * | msg,
|  | const struct xua_msg_part * | part
| ) |  |
| static

convert SUA address to SCCP address

Parameters

  | msg | user-provided message buffer to which address shall be * appended
  [in] | part | SUA wire format binary address

Returns
  0 in case of success; negative on error

References osmo_sccp_addr_encode(), and sua_addr_parse_part().

Referenced by sccp_add_var_addr(), and sccp_msg_add_sua_opt().

## ◆ sua_to_sccp_cc()

static int sua_to_sccp_cc | ( | struct msgb * | msg,
|  | const struct xua_msg * | xua
| ) |  |
| static

Returns
  xua in case of success, NULL on error (xua not freed!)

References store_local_ref(), SUA_IEI_DEST_REF, SUA_IEI_PROTO_CLASS, SUA_IEI_SRC_REF, xua_ies_to_sccp_opts(), and xua_msg_get_u32().

Referenced by osmo_sua_to_sccp().

## ◆ sua_to_sccp_cr()

static int sua_to_sccp_cr | ( | struct msgb * | msg,
|  | const struct xua_msg * | xua
| ) |  |
| static

Returns
  xua in case of success, NULL on error (xua not freed!)

References sccp_add_var_addr(), store_local_ref(), SUA_IEI_DEST_ADDR, SUA_IEI_PROTO_CLASS, SUA_IEI_SRC_REF, xua_ies_to_sccp_opts(), and xua_msg_get_u32().

Referenced by osmo_sua_to_sccp().

## ◆ sua_to_sccp_cref()

static int sua_to_sccp_cref | ( | struct msgb * | msg,
|  | const struct xua_msg * | xua
| ) |  |
| static

Returns
  xua in case of success, NULL on error (xua not freed!)

References store_local_ref(), SUA_IEI_CAUSE, SUA_IEI_DEST_REF, xua_ies_to_sccp_opts(), and xua_msg_get_u32().

Referenced by osmo_sua_to_sccp().

## ◆ sua_to_sccp_dt1()

static int sua_to_sccp_dt1 | ( | struct msgb * | msg,
|  | const struct xua_msg * | xua
| ) |  |
| static

References sccp_add_variable_part(), store_local_ref(), SUA_IEI_DATA, SUA_IEI_DEST_REF, SUA_IEI_SEGMENTATION, and xua_msg_get_u32().

Referenced by osmo_sua_to_sccp().

## ◆ sua_to_sccp_err()

static int sua_to_sccp_err | ( | struct msgb * | msg,
|  | const struct xua_msg * | xua
| ) |  |
| static

References err, store_local_ref(), SUA_IEI_CAUSE, SUA_IEI_DEST_REF, and xua_msg_get_u32().

Referenced by osmo_sua_to_sccp().

## ◆ sua_to_sccp_it()

static int sua_to_sccp_it | ( | struct msgb * | msg,
|  | const struct xua_msg * | xua
| ) |  |
| static

References store_local_ref(), SUA_IEI_CREDIT, SUA_IEI_DEST_REF, SUA_IEI_PROTO_CLASS, SUA_IEI_SRC_REF, and xua_msg_get_u32().

Referenced by osmo_sua_to_sccp().

## ◆ sua_to_sccp_ludt()

static int sua_to_sccp_ludt | ( | struct msgb * | msg,
|  | const struct xua_msg * | xua
| ) |  |
| static

References sccp_add_long_variable_part(), sccp_add_var_addr(), SUA_IEI_DATA, SUA_IEI_DEST_ADDR, SUA_IEI_PROTO_CLASS, SUA_IEI_S7_HOP_CTR, SUA_IEI_SRC_ADDR, xua_ies_to_sccp_opts(), and xua_msg_get_u32().

Referenced by sua_to_sccp_udt(), and sua_to_sccp_xudt().

## ◆ sua_to_sccp_ludts()

static int sua_to_sccp_ludts | ( | struct msgb * | msg,
|  | const struct xua_msg * | xua
| ) |  |
| static

References sccp_add_long_variable_part(), sccp_add_var_addr(), SUA_IEI_CAUSE, SUA_IEI_DATA, SUA_IEI_DEST_ADDR, SUA_IEI_S7_HOP_CTR, SUA_IEI_SRC_ADDR, xua_ies_to_sccp_opts(), and xua_msg_get_u32().

Referenced by sua_to_sccp_udts().

## ◆ sua_to_sccp_rlc()

static int sua_to_sccp_rlc | ( | struct msgb * | msg,
|  | const struct xua_msg * | xua
| ) |  |
| static

References store_local_ref(), SUA_IEI_DEST_REF, and SUA_IEI_SRC_REF.

Referenced by osmo_sua_to_sccp().

## ◆ sua_to_sccp_rlsd()

static int sua_to_sccp_rlsd | ( | struct msgb * | msg,
|  | const struct xua_msg * | xua
| ) |  |
| static

References store_local_ref(), SUA_IEI_CAUSE, SUA_IEI_DEST_REF, SUA_IEI_SRC_REF, xua_ies_to_sccp_opts(), and xua_msg_get_u32().

Referenced by osmo_sua_to_sccp().

## ◆ sua_to_sccp_udt()

static int sua_to_sccp_udt | ( | struct msgb * | msg,
|  | const struct xua_msg * | xua
| ) |  |
| static

References sccp_add_var_addr(), sccp_add_variable_part(), SUA_IEI_DATA, SUA_IEI_DEST_ADDR, SUA_IEI_PROTO_CLASS, SUA_IEI_S7_HOP_CTR, SUA_IEI_SRC_ADDR, sua_to_sccp_ludt(), sua_to_sccp_xudt(), xua_msg_find_tag(), xua_msg_get_len(), and xua_msg_get_u32().

Referenced by osmo_sua_to_sccp().

## ◆ sua_to_sccp_udts()

static int sua_to_sccp_udts | ( | struct msgb * | msg,
|  | const struct xua_msg * | xua
| ) |  |
| static

References sccp_add_var_addr(), sccp_add_variable_part(), SUA_IEI_CAUSE, SUA_IEI_DATA, SUA_IEI_DEST_ADDR, SUA_IEI_S7_HOP_CTR, SUA_IEI_SRC_ADDR, sua_to_sccp_ludts(), sua_to_sccp_xudts(), xua_msg_find_tag(), xua_msg_get_len(), and xua_msg_get_u32().

Referenced by osmo_sua_to_sccp().

## ◆ sua_to_sccp_xudt()

static int sua_to_sccp_xudt | ( | struct msgb * | msg,
|  | const struct xua_msg * | xua
| ) |  |
| static

References sccp_add_var_addr(), sccp_add_variable_part(), SUA_IEI_DATA, SUA_IEI_DEST_ADDR, SUA_IEI_PROTO_CLASS, SUA_IEI_S7_HOP_CTR, SUA_IEI_SRC_ADDR, sua_to_sccp_ludt(), xua_ies_to_sccp_opts(), xua_msg_get_len(), and xua_msg_get_u32().

Referenced by sua_to_sccp_udt().

## ◆ sua_to_sccp_xudts()

static int sua_to_sccp_xudts | ( | struct msgb * | msg,
|  | const struct xua_msg * | xua
| ) |  |
| static

References sccp_add_var_addr(), sccp_add_variable_part(), SUA_IEI_CAUSE, SUA_IEI_DATA, SUA_IEI_DEST_ADDR, SUA_IEI_S7_HOP_CTR, SUA_IEI_SRC_ADDR, xua_ies_to_sccp_opts(), and xua_msg_get_u32().

Referenced by sua_to_sccp_udts().

## ◆ xua_ies_to_sccp_opts()

static int xua_ies_to_sccp_opts | ( | struct msgb * | msg,
|  | uint8_t * | ptr_opt,
|  | bool | ptr_opt_is_long,
|  | enum sccp_message_types | type,
|  | const struct xua_msg * | xua
| ) |  |
| static

References xua_msg_part::entry, xua_msg::headers, sccp_is_mandatory(), sccp_msg_add_sua_opt(), and sccp_option_permitted().

Referenced by sua_to_sccp_cc(), sua_to_sccp_cr(), sua_to_sccp_cref(), sua_to_sccp_ludt(), sua_to_sccp_ludts(), sua_to_sccp_rlsd(), sua_to_sccp_xudt(), and sua_to_sccp_xudts().

## ◆ xua_msg_add_sccp_opt()

static int xua_msg_add_sccp_opt | ( | struct xua_msg * | xua,
|  | uint8_t | sccp_opt_type,
|  | uint16_t | opt_len,
|  | const uint8_t * | opt
| ) |  |
| static

Convert a given SCCP option to SUA and add it to given xua_msg.

Parameters

  | xua | caller-provided xUA message to which option is to be added
  [in] | sccp_opt_type | SCCP option type (PNC)
  [in] | opt_len | size of opt in bytes
  [in] | opt | pointer to wire-format encoded SCCP option data

Returns
  0 in case of success; negative on error

References load_24be(), sccp_addr_to_sua(), SUA_CAUSE_T_ERROR, SUA_CAUSE_T_REFUSAL, SUA_CAUSE_T_RELEASE, SUA_CAUSE_T_RESET, SUA_CAUSE_T_RETURN, SUA_IEI_CAUSE, SUA_IEI_DATA, SUA_IEI_DEST_ADDR, SUA_IEI_DEST_REF, SUA_IEI_IMPORTANCE, SUA_IEI_PROTO_CLASS, SUA_IEI_S7_HOP_CTR, SUA_IEI_SRC_ADDR, SUA_IEI_SRC_REF, xua_msg_add_data(), and xua_msg_add_u32().

Referenced by sccp_to_xua_opt().

## Variable Documentation

## ◆ sccp_mandatory

const uint16_t sccp_mandatory[NUM_SCCP_MSGT][MAX_IES]
| static

Referenced by sccp_is_mandatory().

## ◆ sccp_optional

const uint16_t sccp_optional[NUM_SCCP_MSGT][MAX_IES]
| static

Referenced by sccp_option_permitted().