libosmogb 1.13.1.1-afb4 Osmocom Gb library

Data Structures | Macros | Functions | Variables
gprs_bssgp_rim.c File Reference
`#include <errno.h>`
`#include <osmocom/gprs/gprs_bssgp.h>`
`#include <osmocom/gprs/gprs_bssgp_rim.h>`
`#include <osmocom/gsm/gsm0808_utils.h>`
`#include "gprs_bssgp_internal.h"`

## Data Structures
struct | bssgp_ran_inf_x_cont

## Macros
#define | TVLV_HDR_MAXLEN 3
#define | TVLV_HDR_LEN 2
#define | REP_CELL_ID_LEN 8

## Functions
int | bssgp_parse_rim_ra (struct bssgp_rim_routing_info *ri, const uint8_t *buf, unsigned int len, uint8_t discr)
| Parse a RIM Routing address IE (3GPP TS 29.060, chapter 7.7.57 and 7.7.77). More...
int | bssgp_parse_rim_ri (struct bssgp_rim_routing_info *ri, const uint8_t *buf, unsigned int len)
| Parse a RIM Routing information IE (3GPP TS 48.018, chapter 11.3.70). More...
int | bssgp_create_rim_ri (uint8_t *buf, const struct bssgp_rim_routing_info *ri)
| Encode a RIM Routing information IE (3GPP TS 48.018, chapter 11.3.70). More...
char * | bssgp_rim_ri_name_buf (char *buf, size_t buf_len, const struct bssgp_rim_routing_info *ri)
| Encode a RIM Routing information into a human readable string. More...
const char * | bssgp_rim_ri_name (const struct bssgp_rim_routing_info *ri)
| Encode a RIM Routing information into a human readable string. More...
int | bssgp_dec_ran_inf_req_app_cont_nacc (struct bssgp_ran_inf_req_app_cont_nacc *cont, const uint8_t *buf, size_t len)
| Decode a RAN Information Request Application Container for NACC (3GPP TS 48.018, section 11.3.63.1.1). More...
int | bssgp_enc_ran_inf_req_app_cont_nacc (uint8_t *buf, size_t len, const struct bssgp_ran_inf_req_app_cont_nacc *cont)
| Encode a RAN Information Request Application Container for NACC (3GPP TS 48.018, section 11.3.63.1.1). More...
int | bssgp_dec_ran_inf_app_cont_nacc (struct bssgp_ran_inf_app_cont_nacc *cont, const uint8_t *buf, size_t len)
| Decode a RAN Information Application Container (3GPP TS 48.018, section 11.3.63.2.1). More...
int | bssgp_enc_ran_inf_app_cont_nacc (uint8_t *buf, size_t len, const struct bssgp_ran_inf_app_cont_nacc *cont)
| Encode a RAN Information Application Container (3GPP TS 48.018, section 11.3.63.2.1). More...
int | bssgp_dec_app_err_cont_nacc (struct bssgp_app_err_cont_nacc *cont, const uint8_t *buf, size_t len)
| Decode a Application Error Container for NACC (3GPP TS 48.018, section 11.3.64.1). More...
int | bssgp_enc_app_err_cont_nacc (uint8_t *buf, size_t len, const struct bssgp_app_err_cont_nacc *cont)
| Encode Application Error Container for NACC (3GPP TS 48.018, section 11.3.64.1). More...
static int | dec_rim_cont_common (struct bssgp_ran_inf_x_cont *cont, struct tlv_parsed *tp)
static uint8_t * | enc_rim_cont_common (uint8_t *buf, size_t len, const struct bssgp_ran_inf_x_cont *cont)
int | bssgp_dec_ran_inf_req_rim_cont (struct bssgp_ran_inf_req_rim_cont *cont, const uint8_t *buf, size_t len)
| Decode a RAN Information Request RIM Container (3GPP TS 48.018, table 11.3.62a.1.b). More...
static uint8_t * | dub_tlvp_header (uint8_t *buf, uint8_t iei, uint16_t len)
int | bssgp_enc_ran_inf_req_rim_cont (uint8_t *buf, size_t len, const struct bssgp_ran_inf_req_rim_cont *cont)
| Encode a RAN Information Request RIM Container (3GPP TS 48.018, table 11.3.62a.1.b). More...
int | bssgp_dec_ran_inf_rim_cont (struct bssgp_ran_inf_rim_cont *cont, const uint8_t *buf, size_t len)
| Decode a RAN Information RIM Container (3GPP TS 48.018, table 11.3.62a.2.b). More...
int | bssgp_enc_ran_inf_rim_cont (uint8_t *buf, size_t len, const struct bssgp_ran_inf_rim_cont *cont)
| Encode a RAN Information RIM Container (3GPP TS 48.018, table 11.3.62a.2.b). More...
int | bssgp_dec_ran_inf_ack_rim_cont (struct bssgp_ran_inf_ack_rim_cont *cont, const uint8_t *buf, size_t len)
| Decode a RAN Information ACK RIM Container (3GPP TS 48.018, table 11.3.62a.3.b). More...
int | bssgp_enc_ran_inf_ack_rim_cont (uint8_t *buf, size_t len, const struct bssgp_ran_inf_ack_rim_cont *cont)
| Encode a RAN Information ACK RIM Container (3GPP TS 48.018, table 11.3.62a.3.b). More...
int | bssgp_dec_ran_inf_err_rim_cont (struct bssgp_ran_inf_err_rim_cont *cont, const uint8_t *buf, size_t len)
| Decode a RAN Information Error RIM Container (3GPP TS 48.018, table 11.3.62a.4.b). More...
int | bssgp_enc_ran_inf_err_rim_cont (uint8_t *buf, size_t len, const struct bssgp_ran_inf_err_rim_cont *cont)
| Encode a RAN Information Error RIM Container (3GPP TS 48.018, table 11.3.62a.4.b). More...
int | bssgp_dec_ran_inf_app_err_rim_cont (struct bssgp_ran_inf_app_err_rim_cont *cont, const uint8_t *buf, size_t len)
| Decode a RAN Information Application Error RIM Container (3GPP TS 48.018, table 11.3.62a.5.b). More...
int | bssgp_enc_ran_inf_app_err_rim_cont (uint8_t *buf, size_t len, const struct bssgp_ran_inf_app_err_rim_cont *cont)
| Encode a RAN Information Application Error RIM Container (3GPP TS 48.018, table 11.3.62a.5.b). More...
int | bssgp_parse_rim_pdu (struct bssgp_ran_information_pdu *pdu, const struct msgb *msg)
| Parse a given message buffer into a rim-pdu struct. More...
struct msgb * | bssgp_encode_rim_pdu (const struct bssgp_ran_information_pdu *pdu)
| Encode a given rim-pdu struct into a message buffer. More...
int | bssgp_tx_rim (const struct bssgp_ran_information_pdu *pdu, uint16_t nsei)
| Send RIM RAN INFORMATION REQUEST via BSSGP (3GPP TS 48.018, section 10.6.1). More...
int | bssgp_tx_rim_encoded (struct msgb *msg, uint16_t nsei)
| Send encoded RAN TRANSPARENT CONTAINER via BSSGP (3GPP TS 29.060, section 7.7.43). More...
int | bssgp_rx_rim (struct msgb *msg, struct tlv_parsed *tp, uint16_t bvci)

## Variables
const struct value_string | bssgp_rim_routing_info_discr_strs []
const struct value_string | bssgp_nacc_cause_strs []
const struct value_string | bssgp_ran_inf_app_id_strs []

## Macro Definition Documentation

## ◆ REP_CELL_ID_LEN

#define REP_CELL_ID_LEN 8

## ◆ TVLV_HDR_LEN

#define TVLV_HDR_LEN 2

## ◆ TVLV_HDR_MAXLEN

#define TVLV_HDR_MAXLEN 3

## Function Documentation

## ◆ bssgp_create_rim_ri()

int bssgp_create_rim_ri | ( | uint8_t * | buf,
|  | const struct bssgp_rim_routing_info * | ri
| ) |  |

Encode a RIM Routing information IE (3GPP TS 48.018, chapter 11.3.70).

Parameters

  [out] | buf | user provided memory (at least 14 byte) for the generated value part of the IE.
  [in] | ri | user provided input data struct.

Returns
  length of encoded octets, -EINVAL on error.

References bssgp_create_cell_id(), BSSGP_RIM_ROUTING_INFO_EUTRAN, BSSGP_RIM_ROUTING_INFO_GERAN, BSSGP_RIM_ROUTING_INFO_MAXLEN, BSSGP_RIM_ROUTING_INFO_UTRAN, bssgp_rim_routing_info::cid, bssgp_rim_routing_info::discr, bssgp_rim_routing_info::eutran, bssgp_rim_routing_info::geran, bssgp_rim_routing_info::global_enb_id, bssgp_rim_routing_info::global_enb_id_len, gsm48_encode_ra(), len(), gprs_ra_id::mcc, osmo_eutran_tai::mcc, osmo_eutran_tai::mnc, osmo_eutran_tai::mnc_3_digits, OSMO_ASSERT, bssgp_rim_routing_info::raid, bssgp_rim_routing_info::rncid, osmo_eutran_tai::tac, bssgp_rim_routing_info::tai, and bssgp_rim_routing_info::utran.

Referenced by bssgp_encode_rim_pdu().

## ◆ bssgp_dec_app_err_cont_nacc()

int bssgp_dec_app_err_cont_nacc | ( | struct bssgp_app_err_cont_nacc * | cont,
|  | const uint8_t * | buf,
|  | size_t | len
| ) |  |

Decode a Application Error Container for NACC (3GPP TS 48.018, section 11.3.64.1).

Parameters

  [out] | user | provided memory for decoded data struct.
  [in] | buf | user provided memory with the encoded value data of the IE.

Returns
  0 on success, -EINVAL on error.

References bssgp_app_err_cont_nacc::err_app_cont, bssgp_app_err_cont_nacc::err_app_cont_len, len(), and bssgp_app_err_cont_nacc::nacc_cause.

Referenced by bssgp_dec_ran_inf_app_err_rim_cont(), and bssgp_dec_ran_inf_rim_cont().

## ◆ bssgp_dec_ran_inf_ack_rim_cont()

int bssgp_dec_ran_inf_ack_rim_cont | ( | struct bssgp_ran_inf_ack_rim_cont * | cont,
|  | const uint8_t * | buf,
|  | size_t | len
| ) |  |

Decode a RAN Information ACK RIM Container (3GPP TS 48.018, table 11.3.62a.3.b).

Parameters

  [out] | user | provided memory for decoded data struct.
  [in] | buf | user provided memory with the encoded value data of the IE.

Returns
  0 on success, -EINVAL on error.

References bssgp_ran_inf_ack_rim_cont::app_id, BSSGP_IE_RIM_APP_IDENTITY, BSSGP_IE_RIM_PROTOCOL_VERSION, BSSGP_IE_RIM_SEQ_NR, BSSGP_IE_SON_TRANSFER_APP_ID, len(), bssgp_ran_inf_ack_rim_cont::prot_ver, bssgp_ran_inf_ack_rim_cont::seq_num, bssgp_ran_inf_ack_rim_cont::son_trans_app_id, bssgp_ran_inf_ack_rim_cont::son_trans_app_id_len, tlv_parse(), TLVP_LEN, TLVP_PRES_LEN, TLVP_VAL, tlvp_val32be(), and tvlv_att_def.

Referenced by bssgp_parse_rim_pdu().

## ◆ bssgp_dec_ran_inf_app_cont_nacc()

int bssgp_dec_ran_inf_app_cont_nacc | ( | struct bssgp_ran_inf_app_cont_nacc * | cont,
|  | const uint8_t * | buf,
|  | size_t | len
| ) |  |

Decode a RAN Information Application Container (3GPP TS 48.018, section 11.3.63.2.1).

Parameters

  [out] | user | provided memory for decoded data struct.
  [in] | buf | user provided memory with the encoded value data of the IE.

Returns
  0 on success, -EINVAL on error.

References BSSGP_RIM_PSI_LEN, BSSGP_RIM_SI_LEN, CELL_IDENT_WHOLE_GLOBAL_PS, gsm0808_decode_cell_id_u(), len(), bssgp_ran_inf_app_cont_nacc::num_si, REP_CELL_ID_LEN, bssgp_ran_inf_app_cont_nacc::reprt_cell, bssgp_ran_inf_app_cont_nacc::si, and bssgp_ran_inf_app_cont_nacc::type_psi.

Referenced by bssgp_dec_ran_inf_rim_cont().

## ◆ bssgp_dec_ran_inf_app_err_rim_cont()

int bssgp_dec_ran_inf_app_err_rim_cont | ( | struct bssgp_ran_inf_app_err_rim_cont * | cont,
|  | const uint8_t * | buf,
|  | size_t | len
| ) |  |

Decode a RAN Information Application Error RIM Container (3GPP TS 48.018, table 11.3.62a.5.b).

Parameters

  [out] | user | provided memory for decoded data struct.
  [in] | buf | user provided memory with the encoded value data of the IE.

Returns
  0 on success, -EINVAL on error.

References bssgp_ran_inf_app_err_rim_cont::app_err_cont_nacc, bssgp_ran_inf_app_err_rim_cont::app_id, bssgp_dec_app_err_cont_nacc(), BSSGP_IE_APP_ERROR_CONTAINER, BSSGP_RAN_INF_APP_ID_MBMS, BSSGP_RAN_INF_APP_ID_NACC, BSSGP_RAN_INF_APP_ID_SI3, BSSGP_RAN_INF_APP_ID_SON, BSSGP_RAN_INF_APP_ID_UTRA_SI, dec_rim_cont_common(), len(), tlv_parse(), TLVP_LEN, TLVP_VAL, tvlv_att_def, and bssgp_ran_inf_app_err_rim_cont::u.

Referenced by bssgp_parse_rim_pdu().

## ◆ bssgp_dec_ran_inf_err_rim_cont()

int bssgp_dec_ran_inf_err_rim_cont | ( | struct bssgp_ran_inf_err_rim_cont * | cont,
|  | const uint8_t * | buf,
|  | size_t | len
| ) |  |

Decode a RAN Information Error RIM Container (3GPP TS 48.018, table 11.3.62a.4.b).

Parameters

  [out] | user | provided memory for decoded data struct.
  [in] | buf | user provided memory with the encoded value data of the IE.

Returns
  0 on success, -EINVAL on error.

References bssgp_ran_inf_err_rim_cont::app_id, BSSGP_IE_CAUSE, BSSGP_IE_PDU_IN_ERROR, BSSGP_IE_RIM_APP_IDENTITY, BSSGP_IE_RIM_PROTOCOL_VERSION, BSSGP_IE_SON_TRANSFER_APP_ID, bssgp_ran_inf_err_rim_cont::cause, bssgp_ran_inf_err_rim_cont::err_pdu, bssgp_ran_inf_err_rim_cont::err_pdu_len, len(), bssgp_ran_inf_err_rim_cont::prot_ver, bssgp_ran_inf_err_rim_cont::son_trans_app_id, bssgp_ran_inf_err_rim_cont::son_trans_app_id_len, tlv_parse(), TLVP_LEN, TLVP_PRES_LEN, TLVP_PRESENT, TLVP_VAL, and tvlv_att_def.

Referenced by bssgp_parse_rim_pdu().

## ◆ bssgp_dec_ran_inf_req_app_cont_nacc()

int bssgp_dec_ran_inf_req_app_cont_nacc | ( | struct bssgp_ran_inf_req_app_cont_nacc * | cont,
|  | const uint8_t * | buf,
|  | size_t | len
| ) |  |

Decode a RAN Information Request Application Container for NACC (3GPP TS 48.018, section 11.3.63.1.1).

Parameters

  [out] | user | provided memory for decoded data struct.
  [in] | buf | user provided memory with the encoded value data of the IE.

Returns
  0 on success, -EINVAL on error.

References CELL_IDENT_WHOLE_GLOBAL_PS, gsm0808_decode_cell_id_u(), len(), REP_CELL_ID_LEN, and bssgp_ran_inf_req_app_cont_nacc::reprt_cell.

Referenced by bssgp_dec_ran_inf_req_rim_cont().

## ◆ bssgp_dec_ran_inf_req_rim_cont()

int bssgp_dec_ran_inf_req_rim_cont | ( | struct bssgp_ran_inf_req_rim_cont * | cont,
|  | const uint8_t * | buf,
|  | size_t | len
| ) |  |

Decode a RAN Information Request RIM Container (3GPP TS 48.018, table 11.3.62a.1.b).

Parameters

  [out] | user | provided memory for decoded data struct.
  [in] | buf | user provided memory with the encoded value data of the IE.

Returns
  0 on success, -EINVAL on error.

References bssgp_ran_inf_req_rim_cont::app_cont_nacc, bssgp_ran_inf_req_rim_cont::app_id, bssgp_dec_ran_inf_req_app_cont_nacc(), BSSGP_IE_RIM_REQ_APP_CONTAINER, BSSGP_IE_SON_TRANSFER_APP_ID, BSSGP_RAN_INF_APP_ID_MBMS, BSSGP_RAN_INF_APP_ID_NACC, BSSGP_RAN_INF_APP_ID_SI3, BSSGP_RAN_INF_APP_ID_SON, BSSGP_RAN_INF_APP_ID_UTRA_SI, dec_rim_cont_common(), len(), bssgp_ran_inf_req_rim_cont::son_trans_app_id, bssgp_ran_inf_req_rim_cont::son_trans_app_id_len, tlv_parse(), TLVP_LEN, TLVP_PRES_LEN, TLVP_PRESENT, TLVP_VAL, tvlv_att_def, and bssgp_ran_inf_req_rim_cont::u.

Referenced by bssgp_parse_rim_pdu().

## ◆ bssgp_dec_ran_inf_rim_cont()

int bssgp_dec_ran_inf_rim_cont | ( | struct bssgp_ran_inf_rim_cont * | cont,
|  | const uint8_t * | buf,
|  | size_t | len
| ) |  |

Decode a RAN Information RIM Container (3GPP TS 48.018, table 11.3.62a.2.b).

Parameters

  [out] | user | provided memory for decoded data struct.
  [in] | buf | user provided memory with the encoded value data of the IE.

Returns
  0 on success, -EINVAL on error.

References bssgp_ran_inf_rim_cont::app_cont_nacc, bssgp_ran_inf_rim_cont::app_err, bssgp_ran_inf_rim_cont::app_err_cont_nacc, bssgp_ran_inf_rim_cont::app_id, bssgp_dec_app_err_cont_nacc(), bssgp_dec_ran_inf_app_cont_nacc(), BSSGP_IE_APP_ERROR_CONTAINER, BSSGP_IE_RAN_INFO_APP_CONTAINER, BSSGP_IE_SON_TRANSFER_APP_ID, BSSGP_RAN_INF_APP_ID_MBMS, BSSGP_RAN_INF_APP_ID_NACC, BSSGP_RAN_INF_APP_ID_SI3, BSSGP_RAN_INF_APP_ID_SON, BSSGP_RAN_INF_APP_ID_UTRA_SI, dec_rim_cont_common(), len(), bssgp_ran_inf_rim_cont::son_trans_app_id, bssgp_ran_inf_rim_cont::son_trans_app_id_len, tlv_parse(), TLVP_LEN, TLVP_PRES_LEN, TLVP_PRESENT, TLVP_VAL, tvlv_att_def, and bssgp_ran_inf_rim_cont::u.

Referenced by bssgp_parse_rim_pdu().

## ◆ bssgp_enc_app_err_cont_nacc()

int bssgp_enc_app_err_cont_nacc | ( | uint8_t * | buf,
|  | size_t | len,
|  | const struct bssgp_app_err_cont_nacc * | cont
| ) |  |

Encode Application Error Container for NACC (3GPP TS 48.018, section 11.3.64.1).

Parameters

  [out] | buf | user provided memory for the generated value part of the IE.
  [in] | cont | user provided input data struct.

Returns
  length of encoded octets, -EINVAL on error.

References bssgp_app_err_cont_nacc::err_app_cont, bssgp_app_err_cont_nacc::err_app_cont_len, and bssgp_app_err_cont_nacc::nacc_cause.

Referenced by bssgp_enc_ran_inf_app_err_rim_cont(), and bssgp_enc_ran_inf_rim_cont().

## ◆ bssgp_enc_ran_inf_ack_rim_cont()

int bssgp_enc_ran_inf_ack_rim_cont | ( | uint8_t * | buf,
|  | size_t | len,
|  | const struct bssgp_ran_inf_ack_rim_cont * | cont
| ) |  |

Encode a RAN Information ACK RIM Container (3GPP TS 48.018, table 11.3.62a.3.b).

Parameters

  [out] | buf | user provided memory for the generated value part of the IE.
  [in] | cont | user provided input data struct.

Returns
  length of encoded octets, -EINVAL on error.

References bssgp_ran_inf_ack_rim_cont::app_id, BSSGP_IE_RIM_APP_IDENTITY, BSSGP_IE_RIM_PROTOCOL_VERSION, BSSGP_IE_RIM_SEQ_NR, BSSGP_IE_SON_TRANSFER_APP_ID, len(), osmo_htonl, bssgp_ran_inf_ack_rim_cont::prot_ver, bssgp_ran_inf_ack_rim_cont::seq_num, bssgp_ran_inf_ack_rim_cont::son_trans_app_id, bssgp_ran_inf_ack_rim_cont::son_trans_app_id_len, TVLV_HDR_MAXLEN, and tvlv_put().

Referenced by bssgp_encode_rim_pdu().

## ◆ bssgp_enc_ran_inf_app_cont_nacc()

int bssgp_enc_ran_inf_app_cont_nacc | ( | uint8_t * | buf,
|  | size_t | len,
|  | const struct bssgp_ran_inf_app_cont_nacc * | cont
| ) |  |

Encode a RAN Information Application Container (3GPP TS 48.018, section 11.3.63.2.1).

Parameters

  [out] | buf | user provided memory for the generated value part of the IE.
  [in] | cont | user provided input data struct.

Returns
  length of encoded octets, -EINVAL on error.

References bssgp_create_cell_id(), BSSGP_RIM_PSI_LEN, BSSGP_RIM_SI_LEN, osmo_cell_global_id_ps::cell_identity, bssgp_ran_inf_app_cont_nacc::num_si, osmo_cell_global_id_ps::rai, bssgp_ran_inf_app_cont_nacc::reprt_cell, bssgp_ran_inf_app_cont_nacc::si, and bssgp_ran_inf_app_cont_nacc::type_psi.

Referenced by bssgp_enc_ran_inf_rim_cont().

## ◆ bssgp_enc_ran_inf_app_err_rim_cont()

int bssgp_enc_ran_inf_app_err_rim_cont | ( | uint8_t * | buf,
|  | size_t | len,
|  | const struct bssgp_ran_inf_app_err_rim_cont * | cont
| ) |  |

Encode a RAN Information Application Error RIM Container (3GPP TS 48.018, table 11.3.62a.5.b).

Parameters

  [out] | buf | user provided memory for the generated value part of the IE.
  [in] | cont | user provided input data struct.

Returns
  length of encoded octets, -EINVAL on error.

References bssgp_ran_inf_app_err_rim_cont::app_err_cont_nacc, bssgp_ran_inf_app_err_rim_cont::app_id, bssgp_enc_app_err_cont_nacc(), BSSGP_IE_APP_ERROR_CONTAINER, BSSGP_RAN_INF_APP_ID_MBMS, BSSGP_RAN_INF_APP_ID_NACC, BSSGP_RAN_INF_APP_ID_SI3, BSSGP_RAN_INF_APP_ID_SON, BSSGP_RAN_INF_APP_ID_UTRA_SI, dub_tlvp_header(), enc_rim_cont_common(), len(), TVLV_HDR_LEN, TVLV_HDR_MAXLEN, and bssgp_ran_inf_app_err_rim_cont::u.

Referenced by bssgp_encode_rim_pdu().

## ◆ bssgp_enc_ran_inf_err_rim_cont()

int bssgp_enc_ran_inf_err_rim_cont | ( | uint8_t * | buf,
|  | size_t | len,
|  | const struct bssgp_ran_inf_err_rim_cont * | cont
| ) |  |

Encode a RAN Information Error RIM Container (3GPP TS 48.018, table 11.3.62a.4.b).

Parameters

  [out] | buf | user provided memory for the generated value part of the IE.
  [in] | cont | user provided input data struct.

Returns
  length of encoded octets, -EINVAL on error.

References bssgp_ran_inf_err_rim_cont::app_id, BSSGP_IE_CAUSE, BSSGP_IE_PDU_IN_ERROR, BSSGP_IE_RIM_APP_IDENTITY, BSSGP_IE_RIM_PROTOCOL_VERSION, BSSGP_IE_SON_TRANSFER_APP_ID, bssgp_ran_inf_err_rim_cont::cause, bssgp_ran_inf_err_rim_cont::err_pdu, bssgp_ran_inf_err_rim_cont::err_pdu_len, len(), bssgp_ran_inf_err_rim_cont::prot_ver, bssgp_ran_inf_err_rim_cont::son_trans_app_id, bssgp_ran_inf_err_rim_cont::son_trans_app_id_len, TVLV_HDR_MAXLEN, and tvlv_put().

Referenced by bssgp_encode_rim_pdu().

## ◆ bssgp_enc_ran_inf_req_app_cont_nacc()

int bssgp_enc_ran_inf_req_app_cont_nacc | ( | uint8_t * | buf,
|  | size_t | len,
|  | const struct bssgp_ran_inf_req_app_cont_nacc * | cont
| ) |  |

Encode a RAN Information Request Application Container for NACC (3GPP TS 48.018, section 11.3.63.1.1).

Parameters

  [out] | buf | user provided memory for the generated value part of the IE.
  [in] | cont | user provided input data struct.

Returns
  length of encoded octets, -EINVAL on error.

References bssgp_create_cell_id(), osmo_cell_global_id_ps::cell_identity, len(), osmo_cell_global_id_ps::rai, REP_CELL_ID_LEN, and bssgp_ran_inf_req_app_cont_nacc::reprt_cell.

Referenced by bssgp_enc_ran_inf_req_rim_cont().

## ◆ bssgp_enc_ran_inf_req_rim_cont()

int bssgp_enc_ran_inf_req_rim_cont | ( | uint8_t * | buf,
|  | size_t | len,
|  | const struct bssgp_ran_inf_req_rim_cont * | cont
| ) |  |

Encode a RAN Information Request RIM Container (3GPP TS 48.018, table 11.3.62a.1.b).

Parameters

  [out] | buf | user provided memory for the generated value part of the IE.
  [in] | cont | user provided input data struct.

Returns
  length of encoded octets, -EINVAL on error.

References bssgp_ran_inf_req_rim_cont::app_cont_nacc, bssgp_ran_inf_req_rim_cont::app_id, bssgp_enc_ran_inf_req_app_cont_nacc(), BSSGP_IE_RIM_REQ_APP_CONTAINER, BSSGP_IE_SON_TRANSFER_APP_ID, BSSGP_RAN_INF_APP_ID_MBMS, BSSGP_RAN_INF_APP_ID_NACC, BSSGP_RAN_INF_APP_ID_SI3, BSSGP_RAN_INF_APP_ID_SON, BSSGP_RAN_INF_APP_ID_UTRA_SI, dub_tlvp_header(), enc_rim_cont_common(), len(), bssgp_ran_inf_req_rim_cont::son_trans_app_id, bssgp_ran_inf_req_rim_cont::son_trans_app_id_len, TVLV_HDR_LEN, TVLV_HDR_MAXLEN, tvlv_put(), and bssgp_ran_inf_req_rim_cont::u.

Referenced by bssgp_encode_rim_pdu().

## ◆ bssgp_enc_ran_inf_rim_cont()

int bssgp_enc_ran_inf_rim_cont | ( | uint8_t * | buf,
|  | size_t | len,
|  | const struct bssgp_ran_inf_rim_cont * | cont
| ) |  |

Encode a RAN Information RIM Container (3GPP TS 48.018, table 11.3.62a.2.b).

Parameters

  [out] | buf | user provided memory for the generated value part of the IE.
  [in] | cont | user provided input data struct.

Returns
  length of encoded octets, -EINVAL on error.

References bssgp_ran_inf_rim_cont::app_cont_nacc, bssgp_ran_inf_rim_cont::app_err, bssgp_ran_inf_rim_cont::app_err_cont_nacc, bssgp_ran_inf_rim_cont::app_id, bssgp_enc_app_err_cont_nacc(), bssgp_enc_ran_inf_app_cont_nacc(), BSSGP_IE_APP_ERROR_CONTAINER, BSSGP_IE_RAN_INFO_APP_CONTAINER, BSSGP_IE_SON_TRANSFER_APP_ID, BSSGP_RAN_INF_APP_ID_MBMS, BSSGP_RAN_INF_APP_ID_NACC, BSSGP_RAN_INF_APP_ID_SI3, BSSGP_RAN_INF_APP_ID_SON, BSSGP_RAN_INF_APP_ID_UTRA_SI, dub_tlvp_header(), enc_rim_cont_common(), len(), bssgp_ran_inf_rim_cont::son_trans_app_id, bssgp_ran_inf_rim_cont::son_trans_app_id_len, TVLV_HDR_LEN, TVLV_HDR_MAXLEN, tvlv_put(), and bssgp_ran_inf_rim_cont::u.

Referenced by bssgp_encode_rim_pdu().

## ◆ bssgp_encode_rim_pdu()

struct msgb * bssgp_encode_rim_pdu | ( | const struct bssgp_ran_information_pdu * | pdu | ) |

Encode a given rim-pdu struct into a message buffer.

Parameters

  [out] | pdu | user provided memory that contains the RAN INFORMATION PDU to encode.

Returns
  BSSGP message buffer on sccess, NULL on error.

References bssgp_ran_information_pdu::ack_rim_cont, bssgp_ran_information_pdu::app_err_rim_cont, bssgp_create_rim_ri(), bssgp_enc_ran_inf_ack_rim_cont(), bssgp_enc_ran_inf_app_err_rim_cont(), bssgp_enc_ran_inf_err_rim_cont(), bssgp_enc_ran_inf_req_rim_cont(), bssgp_enc_ran_inf_rim_cont(), BSSGP_IE_RI_ACK_RIM_CONTAINER, BSSGP_IE_RI_APP_ERROR_RIM_CONT, BSSGP_IE_RI_ERROR_RIM_COINTAINER, BSSGP_IE_RI_REQ_RIM_CONTAINER, BSSGP_IE_RI_RIM_CONTAINER, BSSGP_IE_RIM_ROUTING_INFO, bssgp_msgb_alloc(), BSSGP_PDUT_RAN_INFO, BSSGP_PDUT_RAN_INFO_ACK, BSSGP_PDUT_RAN_INFO_APP_ERROR, BSSGP_PDUT_RAN_INFO_ERROR, BSSGP_PDUT_RAN_INFO_REQ, BSSGP_RIM_ROUTING_INFO_MAXLEN, bssgp_ran_information_pdu::decoded, bssgp_ran_information_pdu::decoded_present, bssgp_ran_information_pdu::err_rim_cont, msg, msgb_free(), msgb_put(), msgb_tvlv_put(), OSMO_ASSERT, bssgp_normal_hdr::pdu_type, bssgp_ran_information_pdu::req_rim_cont, bssgp_ran_information_pdu::rim_cont, bssgp_ran_information_pdu::rim_cont_iei, bssgp_ran_information_pdu::rim_cont_len, bssgp_ran_information_pdu::routing_info_dest, and bssgp_ran_information_pdu::routing_info_src.

Referenced by bssgp_tx_rim().

## ◆ bssgp_parse_rim_pdu()

int bssgp_parse_rim_pdu | ( | struct bssgp_ran_information_pdu * | pdu,
|  | const struct msgb * | msg
| ) |  |

Parse a given message buffer into a rim-pdu struct.

Parameters

  [out] | pdu | user provided memory for the resulting RAN INFORMATION PDU.
  [in] | msg | BSSGP message buffer that contains the encoded RAN INFORMATION PDU.

Returns
  0 on sccess, -EINVAL on error.

References bssgp_ran_information_pdu::ack_rim_cont, bssgp_ran_information_pdu::app_err_rim_cont, ARRAY_SIZE, bssgp_dec_ran_inf_ack_rim_cont(), bssgp_dec_ran_inf_app_err_rim_cont(), bssgp_dec_ran_inf_err_rim_cont(), bssgp_dec_ran_inf_req_rim_cont(), bssgp_dec_ran_inf_rim_cont(), BSSGP_IE_RI_ACK_RIM_CONTAINER, BSSGP_IE_RI_APP_ERROR_RIM_CONT, BSSGP_IE_RI_ERROR_RIM_COINTAINER, BSSGP_IE_RI_REQ_RIM_CONTAINER, BSSGP_IE_RI_RIM_CONTAINER, BSSGP_IE_RIM_ROUTING_INFO, bssgp_parse_rim_ri(), bssgp_normal_hdr::data, bssgp_ran_information_pdu::decoded, bssgp_ran_information_pdu::decoded_present, DLBSSGP, bssgp_ran_information_pdu::err_rim_cont, LOGL_DEBUG, LOGL_ERROR, LOGP, msg, msgb_bssgp_len, msgb_bssgph, msgb_nsei, nsei, osmo_pdef_bssgp, osmo_tlv_prot_parse(), bssgp_normal_hdr::pdu_type, bssgp_ran_information_pdu::req_rim_cont, bssgp_ran_information_pdu::rim_cont, bssgp_ran_information_pdu::rim_cont_iei, bssgp_ran_information_pdu::rim_cont_len, bssgp_ran_information_pdu::routing_info_dest, bssgp_ran_information_pdu::routing_info_src, TLVP_LEN, TLVP_PRESENT, and TLVP_VAL.

Referenced by bssgp_rx_rim().

## ◆ bssgp_parse_rim_ra()

int bssgp_parse_rim_ra | ( | struct bssgp_rim_routing_info * | ri,
|  | const uint8_t * | buf,
|  | unsigned int | len,
|  | uint8_t | discr
| ) |  |

Parse a RIM Routing address IE (3GPP TS 29.060, chapter 7.7.57 and 7.7.77).

Parameters

  [out] | ri | user provided memory to store the parsed results.
  [in] | buf | input buffer of the value part of the RIM Routing address IE. \discr[in] discr value part (one byte) of the RIM Routing Address Discriminator IE.

Returns
  length of parsed octets, -EINVAL on error.

References bssgp_parse_cell_id(), BSSGP_RIM_ROUTING_INFO_EUTRAN, BSSGP_RIM_ROUTING_INFO_GERAN, BSSGP_RIM_ROUTING_INFO_UTRAN, bssgp_rim_routing_info::cid, bssgp_rim_routing_info::discr, bssgp_rim_routing_info::eutran, bssgp_rim_routing_info::geran, bssgp_rim_routing_info::global_enb_id, bssgp_rim_routing_info::global_enb_id_len, gsm48_parse_ra(), len(), gprs_ra_id::mcc, osmo_eutran_tai::mcc, gprs_ra_id::mnc, osmo_eutran_tai::mnc, gprs_ra_id::mnc_3_digits, osmo_eutran_tai::mnc_3_digits, bssgp_rim_routing_info::raid, bssgp_rim_routing_info::rncid, osmo_eutran_tai::tac, bssgp_rim_routing_info::tai, and bssgp_rim_routing_info::utran.

Referenced by bssgp_parse_rim_ri().

## ◆ bssgp_parse_rim_ri()

int bssgp_parse_rim_ri | ( | struct bssgp_rim_routing_info * | ri,
|  | const uint8_t * | buf,
|  | unsigned int | len
| ) |  |

Parse a RIM Routing information IE (3GPP TS 48.018, chapter 11.3.70).

Parameters

  [out] | ri | user provided memory to store the parsed results.
  [in] | buf | input buffer of the value part of the IE.

Returns
  length of parsed octets, -EINVAL on error.

References bssgp_parse_rim_ra(), and len().

Referenced by bssgp_parse_rim_pdu().

## ◆ bssgp_rim_ri_name()

const char * bssgp_rim_ri_name | ( | const struct bssgp_rim_routing_info * | ri | ) |

Encode a RIM Routing information into a human readable string.

Parameters

  [in] | ri | user provided input data struct.

Returns
  pointer to the resulting string.

References bssgp_rim_ri_name_buf().

## ◆ bssgp_rim_ri_name_buf()

char * bssgp_rim_ri_name_buf | ( | char * | buf,
|  | size_t | buf_len,
|  | const struct bssgp_rim_routing_info * | ri
| ) |  |

Encode a RIM Routing information into a human readable string.

Parameters

  | [buf] | user provided string buffer to store the resulting string.
  | [buf_len] | maximum length of string buffer.
  [in] | ri | user provided input data struct.

Returns
  pointer to the beginning of the resulting string stored in string buffer.

References bssgp_rim_routing_info_discr_str(), BSSGP_RIM_ROUTING_INFO_EUTRAN, BSSGP_RIM_ROUTING_INFO_GERAN, BSSGP_RIM_ROUTING_INFO_UTRAN, osmo_cell_global_id_ps::cell_identity, bssgp_rim_routing_info::cid, bssgp_rim_routing_info::discr, bssgp_rim_routing_info::eutran, bssgp_rim_routing_info::geran, bssgp_rim_routing_info::global_enb_id, bssgp_rim_routing_info::global_enb_id_len, gprs_ra_id::lac, osmo_location_area_id::lac, osmo_routing_area_id::lac, gprs_ra_id::mcc, osmo_plmn_id::mcc, osmo_eutran_tai::mcc, gprs_ra_id::mnc, osmo_plmn_id::mnc, osmo_eutran_tai::mnc, gprs_ra_id::mnc_3_digits, osmo_plmn_id::mnc_3_digits, osmo_eutran_tai::mnc_3_digits, osmo_cgi_ps_name_buf(), osmo_hexdump_buf(), osmo_plmn_name_buf(), osmo_location_area_id::plmn, gprs_ra_id::rac, osmo_routing_area_id::rac, osmo_cell_global_id_ps::rai, bssgp_rim_routing_info::raid, bssgp_rim_routing_info::rncid, osmo_eutran_tai::tac, bssgp_rim_routing_info::tai, and bssgp_rim_routing_info::utran.

Referenced by bssgp_rim_ri_name(), bssgp_rx_rim(), and bssgp_tx_rim().

## ◆ bssgp_rx_rim()

int bssgp_rx_rim | ( | struct msgb * | msg,
|  | struct tlv_parsed * | tp,
|  | uint16_t | bvci
| ) |  |

References BSSGP_CAUSE_MISSING_MAND_IE, bssgp_parse_rim_pdu(), bssgp_pdu_str(), BSSGP_PDUT_RAN_INFO, BSSGP_PDUT_RAN_INFO_ACK, BSSGP_PDUT_RAN_INFO_APP_ERROR, BSSGP_PDUT_RAN_INFO_ERROR, BSSGP_PDUT_RAN_INFO_REQ, bssgp_prim_cb(), bssgp_rim_ri_name_buf(), bssgp_tx_status(), osmo_bssgp_prim::bvci, bvci, DEBUGP, DLBSSGP, msg, msgb_bssgph, msgb_nsei, osmo_bssgp_prim::nsei, nsei, osmo_bssgp_prim::oph, OSMO_ASSERT, osmo_prim_init(), bssgp_normal_hdr::pdu_type, PRIM_BSSGP_RIM_PDU_TRANSFER, PRIM_OP_INDICATION, osmo_bssgp_prim::rim_pdu, bssgp_ran_information_pdu::routing_info_dest, bssgp_ran_information_pdu::routing_info_src, SAP_BSSGP_RIM, osmo_bssgp_prim::tp, and osmo_bssgp_prim::u.

Referenced by bssgp_rx_sign().

## ◆ bssgp_tx_rim()

int bssgp_tx_rim | ( | const struct bssgp_ran_information_pdu * | pdu,
|  | uint16_t | nsei
| ) |  |

Send RIM RAN INFORMATION REQUEST via BSSGP (3GPP TS 48.018, section 10.6.1).

Parameters

  [in] | pdu | user provided memory for the RAN INFORMATION PDU to be sent.
  [in] | nsei | BSSGP network service entity identifier (NSEI).

Returns
  0 on sccess, -EINVAL on error.

References bssgp_encode_rim_pdu(), bssgp_ns_send, bssgp_ns_send_data, bssgp_pdu_str(), bssgp_rim_ri_name_buf(), DEBUGP, DLBSSGP, LOGL_ERROR, LOGP, msg, msgb_bssgph, msgb_bvci, msgb_nsei, nsei, bssgp_normal_hdr::pdu_type, bssgp_ran_information_pdu::routing_info_dest, and bssgp_ran_information_pdu::routing_info_src.

## ◆ bssgp_tx_rim_encoded()

int bssgp_tx_rim_encoded | ( | struct msgb * | msg,
|  | uint16_t | nsei
| ) |  |

Send encoded RAN TRANSPARENT CONTAINER via BSSGP (3GPP TS 29.060, section 7.7.43).

Parameters

  [in] | msg | user provided memory for the encoded RAN TRANSPARENT CONTAINER to be sent. (this function will take ownership of msg).
  [in] | nsei | BSSGP network service entity identifier (NSEI).

Returns
  0 on sccess, -EINVAL on error.

References bssgp_ns_send, bssgp_ns_send_data, bssgp_pdu_str(), DEBUGP, DLBSSGP, msg, msgb_bssgph, msgb_bvci, msgb_nsei, nsei, and bssgp_normal_hdr::pdu_type.

## ◆ dec_rim_cont_common()

static int dec_rim_cont_common | ( | struct bssgp_ran_inf_x_cont * | cont,
|  | struct tlv_parsed * | tp
| ) |  |
| static

References bssgp_ran_inf_x_cont::app_id, BSSGP_IE_RIM_APP_IDENTITY, BSSGP_IE_RIM_PDU_INDICATIONS, BSSGP_IE_RIM_PROTOCOL_VERSION, BSSGP_IE_RIM_SEQ_NR, bssgp_ran_inf_x_cont::pdu_ind, bssgp_ran_inf_x_cont::prot_ver, bssgp_ran_inf_x_cont::seq_num, TLVP_PRES_LEN, TLVP_VAL, and tlvp_val32be().

Referenced by bssgp_dec_ran_inf_app_err_rim_cont(), bssgp_dec_ran_inf_req_rim_cont(), and bssgp_dec_ran_inf_rim_cont().

## ◆ dub_tlvp_header()

static uint8_t * dub_tlvp_header | ( | uint8_t * | buf,
|  | uint8_t | iei,
|  | uint16_t | len
| ) |  |
| static

References iei, len(), TVLV_HDR_LEN, TVLV_HDR_MAXLEN, and TVLV_MAX_ONEBYTE.

Referenced by bssgp_enc_ran_inf_app_err_rim_cont(), bssgp_enc_ran_inf_req_rim_cont(), and bssgp_enc_ran_inf_rim_cont().

## ◆ enc_rim_cont_common()

static uint8_t * enc_rim_cont_common | ( | uint8_t * | buf,
|  | size_t | len,
|  | const struct bssgp_ran_inf_x_cont * | cont
| ) |  |
| static

References bssgp_ran_inf_x_cont::app_id, BSSGP_IE_RIM_APP_IDENTITY, BSSGP_IE_RIM_PDU_INDICATIONS, BSSGP_IE_RIM_PROTOCOL_VERSION, BSSGP_IE_RIM_SEQ_NR, len(), osmo_htonl, bssgp_ran_inf_x_cont::pdu_ind, bssgp_ran_inf_x_cont::prot_ver, bssgp_ran_inf_x_cont::seq_num, TVLV_HDR_MAXLEN, and tvlv_put().

Referenced by bssgp_enc_ran_inf_app_err_rim_cont(), bssgp_enc_ran_inf_req_rim_cont(), and bssgp_enc_ran_inf_rim_cont().

## Variable Documentation

## ◆ bssgp_nacc_cause_strs

const struct value_string bssgp_nacc_cause_strs[]

Initial value:
= {
{ BSSGP_NACC_CAUSE_UNSPEC, "unspecified error" },
{ BSSGP_NACC_CAUSE_SYNTAX_ERR, "syntax error in app container" },
{ BSSGP_NACC_CAUSE_RPRT_CELL_MISSMTCH, "reporting cell id mismatch" },
{ BSSGP_NACC_CAUSE_SIPSI_TYPE_ERR, "SI/PSI type error" },
{ BSSGP_NACC_CAUSE_SIPSI_LEN_ERR, "SI/PSI inconsistent length" },
{ BSSGP_NACC_CAUSE_SIPSI_SET_ERR, "inconsistent set of msg" },
{ 0, NULL }
}
BSSGP_NACC_CAUSE_SIPSI_LEN_ERR
@ BSSGP_NACC_CAUSE_SIPSI_LEN_ERR
Definition: gprs_bssgp_rim.h:106
BSSGP_NACC_CAUSE_RPRT_CELL_MISSMTCH
@ BSSGP_NACC_CAUSE_RPRT_CELL_MISSMTCH
Definition: gprs_bssgp_rim.h:104
BSSGP_NACC_CAUSE_SYNTAX_ERR
@ BSSGP_NACC_CAUSE_SYNTAX_ERR
Definition: gprs_bssgp_rim.h:103
BSSGP_NACC_CAUSE_UNSPEC
@ BSSGP_NACC_CAUSE_UNSPEC
Definition: gprs_bssgp_rim.h:102
BSSGP_NACC_CAUSE_SIPSI_TYPE_ERR
@ BSSGP_NACC_CAUSE_SIPSI_TYPE_ERR
Definition: gprs_bssgp_rim.h:105
BSSGP_NACC_CAUSE_SIPSI_SET_ERR
@ BSSGP_NACC_CAUSE_SIPSI_SET_ERR
Definition: gprs_bssgp_rim.h:107

Referenced by bssgp_nacc_cause_str().

## ◆ bssgp_ran_inf_app_id_strs

const struct value_string bssgp_ran_inf_app_id_strs[]

Initial value:
= {
{ BSSGP_RAN_INF_APP_ID_NACC, "Network Assisted Cell Change (NACC)" },
{ BSSGP_RAN_INF_APP_ID_SI3, "System Information 3 (SI3)" },
{ BSSGP_RAN_INF_APP_ID_MBMS, "MBMS data channel" },
{ BSSGP_RAN_INF_APP_ID_SON, "SON Transfer" },
{ BSSGP_RAN_INF_APP_ID_UTRA_SI, "UTRA System Information (UTRA SI)" },
{ 0, NULL }
}
BSSGP_RAN_INF_APP_ID_MBMS
@ BSSGP_RAN_INF_APP_ID_MBMS
Definition: gprs_bssgp_rim.h:132
BSSGP_RAN_INF_APP_ID_UTRA_SI
@ BSSGP_RAN_INF_APP_ID_UTRA_SI
Definition: gprs_bssgp_rim.h:134
BSSGP_RAN_INF_APP_ID_SI3
@ BSSGP_RAN_INF_APP_ID_SI3
Definition: gprs_bssgp_rim.h:131
BSSGP_RAN_INF_APP_ID_SON
@ BSSGP_RAN_INF_APP_ID_SON
Definition: gprs_bssgp_rim.h:133
BSSGP_RAN_INF_APP_ID_NACC
@ BSSGP_RAN_INF_APP_ID_NACC
Definition: gprs_bssgp_rim.h:130

Referenced by bssgp_ran_inf_app_id_str().

## ◆ bssgp_rim_routing_info_discr_strs

const struct value_string bssgp_rim_routing_info_discr_strs[]

Initial value:
= {
{ BSSGP_RIM_ROUTING_INFO_GERAN, "GERAN-cell" },
{ BSSGP_RIM_ROUTING_INFO_UTRAN, "UTRAN-RNC" },
{ BSSGP_RIM_ROUTING_INFO_EUTRAN, "E-UTRAN-eNodeB/HeNB" },
{ 0, NULL }
}
BSSGP_RIM_ROUTING_INFO_UTRAN
@ BSSGP_RIM_ROUTING_INFO_UTRAN
Definition: gprs_bssgp_rim.h:34
BSSGP_RIM_ROUTING_INFO_EUTRAN
@ BSSGP_RIM_ROUTING_INFO_EUTRAN
Definition: gprs_bssgp_rim.h:35
BSSGP_RIM_ROUTING_INFO_GERAN
@ BSSGP_RIM_ROUTING_INFO_GERAN
Definition: gprs_bssgp_rim.h:33

Referenced by bssgp_rim_routing_info_discr_str().