libosmogb 1.10.0.64-ff3d
Osmocom Gb library
|
#include <string.h>
#include <stdio.h>
#include <osmocom/core/fsm.h>
#include <osmocom/core/logging.h>
#include <osmocom/core/utils.h>
#include <osmocom/core/tdef.h>
#include <osmocom/gsm/gsm48.h>
#include <osmocom/gsm/tlv.h>
#include <osmocom/gprs/gprs_msgb.h>
#include <osmocom/gprs/gprs_bssgp.h>
#include <osmocom/gprs/gprs_bssgp2.h>
#include <osmocom/gprs/bssgp_bvc_fsm.h>
#include "common_vty.h"
Data Structures | |
struct | bvc_fsm_priv |
Macros | |
#define | S(x) (1 << (x)) |
#define | T1 1 |
#define | T2 2 |
#define | T1_SECS osmo_tdef_get(bssgp_bvc_fsm_tdefs, 1, OSMO_TDEF_S, 5) |
#define | T2_SECS osmo_tdef_get(bssgp_bvc_fsm_tdefs, 2, OSMO_TDEF_S, 10) |
Functions | |
static int | fi_tx_ptp (struct osmo_fsm_inst *fi, struct msgb *msg) |
static int | fi_tx_sig (struct osmo_fsm_inst *fi, struct msgb *msg) |
static void | _tx_bvc_reset (struct osmo_fsm_inst *fi, uint8_t cause) |
static void | _tx_bvc_reset_ack (struct osmo_fsm_inst *fi) |
static void | _tx_status (struct osmo_fsm_inst *fi, enum gprs_bssgp_cause cause, const struct msgb *rx) |
static void | update_negotiated_features (struct osmo_fsm_inst *fi, const struct tlv_parsed *tp) |
static void | _onenter_tail (struct osmo_fsm_inst *fi, uint32_t prev_state) |
static void | bssgp_bvc_fsm_null (struct osmo_fsm_inst *fi, uint32_t event, void *data) |
static void | bssgp_bvc_fsm_blocked_onenter (struct osmo_fsm_inst *fi, uint32_t prev_state) |
static void | bssgp_bvc_fsm_blocked (struct osmo_fsm_inst *fi, uint32_t event, void *data) |
static void | bssgp_bvc_fsm_wait_reset_ack (struct osmo_fsm_inst *fi, uint32_t event, void *data) |
static void | bssgp_bvc_fsm_unblocked (struct osmo_fsm_inst *fi, uint32_t event, void *data) |
static void | bssgp_bvc_fsm_allstate (struct osmo_fsm_inst *fi, uint32_t event, void *data) |
static int | bssgp_bvc_fsm_timer_cb (struct osmo_fsm_inst *fi) |
static struct osmo_fsm_inst * | _bvc_fsm_alloc (void *ctx, struct gprs_ns2_inst *nsi, bool role_sgsn, uint16_t nsei, uint16_t bvci) |
struct osmo_fsm_inst * | bssgp_bvc_fsm_alloc_sig_bss (void *ctx, struct gprs_ns2_inst *nsi, uint16_t nsei, uint32_t features) |
Allocate a SIGNALING-BVC FSM for the BSS role (facing a remote SGSN). More... | |
struct osmo_fsm_inst * | bssgp_bvc_fsm_alloc_ptp_bss (void *ctx, struct gprs_ns2_inst *nsi, uint16_t nsei, uint16_t bvci, const struct gprs_ra_id *ra_id, uint16_t cell_id) |
Allocate a PTP-BVC FSM for the BSS role (facing a remote SGSN). More... | |
struct osmo_fsm_inst * | bssgp_bvc_fsm_alloc_sig_sgsn (void *ctx, struct gprs_ns2_inst *nsi, uint16_t nsei, uint32_t features) |
Allocate a SIGNALING-BVC FSM for the SGSN role (facing a remote BSS). More... | |
struct osmo_fsm_inst * | bssgp_bvc_fsm_alloc_ptp_sgsn (void *ctx, struct gprs_ns2_inst *nsi, uint16_t nsei, uint16_t bvci) |
Allocate a PTP-BVC FSM for the SGSN role (facing a remote BSS). More... | |
void | bssgp_bvc_fsm_set_ops (struct osmo_fsm_inst *fi, const struct bssgp_bvc_fsm_ops *ops, void *ops_priv) |
Set the 'operations' callbacks + private data. More... | |
bool | bssgp_bvc_fsm_is_unblocked (struct osmo_fsm_inst *fi) |
Return if the given BVC FSM is in UNBLOCKED state. More... | |
uint8_t | bssgp_bvc_fsm_get_block_cause (struct osmo_fsm_inst *fi) |
Determine the cause value why given BVC FSM is blocked. More... | |
uint32_t | bssgp_bvc_fsm_get_features_advertised (struct osmo_fsm_inst *fi) |
Return the advertised features / extended features. More... | |
uint32_t | bssgp_bvc_fsm_get_features_received (struct osmo_fsm_inst *fi) |
Return the received features / extended features. More... | |
uint32_t | bssgp_bvc_fsm_get_features_negotiated (struct osmo_fsm_inst *fi) |
Return the negotiated features / extended features. More... | |
void | bssgp_bvc_fsm_set_max_pdu_len (struct osmo_fsm_inst *fi, uint16_t max_pdu_len) |
Set the maximum size of a BSSGP PDU. More... | |
uint16_t | bssgp_bvc_fsm_get_max_pdu_len (const struct osmo_fsm_inst *fi) |
Return the maximum size of a BSSGP PDU ! On the NS layer this corresponds to the size of an NS SDU in NS-UNITDATA (3GPP TS 48.016 Ch. More... | |
static | __attribute__ ((constructor)) |
Variables | |
struct osmo_tdef | bssgp_bvc_fsm_tdefs [] |
static struct osmo_fsm | bssgp_bvc_fsm |
static const struct value_string | ptp_bvc_event_names [] |
static const struct osmo_fsm_state | bssgp_bvc_fsm_states [] |
#define T1 1 |
#define T1_SECS osmo_tdef_get(bssgp_bvc_fsm_tdefs, 1, OSMO_TDEF_S, 5) |
#define T2 2 |
#define T2_SECS osmo_tdef_get(bssgp_bvc_fsm_tdefs, 2, OSMO_TDEF_S, 10) |
|
static |
References bssgp_bvc_fsm, OSMO_ASSERT, and osmo_fsm_register().
|
static |
References bssgp_bvc_fsm, bvci, bvc_fsm_priv::bvci, LOGL_INFO, bvc_fsm_priv::max_pdu_len, nsei, bvc_fsm_priv::nsei, bvc_fsm_priv::nsi, osmo_fsm_inst_alloc(), osmo_fsm_inst_free(), osmo_fsm_inst::priv, and bvc_fsm_priv::role_sgsn.
Referenced by bssgp_bvc_fsm_alloc_ptp_bss(), bssgp_bvc_fsm_alloc_ptp_sgsn(), bssgp_bvc_fsm_alloc_sig_bss(), and bssgp_bvc_fsm_alloc_sig_sgsn().
|
static |
|
static |
References bvc_fsm_priv::advertised, bssgp2_enc_bvc_reset(), bssgp_bvc_fsm, bvc_fsm_priv::bvci, cause, bvc_fsm_priv::cell_id, bvc_fsm_priv::features, fi_tx_sig(), osmo_fsm_inst::fsm, OSMO_ASSERT, osmo_fsm_inst::priv, bvc_fsm_priv::ra_id, and bvc_fsm_priv::role_sgsn.
Referenced by bssgp_bvc_fsm_allstate(), and bssgp_bvc_fsm_timer_cb().
|
static |
References bvc_fsm_priv::advertised, bssgp2_enc_bvc_reset_ack(), bssgp_bvc_fsm, bvc_fsm_priv::bvci, bvc_fsm_priv::cell_id, bvc_fsm_priv::features, fi_tx_sig(), osmo_fsm_inst::fsm, OSMO_ASSERT, osmo_fsm_inst::priv, bvc_fsm_priv::ra_id, and bvc_fsm_priv::role_sgsn.
Referenced by bssgp_bvc_fsm_allstate(), and bssgp_bvc_fsm_timer_cb().
|
static |
References bssgp2_enc_status(), BSSGP_CAUSE_BVCI_BLOCKED, BSSGP_CAUSE_UNKNOWN_BVCI, bvci, bvc_fsm_priv::bvci, cause, fi_tx_ptp(), fi_tx_sig(), bvc_fsm_priv::max_pdu_len, msgb_bvci, and osmo_fsm_inst::priv.
Referenced by bssgp_bvc_fsm_blocked(), and bssgp_bvc_fsm_unblocked().
struct osmo_fsm_inst * bssgp_bvc_fsm_alloc_ptp_bss | ( | void * | ctx, |
struct gprs_ns2_inst * | nsi, | ||
uint16_t | nsei, | ||
uint16_t | bvci, | ||
const struct gprs_ra_id * | ra_id, | ||
uint16_t | cell_id | ||
) |
Allocate a PTP-BVC FSM for the BSS role (facing a remote SGSN).
[in] | ctx | talloc context from which to allocate |
[in] | nsi | NS Instance on which this BVC operates |
[in] | nsei | NS Entity Identifier on which this BVC operates |
[in] | bvci | BVCI of this FSM |
[in] | ra_id | Routing Area Identity of the cell (reported to SGSN) |
[in] | cell_id | Cell Identifier of the cell (reported to SGSN) |
References _bvc_fsm_alloc(), bvci, bvc_fsm_priv::cell_id, nsei, bvc_fsm_priv::nsi, OSMO_ASSERT, osmo_fsm_inst::priv, and bvc_fsm_priv::ra_id.
struct osmo_fsm_inst * bssgp_bvc_fsm_alloc_ptp_sgsn | ( | void * | ctx, |
struct gprs_ns2_inst * | nsi, | ||
uint16_t | nsei, | ||
uint16_t | bvci | ||
) |
Allocate a PTP-BVC FSM for the SGSN role (facing a remote BSS).
[in] | ctx | talloc context from which to allocate |
[in] | nsi | NS Instance on which this BVC operates |
[in] | nsei | NS Entity Identifier on which this BVC operates |
[in] | bvci | BVCI of this FSM |
References _bvc_fsm_alloc(), bvci, nsei, and OSMO_ASSERT.
struct osmo_fsm_inst * bssgp_bvc_fsm_alloc_sig_bss | ( | void * | ctx, |
struct gprs_ns2_inst * | nsi, | ||
uint16_t | nsei, | ||
uint32_t | features | ||
) |
Allocate a SIGNALING-BVC FSM for the BSS role (facing a remote SGSN).
[in] | ctx | talloc context from which to allocate |
[in] | nsi | NS Instance on which this BVC operates |
[in] | nsei | NS Entity Identifier on which this BVC operates |
[in] | features | Feature [byte 0] and Extended Feature [byte 1] bitmap |
References _bvc_fsm_alloc(), bvc_fsm_priv::advertised, bvc_fsm_priv::features, nsei, and osmo_fsm_inst::priv.
struct osmo_fsm_inst * bssgp_bvc_fsm_alloc_sig_sgsn | ( | void * | ctx, |
struct gprs_ns2_inst * | nsi, | ||
uint16_t | nsei, | ||
uint32_t | features | ||
) |
Allocate a SIGNALING-BVC FSM for the SGSN role (facing a remote BSS).
[in] | ctx | talloc context from which to allocate |
[in] | nsi | NS Instance on which this BVC operates |
[in] | nsei | NS Entity Identifier on which this BVC operates |
[in] | features | Feature [byte 0] and Extended Feature [byte 1] bitmap |
References _bvc_fsm_alloc(), bvc_fsm_priv::advertised, bvc_fsm_priv::features, nsei, and osmo_fsm_inst::priv.
|
static |
References _tx_bvc_reset(), _tx_bvc_reset_ack(), BSSGP_BVCFSM_E_REQ_RESET, BSSGP_BVCFSM_E_RX_RESET, BSSGP_BVCFSM_S_UNBLOCKED, BSSGP_BVCFSM_S_WAIT_RESET_ACK, bssgp_cause_str(), BSSGP_IE_CAUSE, BSSGP_IE_CELL_ID, bssgp_parse_cell_id(), bvc_fsm_priv::bvci, cause, bvc_fsm_priv::cell_id, data, bvc_fsm_priv::last_reset_cause, bvc_fsm_priv::locally_blocked, LOGL_NOTICE, LOGPFSML, msgb_bcid, bvc_fsm_priv::nsei, bvc_fsm_priv::ops, bvc_fsm_priv::ops_priv, osmo_fsm_inst_state_chg, osmo_fsm_inst::priv, bvc_fsm_priv::ra_id, bssgp_bvc_fsm_ops::reset_notification, bvc_fsm_priv::role_sgsn, T2, T2_SECS, TLVP_VAL, and update_negotiated_features().
|
static |
References _tx_status(), bssgp2_enc_bvc_block_ack(), bssgp2_enc_bvc_unblock(), bssgp2_enc_bvc_unblock_ack(), BSSGP_BVCFSM_E_REQ_UNBLOCK, BSSGP_BVCFSM_E_RX_BLOCK, BSSGP_BVCFSM_E_RX_BLOCK_ACK, BSSGP_BVCFSM_E_RX_UNBLOCK, BSSGP_BVCFSM_S_BLOCKED, BSSGP_BVCFSM_S_UNBLOCKED, BSSGP_CAUSE_SEM_INCORR_PDU, bssgp_cause_str(), BSSGP_IE_CAUSE, bvc_fsm_priv::bvci, cause, data, fi_tx_sig(), bvc_fsm_priv::locally_blocked, LOGL_ERROR, LOGL_NOTICE, LOGPFSML, msgb_bcid, osmo_fsm_inst_state_chg, osmo_fsm_inst::priv, bvc_fsm_priv::role_sgsn, T1, T1_SECS, and TLVP_VAL.
|
static |
References _onenter_tail(), bvc_fsm_priv::bvci, OSMO_ASSERT, and osmo_fsm_inst::priv.
uint8_t bssgp_bvc_fsm_get_block_cause | ( | struct osmo_fsm_inst * | fi | ) |
Determine the cause value why given BVC FSM is blocked.
References bvc_fsm_priv::block_cause, bssgp_bvc_fsm, osmo_fsm_inst::fsm, OSMO_ASSERT, and osmo_fsm_inst::priv.
uint32_t bssgp_bvc_fsm_get_features_advertised | ( | struct osmo_fsm_inst * | fi | ) |
Return the advertised features / extended features.
References bvc_fsm_priv::advertised, bssgp_bvc_fsm, bvc_fsm_priv::features, osmo_fsm_inst::fsm, OSMO_ASSERT, and osmo_fsm_inst::priv.
uint32_t bssgp_bvc_fsm_get_features_negotiated | ( | struct osmo_fsm_inst * | fi | ) |
Return the negotiated features / extended features.
References bssgp_bvc_fsm, bvc_fsm_priv::features, osmo_fsm_inst::fsm, bvc_fsm_priv::negotiated, OSMO_ASSERT, and osmo_fsm_inst::priv.
uint32_t bssgp_bvc_fsm_get_features_received | ( | struct osmo_fsm_inst * | fi | ) |
Return the received features / extended features.
References bssgp_bvc_fsm, bvc_fsm_priv::features, osmo_fsm_inst::fsm, OSMO_ASSERT, osmo_fsm_inst::priv, and bvc_fsm_priv::received.
uint16_t bssgp_bvc_fsm_get_max_pdu_len | ( | const struct osmo_fsm_inst * | fi | ) |
Return the maximum size of a BSSGP PDU ! On the NS layer this corresponds to the size of an NS SDU in NS-UNITDATA (3GPP TS 48.016 Ch.
9.2.10)
References bssgp_bvc_fsm, osmo_fsm_inst::fsm, bvc_fsm_priv::max_pdu_len, OSMO_ASSERT, and osmo_fsm_inst::priv.
bool bssgp_bvc_fsm_is_unblocked | ( | struct osmo_fsm_inst * | fi | ) |
Return if the given BVC FSM is in UNBLOCKED state.
References BSSGP_BVCFSM_S_UNBLOCKED, and osmo_fsm_inst::state.
|
static |
References OSMO_ASSERT.
void bssgp_bvc_fsm_set_max_pdu_len | ( | struct osmo_fsm_inst * | fi, |
uint16_t | max_pdu_len | ||
) |
Set the maximum size of a BSSGP PDU.
! On the NS layer this corresponds to the size of an NS SDU in NS-UNITDATA (3GPP TS 48.016 Ch. 9.2.10)
References bssgp_bvc_fsm, osmo_fsm_inst::fsm, bvc_fsm_priv::max_pdu_len, OSMO_ASSERT, and osmo_fsm_inst::priv.
void bssgp_bvc_fsm_set_ops | ( | struct osmo_fsm_inst * | fi, |
const struct bssgp_bvc_fsm_ops * | ops, | ||
void * | ops_priv | ||
) |
Set the 'operations' callbacks + private data.
[in] | fi | FSM instance for which the data shall be set |
[in] | ops | BSSGP BVC FSM operations (call-back functions) to register |
[in] | ops_priv | opaque/private data pointer passed through to call-backs |
References bssgp_bvc_fsm, osmo_fsm_inst::fsm, bvc_fsm_priv::ops, bvc_fsm_priv::ops_priv, OSMO_ASSERT, and osmo_fsm_inst::priv.
|
static |
References _tx_bvc_reset(), _tx_bvc_reset_ack(), bvc_fsm_priv::block_cause, bssgp2_enc_bvc_block(), bssgp2_enc_bvc_unblock(), BSSGP_BVCFSM_S_BLOCKED, BSSGP_BVCFSM_S_UNBLOCKED, BSSGP_BVCFSM_S_WAIT_RESET_ACK, bvc_fsm_priv::bvci, fi_tx_sig(), bvc_fsm_priv::last_reset_cause, OSMO_ASSERT, osmo_fsm_inst_state_chg, osmo_fsm_inst::priv, osmo_fsm_inst::state, osmo_fsm_inst::T, T1, T1_SECS, T2, and T2_SECS.
|
static |
References _tx_status(), bvc_fsm_priv::block_cause, bssgp2_dec_fc_bvc(), bssgp2_enc_bvc_block(), bssgp2_enc_bvc_block_ack(), bssgp2_enc_fc_bvc(), bssgp2_enc_fc_bvc_ack(), BSSGP_BVCFSM_E_REQ_BLOCK, BSSGP_BVCFSM_E_REQ_FC_BVC, BSSGP_BVCFSM_E_RX_BLOCK, BSSGP_BVCFSM_E_RX_FC_BVC, BSSGP_BVCFSM_E_RX_FC_BVC_ACK, BSSGP_BVCFSM_E_RX_UNBLOCK, BSSGP_BVCFSM_E_RX_UNBLOCK_ACK, BSSGP_BVCFSM_S_BLOCKED, BSSGP_BVCFSM_S_UNBLOCKED, BSSGP_CAUSE_SEM_INCORR_PDU, bssgp_cause_str(), BSSGP_IE_CAUSE, BSSGP_PDUT_BVC_UNBLOCK_ACK, bssgp_tx_simple_bvci(), BSSGP_XFEAT_GBIT, bvc_fsm_priv::bvci, data, bvc_fsm_priv::fc_granularity, bvc_fsm_priv::features, fi_tx_ptp(), fi_tx_sig(), bvc_fsm_priv::locally_blocked, LOGL_ERROR, LOGL_NOTICE, LOGPFSML, msgb_bcid, bvc_fsm_priv::negotiated, bvc_fsm_priv::nsei, bvc_fsm_priv::ops, bvc_fsm_priv::ops_priv, OSMO_ASSERT, osmo_fsm_inst_state_chg, osmo_fsm_inst::priv, bvc_fsm_priv::role_sgsn, bssgp_bvc_fsm_ops::rx_fc_bvc, T1, T1_SECS, bssgp2_flow_ctrl::tag, and TLVP_VAL.
|
static |
References bvc_fsm_priv::block_cause, bssgp2_enc_bvc_block(), BSSGP_BVCFSM_E_RX_RESET, BSSGP_BVCFSM_E_RX_RESET_ACK, BSSGP_BVCFSM_S_BLOCKED, BSSGP_BVCFSM_S_UNBLOCKED, BSSGP_IE_CELL_ID, bssgp_parse_cell_id(), bvc_fsm_priv::bvci, cause, bvc_fsm_priv::cell_id, data, fi_tx_sig(), bvc_fsm_priv::last_reset_cause, bvc_fsm_priv::locally_blocked, msgb_bcid, bvc_fsm_priv::nsei, bvc_fsm_priv::ops, bvc_fsm_priv::ops_priv, osmo_fsm_inst_state_chg, osmo_fsm_inst::priv, bvc_fsm_priv::ra_id, bssgp_bvc_fsm_ops::reset_ack_notification, bvc_fsm_priv::role_sgsn, T1, T1_SECS, TLVP_VAL, and update_negotiated_features().
|
static |
References bssgp2_nsi_tx_ptp(), bssgp_bvc_fsm, bvc_fsm_priv::bvci, osmo_fsm_inst::fsm, LOGPFSM, msg, msgb_bssgph, bvc_fsm_priv::nsei, bvc_fsm_priv::nsi, OSMO_ASSERT, osmo_pdef_bssgp, osmo_tlv_prot_msg_name(), bssgp_normal_hdr::pdu_type, and osmo_fsm_inst::priv.
Referenced by _tx_status(), and bssgp_bvc_fsm_unblocked().
|
static |
References bssgp2_nsi_tx_sig(), bssgp_bvc_fsm, osmo_fsm_inst::fsm, LOGPFSM, msg, msgb_bssgph, bvc_fsm_priv::nsei, bvc_fsm_priv::nsi, OSMO_ASSERT, osmo_pdef_bssgp, osmo_tlv_prot_msg_name(), bssgp_normal_hdr::pdu_type, and osmo_fsm_inst::priv.
Referenced by _tx_bvc_reset(), _tx_bvc_reset_ack(), _tx_status(), bssgp_bvc_fsm_blocked(), bssgp_bvc_fsm_timer_cb(), bssgp_bvc_fsm_unblocked(), and bssgp_bvc_fsm_wait_reset_ack().
|
static |
References bvc_fsm_priv::advertised, bssgp_bvc_fsm, BSSGP_IE_EXT_FEATURE_BITMAP, BSSGP_IE_FEATURE_BITMAP, bvc_fsm_priv::features, osmo_fsm_inst::fsm, LOGL_NOTICE, LOGPFSML, bvc_fsm_priv::negotiated, OSMO_ASSERT, osmo_fsm_inst::priv, bvc_fsm_priv::received, TLVP_PRES_LEN, and TLVP_VAL.
Referenced by bssgp_bvc_fsm_allstate(), and bssgp_bvc_fsm_wait_reset_ack().
|
static |
Referenced by __attribute__(), _bvc_fsm_alloc(), _tx_bvc_reset(), _tx_bvc_reset_ack(), bssgp_bvc_fsm_get_block_cause(), bssgp_bvc_fsm_get_features_advertised(), bssgp_bvc_fsm_get_features_negotiated(), bssgp_bvc_fsm_get_features_received(), bssgp_bvc_fsm_get_max_pdu_len(), bssgp_bvc_fsm_set_max_pdu_len(), bssgp_bvc_fsm_set_ops(), fi_tx_ptp(), fi_tx_sig(), and update_negotiated_features().
|
static |
struct osmo_tdef bssgp_bvc_fsm_tdefs[] |
|
static |