libosmogb 1.9.0.192-1c24
Osmocom Gb library
gprs_ns2_sns.c File Reference

NS Sub-Network Service Protocol implementation 3GPP TS 08.16 version 8.0.1 Release 1999 / ETSI TS 101 299 V8.0.1 (2002-05) as well as its successor 3GPP TS 48.016. More...

#include <errno.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdint.h>
#include <osmocom/core/fsm.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/socket.h>
#include <osmocom/core/sockaddr_str.h>
#include <osmocom/gsm/tlv.h>
#include <osmocom/gprs/gprs_msgb.h>
#include <osmocom/gprs/gprs_ns2.h>
#include <osmocom/gprs/protocol/gsm_08_16.h>
#include "gprs_ns2_internal.h"
#include <osmocom/vty/vty.h>
#include <osmocom/vty/misc.h>

Data Structures

struct  sns_endpoint
 
struct  ns2_sns_bind
 
struct  ns2_sns_procedure
 
struct  ns2_sns_elems
 
struct  ns2_sns_state
 

Macros

#define S(x)   (1 << (x))
 
#define GPRS_SNS_FLAG_KEEP_SELECT_ENDPOINT_ORDER   (void *) 1
 
#define sns_failed(fi, reason)    _sns_failed(fi, reason, __FILE__, __LINE__)
 
#define ip4_weight_sum_data(elems)   ip4_weight_sum(elems, true)
 
#define ip4_weight_sum_sig(elems)   ip4_weight_sum(elems, false)
 
#define ip6_weight_sum_data(elems)   ip6_weight_sum(elems, true)
 
#define ip6_weight_sum_sig(elems)   ip6_weight_sum(elems, false)
 
#define ip46_weight_sum_data(elems)   ip46_weight_sum(elems, true)
 
#define ip46_weight_sum_sig(elems)   ip46_weight_sum(elems, false)
 

Enumerations

enum  ns2_sns_role {
  GPRS_SNS_ROLE_BSS ,
  GPRS_SNS_ROLE_SGSN
}
 
enum  gprs_sns_bss_state {
  GPRS_SNS_ST_UNCONFIGURED ,
  GPRS_SNS_ST_BSS_SIZE ,
  GPRS_SNS_ST_BSS_CONFIG_BSS ,
  GPRS_SNS_ST_BSS_CONFIG_SGSN ,
  GPRS_SNS_ST_CONFIGURED ,
  GPRS_SNS_ST_SGSN_WAIT_CONFIG ,
  GPRS_SNS_ST_SGSN_WAIT_CONFIG_ACK ,
  GPRS_SNS_ST_LOCAL_PROCEDURE ,
  GPRS_SNS_ST_UNCONFIGURED ,
  GPRS_SNS_ST_SIZE ,
  GPRS_SNS_ST_CONFIG_BSS ,
  GPRS_SNS_ST_CONFIG_SGSN ,
  GPRS_SNS_ST_CONFIGURED
}
 
enum  sns_procedure {
  SNS_PROC_NONE ,
  SNS_PROC_ADD ,
  SNS_PROC_DEL ,
  SNS_PROC_CHANGE_WEIGHT
}
 

Functions

static struct gprs_ns2_nsense_inst_from_fi (struct osmo_fsm_inst *fi)
 
static void _sns_failed (struct osmo_fsm_inst *fi, const char *reason, const char *file, int line)
 
static int ip4_weight_sum (const struct ns2_sns_elems *elems, bool data_weight)
 
static int ip6_weight_sum (const struct ns2_sns_elems *elems, bool data_weight)
 
static int ip46_weight_sum (const struct ns2_sns_elems *elems, bool data_weight)
 
static struct gprs_ns2_vcnsvc_by_ip4_elem (struct gprs_ns2_nse *nse, const struct gprs_ns_ie_ip4_elem *ip4)
 
static struct gprs_ns2_vcnsvc_by_ip6_elem (struct gprs_ns2_nse *nse, const struct gprs_ns_ie_ip6_elem *ip6)
 
const struct osmo_sockaddrgprs_ns2_nse_sns_remote (struct gprs_ns2_nse *nse)
 Return the initial SNS remote socket address. More...
 
void ns2_sns_replace_nsvc (struct gprs_ns2_vc *nsvc)
 called when a nsvc is beeing freed or the nsvc became dead More...
 
static void ns2_clear_elems (struct ns2_sns_elems *elems)
 
static void ns2_clear_procedures (struct ns2_sns_state *gss)
 
static void ns2_vc_create_ip (struct osmo_fsm_inst *fi, struct gprs_ns2_nse *nse, const struct osmo_sockaddr *remote, uint8_t sig_weight, uint8_t data_weight)
 
static void ns2_nsvc_create_ip4 (struct osmo_fsm_inst *fi, struct gprs_ns2_nse *nse, const struct gprs_ns_ie_ip4_elem *ip4)
 
static void ns2_nsvc_create_ip6 (struct osmo_fsm_inst *fi, struct gprs_ns2_nse *nse, const struct gprs_ns_ie_ip6_elem *ip6)
 
static struct gprs_ns2_vcnsvc_for_bind_and_remote (struct gprs_ns2_nse *nse, struct gprs_ns2_vc_bind *bind, const struct osmo_sockaddr *remote)
 
static int create_missing_nsvcs (struct osmo_fsm_inst *fi)
 
static int add_ip4_elem (struct ns2_sns_state *gss, struct ns2_sns_elems *elems, const struct gprs_ns_ie_ip4_elem *ip4)
 
static int remove_ip4_elem (struct ns2_sns_state *gss, struct ns2_sns_elems *elems, const struct gprs_ns_ie_ip4_elem *ip4)
 
static int update_ip4_elem (struct ns2_sns_state *gss, struct ns2_sns_elems *elems, const struct gprs_ns_ie_ip4_elem *ip4)
 
static int add_ip6_elem (struct ns2_sns_state *gss, struct ns2_sns_elems *elems, const struct gprs_ns_ie_ip6_elem *ip6)
 
static int remove_ip6_elem (struct ns2_sns_state *gss, struct ns2_sns_elems *elems, const struct gprs_ns_ie_ip6_elem *ip6)
 
static int update_ip6_elem (struct ns2_sns_state *gss, struct ns2_sns_elems *elems, const struct gprs_ns_ie_ip6_elem *ip6)
 
static int remove_bind_elem (struct ns2_sns_state *gss, struct ns2_sns_elems *elems, struct ns2_sns_bind *sbind)
 
static int do_sns_change_weight (struct osmo_fsm_inst *fi, const struct gprs_ns_ie_ip4_elem *ip4, const struct gprs_ns_ie_ip6_elem *ip6)
 
static int do_sns_delete (struct osmo_fsm_inst *fi, const struct gprs_ns_ie_ip4_elem *ip4, const struct gprs_ns_ie_ip6_elem *ip6)
 
static int do_sns_add (struct osmo_fsm_inst *fi, const struct gprs_ns_ie_ip4_elem *ip4, const struct gprs_ns_ie_ip6_elem *ip6)
 
static void ns2_sns_st_bss_unconfigured (struct osmo_fsm_inst *fi, uint32_t event, void *data)
 
static void ns2_sns_st_bss_size (struct osmo_fsm_inst *fi, uint32_t event, void *data)
 
static int ns2_sns_count_num_local_ep (struct osmo_fsm_inst *fi, int ip_proto)
 
static int ns2_sns_copy_local_endpoints (struct ns2_sns_state *gss)
 
static void ns2_sns_compute_local_ep_from_binds (struct osmo_fsm_inst *fi)
 
static void ns2_sns_choose_next_bind (struct ns2_sns_state *gss)
 
static void ns2_sns_st_bss_size_onenter (struct osmo_fsm_inst *fi, uint32_t old_state)
 
static void ns2_sns_st_bss_config_bss (struct osmo_fsm_inst *fi, uint32_t event, void *data)
 
static void ns2_sns_st_bss_config_bss_onenter (struct osmo_fsm_inst *fi, uint32_t old_state)
 
static int ns_sns_configured_timeout (struct osmo_fsm_inst *fi)
 
static int ns_sns_append_remote_eps (struct osmo_fsm_inst *fi, const struct tlv_parsed *tp)
 
static void ns2_sns_st_bss_config_sgsn_onenter (struct osmo_fsm_inst *fi, uint32_t old_state)
 
static void ns2_sns_st_bss_config_sgsn (struct osmo_fsm_inst *fi, uint32_t event, void *data)
 
static void ns2_sns_st_configured_add (struct osmo_fsm_inst *fi, struct ns2_sns_state *gss, struct tlv_parsed *tp)
 
static void ns2_sns_st_configured_delete (struct osmo_fsm_inst *fi, struct ns2_sns_state *gss, struct tlv_parsed *tp)
 
static void ns2_sns_st_configured_change (struct osmo_fsm_inst *fi, struct ns2_sns_state *gss, struct tlv_parsed *tp)
 
static void ns2_sns_st_configured (struct osmo_fsm_inst *fi, uint32_t event, void *data)
 
static void ns2_sns_st_configured_onenter (struct osmo_fsm_inst *fi, uint32_t old_state)
 
static void ns2_sns_st_local_procedure_onenter (struct osmo_fsm_inst *fi, uint32_t old_state)
 
static void create_nsvc_for_new_sbind (struct ns2_sns_state *gss, struct ns2_sns_bind *sbind)
 
static void ns2_sns_st_local_procedure (struct osmo_fsm_inst *fi, uint32_t event, void *data)
 
static int ns2_sns_fsm_bss_timer_cb (struct osmo_fsm_inst *fi)
 
static struct gprs_ns_ie_ip4_elemns2_get_sbind_ip4_entry (struct ns2_sns_state *gss, struct ns2_sns_bind *sbind, struct ns2_sns_elems *endpoints)
 
static struct gprs_ns_ie_ip6_elemns2_get_sbind_ip6_entry (struct ns2_sns_state *gss, struct ns2_sns_bind *sbind, struct ns2_sns_elems *endpoints)
 
static int ns2_update_weight_entry (struct ns2_sns_state *gss, struct ns2_sns_bind *sbind, struct ns2_sns_elems *endpoints)
 
static void ns2_add_procedure (struct ns2_sns_state *gss, struct ns2_sns_bind *sbind, enum sns_procedure procedure_type)
 
static int ns2_sns_add_elements (struct ns2_sns_state *gss, struct ns2_sns_bind *sbind, struct ns2_sns_elems *elems)
 
static void ns2_sns_st_all_action (struct osmo_fsm_inst *fi, uint32_t event, void *data)
 
static int ns2_sns_bss_valid_configuration (struct ns2_sns_state *gss)
 
static void ns2_sns_st_all_action_bss (struct osmo_fsm_inst *fi, uint32_t event, void *data)
 
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_rx (struct gprs_ns2_vc *nsvc, struct msgb *msg, struct tlv_parsed *tp)
 main entry point for receiving SNS messages from the network. More...
 
static void vty_dump_sns_ip4 (struct vty *vty, const char *prefix, const struct gprs_ns_ie_ip4_elem *ip4)
 
static void vty_dump_sns_ip6 (struct vty *vty, const char *prefix, const struct gprs_ns_ie_ip6_elem *ip6)
 
void ns2_sns_dump_vty (struct vty *vty, const char *prefix, const struct gprs_ns2_nse *nse, bool stats)
 Dump the IP-SNS state to a vty. More...
 
void ns2_sns_write_vty (struct vty *vty, const struct gprs_ns2_nse *nse)
 write IP-SNS to a vty More...
 
static struct sns_endpointns2_get_sns_endpoint (struct ns2_sns_state *state, const struct osmo_sockaddr *saddr)
 
int gprs_ns2_sns_add_endpoint (struct gprs_ns2_nse *nse, const struct osmo_sockaddr *saddr)
 gprs_ns2_sns_add_endpoint More...
 
int gprs_ns2_sns_del_endpoint (struct gprs_ns2_nse *nse, const struct osmo_sockaddr *saddr)
 gprs_ns2_sns_del_endpoint More...
 
int gprs_ns2_sns_count (struct gprs_ns2_nse *nse)
 gprs_ns2_sns_count More...
 
void ns2_sns_notify_alive (struct gprs_ns2_nse *nse, struct gprs_ns2_vc *nsvc, bool alive)
 
int gprs_ns2_sns_add_bind (struct gprs_ns2_nse *nse, struct gprs_ns2_vc_bind *bind)
 
int gprs_ns2_sns_del_bind (struct gprs_ns2_nse *nse, struct gprs_ns2_vc_bind *bind)
 
void ns2_sns_update_weights (struct gprs_ns2_vc_bind *bind)
 
static void ns2_clear_sgsn (struct ns2_sns_state *gss, struct gprs_ns2_vc *size_nsvc)
 
static void ns2_sns_st_sgsn_unconfigured_onenter (struct osmo_fsm_inst *fi, uint32_t old_state)
 
static void ns2_sns_st_sgsn_unconfigured (struct osmo_fsm_inst *fi, uint32_t event, void *data)
 
static void ns2_sns_st_sgsn_wait_config (struct osmo_fsm_inst *fi, uint32_t event, void *data)
 
static void ns2_sns_st_sgsn_wait_config_ack_onenter (struct osmo_fsm_inst *fi, uint32_t old_state)
 
static void ns2_sns_st_sgsn_wait_config_ack (struct osmo_fsm_inst *fi, uint32_t event, void *data)
 
static int ns2_sns_fsm_sgsn_timer_cb (struct osmo_fsm_inst *fi)
 
static void ns2_sns_st_all_action_sgsn (struct osmo_fsm_inst *fi, uint32_t event, void *data)
 
struct osmo_fsm_instns2_sns_sgsn_fsm_alloc (struct gprs_ns2_nse *nse, const char *id)
 Allocate an IP-SNS FSM for the SGSN side. More...
 
static __attribute__ ((constructor))
 

Variables

static const struct value_string gprs_sns_event_names []
 
static const struct osmo_fsm_state ns2_sns_bss_states []
 
static struct osmo_fsm gprs_ns2_sns_bss_fsm
 
static const struct osmo_fsm_state ns2_sns_sgsn_states []
 
static struct osmo_fsm gprs_ns2_sns_sgsn_fsm
 

Detailed Description

NS Sub-Network Service Protocol implementation 3GPP TS 08.16 version 8.0.1 Release 1999 / ETSI TS 101 299 V8.0.1 (2002-05) as well as its successor 3GPP TS 48.016.

Macro Definition Documentation

◆ GPRS_SNS_FLAG_KEEP_SELECT_ENDPOINT_ORDER

#define GPRS_SNS_FLAG_KEEP_SELECT_ENDPOINT_ORDER   (void *) 1

◆ ip46_weight_sum_data

#define ip46_weight_sum_data (   elems)    ip46_weight_sum(elems, true)

◆ ip46_weight_sum_sig

#define ip46_weight_sum_sig (   elems)    ip46_weight_sum(elems, false)

◆ ip4_weight_sum_data

#define ip4_weight_sum_data (   elems)    ip4_weight_sum(elems, true)

◆ ip4_weight_sum_sig

#define ip4_weight_sum_sig (   elems)    ip4_weight_sum(elems, false)

◆ ip6_weight_sum_data

#define ip6_weight_sum_data (   elems)    ip6_weight_sum(elems, true)

◆ ip6_weight_sum_sig

#define ip6_weight_sum_sig (   elems)    ip6_weight_sum(elems, false)

◆ S

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

◆ sns_failed

#define sns_failed (   fi,
  reason 
)     _sns_failed(fi, reason, __FILE__, __LINE__)

Enumeration Type Documentation

◆ gprs_sns_bss_state

Enumerator
GPRS_SNS_ST_UNCONFIGURED 
GPRS_SNS_ST_BSS_SIZE 

SNS-SIZE procedure ongoing.

GPRS_SNS_ST_BSS_CONFIG_BSS 

SNS-CONFIG procedure (BSS->SGSN) ongoing.

GPRS_SNS_ST_BSS_CONFIG_SGSN 

SNS-CONFIG procedure (SGSN->BSS) ongoing.

GPRS_SNS_ST_CONFIGURED 
GPRS_SNS_ST_SGSN_WAIT_CONFIG 
GPRS_SNS_ST_SGSN_WAIT_CONFIG_ACK 
GPRS_SNS_ST_LOCAL_PROCEDURE 

in process of a ADD/DEL/CHANGE procedure towards SGSN (BSS->SGSN)

GPRS_SNS_ST_UNCONFIGURED 
GPRS_SNS_ST_SIZE 

SNS-SIZE procedure ongoing.

GPRS_SNS_ST_CONFIG_BSS 

SNS-CONFIG procedure (BSS->SGSN) ongoing.

GPRS_SNS_ST_CONFIG_SGSN 

SNS-CONFIG procedure (SGSN->BSS) ongoing.

GPRS_SNS_ST_CONFIGURED 

◆ ns2_sns_role

Enumerator
GPRS_SNS_ROLE_BSS 
GPRS_SNS_ROLE_SGSN 

◆ sns_procedure

Enumerator
SNS_PROC_NONE 

used as invalid/idle value

SNS_PROC_ADD 
SNS_PROC_DEL 
SNS_PROC_CHANGE_WEIGHT 

Function Documentation

◆ __attribute__()

static __attribute__ ( (constructor)  )
static

◆ _sns_failed()

◆ add_ip4_elem()

static int add_ip4_elem ( struct ns2_sns_state gss,
struct ns2_sns_elems elems,
const struct gprs_ns_ie_ip4_elem ip4 
)
static

◆ add_ip6_elem()

static int add_ip6_elem ( struct ns2_sns_state gss,
struct ns2_sns_elems elems,
const struct gprs_ns_ie_ip6_elem ip6 
)
static

◆ create_missing_nsvcs()

◆ create_nsvc_for_new_sbind()

◆ do_sns_add()

◆ do_sns_change_weight()

◆ do_sns_delete()

◆ gprs_ns2_nse_sns_remote()

const struct osmo_sockaddr * gprs_ns2_nse_sns_remote ( struct gprs_ns2_nse nse)

Return the initial SNS remote socket address.

Parameters
nseNS Entity
Returns
address of the initial SNS connection; NULL in case of error

References gprs_ns2_nse::bss_sns_fi, ns2_sns_state::initial, ns2_sns_state::nse, osmo_fsm_inst::priv, and sns_endpoint::saddr.

◆ gprs_ns2_sns_add_bind()

◆ gprs_ns2_sns_add_endpoint()

◆ gprs_ns2_sns_count()

int gprs_ns2_sns_count ( struct gprs_ns2_nse nse)

gprs_ns2_sns_count

Parameters
[in]nseNS Entity whose IP-SNS endpoints shall be printed
Returns
the count of endpoints or < 0 if NSE doesn't contain sns.

References gprs_ns2_nse::bss_sns_fi, gprs_ns2_nse::dialect, GPRS_NS2_DIALECT_SNS, GPRS_NS2_LL_UDP, list, gprs_ns2_nse::ll, llist_for_each_entry, osmo_fsm_inst::priv, and ns2_sns_state::sns_endpoints.

Referenced by vty_nse_check_sns().

◆ gprs_ns2_sns_del_bind()

◆ gprs_ns2_sns_del_endpoint()

int gprs_ns2_sns_del_endpoint ( struct gprs_ns2_nse nse,
const struct osmo_sockaddr saddr 
)

◆ ip46_weight_sum()

static int ip46_weight_sum ( const struct ns2_sns_elems elems,
bool  data_weight 
)
static

◆ ip4_weight_sum()

static int ip4_weight_sum ( const struct ns2_sns_elems elems,
bool  data_weight 
)
static

◆ ip6_weight_sum()

static int ip6_weight_sum ( const struct ns2_sns_elems elems,
bool  data_weight 
)
static

◆ ns2_add_procedure()

◆ ns2_clear_elems()

◆ ns2_clear_procedures()

◆ ns2_clear_sgsn()

◆ ns2_get_sbind_ip4_entry()

◆ ns2_get_sbind_ip6_entry()

◆ ns2_get_sns_endpoint()

static struct sns_endpoint * ns2_get_sns_endpoint ( struct ns2_sns_state state,
const struct osmo_sockaddr saddr 
)
static

◆ ns2_nsvc_create_ip4()

◆ ns2_nsvc_create_ip6()

◆ ns2_sns_add_elements()

◆ ns2_sns_bss_fsm_alloc()

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

◆ ns2_sns_bss_valid_configuration()

◆ ns2_sns_choose_next_bind()

static void ns2_sns_choose_next_bind ( struct ns2_sns_state gss)
static

◆ ns2_sns_compute_local_ep_from_binds()

◆ ns2_sns_copy_local_endpoints()

◆ ns2_sns_count_num_local_ep()

static int ns2_sns_count_num_local_ep ( struct osmo_fsm_inst fi,
int  ip_proto 
)
static

◆ ns2_sns_dump_vty()

void ns2_sns_dump_vty ( struct vty vty,
const char *  prefix,
const struct gprs_ns2_nse nse,
bool  stats 
)

Dump the IP-SNS state to a vty.

Parameters
[in]vtyVTY to which the state shall be printed
[in]prefixprefix to print at start of each line (typically indenting)
[in]nseNS Entity whose IP-SNS state shall be printed
[in]statsWhether or not statistics shall also be printed

References gprs_ns2_nse::bss_sns_fi, ns2_sns_elems::ip4, ns2_sns_elems::ip6, ns2_sns_state::local, ns2_sns_state::nse, ns2_sns_elems::num_ip4, ns2_sns_elems::num_ip6, ns2_sns_state::num_max_ip4_remote, ns2_sns_state::num_max_ip6_remote, ns2_sns_state::num_max_nsvcs, osmo_fsm_inst::priv, ns2_sns_state::remote, vty_dump_sns_ip4(), vty_dump_sns_ip6(), VTY_NEWLINE, vty_out(), and vty_out_fsm_inst2().

Referenced by dump_nse().

◆ ns2_sns_fsm_bss_timer_cb()

◆ ns2_sns_fsm_sgsn_timer_cb()

◆ ns2_sns_notify_alive()

◆ ns2_sns_replace_nsvc()

◆ ns2_sns_rx()

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

◆ ns2_sns_sgsn_fsm_alloc()

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

Allocate an IP-SNS FSM for the SGSN side.

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

References ns2_sns_state::binds, gprs_ns2_sns_sgsn_fsm, GPRS_SNS_ROLE_SGSN, INIT_LLIST_HEAD, LOGL_DEBUG, ns2_sns_state::nse, osmo_fsm_inst_alloc(), osmo_fsm_inst_term, OSMO_FSM_TERM_ERROR, osmo_fsm_inst::priv, ns2_sns_state::procedures, ns2_sns_state::role, and ns2_sns_state::sns_endpoints.

Referenced by ns2_nse_set_dialect().

◆ 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_bss_onenter()

◆ ns2_sns_st_bss_config_sgsn()

◆ ns2_sns_st_bss_config_sgsn_onenter()

static void ns2_sns_st_bss_config_sgsn_onenter ( struct osmo_fsm_inst fi,
uint32_t  old_state 
)
static

◆ ns2_sns_st_bss_size()

◆ ns2_sns_st_bss_size_onenter()

◆ ns2_sns_st_bss_unconfigured()

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

◆ ns2_sns_st_configured()

◆ ns2_sns_st_configured_add()

◆ ns2_sns_st_configured_change()

◆ ns2_sns_st_configured_delete()

◆ ns2_sns_st_configured_onenter()

◆ ns2_sns_st_local_procedure()

◆ ns2_sns_st_local_procedure_onenter()

◆ ns2_sns_st_sgsn_unconfigured()

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

◆ ns2_sns_st_sgsn_unconfigured_onenter()

static void ns2_sns_st_sgsn_unconfigured_onenter ( struct osmo_fsm_inst fi,
uint32_t  old_state 
)
static

◆ ns2_sns_st_sgsn_wait_config()

◆ ns2_sns_st_sgsn_wait_config_ack()

◆ ns2_sns_st_sgsn_wait_config_ack_onenter()

◆ ns2_sns_update_weights()

◆ ns2_sns_write_vty()

void ns2_sns_write_vty ( struct vty vty,
const struct gprs_ns2_nse nse 
)

write IP-SNS to a vty

Parameters
[in]vtyVTY to which the state shall be printed
[in]nseNS Entity whose IP-SNS state shall be printed

References gprs_ns2_nse::bss_sns_fi, osmo_sockaddr_str::ip, list, llist_for_each_entry, ns2_sns_state::nse, osmo_sockaddr_str_from_sockaddr(), osmo_sockaddr_str::port, osmo_fsm_inst::priv, sns_endpoint::saddr, osmo_sockaddr::sas, ns2_sns_state::sns_endpoints, osmo_sockaddr::u, VTY_NEWLINE, and vty_out().

Referenced by _config_write_ns_nse().

◆ ns2_update_weight_entry()

◆ ns2_vc_create_ip()

static void ns2_vc_create_ip ( struct osmo_fsm_inst fi,
struct gprs_ns2_nse nse,
const struct osmo_sockaddr remote,
uint8_t  sig_weight,
uint8_t  data_weight 
)
static

◆ ns_sns_append_remote_eps()

◆ ns_sns_configured_timeout()

static int ns_sns_configured_timeout ( struct osmo_fsm_inst fi)
inlinestatic

◆ nse_inst_from_fi()

◆ nsvc_by_ip4_elem()

static struct gprs_ns2_vc * nsvc_by_ip4_elem ( struct gprs_ns2_nse nse,
const struct gprs_ns_ie_ip4_elem ip4 
)
static

◆ nsvc_by_ip6_elem()

static struct gprs_ns2_vc * nsvc_by_ip6_elem ( struct gprs_ns2_nse nse,
const struct gprs_ns_ie_ip6_elem ip6 
)
static

◆ nsvc_for_bind_and_remote()

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

◆ remove_bind_elem()

◆ remove_ip4_elem()

static int remove_ip4_elem ( struct ns2_sns_state gss,
struct ns2_sns_elems elems,
const struct gprs_ns_ie_ip4_elem ip4 
)
static

◆ remove_ip6_elem()

static int remove_ip6_elem ( struct ns2_sns_state gss,
struct ns2_sns_elems elems,
const struct gprs_ns_ie_ip6_elem ip6 
)
static

◆ update_ip4_elem()

◆ update_ip6_elem()

◆ vty_dump_sns_ip4()

static void vty_dump_sns_ip4 ( struct vty vty,
const char *  prefix,
const struct gprs_ns_ie_ip4_elem ip4 
)
static

◆ vty_dump_sns_ip6()

static void vty_dump_sns_ip6 ( struct vty vty,
const char *  prefix,
const struct gprs_ns_ie_ip6_elem ip6 
)
static

Variable Documentation

◆ gprs_ns2_sns_bss_fsm

struct osmo_fsm gprs_ns2_sns_bss_fsm
static
Initial value:
= {
.name = "GPRS-NS2-SNS-BSS",
.states = ns2_sns_bss_states,
.allstate_event_mask = S(NS2_SNS_EV_REQ_NO_NSVC) |
.allstate_action = ns2_sns_st_all_action_bss,
.cleanup = NULL,
.event_names = gprs_sns_event_names,
.pre_term = NULL,
.log_subsys = DLNS,
}
@ NS2_SNS_EV_REQ_ADD_BIND
add a new local bind to this NSE
Definition: gprs_ns2_internal.h:365
@ NS2_SNS_EV_REQ_NO_NSVC
no more NS-VC remaining (all dead)
Definition: gprs_ns2_internal.h:362
@ NS2_SNS_EV_REQ_FREE_NSVCS
free all NS-VCs
Definition: gprs_ns2_internal.h:363
@ NS2_SNS_EV_REQ_CHANGE_WEIGHT
a bind changed its weight
Definition: gprs_ns2_internal.h:367
@ NS2_SNS_EV_REQ_DELETE_BIND
remove a local bind from this NSE
Definition: gprs_ns2_internal.h:366
@ NS2_SNS_EV_REQ_SELECT_ENDPOINT
Select a SNS endpoint from the list.
Definition: gprs_ns2_internal.h:352
static int ns2_sns_fsm_bss_timer_cb(struct osmo_fsm_inst *fi)
Definition: gprs_ns2_sns.c:1771
static const struct value_string gprs_sns_event_names[]
Definition: gprs_ns2_sns.c:76
static void ns2_sns_st_all_action_bss(struct osmo_fsm_inst *fi, uint32_t event, void *data)
Definition: gprs_ns2_sns.c:2199
static const struct osmo_fsm_state ns2_sns_bss_states[]
Definition: gprs_ns2_sns.c:1704
#define S(x)
Definition: gprs_ns2_sns.c:57
#define DLNS
#define ARRAY_SIZE(x)

Referenced by __attribute__(), and ns2_sns_bss_fsm_alloc().

◆ gprs_ns2_sns_sgsn_fsm

struct osmo_fsm gprs_ns2_sns_sgsn_fsm
static
Initial value:
= {
.name = "GPRS-NS2-SNS-SGSN",
.allstate_event_mask = S(NS2_SNS_EV_RX_SIZE) |
.allstate_action = ns2_sns_st_all_action_sgsn,
.cleanup = NULL,
.event_names = gprs_sns_event_names,
.pre_term = NULL,
.log_subsys = DLNS,
}
@ NS2_SNS_EV_RX_SIZE
Definition: gprs_ns2_internal.h:353
static int ns2_sns_fsm_sgsn_timer_cb(struct osmo_fsm_inst *fi)
Definition: gprs_ns2_sns.c:2914
static const struct osmo_fsm_state ns2_sns_sgsn_states[]
Definition: gprs_ns2_sns.c:2856
static void ns2_sns_st_all_action_sgsn(struct osmo_fsm_inst *fi, uint32_t event, void *data)
Definition: gprs_ns2_sns.c:2947

Referenced by __attribute__(), and ns2_sns_sgsn_fsm_alloc().

◆ gprs_sns_event_names

const struct value_string gprs_sns_event_names[]
static
Initial value:
= {
{ NS2_SNS_EV_REQ_SELECT_ENDPOINT, "REQ_SELECT_ENDPOINT" },
{ NS2_SNS_EV_RX_SIZE, "RX_SIZE" },
{ NS2_SNS_EV_RX_SIZE_ACK, "RX_SIZE_ACK" },
{ NS2_SNS_EV_RX_CONFIG, "RX_CONFIG" },
{ NS2_SNS_EV_RX_CONFIG_END, "RX_CONFIG_END" },
{ NS2_SNS_EV_RX_CONFIG_ACK, "RX_CONFIG_ACK" },
{ NS2_SNS_EV_RX_ADD, "RX_ADD" },
{ NS2_SNS_EV_RX_DELETE, "RX_DELETE" },
{ NS2_SNS_EV_RX_ACK, "RX_ACK" },
{ NS2_SNS_EV_RX_CHANGE_WEIGHT, "RX_CHANGE_WEIGHT" },
{ NS2_SNS_EV_REQ_NO_NSVC, "REQ_NO_NSVC" },
{ NS2_SNS_EV_REQ_FREE_NSVCS, "REQ_FREE_NSVCS" },
{ NS2_SNS_EV_REQ_NSVC_ALIVE, "REQ_NSVC_ALIVE"},
{ NS2_SNS_EV_REQ_ADD_BIND, "REQ_ADD_BIND"},
{ NS2_SNS_EV_REQ_DELETE_BIND, "REQ_DELETE_BIND"},
{ NS2_SNS_EV_REQ_CHANGE_WEIGHT, "REQ_CHANGE_WEIGHT"},
{ 0, NULL }
}
@ NS2_SNS_EV_REQ_NSVC_ALIVE
a NS-VC became alive
Definition: gprs_ns2_internal.h:364
@ NS2_SNS_EV_RX_CONFIG
Definition: gprs_ns2_internal.h:355
@ NS2_SNS_EV_RX_DELETE
Definition: gprs_ns2_internal.h:359
@ NS2_SNS_EV_RX_CONFIG_ACK
Definition: gprs_ns2_internal.h:357
@ NS2_SNS_EV_RX_ADD
Definition: gprs_ns2_internal.h:358
@ NS2_SNS_EV_RX_CONFIG_END
SNS-CONFIG with end flag received.
Definition: gprs_ns2_internal.h:356
@ NS2_SNS_EV_RX_ACK
Rx of SNS-ACK (response to ADD/DELETE/CHG_WEIGHT.
Definition: gprs_ns2_internal.h:361
@ NS2_SNS_EV_RX_SIZE_ACK
Definition: gprs_ns2_internal.h:354
@ NS2_SNS_EV_RX_CHANGE_WEIGHT
Definition: gprs_ns2_internal.h:360

◆ ns2_sns_bss_states

const struct osmo_fsm_state ns2_sns_bss_states[]
static

◆ ns2_sns_sgsn_states

const struct osmo_fsm_state ns2_sns_sgsn_states[]
static