libosmogb 1.10.0.58-6cd7a
Osmocom Gb library
|
GPRS BSSGP protocol implementation as per 3GPP TS 08.18. More...
#include <errno.h>
#include <stdint.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/byteswap.h>
#include <osmocom/core/rate_ctr.h>
#include <osmocom/gsm/tlv.h>
#include <osmocom/core/talloc.h>
#include <osmocom/gprs/gprs_bssgp.h>
#include <osmocom/gprs/gprs_bssgp_bss.h>
#include <osmocom/gprs/gprs_ns.h>
#include "gprs_bssgp_internal.h"
Macros | |
#define | GSM_IMSI_LENGTH 17 |
Functions | |
uint8_t * | bssgp_msgb_tlli_put (struct msgb *msg, uint32_t tlli) |
uint8_t * | bssgp_msgb_ra_put (struct msgb *msg, const struct gprs_ra_id *ra_id) |
int | bssgp_tx_suspend (uint16_t nsei, uint32_t tlli, const struct gprs_ra_id *ra_id) |
GMM-SUSPEND.req (Chapter 10.3.6) More... | |
int | bssgp_tx_resume (uint16_t nsei, uint32_t tlli, const struct gprs_ra_id *ra_id, uint8_t suspend_ref) |
GMM-RESUME.req (Chapter 10.3.9) More... | |
int | bssgp_tx_ra_capa_upd (struct bssgp_bvc_ctx *bctx, uint32_t tlli, uint8_t tag) |
Transmit RA-CAPABILITY-UPDATE (10.3.3) More... | |
static struct msgb * | common_tx_radio_status (struct bssgp_bvc_ctx *bctx) |
static int | common_tx_radio_status2 (struct msgb *msg, uint8_t cause) |
int | bssgp_tx_radio_status_tlli (struct bssgp_bvc_ctx *bctx, uint8_t cause, uint32_t tlli) |
Transmit RADIO-STATUS for TLLI (10.3.5) More... | |
int | bssgp_tx_radio_status_tmsi (struct bssgp_bvc_ctx *bctx, uint8_t cause, uint32_t tmsi) |
Transmit RADIO-STATUS for TMSI (10.3.5) More... | |
int | bssgp_tx_radio_status_imsi (struct bssgp_bvc_ctx *bctx, uint8_t cause, const char *imsi) |
Transmit RADIO-STATUS for IMSI (10.3.5) More... | |
int | bssgp_tx_flush_ll_ack (struct bssgp_bvc_ctx *bctx, uint32_t tlli, uint8_t action, uint16_t bvci_new, uint32_t num_octets) |
Transmit FLUSH-LL-ACK (Chapter 10.4.2) More... | |
int | bssgp_tx_llc_discarded (struct bssgp_bvc_ctx *bctx, uint32_t tlli, uint8_t num_frames, uint32_t num_octets) |
Transmit LLC-DISCARDED (Chapter 10.4.3) More... | |
int | bssgp_tx_bvc_block (struct bssgp_bvc_ctx *bctx, uint8_t cause) |
Transmit a BVC-BLOCK message (Chapter 10.4.8) More... | |
int | bssgp_tx_bvc_unblock (struct bssgp_bvc_ctx *bctx) |
Transmit a BVC-UNBLOCK message (Chapter 10.4.10) More... | |
int | bssgp_tx_bvc_reset2 (struct bssgp_bvc_ctx *bctx, uint16_t bvci, uint8_t cause, bool add_cell_id) |
Transmit a BVC-RESET message (Chapter 10.4.12) More... | |
int | bssgp_tx_bvc_reset (struct bssgp_bvc_ctx *bctx, uint16_t bvci, uint8_t cause) |
int | bssgp_tx_fc_bvc (struct bssgp_bvc_ctx *bctx, uint8_t tag, uint32_t bucket_size, uint32_t bucket_leak_rate, uint32_t bmax_default_ms, uint32_t r_default_ms, uint8_t *bucket_full_ratio, uint32_t *queue_delay_ms) |
Transmit a FLOW_CONTROL-BVC (Chapter 10.4.4) More... | |
int | bssgp_tx_fc_ms (struct bssgp_bvc_ctx *bctx, uint32_t tlli, uint8_t tag, uint32_t ms_bucket_size, uint32_t bucket_leak_rate, uint8_t *bucket_full_ratio) |
Transmit a FLOW_CONTROL-MS (Chapter 10.4.6) More... | |
int | bssgp_tx_ul_ud (struct bssgp_bvc_ctx *bctx, uint32_t tlli, const uint8_t *qos_profile, struct msgb *llc_pdu) |
RL-UL-UNITDATA.req (Chapter 10.2.2) More... | |
int | bssgp_rx_paging (struct bssgp_paging_info *pinfo, struct msgb *msg) |
GPRS BSSGP protocol implementation as per 3GPP TS 08.18.
#define GSM_IMSI_LENGTH 17 |
uint8_t * bssgp_msgb_ra_put | ( | struct msgb * | msg, |
const struct gprs_ra_id * | ra_id | ||
) |
References BSSGP_IE_ROUTEING_AREA, gsm48_encode_ra(), msg, msgb_tvlv_put(), and ra_id.
Referenced by bssgp_tx_paging(), bssgp_tx_resume(), bssgp_tx_resume_ack(), bssgp_tx_resume_nack(), bssgp_tx_suspend(), bssgp_tx_suspend_ack(), and bssgp_tx_suspend_nack().
uint8_t * bssgp_msgb_tlli_put | ( | struct msgb * | msg, |
uint32_t | tlli | ||
) |
References BSSGP_IE_TLLI, msg, msgb_tvlv_put(), osmo_htonl, and tlli.
Referenced by bssgp_tx_fc_ms(), bssgp_tx_flush_ll_ack(), bssgp_tx_llc_discarded(), bssgp_tx_ra_capa_upd(), bssgp_tx_radio_status_tlli(), bssgp_tx_resume(), bssgp_tx_resume_ack(), bssgp_tx_resume_nack(), bssgp_tx_suspend(), bssgp_tx_suspend_ack(), and bssgp_tx_suspend_nack().
int bssgp_rx_paging | ( | struct bssgp_paging_info * | pinfo, |
struct msgb * | msg | ||
) |
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_ROUTEING_AREA, BSSGP_IE_TMSI, BSSGP_PAGING_BSS_AREA, BSSGP_PAGING_BVCI, BSSGP_PAGING_CS, BSSGP_PAGING_LOCATION_AREA, BSSGP_PAGING_PS, BSSGP_PAGING_ROUTEING_AREA, BSSGP_PDUT_PAGING_CS, BSSGP_PDUT_PAGING_PS, bssgp_tlv_parse(), bssgp_paging_info::bvci, bssgp_normal_hdr::data, bssgp_paging_info::drx_params, gsm48_mi_to_string(), gsm48_parse_ra(), GSM_IMSI_LENGTH, bssgp_paging_info::imsi, bssgp_paging_info::mode, msg, msgb_bssgp_len, msgb_bssgph, bssgp_normal_hdr::pdu_type, bssgp_paging_info::ptmsi, bssgp_paging_info::qos, bssgp_paging_info::raid, bssgp_paging_info::scope, TLVP_LEN, TLVP_PRES_LEN, TLVP_PRESENT, TLVP_VAL, and tlvp_val16be().
int bssgp_tx_bvc_block | ( | struct bssgp_bvc_ctx * | bctx, |
uint8_t | cause | ||
) |
Transmit a BVC-BLOCK message (Chapter 10.4.8)
References bssgp_cause_str(), BSSGP_IE_BVCI, BSSGP_IE_CAUSE, bssgp_msgb_alloc(), bssgp_ns_send, bssgp_ns_send_data, BSSGP_PDUT_BVC_BLOCK, bssgp_bvc_ctx::bvci, cause, DLBSSGP, LOGL_NOTICE, LOGP, msg, msgb_bvci, msgb_nsei, msgb_put(), msgb_tvlv_put(), bssgp_bvc_ctx::nsei, osmo_htons, and bssgp_normal_hdr::pdu_type.
int bssgp_tx_bvc_reset | ( | struct bssgp_bvc_ctx * | bctx, |
uint16_t | bvci, | ||
uint8_t | cause | ||
) |
References bssgp_tx_bvc_reset2(), bvci, BVCI_PTM, BVCI_SIGNALLING, and cause.
Referenced by bssgp_tx_bvc_ptp_reset(), and DEFUN().
int bssgp_tx_bvc_reset2 | ( | struct bssgp_bvc_ctx * | bctx, |
uint16_t | bvci, | ||
uint8_t | cause, | ||
bool | add_cell_id | ||
) |
Transmit a BVC-RESET message (Chapter 10.4.12)
References bssgp_tx_bvc_reset_nsei_bvci(), bvci, cause, bssgp_bvc_ctx::cell_id, bssgp_bvc_ctx::nsei, and bssgp_bvc_ctx::ra_id.
Referenced by bssgp_tx_bvc_reset().
int bssgp_tx_bvc_unblock | ( | struct bssgp_bvc_ctx * | bctx | ) |
Transmit a BVC-UNBLOCK message (Chapter 10.4.10)
References BSSGP_IE_BVCI, bssgp_msgb_alloc(), bssgp_ns_send, bssgp_ns_send_data, BSSGP_PDUT_BVC_UNBLOCK, bssgp_bvc_ctx::bvci, DLBSSGP, LOGL_NOTICE, LOGP, msg, msgb_bvci, msgb_nsei, msgb_put(), msgb_tvlv_put(), bssgp_bvc_ctx::nsei, osmo_htons, and bssgp_normal_hdr::pdu_type.
int bssgp_tx_fc_bvc | ( | struct bssgp_bvc_ctx * | bctx, |
uint8_t | tag, | ||
uint32_t | bucket_size, | ||
uint32_t | bucket_leak_rate, | ||
uint32_t | bmax_default_ms, | ||
uint32_t | r_default_ms, | ||
uint8_t * | bucket_full_ratio, | ||
uint32_t * | queue_delay_ms | ||
) |
Transmit a FLOW_CONTROL-BVC (Chapter 10.4.4)
[in] | bctx | BVC Context |
[in] | tag | Additional tag to identify acknowledge |
[in] | bucket_size | Maximum bucket size in octets |
[in] | bucket_leak_rate | Bucket leak rate in octets/sec |
[in] | bmax_default_ms | Maximum bucket size default for MS |
[in] | r_default_ms | Bucket leak rate default for MS in octets/sec |
[in] | bucket_full_ratio | Ratio (in percent) of queue filling |
[in] | queue_delay_ms | Average queuing delay in milliseconds |
References 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_R_DEFAULT_MS, BSSGP_IE_TAG, bssgp_msgb_alloc(), bssgp_ns_send, bssgp_ns_send_data, BSSGP_PDUT_FLOW_CONTROL_BVC, bssgp_bvc_ctx::bvci, msg, msgb_bvci, msgb_nsei, msgb_put(), msgb_tvlv_put(), bssgp_bvc_ctx::nsei, osmo_htons, and bssgp_normal_hdr::pdu_type.
int bssgp_tx_fc_ms | ( | struct bssgp_bvc_ctx * | bctx, |
uint32_t | tlli, | ||
uint8_t | tag, | ||
uint32_t | ms_bucket_size, | ||
uint32_t | bucket_leak_rate, | ||
uint8_t * | bucket_full_ratio | ||
) |
Transmit a FLOW_CONTROL-MS (Chapter 10.4.6)
[in] | bctx | BVC Context |
[in] | tlli | TLLI to identify MS |
[in] | tag | Additional tag to identify acknowledge |
[in] | ms_bucket_size | Maximum bucket size in octets |
[in] | bucket_leak_rate | Bucket leak rate in octets/sec |
[in] | bucket_full_ratio | Ratio (in percent) of queue filling |
References BSSGP_IE_BUCKET_FULL_RATIO, BSSGP_IE_BUCKET_LEAK_RATE, BSSGP_IE_MS_BUCKET_SIZE, BSSGP_IE_TAG, bssgp_msgb_alloc(), bssgp_msgb_tlli_put(), bssgp_ns_send, bssgp_ns_send_data, BSSGP_PDUT_FLOW_CONTROL_MS, bssgp_bvc_ctx::bvci, msg, msgb_bvci, msgb_nsei, msgb_put(), msgb_tvlv_put(), bssgp_bvc_ctx::nsei, bssgp_normal_hdr::pdu_type, and tlli.
int bssgp_tx_flush_ll_ack | ( | struct bssgp_bvc_ctx * | bctx, |
uint32_t | tlli, | ||
uint8_t | action, | ||
uint16_t | bvci_new, | ||
uint32_t | num_octets | ||
) |
Transmit FLUSH-LL-ACK (Chapter 10.4.2)
References BSSGP_IE_BVCI, BSSGP_IE_FLUSH_ACTION, BSSGP_IE_NUM_OCT_AFF, bssgp_msgb_alloc(), bssgp_msgb_tlli_put(), bssgp_ns_send, bssgp_ns_send_data, BSSGP_PDUT_FLUSH_LL_ACK, msg, msgb_bvci, msgb_nsei, msgb_put(), msgb_tvlv_put(), bssgp_bvc_ctx::nsei, osmo_htonl, osmo_htons, bssgp_normal_hdr::pdu_type, and tlli.
int bssgp_tx_llc_discarded | ( | struct bssgp_bvc_ctx * | bctx, |
uint32_t | tlli, | ||
uint8_t | num_frames, | ||
uint32_t | num_octets | ||
) |
Transmit LLC-DISCARDED (Chapter 10.4.3)
References BSSGP_IE_BVCI, BSSGP_IE_LLC_FRAMES_DISCARDED, BSSGP_IE_NUM_OCT_AFF, bssgp_msgb_alloc(), bssgp_msgb_tlli_put(), bssgp_ns_send, bssgp_ns_send_data, BSSGP_PDUT_LLC_DISCARD, bssgp_bvc_ctx::bvci, DLBSSGP, LOGL_NOTICE, LOGP, msg, msgb_bvci, msgb_nsei, msgb_put(), msgb_tvlv_put(), bssgp_bvc_ctx::nsei, osmo_htonl, osmo_htons, bssgp_normal_hdr::pdu_type, and tlli.
int bssgp_tx_ra_capa_upd | ( | struct bssgp_bvc_ctx * | bctx, |
uint32_t | tlli, | ||
uint8_t | tag | ||
) |
Transmit RA-CAPABILITY-UPDATE (10.3.3)
References BSSGP_IE_TAG, bssgp_msgb_alloc(), bssgp_msgb_tlli_put(), bssgp_ns_send, bssgp_ns_send_data, BSSGP_PDUT_RA_CAPA_UDPATE, bssgp_bvc_ctx::bvci, DLBSSGP, LOGL_NOTICE, LOGP, msg, msgb_bvci, msgb_nsei, msgb_put(), msgb_tvlv_put(), bssgp_bvc_ctx::nsei, bssgp_normal_hdr::pdu_type, and tlli.
int bssgp_tx_radio_status_imsi | ( | struct bssgp_bvc_ctx * | bctx, |
uint8_t | cause, | ||
const char * | imsi | ||
) |
Transmit RADIO-STATUS for IMSI (10.3.5)
References BSSGP_IE_IMSI, cause, common_tx_radio_status(), common_tx_radio_status2(), DLBSSGP, gsm48_generate_mid_from_imsi(), GSM48_MID_MAX_SIZE, LOGL_NOTICE, LOGPC, mi, msg, msgb_tvlv_put(), and OSMO_ASSERT.
int bssgp_tx_radio_status_tlli | ( | struct bssgp_bvc_ctx * | bctx, |
uint8_t | cause, | ||
uint32_t | tlli | ||
) |
Transmit RADIO-STATUS for TLLI (10.3.5)
References bssgp_msgb_tlli_put(), cause, common_tx_radio_status(), common_tx_radio_status2(), DLBSSGP, LOGL_NOTICE, LOGPC, msg, and tlli.
int bssgp_tx_radio_status_tmsi | ( | struct bssgp_bvc_ctx * | bctx, |
uint8_t | cause, | ||
uint32_t | tmsi | ||
) |
Transmit RADIO-STATUS for TMSI (10.3.5)
References BSSGP_IE_TMSI, cause, common_tx_radio_status(), common_tx_radio_status2(), DLBSSGP, LOGL_NOTICE, LOGPC, msg, msgb_tvlv_put(), and osmo_htonl.
int bssgp_tx_resume | ( | uint16_t | nsei, |
uint32_t | tlli, | ||
const struct gprs_ra_id * | ra_id, | ||
uint8_t | suspend_ref | ||
) |
GMM-RESUME.req (Chapter 10.3.9)
References BSSGP_IE_SUSPEND_REF_NR, bssgp_msgb_alloc(), bssgp_msgb_ra_put(), bssgp_msgb_tlli_put(), bssgp_ns_send, bssgp_ns_send_data, BSSGP_PDUT_RESUME, DLBSSGP, LOGL_NOTICE, LOGP, msg, msgb_bvci, msgb_nsei, msgb_put(), msgb_tvlv_put(), nsei, bssgp_normal_hdr::pdu_type, ra_id, and tlli.
int bssgp_tx_suspend | ( | uint16_t | nsei, |
uint32_t | tlli, | ||
const struct gprs_ra_id * | ra_id | ||
) |
GMM-SUSPEND.req (Chapter 10.3.6)
References bssgp_msgb_alloc(), bssgp_msgb_ra_put(), bssgp_msgb_tlli_put(), bssgp_ns_send, bssgp_ns_send_data, BSSGP_PDUT_SUSPEND, DLBSSGP, LOGL_NOTICE, LOGP, msg, msgb_bvci, msgb_nsei, msgb_put(), nsei, bssgp_normal_hdr::pdu_type, ra_id, and tlli.
int bssgp_tx_ul_ud | ( | struct bssgp_bvc_ctx * | bctx, |
uint32_t | tlli, | ||
const uint8_t * | qos_profile, | ||
struct msgb * | llc_pdu | ||
) |
RL-UL-UNITDATA.req (Chapter 10.2.2)
[in] | bctx | BVC Context |
[in] | tlli | TLLI to identify MS |
[in] | qos_profile | Pointer to three octests of QoS profile |
[in] | llc_pdu | msgb pointer containing UL Unitdata IE payload |
References bssgp_create_cell_id(), BSSGP_CTR_BYTES_OUT, BSSGP_CTR_PKTS_OUT, BSSGP_IE_ALIGNMENT, BSSGP_IE_CELL_ID, bssgp_ns_send, bssgp_ns_send_data, BSSGP_PDUT_UL_UNITDATA, bssgp_bvc_ctx::bvci, bssgp_bvc_ctx::cell_id, bssgp_bvc_ctx::ctrg, msg, msgb_bvci, msgb_nsei, msgb_push(), msgb_tvlv_push(), bssgp_bvc_ctx::nsei, osmo_htonl, bssgp_ud_hdr::pdu_type, qos_profile, bssgp_ud_hdr::qos_profile, bssgp_bvc_ctx::ra_id, rate_ctr_add(), rate_ctr_group_get_ctr(), rate_ctr_inc(), tlli, and bssgp_ud_hdr::tlli.
|
static |
References bssgp_msgb_alloc(), BSSGP_PDUT_RADIO_STATUS, bssgp_bvc_ctx::bvci, DLBSSGP, LOGL_NOTICE, LOGP, msg, msgb_bvci, msgb_nsei, msgb_put(), bssgp_bvc_ctx::nsei, and bssgp_normal_hdr::pdu_type.
Referenced by bssgp_tx_radio_status_imsi(), bssgp_tx_radio_status_tlli(), and bssgp_tx_radio_status_tmsi().
|
static |
References bssgp_cause_str(), BSSGP_IE_CAUSE, bssgp_ns_send, bssgp_ns_send_data, cause, DLBSSGP, LOGL_NOTICE, LOGPC, msg, and msgb_tvlv_put().
Referenced by bssgp_tx_radio_status_imsi(), bssgp_tx_radio_status_tlli(), and bssgp_tx_radio_status_tmsi().