libosmogb 1.11.0.2-4150.202502212026
Osmocom Gb library
|
GPRS BSSGP RIM protocol implementation as per 3GPP TS 48.018. More...
#include <stdint.h>
#include <osmocom/core/timer.h>
#include <osmocom/core/linuxlist.h>
#include <osmocom/gsm/gsm48.h>
#include <osmocom/gsm/prim.h>
#include <osmocom/gprs/protocol/gsm_08_18.h>
#include <osmocom/gprs/protocol/gsm_24_301.h>
#include <osmocom/gprs/gprs_bssgp_rim.h>
#include <osmocom/gsm/tlv.h>
#include <osmocom/gprs/gprs_msgb.h>
Go to the source code of this file.
Data Structures | |
struct | osmo_bssgp_prim |
struct | bssgp_flow_control |
BSSGP flow control (SGSN side) According to Section 8.2. More... | |
struct | bssgp_bvc_ctx |
struct | bssgp_lv |
struct | bssgp_dl_ud_par |
struct | bssgp_paging_info |
BSSGP paging information. More... | |
Macros | |
#define | BSSGP_PDUF_UL 0x0001 /* PDU may occur in uplink */ |
#define | BSSGP_PDUF_DL 0x0002 /* PDU may occur in downlink */ |
#define | BSSGP_PDUF_SIG 0x0004 /* PDU may occur on Signaling BVC */ |
#define | BSSGP_PDUF_PTP 0x0008 /* PDU may occur on PTP BVC */ |
#define | BSSGP_PDUF_PTM 0x0010 /* PDU may occur on PTM BVC */ |
#define | BVC_S_BLOCKED 0x0001 |
#define | BVC_F_BLOCKED 0x0001 |
Typedefs | |
typedef int(* | bssgp_bvc_send) (void *ctx, struct msgb *msg) |
Enumerations | |
enum | bssgp_prim { PRIM_BSSGP_DL_UD , PRIM_BSSGP_UL_UD , PRIM_BSSGP_PTM_UD , PRIM_BSSGP_GMM_SUSPEND , PRIM_BSSGP_GMM_RESUME , PRIM_BSSGP_GMM_PAGING , PRIM_NM_FLUSH_LL , PRIM_NM_LLC_DISCARDED , PRIM_NM_BVC_RESET , PRIM_NM_BVC_BLOCK , PRIM_NM_BVC_UNBLOCK , PRIM_NM_STATUS , PRIM_BSSGP_RIM_PDU_TRANSFER } |
enum | bssgp_ctr { BSSGP_CTR_PKTS_IN , BSSGP_CTR_PKTS_OUT , BSSGP_CTR_BYTES_IN , BSSGP_CTR_BYTES_OUT , BSSGP_CTR_BLOCKED , BSSGP_CTR_DISCARDED , BSSGP_CTR_STATUS } |
enum | bssgp_paging_mode { BSSGP_PAGING_PS , BSSGP_PAGING_CS } |
BSSGP Paging mode. More... | |
enum | bssgp_paging_scope { BSSGP_PAGING_BSS_AREA , BSSGP_PAGING_LOCATION_AREA , BSSGP_PAGING_ROUTEING_AREA , BSSGP_PAGING_BVCI } |
BSSGP Paging scope. More... | |
Variables | |
const struct osmo_tlv_prot_def | osmo_pdef_bssgp |
struct gprs_ns_inst * | bssgp_nsi |
struct llist_head | bssgp_bvc_ctxts |
GPRS BSSGP RIM protocol implementation as per 3GPP TS 48.018.
#define BVC_F_BLOCKED 0x0001 |
#define BVC_S_BLOCKED 0x0001 |
void bssgp_bvc_ctx_free | ( | struct bssgp_bvc_ctx * | ctx | ) |
const char * bssgp_cause_str | ( | enum gprs_bssgp_cause | cause | ) |
References bssgp_cause_strings, cause, and get_value_string().
Referenced by bssgp_bvc_fsm_allstate(), bssgp_bvc_fsm_blocked(), bssgp_bvc_fsm_unblocked(), bssgp_rx_bvc_reset(), bssgp_rx_status(), bssgp_tx_bvc_block(), bssgp_tx_bvc_ptp_reset(), bssgp_tx_status(), common_tx_radio_status2(), and tx_bvc_reset_nsei_bvci().
int bssgp_create_cell_id2 | ( | uint8_t * | buf, |
size_t | buf_len, | ||
const struct osmo_routing_area_id * | raid, | ||
uint16_t | cid | ||
) |
Encode the 04.08 RAI, Cell Id into BSSGP Cell identity.
References osmo_routing_area_id_encode_buf().
void bssgp_fc_flush_queue | ( | struct bssgp_flow_control * | fc | ) |
Flush the queue of the bssgp_flow_control.
[in] | The | flow control object which holds the queue. |
References bssgp_fc_queue_element::list, llist_for_each_entry_safe, bssgp_fc_queue_element::msg, msgb_free(), and bssgp_flow_control::queue.
Referenced by bssgp_flush_all_queues().
int bssgp_fc_in | ( | struct bssgp_flow_control * | fc, |
struct msgb * | msg, | ||
uint32_t | llc_pdu_len, | ||
void * | priv | ||
) |
References bssgp_fc_needs_queueing(), bssgp_flow_control::bucket_size_max, DLBSSGP, fc_enqueue(), LOGL_NOTICE, LOGP, msg, msgb_free(), osmo_gettimeofday(), bssgp_flow_control::out_cb, and bssgp_flow_control::time_last_pdu.
Referenced by bssgp_fc_ms_init(), and bssgp_tx_dl_ud().
void bssgp_fc_init | ( | struct bssgp_flow_control * | fc, |
uint32_t | bucket_size_max, | ||
uint32_t | bucket_leak_rate, | ||
uint32_t | max_queue_depth, | ||
int(*)(struct bssgp_flow_control *fc, struct msgb *msg, uint32_t llc_pdu_len, void *priv) | out_cb | ||
) |
References bssgp_flow_control::bucket_leak_rate, bssgp_flow_control::bucket_size_max, INIT_LLIST_HEAD, bssgp_flow_control::max_queue_depth, osmo_gettimeofday(), bssgp_flow_control::out_cb, bssgp_flow_control::queue, and bssgp_flow_control::time_last_pdu.
Referenced by bssgp_fc_ms_init(), and btsctx_alloc().
Flush the queues of all BSSGP contexts.
References bssgp_bvc_ctxts, bssgp_fc_flush_queue(), bssgp_bvc_ctx::fc, bssgp_bvc_ctx::list, and llist_for_each_entry.
References msg, msgb_bssgph, and OSMO_ASSERT.
Referenced by bssgp2_enc_bvc_block(), bssgp2_enc_bvc_block_ack(), bssgp2_enc_bvc_reset(), bssgp2_enc_bvc_reset_ack(), bssgp2_enc_bvc_unblock(), bssgp2_enc_bvc_unblock_ack(), bssgp2_enc_fc_bvc(), bssgp2_enc_fc_bvc_ack(), bssgp2_enc_fc_ms(), bssgp2_enc_fc_ms_ack(), bssgp2_enc_flush_ll(), bssgp2_enc_status(), bssgp_encode_rim_pdu(), bssgp_tx_bvc_block(), bssgp_tx_bvc_unblock(), bssgp_tx_fc_bvc(), bssgp_tx_fc_bvc_ack(), bssgp_tx_fc_ms(), bssgp_tx_flush_ll_ack(), bssgp_tx_llc_discarded(), bssgp_tx_paging(), bssgp_tx_ra_capa_upd(), bssgp_tx_resume(), bssgp_tx_resume_ack(), bssgp_tx_resume_nack(), bssgp_tx_simple_bvci(), bssgp_tx_status(), bssgp_tx_suspend(), bssgp_tx_suspend_ack(), bssgp_tx_suspend_nack(), common_tx_radio_status(), and tx_bvc_reset_nsei_bvci().
References msgb::len, LIBGB_MSGB_CB, msg, msgb_copy(), and name.
uint16_t bssgp_parse_cell_id | ( | struct gprs_ra_id * | raid, |
const uint8_t * | buf | ||
) |
References gsm48_parse_ra().
Referenced by bssgp_bvc_fsm_allstate(), bssgp_bvc_fsm_wait_reset_ack(), bssgp_parse_rim_ra(), and bssgp_rx_bvc_reset().
int bssgp_parse_cell_id2 | ( | struct osmo_routing_area_id * | raid, |
uint16_t * | cid, | ||
const uint8_t * | buf, | ||
size_t | buf_len | ||
) |
Parse the value of a BSSGP Cell identity (04.08 RAI + Cell Id)
References osmo_routing_area_id_decode().
const char * bssgp_pdu_str | ( | enum bssgp_pdu_type | pdu | ) |
References bssgp_pdu_strings, and get_value_string().
Referenced by bssgp_rcvmsg(), bssgp_rx_ptp(), bssgp_rx_rim(), bssgp_rx_sign(), bssgp_tx_rim(), and bssgp_tx_rim_encoded().
return the PDU type flags (UL/DL/SIG/PTP/PTM) of specified PDU type
References osmo_pdef_bssgp, and pdu_type.
int bssgp_prim_cb | ( | struct osmo_prim_hdr * | oph, |
void * | ctx | ||
) |
References BSSGP_CAUSE_INV_MAND_INF, BSSGP_CAUSE_PDU_INCOMP_FEAT, BSSGP_CAUSE_UNKNOWN_BVCI, BSSGP_CTR_BYTES_IN, BSSGP_CTR_PKTS_IN, BSSGP_IE_BVCI, bssgp_pdu_str(), BSSGP_PDUT_BVC_RESET, BSSGP_PDUT_DL_UNITDATA, BSSGP_PDUT_STATUS, BSSGP_PDUT_UL_UNITDATA, bssgp_rx_ptp(), bssgp_rx_sign(), bssgp_rx_status(), bssgp_tlv_parse(), bssgp_tx_status(), btsctx_by_bvci_nsei(), bvci, BVCI_PTM, BVCI_SIGNALLING, bssgp_bvc_ctx::ctrg, bssgp_ud_hdr::data, bssgp_normal_hdr::data, DLBSSGP, LOG_CTX_GB_BVC, log_set_context(), LOGL_ERROR, LOGL_NOTICE, LOGP, msg, msgb_bssgp_len, msgb_bssgph, msgb_bvci, msgb_hexdump(), msgb_nsei, nsei, pdu_type, bssgp_normal_hdr::pdu_type, rate_ctr_add(), rate_ctr_group_get_ctr(), and TLVP_PRES_LEN.
void bssgp_set_bssgp_callback | ( | bssgp_bvc_send | ns_send, |
void * | data | ||
) |
References bssgp_ns_send, bssgp_ns_send_data, and data.
References bssgp_lv::len, tlv_parse(), and tvlv_att_def.
Referenced by bssgp_rcvmsg(), and bssgp_rx_paging().
int bssgp_tx_bvc_reset_nsei_bvci | ( | uint16_t | nsei, |
uint16_t | bvci, | ||
enum gprs_bssgp_cause | cause, | ||
const struct gprs_ra_id * | ra_id, | ||
uint16_t | cell_id | ||
) |
Transmit a BVC-RESET message with a given nsei and bvci (Chapter 10.4.12)
[in] | nsei | The NSEI to transmit over |
[in] | bvci | BVCI of the BVC to reset |
[in] | cause | The cause of the reset |
[in] | ra_id | Pointer to the ra_id to include. If NULL no cell information will be included |
[in] | cell_id | The cell_id to include (if ra_id is not NULL) returns >= 0 on success, on error < 0. |
References BSSGP_PDUT_BVC_RESET, bvci, cause, nsei, ra_id, and tx_bvc_reset_nsei_bvci().
Referenced by bssgp_tx_bvc_reset2().
References BSSGP_CTR_BYTES_OUT, BSSGP_CTR_PKTS_OUT, bssgp_fc_in(), BSSGP_IE_DRX_PARAMS, BSSGP_IE_IMSI, BSSGP_IE_LLC_PDU, BSSGP_IE_MS_RADIO_ACCESS_CAP, BSSGP_IE_PDU_LIFETIME, BSSGP_IE_TLLI, BSSGP_PDUT_DL_UNITDATA, btsctx_by_bvci_nsei(), bvci, BVCI_PTM, bssgp_bvc_ctx::ctrg, DLBSSGP, bssgp_dl_ud_par::drx_parms, bssgp_bvc_ctx::fc, bssgp_dl_ud_par::fc, gsm48_generate_mid_from_imsi(), GSM48_MID_MAX_SIZE, bssgp_dl_ud_par::imsi, bssgp_lv::len, LOGL_ERROR, LOGP, mi, bssgp_dl_ud_par::ms_ra_cap, msg, msgb_bvci, msgb_free(), msgb_nsei, msgb_tlli, nsei, OSMO_ASSERT, osmo_htonl, osmo_htons, bssgp_ud_hdr::pdu_type, bssgp_dl_ud_par::qos_profile, bssgp_ud_hdr::qos_profile, rate_ctr_add(), rate_ctr_group_get_ctr(), bssgp_dl_ud_par::tlli, bssgp_ud_hdr::tlli, TVLV_MAX_ONEBYTE, and bssgp_lv::v.
int bssgp_tx_paging | ( | uint16_t | nsei, |
uint16_t | ns_bvci, | ||
struct bssgp_paging_info * | pinfo | ||
) |
References BSSGP_IE_BSS_AREA_ID, BSSGP_IE_BVCI, BSSGP_IE_DRX_PARAMS, BSSGP_IE_IMSI, BSSGP_IE_LOCATION_AREA, BSSGP_IE_QOS_PROFILE, BSSGP_IE_TMSI, bssgp_msgb_alloc(), bssgp_msgb_ra_put(), bssgp_ns_send, bssgp_ns_send_data, BSSGP_PAGING_BSS_AREA, BSSGP_PAGING_BVCI, BSSGP_PAGING_LOCATION_AREA, BSSGP_PAGING_PS, BSSGP_PAGING_ROUTEING_AREA, BSSGP_PDUT_PAGING_CS, BSSGP_PDUT_PAGING_PS, bssgp_paging_info::bvci, bvci, bssgp_paging_info::drx_params, gsm48_encode_ra(), gsm48_generate_mid_from_imsi(), GSM48_MID_MAX_SIZE, bssgp_paging_info::imsi, mi, bssgp_paging_info::mode, msg, msgb_bvci, msgb_nsei, nsei, OSMO_ASSERT, osmo_htonl, osmo_htons, bssgp_normal_hdr::pdu_type, bssgp_paging_info::ptmsi, bssgp_paging_info::qos, bssgp_paging_info::raid, and bssgp_paging_info::scope.
References BSSGP_IE_BVCI, bssgp_msgb_alloc(), bssgp_ns_send, bssgp_ns_send_data, bvci, msg, msgb_bvci, msgb_nsei, nsei, osmo_htons, pdu_type, and bssgp_normal_hdr::pdu_type.
Referenced by bssgp_bvc_fsm_unblocked(), bssgp_rx_bvc_block(), bssgp_rx_bvc_reset(), and bssgp_rx_bvc_unblock().
References BSSGP_CAUSE_BVCI_BLOCKED, bssgp_cause_str(), BSSGP_CAUSE_UNKNOWN_BVCI, BSSGP_IE_BVCI, BSSGP_IE_CAUSE, BSSGP_IE_PDU_IN_ERROR, bssgp_msgb_alloc(), bssgp_ns_send, bssgp_ns_send_data, BSSGP_PDUT_STATUS, bvci, cause, DLBSSGP, LOGL_ERROR, LOGL_NOTICE, LOGP, msg, msgb_bssgp_len, msgb_bssgph, msgb_bvci, msgb_nsei, osmo_htons, and bssgp_normal_hdr::pdu_type.
Referenced by bssgp_rcvmsg(), bssgp_rx_bvc_block(), bssgp_rx_bvc_unblock(), bssgp_rx_fc_bvc(), bssgp_rx_llc_disc(), bssgp_rx_ptp(), bssgp_rx_resume(), bssgp_rx_rim(), bssgp_rx_sign(), bssgp_rx_suspend(), and bssgp_rx_ul_ud().
References bssgp_node, CFG_LOG_NODE, CONFIG_NODE, config_write_bssgp(), install_lib_element(), install_lib_element_ve(), and install_node().
struct bssgp_bvc_ctx * btsctx_alloc | ( | uint16_t | bvci, |
uint16_t | nsei | ||
) |
References _bssgp_tx_dl_ud(), bssgp_bvc_ctxts, bssgp_ctrg_desc, bssgp_fc_init(), bssgp_tall_ctx, bssgp_bvc_ctx::bvci, bvci, bssgp_bvc_ctx::ctrg, bssgp_bvc_ctx::fc, bssgp_bvc_ctx::is_sgsn, bssgp_bvc_ctx::list, bssgp_bvc_ctx::nsei, nsei, rate_ctr_group_alloc(), and rate_ctr_group_free().
Referenced by bssgp_rx_bvc_reset().
struct bssgp_bvc_ctx * btsctx_by_bvci_nsei | ( | uint16_t | bvci, |
uint16_t | nsei | ||
) |
References bssgp_bvc_ctxts, bssgp_bvc_ctx::bvci, bvci, bssgp_bvc_ctx::list, llist_for_each_entry, bssgp_bvc_ctx::nsei, and nsei.
Referenced by bssgp_fc_ms_init(), bssgp_rcvmsg(), bssgp_rx_bvc_block(), bssgp_rx_bvc_reset(), bssgp_rx_bvc_unblock(), bssgp_tx_dl_ud(), DEFUN(), and DEFUN().
struct bssgp_bvc_ctx * btsctx_by_raid_cid | ( | const struct gprs_ra_id * | raid, |
uint16_t | cid | ||
) |
References bssgp_bvc_ctxts, bssgp_bvc_ctx::cell_id, bssgp_bvc_ctx::list, llist_for_each_entry, and bssgp_bvc_ctx::ra_id.
|
extern |
Referenced by bssgp_flush_all_queues(), bssgp_tx_bvc_ptp_reset(), btsctx_alloc(), btsctx_by_bvci_nsei(), btsctx_by_raid_cid(), DEFUN(), and dump_bssgp().
|
extern |
Referenced by _gprs_ns_sendmsg().
|
extern |
Referenced by bssgp_parse_rim_pdu(), bssgp_pdu_type_flags(), fi_tx_ptp(), and fi_tx_sig().