libosmogb 1.9.0.192-1c24
Osmocom Gb library
gprs_bssgp2.c File Reference

Functions

int bssgp2_nsi_tx_ptp (struct gprs_ns2_inst *nsi, uint16_t nsei, uint16_t bvci, struct msgb *msg, uint32_t lsp)
 transmit BSSGP PDU over NS (PTP BVC) More...
 
int bssgp2_nsi_tx_sig (struct gprs_ns2_inst *nsi, uint16_t nsei, struct msgb *msg, uint32_t lsp)
 transmit BSSGP PDU over NS (SIGNALING BVC) More...
 
struct msgbbssgp2_enc_bvc_block (uint16_t bvci, enum gprs_bssgp_cause cause)
 Encode BSSGP BVC-BLOCK PDU as per TS 48.018 Section 10.4.8. More...
 
struct msgbbssgp2_enc_bvc_block_ack (uint16_t bvci)
 Encode BSSGP BVC-BLOCK-ACK PDU as per TS 48.018 Section 10.4.9. More...
 
struct msgbbssgp2_enc_bvc_unblock (uint16_t bvci)
 Encode BSSGP BVC-UNBLOCK PDU as per TS 48.018 Section 10.4.10. More...
 
struct msgbbssgp2_enc_bvc_unblock_ack (uint16_t bvci)
 Encode BSSGP BVC-UNBLOCK-ACK PDU as per TS 48.018 Section 10.4.11. More...
 
struct msgbbssgp2_enc_bvc_reset (uint16_t bvci, enum gprs_bssgp_cause cause, const struct gprs_ra_id *ra_id, uint16_t cell_id, const uint8_t *feat_bm, const uint8_t *ext_feat_bm)
 Encode BSSGP BVC-RESET PDU as per TS 48.018 Section 10.4.12. More...
 
struct msgbbssgp2_enc_bvc_reset_ack (uint16_t bvci, const struct gprs_ra_id *ra_id, uint16_t cell_id, const uint8_t *feat_bm, const uint8_t *ext_feat_bm)
 Encode BSSGP BVC-RESET-ACK PDU as per TS 48.018 Section 10.4.13. More...
 
struct msgbbssgp2_enc_status (uint8_t cause, const uint16_t *bvci, const struct msgb *orig_msg, uint16_t max_pdu_len)
 Encode BSSGP STATUS PDU as per TS 48.018 Section 10.4.14. More...
 
int bssgp2_dec_fc_bvc (struct bssgp2_flow_ctrl *fc, const struct tlv_parsed *tp)
 Decode a FLOW-CONTROL-BVC PDU as per TS 48.018 Section 10.4.4. More...
 
struct msgbbssgp2_enc_fc_bvc (const struct bssgp2_flow_ctrl *fc, enum bssgp_fc_granularity *gran)
 Encode a FLOW-CONTROL-BVC PDU as per TS 48.018 Section 10.4.4. More...
 
struct msgbbssgp2_enc_flush_ll (uint32_t tlli, uint16_t old_bvci, const uint16_t *new_bvci, const uint16_t *nsei)
 Encode BSSGP FLUSH-LL PDU as per TS 48.018 Section 10.4.1. More...
 
struct msgbbssgp2_enc_fc_bvc_ack (uint8_t tag)
 Encode a FLOW-CONTROL-BVC-ACK PDU as per TS 48.018 Section 10.4.4. More...
 
int bssgp2_dec_fc_ms (struct bssgp2_flow_ctrl *fc, struct tlv_parsed *tp)
 Decode a FLOW-CONTROL-MS PDU as per TS 48.018 Section 10.4.6. More...
 
struct msgbbssgp2_enc_fc_ms (const struct bssgp2_flow_ctrl *fc, enum bssgp_fc_granularity *gran)
 Encode a FLOW-CONTROL-MS PDU as per TS 48.018 Section 10.4.6. More...
 
struct msgbbssgp2_enc_fc_ms_ack (uint32_t tlli, uint8_t tag)
 Encode a FLOW-CONTROL-BVC-ACK PDU as per TS 48.018 Section 10.4.7. More...
 

Variables

static const unsigned int bssgp_fc_gran_tbl []
 

Function Documentation

◆ bssgp2_dec_fc_bvc()

◆ bssgp2_dec_fc_ms()

int bssgp2_dec_fc_ms ( struct bssgp2_flow_ctrl fc,
struct tlv_parsed tp 
)

Decode a FLOW-CONTROL-MS PDU as per TS 48.018 Section 10.4.6.

Parameters
[out]fccaller-allocated memory for parsed output
[in]tppre-parsed TLVs; caller must ensure mandatory IE presence/length
Returns
0 on success; negative in case of error

References bssgp_fc_gran_tbl, BSSGP_IE_BUCKET_FULL_RATIO, BSSGP_IE_BUCKET_LEAK_RATE, BSSGP_IE_FLOW_CTRL_GRANULARITY, BSSGP_IE_MS_BUCKET_SIZE, BSSGP_IE_TAG, BSSGP_IE_TLLI, bssgp2_flow_ctrl::bucket_full_ratio, bssgp2_flow_ctrl::bucket_full_ratio_present, bssgp2_flow_ctrl::bucket_leak_rate, bssgp2_flow_ctrl::bucket_size_max, bssgp2_flow_ctrl::ms, bssgp2_flow_ctrl::tag, bssgp2_flow_ctrl::tlli, TLVP_PRESENT, TLVP_VAL, tlvp_val16be(), tlvp_val32be(), and bssgp2_flow_ctrl::u.

◆ bssgp2_enc_bvc_block()

struct msgb * bssgp2_enc_bvc_block ( uint16_t  bvci,
enum gprs_bssgp_cause  cause 
)

◆ bssgp2_enc_bvc_block_ack()

struct msgb * bssgp2_enc_bvc_block_ack ( uint16_t  bvci)

Encode BSSGP BVC-BLOCK-ACK PDU as per TS 48.018 Section 10.4.9.

References BSSGP_IE_BVCI, bssgp_msgb_alloc(), BSSGP_PDUT_BVC_BLOCK_ACK, bvci, msg, msgb_put(), msgb_tvlv_put(), osmo_htons, and bssgp_normal_hdr::pdu_type.

Referenced by bssgp_bvc_fsm_blocked(), and bssgp_bvc_fsm_unblocked().

◆ bssgp2_enc_bvc_reset()

struct msgb * bssgp2_enc_bvc_reset ( uint16_t  bvci,
enum gprs_bssgp_cause  cause,
const struct gprs_ra_id ra_id,
uint16_t  cell_id,
const uint8_t *  feat_bm,
const uint8_t *  ext_feat_bm 
)

Encode BSSGP BVC-RESET PDU as per TS 48.018 Section 10.4.12.

Parameters
[in]bvciPTP BVCI to encode into the BVCI IE
[in]causeBSSGP Cause value (reason for reset)
[in]ra_idRouting Area ID to be encoded to CELL_ID IE (optional)
[in]cell_idCell ID to be encoded to CELL_ID IE (only if ra_id is non-NULL)
[in]feat_bmFeature Bitmap (optional)
[in]ext_feat_bmExtended Feature Bitmap (optional)

References bssgp_create_cell_id(), BSSGP_IE_BVCI, BSSGP_IE_CAUSE, BSSGP_IE_CELL_ID, BSSGP_IE_EXT_FEATURE_BITMAP, BSSGP_IE_FEATURE_BITMAP, bssgp_msgb_alloc(), BSSGP_PDUT_BVC_RESET, bvci, cause, msg, msgb_put(), msgb_tvlv_put(), osmo_htons, bssgp_normal_hdr::pdu_type, and ra_id.

Referenced by _tx_bvc_reset().

◆ bssgp2_enc_bvc_reset_ack()

struct msgb * bssgp2_enc_bvc_reset_ack ( uint16_t  bvci,
const struct gprs_ra_id ra_id,
uint16_t  cell_id,
const uint8_t *  feat_bm,
const uint8_t *  ext_feat_bm 
)

Encode BSSGP BVC-RESET-ACK PDU as per TS 48.018 Section 10.4.13.

Parameters
[in]bvciPTP BVCI to encode into the BVCI IE
[in]ra_idRouting Area ID to be encoded to CELL_ID IE (optional)
[in]cell_idCell ID to be encoded to CELL_ID IE (only if ra_id is non-NULL)
[in]feat_bmFeature Bitmap (optional)
[in]ext_feat_bmExtended Feature Bitmap (optional)

References bssgp_create_cell_id(), BSSGP_IE_BVCI, BSSGP_IE_CELL_ID, BSSGP_IE_EXT_FEATURE_BITMAP, BSSGP_IE_FEATURE_BITMAP, bssgp_msgb_alloc(), BSSGP_PDUT_BVC_RESET_ACK, bvci, msg, msgb_put(), msgb_tvlv_put(), osmo_htons, bssgp_normal_hdr::pdu_type, and ra_id.

Referenced by _tx_bvc_reset_ack().

◆ bssgp2_enc_bvc_unblock()

struct msgb * bssgp2_enc_bvc_unblock ( uint16_t  bvci)

Encode BSSGP BVC-UNBLOCK PDU as per TS 48.018 Section 10.4.10.

References BSSGP_IE_BVCI, bssgp_msgb_alloc(), BSSGP_PDUT_BVC_UNBLOCK, bvci, msg, msgb_put(), msgb_tvlv_put(), osmo_htons, and bssgp_normal_hdr::pdu_type.

Referenced by bssgp_bvc_fsm_blocked(), and bssgp_bvc_fsm_timer_cb().

◆ bssgp2_enc_bvc_unblock_ack()

struct msgb * bssgp2_enc_bvc_unblock_ack ( uint16_t  bvci)

Encode BSSGP BVC-UNBLOCK-ACK PDU as per TS 48.018 Section 10.4.11.

References BSSGP_IE_BVCI, bssgp_msgb_alloc(), BSSGP_PDUT_BVC_UNBLOCK_ACK, bvci, msg, msgb_put(), msgb_tvlv_put(), osmo_htons, and bssgp_normal_hdr::pdu_type.

Referenced by bssgp_bvc_fsm_blocked().

◆ bssgp2_enc_fc_bvc()

◆ bssgp2_enc_fc_bvc_ack()

struct msgb * bssgp2_enc_fc_bvc_ack ( uint8_t  tag)

Encode a FLOW-CONTROL-BVC-ACK PDU as per TS 48.018 Section 10.4.4.

Parameters
[in]tagthe tag IE value to encode
Returns
encoded PDU or NULL in case of error

References BSSGP_IE_TAG, bssgp_msgb_alloc(), BSSGP_PDUT_FLOW_CONTROL_BVC_ACK, msg, msgb_put(), msgb_tvlv_put(), and bssgp_normal_hdr::pdu_type.

Referenced by bssgp_bvc_fsm_unblocked().

◆ bssgp2_enc_fc_ms()

◆ bssgp2_enc_fc_ms_ack()

struct msgb * bssgp2_enc_fc_ms_ack ( uint32_t  tlli,
uint8_t  tag 
)

Encode a FLOW-CONTROL-BVC-ACK PDU as per TS 48.018 Section 10.4.7.

Parameters
[in]tllithe TLLI IE value to encode
[in]tagthe tag IE value to encode
Returns
encoded PDU or NULL in case of error

References BSSGP_IE_TAG, BSSGP_IE_TLLI, bssgp_msgb_alloc(), BSSGP_PDUT_FLOW_CONTROL_MS_ACK, msg, msgb_put(), msgb_tvlv_put(), msgb_tvlv_put_32be(), bssgp_normal_hdr::pdu_type, and tlli.

◆ bssgp2_enc_flush_ll()

struct msgb * bssgp2_enc_flush_ll ( uint32_t  tlli,
uint16_t  old_bvci,
const uint16_t *  new_bvci,
const uint16_t *  nsei 
)

Encode BSSGP FLUSH-LL PDU as per TS 48.018 Section 10.4.1.

Parameters
[in]tlli- the TLLI of the MS
[in]old_bvciBVCI
[in]new_bvci2optional BVCI - only encoded if non-NULL
[in]nseioptional - only encoded if non-NULL
Returns
encoded PDU or NULL in case of error

References BSSGP_IE_BVCI, BSSGP_IE_TLLI, bssgp_msgb_alloc(), BSSGP_PDUT_FLUSH_LL, msg, msgb_put(), msgb_tvlv_put_16be(), msgb_tvlv_put_32be(), nsei, bssgp_normal_hdr::pdu_type, and tlli.

◆ bssgp2_enc_status()

struct msgb * bssgp2_enc_status ( uint8_t  cause,
const uint16_t *  bvci,
const struct msgb orig_msg,
uint16_t  max_pdu_len 
)

Encode BSSGP STATUS PDU as per TS 48.018 Section 10.4.14.

Parameters
[in]causeBSSGP Cause value
[in]bvcioptional BVCI - only encoded if non-NULL
[in]msgoptional message buffer containing PDU in error - only encoded if non-NULL
[in]max_pdu_lenMaximum BSSGP PDU size the NS layer accepts

References BSSGP_IE_BVCI, BSSGP_IE_CAUSE, BSSGP_IE_PDU_IN_ERROR, bssgp_msgb_alloc(), BSSGP_PDUT_STATUS, bvci, cause, msg, msgb_bssgp_len, msgb_bssgph, msgb_length(), msgb_put(), msgb_tvlv_put(), osmo_htons, bssgp_normal_hdr::pdu_type, and TVLV_GROSS_LEN().

Referenced by _tx_status().

◆ bssgp2_nsi_tx_ptp()

int bssgp2_nsi_tx_ptp ( struct gprs_ns2_inst nsi,
uint16_t  nsei,
uint16_t  bvci,
struct msgb msg,
uint32_t  lsp 
)

transmit BSSGP PDU over NS (PTP BVC)

Parameters
[in]nsiNS Instance through which to transmit
[in]nseiNSEI of NSE through which to transmit
[in]bvciBVCI through which to transmit
[in]msgBSSGP PDU to transmit
Returns
0 on success; negative on error

References bvci, osmo_gprs_ns2_prim::bvci, GPRS_NS2_PRIM_UNIT_DATA, gprs_ns2_recv_prim(), osmo_gprs_ns2_prim::link_selector, msg, nsei, osmo_gprs_ns2_prim::nsei, osmo_gprs_ns2_prim::oph, osmo_prim_init(), PRIM_OP_REQUEST, SAP_NS, osmo_gprs_ns2_prim::u, and osmo_gprs_ns2_prim::unitdata.

Referenced by bssgp2_nsi_tx_sig(), and fi_tx_ptp().

◆ bssgp2_nsi_tx_sig()

int bssgp2_nsi_tx_sig ( struct gprs_ns2_inst nsi,
uint16_t  nsei,
struct msgb msg,
uint32_t  lsp 
)

transmit BSSGP PDU over NS (SIGNALING BVC)

Parameters
[in]nsiNS Instance through which to transmit
[in]nseiNSEI of NSE through which to transmit
[in]msgBSSGP PDU to transmit
Returns
0 on success; negative on error

References bssgp2_nsi_tx_ptp(), msg, and nsei.

Referenced by fi_tx_sig().

Variable Documentation

◆ bssgp_fc_gran_tbl

const unsigned int bssgp_fc_gran_tbl[]
static
Initial value:
= {
}
@ BSSGP_FC_GRAN_10000
Definition: gsm_08_18.h:350
@ BSSGP_FC_GRAN_100000
Definition: gsm_08_18.h:351
@ BSSGP_FC_GRAN_100
Definition: gsm_08_18.h:348
@ BSSGP_FC_GRAN_1000
Definition: gsm_08_18.h:349

Referenced by bssgp2_dec_fc_bvc(), bssgp2_dec_fc_ms(), bssgp2_enc_fc_bvc(), and bssgp2_enc_fc_ms().