libosmogb  1.4.0.160-7619
Osmocom Gb library
gprs_ns2_internal.h File Reference
#include <stdbool.h>
#include <stdint.h>
#include <osmocom/gprs/protocol/gsm_08_16.h>
#include <osmocom/gprs/gprs_ns2.h>

Go to the source code of this file.

Data Structures

struct  gprs_ns2_inst
 An instance of the NS protocol stack. More...
 
struct  gprs_ns2_nse
 Structure repesenting a NSE. More...
 
struct  gprs_ns2_vc
 Structure representing a single NS-VC. More...
 
struct  gprs_ns2_vc_bind
 Structure repesenting a bind instance. More...
 
struct  gprs_ns2_vc_driver
 

Macros

#define NS_TIMERS_COUNT   8
 
#define NS_TIMERS   "(tns-block|tns-block-retries|tns-reset|tns-reset-retries|tns-test|tns-alive|tns-alive-retries|tsns-prov)"
 
#define NS_TIMERS_HELP
 
#define NS_ALLOC_SIZE   3072
 
#define NS_ALLOC_HEADROOM   20
 
#define NSE_S_BLOCKED   0x0001
 
#define NSE_S_ALIVE   0x0002
 
#define NSE_S_RESET   0x0004
 
#define NS_DESC_B(st)   ((st) & NSE_S_BLOCKED ? "BLOCKED" : "UNBLOCKED")
 
#define NS_DESC_A(st)   ((st) & NSE_S_ALIVE ? "ALIVE" : "DEAD")
 
#define NS_DESC_R(st)   ((st) & NSE_S_RESET ? "RESET" : "UNRESET")
 

Enumerations

enum  ns2_timeout {
  NS_TOUT_TNS_BLOCK,
  NS_TOUT_TNS_BLOCK_RETRIES,
  NS_TOUT_TNS_RESET,
  NS_TOUT_TNS_RESET_RETRIES,
  NS_TOUT_TNS_TEST,
  NS_TOUT_TNS_ALIVE,
  NS_TOUT_TNS_ALIVE_RETRIES,
  NS_TOUT_TSNS_PROV
}
 
enum  nsvc_timer_mode {
  NSVC_TIMER_TNS_TEST,
  NSVC_TIMER_TNS_ALIVE,
  NSVC_TIMER_TNS_RESET,
  _NSVC_TIMER_NR,
  NSVC_TIMER_TNS_TEST,
  NSVC_TIMER_TNS_ALIVE,
  NSVC_TIMER_TNS_RESET,
  _NSVC_TIMER_NR
}
 
enum  ns_stat {
  NS_STAT_ALIVE_DELAY,
  NS_STAT_ALIVE_DELAY
}
 
enum  gprs_ns_ll {
  GPRS_NS_LL_UDP,
  GPRS_NS_LL_E1,
  GPRS_NS_LL_FR_GRE,
  GPRS_NS_LL_UDP,
  GPRS_NS_LL_E1,
  GPRS_NS_LL_FR_GRE
}
 Osmocom NS link layer types. More...
 
enum  gprs_ns2_cs {
  GPRS_NS2_CS_CREATED,
  GPRS_NS2_CS_FOUND,
  GPRS_NS2_CS_REJECTED,
  GPRS_NS2_CS_SKIPPED,
  GPRS_NS2_CS_ERROR
}
 Osmocom NS2 VC create status. More...
 

Functions

enum gprs_ns2_cs ns2_create_vc (struct gprs_ns2_vc_bind *bind, struct msgb *msg, const char *logname, struct msgb **reject, struct gprs_ns2_vc **success)
 Create a new NS-VC based on a [received] message. 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...
 
struct gprs_ns2_vcns2_vc_alloc (struct gprs_ns2_vc_bind *bind, struct gprs_ns2_nse *nse, bool initiater)
 Allocate a NS-VC within the given bind + NSE. More...
 
struct msgbgprs_ns2_msgb_alloc (void)
 Allocate a message buffer for use with the NS2 stack. More...
 
void gprs_ns2_sns_dump_vty (struct vty *vty, const struct gprs_ns2_nse *nse, bool stats)
 Dump the IP-SNS state to a vty. More...
 
void ns2_prim_status_ind (struct gprs_ns2_nse *nse, uint16_t bvci, enum gprs_ns2_affecting_cause cause)
 Send a STATUS.ind primitive to the specified NS instance user. More...
 
void ns2_nse_notify_alive (struct gprs_ns2_vc *nsvc, bool alive)
 
int gprs_ns2_validate (struct gprs_ns2_vc *nsvc, uint8_t pdu_type, struct msgb *msg, struct tlv_parsed *tp, uint8_t *cause)
 
int ns2_tx_sns_ack (struct gprs_ns2_vc *nsvc, uint8_t trans_id, uint8_t *cause, const struct gprs_ns_ie_ip4_elem *ip4_elems, unsigned int num_ip4_elems, const struct gprs_ns_ie_ip6_elem *ip6_elems, unsigned int num_ip6_elems)
 Encode + Transmit a SNS-ACK as per Section 9.3.1. More...
 
int ns2_tx_sns_config (struct gprs_ns2_vc *nsvc, bool end_flag, const struct gprs_ns_ie_ip4_elem *ip4_elems, unsigned int num_ip4_elems, const struct gprs_ns_ie_ip6_elem *ip6_elems, unsigned int num_ip6_elems)
 Encode + Transmit a SNS-CONFIG as per Section 9.3.4. More...
 
int ns2_tx_sns_config_ack (struct gprs_ns2_vc *nsvc, uint8_t *cause)
 Encode + Transmit a SNS-CONFIG-ACK as per Section 9.3.5. More...
 
int ns2_tx_sns_size (struct gprs_ns2_vc *nsvc, bool reset_flag, uint16_t max_nr_nsvc, int ip4_ep_nr, int ip6_ep_nr)
 Encode + transmit a SNS-SIZE as per Section 9.3.7. More...
 
int ns2_tx_sns_size_ack (struct gprs_ns2_vc *nsvc, uint8_t *cause)
 Encode + Transmit a SNS-SIZE-ACK as per Section 9.3.8. More...
 
int ns2_tx_block (struct gprs_ns2_vc *nsvc, uint8_t cause)
 Transmit a NS-BLOCK on a given NS-VC. More...
 
int ns2_tx_block_ack (struct gprs_ns2_vc *nsvc)
 Transmit a NS-BLOCK-ACK on a given NS-VC. More...
 
int ns2_tx_reset (struct gprs_ns2_vc *nsvc, uint8_t cause)
 Transmit a NS-RESET on a given NS-VC. More...
 
int ns2_tx_reset_ack (struct gprs_ns2_vc *nsvc)
 Transmit a NS-RESET-ACK on a given NS-VC. More...
 
int ns2_tx_unblock (struct gprs_ns2_vc *nsvc)
 Transmit a NS-UNBLOCK on a given NS-VC. More...
 
int ns2_tx_unblock_ack (struct gprs_ns2_vc *nsvc)
 Transmit a NS-UNBLOCK-ACK on a given NS-VC. More...
 
int ns2_tx_alive (struct gprs_ns2_vc *nsvc)
 Transmit a NS-ALIVE on a given NS-VC. More...
 
int ns2_tx_alive_ack (struct gprs_ns2_vc *nsvc)
 Transmit a NS-ALIVE-ACK on a given NS-VC. More...
 
int ns2_tx_unit_data (struct gprs_ns2_vc *nsvc, uint16_t bvci, uint8_t sducontrol, struct msgb *msg)
 Transmit NS-UNITDATA on a given NS-VC. More...
 
int ns2_tx_status (struct gprs_ns2_vc *nsvc, uint8_t cause, uint16_t bvci, struct msgb *orig_msg)
 Transmit a NS-STATUS on a given NS-VC. More...
 
struct gprs_ns2_vcgprs_ns2_ip_bind_connect (struct gprs_ns2_vc_bind *bind, struct gprs_ns2_nse *nse, const struct osmo_sockaddr *remote)
 Create new NS-VC to a given remote address. More...
 
int gprs_ns2_sns_rx (struct gprs_ns2_vc *nsvc, struct msgb *msg, struct tlv_parsed *tp)
 main entry point for receiving SNS messages from the network. More...
 
struct osmo_fsm_instns2_sns_bss_fsm_alloc (struct gprs_ns2_nse *nse, const char *id)
 Allocate an IP-SNS FSM for the BSS side. More...
 
int ns2_sns_bss_fsm_start (struct gprs_ns2_nse *nse, struct gprs_ns2_vc *nsvc, const struct osmo_sockaddr *remote)
 Start an IP-SNS FSM. More...
 
void ns2_sns_free_nsvc (struct gprs_ns2_vc *nsvc)
 called when a nsvc is beeing freed More...
 
struct osmo_fsm_instgprs_ns2_vc_fsm_alloc (struct gprs_ns2_vc *nsvc, const char *id, bool initiate)
 gprs_ns2_vc_fsm_alloc More...
 
int gprs_ns2_vc_fsm_start (struct gprs_ns2_vc *nsvc)
 Start a NS-VC FSM. More...
 
int gprs_ns2_vc_rx (struct gprs_ns2_vc *nsvc, struct msgb *msg, struct tlv_parsed *tp)
 entry point for messages from the driver/VL More...
 
int gprs_ns2_vc_is_alive (struct gprs_ns2_vc *nsvc)
 
int gprs_ns2_vc_is_unblocked (struct gprs_ns2_vc *nsvc)
 is the given NS-VC unblocked? More...
 
void ns2_vty_bind_apply (struct gprs_ns2_vc_bind *bind)
 ns2_vty_bind_apply will be called when a new bind is created to apply vty settings More...
 
void ns2_nse_notify_unblocked (struct gprs_ns2_vc *nsvc, bool unblocked)
 Notify a nse about the change of a NS-VC. More...
 

Macro Definition Documentation

◆ NS_ALLOC_HEADROOM

#define NS_ALLOC_HEADROOM   20

◆ NS_ALLOC_SIZE

#define NS_ALLOC_SIZE   3072

◆ NS_DESC_A

#define NS_DESC_A (   st)    ((st) & NSE_S_ALIVE ? "ALIVE" : "DEAD")

◆ NS_DESC_B

#define NS_DESC_B (   st)    ((st) & NSE_S_BLOCKED ? "BLOCKED" : "UNBLOCKED")

◆ NS_DESC_R

#define NS_DESC_R (   st)    ((st) & NSE_S_RESET ? "RESET" : "UNRESET")

◆ NS_TIMERS

#define NS_TIMERS   "(tns-block|tns-block-retries|tns-reset|tns-reset-retries|tns-test|tns-alive|tns-alive-retries|tsns-prov)"

◆ NS_TIMERS_COUNT

#define NS_TIMERS_COUNT   8

◆ NS_TIMERS_HELP

#define NS_TIMERS_HELP
Value:
"(un)blocking Timer (Tns-block) timeout\n" \
"(un)blocking Timer (Tns-block) number of retries\n" \
"Reset Timer (Tns-reset) timeout\n" \
"Reset Timer (Tns-reset) number of retries\n" \
"Test Timer (Tns-test) timeout\n" \
"Alive Timer (Tns-alive) timeout\n" \
"Alive Timer (Tns-alive) number of retries\n" \
"SNS Provision Timer (Tsns-prov) timeout\n"

◆ NSE_S_ALIVE

#define NSE_S_ALIVE   0x0002

◆ NSE_S_BLOCKED

#define NSE_S_BLOCKED   0x0001

◆ NSE_S_RESET

#define NSE_S_RESET   0x0004

Enumeration Type Documentation

◆ gprs_ns2_cs

Osmocom NS2 VC create status.

Enumerator
GPRS_NS2_CS_CREATED 

A NSVC object has been created.

GPRS_NS2_CS_FOUND 

A NSVC object has been found.

GPRS_NS2_CS_REJECTED 

Rejected and answered message.

GPRS_NS2_CS_SKIPPED 

Skipped message.

GPRS_NS2_CS_ERROR 

Failed to process message.

◆ gprs_ns_ll

enum gprs_ns_ll

Osmocom NS link layer types.

Enumerator
GPRS_NS_LL_UDP 

NS/UDP/IP.

GPRS_NS_LL_E1 

NS/E1.

GPRS_NS_LL_FR_GRE 

NS/FR/GRE/IP.

GPRS_NS_LL_UDP 

NS/UDP/IP.

GPRS_NS_LL_E1 

NS/E1.

GPRS_NS_LL_FR_GRE 

NS/FR/GRE/IP.

◆ ns2_timeout

Enumerator
NS_TOUT_TNS_BLOCK 
NS_TOUT_TNS_BLOCK_RETRIES 
NS_TOUT_TNS_RESET 
NS_TOUT_TNS_RESET_RETRIES 
NS_TOUT_TNS_TEST 
NS_TOUT_TNS_ALIVE 
NS_TOUT_TNS_ALIVE_RETRIES 
NS_TOUT_TSNS_PROV 

◆ ns_stat

enum ns_stat
Enumerator
NS_STAT_ALIVE_DELAY 
NS_STAT_ALIVE_DELAY 

◆ nsvc_timer_mode

Enumerator
NSVC_TIMER_TNS_TEST 
NSVC_TIMER_TNS_ALIVE 
NSVC_TIMER_TNS_RESET 
_NSVC_TIMER_NR 
NSVC_TIMER_TNS_TEST 
NSVC_TIMER_TNS_ALIVE 
NSVC_TIMER_TNS_RESET 
_NSVC_TIMER_NR 

Function Documentation

◆ gprs_ns2_ip_bind_connect()

struct gprs_ns2_vc* gprs_ns2_ip_bind_connect ( struct gprs_ns2_vc_bind bind,
struct gprs_ns2_nse nse,
const struct osmo_sockaddr remote 
)

Create new NS-VC to a given remote address.

Parameters
[in]bindthe bind we want to connect
[in]nseNS entity to be used for the new NS-VC
[in]remoteremote address to connect to
Returns
pointer to newly-allocated and connected NS-VC; NULL on error

References gprs_ns2_free_nsvc(), GPRS_NS_LL_UDP, gprs_ns2_vc::ll, ns2_vc_alloc(), priv, gprs_ns2_vc::priv, and priv_vc::remote.

Referenced by gprs_ns2_ip_connect_inactive(), and gprs_ns2_ip_connect_sns().

◆ gprs_ns2_sns_dump_vty()

void gprs_ns2_sns_dump_vty ( struct vty vty,
const struct gprs_ns2_nse nse,
bool  stats 
)

◆ gprs_ns2_sns_rx()

int gprs_ns2_sns_rx ( struct gprs_ns2_vc nsvc,
struct msgb msg,
struct tlv_parsed tp 
)

◆ gprs_ns2_validate()

◆ gprs_ns2_vc_fsm_alloc()

struct osmo_fsm_inst* gprs_ns2_vc_fsm_alloc ( struct gprs_ns2_vc nsvc,
const char *  id,
bool  initiater 
)

gprs_ns2_vc_fsm_alloc

Parameters
ctx
vc
ida char representation of the virtual curcuit
initiaterinitiater is the site which starts the connection. Usually the BSS.
Returns
NULL on error, otherwise the fsm

References gprs_ns2_vc_priv::alive, alive_timeout_handler(), gprs_ns2_vc::fi, gprs_ns2_vc_priv::initiater, LOGL_DEBUG, gprs_ns2_vc_priv::nsvc, osmo_fsm_inst_alloc(), osmo_timer_setup(), osmo_fsm_inst::priv, priv, and gprs_ns2_vc_priv::timer.

Referenced by ns2_vc_alloc().

◆ gprs_ns2_vc_fsm_start()

int gprs_ns2_vc_fsm_start ( struct gprs_ns2_vc nsvc)

Start a NS-VC FSM.

Parameters
nsvcthe virtual circuit
Returns
0 on success; negative on error

References gprs_ns2_vc::fi, GPRS_NS2_EV_START, GPRS_NS2_ST_UNCONFIGURED, osmo_fsm_inst_dispatch, and osmo_fsm_inst::state.

Referenced by gprs_ns2_ip_connect(), gprs_ns2_start_alive_all_nsvcs(), handle_nsfrgre_read(), and handle_nsip_read().

◆ gprs_ns2_vc_is_alive()

int gprs_ns2_vc_is_alive ( struct gprs_ns2_vc nsvc)

◆ gprs_ns2_vc_is_unblocked()

int gprs_ns2_vc_is_unblocked ( struct gprs_ns2_vc nsvc)

◆ gprs_ns2_vc_rx()

int gprs_ns2_vc_rx ( struct gprs_ns2_vc nsvc,
struct msgb msg,
struct tlv_parsed tp 
)

◆ ns2_nse_notify_alive()

void ns2_nse_notify_alive ( struct gprs_ns2_vc nsvc,
bool  alive 
)

◆ ns2_sns_bss_fsm_alloc()

struct osmo_fsm_inst* ns2_sns_bss_fsm_alloc ( struct gprs_ns2_nse nse,
const char *  id 
)

Allocate an IP-SNS FSM for the BSS side.

Parameters
[in]nseNS Entity in which the FSM runs
[in]idstring identifier FSM instance on success; NULL on error

References LOGL_DEBUG, ns2_sns_state::nse, osmo_fsm_inst_alloc(), osmo_fsm_inst_term, OSMO_FSM_TERM_ERROR, and osmo_fsm_inst::priv.

Referenced by gprs_ns2_ip_connect_sns().

◆ ns2_sns_bss_fsm_start()

◆ ns2_sns_free_nsvc()

◆ ns2_tx_alive()

int ns2_tx_alive ( struct gprs_ns2_vc nsvc)

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

Parameters
[in]nsvcNS-VC on which the NS-ALIVE is to be transmitted
Returns
0 in case of success

References DLNS, LOG_CTX_GB_NSVC, log_set_context(), LOGL_DEBUG, LOGP, ns2_tx_simple(), NS_PDUT_ALIVE, gprs_ns2_vc::nse, gprs_ns2_nse::nsei, and gprs_ns2_vc::nsvci.

Referenced by alive_timeout_handler(), gprs_ns2_st_alive_onenter(), and start_test_procedure().

◆ ns2_tx_alive_ack()

int ns2_tx_alive_ack ( struct gprs_ns2_vc nsvc)

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

Parameters
[in]nsvcNS-VC on which the NS-ALIVE-ACK is to be transmitted
Returns
0 in case of success

References DLNS, LOG_CTX_GB_NSVC, log_set_context(), LOGL_DEBUG, LOGP, ns2_tx_simple(), NS_PDUT_ALIVE_ACK, gprs_ns2_vc::nse, gprs_ns2_nse::nsei, and gprs_ns2_vc::nsvci.

Referenced by gprs_ns2_vc_fsm_allstate_action().

◆ ns2_tx_block()

int ns2_tx_block ( struct gprs_ns2_vc nsvc,
uint8_t  cause 
)

◆ ns2_tx_block_ack()

int ns2_tx_block_ack ( struct gprs_ns2_vc nsvc)

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

Parameters
[in]nsvcNS-VC on which the NS-BLOCK is to be transmitted
Returns
0 in case of success

References gprs_ns2_vc::bind, DLNS, ERR_IF_NSVC_USES_SNS, gprs_ns2_msgb_alloc(), msgb::l2h, LOG_CTX_GB_NSVC, log_set_context(), LOGL_INFO, LOGP, msg, msgb_put(), msgb_tvlv_put(), NS_IE_VCI, NS_PDUT_BLOCK_ACK, gprs_ns2_vc::nse, gprs_ns2_nse::nsei, gprs_ns2_vc::nsvci, osmo_htons, gprs_ns_hdr::pdu_type, and gprs_ns2_vc_bind::send_vc.

Referenced by gprs_ns2_st_blocked(), and gprs_ns2_st_unblocked().

◆ ns2_tx_reset()

int ns2_tx_reset ( struct gprs_ns2_vc nsvc,
uint8_t  cause 
)

◆ ns2_tx_reset_ack()

int ns2_tx_reset_ack ( struct gprs_ns2_vc nsvc)

◆ ns2_tx_sns_ack()

int ns2_tx_sns_ack ( struct gprs_ns2_vc nsvc,
uint8_t  trans_id,
uint8_t *  cause,
const struct gprs_ns_ie_ip4_elem ip4_elems,
unsigned int  num_ip4_elems,
const struct gprs_ns_ie_ip6_elem ip6_elems,
unsigned int  num_ip6_elems 
)

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

Parameters
[in]nsvcNS-VC through which to transmit the ACK
[in]trans_idTransaction ID which to acknowledge
[in]causePointer to cause value (NULL if no cause to be sent)
[in]ip4_elemsArray of IPv4 Elements
[in]num_ip4_elemsnumber of ip4_elems
Returns
0 on success; negative in case of error

References gprs_ns2_vc::bind, gprs_ns2_nse::bss_sns_fi, DLNS, gprs_ns2_msgb_alloc(), msgb::l2h, 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_IPv6_LIST, NS_IE_NSEI, gprs_ns2_vc::nse, nsei, gprs_ns2_nse::nsei, osmo_htons, gprs_ns_hdr::pdu_type, gprs_ns2_vc_bind::send_vc, and SNS_PDUT_ACK.

Referenced by ns2_sns_st_configured_add(), ns2_sns_st_configured_change(), and ns2_sns_st_configured_delete().

◆ ns2_tx_sns_config()

int ns2_tx_sns_config ( struct gprs_ns2_vc nsvc,
bool  end_flag,
const struct gprs_ns_ie_ip4_elem ip4_elems,
unsigned int  num_ip4_elems,
const struct gprs_ns_ie_ip6_elem ip6_elems,
unsigned int  num_ip6_elems 
)

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

Parameters
[in]nsvcNS-VC through which to transmit the SNS-CONFIG
[in]end_flagWhether or not this is the last SNS-CONFIG
[in]ip4_elemsArray of IPv4 Elements
[in]num_ip4_elemsnumber of ip4_elems
Returns
0 on success; negative in case of error

References gprs_ns2_vc::bind, gprs_ns2_nse::bss_sns_fi, DLNS, gprs_ns2_msgb_alloc(), msgb::l2h, 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_IPv6_LIST, NS_IE_NSEI, gprs_ns2_vc::nse, nsei, gprs_ns2_nse::nsei, osmo_htons, gprs_ns_hdr::pdu_type, gprs_ns2_vc_bind::send_vc, and SNS_PDUT_CONFIG.

Referenced by ns2_sns_st_config_bss_onenter().

◆ ns2_tx_sns_config_ack()

int ns2_tx_sns_config_ack ( struct gprs_ns2_vc nsvc,
uint8_t *  cause 
)

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

Parameters
[in]nsvcNS-VC through which to transmit the SNS-CONFIG-ACK
[in]causePointer to cause value (NULL if no cause to be sent)
Returns
0 on success; negative in case of error

References gprs_ns2_vc::bind, gprs_ns2_nse::bss_sns_fi, DLNS, gprs_ns2_msgb_alloc(), msgb::l2h, LOG_CTX_GB_NSVC, log_set_context(), LOGL_ERROR, LOGP, msg, msgb_free(), msgb_put(), msgb_tvlv_put(), NS_IE_CAUSE, NS_IE_NSEI, gprs_ns2_vc::nse, nsei, gprs_ns2_nse::nsei, osmo_htons, gprs_ns_hdr::pdu_type, gprs_ns2_vc_bind::send_vc, and SNS_PDUT_CONFIG_ACK.

Referenced by ns_sns_st_config_sgsn_ip4(), and ns_sns_st_config_sgsn_ip6().

◆ ns2_tx_sns_size()

int ns2_tx_sns_size ( struct gprs_ns2_vc nsvc,
bool  reset_flag,
uint16_t  max_nr_nsvc,
int  ip4_ep_nr,
int  ip6_ep_nr 
)

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

Parameters
[in]nsvcNS-VC through which to transmit the SNS-SIZE
[in]reset_flagWhether or not to add a RESET flag
[in]max_nr_nsvcMaximum number of NS-VCs
[in]ip4_ep_nrNumber of IPv4 endpoints (< 0 will omit the TLV)
[in]ip6_ep_nrNumber of IPv6 endpoints (< 0 will omit the TLV)
Returns
0 on success; negative in case of error

References gprs_ns2_vc::bind, gprs_ns2_nse::bss_sns_fi, DLNS, gprs_ns2_msgb_alloc(), msgb::l2h, 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, gprs_ns2_vc::nse, nsei, gprs_ns2_nse::nsei, osmo_htons, gprs_ns_hdr::pdu_type, gprs_ns2_vc_bind::send_vc, and SNS_PDUT_SIZE.

Referenced by ns2_sns_st_size_onenter().

◆ ns2_tx_sns_size_ack()

int ns2_tx_sns_size_ack ( struct gprs_ns2_vc nsvc,
uint8_t *  cause 
)

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

Parameters
[in]nsvcNS-VC through which to transmit the SNS-SIZE-ACK
[in]causePointer to cause value (NULL if no cause to be sent)
Returns
0 on success; negative in case of error

References gprs_ns2_vc::bind, gprs_ns2_nse::bss_sns_fi, DLNS, gprs_ns2_msgb_alloc(), msgb::l2h, LOG_CTX_GB_NSVC, log_set_context(), LOGL_ERROR, LOGP, msg, msgb_free(), msgb_put(), msgb_tvlv_put(), NS_IE_CAUSE, NS_IE_NSEI, gprs_ns2_vc::nse, nsei, gprs_ns2_nse::nsei, osmo_htons, gprs_ns_hdr::pdu_type, gprs_ns2_vc_bind::send_vc, and SNS_PDUT_SIZE_ACK.

◆ ns2_tx_status()

int ns2_tx_status ( struct gprs_ns2_vc nsvc,
uint8_t  cause,
uint16_t  bvci,
struct msgb orig_msg 
)

◆ ns2_tx_unblock()

int ns2_tx_unblock ( struct gprs_ns2_vc nsvc)

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

Parameters
[in]nsvcNS-VC on which the NS-UNBLOCK is to be transmitted
Returns
0 in case of success

References DLNS, ERR_IF_NSVC_USES_SNS, LOG_CTX_GB_NSVC, log_set_context(), LOGL_INFO, LOGP, ns2_tx_simple(), NS_PDUT_UNBLOCK, gprs_ns2_vc::nse, gprs_ns2_nse::nsei, and gprs_ns2_vc::nsvci.

Referenced by gprs_ns2_st_blocked_onenter().

◆ ns2_tx_unblock_ack()

int ns2_tx_unblock_ack ( struct gprs_ns2_vc nsvc)

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

Parameters
[in]nsvcNS-VC on which the NS-UNBLOCK-ACK is to be transmitted
Returns
0 in case of success

References DLNS, ERR_IF_NSVC_USES_SNS, LOG_CTX_GB_NSVC, log_set_context(), LOGL_INFO, LOGP, ns2_tx_simple(), NS_PDUT_UNBLOCK_ACK, gprs_ns2_vc::nse, gprs_ns2_nse::nsei, and gprs_ns2_vc::nsvci.

Referenced by gprs_ns2_st_blocked().

◆ ns2_tx_unit_data()

int ns2_tx_unit_data ( struct gprs_ns2_vc nsvc,
uint16_t  bvci,
uint8_t  sducontrol,
struct msgb msg 
)

Transmit NS-UNITDATA on a given NS-VC.

Parameters
[in]nsvcNS-VC on which the NS-UNITDATA is to be transmitted
[in]bvciBVCI to encode in NS-UNITDATA header
[in]sducontrolSDU control octet of NS header
[in]msgmessage buffer containing payload
Returns
0 in case of success

References gprs_ns2_vc::bind, gprs_ns_hdr::data, DLNS, if(), msgb::l2h, LOG_CTX_GB_NSVC, log_set_context(), LOGL_ERROR, LOGP, msgb_free(), msgb_push(), NS_PDUT_UNITDATA, gprs_ns_hdr::pdu_type, and gprs_ns2_vc_bind::send_vc.

Referenced by gprs_ns2_recv_prim().

◆ ns2_vty_bind_apply()

void ns2_vty_bind_apply ( struct gprs_ns2_vc_bind bind)

ns2_vty_bind_apply will be called when a new bind is created to apply vty settings

Parameters
bind
Returns

References gprs_ns2_bind_set_mode(), priv, and ns2_vty_priv::vc_mode.

Referenced by gprs_ns2_frgre_bind(), and gprs_ns2_ip_bind().