Loading...
Searching...
No Matches
gprs_ns2_vc_fsm.c File Reference

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))

## Enumerations

enum | gprs_ns2_vc_state { GPRS_NS2_ST_UNCONFIGURED , GPRS_NS2_ST_RESET , GPRS_NS2_ST_BLOCKED , GPRS_NS2_ST_UNBLOCKED , GPRS_NS2_ST_RECOVERING }

enum

gprs_ns2_vc_event {
GPRS_NS2_EV_REQ_START ,
GPRS_NS2_EV_RX_RESET ,
GPRS_NS2_EV_RX_RESET_ACK ,
GPRS_NS2_EV_RX_UNBLOCK ,
GPRS_NS2_EV_RX_UNBLOCK_ACK ,
GPRS_NS2_EV_RX_BLOCK ,
GPRS_NS2_EV_RX_BLOCK_ACK ,
GPRS_NS2_EV_RX_ALIVE ,
GPRS_NS2_EV_RX_ALIVE_ACK ,
GPRS_NS2_EV_RX_STATUS ,
GPRS_NS2_EV_RX_UNITDATA ,
GPRS_NS2_EV_REQ_FORCE_UNCONFIGURED ,
GPRS_NS2_EV_REQ_OM_RESET ,
GPRS_NS2_EV_REQ_OM_BLOCK ,
GPRS_NS2_EV_REQ_OM_UNBLOCK ,
GPRS_NS2_EV_RX_BLOCK_FOREIGN
}

## 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
int | ns2_vc_fsm_start (struct gprs_ns2_vc *nsvc)
| Start a NS-VC FSM.
int | ns2_vc_force_unconfigured (struct gprs_ns2_vc *nsvc)
| Reset a NS-VC FSM.
int | ns2_vc_block (struct gprs_ns2_vc *nsvc)
| Block a NS-VC.
int | ns2_vc_unblock (struct gprs_ns2_vc *nsvc)
| Unblock a NS-VC.
int | ns2_vc_reset (struct gprs_ns2_vc *nsvc)
| Reset a NS-VC.
int | ns2_vc_rx (struct gprs_ns2_vc *nsvc, struct msgb *msg, struct tlv_parsed *tp)
| entry point for messages from the driver/VL
int | ns2_vc_is_unblocked (struct gprs_ns2_vc *nsvc)
| is the given NS-VC unblocked?
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

## Detailed Description

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.

## Macro Definition Documentation

## S

#define S | ( |  | x | ) | (1 << (x))

## Enumeration Type Documentation

## gprs_ns2_vc_event

enum gprs_ns2_vc_event

Enumerator
GPRS_NS2_EV_REQ_START |
GPRS_NS2_EV_RX_RESET |
GPRS_NS2_EV_RX_RESET_ACK |
GPRS_NS2_EV_RX_UNBLOCK |
GPRS_NS2_EV_RX_UNBLOCK_ACK |
GPRS_NS2_EV_RX_BLOCK |
GPRS_NS2_EV_RX_BLOCK_ACK |
GPRS_NS2_EV_RX_ALIVE |
GPRS_NS2_EV_RX_ALIVE_ACK |
GPRS_NS2_EV_RX_STATUS |
GPRS_NS2_EV_RX_UNITDATA |
GPRS_NS2_EV_REQ_FORCE_UNCONFIGURED |
GPRS_NS2_EV_REQ_OM_RESET |
GPRS_NS2_EV_REQ_OM_BLOCK |
GPRS_NS2_EV_REQ_OM_UNBLOCK |
GPRS_NS2_EV_RX_BLOCK_FOREIGN |

## gprs_ns2_vc_state

enum gprs_ns2_vc_state

Enumerator
GPRS_NS2_ST_UNCONFIGURED |
GPRS_NS2_ST_RESET |
GPRS_NS2_ST_BLOCKED |
GPRS_NS2_ST_UNBLOCKED |
GPRS_NS2_ST_RECOVERING |

## Function Documentation

## __attribute__()

static __attribute__ | ( | (constructor) |  | ) |

static

References __attribute__, ns2_vc_fsm, OSMO_ASSERT, and osmo_fsm_register().

## alive_timeout_handler()

static void alive_timeout_handler | ( | void * | data | ) |

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().

## alive_timer_elapsed_ms()

static int alive_timer_elapsed_ms | ( | struct gprs_ns2_vc_priv * | priv | ) |

static

References gprs_ns2_vc_priv::alive, osmo_clock_gettime(), gprs_ns2_vc_priv::timer_started, and timespecsub.

Referenced by recv_test_procedure().

## ns2_recv_unitdata()

static void ns2_recv_unitdata | ( | struct osmo_fsm_inst * | fi,
|  | struct msgb * | msg
| ) |  |

static

References bvci, osmo_gprs_ns2_prim::bvci, gprs_ns2_inst::cb, gprs_ns2_inst::cb_data, osmo_gprs_ns2_prim::change, gprs_ns_hdr::data, GPRS_NS2_ENDPOINT_REQUEST_CHANGE, GPRS_NS2_PRIM_UNIT_DATA, msg, msgb_free(), ns_inst_from_fi(), gprs_ns2_vc::nse, osmo_gprs_ns2_prim::nsei, gprs_ns2_nse::nsei, gprs_ns2_vc_priv::nsvc, osmo_gprs_ns2_prim::oph, PRIM_OP_INDICATION, osmo_fsm_inst::priv, SAP_NS, osmo_gprs_ns2_prim::u, and osmo_gprs_ns2_prim::unitdata.

Referenced by ns2_vc_fsm_allstate_action().

## ns2_st_alive()

static void ns2_st_alive | ( | struct osmo_fsm_inst * | fi,
|  | uint32_t | event,
|  | void * | data
| ) |  |

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().

## ns2_st_alive_onenter()

static void ns2_st_alive_onenter | ( | struct osmo_fsm_inst * | fi,
|  | uint32_t | old_state
| ) |  |

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.

## ns2_st_blocked()

static void ns2_st_blocked | ( | struct osmo_fsm_inst * | fi,
|  | uint32_t | event,
|  | void * | data
| ) |  |

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.

## ns2_st_blocked_onenter()

static void ns2_st_blocked_onenter | ( | struct osmo_fsm_inst * | fi,
|  | uint32_t | old_state
| ) |  |

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.

## ns2_st_reset()

static void ns2_st_reset | ( | struct osmo_fsm_inst * | fi,
|  | uint32_t | event,
|  | void * | data
| ) |  |

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().

## ns2_st_reset_onenter()

static void ns2_st_reset_onenter | ( | struct osmo_fsm_inst * | fi,
|  | uint32_t | old_state
| ) |  |

static

References gprs_ns2_vc_priv::accept_unitdata, GPRS_NS2_ST_RESET, gprs_ns2_vc_priv::initiate_reset, gprs_ns2_vc_priv::N, ns2_nse_notify_unblocked(), ns2_tx_reset(), NS_CAUSE_OM_INTERVENTION, gprs_ns2_vc_priv::nsvc, osmo_fsm_inst::priv, and stop_test_procedure().

## ns2_st_unblocked()

static void ns2_st_unblocked | ( | struct osmo_fsm_inst * | fi,
|  | uint32_t | event,
|  | void * | data
| ) |  |

static

References gprs_ns2_vc_priv::accept_unitdata, GPRS_NS2_EV_RX_BLOCK, GPRS_NS2_EV_RX_BLOCK_FOREIGN, GPRS_NS2_EV_RX_UNBLOCK, GPRS_NS2_ST_BLOCKED, gprs_ns2_vc_priv::initiate_block, ns2_tx_block_ack(), ns2_tx_unblock_ack(), gprs_ns2_vc_priv::nsvc, osmo_fsm_inst_state_chg, and osmo_fsm_inst::priv.

## ns2_st_unblocked_on_enter()

static void ns2_st_unblocked_on_enter | ( | struct osmo_fsm_inst * | fi,
|  | uint32_t | old_state
| ) |  |

static

References gprs_ns2_vc_priv::accept_unitdata, GPRS_NS2_AFF_CAUSE_VC_RECOVERY, GPRS_NS2_ST_UNBLOCKED, ns2_nse_notify_unblocked(), ns2_prim_status_ind(), NS_CTR_UNBLOCKED, gprs_ns2_nse::nsvc, osmo_clock_gettime(), osmo_fsm_inst::priv, gprs_ns2_vc::priv, RATE_CTR_INC_NS, and start_test_procedure().

## ns2_st_unconfigured()

static void ns2_st_unconfigured | ( | struct osmo_fsm_inst * | fi,
|  | uint32_t | event,
|  | void * | data
| ) |  |

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.

## ns2_st_unconfigured_onenter()

static void ns2_st_unconfigured_onenter | ( | struct osmo_fsm_inst * | fi,
|  | uint32_t | old_state
| ) |  |

static

References ns2_nse_notify_unblocked(), gprs_ns2_vc_priv::nsvc, osmo_fsm_inst::priv, and stop_test_procedure().

## ns2_vc_block()

int ns2_vc_block | ( | struct gprs_ns2_vc * | nsvc | ) |

Block a NS-VC.

Parameters

  nsvc | the virtual circuit

Returns
  0 on success; negative on error

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().

## ns2_vc_force_unconfigured()

int ns2_vc_force_unconfigured | ( | struct gprs_ns2_vc * | nsvc | ) |

Reset a NS-VC FSM.

Parameters

  nsvc | the virtual circuit

Returns
  0 on success; negative on error

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().

## ns2_vc_fsm_alloc()

struct osmo_fsm_inst * ns2_vc_fsm_alloc | ( | struct gprs_ns2_vc * | nsvc,
|  | const char * | id,
|  | bool | initiator
| ) |  |

gprs_ns2_vc_fsm_alloc

Parameters

  ctx |
  vc |
  id | a char representation of the virtual curcuit
  initiator | initiator is the site which starts the connection. Usually the BSS.

Returns
  NULL on error, otherwise the fsm

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().

## ns2_vc_fsm_allstate_action()

static void ns2_vc_fsm_allstate_action | ( | struct osmo_fsm_inst * | fi,
|  | uint32_t | event,
|  | void * | data
| ) |  |

static

References gprs_ns2_vc_priv::accept_unitdata, cause, msgb::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, msgb::len, 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, and gprs_ns2_inst::timeout.

## ns2_vc_fsm_clean()

static void ns2_vc_fsm_clean | ( | struct osmo_fsm_inst * | fi,
|  | enum osmo_fsm_term_cause | cause
| ) |  |

static

References gprs_ns2_vc_priv::alive, osmo_timer_del(), osmo_fsm_inst::priv, and gprs_ns2_vc_priv::timer.

## ns2_vc_fsm_start()

int ns2_vc_fsm_start | ( | struct gprs_ns2_vc * | nsvc | ) |

Start a NS-VC FSM.

Parameters

  nsvc | the virtual circuit

Returns
  0 on success; negative on error

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().

## ns2_vc_fsm_timer_cb()

static int ns2_vc_fsm_timer_cb | ( | struct osmo_fsm_inst * | fi | ) |

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.

## ns2_vc_is_unblocked()

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().

## ns2_vc_reset()

int ns2_vc_reset | ( | struct gprs_ns2_vc * | nsvc | ) |

Reset a NS-VC.

Parameters

  nsvc | the virtual circuit

Returns
  0 on success; negative on error

References gprs_ns2_vc::fi, GPRS_NS2_EV_REQ_OM_RESET, gprs_ns2_vc_priv::nsvc, and osmo_fsm_inst_dispatch.

Referenced by DEFUN().

## ns2_vc_rx()

int ns2_vc_rx | ( | struct gprs_ns2_vc * | nsvc,
|  | struct msgb * | msg,
|  | struct tlv_parsed * | tp
| ) |  |

entry point for messages from the driver/VL

Parameters

  nsvc | virtual circuit on which the message was received
  msg | message that was received
  tp | parsed TLVs of the received message

Returns
  0 on success; negative on error

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, 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, and TLVP_PRESENT.

Referenced by ns2_recv_vc().

## ns2_vc_unblock()

int ns2_vc_unblock | ( | struct gprs_ns2_vc * | nsvc | ) |

Unblock a NS-VC.

Parameters

  nsvc | the virtual circuit

Returns
  0 on success; negative on error

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().

## ns_inst_from_fi()

static struct gprs_ns2_inst * ns_inst_from_fi | ( | struct osmo_fsm_inst * | fi | ) |

inline static

References gprs_ns2_vc::nse, gprs_ns2_nse::nsi, gprs_ns2_vc_priv::nsvc, and osmo_fsm_inst::priv.

Referenced by alive_timeout_handler(), ns2_recv_unitdata(), ns2_st_alive_onenter(), ns2_st_reset(), ns2_vc_fsm_allstate_action(), ns2_vc_fsm_timer_cb(), and recv_test_procedure().

## recv_test_procedure()

static void recv_test_procedure | ( | struct osmo_fsm_inst * | fi | ) |

static

References alive_timer_elapsed_ms(), gprs_ns2_vc::mode, 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().

## start_test_procedure()

static void start_test_procedure | ( | struct osmo_fsm_inst * | fi,
|  | bool | start_tx_alive
| ) |  |

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().

## stop_test_procedure()

static void stop_test_procedure | ( | struct gprs_ns2_vc_priv * | priv | ) |

static

References gprs_ns2_vc_priv::alive, NS_STAT_ALIVE_DELAY, gprs_ns2_vc_priv::nsvc, osmo_stat_item_group_get_item(), osmo_stat_item_set(), osmo_timer_del(), gprs_ns2_vc::statg, and gprs_ns2_vc_priv::timer.

Referenced by ns2_st_reset_onenter(), and ns2_st_unconfigured_onenter().

## Variable Documentation

## ns2_vc_event_names

const struct value_string ns2_vc_event_names[]

static

Initial value:
= {
{ GPRS_NS2_EV_REQ_START, "REQ-START" },
{ GPRS_NS2_EV_RX_RESET, "RX-RESET" },
{ GPRS_NS2_EV_RX_RESET_ACK, "RX-RESET_ACK" },
{ GPRS_NS2_EV_RX_UNBLOCK, "RX-UNBLOCK" },
{ GPRS_NS2_EV_RX_UNBLOCK_ACK, "RX-UNBLOCK_ACK" },
{ GPRS_NS2_EV_RX_BLOCK, "RX-BLOCK" },
{ GPRS_NS2_EV_RX_BLOCK_FOREIGN, "RX-BLOCK_FOREIGN" },
{ GPRS_NS2_EV_RX_BLOCK_ACK, "RX-BLOCK_ACK" },
{ GPRS_NS2_EV_RX_ALIVE, "RX-ALIVE" },
{ GPRS_NS2_EV_RX_ALIVE_ACK, "RX-ALIVE_ACK" },
{ GPRS_NS2_EV_RX_STATUS, "RX-STATUS" },
{ GPRS_NS2_EV_RX_UNITDATA, "RX-UNITDATA" },
{ GPRS_NS2_EV_REQ_FORCE_UNCONFIGURED, "REQ-FORCE_UNCONFIGURED" },
{ GPRS_NS2_EV_REQ_OM_RESET, "REQ-O&M-RESET"},
{ GPRS_NS2_EV_REQ_OM_BLOCK, "REQ-O&M-BLOCK"},
{ GPRS_NS2_EV_REQ_OM_UNBLOCK, "REQ-O&M-UNBLOCK"},
{ 0, NULL }
}
GPRS_NS2_EV_RX_BLOCK_ACK
@ GPRS_NS2_EV_RX_BLOCK_ACK
Definition gprs_ns2_vc_fsm.c:108
GPRS_NS2_EV_RX_RESET_ACK
@ GPRS_NS2_EV_RX_RESET_ACK
Definition gprs_ns2_vc_fsm.c:104
GPRS_NS2_EV_RX_ALIVE_ACK
@ GPRS_NS2_EV_RX_ALIVE_ACK
Definition gprs_ns2_vc_fsm.c:110
GPRS_NS2_EV_REQ_START
@ GPRS_NS2_EV_REQ_START
Definition gprs_ns2_vc_fsm.c:100
GPRS_NS2_EV_RX_BLOCK
@ GPRS_NS2_EV_RX_BLOCK
Definition gprs_ns2_vc_fsm.c:107
GPRS_NS2_EV_RX_UNBLOCK
@ GPRS_NS2_EV_RX_UNBLOCK
Definition gprs_ns2_vc_fsm.c:105
GPRS_NS2_EV_RX_ALIVE
@ GPRS_NS2_EV_RX_ALIVE
Definition gprs_ns2_vc_fsm.c:109
GPRS_NS2_EV_REQ_FORCE_UNCONFIGURED
@ GPRS_NS2_EV_REQ_FORCE_UNCONFIGURED
Definition gprs_ns2_vc_fsm.c:115
GPRS_NS2_EV_REQ_OM_RESET
@ GPRS_NS2_EV_REQ_OM_RESET
Definition gprs_ns2_vc_fsm.c:116
GPRS_NS2_EV_RX_UNITDATA
@ GPRS_NS2_EV_RX_UNITDATA
Definition gprs_ns2_vc_fsm.c:113
GPRS_NS2_EV_RX_BLOCK_FOREIGN
@ GPRS_NS2_EV_RX_BLOCK_FOREIGN
Definition gprs_ns2_vc_fsm.c:119
GPRS_NS2_EV_RX_STATUS
@ GPRS_NS2_EV_RX_STATUS
Definition gprs_ns2_vc_fsm.c:111
GPRS_NS2_EV_REQ_OM_BLOCK
@ GPRS_NS2_EV_REQ_OM_BLOCK
Definition gprs_ns2_vc_fsm.c:117
GPRS_NS2_EV_RX_RESET
@ GPRS_NS2_EV_RX_RESET
Definition gprs_ns2_vc_fsm.c:103
GPRS_NS2_EV_RX_UNBLOCK_ACK
@ GPRS_NS2_EV_RX_UNBLOCK_ACK
Definition gprs_ns2_vc_fsm.c:106
GPRS_NS2_EV_REQ_OM_UNBLOCK
@ GPRS_NS2_EV_REQ_OM_UNBLOCK
Definition gprs_ns2_vc_fsm.c:118

## ns2_vc_fsm

struct osmo_fsm ns2_vc_fsm

static

Initial value:
= {
.name = "GPRS-NS2-VC",
.states = ns2_vc_states,
.num_states = ARRAY_SIZE(ns2_vc_states),
.allstate_event_mask = S(GPRS_NS2_EV_RX_UNITDATA) |
S(GPRS_NS2_EV_RX_RESET) |
S(GPRS_NS2_EV_RX_ALIVE) |
S(GPRS_NS2_EV_RX_ALIVE_ACK) |
S(GPRS_NS2_EV_RX_STATUS) |
S(GPRS_NS2_EV_REQ_FORCE_UNCONFIGURED) |
S(GPRS_NS2_EV_REQ_OM_RESET) |
S(GPRS_NS2_EV_REQ_OM_BLOCK) |
S(GPRS_NS2_EV_REQ_OM_UNBLOCK),
.allstate_action = ns2_vc_fsm_allstate_action,
.cleanup = ns2_vc_fsm_clean,
.timer_cb = ns2_vc_fsm_timer_cb,
.event_names = ns2_vc_event_names,
.pre_term = NULL,
.log_subsys = DLNS,
}
ns2_vc_fsm_allstate_action
static void ns2_vc_fsm_allstate_action(struct osmo_fsm_inst *fi, uint32_t event, void *data)
Definition gprs_ns2_vc_fsm.c:630
ns2_vc_fsm_clean
static void ns2_vc_fsm_clean(struct osmo_fsm_inst *fi, enum osmo_fsm_term_cause cause)
Definition gprs_ns2_vc_fsm.c:753
ns2_vc_event_names
static const struct value_string ns2_vc_event_names[]
Definition gprs_ns2_vc_fsm.c:122
ns2_vc_states
static const struct osmo_fsm_state ns2_vc_states[]
Definition gprs_ns2_vc_fsm.c:489
ns2_vc_fsm_timer_cb
static int ns2_vc_fsm_timer_cb(struct osmo_fsm_inst *fi)
Definition gprs_ns2_vc_fsm.c:543
S
#define S(x)
Definition gprs_ns2_vc_fsm.c:50
DLNS
#define DLNS
ARRAY_SIZE
#define ARRAY_SIZE(x)

Referenced by __attribute__(), and ns2_vc_fsm_alloc().

## ns2_vc_states

const struct osmo_fsm_state ns2_vc_states[]

static