libosmogb 1.10.0.62-c31e0
Osmocom Gb library
|
#include <osmocom/core/utils.h>
#include <osmocom/core/byteswap.h>
#include <osmocom/core/msgb.h>
#include <osmocom/gsm/gsm48.h>
#include <osmocom/gsm/tlv.h>
#include <osmocom/gprs/gprs_ns2.h>
#include <osmocom/gprs/gprs_bssgp.h>
#include <osmocom/gprs/gprs_bssgp2.h>
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 msgb * | bssgp2_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 msgb * | bssgp2_enc_bvc_block_ack (uint16_t bvci) |
Encode BSSGP BVC-BLOCK-ACK PDU as per TS 48.018 Section 10.4.9. More... | |
struct msgb * | bssgp2_enc_bvc_unblock (uint16_t bvci) |
Encode BSSGP BVC-UNBLOCK PDU as per TS 48.018 Section 10.4.10. More... | |
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. More... | |
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. More... | |
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. More... | |
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. 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 msgb * | bssgp2_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 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. More... | |
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. 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 msgb * | bssgp2_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 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. More... | |
Variables | |
static const unsigned int | bssgp_fc_gran_tbl [] |
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.
[out] | fc | caller-allocated memory for parsed output |
[in] | tp | pre-parsed TLVs; caller must ensure mandatory IE presence/length |
References bssgp2_flow_ctrl::bmax_default_ms, bssgp_fc_gran_tbl, BSSGP_IE_BMAX_DEFAULT_MS, BSSGP_IE_BUCKET_FULL_RATIO, BSSGP_IE_BUCKET_LEAK_RATE, BSSGP_IE_BVC_BUCKET_SIZE, BSSGP_IE_BVC_MEASUREMENT, BSSGP_IE_FLOW_CTRL_GRANULARITY, BSSGP_IE_R_DEFAULT_MS, BSSGP_IE_TAG, 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::bvc, bssgp2_flow_ctrl::measurement, bssgp2_flow_ctrl::measurement_present, bssgp2_flow_ctrl::r_default_ms, bssgp2_flow_ctrl::tag, TLVP_PRESENT, TLVP_VAL, tlvp_val16be(), and bssgp2_flow_ctrl::u.
Referenced by bssgp_bvc_fsm_unblocked().
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.
[out] | fc | caller-allocated memory for parsed output |
[in] | tp | pre-parsed TLVs; caller must ensure mandatory IE presence/length |
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.
struct msgb * bssgp2_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.
References BSSGP_IE_BVCI, BSSGP_IE_CAUSE, bssgp_msgb_alloc(), BSSGP_PDUT_BVC_BLOCK, bvci, cause, msg, msgb_put(), msgb_tvlv_put(), osmo_htons, and bssgp_normal_hdr::pdu_type.
Referenced by bssgp_bvc_fsm_timer_cb(), bssgp_bvc_fsm_unblocked(), and bssgp_bvc_fsm_wait_reset_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().
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.
[in] | bvci | PTP BVCI to encode into the BVCI IE |
[in] | cause | BSSGP Cause value (reason for reset) |
[in] | ra_id | Routing Area ID to be encoded to CELL_ID IE (optional) |
[in] | cell_id | Cell ID to be encoded to CELL_ID IE (only if ra_id is non-NULL) |
[in] | feat_bm | Feature Bitmap (optional) |
[in] | ext_feat_bm | Extended 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().
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.
[in] | bvci | PTP BVCI to encode into the BVCI IE |
[in] | ra_id | Routing Area ID to be encoded to CELL_ID IE (optional) |
[in] | cell_id | Cell ID to be encoded to CELL_ID IE (only if ra_id is non-NULL) |
[in] | feat_bm | Feature Bitmap (optional) |
[in] | ext_feat_bm | Extended 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().
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().
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().
struct msgb * bssgp2_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.
[in] | fc | structure describing to-be-encoded FC parameters |
[in] | gran | if non-NULL: Encode using specified unit granularity |
References bssgp2_flow_ctrl::bmax_default_ms, bssgp_fc_gran_tbl, BSSGP_IE_BMAX_DEFAULT_MS, BSSGP_IE_BUCKET_FULL_RATIO, BSSGP_IE_BUCKET_LEAK_RATE, BSSGP_IE_BVC_BUCKET_SIZE, BSSGP_IE_BVC_MEASUREMENT, BSSGP_IE_FLOW_CTRL_GRANULARITY, BSSGP_IE_R_DEFAULT_MS, BSSGP_IE_TAG, bssgp_msgb_alloc(), BSSGP_PDUT_FLOW_CONTROL_BVC, 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::bvc, bssgp2_flow_ctrl::measurement, bssgp2_flow_ctrl::measurement_present, msg, msgb_put(), msgb_tvlv_put(), msgb_tvlv_put_16be(), bssgp_normal_hdr::pdu_type, bssgp2_flow_ctrl::r_default_ms, bssgp2_flow_ctrl::tag, and bssgp2_flow_ctrl::u.
Referenced by bssgp_bvc_fsm_unblocked().
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.
[in] | tag | the tag IE value to encode |
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().
struct msgb * bssgp2_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.
[in] | fc | structure describing to-be-encoded FC parameters |
[in] | gran | if non-NULL: Encode using specified unit granularity |
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, bssgp_msgb_alloc(), BSSGP_PDUT_FLOW_CONTROL_MS, 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, msg, msgb_put(), msgb_tvlv_put(), msgb_tvlv_put_16be(), msgb_tvlv_put_32be(), bssgp_normal_hdr::pdu_type, bssgp2_flow_ctrl::tag, bssgp2_flow_ctrl::tlli, and bssgp2_flow_ctrl::u.
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.
[in] | tlli | the TLLI IE value to encode |
[in] | tag | the tag IE value to encode |
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.
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.
[in] | tlli | - the TLLI of the MS |
[in] | old_bvci | BVCI |
[in] | new_bvci2 | optional BVCI - only encoded if non-NULL |
[in] | nsei | optional - only encoded if non-NULL |
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.
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.
[in] | cause | BSSGP Cause value |
[in] | bvci | optional BVCI - only encoded if non-NULL |
[in] | msg | optional message buffer containing PDU in error - only encoded if non-NULL |
[in] | max_pdu_len | Maximum 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().
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)
[in] | nsi | NS Instance through which to transmit |
[in] | nsei | NSEI of NSE through which to transmit |
[in] | bvci | BVCI through which to transmit |
[in] | msg | BSSGP PDU to transmit |
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().
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)
[in] | nsi | NS Instance through which to transmit |
[in] | nsei | NSEI of NSE through which to transmit |
[in] | msg | BSSGP PDU to transmit |
References bssgp2_nsi_tx_ptp(), msg, and nsei.
Referenced by fi_tx_sig().
|
static |
Referenced by bssgp2_dec_fc_bvc(), bssgp2_dec_fc_ms(), bssgp2_enc_fc_bvc(), and bssgp2_enc_fc_ms().