libosmogb 1.13.1.1-afb4 Osmocom Gb library

Files | Data Structures | Macros | Enumerations | Enumerator | Functions | Variables
Libgb

GPRS Networks Service (NS) messages on the Gb interface 3GPP TS 08.16 version 8.0.1 Release 1999 / ETSI TS 101 299 V8.0.1 (2002-05) More...

## Files
file | gprs_ns.h
file | gprs_ns.c
| GPRS Networks Service (NS) messages on the Gb interface.
file | gprs_ns2.c
| GPRS Networks Service (NS) messages on the Gb interface.

## Data Structures
struct | gprs_ns_hdr
| Common header of GPRS NS. More...
struct | gprs_ns_ie_ip4_elem
| Section 10.3.2c List of IP4 Elements. More...
struct | gprs_ns_ie_ip6_elem
| Section 10.3.2d List of IP6 Elements. More...

## Macros
#define | ns_set_state(ns_, st_) ns_set_state_with_log(ns_, st_, false, __FILE__, __LINE__)
#define | ns_set_remote_state(ns_, st_) ns_set_state_with_log(ns_, st_, true, __FILE__, __LINE__)
#define | ns_mark_blocked(ns_) ns_set_state(ns_, (ns_)->state | NSE_S_BLOCKED)
#define | ns_mark_unblocked(ns_) ns_set_state(ns_, (ns_)->state & (~NSE_S_BLOCKED));
#define | ns_mark_alive(ns_) ns_set_state(ns_, (ns_)->state | NSE_S_ALIVE)
#define | ns_mark_dead(ns_) ns_set_state(ns_, (ns_)->state & (~NSE_S_ALIVE));
#define | ERR_IF_NSVC_USES_SNS(nsvc, reason)
#define | CHECK_TX_RC(rc, nsvc)
#define | ns_set_state(ns_, st_) ns_set_state_with_log(ns_, st_, false, __FILE__, __LINE__)
#define | ns_set_remote_state(ns_, st_) ns_set_state_with_log(ns_, st_, true, __FILE__, __LINE__)
#define | ns_mark_blocked(ns_) ns_set_state(ns_, (ns_)->state | NSE_S_BLOCKED)
#define | ns_mark_unblocked(ns_) ns_set_state(ns_, (ns_)->state & (~NSE_S_BLOCKED));
#define | ns_mark_alive(ns_) ns_set_state(ns_, (ns_)->state | NSE_S_ALIVE)
#define | ns_mark_dead(ns_) ns_set_state(ns_, (ns_)->state & (~NSE_S_ALIVE));
#define | NS2_LL_MAX_STR 4+2*(INET6_ADDRSTRLEN+9)+8

## Enumerations
enum | ns_pdu_type { NS_PDUT_UNITDATA = 0x00 , NS_PDUT_RESET = 0x02 , NS_PDUT_RESET_ACK = 0x03 , NS_PDUT_BLOCK = 0x04 , NS_PDUT_BLOCK_ACK = 0x05 , NS_PDUT_UNBLOCK = 0x06 , NS_PDUT_UNBLOCK_ACK = 0x07 , NS_PDUT_STATUS = 0x08 , NS_PDUT_ALIVE = 0x0a , NS_PDUT_ALIVE_ACK = 0x0b , SNS_PDUT_ACK = 0x0c , SNS_PDUT_ADD = 0x0d , SNS_PDUT_CHANGE_WEIGHT = 0x0e , SNS_PDUT_CONFIG = 0x0f , SNS_PDUT_CONFIG_ACK = 0x10 , SNS_PDUT_DELETE = 0x11 , SNS_PDUT_SIZE = 0x12 , SNS_PDUT_SIZE_ACK = 0x13 }
| NS PDU Type (TS 08.16, Section 10.3.7, Table 14) More...
enum | ns_ctrl_ie { NS_IE_CAUSE = 0x00 , NS_IE_VCI = 0x01 , NS_IE_PDU = 0x02 , NS_IE_BVCI = 0x03 , NS_IE_NSEI = 0x04 , NS_IE_IPv4_LIST = 0x05 , NS_IE_IPv6_LIST = 0x06 , NS_IE_MAX_NR_NSVC = 0x07 , NS_IE_IPv4_EP_NR = 0x08 , NS_IE_IPv6_EP_NR = 0x09 , NS_IE_RESET_FLAG = 0x0a , NS_IE_IP_ADDR = 0x0b , NS_IE_TRANS_ID = 0xff }
| NS Control IE (TS 08.16, Section 10.3, Table 12) More...
enum | ns_cause { NS_CAUSE_TRANSIT_FAIL = 0x00 , NS_CAUSE_OM_INTERVENTION = 0x01 , NS_CAUSE_EQUIP_FAIL = 0x02 , NS_CAUSE_NSVC_BLOCKED = 0x03 , NS_CAUSE_NSVC_UNKNOWN = 0x04 , NS_CAUSE_BVCI_UNKNOWN = 0x05 , NS_CAUSE_SEM_INCORR_PDU = 0x08 , NS_CAUSE_PDU_INCOMP_PSTATE = 0x0a , NS_CAUSE_PROTO_ERR_UNSPEC = 0x0b , NS_CAUSE_INVAL_ESSENT_IE = 0x0c , NS_CAUSE_MISSING_ESSENT_IE = 0x0d , NS_CAUSE_INVAL_NR_IPv4_EP = 0x0e , NS_CAUSE_INVAL_NR_IPv6_EP = 0x0f , NS_CAUSE_INVAL_NR_NS_VC = 0x10 , NS_CAUSE_INVAL_WEIGH = 0x11 , NS_CAUSE_UNKN_IP_EP = 0x12 , NS_CAUSE_UNKN_IP_ADDR = 0x13 , NS_CAUSE_UNKN_IP_TEST_FAILED = 0x14 }
| NS Cause (TS 08.16, Section 10.3.2, Table 13) More...
enum | ns_ctr { NS_CTR_PKTS_IN , NS_CTR_PKTS_OUT , NS_CTR_BYTES_IN , NS_CTR_BYTES_OUT , NS_CTR_BLOCKED , NS_CTR_DEAD , NS_CTR_REPLACED , NS_CTR_NSEI_CHG , NS_CTR_INV_VCI , NS_CTR_INV_NSEI , NS_CTR_LOST_ALIVE , NS_CTR_LOST_RESET , NS_CTR_PKTS_IN , NS_CTR_PKTS_OUT , NS_CTR_PKTS_OUT_DROP , NS_CTR_BYTES_IN , NS_CTR_BYTES_OUT , NS_CTR_BYTES_OUT_DROP , NS_CTR_BLOCKED , NS_CTR_UNBLOCKED , NS_CTR_DEAD , NS_CTR_REPLACED , NS_CTR_NSEI_CHG , NS_CTR_INV_VCI , NS_CTR_INV_NSEI , NS_CTR_LOST_ALIVE , NS_CTR_LOST_RESET }
enum | ns_stat { NS_STAT_ALIVE_DELAY }

## Functions
struct gprs_ns_hdr | __attribute__ ((packed))
static bool | nsvc_is_not_used (const struct gprs_nsvc *nsvc)
struct msgb * | gprs_ns_msgb_alloc (void)
static void | ns_set_state_with_log (struct gprs_nsvc *nsvc, uint32_t state, bool is_remote, const char *file, unsigned line)
struct gprs_nsvc * | gprs_nsvc_by_nsvci (struct gprs_ns_inst *nsi, uint16_t nsvci)
| Lookup struct gprs_nsvc based on NSVCI. More...
struct gprs_nsvc * | gprs_nsvc_by_nsei (struct gprs_ns_inst *nsi, uint16_t nsei)
| Lookup struct gprs_nsvc based on NSEI. More...
static struct gprs_nsvc * | gprs_active_nsvc_by_nsei (struct gprs_ns_inst *nsi, uint16_t nsei, uint16_t bvci)
| Determine active NS-VC for given NSEI + BVCI. More...
struct gprs_nsvc * | gprs_nsvc_by_rem_addr (struct gprs_ns_inst *nsi, const struct sockaddr_in *sin)
| Lookup NS-VC based on specified remote peer socket addr. More...
static void | gprs_ns_timer_cb (void *data)
struct gprs_nsvc * | gprs_nsvc_create2 (struct gprs_ns_inst *nsi, uint16_t nsvci, uint8_t sig_weight, uint8_t data_weight)
| Create a new NS-VC (Virtual Circuit) within given instance. More...
void | gprs_nsvc_delete (struct gprs_nsvc *nsvc)
| Delete given NS-VC. More...
static void | ns_osmo_signal_dispatch (struct gprs_nsvc *nsvc, unsigned int signal, uint8_t cause)
static void | ns_osmo_signal_dispatch_mismatch (struct gprs_nsvc *nsvc, struct msgb *msg, uint8_t pdu_type, uint8_t ie_type)
static void | ns_osmo_signal_dispatch_replaced (struct gprs_nsvc *nsvc, struct gprs_nsvc *old_nsvc)
const char * | gprs_ns_cause_str (enum ns_cause cause)
| Obtain a human-readable string for NS cause value. More...
static int | nsip_sendmsg (struct gprs_nsvc *nsvc, struct msgb *msg)
int | grps_ns_frgre_sendmsg (struct gprs_nsvc *nsvc, struct msgb *msg)
static bool | ns_is_sns (uint8_t pdu_type)
static int | gprs_ns_tx (struct gprs_nsvc *nsvc, struct msgb *msg)
static int | gprs_ns_tx_simple (struct gprs_nsvc *nsvc, uint8_t pdu_type)
int | gprs_ns_tx_reset (struct gprs_nsvc *nsvc, uint8_t cause)
| Transmit a NS-RESET on a given NSVC. More...
int | gprs_ns_tx_status (struct gprs_nsvc *nsvc, uint8_t cause, uint16_t bvci, struct msgb *orig_msg)
| Transmit a NS-STATUS on a given NSVC. More...
int | gprs_ns_tx_block (struct gprs_nsvc *nsvc, uint8_t cause)
| Transmit a NS-BLOCK on a given NS-VC. More...
static int | gprs_ns_tx_block_ack (struct gprs_nsvc *nsvc)
| Transmit a NS-BLOCK-ACK on a given NS-VC. More...
int | gprs_ns_tx_unblock (struct gprs_nsvc *nsvc)
| Transmit a NS-UNBLOCK on a given NS-VC. More...
int | gprs_ns_tx_alive (struct gprs_nsvc *nsvc)
| Transmit a NS-ALIVE on a given NS-VC. More...
int | gprs_ns_tx_alive_ack (struct gprs_nsvc *nsvc)
| Transmit a NS-ALIVE-ACK on a given NS-VC. More...
static void | nsvc_start_timer (struct gprs_nsvc *nsvc, enum nsvc_timer_mode mode)
static int | nsvc_timer_elapsed_ms (struct gprs_nsvc *nsvc)
static int | gprs_ns_tx_reset_ack (struct gprs_nsvc *nsvc)
int | gprs_ns_tx_sns_ack (struct gprs_nsvc *nsvc, uint8_t trans_id, uint8_t *cause, const struct gprs_ns_ie_ip4_elem *ip4_elems, unsigned int num_ip4_elems)
| Encode + Transmit a SNS-ACK as per Section 9.3.1. More...
int | gprs_ns_tx_sns_config (struct gprs_nsvc *nsvc, bool end_flag, const struct gprs_ns_ie_ip4_elem *ip4_elems, unsigned int num_ip4_elems)
| Encode + Transmit a SNS-CONFIG as per Section 9.3.4. More...
int | gprs_ns_tx_sns_config_ack (struct gprs_nsvc *nsvc, uint8_t *cause)
| Encode + Transmit a SNS-CONFIG-ACK as per Section 9.3.5. More...
int | gprs_ns_tx_sns_size (struct gprs_nsvc *nsvc, bool reset_flag, uint16_t max_nr_nsvc, uint16_t *ip4_ep_nr, uint16_t *ip6_ep_nr)
| Encode + transmit a SNS-SIZE as per Section 9.3.7. More...
int | gprs_ns_tx_sns_size_ack (struct gprs_nsvc *nsvc, uint8_t *cause)
| Encode + Transmit a SNS-SIZE-ACK as per Section 9.3.8. More...
int | gprs_ns_sendmsg (struct gprs_ns_inst *nsi, struct msgb *msg)
| High-level function for transmitting a NS-UNITDATA messsage. More...
static int | gprs_ns_rx_unitdata (struct gprs_nsvc *nsvc, struct msgb *msg)
static int | gprs_ns_rx_status (struct gprs_nsvc *nsvc, struct msgb *msg)
static int | gprs_nsvc_replace_if_found (uint16_t nsvci, struct gprs_nsvc **nsvc, struct gprs_nsvc **old_nsvc)
static int | gprs_ns_rx_reset (struct gprs_nsvc **nsvc, struct msgb *msg)
static int | gprs_ns_rx_reset_ack (struct gprs_nsvc **nsvc, struct msgb *msg)
static int | gprs_ns_rx_block (struct gprs_nsvc *nsvc, struct msgb *msg)
int | gprs_ns_vc_create (struct gprs_ns_inst *nsi, struct msgb *msg, struct gprs_nsvc *fallback_nsvc, struct gprs_nsvc **new_nsvc)
| Create/get NS-VC independently from underlying transport layer. More...
int | gprs_ns_process_msg (struct gprs_ns_inst *nsi, struct msgb *msg, struct gprs_nsvc **nsvc)
| Process NS message independently from underlying transport layer. More...
int | gprs_ns_rcvmsg (struct gprs_ns_inst *nsi, struct msgb *msg, struct sockaddr_in *saddr, enum gprs_ns_ll ll)
| Receive incoming NS message from underlying transport layer. More...
char * | gprs_ns_ll_str_buf (char *buf, size_t buf_len, const struct gprs_nsvc *nsvc)
const char * | gprs_ns_ll_str (const struct gprs_nsvc *nsvc)
char * | gprs_ns_ll_str_c (const void *ctx, const struct gprs_nsvc *nsvc)
void | gprs_ns_ll_copy (struct gprs_nsvc *nsvc, struct gprs_nsvc *other)
void | gprs_ns_ll_clear (struct gprs_nsvc *nsvc)
struct gprs_ns_inst * | gprs_ns_instantiate (gprs_ns_cb_t *cb, void *ctx)
| Create a new GPRS NS instance. More...
void | gprs_ns_close (struct gprs_ns_inst *nsi)
void | gprs_ns_destroy (struct gprs_ns_inst *nsi)
| Destroy an entire NS instance. More...
static struct msgb * | read_nsip_msg (struct osmo_fd *bfd, int *error, struct sockaddr_in *saddr)
static int | handle_nsip_read (struct osmo_fd *bfd)
static int | handle_nsip_write (struct osmo_fd *bfd)
static int | nsip_fd_cb (struct osmo_fd *bfd, unsigned int what)
int | gprs_ns_nsip_listen (struct gprs_ns_inst *nsi)
| Create a listening socket for GPRS NS/UDP/IP. More...
int | gprs_nsvc_reset (struct gprs_nsvc *nsvc, uint8_t cause)
| Initiate a RESET procedure. More...
struct gprs_nsvc * | gprs_ns_nsip_connect (struct gprs_ns_inst *nsi, struct sockaddr_in *dest, uint16_t nsei, uint16_t nsvci)
| Establish a NS connection (from the BSS) to the SGSN. More...
struct gprs_nsvc * | gprs_ns_nsip_connect_sns (struct gprs_ns_inst *nsi, struct sockaddr_in *dest, uint16_t nsei, uint16_t nsvci)
| Establish a NS connection (from the BSS) to the SGSN using SNS auto-configuration. More...
void | gprs_ns_set_log_ss (int ss)
char * | gprs_nsvc_state_append (char *s, struct gprs_nsvc *nsvc)
| Append the nsvc state to a talloc string. More...
void | gprs_nsvc_start_test (struct gprs_nsvc *nsvc)
| Start the ALIVE timer procedure in all NS-VCs part of this NS Instance. More...
void | gprs_start_alive_all_nsvcs (struct gprs_ns_inst *nsi)
char * | gprs_ns2_ll_str_buf (char *buf, size_t buf_len, struct gprs_ns2_vc *nsvc)
| string-format a given NS-VC into a user-supplied buffer. More...
const char * | gprs_ns2_ll_str (struct gprs_ns2_vc *nsvc)
| string-format a given NS-VC to a thread-local static buffer. More...
char * | gprs_ns2_ll_str_c (const void *ctx, struct gprs_ns2_vc *nsvc)
| string-format a given NS-VC to a dynamically allocated string. More...
const char * | gprs_ns2_nsvc_state_name (struct gprs_ns2_vc *nsvc)
| Return the current state name of a given NS-VC to a thread-local static buffer. More...
static struct gprs_ns2_vc * | ns2_load_sharing_signal (struct gprs_ns2_nse *nse)
static struct gprs_ns2_vc * | ns2_load_sharing_modulo (struct gprs_ns2_nse *nse, uint16_t bvci, uint32_t load_selector)
static struct gprs_ns2_vc * | ns2_load_sharing_weight_modulo (struct gprs_ns2_nse *nse, uint16_t bvci, uint32_t load_selector)
struct gprs_ns2_vc * | ns2_load_sharing_first (struct gprs_ns2_nse *nse)
static struct gprs_ns2_vc * | ns2_load_sharing (struct gprs_ns2_nse *nse, uint16_t bvci, uint32_t link_selector)
int | gprs_ns2_recv_prim (struct gprs_ns2_inst *nsi, struct osmo_prim_hdr *oph)
| Receive a primitive from the NS User (Gb). More...
void | ns2_prim_status_ind (struct gprs_ns2_nse *nse, struct gprs_ns2_vc *nsvc, uint16_t bvci, enum gprs_ns2_affecting_cause cause)
| Send a STATUS.ind primitive to the specified NS instance user. More...
struct gprs_ns2_vc * | ns2_vc_alloc (struct gprs_ns2_vc_bind *bind, struct gprs_ns2_nse *nse, bool initiater, enum gprs_ns2_vc_mode vc_mode, const char *id)
| Allocate a NS-VC within the given bind + NSE. More...
void | gprs_ns2_free_nsvc (struct gprs_ns2_vc *nsvc)
| Destroy/release given NS-VC. More...
void | ns2_free_nsvcs (struct gprs_ns2_nse *nse)
void | gprs_ns2_free_nsvcs (struct gprs_ns2_nse *nse)
| Destroy/release all NS-VC of given NSE. More...
struct msgb * | ns2_msgb_alloc (void)
| Allocate a message buffer for use with the NS2 stack. More...
static int | reject_status_msg (struct msgb *orig_msg, struct tlv_parsed *tp, struct msgb **reject, enum ns_cause cause)
| Create a status message to be sent over a new connection. More...
struct gprs_ns2_nse * | gprs_ns2_nse_by_nsei (struct gprs_ns2_inst *nsi, uint16_t nsei)
| Resolve a NS Entity based on its NSEI. More...
struct gprs_ns2_vc * | gprs_ns2_nsvc_by_nsvci (struct gprs_ns2_inst *nsi, uint16_t nsvci)
| Resolve a NS-VC Entity based on its NS-VCI. More...
struct gprs_ns2_nse * | gprs_ns2_create_nse2 (struct gprs_ns2_inst *nsi, uint16_t nsei, enum gprs_ns2_ll linklayer, enum gprs_ns2_dialect dialect, bool ip_sns_role_sgsn)
| Create a NS Entity within given NS instance. More...
int | ns2_nse_set_dialect (struct gprs_ns2_nse *nse, enum gprs_ns2_dialect dialect)
struct gprs_ns2_nse * | gprs_ns2_create_nse (struct gprs_ns2_inst *nsi, uint16_t nsei, enum gprs_ns2_ll linklayer, enum gprs_ns2_dialect dialect)
| Create a NS Entity within given NS instance. More...
uint16_t | gprs_ns2_nse_nsei (struct gprs_ns2_nse *nse)
| Return the NSEI. More...
void | gprs_ns2_free_nse (struct gprs_ns2_nse *nse)
| Destroy given NS Entity. More...
void | gprs_ns2_free_nses (struct gprs_ns2_inst *nsi)
static int | ns2_tlv_parse (struct tlv_parsed *dec, const uint8_t *buf, int buf_len, uint8_t lv_tag, uint8_t lv_tag2)
static enum ns2_cs | ns2_create_vc_sns (struct gprs_ns2_vc_bind *bind, const struct osmo_sockaddr *remote, struct gprs_ns2_vc **success, uint16_t nsei)
enum ns2_cs | ns2_create_vc (struct gprs_ns2_vc_bind *bind, struct msgb *msg, const struct osmo_sockaddr *remote, const char *logname, struct msgb **reject, struct gprs_ns2_vc **success)
| Create a new NS-VC based on a [received] message. More...
struct gprs_ns2_vc * | gprs_ns2_ip_connect_inactive (struct gprs_ns2_vc_bind *bind, const struct osmo_sockaddr *remote, struct gprs_ns2_nse *nse, uint16_t nsvci)
| Create, and connect an inactive, new IP-based NS-VC. More...
struct gprs_ns2_vc * | gprs_ns2_ip_connect (struct gprs_ns2_vc_bind *bind, const struct osmo_sockaddr *remote, struct gprs_ns2_nse *nse, uint16_t nsvci)
| Create, connect and activate a new IP-based NS-VC. More...
struct gprs_ns2_vc * | gprs_ns2_ip_connect2 (struct gprs_ns2_vc_bind *bind, const struct osmo_sockaddr *remote, uint16_t nsei, uint16_t nsvci, enum gprs_ns2_dialect dialect)
| Create, connect and activate a new IP-based NS-VC. More...
struct gprs_ns2_vc * | gprs_ns2_nsvc_by_sockaddr_nse (struct gprs_ns2_nse *nse, const struct osmo_sockaddr *sockaddr)
| Find NS-VC for given socket address. More...
int | gprs_ns2_nse_foreach_nsvc (struct gprs_ns2_nse *nse, gprs_ns2_foreach_nsvc_cb cb, void *cb_data)
| Iterate over all nsvc of a NS Entity and call the callback. More...
int | ns2_recv_vc (struct gprs_ns2_vc *nsvc, struct msgb *msg)
| Bottom-side entry-point for received NS PDU from the driver/bind. More...
void | ns2_nse_data_sum (struct gprs_ns2_nse *nse)
void | ns2_nse_notify_unblocked (struct gprs_ns2_vc *nsvc, bool unblocked)
| Notify a nse about the change of a NS-VC. More...
struct gprs_ns2_inst * | gprs_ns2_instantiate (void *ctx, osmo_prim_cb cb, void *cb_data)
| Create a new GPRS NS instance. More...
void | gprs_ns2_free (struct gprs_ns2_inst *nsi)
| Destroy a NS Instance (including all its NSEs, binds, ...). More...
void | gprs_ns2_start_alive_all_nsvcs (struct gprs_ns2_nse *nse)
| Start the NS-ALIVE FSM in all NS-VCs of given NSE. More...
void | gprs_ns2_free_bind (struct gprs_ns2_vc_bind *bind)
| Destroy a given bind. More...
void | gprs_ns2_free_binds (struct gprs_ns2_inst *nsi)
struct gprs_ns2_vc_bind * | gprs_ns2_bind_by_name (struct gprs_ns2_inst *nsi, const char *name)
| Search for a bind with a unique name. More...
enum gprs_ns2_vc_mode | ns2_dialect_to_vc_mode (enum gprs_ns2_dialect dialect)
static void | add_bind_array (struct gprs_ns2_vc_bind **array, struct gprs_ns2_vc_bind *bind, int size)
void | ns2_nse_update_mtu (struct gprs_ns2_nse *nse)
int | ns2_count_transfer_cap (struct gprs_ns2_nse *nse, uint16_t bvci)
| calculate the transfer capabilities for a nse More...
int | ns2_bind_alloc (struct gprs_ns2_inst *nsi, const char *name, struct gprs_ns2_vc_bind **result)
| common allocation + low-level initialization of a bind. More...

## Variables
uint8_t | gprs_ns_hdr::pdu_type
| NS PDU type. More...
uint8_t | gprs_ns_hdr::data [0]
| variable-length payload More...
uint8_t | pdu_type
| NS PDU type. More...
uint8_t | data [0]
| variable-length payload More...
uint32_t | gprs_ns_ie_ip4_elem::ip_addr
uint16_t | gprs_ns_ie_ip4_elem::udp_port
uint8_t | gprs_ns_ie_ip4_elem::sig_weight
uint8_t | gprs_ns_ie_ip4_elem::data_weight
uint32_t | ip_addr
uint16_t | udp_port
uint8_t | sig_weight
uint8_t | data_weight
struct in6_addr | gprs_ns_ie_ip6_elem::ip_addr
uint16_t | gprs_ns_ie_ip6_elem::udp_port
uint8_t | gprs_ns_ie_ip6_elem::sig_weight
uint8_t | gprs_ns_ie_ip6_elem::data_weight
const struct value_string | gprs_ns_pdu_strings []
enum ns_pdu_type | __attribute__
static const struct tlv_definition | ns_att_tlvdef
static const struct rate_ctr_desc | nsvc_ctr_description []
static const struct rate_ctr_group_desc | nsvc_ctrg_desc
static const struct osmo_stat_item_desc | nsvc_stat_description []
static const struct osmo_stat_item_group_desc | nsvc_statg_desc
const struct value_string | gprs_ns_signal_ns_names []
const struct value_string | gprs_ns_pdu_strings []
static const struct value_string | ns_cause_str []
static enum ns_timeout | timer_mode_tout [_NSVC_TIMER_NR]
static const struct value_string | timer_mode_strs []
static bool | gprs_sns_fsm_registered = false
static const struct tlv_definition | ns_att_tlvdef1
static const struct tlv_definition | ns_att_tlvdef2
const struct value_string | gprs_ns2_cause_strs []
static const struct rate_ctr_desc | ns_ctr_description []
static const struct rate_ctr_group_desc | nse_ctrg_desc
static const struct rate_ctr_group_desc | nsvc_ctrg_desc
static const struct osmo_stat_item_desc | nsvc_stat_description []
static const struct osmo_stat_item_group_desc | nsvc_statg_desc
const struct osmo_stat_item_desc | nsbind_stat_description []
static const struct osmo_stat_item_group_desc | nsbind_statg_desc
const struct value_string | gprs_ns2_aff_cause_prim_strs []
const struct value_string | gprs_ns2_prim_strs []
const struct value_string | gprs_ns2_lltype_strs []
enum gsmtap_um_voice_type | __attribute__

## Detailed Description

GPRS Networks Service (NS) messages on the Gb interface 3GPP TS 08.16 version 8.0.1 Release 1999 / ETSI TS 101 299 V8.0.1 (2002-05)

Some introduction into NS: NS is used typically on top of frame relay, but in the ip.access world it is encapsulated in UDP packets. It serves as an intermediate shim betwen BSSGP and the underlying medium. It doesn't do much, apart from providing congestion notification and status indication.

Terms:

        NS              Network Service
        NSVC            NS Virtual Connection
        NSEI            NS Entity Identifier
        NSVL            NS Virtual Link
        NSVLI           NS Virtual Link Identifier
        BVC             BSSGP Virtual Connection
        BVCI            BSSGP Virtual Connection Identifier
        NSVCG           NS Virtual Connection Goup
        Blocked         NS-VC cannot be used for user traffic
        Alive           Ability of a NS-VC to provide communication

There can be multiple BSSGP virtual connections over one (group of) NSVC's. BSSGP will therefore identify the BSSGP virtual connection by a BVCI passed down to NS. NS then has to figure out which NSVC's are responsible for this BVCI. Those mappings are administratively configured.

This implementation has the following limitations:

- Only one NS-VC for each NSE: No load-sharing function
- NSVCI 65535 and 65534 are reserved for internal use
- Only UDP is supported as of now, no frame relay support
- There are no BLOCK and UNBLOCK timers (yet?)

Some introduction into NS: NS is used typically on top of frame relay, but in the ip.access world it is encapsulated in UDP packets. It serves as an intermediate shim betwen BSSGP and the underlying medium. It doesn't do much, apart from providing congestion notification and status indication.

Terms:

        NS              Network Service
        NSVC            NS Virtual Connection
        NSEI            NS Entity Identifier
        NSVL            NS Virtual Link
        NSVLI           NS Virtual Link Identifier
        BVC             BSSGP Virtual Connection
        BVCI            BSSGP Virtual Connection Identifier
        NSVCG           NS Virtual Connection Goup
        Blocked         NS-VC cannot be used for user traffic
        Alive           Ability of a NS-VC to provide communication

There can be multiple BSSGP virtual connections over one (group of) NSVC's. BSSGP will therefore identify the BSSGP virtual connection by a BVCI passed down to NS. NS then has to figure out which NSVC's are responsible for this BVCI. Those mappings are administratively configured.

This implementation has the following limitations:

- NSVCI 65535 and 65534 are reserved for internal use
- There are no BLOCK and UNBLOCK timers (yet?)

## Macro Definition Documentation

## ◆ CHECK_TX_RC

#define CHECK_TX_RC | ( |  | rc,
|  |  | nsvc
| ) |  |

Value:
if (rc < 0) \
LOGP(DNS, LOGL_ERROR, "TX failed (%d) to peer %s\n", \
rc, gprs_ns_ll_str(nsvc));
DNS
int DNS
Definition: common_vty.c:66
gprs_ns_ll_str
const char * gprs_ns_ll_str(const struct gprs_nsvc *nsvc)
Definition: gprs_ns.c:1546

## ◆ ERR_IF_NSVC_USES_SNS

#define ERR_IF_NSVC_USES_SNS | ( |  | nsvc,
|  |  | reason
| ) |  |

Value:
do { \
if ((nsvc)->nsi->bss_sns_fi) { \
LOGP(DNS, LOGL_ERROR, "NSEI=%u Asked to %s. Rejected on IP-SNS\n", \
nsvc->nsei, reason); \
osmo_log_backtrace(DNS, LOGL_ERROR); \
return -EIO; \
} \
} while (0)

## ◆ NS2_LL_MAX_STR

#define NS2_LL_MAX_STR 4+2*(INET6_ADDRSTRLEN+9)+8

## ◆ ns_mark_alive [1/2]

#define ns_mark_alive | ( |  | ns_ | ) | ns_set_state(ns_, (ns_)->state | NSE_S_ALIVE)

## ◆ ns_mark_alive [2/2]

#define ns_mark_alive | ( |  | ns_ | ) | ns_set_state(ns_, (ns_)->state | NSE_S_ALIVE)

## ◆ ns_mark_blocked [1/2]

#define ns_mark_blocked | ( |  | ns_ | ) | ns_set_state(ns_, (ns_)->state | NSE_S_BLOCKED)

## ◆ ns_mark_blocked [2/2]

#define ns_mark_blocked | ( |  | ns_ | ) | ns_set_state(ns_, (ns_)->state | NSE_S_BLOCKED)

## ◆ ns_mark_dead [1/2]

#define ns_mark_dead | ( |  | ns_ | ) | ns_set_state(ns_, (ns_)->state & (~NSE_S_ALIVE));

## ◆ ns_mark_dead [2/2]

#define ns_mark_dead | ( |  | ns_ | ) | ns_set_state(ns_, (ns_)->state & (~NSE_S_ALIVE));

## ◆ ns_mark_unblocked [1/2]

#define ns_mark_unblocked | ( |  | ns_ | ) | ns_set_state(ns_, (ns_)->state & (~NSE_S_BLOCKED));

## ◆ ns_mark_unblocked [2/2]

#define ns_mark_unblocked | ( |  | ns_ | ) | ns_set_state(ns_, (ns_)->state & (~NSE_S_BLOCKED));

## ◆ ns_set_remote_state [1/2]

#define ns_set_remote_state | ( |  | ns_,
|  |  | st_
| ) |  | ns_set_state_with_log(ns_, st_, true, __FILE__, __LINE__)

## ◆ ns_set_remote_state [2/2]

#define ns_set_remote_state | ( |  | ns_,
|  |  | st_
| ) |  | ns_set_state_with_log(ns_, st_, true, __FILE__, __LINE__)

## ◆ ns_set_state [1/2]

#define ns_set_state | ( |  | ns_,
|  |  | st_
| ) |  | ns_set_state_with_log(ns_, st_, false, __FILE__, __LINE__)

## ◆ ns_set_state [2/2]

#define ns_set_state | ( |  | ns_,
|  |  | st_
| ) |  | ns_set_state_with_log(ns_, st_, false, __FILE__, __LINE__)

## Enumeration Type Documentation

## ◆ ns_cause

enum ns_cause

NS Cause (TS 08.16, Section 10.3.2, Table 13)

Enumerator
NS_CAUSE_TRANSIT_FAIL |
NS_CAUSE_OM_INTERVENTION |
NS_CAUSE_EQUIP_FAIL |
NS_CAUSE_NSVC_BLOCKED |
NS_CAUSE_NSVC_UNKNOWN |
NS_CAUSE_BVCI_UNKNOWN |
NS_CAUSE_SEM_INCORR_PDU |
NS_CAUSE_PDU_INCOMP_PSTATE |
NS_CAUSE_PROTO_ERR_UNSPEC |
NS_CAUSE_INVAL_ESSENT_IE |
NS_CAUSE_MISSING_ESSENT_IE |
NS_CAUSE_INVAL_NR_IPv4_EP |
NS_CAUSE_INVAL_NR_IPv6_EP |
NS_CAUSE_INVAL_NR_NS_VC |
NS_CAUSE_INVAL_WEIGH |
NS_CAUSE_UNKN_IP_EP |
NS_CAUSE_UNKN_IP_ADDR |
NS_CAUSE_UNKN_IP_TEST_FAILED |

## ◆ ns_ctr

enum ns_ctr

Enumerator
NS_CTR_PKTS_IN |
NS_CTR_PKTS_OUT |
NS_CTR_BYTES_IN |
NS_CTR_BYTES_OUT |
NS_CTR_BLOCKED |
NS_CTR_DEAD |
NS_CTR_REPLACED |
NS_CTR_NSEI_CHG |
NS_CTR_INV_VCI |
NS_CTR_INV_NSEI |
NS_CTR_LOST_ALIVE |
NS_CTR_LOST_RESET |
NS_CTR_PKTS_IN |
NS_CTR_PKTS_OUT |
NS_CTR_PKTS_OUT_DROP |
NS_CTR_BYTES_IN |
NS_CTR_BYTES_OUT |
NS_CTR_BYTES_OUT_DROP |
NS_CTR_BLOCKED |
NS_CTR_UNBLOCKED |
NS_CTR_DEAD |
NS_CTR_REPLACED |
NS_CTR_NSEI_CHG |
NS_CTR_INV_VCI |
NS_CTR_INV_NSEI |
NS_CTR_LOST_ALIVE |
NS_CTR_LOST_RESET |

## ◆ ns_ctrl_ie

enum ns_ctrl_ie

NS Control IE (TS 08.16, Section 10.3, Table 12)

Enumerator
NS_IE_CAUSE |
NS_IE_VCI |
NS_IE_PDU |
NS_IE_BVCI |
NS_IE_NSEI |
NS_IE_IPv4_LIST |
NS_IE_IPv6_LIST |
NS_IE_MAX_NR_NSVC |
NS_IE_IPv4_EP_NR |
NS_IE_IPv6_EP_NR |
NS_IE_RESET_FLAG |
NS_IE_IP_ADDR |
NS_IE_TRANS_ID |

## ◆ ns_pdu_type

enum ns_pdu_type

NS PDU Type (TS 08.16, Section 10.3.7, Table 14)

Enumerator
NS_PDUT_UNITDATA |
NS_PDUT_RESET |
NS_PDUT_RESET_ACK |
NS_PDUT_BLOCK |
NS_PDUT_BLOCK_ACK |
NS_PDUT_UNBLOCK |
NS_PDUT_UNBLOCK_ACK |
NS_PDUT_STATUS |
NS_PDUT_ALIVE |
NS_PDUT_ALIVE_ACK |
SNS_PDUT_ACK |
SNS_PDUT_ADD |
SNS_PDUT_CHANGE_WEIGHT |
SNS_PDUT_CONFIG |
SNS_PDUT_CONFIG_ACK |
SNS_PDUT_DELETE |
SNS_PDUT_SIZE |
SNS_PDUT_SIZE_ACK |

## ◆ ns_stat

enum ns_stat

Enumerator
NS_STAT_ALIVE_DELAY |

## Function Documentation

## ◆ __attribute__()

struct gprs_ns_hdr __attribute__ | ( | (packed) |  | ) |

## ◆ add_bind_array()

static void add_bind_array | ( | struct gprs_ns2_vc_bind ** | array,
|  | struct gprs_ns2_vc_bind * | bind,
|  | int | size
| ) |  |
| static

Referenced by ns2_count_transfer_cap().

## ◆ gprs_active_nsvc_by_nsei()

static struct gprs_nsvc * gprs_active_nsvc_by_nsei | ( | struct gprs_ns_inst * | nsi,
|  | uint16_t | nsei,
|  | uint16_t | bvci
| ) |  |
| static

Determine active NS-VC for given NSEI + BVCI.

Use this function to determine which of the NS-VCs inside the NS Instance shall be used to transmit data for given NSEI + BVCI

References bvci, gprs_nsvc::data_weight, gprs_ns_inst::gprs_nsvcs, list, llist_for_each_entry, NSE_S_ALIVE, NSE_S_BLOCKED, nsei, gprs_nsvc::nsei, gprs_nsvc::nsi, gprs_nsvc::sig_weight, and gprs_nsvc::state.

Referenced by gprs_ns_sendmsg().

## ◆ gprs_ns2_bind_by_name()

struct gprs_ns2_vc_bind * gprs_ns2_bind_by_name | ( | struct gprs_ns2_inst * | nsi,
|  | const char * | name
| ) |  |

Search for a bind with a unique name.

Parameters

  [in] | nsi | NS instance on which we operate
  [in] | name | The unique bind name to search for

Returns
  the bind or NULL if not found

References gprs_ns2_inst::binding, list, llist_for_each_entry, name, gprs_ns2_vc_bind::name, and gprs_ns2_vc_bind::nsi.

Referenced by config_write_vbind(), DEFUN(), gprs_ns2_fr_bind(), gprs_ns2_frgre_bind(), ns2_bind_alloc(), ns2_sns_add_sns_default_binds(), and ns_nse_nsvc_udp_cmds().

## ◆ gprs_ns2_create_nse()

struct gprs_ns2_nse * gprs_ns2_create_nse | ( | struct gprs_ns2_inst * | nsi,
|  | uint16_t | nsei,
|  | enum gprs_ns2_ll | linklayer,
|  | enum gprs_ns2_dialect | dialect
| ) |  |

Create a NS Entity within given NS instance.

Parameters

  [in] | nsi | NS instance in which to create NS Entity
  [in] | nsei | NS Entity Identifier of to-be-created NSE

Returns
  newly-allocated NS-E in successful case; NULL on error

References gprs_ns2_nse::dialect, gprs_ns2_create_nse2(), nsei, and gprs_ns2_nse::nsi.

Referenced by gprs_ns2_fr_connect2(), gprs_ns2_ip_connect2(), and ns2_create_vc().

## ◆ gprs_ns2_create_nse2()

struct gprs_ns2_nse * gprs_ns2_create_nse2 | ( | struct gprs_ns2_inst * | nsi,
|  | uint16_t | nsei,
|  | enum gprs_ns2_ll | linklayer,
|  | enum gprs_ns2_dialect | dialect,
|  | bool | ip_sns_role_sgsn
| ) |  |

Create a NS Entity within given NS instance.

Parameters

  [in] | nsi | NS instance in which to create NS Entity
  [in] | nsei | NS Entity Identifier of to-be-created NSE
  [in] | ip_sns_role_sgsn | Does local side implement SGSN role?

Returns
  newly-allocated NS-E in successful case; NULL on error

References gprs_ns2_nse::ctrg, gprs_ns2_nse::dialect, gprs_ns2_nse::first, GPRS_NS2_DIALECT_UNDEF, gprs_ns2_nse_by_nsei(), INIT_LLIST_HEAD, gprs_ns2_nse::ip_sns_role_sgsn, gprs_ns2_nse::list, gprs_ns2_nse::ll, llist_add_tail(), LOGL_ERROR, LOGNSE, gprs_ns2_nse::mtu, ns2_nse_set_dialect(), gprs_ns2_inst::nse, nse_ctrg_desc, nsei, gprs_ns2_nse::nsei, gprs_ns2_nse::nsi, gprs_ns2_nse::nsvc, osmo_clock_gettime(), rate_ctr_group_alloc(), and gprs_ns2_nse::ts_alive_change.

Referenced by DEFUN(), gprs_ns2_create_nse(), and ns2_create_vc_sns().

## ◆ gprs_ns2_free()

void gprs_ns2_free | ( | struct gprs_ns2_inst * | nsi | ) |

Destroy a NS Instance (including all its NSEs, binds, ...).

Parameters

  [in] | nsi | NS instance to destroy

References gprs_ns2_free_binds(), and gprs_ns2_free_nses().

## ◆ gprs_ns2_free_bind()

void gprs_ns2_free_bind | ( | struct gprs_ns2_vc_bind * | bind | ) |

Destroy a given bind.

Parameters

  [in] | bind | the bind we want to destroy

References gprs_ns2_vc_bind::driver, gprs_ns2_vc_driver::free_bind, gprs_ns2_vc_bind::freed, gprs_ns2_free_nsvc(), gprs_ns2_is_ip_bind(), gprs_ns2_sns_del_bind(), list, gprs_ns2_vc_bind::list, llist_del(), llist_empty(), llist_first_entry, llist_for_each_entry, gprs_ns2_vc_bind::name, gprs_ns2_inst::nse, gprs_ns2_vc_bind::nsi, gprs_ns2_nse::nsvc, gprs_ns2_vc_bind::nsvc, osmo_stat_item_group_free(), and gprs_ns2_vc_bind::statg.

Referenced by DEFUN(), gprs_ns2_fr_bind(), gprs_ns2_free_binds(), gprs_ns2_frgre_bind(), and gprs_ns2_ip_bind().

## ◆ gprs_ns2_free_binds()

void gprs_ns2_free_binds | ( | struct gprs_ns2_inst * | nsi | ) |

References gprs_ns2_inst::binding, gprs_ns2_free_bind(), list, llist_empty(), llist_first_entry, and gprs_ns2_vc_bind::nsi.

Referenced by gprs_ns2_free().

## ◆ gprs_ns2_free_nse()

void gprs_ns2_free_nse | ( | struct gprs_ns2_nse * | nse | ) |

Destroy given NS Entity.

Parameters

  [in] | nse | NS Entity to destroy

References gprs_ns2_nse::alive, gprs_ns2_nse::bss_sns_fi, gprs_ns2_nse::ctrg, gprs_ns2_nse::freed, GPRS_NS2_AFF_CAUSE_FAILURE, gprs_ns2_free_nsvcs(), gprs_ns2_nse::list, llist_del(), ns2_free_nsvcs(), ns2_prim_status_ind(), osmo_fsm_inst_term, OSMO_FSM_TERM_REQUEST, and rate_ctr_group_free().

Referenced by _sns_failed(), DEFUN(), DEFUN_HIDDEN(), gprs_ns2_fr_connect2(), and gprs_ns2_free_nses().

## ◆ gprs_ns2_free_nses()

void gprs_ns2_free_nses | ( | struct gprs_ns2_inst * | nsi | ) |

References gprs_ns2_free_nse(), list, llist_empty(), llist_first_entry, gprs_ns2_inst::nse, and gprs_ns2_nse::nsi.

Referenced by gprs_ns2_free().

## ◆ gprs_ns2_free_nsvc()

void gprs_ns2_free_nsvc | ( | struct gprs_ns2_vc * | nsvc | ) |

Destroy/release given NS-VC.

Parameters

  [in] | nsvc | NS-VC to destroy

References gprs_ns2_vc::bind, gprs_ns2_vc::blist, gprs_ns2_vc::ctrg, gprs_ns2_vc::fi, gprs_ns2_vc_bind::free_vc, gprs_ns2_vc::freed, GPRS_NS2_AFF_CAUSE_VC_FAILURE, gprs_ns2_vc::list, llist_del(), ns2_nse_notify_unblocked(), ns2_prim_status_ind(), ns2_sns_replace_nsvc(), gprs_ns2_vc::nse, osmo_fsm_inst_term, OSMO_FSM_TERM_REQUEST, osmo_stat_item_group_free(), gprs_ns2_vc::priv, rate_ctr_group_free(), and gprs_ns2_vc::statg.

Referenced by DEFUN(), do_sns_delete(), gprs_ns2_fr_connect(), gprs_ns2_free_bind(), ns2_clear_sgsn(), ns2_create_vc(), ns2_free_nsvcs(), ns2_ip_bind_connect(), ns2_sns_st_all_action(), and ns2_sns_st_configured_onenter().

## ◆ gprs_ns2_free_nsvcs()

void gprs_ns2_free_nsvcs | ( | struct gprs_ns2_nse * | nse | ) |

Destroy/release all NS-VC of given NSE.

Parameters

  [in] | nse | NSE

References gprs_ns2_nse::bss_sns_fi, gprs_ns2_nse::freed, ns2_free_nsvcs(), NS2_SNS_EV_REQ_FREE_NSVCS, gprs_ns2_vc::nse, and osmo_fsm_inst_dispatch.

Referenced by DEFUN(), DEFUN_HIDDEN(), gprs_ns2_free_nse(), and gprs_ns2_sns_del_endpoint().

## ◆ gprs_ns2_instantiate()

struct gprs_ns2_inst * gprs_ns2_instantiate | ( | void * | ctx,
|  | osmo_prim_cb | cb,
|  | void * | cb_data
| ) |  |

Create a new GPRS NS instance.

Parameters

  [in] | ctx | a talloc context to allocate NS instance from
  [in] | cb | Call-back function for dispatching primitives to the user. The Call-back must free all msgb* given in the primitive.
  [in] | cb_data | transparent user data passed to Call-back

Returns
  dynamically allocated gprs_ns_inst; NULL on error

References gprs_ns2_inst::binding, gprs_ns2_inst::cb, gprs_ns2_inst::cb_data, INIT_LLIST_HEAD, NS_DEFAULT_TXQUEUE_MAX_LENGTH, NS_TOUT_TNS_ALIVE, NS_TOUT_TNS_ALIVE_RETRIES, NS_TOUT_TNS_BLOCK, NS_TOUT_TNS_BLOCK_RETRIES, NS_TOUT_TNS_RESET, NS_TOUT_TNS_RESET_RETRIES, NS_TOUT_TNS_TEST, NS_TOUT_TSNS_CONFIG_RETRIES, NS_TOUT_TSNS_PROCEDURES_RETRIES, NS_TOUT_TSNS_PROV, NS_TOUT_TSNS_SIZE_RETRIES, gprs_ns2_inst::nse, gprs_ns2_inst::timeout, and gprs_ns2_inst::txqueue_max_length.

## ◆ gprs_ns2_ip_connect()

struct gprs_ns2_vc * gprs_ns2_ip_connect | ( | struct gprs_ns2_vc_bind * | bind,
|  | const struct osmo_sockaddr * | remote,
|  | struct gprs_ns2_nse * | nse,
|  | uint16_t | nsvci
| ) |  |

Create, connect and activate a new IP-based NS-VC.

Parameters

  [in] | bind | bind in which the new NS-VC is to be created
  [in] | remote | remote address to which to connect
  [in] | nse | NS Entity in which the NS-VC is to be created
  [in] | nsvci | is only required when bind->vc_mode == NS2_VC_MODE_BLOCKRESET

Returns
  pointer to newly-allocated, connected and activated NS-VC; NULL on error

References gprs_ns2_vc::bind, gprs_ns2_ip_connect_inactive(), ns2_vc_fsm_start(), gprs_ns2_vc::nse, and gprs_ns2_vc::nsvci.

Referenced by DEFUN(), gprs_ns2_ip_connect2(), and ns_nse_nsvc_udp_cmds().

## ◆ gprs_ns2_ip_connect2()

struct gprs_ns2_vc * gprs_ns2_ip_connect2 | ( | struct gprs_ns2_vc_bind * | bind,
|  | const struct osmo_sockaddr * | remote,
|  | uint16_t | nsei,
|  | uint16_t | nsvci,
|  | enum gprs_ns2_dialect | dialect
| ) |  |

Create, connect and activate a new IP-based NS-VC.

Parameters

  [in] | bind | bind in which the new NS-VC is to be created
  [in] | remote | remote address to which to connect
  [in] | nsei | NSEI of the NS Entity in which the NS-VC is to be created
  [in] | nsvci | is only required when bind->vc_mode == NS2_VC_MODE_BLOCKRESET

Returns
  pointer to newly-allocated, connected and activated NS-VC; NULL on error

References gprs_ns2_nse::dialect, gprs_ns2_create_nse(), gprs_ns2_ip_connect(), GPRS_NS2_LL_UDP, gprs_ns2_nse_by_nsei(), nsei, and gprs_ns2_vc_bind::nsi.

## ◆ gprs_ns2_ip_connect_inactive()

struct gprs_ns2_vc * gprs_ns2_ip_connect_inactive | ( | struct gprs_ns2_vc_bind * | bind,
|  | const struct osmo_sockaddr * | remote,
|  | struct gprs_ns2_nse * | nse,
|  | uint16_t | nsvci
| ) |  |

Create, and connect an inactive, new IP-based NS-VC.

Parameters

  [in] | bind | bind in which the new NS-VC is to be created
  [in] | remote | remote address to which to connect
  [in] | nse | NS Entity in which the NS-VC is to be created
  [in] | nsvci | is only required when bind->vc_mode == NS2_VC_MODE_BLOCKRESET

Returns
  pointer to newly-allocated, connected and inactive NS-VC; NULL on error

References gprs_ns2_vc::bind, GPRS_NS2_VC_MODE_BLOCKRESET, gprs_ns2_vc::mode, ns2_ip_bind_connect(), gprs_ns2_vc::nse, gprs_ns2_vc::nsvci, and gprs_ns2_vc::nsvci_is_valid.

Referenced by create_missing_nsvcs(), create_nsvc_for_new_sbind(), gprs_ns2_ip_connect(), and ns2_vc_create_ip().

## ◆ gprs_ns2_ll_str()

const char * gprs_ns2_ll_str | ( | struct gprs_ns2_vc * | nsvc | ) |

string-format a given NS-VC to a thread-local static buffer.

Parameters

  [in] | nsvc | NS-VC to be string-formatted

Returns
  pointer to the string on success; NULL on error

References gprs_ns2_ll_str_buf(), and NS2_LL_MAX_STR.

Referenced by do_sns_change_weight(), do_sns_delete(), and ns2_vty_dump_nsvc().

## ◆ gprs_ns2_ll_str_buf()

char * gprs_ns2_ll_str_buf | ( | char * | buf,
|  | size_t | buf_len,
|  | struct gprs_ns2_vc * | nsvc
| ) |  |

string-format a given NS-VC into a user-supplied buffer.

Parameters

  [in] | buf | user-allocated output buffer
  [in] | buf_len | size of user-allocated output buffer in bytes
  [in] | nsvc | NS-VC to be string-formatted

Returns
  pointer to buf on success; NULL on error

References gprs_ns2_vc::bind, gprs_ns2_fr_bind_netif(), gprs_ns2_fr_nsvc_dlci(), gprs_ns2_ip_bind_sockaddr(), gprs_ns2_ip_vc_remote(), gprs_ns2_is_ip_bind(), GPRS_NS2_LL_FR, GPRS_NS2_LL_FR_GRE, GPRS_NS2_LL_UDP, osmo_sockaddr_str::ip, gprs_ns2_nse::ll, gprs_ns2_vc::nse, gprs_ns2_vc::nsvci, gprs_ns2_vc::nsvci_is_valid, osmo_sockaddr_str_from_sockaddr(), osmo_sockaddr_str::port, osmo_sockaddr::sas, and osmo_sockaddr::u.

Referenced by gprs_ns2_ll_str(), gprs_ns2_ll_str_c(), and ns2_prim_status_ind().

## ◆ gprs_ns2_ll_str_c()

char * gprs_ns2_ll_str_c | ( | const void * | ctx,
|  | struct gprs_ns2_vc * | nsvc
| ) |  |

string-format a given NS-VC to a dynamically allocated string.

Parameters

  [in] | ctx | talloc context from which to allocate
  [in] | nsvc | NS-VC to be string-formatted

Returns
  pointer to the string on success; NULL on error

References gprs_ns2_ll_str_buf(), and NS2_LL_MAX_STR.

## ◆ gprs_ns2_nse_by_nsei()

struct gprs_ns2_nse * gprs_ns2_nse_by_nsei | ( | struct gprs_ns2_inst * | nsi,
|  | uint16_t | nsei
| ) |  |

Resolve a NS Entity based on its NSEI.

Parameters

  [in] | nsi | NS Instance in which we do the look-up
  [in] | nsei | NSEI to look up

Returns
  NS Entity in successful case; NULL if none found

References list, llist_for_each_entry, gprs_ns2_inst::nse, nsei, gprs_ns2_nse::nsei, and gprs_ns2_nse::nsi.

Referenced by DEFUN(), DEFUN_HIDDEN(), gprs_ns2_create_nse2(), gprs_ns2_fr_connect2(), gprs_ns2_ip_connect2(), gprs_ns2_recv_prim(), ns2_create_vc(), ns2_create_vc_sns(), and ns2_nse_notify_unblocked().

## ◆ gprs_ns2_nse_foreach_nsvc()

int gprs_ns2_nse_foreach_nsvc | ( | struct gprs_ns2_nse * | nse,
|  | gprs_ns2_foreach_nsvc_cb | cb,
|  | void * | cb_data
| ) |  |

Iterate over all nsvc of a NS Entity and call the callback.

If the callback returns < 0 it aborts the loop and returns the callback return code.

Parameters

  [in] | nse | NS Entity to iterate over all nsvcs
  [in] | cb | the callback to call
  [in,out] | cb_data | the private data of the callback

Returns
  0 if the loop completes. If a callback returns < 0 it will returns this value.

References list, llist_for_each_entry_safe, gprs_ns2_vc::nse, and gprs_ns2_nse::nsvc.

Referenced by DEFUN_HIDDEN().

## ◆ gprs_ns2_nse_nsei()

uint16_t gprs_ns2_nse_nsei | ( | struct gprs_ns2_nse * | nse | ) |

Return the NSEI.

Parameters

  [in] | nse | NS Entity

Returns
  the nsei.

References gprs_ns2_nse::nsei.

## ◆ gprs_ns2_nsvc_by_nsvci()

struct gprs_ns2_vc * gprs_ns2_nsvc_by_nsvci | ( | struct gprs_ns2_inst * | nsi,
|  | uint16_t | nsvci
| ) |  |

Resolve a NS-VC Entity based on its NS-VCI.

Parameters

  [in] | nsi | NS Instance in which we do the look-up
  [in] | nsvci | NS-VCI to look up

Returns
  NS-VC Entity in successful case; NULL if none found

References list, llist_for_each_entry, gprs_ns2_inst::nse, gprs_ns2_vc::nse, gprs_ns2_nse::nsvc, gprs_ns2_vc::nsvci, and gprs_ns2_vc::nsvci_is_valid.

Referenced by DEFUN(), ns2_create_vc(), and ns2_vc_rx().

## ◆ gprs_ns2_nsvc_by_sockaddr_nse()

struct gprs_ns2_vc * gprs_ns2_nsvc_by_sockaddr_nse | ( | struct gprs_ns2_nse * | nse,
|  | const struct osmo_sockaddr * | sockaddr
| ) |  |

Find NS-VC for given socket address.

Parameters

  [in] | nse | NS Entity in which to search
  [in] | sockaddr | socket address to search for

Returns
  NS-VC matching sockaddr; NULL if none found

References gprs_ns2_ip_vc_remote(), list, llist_for_each_entry, gprs_ns2_nse::nsvc, OSMO_ASSERT, and osmo_sockaddr_cmp().

Referenced by nsvc_by_ip4_elem(), and nsvc_by_ip6_elem().

## ◆ gprs_ns2_nsvc_state_name()

const char * gprs_ns2_nsvc_state_name | ( | struct gprs_ns2_vc * | nsvc | ) |

Return the current state name of a given NS-VC to a thread-local static buffer.

Parameters

  [in] | nsvc | NS-VC to return the state of

Returns
  pointer to the string on success; NULL on error

References gprs_ns2_vc::fi, and osmo_fsm_inst_state_name().

## ◆ gprs_ns2_recv_prim()

int gprs_ns2_recv_prim | ( | struct gprs_ns2_inst * | nsi,
|  | struct osmo_prim_hdr * | oph
| ) |  |

Receive a primitive from the NS User (Gb).

Parameters

  [in] | nsi | NS instance to which the primitive is issued
  [in] | oph | The primitive

Returns
  0 on success; negative on error

References gprs_ns2_nse::alive, bvci, osmo_gprs_ns2_prim::bvci, osmo_gprs_ns2_prim::change, container_of, GPRS_NS2_ENDPOINT_CONFIRM_CHANGE, GPRS_NS2_ENDPOINT_REQUEST_CHANGE, gprs_ns2_nse_by_nsei(), GPRS_NS2_PRIM_UNIT_DATA, osmo_gprs_ns2_prim::link_selector, osmo_prim_hdr::msg, msgb_free(), ns2_load_sharing(), ns2_tx_unit_data(), gprs_ns2_vc::nse, nsei, osmo_gprs_ns2_prim::nsei, osmo_prim_hdr::operation, PRIM_OP_REQUEST, osmo_prim_hdr::primitive, osmo_prim_hdr::sap, SAP_NS, osmo_gprs_ns2_prim::u, and osmo_gprs_ns2_prim::unitdata.

Referenced by bssgp2_nsi_tx_ptp().

## ◆ gprs_ns2_start_alive_all_nsvcs()

void gprs_ns2_start_alive_all_nsvcs | ( | struct gprs_ns2_nse * | nse | ) |

Start the NS-ALIVE FSM in all NS-VCs of given NSE.

Parameters

  [in] | nse | NS Entity in whihc to start NS-ALIVE FSMs

References list, llist_for_each_entry, ns2_vc_fsm_start(), gprs_ns2_vc::nse, gprs_ns2_nse::nsvc, OSMO_ASSERT, and gprs_ns2_vc::sns_only.

Referenced by ns2_sns_st_bss_config_sgsn(), ns2_sns_st_configured_add(), ns2_sns_st_local_procedure(), and ns2_sns_st_sgsn_wait_config_ack().

## ◆ gprs_ns_cause_str()

const char * gprs_ns_cause_str | ( | enum ns_cause | cause | ) |

Obtain a human-readable string for NS cause value.

References cause, get_value_string(), and ns_cause_str.

Referenced by gprs_ns_rx_reset(), gprs_ns_rx_status(), gprs_ns_tx_block(), gprs_ns_tx_reset(), gprs_ns_tx_status(), gprs_sns_st_config_bss(), and gprs_sns_st_size().

## ◆ gprs_ns_close()

void gprs_ns_close | ( | struct gprs_ns_inst * | nsi | ) |

References osmo_fd::data, osmo_fd::fd, gprs_ns_inst::fd, gprs_nsvc_delete(), gprs_ns_inst::gprs_nsvcs, list, llist_for_each_entry_safe, gprs_nsvc::nsi, gprs_ns_inst::nsip, osmo_fd_unregister(), and gprs_ns_inst::unknown_nsvc.

Referenced by gprs_ns_destroy().

## ◆ gprs_ns_destroy()

void gprs_ns_destroy | ( | struct gprs_ns_inst * | nsi | ) |

Destroy an entire NS instance.

Parameters

  nsi | gprs_ns_inst that is to be destroyed

This function releases all resources associated with the NS-instance.

References gprs_ns_close(), and gprs_nsvc::nsi.

## ◆ gprs_ns_instantiate()

struct gprs_ns_inst * gprs_ns_instantiate | ( | gprs_ns_cb_t * | cb,
|  | void * | ctx
| ) |  |

Create a new GPRS NS instance.

Parameters

  [in] | cb | Call-back function for incoming BSSGP data

Returns
  dynamically allocated gprs_ns_inst

References gprs_ns_inst::cb, gprs_nsvc_create2(), gprs_ns_inst::gprs_nsvcs, gprs_sns_fsm_registered, gprs_sns_init(), INIT_LLIST_HEAD, gprs_nsvc::list, llist_del(), NS_TOUT_TNS_ALIVE, NS_TOUT_TNS_ALIVE_RETRIES, NS_TOUT_TNS_BLOCK, NS_TOUT_TNS_BLOCK_RETRIES, NS_TOUT_TNS_RESET, NS_TOUT_TNS_RESET_RETRIES, NS_TOUT_TNS_TEST, NS_TOUT_TSNS_PROV, gprs_ns_inst::nsip, gprs_nsvc::nsvci_is_valid, gprs_ns_inst::timeout, gprs_ns_inst::unknown_nsvc, and gprs_ns_inst::use_reset_block_unblock.

## ◆ gprs_ns_ll_clear()

void gprs_ns_ll_clear | ( | struct gprs_nsvc * | nsvc | ) |

References gprs_nsvc::bts_addr, gprs_nsvc::frgre, GPRS_NS_LL_FR_GRE, GPRS_NS_LL_UDP, gprs_nsvc::ip, and gprs_nsvc::ll.

Referenced by gprs_ns_rx_reset(), and gprs_ns_rx_reset_ack().

## ◆ gprs_ns_ll_copy()

void gprs_ns_ll_copy | ( | struct gprs_nsvc * | nsvc,
|  | struct gprs_nsvc * | other
| ) |  |

References gprs_nsvc::frgre, GPRS_NS_LL_FR_GRE, GPRS_NS_LL_UDP, gprs_nsvc::ip, and gprs_nsvc::ll.

Referenced by gprs_ns_rx_reset(), gprs_ns_rx_reset_ack(), and gprs_ns_vc_create().

## ◆ gprs_ns_ll_str()

const char * gprs_ns_ll_str | ( | const struct gprs_nsvc * | nsvc | ) |

References gprs_ns_ll_str_buf().

Referenced by create_missing_nsvcs(), do_sns_add(), do_sns_change_weight(), do_sns_delete(), dump_nse(), gprs_ns_rx_reset(), gprs_ns_rx_reset_ack(), gprs_ns_vc_create(), and gprs_nsvc_replace_if_found().

## ◆ gprs_ns_ll_str_buf()

char * gprs_ns_ll_str_buf | ( | char * | buf,
|  | size_t | buf_len,
|  | const struct gprs_nsvc * | nsvc
| ) |  |

References gprs_nsvc::bts_addr, gprs_nsvc::frgre, GPRS_NS_LL_FR_GRE, GPRS_NS_LL_UDP, gprs_nsvc::ip, gprs_nsvc::ll, and osmo_ntohs.

Referenced by gprs_ns_ll_str(), and gprs_ns_ll_str_c().

## ◆ gprs_ns_ll_str_c()

char * gprs_ns_ll_str_c | ( | const void * | ctx,
|  | const struct gprs_nsvc * | nsvc
| ) |  |

References gprs_ns_ll_str_buf().

## ◆ gprs_ns_msgb_alloc()

struct msgb * gprs_ns_msgb_alloc | ( | void |  | ) |

References DNS, LOGL_ERROR, LOGP, msg, msgb_alloc_headroom(), NS_ALLOC_HEADROOM, and NS_ALLOC_SIZE.

Referenced by gprs_ns_tx_block(), gprs_ns_tx_block_ack(), gprs_ns_tx_reset(), gprs_ns_tx_reset_ack(), gprs_ns_tx_simple(), gprs_ns_tx_sns_ack(), gprs_ns_tx_sns_config(), gprs_ns_tx_sns_config_ack(), gprs_ns_tx_sns_size(), gprs_ns_tx_sns_size_ack(), gprs_ns_tx_status(), and read_nsip_msg().

## ◆ gprs_ns_nsip_connect()

struct gprs_nsvc * gprs_ns_nsip_connect | ( | struct gprs_ns_inst * | nsi,
|  | struct sockaddr_in * | dest,
|  | uint16_t | nsei,
|  | uint16_t | nsvci
| ) |  |

Establish a NS connection (from the BSS) to the SGSN.

Parameters

  | nsi | NS-instance
  [in] | dest | Destination IP/Port
  [in] | nsei | NSEI of the to-be-established NS-VC
  [in] | nsvci | NSVCI of the to-be-established NS-VC

Returns
  struct gprs_nsvc representing the new NS-VC

This function will establish a single NS/UDP/IP connection in uplink (BSS to SGSN) direction.

References gprs_nsvc::bts_addr, gprs_nsvc_by_rem_addr(), gprs_nsvc_create2(), gprs_nsvc_reset(), gprs_nsvc::ip, NS_CAUSE_OM_INTERVENTION, nsei, gprs_nsvc::nsei, gprs_nsvc::nsi, gprs_nsvc::nsvci, and gprs_nsvc::remote_end_is_sgsn.

## ◆ gprs_ns_nsip_connect_sns()

struct gprs_nsvc * gprs_ns_nsip_connect_sns | ( | struct gprs_ns_inst * | nsi,
|  | struct sockaddr_in * | dest,
|  | uint16_t | nsei,
|  | uint16_t | nsvci
| ) |  |

Establish a NS connection (from the BSS) to the SGSN using SNS auto-configuration.

Parameters

  | nsi | NS-instance
  [in] | dest | Destination IP/Port
  [in] | nsei | NSEI of the to-be-established NS-VC
  [in] | nsvci | NSVCI of the to-be-established NS-VC

Returns
  struct gprs_nsvc representing the new NS-VC

This function will establish a single NS/UDP/IP connection in uplink (BSS to SGSN) direction. It will start with the SNS-SIZE procedure, followed by BSS-originated SNS-CONFIG, then SGSN-originated SNS-CONFIG.

Once configuration completes, the user will be notified by the S_SNS_CONFIGURED signal, at which point he typically would want to initiate NS-RESET by means of gprs_nsvc_reset().

References gprs_ns_inst::bss_sns_fi, gprs_nsvc::bts_addr, gprs_nsvc_by_rem_addr(), gprs_nsvc_create2(), gprs_sns_bss_fsm_alloc(), gprs_sns_bss_fsm_start(), gprs_nsvc::ip, ns_set_state, nsei, gprs_nsvc::nsei, gprs_nsvc::nsi, gprs_nsvc::nsvci, osmo_fsm_inst_term, OSMO_FSM_TERM_REQUEST, and gprs_nsvc::remote_end_is_sgsn.

## ◆ gprs_ns_nsip_listen()

int gprs_ns_nsip_listen | ( | struct gprs_ns_inst * | nsi | ) |

Create a listening socket for GPRS NS/UDP/IP.

Parameters

  [in] | nsi | NS protocol instance to listen

Returns
  >=0 (fd) in case of success, negative in case of error

A call to this function will create a UDP socket bound to the port number and IP address specified in the NS protocol instance. The file descriptor of the socket will be stored in nsi->nsip.fd.

References osmo_fd::cb, osmo_fd::data, DNS, gprs_ns_inst::dscp, gprs_ns_inst::fd, gprs_ns_inst::local_ip, gprs_ns_inst::local_port, LOGL_NOTICE, LOGP, gprs_ns_inst::nsip, nsip_fd_cb(), osmo_htonl, OSMO_SOCK_F_BIND, OSMO_SOCK_F_CONNECT, OSMO_SOCK_F_DSCP, osmo_sock_init2_ofd(), osmo_sock_init_ofd(), gprs_ns_inst::remote_ip, and gprs_ns_inst::remote_port.

## ◆ gprs_ns_process_msg()

int gprs_ns_process_msg | ( | struct gprs_ns_inst * | nsi,
|  | struct msgb * | msg,
|  | struct gprs_nsvc ** | nsvc
| ) |  |

Process NS message independently from underlying transport layer.

Parameters

  | nsi | NS instance to which the data belongs
  [in] | msg | message buffer containing newly-received data
  [in,out] | nsvc | refers to the virtual connection, may be modified when processing a NS_RESET

Returns
  0 in case of success, < 0 in case of error

This contains the main NS automaton.

References gprs_ns_inst::bss_sns_fi, gprs_ns_hdr::data, DNS, get_value_string(), gprs_ns_pdu_strings, gprs_ns_rx_block(), gprs_ns_rx_reset(), gprs_ns_rx_reset_ack(), gprs_ns_rx_sns(), gprs_ns_rx_status(), gprs_ns_rx_unitdata(), gprs_ns_tx_alive_ack(), gprs_ns_tx_simple(), gprs_ns_tx_status(), gprs_ns_tx_unblock(), gprs_nsvc_reset(), LOG_CTX_GB_NSVC, log_set_context(), LOGL_INFO, LOGL_NOTICE, LOGP, LOGPC, msg, msgb_hexdump(), msgb_l2len(), msgb_nsei, ns_att_tlvdef, NS_CAUSE_PDU_INCOMP_PSTATE, NS_CAUSE_PROTO_ERR_UNSPEC, NS_CTR_BYTES_IN, NS_CTR_PKTS_IN, NS_IE_NSEI, NS_IE_TRANS_ID, ns_is_sns(), ns_mark_alive, ns_mark_unblocked, ns_osmo_signal_dispatch(), 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, ns_set_remote_state, ns_set_state, NS_STAT_ALIVE_DELAY, NSE_S_ALIVE, NSE_S_BLOCKED, NSE_S_RESET, nsvc_is_not_used(), nsvc_start_timer(), nsvc_timer_elapsed_ms(), NSVC_TIMER_TNS_ALIVE, NSVC_TIMER_TNS_TEST, osmo_stat_item_group_get_item(), osmo_stat_item_set(), gprs_ns_hdr::pdu_type, rate_ctr_add(), rate_ctr_group_get_ctr(), rate_ctr_inc(), S_NS_UNBLOCK, SNS_PDUT_ACK, SNS_PDUT_ADD, SNS_PDUT_CHANGE_WEIGHT, SNS_PDUT_CONFIG, SNS_PDUT_CONFIG_ACK, SNS_PDUT_DELETE, SNS_PDUT_SIZE, SNS_PDUT_SIZE_ACK, and tlv_parse().

Referenced by gprs_ns_rcvmsg().

## ◆ gprs_ns_rcvmsg()

int gprs_ns_rcvmsg | ( | struct gprs_ns_inst * | nsi,
|  | struct msgb * | msg,
|  | struct sockaddr_in * | saddr,
|  | enum gprs_ns_ll | ll
| ) |  |

Receive incoming NS message from underlying transport layer.

Parameters

  | nsi | NS instance to which the data belongs
  [in] | msg | message buffer containing newly-received data
  [in] | saddr | socketaddr from which data was received
  [in] | ll | link-layer type in which data was received

Returns
  0 in case of success, < 0 in case of error

This is the main entry point int othe NS imlementation where frames from the underlying transport (normally UDP) enter.

References gprs_nsvc::bts_addr, gprs_ns_process_msg(), gprs_ns_vc_create(), gprs_nsvc_by_rem_addr(), gprs_nsvc::ip, gprs_nsvc::ll, LOG_CTX_GB_NSVC, log_set_context(), msg, gprs_nsvc::nsi, and gprs_ns_inst::unknown_nsvc.

Referenced by handle_nsfrgre_read(), and handle_nsip_read().

## ◆ gprs_ns_rx_block()

static int gprs_ns_rx_block | ( | struct gprs_nsvc * | nsvc,
|  | struct msgb * | msg
| ) |  |
| static

References cause, gprs_nsvc::ctrg, gprs_ns_hdr::data, DNS, gprs_ns_tx_block_ack(), gprs_ns_tx_status(), LOGL_ERROR, LOGL_INFO, LOGP, msg, msgb_l2len(), ns_att_tlvdef, NS_CAUSE_MISSING_ESSENT_IE, NS_CTR_BLOCKED, NS_IE_CAUSE, NS_IE_VCI, ns_mark_blocked, ns_osmo_signal_dispatch(), gprs_nsvc::nsei, rate_ctr_group_get_ctr(), rate_ctr_inc(), S_NS_BLOCK, tlv_parse(), TLVP_PRESENT, and TLVP_VAL.

Referenced by gprs_ns_process_msg().

## ◆ gprs_ns_rx_reset()

static int gprs_ns_rx_reset | ( | struct gprs_nsvc ** | nsvc,
|  | struct msgb * | msg
| ) |  |
| static

References cause, CHECK_TX_RC, gprs_ns_hdr::data, DNS, gprs_ns_cause_str(), gprs_ns_ll_clear(), gprs_ns_ll_copy(), gprs_ns_ll_str(), gprs_ns_tx_reset_ack(), gprs_ns_tx_status(), gprs_nsvc_create2(), gprs_nsvc_replace_if_found(), gprs_nsvc_start_test(), LOGL_ERROR, LOGL_INFO, LOGP, msg, msgb_l2len(), ns_att_tlvdef, NS_CAUSE_MISSING_ESSENT_IE, NS_CTR_INV_NSEI, NS_CTR_INV_VCI, NS_CTR_NSEI_CHG, NS_CTR_REPLACED, NS_IE_CAUSE, NS_IE_NSEI, NS_IE_VCI, ns_osmo_signal_dispatch(), ns_osmo_signal_dispatch_mismatch(), ns_osmo_signal_dispatch_replaced(), NS_PDUT_RESET, ns_set_state, NSE_S_ALIVE, NSE_S_BLOCKED, nsei, osmo_stat_item_group_udp_idx(), rate_ctr_group_get_ctr(), rate_ctr_group_upd_idx(), rate_ctr_inc(), S_NS_RESET, tlv_parse(), TLVP_PRESENT, TLVP_VAL, and tlvp_val16be().

Referenced by gprs_ns_process_msg().

## ◆ gprs_ns_rx_reset_ack()

static int gprs_ns_rx_reset_ack | ( | struct gprs_nsvc ** | nsvc,
|  | struct msgb * | msg
| ) |  |
| static

References CHECK_TX_RC, gprs_ns_hdr::data, DNS, gprs_ns_ll_clear(), gprs_ns_ll_copy(), gprs_ns_ll_str(), gprs_ns_tx_status(), gprs_nsvc_replace_if_found(), gprs_nsvc_start_test(), LOGL_ERROR, LOGL_INFO, LOGL_NOTICE, LOGP, msg, msgb_l2len(), ns_att_tlvdef, NS_CAUSE_MISSING_ESSENT_IE, NS_CTR_BLOCKED, NS_CTR_INV_NSEI, NS_CTR_INV_VCI, NS_CTR_NSEI_CHG, NS_CTR_REPLACED, NS_IE_NSEI, NS_IE_VCI, ns_osmo_signal_dispatch_mismatch(), ns_osmo_signal_dispatch_replaced(), NS_PDUT_RESET_ACK, ns_set_remote_state, ns_set_state, NSE_S_ALIVE, NSE_S_BLOCKED, NSE_S_RESET, nsei, osmo_timer_del(), rate_ctr_group_get_ctr(), rate_ctr_inc(), tlv_parse(), TLVP_PRESENT, and tlvp_val16be().

Referenced by gprs_ns_process_msg().

## ◆ gprs_ns_rx_status()

static int gprs_ns_rx_status | ( | struct gprs_nsvc * | nsvc,
|  | struct msgb * | msg
| ) |  |
| static

References cause, gprs_ns_hdr::data, DNS, gprs_ns_cause_str(), LOGL_ERROR, LOGL_INFO, LOGL_NOTICE, LOGP, LOGPC, msg, msgb_l2len(), ns_att_tlvdef, NS_IE_CAUSE, gprs_nsvc::nsei, tlv_parse(), TLVP_PRESENT, and TLVP_VAL.

Referenced by gprs_ns_process_msg().

## ◆ gprs_ns_rx_unitdata()

static int gprs_ns_rx_unitdata | ( | struct gprs_nsvc * | nsvc,
|  | struct msgb * | msg
| ) |  |
| static

References bvci, gprs_ns_inst::cb, gprs_ns_hdr::data, GPRS_NS_EVT_UNIT_DATA, gprs_ns_tx_status(), if(), msg, msgb_bssgph, msgb_bvci, NS_CAUSE_NSVC_BLOCKED, NSE_S_BLOCKED, gprs_nsvc::nsi, and gprs_nsvc::state.

Referenced by gprs_ns_process_msg().

## ◆ gprs_ns_sendmsg()

int gprs_ns_sendmsg | ( | struct gprs_ns_inst * | nsi,
|  | struct msgb * | msg
| ) |  |

High-level function for transmitting a NS-UNITDATA messsage.

Parameters

  [in] | nsi | NS-instance on which we shall transmit
  [in] | msg | struct msgb to be trasnmitted

This function obtains the NS-VC by the msgb_nsei(msg) and then checks if the NS-VC is ALIVE and not BLOCKED. After that, it adds a NS header for the NS-UNITDATA message type and sends it off.

Section 9.2.10: transmit side / NS-UNITDATA-REQUEST primitive

References bvci, gprs_ns_hdr::data, DNS, gprs_active_nsvc_by_nsei(), gprs_ns_tx(), gprs_nsvc_by_nsei(), if(), LOG_CTX_GB_NSVC, log_set_context(), LOGL_ERROR, LOGP, msg, msgb_bvci, msgb_free(), msgb_nsei, msgb_push(), NS_PDUT_UNITDATA, and gprs_ns_hdr::pdu_type.

Referenced by _gprs_ns_sendmsg().

## ◆ gprs_ns_set_log_ss()

void gprs_ns_set_log_ss | ( | int | ss | ) |

References DNS.

## ◆ gprs_ns_timer_cb()

static void gprs_ns_timer_cb | ( | void * | data | ) |
| static

References _NSVC_TIMER_NR, gprs_nsvc::alive_retries, gprs_ns_inst::bss_sns_fi, gprs_nsvc::ctrg, data, DEBUGP, DNS, get_value_string(), gprs_ns_tx_alive(), gprs_ns_tx_reset(), LOG_CTX_GB_NSVC, log_set_context(), LOGL_NOTICE, LOGP, NS_CAUSE_NSVC_BLOCKED, NS_CAUSE_OM_INTERVENTION, NS_CTR_BLOCKED, NS_CTR_DEAD, NS_CTR_LOST_ALIVE, NS_CTR_LOST_RESET, ns_osmo_signal_dispatch(), ns_set_state, NS_TOUT_TNS_ALIVE_RETRIES, NSE_S_BLOCKED, NSE_S_RESET, gprs_nsvc::nsei, gprs_nsvc::nsi, gprs_ns_inst::nsip, nsvc_start_timer(), NSVC_TIMER_TNS_ALIVE, NSVC_TIMER_TNS_RESET, NSVC_TIMER_TNS_TEST, rate_ctr_group_get_ctr(), rate_ctr_inc(), S_NS_ALIVE_EXP, S_NS_BLOCK, gprs_nsvc::state, gprs_ns_inst::timeout, gprs_nsvc::timer_mode, timer_mode_strs, timer_mode_tout, and gprs_ns_inst::use_reset_block_unblock.

Referenced by gprs_nsvc_create2().

## ◆ gprs_ns_tx()

static int gprs_ns_tx | ( | struct gprs_nsvc * | nsvc,
|  | struct msgb * | msg
| ) |  |
| static

References gprs_nsvc::ctrg, DNS, get_value_string(), gprs_ns_frgre_sendmsg(), GPRS_NS_LL_FR_GRE, GPRS_NS_LL_UDP, gprs_ns_pdu_strings, gprs_nsvc::ll, LOG_CTX_GB_NSVC, log_set_context(), LOGL_ERROR, LOGL_INFO, LOGL_NOTICE, LOGP, msg, msgb_free(), msgb_l2len(), NS_CTR_BYTES_OUT, NS_CTR_PKTS_OUT, ns_is_sns(), NS_PDUT_STATUS, nsip_sendmsg(), nsvc_is_not_used(), gprs_ns_hdr::pdu_type, rate_ctr_add(), rate_ctr_group_get_ctr(), and rate_ctr_inc().

Referenced by gprs_ns_sendmsg(), gprs_ns_tx_block(), gprs_ns_tx_block_ack(), gprs_ns_tx_reset(), gprs_ns_tx_reset_ack(), gprs_ns_tx_simple(), gprs_ns_tx_sns_ack(), gprs_ns_tx_sns_config(), gprs_ns_tx_sns_config_ack(), gprs_ns_tx_sns_size(), gprs_ns_tx_sns_size_ack(), and gprs_ns_tx_status().

## ◆ gprs_ns_tx_alive()

int gprs_ns_tx_alive | ( | struct gprs_nsvc * | nsvc | ) |

Transmit a NS-ALIVE on a given NS-VC.

Parameters

  [in] | nsvc | NS-VC on which the NS-ALIVE is to be transmitted

Returns
  0 in case of success

References DNS, gprs_ns_tx_simple(), LOG_CTX_GB_NSVC, log_set_context(), LOGL_DEBUG, LOGP, NS_PDUT_ALIVE, gprs_nsvc::nsei, and gprs_nsvc::nsvci.

Referenced by gprs_ns_timer_cb(), and gprs_nsvc_start_test().

## ◆ gprs_ns_tx_alive_ack()

int gprs_ns_tx_alive_ack | ( | struct gprs_nsvc * | nsvc | ) |

Transmit a NS-ALIVE-ACK on a given NS-VC.

Parameters

  [in] | nsvc | NS-VC on which the NS-ALIVE-ACK is to be transmitted

Returns
  0 in case of success

References DNS, gprs_ns_tx_simple(), LOG_CTX_GB_NSVC, log_set_context(), LOGL_DEBUG, LOGP, NS_PDUT_ALIVE_ACK, gprs_nsvc::nsei, and gprs_nsvc::nsvci.

Referenced by gprs_ns_process_msg().

## ◆ gprs_ns_tx_block()

int gprs_ns_tx_block | ( | struct gprs_nsvc * | nsvc,
|  | uint8_t | cause
| ) |  |

Transmit a NS-BLOCK on a given NS-VC.

Parameters

  [in] | nsvc | NS-VC on which the NS-BLOCK is to be transmitted
  [in] | cause | Numeric NS Cause value

Returns
  0 in case of success

References cause, gprs_nsvc::ctrg, DNS, ERR_IF_NSVC_USES_SNS, gprs_ns_cause_str(), gprs_ns_msgb_alloc(), gprs_ns_tx(), LOG_CTX_GB_NSVC, log_set_context(), LOGL_INFO, LOGP, msg, msgb_put(), msgb_tvlv_put(), NS_CTR_BLOCKED, NS_IE_CAUSE, NS_IE_VCI, ns_mark_blocked, NS_PDUT_BLOCK, gprs_nsvc::nsei, gprs_nsvc::nsvci, osmo_htons, gprs_ns_hdr::pdu_type, rate_ctr_group_get_ctr(), and rate_ctr_inc().

Referenced by DEFUN().

## ◆ gprs_ns_tx_block_ack()

static int gprs_ns_tx_block_ack | ( | struct gprs_nsvc * | nsvc | ) |
| static

Transmit a NS-BLOCK-ACK on a given NS-VC.

Parameters

  [in] | nsvc | NS-VC on which the NS-BLOCK is to be transmitted

Returns
  0 in case of success

References DNS, ERR_IF_NSVC_USES_SNS, gprs_ns_msgb_alloc(), gprs_ns_tx(), LOG_CTX_GB_NSVC, log_set_context(), LOGL_INFO, LOGP, msg, msgb_put(), msgb_tvlv_put(), NS_IE_VCI, NS_PDUT_BLOCK_ACK, gprs_nsvc::nsei, gprs_nsvc::nsvci, osmo_htons, and gprs_ns_hdr::pdu_type.

Referenced by gprs_ns_rx_block().

## ◆ gprs_ns_tx_reset()

int gprs_ns_tx_reset | ( | struct gprs_nsvc * | nsvc,
|  | uint8_t | cause
| ) |  |

Transmit a NS-RESET on a given NSVC.

Parameters

  [in] | nsvc | NS-VC used for transmission
  [in] | cause | Numeric NS cause value

References cause, DNS, ERR_IF_NSVC_USES_SNS, gprs_ns_cause_str(), gprs_ns_msgb_alloc(), gprs_ns_tx(), LOG_CTX_GB_NSVC, log_set_context(), LOGL_INFO, LOGP, msg, msgb_put(), msgb_tvlv_put(), NS_IE_CAUSE, NS_IE_NSEI, NS_IE_VCI, NS_PDUT_RESET, nsei, gprs_nsvc::nsei, gprs_nsvc::nsvci, osmo_htons, and gprs_ns_hdr::pdu_type.

Referenced by gprs_ns_timer_cb(), and gprs_nsvc_reset().

## ◆ gprs_ns_tx_reset_ack()

static int gprs_ns_tx_reset_ack | ( | struct gprs_nsvc * | nsvc | ) |
| static

References DNS, ERR_IF_NSVC_USES_SNS, gprs_ns_msgb_alloc(), gprs_ns_tx(), LOG_CTX_GB_NSVC, log_set_context(), LOGL_INFO, LOGP, msg, msgb_put(), msgb_tvlv_put(), NS_IE_NSEI, NS_IE_VCI, NS_PDUT_RESET_ACK, nsei, gprs_nsvc::nsei, gprs_nsvc::nsvci, osmo_htons, and gprs_ns_hdr::pdu_type.

Referenced by gprs_ns_rx_reset().

## ◆ gprs_ns_tx_simple()

static int gprs_ns_tx_simple | ( | struct gprs_nsvc * | nsvc,
|  | uint8_t | pdu_type
| ) |  |
| static

References gprs_ns_msgb_alloc(), gprs_ns_tx(), LOG_CTX_GB_NSVC, log_set_context(), msg, msgb_put(), pdu_type, and gprs_ns_hdr::pdu_type.

Referenced by gprs_ns_process_msg(), gprs_ns_tx_alive(), gprs_ns_tx_alive_ack(), and gprs_ns_tx_unblock().

## ◆ gprs_ns_tx_sns_ack()

int gprs_ns_tx_sns_ack | ( | struct gprs_nsvc * | nsvc,
|  | uint8_t | trans_id,
|  | uint8_t * | cause,
|  | const struct gprs_ns_ie_ip4_elem * | ip4_elems,
|  | unsigned int | num_ip4_elems
| ) |  |

Encode + Transmit a SNS-ACK as per Section 9.3.1.

Parameters

  [in] | nsvc | NS-VC through which to transmit the ACK
  [in] | trans_id | Transaction ID which to acknowledge
  [in] | cause | Pointer to cause value (NULL if no cause to be sent)
  [in] | ip4_elems | Array of IPv4 Elements
  [in] | num_ip4_elems | number of ip4_elems

Returns
  0 on success; negative in case of error

References gprs_ns_inst::bss_sns_fi, cause, DNS, gprs_ns_msgb_alloc(), gprs_ns_tx(), LOG_CTX_GB_NSVC, log_set_context(), LOGL_ERROR, LOGP, msg, msgb_free(), msgb_put(), msgb_tvlv_put(), msgb_v_put(), NS_IE_CAUSE, NS_IE_IPv4_LIST, NS_IE_NSEI, nsei, gprs_nsvc::nsei, gprs_nsvc::nsi, osmo_htons, gprs_ns_hdr::pdu_type, and SNS_PDUT_ACK.

Referenced by gprs_sns_st_configured().

## ◆ gprs_ns_tx_sns_config()

int gprs_ns_tx_sns_config | ( | struct gprs_nsvc * | nsvc,
|  | bool | end_flag,
|  | const struct gprs_ns_ie_ip4_elem * | ip4_elems,
|  | unsigned int | num_ip4_elems
| ) |  |

Encode + Transmit a SNS-CONFIG as per Section 9.3.4.

Parameters

  [in] | nsvc | NS-VC through which to transmit the SNS-CONFIG
  [in] | end_flag | Whether or not this is the last SNS-CONFIG
  [in] | ip4_elems | Array of IPv4 Elements
  [in] | num_ip4_elems | number of ip4_elems

Returns
  0 on success; negative in case of error

References gprs_ns_inst::bss_sns_fi, DNS, gprs_ns_msgb_alloc(), gprs_ns_tx(), LOG_CTX_GB_NSVC, log_set_context(), LOGL_ERROR, LOGP, msg, msgb_free(), msgb_put(), msgb_tvlv_put(), msgb_v_put(), NS_IE_IPv4_LIST, NS_IE_NSEI, nsei, gprs_nsvc::nsei, gprs_nsvc::nsi, osmo_htons, gprs_ns_hdr::pdu_type, and SNS_PDUT_CONFIG.

Referenced by gprs_sns_st_config_bss_onenter().

## ◆ gprs_ns_tx_sns_config_ack()

int gprs_ns_tx_sns_config_ack | ( | struct gprs_nsvc * | nsvc,
|  | uint8_t * | cause
| ) |  |

Encode + Transmit a SNS-CONFIG-ACK as per Section 9.3.5.

Parameters

  [in] | nsvc | NS-VC through which to transmit the SNS-CONFIG-ACK
  [in] | cause | Pointer to cause value (NULL if no cause to be sent)

Returns
  0 on success; negative in case of error

References gprs_ns_inst::bss_sns_fi, cause, DNS, gprs_ns_msgb_alloc(), gprs_ns_tx(), LOG_CTX_GB_NSVC, log_set_context(), LOGL_ERROR, LOGP, msg, msgb_free(), msgb_put(), msgb_tvlv_put(), NS_IE_CAUSE, NS_IE_NSEI, nsei, gprs_nsvc::nsei, gprs_nsvc::nsi, osmo_htons, gprs_ns_hdr::pdu_type, and SNS_PDUT_CONFIG_ACK.

Referenced by gprs_sns_st_config_sgsn().

## ◆ gprs_ns_tx_sns_size()

int gprs_ns_tx_sns_size | ( | struct gprs_nsvc * | nsvc,
|  | bool | reset_flag,
|  | uint16_t | max_nr_nsvc,
|  | uint16_t * | ip4_ep_nr,
|  | uint16_t * | ip6_ep_nr
| ) |  |

Encode + transmit a SNS-SIZE as per Section 9.3.7.

Parameters

  [in] | nsvc | NS-VC through which to transmit the SNS-SIZE
  [in] | reset_flag | Whether or not to add a RESET flag
  [in] | max_nr_nsvc | Maximum number of NS-VCs
  [in] | ip4_ep_nr | Number of IPv4 endpoints (NULL if none)
  [in] | ip6_ep_nr | Number of IPv6 endpoints (NULL if none)

Returns
  0 on success; negative in case of error

References gprs_ns_inst::bss_sns_fi, DNS, gprs_ns_msgb_alloc(), gprs_ns_tx(), LOG_CTX_GB_NSVC, log_set_context(), LOGL_ERROR, LOGP, msg, msgb_free(), msgb_put(), msgb_tv16_put(), msgb_tv_put(), msgb_tvlv_put(), NS_IE_IPv4_EP_NR, NS_IE_IPv6_EP_NR, NS_IE_MAX_NR_NSVC, NS_IE_NSEI, NS_IE_RESET_FLAG, nsei, gprs_nsvc::nsei, gprs_nsvc::nsi, osmo_htons, gprs_ns_hdr::pdu_type, and SNS_PDUT_SIZE.

Referenced by gprs_sns_st_size_onenter().

## ◆ gprs_ns_tx_sns_size_ack()

int gprs_ns_tx_sns_size_ack | ( | struct gprs_nsvc * | nsvc,
|  | uint8_t * | cause
| ) |  |

Encode + Transmit a SNS-SIZE-ACK as per Section 9.3.8.

Parameters

  [in] | nsvc | NS-VC through which to transmit the SNS-SIZE-ACK
  [in] | cause | Pointer to cause value (NULL if no cause to be sent)

Returns
  0 on success; negative in case of error

References gprs_ns_inst::bss_sns_fi, cause, DNS, gprs_ns_msgb_alloc(), gprs_ns_tx(), LOG_CTX_GB_NSVC, log_set_context(), LOGL_ERROR, LOGP, msg, msgb_free(), msgb_put(), msgb_tvlv_put(), NS_IE_CAUSE, NS_IE_NSEI, nsei, gprs_nsvc::nsei, gprs_nsvc::nsi, osmo_htons, gprs_ns_hdr::pdu_type, and SNS_PDUT_SIZE_ACK.

## ◆ gprs_ns_tx_status()

int gprs_ns_tx_status | ( | struct gprs_nsvc * | nsvc,
|  | uint8_t | cause,
|  | uint16_t | bvci,
|  | struct msgb * | orig_msg
| ) |  |

Transmit a NS-STATUS on a given NSVC.

Parameters

  [in] | nsvc | NS-VC to be used for transmission
  [in] | cause | Numeric NS cause value
  [in] | bvci | BVCI to be reset within NSVC
  [in] | orig_msg | message causing the STATUS

References bvci, cause, DNS, gprs_ns_cause_str(), gprs_ns_msgb_alloc(), gprs_ns_tx(), msgb::l2h, LOG_CTX_GB_NSVC, log_set_context(), LOGL_NOTICE, LOGP, msg, msgb_l2len(), msgb_put(), msgb_tvlv_put(), NS_CAUSE_BVCI_UNKNOWN, NS_CAUSE_INVAL_ESSENT_IE, NS_CAUSE_MISSING_ESSENT_IE, NS_CAUSE_NSVC_BLOCKED, NS_CAUSE_NSVC_UNKNOWN, NS_CAUSE_PDU_INCOMP_PSTATE, NS_CAUSE_PROTO_ERR_UNSPEC, NS_CAUSE_SEM_INCORR_PDU, NS_IE_CAUSE, NS_IE_PDU, NS_IE_VCI, NS_PDUT_STATUS, gprs_nsvc::nsei, gprs_nsvc::nsvci, osmo_htons, and gprs_ns_hdr::pdu_type.

Referenced by gprs_ns_process_msg(), gprs_ns_rx_block(), gprs_ns_rx_reset(), gprs_ns_rx_reset_ack(), gprs_ns_rx_unitdata(), and gprs_ns_vc_create().

## ◆ gprs_ns_tx_unblock()

int gprs_ns_tx_unblock | ( | struct gprs_nsvc * | nsvc | ) |

Transmit a NS-UNBLOCK on a given NS-VC.

Parameters

  [in] | nsvc | NS-VC on which the NS-UNBLOCK is to be transmitted

Returns
  0 in case of success

References DNS, ERR_IF_NSVC_USES_SNS, gprs_ns_tx_simple(), LOG_CTX_GB_NSVC, log_set_context(), LOGL_INFO, LOGP, NS_PDUT_UNBLOCK, gprs_nsvc::nsei, and gprs_nsvc::nsvci.

Referenced by DEFUN(), and gprs_ns_process_msg().

## ◆ gprs_ns_vc_create()

int gprs_ns_vc_create | ( | struct gprs_ns_inst * | nsi,
|  | struct msgb * | msg,
|  | struct gprs_nsvc * | fallback_nsvc,
|  | struct gprs_nsvc ** | new_nsvc
| ) |  |

Create/get NS-VC independently from underlying transport layer.

Parameters

  | nsi | NS instance to which the data belongs
  [in] | msg | message buffer containing newly-received data
  [in] | fallback_nsvc | is used to send error messages back to the peer and to initialise the ll info of a created NS-VC object
  [out] | new_nsvc | contains a pointer to a NS-VC object if one has been created or found

Returns
  < 0 in case of error, GPRS_NS_CS_SKIPPED if a message has been skipped, GPRS_NS_CS_REJECTED if a message has been rejected and answered accordingly, GPRS_NS_CS_CREATED if a new NS-VC object has been created and registered, and GPRS_NS_CS_FOUND if an existing NS-VC object has been found with the same NSEI.

This contains the initial NS automaton state (NS-VC not yet attached).

References CHECK_TX_RC, gprs_ns_hdr::data, DNS, get_value_string(), GPRS_NS_CS_CREATED, GPRS_NS_CS_FOUND, GPRS_NS_CS_REJECTED, GPRS_NS_CS_SKIPPED, gprs_ns_ll_copy(), gprs_ns_ll_str(), gprs_ns_pdu_strings, gprs_ns_tx_status(), gprs_nsvc_by_nsvci(), gprs_nsvc_create2(), if(), LOG_CTX_GB_NSVC, log_set_context(), LOGL_ERROR, LOGL_INFO, LOGL_NOTICE, LOGP, msg, msgb_l2len(), ns_att_tlvdef, NS_CAUSE_MISSING_ESSENT_IE, NS_CAUSE_PDU_INCOMP_PSTATE, NS_CTR_NSEI_CHG, NS_IE_CAUSE, NS_IE_NSEI, NS_IE_VCI, NS_PDUT_ALIVE_ACK, NS_PDUT_RESET, NS_PDUT_RESET_ACK, NS_PDUT_STATUS, ns_set_state, NSE_S_ALIVE, nsei, gprs_nsvc::nsei, gprs_nsvc::nsvci, gprs_nsvc::nsvci_is_valid, gprs_ns_hdr::pdu_type, rate_ctr_group_get_ctr(), rate_ctr_inc(), tlv_parse(), TLVP_PRESENT, and tlvp_val16be().

Referenced by gprs_ns_rcvmsg().

## ◆ gprs_nsvc_by_nsei()

struct gprs_nsvc * gprs_nsvc_by_nsei | ( | struct gprs_ns_inst * | nsi,
|  | uint16_t | nsei
| ) |  |

Lookup struct gprs_nsvc based on NSEI.

Parameters

  [in] | nsi | NS instance in which to search
  [in] | nsei | NSEI to be searched

Returns
  first gprs_nsvc of respective NSEI

References gprs_ns_inst::gprs_nsvcs, list, llist_for_each_entry, nsei, gprs_nsvc::nsei, and gprs_nsvc::nsi.

Referenced by DEFUN(), and gprs_ns_sendmsg().

## ◆ gprs_nsvc_by_nsvci()

struct gprs_nsvc * gprs_nsvc_by_nsvci | ( | struct gprs_ns_inst * | nsi,
|  | uint16_t | nsvci
| ) |  |

Lookup struct gprs_nsvc based on NSVCI.

Parameters

  [in] | nsi | NS instance in which to search
  [in] | nsvci | NSVCI to be searched

Returns
  gprs_nsvc of respective NSVCI

References gprs_ns_inst::gprs_nsvcs, list, llist_for_each_entry, gprs_nsvc::nsi, and gprs_nsvc::nsvci.

Referenced by DEFUN(), gprs_ns_vc_create(), gprs_nsvc_create2(), and gprs_nsvc_replace_if_found().

## ◆ gprs_nsvc_by_rem_addr()

struct gprs_nsvc * gprs_nsvc_by_rem_addr | ( | struct gprs_ns_inst * | nsi,
|  | const struct sockaddr_in * | sin
| ) |  |

Lookup NS-VC based on specified remote peer socket addr.

Parameters

  [in] | nsi | NS Instance within which we shall look up the NS-VC
  [in] | sin | Remote peer Socket Address (IP + UDP Port)

Returns
  NS-VC matching the given peer; NULL in case of none

References gprs_nsvc::bts_addr, gprs_ns_inst::gprs_nsvcs, gprs_nsvc::ip, list, llist_for_each_entry, and gprs_nsvc::nsi.

Referenced by gprs_ns_nsip_connect(), gprs_ns_nsip_connect_sns(), gprs_ns_rcvmsg(), and nsvc_by_ip4_elem().

## ◆ gprs_nsvc_create2()

struct gprs_nsvc * gprs_nsvc_create2 | ( | struct gprs_ns_inst * | nsi,
|  | uint16_t | nsvci,
|  | uint8_t | sig_weight,
|  | uint8_t | data_weight
| ) |  |

Create a new NS-VC (Virtual Circuit) within given instance.

Parameters

  [in] | nsi | NS Instance in which to create the NSVC
  [in] | nsvci] | NS Virtual Connection Identifier for this NSVC
  [in] | sig_weight | Signalling Weight of this NS-VC. Use "0" for no signalling
  [in] | data_weight | Data WEight of this NS-VC. Use "0" for no data

Returns
  newly-created gprs_nsvc within nsi. NULL on error.

References gprs_ns_inst::bss_sns_fi, gprs_nsvc::ctrg, gprs_nsvc::data_weight, data_weight, DNS, gprs_ns_timer_cb(), gprs_nsvc_by_nsvci(), gprs_ns_inst::gprs_nsvcs, gprs_nsvc::list, llist_add(), LOGL_ERROR, LOGL_INFO, LOGP, ns_set_state, NSE_S_BLOCKED, gprs_nsvc::nsi, gprs_ns_inst::nsip, nsvc_ctrg_desc, nsvc_statg_desc, gprs_nsvc::nsvci, gprs_nsvc::nsvci_is_valid, osmo_stat_item_group_alloc(), osmo_timer_setup(), rate_ctr_group_alloc(), gprs_nsvc::sig_weight, sig_weight, gprs_nsvc::statg, gprs_nsvc::timer, and gprs_ns_inst::use_reset_block_unblock.

Referenced by DEFUN(), gprs_ns_instantiate(), gprs_ns_nsip_connect(), gprs_ns_nsip_connect_sns(), gprs_ns_rx_reset(), gprs_ns_vc_create(), and gprs_nsvc_create_ip4().

## ◆ gprs_nsvc_delete()

void gprs_nsvc_delete | ( | struct gprs_nsvc * | nsvc | ) |

Delete given NS-VC.

Parameters

  [in] | nsvc | gprs_nsvc to be deleted

References gprs_nsvc::ctrg, gprs_nsvc::list, llist_del(), osmo_stat_item_group_free(), osmo_timer_del(), rate_ctr_group_free(), gprs_nsvc::statg, and gprs_nsvc::timer.

Referenced by do_sns_delete(), and gprs_ns_close().

## ◆ gprs_nsvc_replace_if_found()

static int gprs_nsvc_replace_if_found | ( | uint16_t | nsvci,
|  | struct gprs_nsvc ** | nsvc,
|  | struct gprs_nsvc ** | old_nsvc
| ) |  |
| static

References DNS, gprs_ns_ll_str(), gprs_nsvc_by_nsvci(), LOGL_INFO, LOGP, and gprs_nsvc::nsvci.

Referenced by gprs_ns_rx_reset(), and gprs_ns_rx_reset_ack().

## ◆ gprs_nsvc_reset()

int gprs_nsvc_reset | ( | struct gprs_nsvc * | nsvc,
|  | uint8_t | cause
| ) |  |

Initiate a RESET procedure.

Parameters

  [in] | nsvc | NS-VC in which to start the procedure
  [in] | cause | Numeric NS cause value

This is a high-level function initiating a NS-RESET procedure. It will not only send a NS-RESET, but also set the state to BLOCKED and start the Tns-reset timer.

References cause, DNS, ERR_IF_NSVC_USES_SNS, gprs_ns_tx_reset(), LOGL_ERROR, LOGL_INFO, LOGP, ns_set_state, NSE_S_BLOCKED, NSE_S_RESET, gprs_nsvc::nsei, nsvc_start_timer(), and NSVC_TIMER_TNS_RESET.

Referenced by DEFUN(), gprs_ns_nsip_connect(), and gprs_ns_process_msg().

## ◆ gprs_nsvc_start_test()

void gprs_nsvc_start_test | ( | struct gprs_nsvc * | nsvc | ) |

Start the ALIVE timer procedure in all NS-VCs part of this NS Instance.

References gprs_ns_tx_alive(), nsvc_is_not_used(), nsvc_start_timer(), and NSVC_TIMER_TNS_TEST.

Referenced by do_sns_add(), gprs_ns_rx_reset(), gprs_ns_rx_reset_ack(), and gprs_start_alive_all_nsvcs().

## ◆ gprs_nsvc_state_append()

char * gprs_nsvc_state_append | ( | char * | s,
|  | struct gprs_nsvc * | nsvc
| ) |  |

Append the nsvc state to a talloc string.

Parameters

  | s | The string to append to (allocated with talloc)
  [in] | nsvc | The NS-VC to print the state of

Returns
  The new string with state information appended to it

This function will append a comma-separated state of the NS-VC to the string. The string needs to be allocated with talloc (e.g. talloc_strdup)

References NS_DESC_A, NS_DESC_B, gprs_nsvc::nsei, gprs_nsvc::nsvci, gprs_nsvc::remote_end_is_sgsn, gprs_nsvc::remote_state, and gprs_nsvc::state.

## ◆ gprs_start_alive_all_nsvcs()

void gprs_start_alive_all_nsvcs | ( | struct gprs_ns_inst * | nsi | ) |

References gprs_nsvc_start_test(), gprs_ns_inst::gprs_nsvcs, list, llist_for_each_entry, and gprs_nsvc::nsi.

Referenced by gprs_sns_st_config_sgsn().

## ◆ grps_ns_frgre_sendmsg()

int grps_ns_frgre_sendmsg | ( | struct gprs_nsvc * | nsvc,
|  | struct msgb * | msg
| ) |  |

## ◆ handle_nsip_read()

static int handle_nsip_read | ( | struct osmo_fd * | bfd | ) |
| static

References osmo_fd::data, GPRS_NS_LL_UDP, gprs_ns_rcvmsg(), msg, msgb_free(), and read_nsip_msg().

Referenced by nsip_fd_cb().

## ◆ handle_nsip_write()

static int handle_nsip_write | ( | struct osmo_fd * | bfd | ) |
| static

Referenced by nsip_fd_cb().

## ◆ ns2_bind_alloc()

int ns2_bind_alloc | ( | struct gprs_ns2_inst * | nsi,
|  | const char * | name,
|  | struct gprs_ns2_vc_bind ** | result
| ) |  |

common allocation + low-level initialization of a bind.

Called by vc-drivers

References gprs_ns2_inst::bind_rate_ctr_idx, gprs_ns2_inst::binding, gprs_ns2_bind_by_name(), INIT_LLIST_HEAD, gprs_ns2_vc_bind::list, llist_add_tail(), name, gprs_ns2_vc_bind::name, nsbind_statg_desc, gprs_ns2_vc_bind::nsi, gprs_ns2_vc_bind::nsvc, osmo_stat_item_group_alloc(), gprs_ns2_vc_bind::sns_data_weight, gprs_ns2_vc_bind::sns_sig_weight, and gprs_ns2_vc_bind::statg.

Referenced by gprs_ns2_fr_bind(), gprs_ns2_frgre_bind(), and gprs_ns2_ip_bind().

## ◆ ns2_count_transfer_cap()

int ns2_count_transfer_cap | ( | struct gprs_ns2_nse * | nse,
|  | uint16_t | bvci
| ) |  |

calculate the transfer capabilities for a nse

Parameters

  nse | the nse to count the transfer capability
  bvci | a bvci - unused

Returns
  the transfer capability in mbit. On error < 0.

References add_bind_array(), gprs_ns2_nse::alive, list, llist_for_each_entry, ns2_vc_is_unblocked(), gprs_ns2_nse::nsvc, gprs_ns2_vc_bind::nsvc, and gprs_ns2_vc_bind::transfer_capability.

Referenced by ns2_prim_status_ind().

## ◆ ns2_create_vc()

enum ns2_cs ns2_create_vc | ( | struct gprs_ns2_vc_bind * | bind,
|  | struct msgb * | msg,
|  | const struct osmo_sockaddr * | remote,
|  | const char * | logname,
|  | struct msgb ** | reject,
|  | struct gprs_ns2_vc ** | success
| ) |  |

Create a new NS-VC based on a [received] message.

Depending on the bind it might create a NSE.

Parameters

  [in] | bind | the bind through which msg was received
  [in] | msg | the actual received message
  [in] | remote | address of remote peer sending message
  [in] | logname | A name to describe the VC. E.g. ip address pair
  [out] | reject | A message filled to be sent back. Only used in failure cases.
  [out] | success | A pointer which will be set to the new VC on success

Returns
  enum value indicating the status, e.g. GPRS_NS2_CS_CREATED

References gprs_ns2_vc_bind::accept_ipaccess, gprs_ns_hdr::data, DLNS, gprs_ns2_create_nse(), GPRS_NS2_DIALECT_IPACCESS, gprs_ns2_free_nsvc(), gprs_ns2_ip_bind_sockaddr(), GPRS_NS2_LL_UDP, gprs_ns2_lltype_str(), gprs_ns2_nse_by_nsei(), gprs_ns2_nsvc_by_nsvci(), if(), gprs_ns2_vc_bind::ll, LOGL_ERROR, LOGL_INFO, LOGNSE, LOGNSVC, LOGP, msg, msgb_l2len(), ns2_create_vc_sns(), NS2_CS_CREATED, NS2_CS_ERROR, NS2_CS_REJECTED, NS2_CS_SKIPPED, ns2_dialect_to_vc_mode(), ns2_tlv_parse(), ns2_vc_alloc(), NS_CAUSE_MISSING_ESSENT_IE, NS_CAUSE_PDU_INCOMP_PSTATE, NS_CAUSE_PROTO_ERR_UNSPEC, NS_IE_CAUSE, NS_IE_NSEI, NS_IE_VCI, NS_PDUT_ALIVE_ACK, NS_PDUT_RESET, NS_PDUT_RESET_ACK, NS_PDUT_STATUS, nsei, gprs_ns2_vc_bind::nsi, osmo_identifier_sanitize_buf(), osmo_sockaddr_to_str(), osmo_sockaddr_to_str_buf(), gprs_ns_hdr::pdu_type, reject_status_msg(), SNS_PDUT_SIZE, TLVP_PRES_LEN, and tlvp_val16be().

Referenced by handle_nsfrgre_read(), and handle_nsip_recvfrom().

## ◆ ns2_create_vc_sns()

static enum ns2_cs ns2_create_vc_sns | ( | struct gprs_ns2_vc_bind * | bind,
|  | const struct osmo_sockaddr * | remote,
|  | struct gprs_ns2_vc ** | success,
|  | uint16_t | nsei
| ) |  |
| static

References gprs_ns2_vc_bind::accept_sns, DLNS, gprs_ns2_create_nse2(), GPRS_NS2_DIALECT_SNS, gprs_ns2_lltype_str(), gprs_ns2_nse_by_nsei(), gprs_ns2_nsvc_by_sockaddr_bind(), gprs_ns2_sns_add_bind(), osmo_sockaddr_str::ip, gprs_ns2_nse::ll, gprs_ns2_vc_bind::ll, LOGL_ERROR, LOGNSE, LOGP, NS2_CS_CREATED, NS2_CS_ERROR, NS2_CS_SKIPPED, ns2_ip_bind_connect(), ns2_sns_add_sns_default_binds(), nsei, gprs_ns2_vc_bind::nsi, gprs_ns2_nse::nsvc, gprs_ns2_vc::nsvci_is_valid, OSMO_ASSERT, osmo_sockaddr_str_from_sockaddr(), osmo_sockaddr_str::port, osmo_sockaddr::sas, and osmo_sockaddr::u.

Referenced by ns2_create_vc().

## ◆ ns2_dialect_to_vc_mode()

enum gprs_ns2_vc_mode ns2_dialect_to_vc_mode | ( | enum gprs_ns2_dialect | dialect | ) |

References GPRS_NS2_DIALECT_IPACCESS, GPRS_NS2_DIALECT_SNS, GPRS_NS2_DIALECT_STATIC_ALIVE, GPRS_NS2_DIALECT_STATIC_RESETBLOCK, GPRS_NS2_VC_MODE_ALIVE, and GPRS_NS2_VC_MODE_BLOCKRESET.

Referenced by ns2_create_vc(), and ns2_ip_bind_connect().

## ◆ ns2_free_nsvcs()

void ns2_free_nsvcs | ( | struct gprs_ns2_nse * | nse | ) |

References gprs_ns2_free_nsvc(), list, llist_empty(), llist_first_entry, gprs_ns2_vc::nse, and gprs_ns2_nse::nsvc.

Referenced by gprs_ns2_free_nse(), gprs_ns2_free_nsvcs(), and ns2_sns_st_all_action_bss().

## ◆ ns2_load_sharing()

static struct gprs_ns2_vc * ns2_load_sharing | ( | struct gprs_ns2_nse * | nse,
|  | uint16_t | bvci,
|  | uint32_t | link_selector
| ) |  |
| static

References bvci, GPRS_NS2_LL_FR, GPRS_NS2_LL_UDP, gprs_ns2_nse::ll, ns2_load_sharing_modulo(), ns2_load_sharing_signal(), ns2_load_sharing_weight_modulo(), and gprs_ns2_vc::nse.

Referenced by gprs_ns2_recv_prim().

## ◆ ns2_load_sharing_first()

struct gprs_ns2_vc * ns2_load_sharing_first | ( | struct gprs_ns2_nse * | nse | ) |

References list, llist_for_each_entry, ns2_vc_is_unblocked(), gprs_ns2_vc::nse, and gprs_ns2_nse::nsvc.

## ◆ ns2_load_sharing_modulo()

static struct gprs_ns2_vc * ns2_load_sharing_modulo | ( | struct gprs_ns2_nse * | nse,
|  | uint16_t | bvci,
|  | uint32_t | load_selector
| ) |  |
| static

References bvci, list, llist_for_each_entry, ns2_vc_is_unblocked(), gprs_ns2_vc::nse, gprs_ns2_nse::nsvc, and gprs_ns2_nse::nsvc_count.

Referenced by ns2_load_sharing().

## ◆ ns2_load_sharing_signal()

static struct gprs_ns2_vc * ns2_load_sharing_signal | ( | struct gprs_ns2_nse * | nse | ) |
| static

References list, llist_for_each_entry, ns2_vc_is_unblocked(), gprs_ns2_vc::nse, and gprs_ns2_nse::nsvc.

Referenced by ns2_load_sharing().

## ◆ ns2_load_sharing_weight_modulo()

static struct gprs_ns2_vc * ns2_load_sharing_weight_modulo | ( | struct gprs_ns2_nse * | nse,
|  | uint16_t | bvci,
|  | uint32_t | load_selector
| ) |  |
| static

References bvci, data_weight, gprs_ns2_vc::data_weight, list, llist_for_each_entry, ns2_vc_is_unblocked(), gprs_ns2_vc::nse, gprs_ns2_nse::nsvc, gprs_ns2_nse::nsvc_count, and gprs_ns2_nse::sum_data_weight.

Referenced by ns2_load_sharing().

## ◆ ns2_msgb_alloc()

struct msgb * ns2_msgb_alloc | ( | void |  | ) |

Allocate a message buffer for use with the NS2 stack.

References DLNS, LOGL_ERROR, LOGP, msg, msgb_alloc_headroom(), NS_ALLOC_HEADROOM, and NS_ALLOC_SIZE.

Referenced by ns2_tx_block(), ns2_tx_block_ack(), ns2_tx_reset(), ns2_tx_reset_ack(), ns2_tx_simple(), ns2_tx_sns_ack(), ns2_tx_sns_config(), ns2_tx_sns_config_ack(), ns2_tx_sns_procedure(), ns2_tx_sns_size(), ns2_tx_sns_size_ack(), ns2_tx_status(), and reject_status_msg().

## ◆ ns2_nse_data_sum()

void ns2_nse_data_sum | ( | struct gprs_ns2_nse * | nse | ) |

References gprs_ns2_vc::data_weight, list, llist_for_each_entry, ns2_vc_is_unblocked(), gprs_ns2_vc::nse, gprs_ns2_nse::nsvc, gprs_ns2_nse::nsvc_count, gprs_ns2_vc::sig_weight, gprs_ns2_nse::sum_data_weight, and gprs_ns2_nse::sum_sig_weight.

Referenced by ns2_nse_notify_unblocked().

## ◆ ns2_nse_notify_unblocked()

void ns2_nse_notify_unblocked | ( | struct gprs_ns2_vc * | nsvc,
|  | bool | unblocked
| ) |  |

Notify a nse about the change of a NS-VC.

Parameters

  [in] | nsvc | NS-VC which has detected the change (and shall not be notified).
  [in] | unblocked | whether the NSE should be marked as unblocked (true) or blocked (false)

References GPRS_NS2_AFF_CAUSE_FAILURE, GPRS_NS2_AFF_CAUSE_RECOVERY, gprs_ns2_nse_by_nsei(), ns2_nse_data_sum(), ns2_prim_status_ind(), ns2_sns_notify_alive(), gprs_ns2_inst::nse, nsei, gprs_ns2_nse::nsvc, and osmo_clock_gettime().

Referenced by gprs_ns2_free_nsvc(), ns2_st_alive_onenter(), ns2_st_blocked_onenter(), ns2_st_reset_onenter(), ns2_st_unblocked_on_enter(), and ns2_st_unconfigured_onenter().

## ◆ ns2_nse_set_dialect()

int ns2_nse_set_dialect | ( | struct gprs_ns2_nse * | nse,
|  | enum gprs_ns2_dialect | dialect
| ) |  |

References gprs_ns2_nse::bss_sns_fi, gprs_ns2_nse::dialect, GPRS_NS2_DIALECT_SNS, GPRS_NS2_DIALECT_UNDEF, gprs_ns2_nse::ip_sns_role_sgsn, ns2_sns_bss_fsm_alloc(), ns2_sns_sgsn_fsm_alloc(), gprs_ns2_nse::nsei, osmo_fsm_inst_term, and OSMO_FSM_TERM_REQUEST.

Referenced by DEFUN(), gprs_ns2_create_nse2(), and ns_nse_nsvc_udp_cmds().

## ◆ ns2_nse_update_mtu()

void ns2_nse_update_mtu | ( | struct gprs_ns2_nse * | nse | ) |

References gprs_ns2_nse::alive, gprs_ns2_vc::bind, GPRS_NS2_AFF_CAUSE_MTU_CHANGE, list, llist_empty(), llist_for_each_entry, gprs_ns2_nse::mtu, gprs_ns2_vc_bind::mtu, ns2_prim_status_ind(), gprs_ns2_vc::nse, and gprs_ns2_nse::nsvc.

Referenced by gprs_n2_fr_mtu_chg_cb(), and ns2_vc_alloc().

## ◆ ns2_prim_status_ind()

void ns2_prim_status_ind | ( | struct gprs_ns2_nse * | nse,
|  | struct gprs_ns2_vc * | nsvc,
|  | uint16_t | bvci,
|  | enum gprs_ns2_affecting_cause | cause
| ) |  |

Send a STATUS.ind primitive to the specified NS instance user.

Parameters

  [in] | nsi | NS instance on which we operate
  [in] | nsei | NSEI to which the statue relates
  [in] | bvci | BVCI to which the status relates
  [in] | cause | The cause of the status

References bvci, osmo_gprs_ns2_prim::bvci, osmo_gprs_ns2_prim::cause, gprs_ns2_inst::cb, gprs_ns2_inst::cb_data, osmo_gprs_ns2_prim::first, gprs_ns2_nse::first, gprs_ns2_aff_cause_prim_str(), gprs_ns2_ll_str_buf(), GPRS_NS2_PRIM_STATUS, LOGL_NOTICE, LOGNSE, LOGNSVC, osmo_gprs_ns2_prim::mtu, gprs_ns2_nse::mtu, ns2_count_transfer_cap(), NS2_LL_MAX_STR, osmo_gprs_ns2_prim::nsei, gprs_ns2_nse::nsei, gprs_ns2_nse::nsi, osmo_gprs_ns2_prim::nsvc, osmo_gprs_ns2_prim::oph, osmo_prim_init(), osmo_gprs_ns2_prim::persistent, gprs_ns2_nse::persistent, PRIM_OP_INDICATION, SAP_NS, osmo_gprs_ns2_prim::status, osmo_gprs_ns2_prim::transfer, and osmo_gprs_ns2_prim::u.

Referenced by gprs_ns2_free_nse(), gprs_ns2_free_nsvc(), ns2_nse_notify_unblocked(), ns2_nse_update_mtu(), ns2_sns_st_all_action_bss(), ns2_sns_st_bss_size_onenter(), ns2_sns_st_configured_onenter(), and ns2_st_unblocked_on_enter().

## ◆ ns2_recv_vc()

int ns2_recv_vc | ( | struct gprs_ns2_vc * | nsvc,
|  | struct msgb * | msg
| ) |  |

Bottom-side entry-point for received NS PDU from the driver/bind.

Parameters

  [in] | nsvc | NS-VC for which the message was received
  | msg | the received message. Ownership is transferred, caller must not free it!

Returns
  0 on success; negative on error

References msg.

Referenced by fr_dlci_rx_cb(), handle_nsfrgre_read(), and handle_nsip_recvfrom().

## ◆ ns2_tlv_parse()

static int ns2_tlv_parse | ( | struct tlv_parsed * | dec,
|  | const uint8_t * | buf,
|  | int | buf_len,
|  | uint8_t | lv_tag,
|  | uint8_t | lv_tag2
| ) |  |
| inline static

References ns_att_tlvdef1, ns_att_tlvdef2, and tlv_parse().

Referenced by ns2_create_vc().

## ◆ ns2_vc_alloc()

struct gprs_ns2_vc * ns2_vc_alloc | ( | struct gprs_ns2_vc_bind * | bind,
|  | struct gprs_ns2_nse * | nse,
|  | bool | initiater,
|  | enum gprs_ns2_vc_mode | vc_mode,
|  | const char * | id
| ) |  |

Allocate a NS-VC within the given bind + NSE.

Parameters

  [in] | bind | The 'bind' on which we operate
  [in] | nse | The NS Entity on which we operate
  [in] | initiater | - if this is an incoming remote (!initiater) or a local outgoing connection (initater)
  [in] | id | - human-readable identifier

Returns
  newly allocated NS-VC on success; NULL on error

References gprs_ns2_vc::bind, gprs_ns2_vc::blist, gprs_ns2_vc::ctrg, gprs_ns2_vc::data_weight, gprs_ns2_vc::list, gprs_ns2_nse::ll, gprs_ns2_vc_bind::ll, llist_add_tail(), gprs_ns2_vc::mode, ns2_nse_update_mtu(), ns2_vc_fsm_alloc(), gprs_ns2_vc::nse, gprs_ns2_vc_bind::nsi, gprs_ns2_nse::nsvc, gprs_ns2_vc_bind::nsvc, nsvc_ctrg_desc, gprs_ns2_inst::nsvc_rate_ctr_idx, nsvc_statg_desc, OSMO_ASSERT, osmo_clock_gettime(), osmo_stat_item_group_alloc(), osmo_stat_item_group_free(), osmo_stat_item_group_set_name(), rate_ctr_group_alloc(), rate_ctr_group_free(), rate_ctr_group_set_name(), gprs_ns2_vc::sig_weight, gprs_ns2_vc::statg, and gprs_ns2_vc::ts_alive_change.

Referenced by gprs_ns2_fr_connect(), ns2_create_vc(), and ns2_ip_bind_connect().

## ◆ ns_is_sns()

static bool ns_is_sns | ( | uint8_t | pdu_type | ) |
| static

References pdu_type, SNS_PDUT_ACK, SNS_PDUT_ADD, SNS_PDUT_CHANGE_WEIGHT, SNS_PDUT_CONFIG, SNS_PDUT_CONFIG_ACK, SNS_PDUT_DELETE, SNS_PDUT_SIZE, and SNS_PDUT_SIZE_ACK.

Referenced by gprs_ns_process_msg(), and gprs_ns_tx().

## ◆ ns_osmo_signal_dispatch()

static void ns_osmo_signal_dispatch | ( | struct gprs_nsvc * | nsvc,
|  | unsigned int | signal,
|  | uint8_t | cause
| ) |  |
| static

References ns_signal_data::cause, ns_signal_data::nsvc, osmo_signal_dispatch(), and SS_L_NS.

Referenced by gprs_ns_process_msg(), gprs_ns_rx_block(), gprs_ns_rx_reset(), and gprs_ns_timer_cb().

## ◆ ns_osmo_signal_dispatch_mismatch()

static void ns_osmo_signal_dispatch_mismatch | ( | struct gprs_nsvc * | nsvc,
|  | struct msgb * | msg,
|  | uint8_t | pdu_type,
|  | uint8_t | ie_type
| ) |  |
| static

References ns_signal_data::ie_type, ns_signal_data::msg, ns_signal_data::nsvc, osmo_signal_dispatch(), ns_signal_data::pdu_type, pdu_type, S_NS_MISMATCH, and SS_L_NS.

Referenced by gprs_ns_rx_reset(), and gprs_ns_rx_reset_ack().

## ◆ ns_osmo_signal_dispatch_replaced()

static void ns_osmo_signal_dispatch_replaced | ( | struct gprs_nsvc * | nsvc,
|  | struct gprs_nsvc * | old_nsvc
| ) |  |
| static

References ns_signal_data::nsvc, ns_signal_data::old_nsvc, osmo_signal_dispatch(), S_NS_REPLACED, and SS_L_NS.

Referenced by gprs_ns_rx_reset(), and gprs_ns_rx_reset_ack().

## ◆ ns_set_state_with_log()

static void ns_set_state_with_log | ( | struct gprs_nsvc * | nsvc,
|  | uint32_t | state,
|  | bool | is_remote,
|  | const char * | file,
|  | unsigned | line
| ) |  |
| inline static

References DNS, file(), LOGL_DEBUG, LOGPSRC, NS_DESC_A, NS_DESC_B, NS_DESC_R, gprs_nsvc::nsei, gprs_nsvc::nsvci, gprs_nsvc::remote_state, and gprs_nsvc::state.

## ◆ nsip_fd_cb()

static int nsip_fd_cb | ( | struct osmo_fd * | bfd,
|  | unsigned int | what
| ) |  |
| static

References handle_nsip_read(), handle_nsip_write(), OSMO_FD_READ, and OSMO_FD_WRITE.

Referenced by gprs_ns_nsip_listen().

## ◆ nsip_sendmsg()

static int nsip_sendmsg | ( | struct gprs_nsvc * | nsvc,
|  | struct msgb * | msg
| ) |  |
| static

References gprs_nsvc::bts_addr, osmo_fd::fd, gprs_ns_inst::fd, gprs_nsvc::ip, msg, msgb_free(), gprs_nsvc::nsi, and gprs_ns_inst::nsip.

Referenced by gprs_ns_tx().

## ◆ nsvc_is_not_used()

static bool nsvc_is_not_used | ( | const struct gprs_nsvc * | nsvc | ) |
| static

References gprs_nsvc::data_weight, and gprs_nsvc::sig_weight.

Referenced by gprs_ns_process_msg(), gprs_ns_tx(), and gprs_nsvc_start_test().

## ◆ nsvc_start_timer()

static void nsvc_start_timer | ( | struct gprs_nsvc * | nsvc,
|  | enum nsvc_timer_mode | mode
| ) |  |
| static

References DEBUGP, DNS, get_value_string(), LOG_CTX_GB_NSVC, log_set_context(), mode, gprs_nsvc::nsei, gprs_nsvc::nsi, osmo_gettimeofday(), osmo_timer_del(), osmo_timer_schedule(), gprs_ns_inst::timeout, gprs_nsvc::timer, gprs_nsvc::timer_mode, timer_mode_strs, timer_mode_tout, and gprs_nsvc::timer_started.

Referenced by gprs_ns_process_msg(), gprs_ns_timer_cb(), gprs_nsvc_reset(), and gprs_nsvc_start_test().

## ◆ nsvc_timer_elapsed_ms()

static int nsvc_timer_elapsed_ms | ( | struct gprs_nsvc * | nsvc | ) |
| static

References osmo_gettimeofday(), gprs_nsvc::timer_started, and timersub.

Referenced by gprs_ns_process_msg().

## ◆ read_nsip_msg()

static struct msgb * read_nsip_msg | ( | struct osmo_fd * | bfd,
|  | int * | error,
|  | struct sockaddr_in * | saddr
| ) |  |
| static

References DNS, osmo_fd::fd, gprs_ns_msgb_alloc(), LOGL_ERROR, LOGP, msg, msgb_free(), msgb_put(), NS_ALLOC_HEADROOM, NS_ALLOC_SIZE, and osmo_sock_get_name2().

Referenced by handle_nsip_read().

## ◆ reject_status_msg()

static int reject_status_msg | ( | struct msgb * | orig_msg,
|  | struct tlv_parsed * | tp,
|  | struct msgb ** | reject,
|  | enum ns_cause | cause
| ) |  |
| static

Create a status message to be sent over a new connection.

Parameters

  [in] | orig_msg | the original message
  [in] | tp | TLVP parsed of the original message
  [out] | reject | callee-allocated message buffer of the generated NS-STATUS
  [in] | cause | Cause for the rejection

Returns
  0 on success

References cause, DLNS, gprs_ns2_cause_str(), msgb::l2h, LOGL_NOTICE, LOGP, msg, msgb_free(), msgb_l2len(), msgb_put(), msgb_tvlv_put(), ns2_msgb_alloc(), NS_CAUSE_INVAL_ESSENT_IE, NS_CAUSE_MISSING_ESSENT_IE, NS_CAUSE_NSVC_BLOCKED, NS_CAUSE_NSVC_UNKNOWN, NS_CAUSE_PDU_INCOMP_PSTATE, NS_CAUSE_PROTO_ERR_UNSPEC, NS_CAUSE_SEM_INCORR_PDU, NS_IE_CAUSE, NS_IE_NSEI, NS_IE_PDU, NS_IE_VCI, NS_PDUT_STATUS, nsei, gprs_ns_hdr::pdu_type, TLVP_PRES_LEN, TLVP_VAL, and tlvp_val16be().

Referenced by ns2_create_vc().

## Variable Documentation

## ◆ __attribute__

enum ns_pdu_type __attribute__

## ◆ data [1/2]

uint8_t data[0]

variable-length payload

Referenced by alive_timeout_handler(), bssgp_bvc_fsm_allstate(), bssgp_bvc_fsm_blocked(), bssgp_bvc_fsm_unblocked(), bssgp_bvc_fsm_wait_reset_ack(), bssgp_set_bssgp_callback(), DEFUN(), fc_timer_cb(), fr_backlog_timer_cb(), fr_t391_cb(), fr_t392_cb(), fr_tx_cb(), gprs_ns2_ip_bind_set_sns_weight(), gprs_ns_timer_cb(), gprs_sns_st_config_bss(), gprs_sns_st_config_sgsn(), gprs_sns_st_configured(), gprs_sns_st_size(), ns2_sns_st_all_action(), ns2_sns_st_all_action_bss(), ns2_sns_st_all_action_sgsn(), ns2_sns_st_bss_config_bss(), ns2_sns_st_bss_config_sgsn(), ns2_sns_st_bss_size(), ns2_sns_st_configured(), ns2_sns_st_local_procedure(), ns2_sns_st_sgsn_wait_config(), ns2_sns_st_sgsn_wait_config_ack(), and ns2_vc_fsm_allstate_action().

## ◆ data [2/2]

uint8_t gprs_ns_hdr::data[0]

variable-length payload

Referenced by gprs_ns_process_msg(), gprs_ns_rx_block(), gprs_ns_rx_reset(), gprs_ns_rx_reset_ack(), gprs_ns_rx_sns(), gprs_ns_rx_status(), gprs_ns_rx_unitdata(), gprs_ns_sendmsg(), gprs_ns_vc_create(), ns2_create_vc(), ns2_sns_rx(), and ns2_tx_unit_data().

## ◆ data_weight [1/3]

uint8_t data_weight

Referenced by DEFUN(), gprs_nsvc_create2(), ip46_weight_sum(), ip4_weight_sum(), ip6_weight_sum(), ns2_load_sharing_weight_modulo(), ns2_vc_create_ip(), and ns_nse_nsvc_udp_cmds().

## ◆ data_weight [2/3]

uint8_t gprs_ns_ie_ip4_elem::data_weight

Referenced by create_missing_nsvcs(), create_nsvc_for_new_sbind(), do_sns_change_weight(), gprs_nsvc_create_ip4(), gprs_sns_bss_fsm_alloc(), ip4_weight_sum(), ns2_add_procedure(), ns2_nsvc_create_ip4(), ns2_sns_add_elements(), ns2_sns_st_local_procedure(), ns2_update_weight_entry(), remove_bind_elem(), update_ip4_elem(), update_remote_ip4_elem(), and vty_dump_sns_ip4().

## ◆ data_weight [3/3]

uint8_t gprs_ns_ie_ip6_elem::data_weight

Referenced by create_missing_nsvcs(), create_nsvc_for_new_sbind(), do_sns_change_weight(), ip6_weight_sum(), ns2_add_procedure(), ns2_nsvc_create_ip6(), ns2_sns_add_elements(), ns2_sns_st_local_procedure(), ns2_update_weight_entry(), remove_bind_elem(), update_ip6_elem(), and vty_dump_sns_ip6().

## ◆ gprs_ns2_aff_cause_prim_strs

const struct value_string gprs_ns2_aff_cause_prim_strs[]

Initial value:
= {
{ GPRS_NS2_AFF_CAUSE_VC_FAILURE, "NSVC failure" },
{ GPRS_NS2_AFF_CAUSE_VC_RECOVERY, "NSVC recovery" },
{ GPRS_NS2_AFF_CAUSE_FAILURE, "NSE failure" },
{ GPRS_NS2_AFF_CAUSE_RECOVERY, "NSE recovery" },
{ GPRS_NS2_AFF_CAUSE_SNS_CONFIGURED, "NSE SNS configured" },
{ GPRS_NS2_AFF_CAUSE_SNS_FAILURE, "NSE SNS failure" },
{ GPRS_NS2_AFF_CAUSE_SNS_NO_ENDPOINTS, "NSE SNS no endpoints"},
{ GPRS_NS2_AFF_CAUSE_MTU_CHANGE, "NSE MTU changed" },
{ 0, NULL }
}
GPRS_NS2_AFF_CAUSE_FAILURE
@ GPRS_NS2_AFF_CAUSE_FAILURE
Definition: gprs_ns2.h:81
GPRS_NS2_AFF_CAUSE_VC_FAILURE
@ GPRS_NS2_AFF_CAUSE_VC_FAILURE
Definition: gprs_ns2.h:79
GPRS_NS2_AFF_CAUSE_MTU_CHANGE
@ GPRS_NS2_AFF_CAUSE_MTU_CHANGE
Definition: gprs_ns2.h:87
GPRS_NS2_AFF_CAUSE_VC_RECOVERY
@ GPRS_NS2_AFF_CAUSE_VC_RECOVERY
Definition: gprs_ns2.h:80
GPRS_NS2_AFF_CAUSE_RECOVERY
@ GPRS_NS2_AFF_CAUSE_RECOVERY
Definition: gprs_ns2.h:82
GPRS_NS2_AFF_CAUSE_SNS_FAILURE
@ GPRS_NS2_AFF_CAUSE_SNS_FAILURE
Definition: gprs_ns2.h:85
GPRS_NS2_AFF_CAUSE_SNS_CONFIGURED
@ GPRS_NS2_AFF_CAUSE_SNS_CONFIGURED
Definition: gprs_ns2.h:84
GPRS_NS2_AFF_CAUSE_SNS_NO_ENDPOINTS
@ GPRS_NS2_AFF_CAUSE_SNS_NO_ENDPOINTS
Definition: gprs_ns2.h:86

Referenced by gprs_ns2_aff_cause_prim_str().

## ◆ gprs_ns2_cause_strs

const struct value_string gprs_ns2_cause_strs[]

Initial value:
= {
{ NS_CAUSE_TRANSIT_FAIL, "Transit network failure" },
{ NS_CAUSE_OM_INTERVENTION, "O&M intervention" },
{ NS_CAUSE_EQUIP_FAIL, "Equipment failure" },
{ NS_CAUSE_NSVC_BLOCKED, "NS-VC blocked" },
{ NS_CAUSE_NSVC_UNKNOWN, "NS-VC unknown" },
{ NS_CAUSE_BVCI_UNKNOWN, "BVCI unknown" },
{ NS_CAUSE_SEM_INCORR_PDU, "Semantically incorrect PDU" },
{ NS_CAUSE_PDU_INCOMP_PSTATE, "PDU not compatible with protocol state" },
{ NS_CAUSE_PROTO_ERR_UNSPEC, "Protocol error, unspecified" },
{ NS_CAUSE_INVAL_ESSENT_IE, "Invalid essential IE" },
{ NS_CAUSE_MISSING_ESSENT_IE, "Missing essential IE" },
{ NS_CAUSE_INVAL_NR_IPv4_EP, "Invalid Number of IPv4 Endpoints" },
{ NS_CAUSE_INVAL_NR_IPv6_EP, "Invalid Number of IPv6 Endpoints" },
{ NS_CAUSE_INVAL_NR_NS_VC, "Invalid Number of NS-VCs" },
{ NS_CAUSE_INVAL_WEIGH, "Invalid Weights" },
{ NS_CAUSE_UNKN_IP_EP, "Unknown IP Endpoint" },
{ NS_CAUSE_UNKN_IP_ADDR, "Unknown IP Address" },
{ NS_CAUSE_UNKN_IP_TEST_FAILED, "IP Test Failed" },
{ 0, NULL }
}
NS_CAUSE_INVAL_NR_NS_VC
@ NS_CAUSE_INVAL_NR_NS_VC
Definition: gsm_08_16.h:98
NS_CAUSE_BVCI_UNKNOWN
@ NS_CAUSE_BVCI_UNKNOWN
Definition: gsm_08_16.h:89
NS_CAUSE_INVAL_ESSENT_IE
@ NS_CAUSE_INVAL_ESSENT_IE
Definition: gsm_08_16.h:93
NS_CAUSE_UNKN_IP_TEST_FAILED
@ NS_CAUSE_UNKN_IP_TEST_FAILED
Definition: gsm_08_16.h:102
NS_CAUSE_PROTO_ERR_UNSPEC
@ NS_CAUSE_PROTO_ERR_UNSPEC
Definition: gsm_08_16.h:92
NS_CAUSE_INVAL_NR_IPv4_EP
@ NS_CAUSE_INVAL_NR_IPv4_EP
Definition: gsm_08_16.h:96
NS_CAUSE_PDU_INCOMP_PSTATE
@ NS_CAUSE_PDU_INCOMP_PSTATE
Definition: gsm_08_16.h:91
NS_CAUSE_SEM_INCORR_PDU
@ NS_CAUSE_SEM_INCORR_PDU
Definition: gsm_08_16.h:90
NS_CAUSE_UNKN_IP_ADDR
@ NS_CAUSE_UNKN_IP_ADDR
Definition: gsm_08_16.h:101
NS_CAUSE_INVAL_NR_IPv6_EP
@ NS_CAUSE_INVAL_NR_IPv6_EP
Definition: gsm_08_16.h:97
NS_CAUSE_EQUIP_FAIL
@ NS_CAUSE_EQUIP_FAIL
Definition: gsm_08_16.h:86
NS_CAUSE_INVAL_WEIGH
@ NS_CAUSE_INVAL_WEIGH
Definition: gsm_08_16.h:99
NS_CAUSE_MISSING_ESSENT_IE
@ NS_CAUSE_MISSING_ESSENT_IE
Definition: gsm_08_16.h:94
NS_CAUSE_OM_INTERVENTION
@ NS_CAUSE_OM_INTERVENTION
Definition: gsm_08_16.h:85
NS_CAUSE_NSVC_BLOCKED
@ NS_CAUSE_NSVC_BLOCKED
Definition: gsm_08_16.h:87
NS_CAUSE_TRANSIT_FAIL
@ NS_CAUSE_TRANSIT_FAIL
Definition: gsm_08_16.h:84
NS_CAUSE_UNKN_IP_EP
@ NS_CAUSE_UNKN_IP_EP
Definition: gsm_08_16.h:100
NS_CAUSE_NSVC_UNKNOWN
@ NS_CAUSE_NSVC_UNKNOWN
Definition: gsm_08_16.h:88

Referenced by gprs_ns2_cause_str().

## ◆ gprs_ns2_lltype_strs

const struct value_string gprs_ns2_lltype_strs[]

Initial value:
= {
{ GPRS_NS2_LL_UDP, "UDP" },
{ GPRS_NS2_LL_FR_GRE, "FR_GRE" },
{ GPRS_NS2_LL_FR, "FR" },
{ 0, NULL }
}
GPRS_NS2_LL_FR
@ GPRS_NS2_LL_FR
NS/FR.
Definition: gprs_ns2.h:47
GPRS_NS2_LL_FR_GRE
@ GPRS_NS2_LL_FR_GRE
NS/FR/GRE/IP.
Definition: gprs_ns2.h:48
GPRS_NS2_LL_UDP
@ GPRS_NS2_LL_UDP
NS/UDP/IP.
Definition: gprs_ns2.h:46

Referenced by gprs_ns2_lltype_str().

## ◆ gprs_ns2_prim_strs

const struct value_string gprs_ns2_prim_strs[]

Initial value:
= {
{ GPRS_NS2_PRIM_UNIT_DATA, "UNIT DATA" },
{ GPRS_NS2_PRIM_CONGESTION, "CONGESTION" },
{ GPRS_NS2_PRIM_STATUS, "STATUS" },
{ 0, NULL }
}
GPRS_NS2_PRIM_CONGESTION
@ GPRS_NS2_PRIM_CONGESTION
Definition: gprs_ns2.h:54
GPRS_NS2_PRIM_STATUS
@ GPRS_NS2_PRIM_STATUS
Definition: gprs_ns2.h:55
GPRS_NS2_PRIM_UNIT_DATA
@ GPRS_NS2_PRIM_UNIT_DATA
Definition: gprs_ns2.h:53

Referenced by gprs_ns2_prim_str().

## ◆ gprs_ns_pdu_strings [1/2]

const struct value_string gprs_ns_pdu_strings[]
| extern

Referenced by gprs_ns_process_msg(), gprs_ns_rx_sns(), gprs_ns_tx(), gprs_ns_vc_create(), ns2_sns_rx(), and ns2_vc_rx().

## ◆ gprs_ns_pdu_strings [2/2]

const struct value_string gprs_ns_pdu_strings[]

Initial value:
= {
{ NS_PDUT_UNITDATA, "NS-UNITDATA" },
{ NS_PDUT_RESET, "NS-RESET" },
{ NS_PDUT_RESET_ACK, "NS-RESET-ACK" },
{ NS_PDUT_BLOCK, "NS-BLOCK" },
{ NS_PDUT_BLOCK_ACK, "NS-BLOCK-ACK" },
{ NS_PDUT_UNBLOCK, "NS-UNBLOCK" },
{ NS_PDUT_UNBLOCK_ACK, "NS-UNBLOCK-ACK" },
{ NS_PDUT_STATUS, "NS-STATUS" },
{ NS_PDUT_ALIVE, "NS-ALIVE" },
{ NS_PDUT_ALIVE_ACK, "NS-ALIVE-ACK" },
{ SNS_PDUT_ACK, "SNS-ACK" },
{ SNS_PDUT_ADD, "SNS-ADD" },
{ SNS_PDUT_CHANGE_WEIGHT, "SNS-CHANGEWEIGHT" },
{ SNS_PDUT_CONFIG, "SNS-CONFIG" },
{ SNS_PDUT_CONFIG_ACK, "SNS-CONFIG-ACK" },
{ SNS_PDUT_DELETE, "SNS-DELETE" },
{ SNS_PDUT_SIZE, "SNS-SIZE" },
{ SNS_PDUT_SIZE_ACK, "SNS-SIZE-ACK" },
{ 0, NULL }
}
NS_PDUT_BLOCK_ACK
@ NS_PDUT_BLOCK_ACK
Definition: gsm_08_16.h:47
NS_PDUT_RESET_ACK
@ NS_PDUT_RESET_ACK
Definition: gsm_08_16.h:45
NS_PDUT_UNBLOCK_ACK
@ NS_PDUT_UNBLOCK_ACK
Definition: gsm_08_16.h:49
NS_PDUT_RESET
@ NS_PDUT_RESET
Definition: gsm_08_16.h:44
NS_PDUT_UNBLOCK
@ NS_PDUT_UNBLOCK
Definition: gsm_08_16.h:48
SNS_PDUT_CHANGE_WEIGHT
@ SNS_PDUT_CHANGE_WEIGHT
Definition: gsm_08_16.h:56
SNS_PDUT_CONFIG
@ SNS_PDUT_CONFIG
Definition: gsm_08_16.h:57
SNS_PDUT_ADD
@ SNS_PDUT_ADD
Definition: gsm_08_16.h:55
NS_PDUT_STATUS
@ NS_PDUT_STATUS
Definition: gsm_08_16.h:50
NS_PDUT_ALIVE_ACK
@ NS_PDUT_ALIVE_ACK
Definition: gsm_08_16.h:52
SNS_PDUT_CONFIG_ACK
@ SNS_PDUT_CONFIG_ACK
Definition: gsm_08_16.h:58
SNS_PDUT_SIZE
@ SNS_PDUT_SIZE
Definition: gsm_08_16.h:60
NS_PDUT_UNITDATA
@ NS_PDUT_UNITDATA
Definition: gsm_08_16.h:43
SNS_PDUT_SIZE_ACK
@ SNS_PDUT_SIZE_ACK
Definition: gsm_08_16.h:61
NS_PDUT_BLOCK
@ NS_PDUT_BLOCK
Definition: gsm_08_16.h:46
SNS_PDUT_ACK
@ SNS_PDUT_ACK
Definition: gsm_08_16.h:54
SNS_PDUT_DELETE
@ SNS_PDUT_DELETE
Definition: gsm_08_16.h:59
NS_PDUT_ALIVE
@ NS_PDUT_ALIVE
Definition: gsm_08_16.h:51

Referenced by gprs_ns_process_msg(), gprs_ns_rx_sns(), gprs_ns_tx(), gprs_ns_vc_create(), ns2_sns_rx(), and ns2_vc_rx().

## ◆ gprs_ns_signal_ns_names

const struct value_string gprs_ns_signal_ns_names[]

Initial value:
= {
{ S_NS_RESET, "NS-RESET" },
{ S_NS_BLOCK, "NS-BLOCK" },
{ S_NS_UNBLOCK, "NS-UNBLOCK" },
{ S_NS_ALIVE_EXP, "NS-ALIVE expired" },
{ S_NS_REPLACED, "NSVC replaced" },
{ S_NS_MISMATCH, "Unexpected IE" },
{ S_SNS_CONFIGURED, "SNS Configured" },
{ 0, NULL }
}
S_SNS_CONFIGURED
@ S_SNS_CONFIGURED
Definition: gprs_ns.h:239
S_NS_MISMATCH
@ S_NS_MISMATCH
Definition: gprs_ns.h:238
S_NS_UNBLOCK
@ S_NS_UNBLOCK
Definition: gprs_ns.h:235
S_NS_ALIVE_EXP
@ S_NS_ALIVE_EXP
Definition: gprs_ns.h:236
S_NS_RESET
@ S_NS_RESET
Definition: gprs_ns.h:233
S_NS_BLOCK
@ S_NS_BLOCK
Definition: gprs_ns.h:234
S_NS_REPLACED
@ S_NS_REPLACED
Definition: gprs_ns.h:237

## ◆ gprs_sns_fsm_registered

bool gprs_sns_fsm_registered = false
| static

Referenced by gprs_ns_instantiate().

## ◆ ip_addr [1/3]

struct in6_addr ip_addr

Referenced by gprs_sns_st_configured(), ns2_sns_st_configured_delete(), and vty_dump_sns_ip6().

## ◆ ip_addr [2/3]

uint32_t gprs_ns_ie_ip4_elem::ip_addr

Referenced by add_ip4_elem(), create_missing_nsvcs(), create_nsvc_for_new_sbind(), do_sns_change_weight(), do_sns_delete(), gprs_nsvc_create_ip4(), gprs_sns_bss_fsm_alloc(), ns2_add_procedure(), ns2_get_sbind_ip4_entry(), ns2_nsvc_create_ip4(), ns2_sns_add_elements(), ns2_sns_st_local_procedure(), nsvc_by_ip4_elem(), remove_bind_elem(), remove_ip4_elem(), update_ip4_elem(), update_remote_ip4_elem(), and vty_dump_sns_ip4().

## ◆ ip_addr [3/3]

struct in6_addr gprs_ns_ie_ip6_elem::ip_addr

Referenced by add_ip6_elem(), create_missing_nsvcs(), create_nsvc_for_new_sbind(), do_sns_change_weight(), do_sns_delete(), ns2_add_procedure(), ns2_get_sbind_ip6_entry(), ns2_nsvc_create_ip6(), ns2_sns_add_elements(), ns2_sns_st_local_procedure(), nsvc_by_ip6_elem(), remove_bind_elem(), remove_ip6_elem(), update_ip6_elem(), and vty_dump_sns_ip6().

## ◆ ns_att_tlvdef

const struct tlv_definition ns_att_tlvdef
| static

Initial value:
= {
.def = {
[NS_IE_CAUSE] = { TLV_TYPE_TvLV, 0 },
[NS_IE_VCI] = { TLV_TYPE_TvLV, 0 },
[NS_IE_PDU] = { TLV_TYPE_TvLV, 0 },
[NS_IE_BVCI] = { TLV_TYPE_TvLV, 0 },
[NS_IE_NSEI] = { TLV_TYPE_TvLV, 0 },
[NS_IE_IPv4_LIST] = { TLV_TYPE_TvLV, 0 },
[NS_IE_IPv6_LIST] = { TLV_TYPE_TvLV, 0 },
[NS_IE_MAX_NR_NSVC] = { TLV_TYPE_FIXED, 2 },
[NS_IE_IPv4_EP_NR] = { TLV_TYPE_FIXED, 2 },
[NS_IE_IPv6_EP_NR] = { TLV_TYPE_FIXED, 2 },
[NS_IE_RESET_FLAG] = { TLV_TYPE_TV, 0 },
[NS_IE_IP_ADDR] = { TLV_TYPE_FIXED, 5 },
},
}
NS_IE_IPv6_EP_NR
@ NS_IE_IPv6_EP_NR
Definition: gsm_08_16.h:76
NS_IE_IPv4_LIST
@ NS_IE_IPv4_LIST
Definition: gsm_08_16.h:72
NS_IE_VCI
@ NS_IE_VCI
Definition: gsm_08_16.h:67
NS_IE_IPv4_EP_NR
@ NS_IE_IPv4_EP_NR
Definition: gsm_08_16.h:75
NS_IE_IP_ADDR
@ NS_IE_IP_ADDR
Definition: gsm_08_16.h:78
NS_IE_NSEI
@ NS_IE_NSEI
Definition: gsm_08_16.h:70
NS_IE_MAX_NR_NSVC
@ NS_IE_MAX_NR_NSVC
Definition: gsm_08_16.h:74
NS_IE_IPv6_LIST
@ NS_IE_IPv6_LIST
Definition: gsm_08_16.h:73
NS_IE_BVCI
@ NS_IE_BVCI
Definition: gsm_08_16.h:69
NS_IE_CAUSE
@ NS_IE_CAUSE
Definition: gsm_08_16.h:66
NS_IE_PDU
@ NS_IE_PDU
Definition: gsm_08_16.h:68
NS_IE_RESET_FLAG
@ NS_IE_RESET_FLAG
Definition: gsm_08_16.h:77
TLV_TYPE_TV
TLV_TYPE_TV
TLV_TYPE_FIXED
TLV_TYPE_FIXED
TLV_TYPE_TvLV
TLV_TYPE_TvLV

Referenced by gprs_ns_process_msg(), gprs_ns_rx_block(), gprs_ns_rx_reset(), gprs_ns_rx_reset_ack(), gprs_ns_rx_status(), and gprs_ns_vc_create().

## ◆ ns_att_tlvdef1

const struct tlv_definition ns_att_tlvdef1
| static

Initial value:
= {
.def = {
[NS_IE_CAUSE] = { TLV_TYPE_TvLV, 0 },
[NS_IE_VCI] = { TLV_TYPE_TvLV, 0 },
[NS_IE_PDU] = { TLV_TYPE_TvLV, 0 },
[NS_IE_BVCI] = { TLV_TYPE_TvLV, 0 },
[NS_IE_NSEI] = { TLV_TYPE_TvLV, 0 },
[NS_IE_IPv4_LIST] = { TLV_TYPE_TvLV, 0 },
[NS_IE_IPv6_LIST] = { TLV_TYPE_TvLV, 0 },
[NS_IE_MAX_NR_NSVC] = { TLV_TYPE_FIXED, 2 },
[NS_IE_IPv4_EP_NR] = { TLV_TYPE_FIXED, 2 },
[NS_IE_IPv6_EP_NR] = { TLV_TYPE_FIXED, 2 },
[NS_IE_RESET_FLAG] = { TLV_TYPE_TV, 0 },
[NS_IE_IP_ADDR] = { TLV_TYPE_FIXED, 5 },
},
}

Referenced by ns2_tlv_parse().

## ◆ ns_att_tlvdef2

const struct tlv_definition ns_att_tlvdef2
| static

Initial value:
= {
.def = {
[NS_IE_CAUSE] = { TLV_TYPE_TvLV, 0 },
[NS_IE_VCI] = { TLV_TYPE_TvLV, 0 },
[NS_IE_PDU] = { TLV_TYPE_TvLV, 0 },
[NS_IE_BVCI] = { TLV_TYPE_TvLV, 0 },
[NS_IE_NSEI] = { TLV_TYPE_TvLV, 0 },
[NS_IE_IPv4_LIST] = { TLV_TYPE_TvLV, 0 },
[NS_IE_IPv6_LIST] = { TLV_TYPE_TvLV, 0 },
[NS_IE_MAX_NR_NSVC] = { TLV_TYPE_FIXED, 2 },
[NS_IE_IPv4_EP_NR] = { TLV_TYPE_FIXED, 2 },
[NS_IE_IPv6_EP_NR] = { TLV_TYPE_FIXED, 2 },
[NS_IE_RESET_FLAG] = { TLV_TYPE_TV, 0 },
[NS_IE_IP_ADDR] = { TLV_TYPE_FIXED, 17 },
},
}

Referenced by ns2_tlv_parse().

## ◆ ns_cause_str

const struct value_string ns_cause_str[]
| static

Initial value:
= {
{ NS_CAUSE_TRANSIT_FAIL, "Transit network failure" },
{ NS_CAUSE_OM_INTERVENTION, "O&M intervention" },
{ NS_CAUSE_EQUIP_FAIL, "Equipment failure" },
{ NS_CAUSE_NSVC_BLOCKED, "NS-VC blocked" },
{ NS_CAUSE_NSVC_UNKNOWN, "NS-VC unknown" },
{ NS_CAUSE_BVCI_UNKNOWN, "BVCI unknown" },
{ NS_CAUSE_SEM_INCORR_PDU, "Semantically incorrect PDU" },
{ NS_CAUSE_PDU_INCOMP_PSTATE, "PDU not compatible with protocol state" },
{ NS_CAUSE_PROTO_ERR_UNSPEC, "Protocol error, unspecified" },
{ NS_CAUSE_INVAL_ESSENT_IE, "Invalid essential IE" },
{ NS_CAUSE_MISSING_ESSENT_IE, "Missing essential IE" },
{ NS_CAUSE_INVAL_NR_IPv4_EP, "Invalid Number of IPv4 Endpoints" },
{ NS_CAUSE_INVAL_NR_IPv6_EP, "Invalid Number of IPv6 Endpoints" },
{ NS_CAUSE_INVAL_NR_NS_VC, "Invalid Number of NS-VCs" },
{ NS_CAUSE_INVAL_WEIGH, "Invalid Weights" },
{ NS_CAUSE_UNKN_IP_EP, "Unknown IP Endpoint" },
{ NS_CAUSE_UNKN_IP_ADDR, "Unknown IP Address" },
{ NS_CAUSE_UNKN_IP_TEST_FAILED, "IP Test Failed" },
{ 0, NULL }
}

Referenced by gprs_ns_cause_str().

## ◆ ns_ctr_description

const struct rate_ctr_desc ns_ctr_description[]
| static

Initial value:
= {
[NS_CTR_PKTS_IN] = { "packets:in", "Packets at NS Level ( In)" },
[NS_CTR_PKTS_OUT] = { "packets:out", "Packets at NS Level (Out)" },
[NS_CTR_PKTS_OUT_DROP] = { "packets:out:drop", "Dropped Packets (Out)" },
[NS_CTR_BYTES_IN] = { "bytes:in", "Bytes at NS Level ( In)" },
[NS_CTR_BYTES_OUT] = { "bytes:out", "Bytes at NS Level (Out)" },
[NS_CTR_BYTES_OUT_DROP] = { "bytes:out:drop", "Dropped Bytes (Out)" },
[NS_CTR_BLOCKED] = { "blocked", "NS-VC Block count " },
[NS_CTR_UNBLOCKED] = { "unblocked", "NS-VC Unblock count " },
[NS_CTR_DEAD] = { "dead", "NS-VC gone dead count " },
[NS_CTR_REPLACED] = { "replaced", "NS-VC replaced other count" },
[NS_CTR_NSEI_CHG] = { "nsei-chg", "NS-VC changed NSEI count " },
[NS_CTR_INV_VCI] = { "inv-nsvci", "NS-VCI was invalid count " },
[NS_CTR_INV_NSEI] = { "inv-nsei", "NSEI was invalid count " },
[NS_CTR_LOST_ALIVE] = { "lost:alive", "ALIVE ACK missing count " },
[NS_CTR_LOST_RESET] = { "lost:reset", "RESET ACK missing count " },
}
NS_CTR_LOST_RESET
@ NS_CTR_LOST_RESET
Definition: gprs_ns.c:140
NS_CTR_PKTS_OUT_DROP
@ NS_CTR_PKTS_OUT_DROP
Definition: gprs_ns2_internal.h:142
NS_CTR_PKTS_OUT
@ NS_CTR_PKTS_OUT
Definition: gprs_ns.c:130
NS_CTR_BYTES_OUT
@ NS_CTR_BYTES_OUT
Definition: gprs_ns.c:132
NS_CTR_BYTES_IN
@ NS_CTR_BYTES_IN
Definition: gprs_ns.c:131
NS_CTR_INV_NSEI
@ NS_CTR_INV_NSEI
Definition: gprs_ns.c:138
NS_CTR_LOST_ALIVE
@ NS_CTR_LOST_ALIVE
Definition: gprs_ns.c:139
NS_CTR_PKTS_IN
@ NS_CTR_PKTS_IN
Definition: gprs_ns.c:129
NS_CTR_UNBLOCKED
@ NS_CTR_UNBLOCKED
Definition: gprs_ns2_internal.h:147
NS_CTR_INV_VCI
@ NS_CTR_INV_VCI
Definition: gprs_ns.c:137
NS_CTR_DEAD
@ NS_CTR_DEAD
Definition: gprs_ns.c:134
NS_CTR_REPLACED
@ NS_CTR_REPLACED
Definition: gprs_ns.c:135
NS_CTR_BLOCKED
@ NS_CTR_BLOCKED
Definition: gprs_ns.c:133
NS_CTR_NSEI_CHG
@ NS_CTR_NSEI_CHG
Definition: gprs_ns.c:136
NS_CTR_BYTES_OUT_DROP
@ NS_CTR_BYTES_OUT_DROP
Definition: gprs_ns2_internal.h:145

## ◆ nsbind_stat_description

const struct osmo_stat_item_desc nsbind_stat_description[]

Initial value:
= {
[NS2_BIND_STAT_BACKLOG_LEN] = { "tx_backlog_length", "Transmit backlog length", "packets", 16, 0 },
}
NS2_BIND_STAT_BACKLOG_LEN
@ NS2_BIND_STAT_BACKLOG_LEN
Definition: gprs_ns2_internal.h:127

## ◆ nsbind_statg_desc

const struct osmo_stat_item_group_desc nsbind_statg_desc
| static

Initial value:
= {
.group_name_prefix = "ns.bind",
.group_description = "NS Bind Statistics",
.num_items = ARRAY_SIZE(nsbind_stat_description),
.item_desc = nsbind_stat_description,
.class_id = OSMO_STATS_CLASS_PEER,
}
nsbind_stat_description
const struct osmo_stat_item_desc nsbind_stat_description[]
Definition: gprs_ns2.c:209
OSMO_STATS_CLASS_PEER
OSMO_STATS_CLASS_PEER
ARRAY_SIZE
#define ARRAY_SIZE(x)

Referenced by ns2_bind_alloc().

## ◆ nse_ctrg_desc

const struct rate_ctr_group_desc nse_ctrg_desc
| static

Initial value:
= {
.group_name_prefix = "ns:nse",
.group_description = "NSE Peer Statistics",
.num_ctr = ARRAY_SIZE(ns_ctr_description),
.ctr_desc = ns_ctr_description,
.class_id = OSMO_STATS_CLASS_PEER,
}
ns_ctr_description
static const struct rate_ctr_desc ns_ctr_description[]
Definition: gprs_ns2.c:162

Referenced by gprs_ns2_create_nse2().

## ◆ nsvc_ctr_description

const struct rate_ctr_desc nsvc_ctr_description[]
| static

Initial value:
= {
{ "packets:in", "Packets at NS Level ( In)" },
{ "packets:out","Packets at NS Level (Out)" },
{ "bytes:in", "Bytes at NS Level ( In)" },
{ "bytes:out", "Bytes at NS Level (Out)" },
{ "blocked", "NS-VC Block count " },
{ "dead", "NS-VC gone dead count " },
{ "replaced", "NS-VC replaced other count" },
{ "nsei-chg", "NS-VC changed NSEI count " },
{ "inv-nsvci", "NS-VCI was invalid count " },
{ "inv-nsei", "NSEI was invalid count " },
{ "lost:alive", "ALIVE ACK missing count " },
{ "lost:reset", "RESET ACK missing count " },
}

## ◆ nsvc_ctrg_desc [1/2]

const struct rate_ctr_group_desc nsvc_ctrg_desc
| static

Initial value:
= {
.group_name_prefix = "ns:nsvc",
.group_description = "NSVC Peer Statistics",
.num_ctr = ARRAY_SIZE(nsvc_ctr_description),
.ctr_desc = nsvc_ctr_description,
.class_id = OSMO_STATS_CLASS_PEER,
}
nsvc_ctr_description
static const struct rate_ctr_desc nsvc_ctr_description[]
Definition: gprs_ns.c:143

Referenced by gprs_nsvc_create2().

## ◆ nsvc_ctrg_desc [2/2]

const struct rate_ctr_group_desc nsvc_ctrg_desc
| static

Initial value:
= {
.group_name_prefix = "ns:nsvc",
.group_description = "NSVC Peer Statistics",
.num_ctr = ARRAY_SIZE(ns_ctr_description),
.ctr_desc = ns_ctr_description,
.class_id = OSMO_STATS_CLASS_PEER,
}

Referenced by ns2_vc_alloc().

## ◆ nsvc_stat_description [1/2]

const struct osmo_stat_item_desc nsvc_stat_description[]
| static

Initial value:
= {
{ "alive.delay", "ALIVE response time ", "ms", 16, 0 },
}

## ◆ nsvc_stat_description [2/2]

const struct osmo_stat_item_desc nsvc_stat_description[]
| static

Initial value:
= {
[NS_STAT_ALIVE_DELAY] = { "alive.delay", "ALIVE response time ", "ms", 16, 0 },
}
NS_STAT_ALIVE_DELAY
@ NS_STAT_ALIVE_DELAY
Definition: gprs_ns.c:167

## ◆ nsvc_statg_desc [1/2]

const struct osmo_stat_item_group_desc nsvc_statg_desc
| static

Initial value:
= {
.group_name_prefix = "ns.nsvc",
.group_description = "NSVC Peer Statistics",
.num_items = ARRAY_SIZE(nsvc_stat_description),
.item_desc = nsvc_stat_description,
.class_id = OSMO_STATS_CLASS_PEER,
}
nsvc_stat_description
static const struct osmo_stat_item_desc nsvc_stat_description[]
Definition: gprs_ns.c:170

Referenced by gprs_nsvc_create2().

## ◆ nsvc_statg_desc [2/2]

const struct osmo_stat_item_group_desc nsvc_statg_desc
| static

Initial value:
= {
.group_name_prefix = "ns.nsvc",
.group_description = "NSVC Peer Statistics",
.num_items = ARRAY_SIZE(nsvc_stat_description),
.item_desc = nsvc_stat_description,
.class_id = OSMO_STATS_CLASS_PEER,
}

Referenced by ns2_vc_alloc().

## ◆ pdu_type [1/2]

uint8_t pdu_type

NS PDU type.

Referenced by bssgp_pdu_type_flags(), bssgp_rcvmsg(), bssgp_rx_ptp(), bssgp_rx_sign(), bssgp_tx_simple_bvci(), gprs_ns_tx_simple(), ns2_tx_simple(), ns2_validate(), ns_is_sns(), and ns_osmo_signal_dispatch_mismatch().

## ◆ pdu_type [2/2]

uint8_t gprs_ns_hdr::pdu_type

NS PDU type.

Referenced by gprs_ns_process_msg(), gprs_ns_rx_sns(), gprs_ns_sendmsg(), gprs_ns_tx(), gprs_ns_tx_block(), gprs_ns_tx_block_ack(), gprs_ns_tx_reset(), gprs_ns_tx_reset_ack(), gprs_ns_tx_simple(), gprs_ns_tx_sns_ack(), gprs_ns_tx_sns_config(), gprs_ns_tx_sns_config_ack(), gprs_ns_tx_sns_size(), gprs_ns_tx_sns_size_ack(), gprs_ns_tx_status(), gprs_ns_vc_create(), ns2_create_vc(), ns2_sns_rx(), ns2_tx_block(), ns2_tx_block_ack(), ns2_tx_reset(), ns2_tx_reset_ack(), ns2_tx_simple(), ns2_tx_sns_ack(), ns2_tx_sns_config(), ns2_tx_sns_config_ack(), ns2_tx_sns_procedure(), ns2_tx_sns_size(), ns2_tx_sns_size_ack(), ns2_tx_status(), ns2_tx_unit_data(), ns2_vc_rx(), and reject_status_msg().

## ◆ sig_weight [1/3]

uint8_t sig_weight

Referenced by DEFUN(), gprs_nsvc_create2(), ns2_vc_create_ip(), and ns_nse_nsvc_udp_cmds().

## ◆ sig_weight [2/3]

uint8_t gprs_ns_ie_ip4_elem::sig_weight

Referenced by create_missing_nsvcs(), create_nsvc_for_new_sbind(), do_sns_change_weight(), gprs_nsvc_create_ip4(), gprs_sns_bss_fsm_alloc(), ip4_weight_sum(), ns2_add_procedure(), ns2_nsvc_create_ip4(), ns2_sns_add_elements(), ns2_sns_st_local_procedure(), ns2_update_weight_entry(), remove_bind_elem(), update_ip4_elem(), update_remote_ip4_elem(), and vty_dump_sns_ip4().

## ◆ sig_weight [3/3]

uint8_t gprs_ns_ie_ip6_elem::sig_weight

Referenced by create_missing_nsvcs(), create_nsvc_for_new_sbind(), do_sns_change_weight(), ip6_weight_sum(), ns2_add_procedure(), ns2_nsvc_create_ip6(), ns2_sns_add_elements(), ns2_sns_st_local_procedure(), ns2_update_weight_entry(), remove_bind_elem(), update_ip6_elem(), and vty_dump_sns_ip6().

## ◆ timer_mode_strs

const struct value_string timer_mode_strs[]
| static

Initial value:
= {
{ NSVC_TIMER_TNS_RESET, "tns-reset" },
{ NSVC_TIMER_TNS_ALIVE, "tns-alive" },
{ NSVC_TIMER_TNS_TEST, "tns-test" },
{ 0, NULL }
}
NSVC_TIMER_TNS_RESET
@ NSVC_TIMER_TNS_RESET
Definition: gprs_ns.h:117
NSVC_TIMER_TNS_ALIVE
@ NSVC_TIMER_TNS_ALIVE
Definition: gprs_ns.h:116
NSVC_TIMER_TNS_TEST
@ NSVC_TIMER_TNS_TEST
Definition: gprs_ns.h:115

Referenced by gprs_ns_timer_cb(), and nsvc_start_timer().

## ◆ timer_mode_tout

enum ns_timeout timer_mode_tout[_NSVC_TIMER_NR]
| static

Initial value:
= {
[NSVC_TIMER_TNS_RESET] = NS_TOUT_TNS_RESET,
[NSVC_TIMER_TNS_ALIVE] = NS_TOUT_TNS_ALIVE,
[NSVC_TIMER_TNS_TEST] = NS_TOUT_TNS_TEST,
}
NS_TOUT_TNS_RESET
@ NS_TOUT_TNS_RESET
Definition: gprs_ns.h:36
NS_TOUT_TNS_TEST
@ NS_TOUT_TNS_TEST
Definition: gprs_ns.h:38
NS_TOUT_TNS_ALIVE
@ NS_TOUT_TNS_ALIVE
Definition: gprs_ns.h:39

Referenced by gprs_ns_timer_cb(), and nsvc_start_timer().

## ◆ udp_port [1/3]

uint16_t udp_port

## ◆ udp_port [2/3]

uint16_t gprs_ns_ie_ip4_elem::udp_port

Referenced by add_ip4_elem(), create_missing_nsvcs(), create_nsvc_for_new_sbind(), do_sns_change_weight(), do_sns_delete(), gprs_nsvc_create_ip4(), gprs_sns_bss_fsm_alloc(), ns2_add_procedure(), ns2_get_sbind_ip4_entry(), ns2_nsvc_create_ip4(), ns2_sns_add_elements(), ns2_sns_st_local_procedure(), nsvc_by_ip4_elem(), remove_bind_elem(), remove_ip4_elem(), update_ip4_elem(), update_remote_ip4_elem(), and vty_dump_sns_ip4().

## ◆ udp_port [3/3]

uint16_t gprs_ns_ie_ip6_elem::udp_port

Referenced by add_ip6_elem(), create_missing_nsvcs(), create_nsvc_for_new_sbind(), do_sns_change_weight(), do_sns_delete(), ns2_add_procedure(), ns2_get_sbind_ip6_entry(), ns2_nsvc_create_ip6(), ns2_sns_add_elements(), ns2_sns_st_local_procedure(), nsvc_by_ip6_elem(), remove_bind_elem(), remove_ip6_elem(), update_ip6_elem(), and vty_dump_sns_ip6().