libosmogb 1.10.0.64-ff3d
Osmocom Gb library
|
NS virtual circuit FSM implementation 3GPP TS 08.16 version 8.0.1 Release 1999 / ETSI TS 101 299 V8.0.1 (2002-05) as well as its successor 3GPP TS 48.016. More...
#include <errno.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <osmocom/core/fsm.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/rate_ctr.h>
#include <osmocom/core/socket.h>
#include <osmocom/core/stat_item.h>
#include <osmocom/gsm/prim.h>
#include <osmocom/gsm/tlv.h>
#include <osmocom/gprs/gprs_msgb.h>
#include <osmocom/gprs/protocol/gsm_08_16.h>
#include "gprs_ns2_internal.h"
Data Structures | |
struct | gprs_ns2_vc_priv |
Macros | |
#define | S(x) (1 << (x)) |
Functions | |
static struct gprs_ns2_inst * | ns_inst_from_fi (struct osmo_fsm_inst *fi) |
static void | start_test_procedure (struct osmo_fsm_inst *fi, bool start_tx_alive) |
static void | stop_test_procedure (struct gprs_ns2_vc_priv *priv) |
static int | alive_timer_elapsed_ms (struct gprs_ns2_vc_priv *priv) |
static void | recv_test_procedure (struct osmo_fsm_inst *fi) |
static void | alive_timeout_handler (void *data) |
static void | ns2_st_unconfigured_onenter (struct osmo_fsm_inst *fi, uint32_t old_state) |
static void | ns2_st_unconfigured (struct osmo_fsm_inst *fi, uint32_t event, void *data) |
static void | ns2_st_reset_onenter (struct osmo_fsm_inst *fi, uint32_t old_state) |
static void | ns2_st_reset (struct osmo_fsm_inst *fi, uint32_t event, void *data) |
static void | ns2_st_blocked_onenter (struct osmo_fsm_inst *fi, uint32_t old_state) |
static void | ns2_st_blocked (struct osmo_fsm_inst *fi, uint32_t event, void *data) |
static void | ns2_st_unblocked_on_enter (struct osmo_fsm_inst *fi, uint32_t old_state) |
static void | ns2_st_unblocked (struct osmo_fsm_inst *fi, uint32_t event, void *data) |
static void | ns2_st_alive (struct osmo_fsm_inst *fi, uint32_t event, void *data) |
static void | ns2_st_alive_onenter (struct osmo_fsm_inst *fi, uint32_t old_state) |
static int | ns2_vc_fsm_timer_cb (struct osmo_fsm_inst *fi) |
static void | ns2_recv_unitdata (struct osmo_fsm_inst *fi, struct msgb *msg) |
static void | ns2_vc_fsm_allstate_action (struct osmo_fsm_inst *fi, uint32_t event, void *data) |
static void | ns2_vc_fsm_clean (struct osmo_fsm_inst *fi, enum osmo_fsm_term_cause cause) |
struct osmo_fsm_inst * | ns2_vc_fsm_alloc (struct gprs_ns2_vc *nsvc, const char *id, bool initiator) |
gprs_ns2_vc_fsm_alloc More... | |
int | ns2_vc_fsm_start (struct gprs_ns2_vc *nsvc) |
Start a NS-VC FSM. More... | |
int | ns2_vc_force_unconfigured (struct gprs_ns2_vc *nsvc) |
Reset a NS-VC FSM. More... | |
int | ns2_vc_block (struct gprs_ns2_vc *nsvc) |
Block a NS-VC. More... | |
int | ns2_vc_unblock (struct gprs_ns2_vc *nsvc) |
Unblock a NS-VC. More... | |
int | ns2_vc_reset (struct gprs_ns2_vc *nsvc) |
Reset a NS-VC. More... | |
int | ns2_vc_rx (struct gprs_ns2_vc *nsvc, struct msgb *msg, struct tlv_parsed *tp) |
entry point for messages from the driver/VL More... | |
int | ns2_vc_is_unblocked (struct gprs_ns2_vc *nsvc) |
is the given NS-VC unblocked? More... | |
static | __attribute__ ((constructor)) |
Variables | |
static const struct value_string | ns2_vc_event_names [] |
static const struct osmo_fsm_state | ns2_vc_states [] |
static struct osmo_fsm | ns2_vc_fsm |
NS virtual circuit FSM implementation 3GPP TS 08.16 version 8.0.1 Release 1999 / ETSI TS 101 299 V8.0.1 (2002-05) as well as its successor 3GPP TS 48.016.
enum gprs_ns2_vc_event |
enum gprs_ns2_vc_state |
|
static |
References ns2_vc_fsm, OSMO_ASSERT, and osmo_fsm_register().
|
static |
References gprs_ns2_vc_priv::alive, data, GPRS_NS2_ST_RECOVERING, GPRS_NS2_ST_RESET, GPRS_NS2_VC_MODE_BLOCKRESET, gprs_ns2_vc::mode, gprs_ns2_vc_priv::mode, gprs_ns2_vc_priv::N, ns2_tx_alive(), NS_CTR_LOST_ALIVE, ns_inst_from_fi(), NS_TOUT_TNS_ALIVE, NS_TOUT_TNS_ALIVE_RETRIES, NS_TOUT_TNS_RESET, NS_TOUT_TNS_TEST, gprs_ns2_vc_priv::nsvc, osmo_clock_gettime(), osmo_fsm_inst_state_chg, osmo_timer_schedule(), osmo_fsm_inst::priv, RATE_CTR_INC_NS, gprs_ns2_inst::timeout, gprs_ns2_vc_priv::timer, and gprs_ns2_vc_priv::timer_started.
Referenced by ns2_vc_fsm_alloc().
|
static |
References gprs_ns2_vc_priv::alive, osmo_clock_gettime(), gprs_ns2_vc_priv::timer_started, and timespecsub.
Referenced by recv_test_procedure().
|
static |
References msg, ns_inst_from_fi(), and osmo_fsm_inst::priv.
Referenced by ns2_vc_fsm_allstate_action().
|
static |
References GPRS_NS2_EV_RX_ALIVE_ACK, GPRS_NS2_ST_UNBLOCKED, and osmo_fsm_inst_state_chg.
Referenced by ns2_vc_fsm_allstate_action().
|
static |
References gprs_ns2_vc_priv::alive, GPRS_NS2_ST_RECOVERING, gprs_ns2_vc_priv::mode, gprs_ns2_vc_priv::N, ns2_nse_notify_unblocked(), ns_inst_from_fi(), NS_TOUT_TNS_TEST, gprs_ns2_vc_priv::nsvc, osmo_timer_schedule(), osmo_fsm_inst::priv, start_test_procedure(), gprs_ns2_inst::timeout, and gprs_ns2_vc_priv::timer.
|
static |
References gprs_ns2_vc_priv::accept_unitdata, GPRS_NS2_EV_RX_BLOCK, GPRS_NS2_EV_RX_BLOCK_ACK, GPRS_NS2_EV_RX_BLOCK_FOREIGN, GPRS_NS2_EV_RX_UNBLOCK, GPRS_NS2_EV_RX_UNBLOCK_ACK, GPRS_NS2_ST_UNBLOCKED, gprs_ns2_vc_priv::initiate_block, ns2_tx_block(), ns2_tx_block_ack(), ns2_tx_unblock_ack(), NS_CAUSE_OM_INTERVENTION, NS_TOUT_TNS_TEST, gprs_ns2_vc_priv::nsvc, gprs_ns2_vc::om_blocked, osmo_fsm_inst_state_chg, osmo_timer_add(), osmo_timer_del(), osmo_fsm_inst::priv, and osmo_fsm_inst::timer.
|
static |
References GPRS_NS2_ST_BLOCKED, GPRS_NS2_ST_RESET, gprs_ns2_vc_priv::initiate_block, gprs_ns2_vc_priv::N, ns2_nse_notify_unblocked(), ns2_tx_block(), ns2_tx_unblock(), NS_CAUSE_OM_INTERVENTION, NS_CTR_BLOCKED, gprs_ns2_vc_priv::nsvc, gprs_ns2_vc::om_blocked, osmo_timer_del(), osmo_fsm_inst::priv, RATE_CTR_INC_NS, start_test_procedure(), and osmo_fsm_inst::timer.
|
static |
References GPRS_NS2_EV_RX_RESET, GPRS_NS2_EV_RX_RESET_ACK, GPRS_NS2_ST_BLOCKED, gprs_ns2_vc_priv::initiate_reset, ns2_tx_reset_ack(), ns_inst_from_fi(), NS_TOUT_TNS_BLOCK, gprs_ns2_vc_priv::nsvc, osmo_fsm_inst_state_chg, osmo_fsm_inst::priv, and gprs_ns2_inst::timeout.
Referenced by ns2_vc_fsm_allstate_action().
|
static |
|
static |
|
static |
|
static |
References gprs_ns2_nse::dialect, GPRS_NS2_DIALECT_SNS, GPRS_NS2_EV_REQ_START, GPRS_NS2_ST_RECOVERING, GPRS_NS2_ST_RESET, GPRS_NS2_ST_UNBLOCKED, GPRS_NS2_VC_MODE_ALIVE, GPRS_NS2_VC_MODE_BLOCKRESET, gprs_ns2_vc_priv::initiate_block, gprs_ns2_vc_priv::initiate_reset, gprs_ns2_vc_priv::initiator, gprs_ns2_vc::mode, NS_TOUT_TNS_ALIVE, NS_TOUT_TNS_RESET, gprs_ns2_vc::nse, gprs_ns2_nse::nsi, gprs_ns2_vc_priv::nsvc, gprs_ns2_vc::om_blocked, OSMO_ASSERT, osmo_fsm_inst_state_chg, osmo_fsm_inst::priv, and gprs_ns2_inst::timeout.
|
static |
References ns2_nse_notify_unblocked(), gprs_ns2_vc_priv::nsvc, osmo_fsm_inst::priv, and stop_test_procedure().
int ns2_vc_block | ( | struct gprs_ns2_vc * | nsvc | ) |
Block a NS-VC.
nsvc | the virtual circuit |
References gprs_ns2_vc::fi, GPRS_NS2_EV_REQ_OM_BLOCK, gprs_ns2_vc_priv::nsvc, gprs_ns2_vc::om_blocked, osmo_fsm_inst_dispatch, and osmo_fsm_inst::priv.
Referenced by DEFUN().
int ns2_vc_force_unconfigured | ( | struct gprs_ns2_vc * | nsvc | ) |
Reset a NS-VC FSM.
nsvc | the virtual circuit |
References gprs_ns2_vc::fi, GPRS_NS2_EV_REQ_FORCE_UNCONFIGURED, gprs_ns2_vc_priv::nsvc, and osmo_fsm_inst_dispatch.
Referenced by fr_dlci_status_cb(), ns2_sns_st_all_action_sgsn(), and nsvc_force_unconf_cb().
struct osmo_fsm_inst * ns2_vc_fsm_alloc | ( | struct gprs_ns2_vc * | nsvc, |
const char * | id, | ||
bool | initiator | ||
) |
gprs_ns2_vc_fsm_alloc
ctx | |
vc | |
id | a char representation of the virtual curcuit |
initiator | initiator is the site which starts the connection. Usually the BSS. |
References gprs_ns2_vc_priv::alive, alive_timeout_handler(), gprs_ns2_vc::fi, gprs_ns2_vc_priv::initiator, LOGL_DEBUG, ns2_vc_fsm, gprs_ns2_vc_priv::nsvc, osmo_fsm_inst_alloc(), osmo_timer_setup(), osmo_fsm_inst::priv, and gprs_ns2_vc_priv::timer.
Referenced by ns2_vc_alloc().
|
static |
References gprs_ns2_vc_priv::accept_unitdata, cause, data, GPRS_NS2_EV_REQ_FORCE_UNCONFIGURED, GPRS_NS2_EV_REQ_OM_BLOCK, GPRS_NS2_EV_REQ_OM_RESET, GPRS_NS2_EV_REQ_OM_UNBLOCK, GPRS_NS2_EV_RX_ALIVE, GPRS_NS2_EV_RX_ALIVE_ACK, GPRS_NS2_EV_RX_RESET, GPRS_NS2_EV_RX_STATUS, GPRS_NS2_EV_RX_UNITDATA, GPRS_NS2_ST_BLOCKED, GPRS_NS2_ST_RECOVERING, GPRS_NS2_ST_RESET, GPRS_NS2_ST_UNBLOCKED, GPRS_NS2_ST_UNCONFIGURED, GPRS_NS2_VC_MODE_BLOCKRESET, gprs_ns2_vc_priv::initiate_block, gprs_ns2_vc_priv::initiate_reset, LOG_NS_DATA, LOG_NS_SIGNAL, LOGL_ERROR, LOGL_INFO, gprs_ns2_vc::mode, msg, msgb_free(), ns2_recv_unitdata(), ns2_st_alive(), ns2_st_reset(), ns2_tx_alive_ack(), ns2_tx_status(), NS_CAUSE_NSVC_BLOCKED, NS_CAUSE_NSVC_UNKNOWN, NS_IE_CAUSE, ns_inst_from_fi(), NS_PDUT_STATUS, NS_PDUT_UNITDATA, NS_TOUT_TNS_BLOCK, NS_TOUT_TNS_RESET, gprs_ns2_vc_priv::nsvc, gprs_ns2_vc::om_blocked, osmo_fsm_inst_state_chg, osmo_fsm_inst::priv, recv_test_procedure(), osmo_fsm_inst::state, gprs_ns2_inst::timeout, and tlvp_val8().
|
static |
References gprs_ns2_vc_priv::alive, osmo_timer_del(), osmo_fsm_inst::priv, and gprs_ns2_vc_priv::timer.
int ns2_vc_fsm_start | ( | struct gprs_ns2_vc * | nsvc | ) |
Start a NS-VC FSM.
nsvc | the virtual circuit |
References gprs_ns2_vc::fi, GPRS_NS2_EV_REQ_START, GPRS_NS2_ST_UNCONFIGURED, gprs_ns2_vc_priv::nsvc, osmo_fsm_inst_dispatch, and osmo_fsm_inst::state.
Referenced by fr_dlci_status_cb(), gprs_ns2_ip_connect(), gprs_ns2_start_alive_all_nsvcs(), handle_nsfrgre_read(), handle_nsip_recvfrom(), and nsvc_force_unconf_cb().
|
static |
References gprs_ns2_vc_priv::accept_unitdata, GPRS_NS2_ST_BLOCKED, GPRS_NS2_ST_RECOVERING, GPRS_NS2_ST_RESET, gprs_ns2_vc_priv::initiate_block, gprs_ns2_vc_priv::initiate_reset, gprs_ns2_vc_priv::N, NS_CTR_LOST_RESET, ns_inst_from_fi(), NS_TOUT_TNS_ALIVE_RETRIES, NS_TOUT_TNS_BLOCK, NS_TOUT_TNS_BLOCK_RETRIES, NS_TOUT_TNS_RESET, NS_TOUT_TNS_RESET_RETRIES, gprs_ns2_vc_priv::nsvc, gprs_ns2_vc::om_blocked, osmo_fsm_inst_state_chg, osmo_fsm_inst::priv, RATE_CTR_INC_NS, osmo_fsm_inst::state, and gprs_ns2_inst::timeout.
int ns2_vc_is_unblocked | ( | struct gprs_ns2_vc * | nsvc | ) |
is the given NS-VC unblocked?
References gprs_ns2_vc::fi, GPRS_NS2_ST_UNBLOCKED, and osmo_fsm_inst::state.
Referenced by ns2_count_transfer_cap(), ns2_load_sharing_first(), ns2_load_sharing_modulo(), ns2_load_sharing_signal(), ns2_load_sharing_weight_modulo(), ns2_nse_data_sum(), ns2_sns_notify_alive(), ns2_sns_replace_nsvc(), ns2_sns_st_configured_onenter(), and ns2_vty_dump_nsvc().
int ns2_vc_reset | ( | struct gprs_ns2_vc * | nsvc | ) |
Reset a NS-VC.
nsvc | the virtual circuit |
References gprs_ns2_vc::fi, GPRS_NS2_EV_REQ_OM_RESET, gprs_ns2_vc_priv::nsvc, and osmo_fsm_inst_dispatch.
Referenced by DEFUN().
int ns2_vc_rx | ( | struct gprs_ns2_vc * | nsvc, |
struct msgb * | msg, | ||
struct tlv_parsed * | tp | ||
) |
entry point for messages from the driver/VL
nsvc | virtual circuit on which the message was received |
msg | message that was received |
tp | parsed TLVs of the received message |
References cause, gprs_ns2_vc::fi, get_value_string(), GPRS_NS2_EV_RX_ALIVE, GPRS_NS2_EV_RX_ALIVE_ACK, GPRS_NS2_EV_RX_BLOCK, GPRS_NS2_EV_RX_BLOCK_ACK, GPRS_NS2_EV_RX_BLOCK_FOREIGN, GPRS_NS2_EV_RX_RESET, GPRS_NS2_EV_RX_RESET_ACK, GPRS_NS2_EV_RX_STATUS, GPRS_NS2_EV_RX_UNBLOCK, GPRS_NS2_EV_RX_UNBLOCK_ACK, GPRS_NS2_EV_RX_UNITDATA, gprs_ns2_nsvc_by_nsvci(), gprs_ns_pdu_strings, if(), LOG_NS_SIGNAL, LOGL_ERROR, LOGPFSML, msg, msgb_free(), ns2_tx_block_ack(), ns2_tx_reset_ack(), ns2_tx_status(), ns2_validate(), NS_CAUSE_NSVC_UNKNOWN, NS_IE_NSEI, NS_IE_VCI, NS_PDUT_ALIVE, NS_PDUT_ALIVE_ACK, NS_PDUT_BLOCK, NS_PDUT_BLOCK_ACK, NS_PDUT_RESET, NS_PDUT_RESET_ACK, NS_PDUT_STATUS, NS_PDUT_UNBLOCK, NS_PDUT_UNBLOCK_ACK, NS_PDUT_UNITDATA, gprs_ns2_vc::nse, nsei, gprs_ns2_nse::nsei, gprs_ns2_nse::nsi, gprs_ns2_vc::nsvci, gprs_ns2_vc::nsvci_is_valid, osmo_fsm_inst_dispatch, gprs_ns_hdr::pdu_type, TLVP_PRESENT, and tlvp_val16be().
int ns2_vc_unblock | ( | struct gprs_ns2_vc * | nsvc | ) |
Unblock a NS-VC.
nsvc | the virtual circuit |
References gprs_ns2_vc::fi, GPRS_NS2_EV_REQ_OM_UNBLOCK, gprs_ns2_vc_priv::nsvc, gprs_ns2_vc::om_blocked, osmo_fsm_inst_dispatch, and osmo_fsm_inst::priv.
Referenced by DEFUN().
|
inlinestatic |
|
static |
References alive_timer_elapsed_ms(), ns_inst_from_fi(), NS_STAT_ALIVE_DELAY, NS_TOUT_TNS_ALIVE, NS_TOUT_TNS_TEST, osmo_stat_item_group_get_item(), osmo_stat_item_set(), osmo_timer_schedule(), osmo_fsm_inst::priv, gprs_ns2_vc::priv, gprs_ns2_vc::statg, and gprs_ns2_inst::timeout.
Referenced by ns2_vc_fsm_allstate_action().
|
static |
References gprs_ns2_vc_priv::alive, LOGL_DEBUG, LOGPFSML, gprs_ns2_vc_priv::mode, gprs_ns2_vc_priv::N, ns2_tx_alive(), NS_TOUT_TNS_ALIVE, NS_TOUT_TNS_TEST, gprs_ns2_vc::nse, gprs_ns2_nse::nsi, gprs_ns2_vc_priv::nsvc, osmo_clock_gettime(), osmo_timer_pending(), osmo_timer_schedule(), osmo_fsm_inst::priv, gprs_ns2_inst::timeout, gprs_ns2_vc_priv::timer, and gprs_ns2_vc_priv::timer_started.
Referenced by ns2_st_alive_onenter(), ns2_st_blocked_onenter(), and ns2_st_unblocked_on_enter().
|
static |
|
static |
|
static |
Referenced by __attribute__(), and ns2_vc_fsm_alloc().
|
static |