libosmo-sigtran 2.0.0.52-6412
Osmocom SIGTRAN library
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_msgsccp_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_msgsccp_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_msgsccp_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_msgsccp_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_msgsccp_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_msgsccp_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_msgsccp_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_msgsccp_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_msgsccp_to_xua_xudt (const struct msgb *msg, struct xua_msg *xua)
 
static struct xua_msgsccp_to_xua_ludt (struct msgb *msg, struct xua_msg *xua)
 
static struct xua_msgsccp_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_msgsccp_to_xua_xudts (const struct msgb *msg, struct xua_msg *xua)
 
static struct xua_msgsccp_to_xua_ludts (const struct msgb *msg, struct xua_msg *xua)
 
static struct xua_msgsccp_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_msgsccp_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_msgosmo_sccp_to_xua (struct msgb *msg)
 convert SCCP message to a SUA message More...
 
struct msgb * osmo_sua_to_sccp (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

◆ 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
msgMessage to which option is to be appended
[in]pncPNC of the option header
[in]lenlength of the option, excluding the header
[in]dataactual 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
msgMessage to which header is to be appended
[in]pncPNC of the option header
[in]lenlength 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]msgMessage to which the encoded address is appended
[in]in_digitsNUL-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_digitsuser-allocated buffer for ASCII digits
[in]inBCD-encoded digits
[in]in_num_bytesSize of in in bytes
[in]oddOdd (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 
)

◆ 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]outuser-allocated output data structure
[in]addrwire-encoded SCCP address
[in]addrlenSize 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()

◆ osmo_sua_to_sccp()

◆ 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
msgMessage buffer to which part shall be added
[out]var_ptrpointer to relative pointer in SCCP header
[in]xuaxUA message from which to use source data
[in]ieixUA 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
msgMessage buffer to which part shall be added
[out]var_ptrpointer to relative pointer in SCCP header
[in]var_ptr_is_longWhether the var_ptr field is 2 bytes long (network order)
[in]xuaxUA message from which to use address
[in]ieixUA 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
msgMessage buffer to which part shall be added
[out]var_ptrpointer to relative pointer in SCCP header
[in]xuaxUA message from which to use source data
[in]ieixUA 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
xuauser-provided xUA message to which address shall be added
[in]ieiSUA Information Element Identifier for address
[in]addrSCCP wire format binary address
[in]addrlenSize 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

◆ 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

◆ 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]msgMessage containing SCCP address (LUDT or LUDTS)
[in]ptr_addrpointer to byte with relative SCCP long pointer (uint16_t, 2 bytes in network order)
[in]len_is_longwhether 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
msgcaller-provided message buffer to which option is to be appended
[in]optxUA 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

◆ 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]msgMessage containing SCCP address
[in]ptr_addrpointer 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(), 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(), 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 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 ( struct msgb *  msg,
struct xua_msg xua 
)
static

◆ sccp_to_xua_ludts()

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

◆ 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]msgMessage buffer holding SCCP message
[in]ptr_optaddress of relative pointer to optional part
[in]ptr_opt_is_longwhether ptr_opt is a long pointer (2 bytes, network order)
xuacaller-provided xUA message to which options are added
Returns
xua in case of success, NULL on error (xua not freed!)

References data, 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

◆ sccp_to_xua_udts()

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

◆ sccp_to_xua_xudt()

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

◆ sccp_to_xua_xudts()

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

◆ store_local_ref()

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

◆ 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
msguser-provided message buffer to which address shall be * appended
[in]partSUA 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

◆ sua_to_sccp_err()

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

◆ sua_to_sccp_it()

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

◆ sua_to_sccp_ludt()

◆ sua_to_sccp_ludts()

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

◆ sua_to_sccp_rlc()

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

◆ sua_to_sccp_rlsd()

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

◆ sua_to_sccp_udt()

◆ sua_to_sccp_udts()

◆ sua_to_sccp_xudt()

◆ sua_to_sccp_xudts()

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

◆ 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

◆ 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
xuacaller-provided xUA message to which option is to be added
[in]sccp_opt_typeSCCP option type (PNC)
[in]opt_lensize of opt in bytes
[in]optpointer 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().