Loading...
Searching...
No Matches
gprs_ns2.h
Go to the documentation of this file.
#pragma once
#include <stdint.h>
#include <netinet/in.h>
#include <osmocom/core/prim.h>
#include <osmocom/gprs/protocol/gsm_08_16.h>
#include <osmocom/gprs/frame_relay.h>
struct osmo_sockaddr;
struct osmo_sockaddr_str;
struct osmo_fr_network;
struct gprs_ns2_inst;
struct gprs_ns2_nse;
struct gprs_ns2_vc;
struct gprs_ns2_vc_bind;
struct gprs_ns2_vc_driver;
struct gprs_ns_ie_ip4_elem;
struct gprs_ns_ie_ip6_elem;
enum gprs_ns2_vc_mode {
GPRS_NS2_VC_MODE_BLOCKRESET,
GPRS_NS2_VC_MODE_ALIVE,
};
enum gprs_ns2_dialect {
GPRS_NS2_DIALECT_UNDEF,
GPRS_NS2_DIALECT_STATIC_ALIVE,
GPRS_NS2_DIALECT_STATIC_RESETBLOCK,
GPRS_NS2_DIALECT_IPACCESS,
GPRS_NS2_DIALECT_SNS,
};
enum gprs_ns2_ll {
GPRS_NS2_LL_UNDEF,
GPRS_NS2_LL_UDP,
GPRS_NS2_LL_FR,
GPRS_NS2_LL_FR_GRE,
};
enum gprs_ns2_prim {
GPRS_NS2_PRIM_UNIT_DATA,
GPRS_NS2_PRIM_CONGESTION,
GPRS_NS2_PRIM_STATUS,
};
extern const struct value_string gprs_ns2_prim_strs[];
extern const struct value_string gprs_ns2_lltype_strs[];
static inline const char *gprs_ns2_prim_str(enum gprs_ns2_prim val)
{ return get_value_string(gprs_ns2_prim_strs, val); }
static inline const char *gprs_ns2_lltype_str(enum gprs_ns2_ll val)
{ return get_value_string(gprs_ns2_lltype_strs, val); }
enum gprs_ns2_congestion_cause {
GPRS_NS2_CONG_CAUSE_BACKWARD_BEGIN,
GPRS_NS2_CONG_CAUSE_BACKWARD_END,
GPRS_NS2_CONG_CAUSE_FORWARD_BEGIN,
GPRS_NS2_CONG_CAUSE_FORWARD_END,
};
enum gprs_ns2_affecting_cause {
GPRS_NS2_AFF_CAUSE_VC_FAILURE,
GPRS_NS2_AFF_CAUSE_VC_RECOVERY,
GPRS_NS2_AFF_CAUSE_FAILURE,
GPRS_NS2_AFF_CAUSE_RECOVERY,
/* osmocom own causes */
GPRS_NS2_AFF_CAUSE_SNS_CONFIGURED,
GPRS_NS2_AFF_CAUSE_SNS_FAILURE,
GPRS_NS2_AFF_CAUSE_SNS_NO_ENDPOINTS,
GPRS_NS2_AFF_CAUSE_MTU_CHANGE,
};
extern const struct value_string gprs_ns2_aff_cause_prim_strs[];
static inline const char *gprs_ns2_aff_cause_prim_str(enum gprs_ns2_affecting_cause val)
{ return get_value_string(gprs_ns2_aff_cause_prim_strs, val); }
enum gprs_ns2_change_ip_endpoint {
GRPS_NS2_ENDPOINT_NO_CHANGE,
GPRS_NS2_ENDPOINT_REQUEST_CHANGE,
GPRS_NS2_ENDPOINT_CONFIRM_CHANGE,
};
extern const struct value_string gprs_ns2_cause_strs[];
static inline const char *gprs_ns2_cause_str(enum ns_cause val)
{ return get_value_string(gprs_ns2_cause_strs, val); }
struct osmo_gprs_ns2_prim {
struct osmo_prim_hdr oph;
uint16_t nsei;
uint16_t bvci;
union {
struct {
enum gprs_ns2_change_ip_endpoint change;
uint32_t link_selector;
/* TODO: implement resource distribution
* add place holder for the link selector */
long long _resource_distribution_placeholder1;
long long _resource_distribution_placeholder2;
long long _resource_distribution_placeholder3;
} unitdata;
struct {
enum gprs_ns2_congestion_cause cause;
} congestion;
struct {
enum gprs_ns2_affecting_cause cause;
char *nsvc;
/* 48.016 5.2.2.6 transfer capability */
int transfer;
/* osmocom specific */
/* Persistent NSE/NSVC are configured by vty */
bool persistent;
/* Only true on the first time it's available.
* Allow the BSSGP layer to reset persistent NSE */
bool first;
/* MTU of a NS SDU. It's the lowest MTU of all (alive & dead) NSVCs */
uint16_t mtu;
} status;
} u;
};
/* instance */
struct gprs_ns2_inst *gprs_ns2_instantiate(void *ctx, osmo_prim_cb cb, void *cb_data);
void gprs_ns2_free(struct gprs_ns2_inst *inst);
/* Entrypoint for primitives from the NS USER */
int gprs_ns2_recv_prim(struct gprs_ns2_inst *nsi, struct osmo_prim_hdr *oph);
typedef int (*gprs_ns2_foreach_nsvc_cb)(struct gprs_ns2_vc *nsvc, void *ctx);
int gprs_ns2_nse_foreach_nsvc(struct gprs_ns2_nse *nse,
gprs_ns2_foreach_nsvc_cb cb, void *cb_data);
struct gprs_ns2_nse *gprs_ns2_nse_by_nsei(struct gprs_ns2_inst *nsi, uint16_t nsei);
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);
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 local_sgsn_role);
uint16_t gprs_ns2_nse_nsei(struct gprs_ns2_nse *nse);
void gprs_ns2_free_nse(struct gprs_ns2_nse *nse);
void gprs_ns2_free_nses(struct gprs_ns2_inst *nsi);
/* create vc */
void gprs_ns2_free_nsvc(struct gprs_ns2_vc *nsvc);
void gprs_ns2_free_nsvcs(struct gprs_ns2_nse *nse);
struct gprs_ns2_vc *gprs_ns2_nsvc_by_nsvci(struct gprs_ns2_inst *nsi, uint16_t nsvci);
/* generic VL driver */
struct gprs_ns2_vc_bind *gprs_ns2_bind_by_name(struct gprs_ns2_inst *nsi,
const char *name);
/* IP VL driver */
int gprs_ns2_ip_bind(struct gprs_ns2_inst *nsi,
const char *name,
const struct osmo_sockaddr *local,
int dscp,
struct gprs_ns2_vc_bind **result);
struct gprs_ns2_vc_bind *gprs_ns2_ip_bind_by_sockaddr(struct gprs_ns2_inst *nsi,
const struct osmo_sockaddr *sockaddr);
/* FR VL driver */
struct gprs_ns2_vc_bind *gprs_ns2_fr_bind_by_netif(
struct gprs_ns2_inst *nsi,
const char *netif);
const char *gprs_ns2_fr_bind_netif(struct gprs_ns2_vc_bind *bind);
enum osmo_fr_role gprs_ns2_fr_bind_role(struct gprs_ns2_vc_bind *bind);
int gprs_ns2_fr_bind(struct gprs_ns2_inst *nsi,
const char *name,
const char *netif,
struct osmo_fr_network *fr_network,
enum osmo_fr_role fr_role,
struct gprs_ns2_vc_bind **result);
int gprs_ns2_is_fr_bind(struct gprs_ns2_vc_bind *bind);
struct gprs_ns2_vc *gprs_ns2_fr_nsvc_by_dlci(struct gprs_ns2_vc_bind *bind, uint16_t dlci);
struct gprs_ns2_vc *gprs_ns2_fr_connect(struct gprs_ns2_vc_bind *bind,
struct gprs_ns2_nse *nse,
uint16_t nsvci,
uint16_t dlci);
struct gprs_ns2_vc *gprs_ns2_fr_connect2(struct gprs_ns2_vc_bind *bind,
uint16_t nsei,
uint16_t nsvci,
uint16_t dlci);
/* create a VC connection */
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);
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);
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);
void gprs_ns2_ip_bind_set_sns_weight(struct gprs_ns2_vc_bind *bind,
uint8_t signalling, uint8_t data);
void gprs_ns2_free_bind(struct gprs_ns2_vc_bind *bind);
void gprs_ns2_free_binds(struct gprs_ns2_inst *nsi);
/* create a VC SNS connection */
int gprs_ns2_sns_count(struct gprs_ns2_nse *nse);
int gprs_ns2_sns_add_endpoint(struct gprs_ns2_nse *nse,
const struct osmo_sockaddr *saddr);
int gprs_ns2_sns_del_endpoint(struct gprs_ns2_nse *nse,
const struct osmo_sockaddr *saddr);
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);
const struct osmo_sockaddr *gprs_ns2_nse_sns_remote(struct gprs_ns2_nse *nse);
const struct osmo_sockaddr *gprs_ns2_ip_vc_remote(const struct gprs_ns2_vc *nsvc);
const struct osmo_sockaddr *gprs_ns2_ip_vc_local(const struct gprs_ns2_vc *nsvc);
bool gprs_ns2_ip_vc_equal(const struct gprs_ns2_vc *nsvc,
const struct osmo_sockaddr *local,
const struct osmo_sockaddr *remote,
uint16_t nsvci);
const struct osmo_sockaddr *gprs_ns2_ip_bind_sockaddr(struct gprs_ns2_vc_bind *bind);
int gprs_ns2_is_ip_bind(struct gprs_ns2_vc_bind *bind);
int gprs_ns2_ip_bind_set_dscp(struct gprs_ns2_vc_bind *bind, int dscp);
int gprs_ns2_ip_bind_set_priority(struct gprs_ns2_vc_bind *bind, uint8_t priority);
struct gprs_ns2_vc *gprs_ns2_nsvc_by_sockaddr_bind(
struct gprs_ns2_vc_bind *bind,
const struct osmo_sockaddr *rem_addr);
int gprs_ns2_frgre_bind(struct gprs_ns2_inst *nsi,
const char *name,
const struct osmo_sockaddr *local,
int dscp,
struct gprs_ns2_vc_bind **result);
int gprs_ns2_is_frgre_bind(struct gprs_ns2_vc_bind *bind);
uint16_t gprs_ns2_fr_nsvc_dlci(const struct gprs_ns2_vc *nsvc);
struct gprs_ns2_vc *gprs_ns2_nsvc_by_sockaddr_nse(
struct gprs_ns2_nse *nse,
const struct osmo_sockaddr *sockaddr);
void gprs_ns2_start_alive_all_nsvcs(struct gprs_ns2_nse *nse);
/* VC information */
const char *gprs_ns2_ll_str(struct gprs_ns2_vc *nsvc);
char *gprs_ns2_ll_str_buf(char *buf, size_t buf_len, struct gprs_ns2_vc *nsvc);
char *gprs_ns2_ll_str_c(const void *ctx, struct gprs_ns2_vc *nsvc);
const char *gprs_ns2_nsvc_state_name(struct gprs_ns2_vc *nsvc);
/* vty */
int gprs_ns2_vty_init(struct gprs_ns2_inst *nsi);
frame_relay.h
osmo_fr_role
osmo_fr_role
Definition frame_relay.h:38
nsei
uint16_t nsei
Identifiers of a BTS, equal to 'struct bssgp_bts_ctx'.
Definition gprs_msgb.h:7
gprs_ns2_is_frgre_bind
int gprs_ns2_is_frgre_bind(struct gprs_ns2_vc_bind *bind)
determine if given bind is for FR-GRE encapsulation.
Definition gprs_ns2_frgre.c:543
gprs_ns2_fr_bind_by_netif
struct gprs_ns2_vc_bind * gprs_ns2_fr_bind_by_netif(struct gprs_ns2_inst *nsi, const char *netif)
Find NS bind for a given network interface.
Definition gprs_ns2_fr.c:849
gprs_ns2_is_ip_bind
int gprs_ns2_is_ip_bind(struct gprs_ns2_vc_bind *bind)
Is the given bind an IP bind?
Definition gprs_ns2_udp.c:476
gprs_ns2_ip_bind_set_priority
int gprs_ns2_ip_bind_set_priority(struct gprs_ns2_vc_bind *bind, uint8_t priority)
Set the socket priority of the given bind.
Definition gprs_ns2_udp.c:507
gprs_ns2_aff_cause_prim_str
static const char * gprs_ns2_aff_cause_prim_str(enum gprs_ns2_affecting_cause val)
Obtain a human-readable string for NS affecting cause in primitives.
Definition gprs_ns2.h:93
gprs_ns2_cause_str
static const char * gprs_ns2_cause_str(enum ns_cause val)
Obtain a human-readable string for NS primitives.
Definition gprs_ns2.h:106
gprs_ns2_ip_bind_sockaddr
const struct osmo_sockaddr * gprs_ns2_ip_bind_sockaddr(struct gprs_ns2_vc_bind *bind)
Return the locally bound socket address of the bind.
Definition gprs_ns2_udp.c:466
gprs_ns2_ip_bind_by_sockaddr
struct gprs_ns2_vc_bind * gprs_ns2_ip_bind_by_sockaddr(struct gprs_ns2_inst *nsi, const struct osmo_sockaddr *sockaddr)
Find NS bind for a given socket address.
Definition gprs_ns2_udp.c:250
gprs_ns2_fr_bind_netif
const char * gprs_ns2_fr_bind_netif(struct gprs_ns2_vc_bind *bind)
Return the network interface of the bind.
Definition gprs_ns2_fr.c:833
gprs_ns2_fr_connect2
struct gprs_ns2_vc * gprs_ns2_fr_connect2(struct gprs_ns2_vc_bind *bind, uint16_t nsei, uint16_t nsvci, uint16_t dlci)
Create, connect and activate a new FR-based NS-VC.
Definition gprs_ns2_fr.c:919
gprs_ns2_prim_str
static const char * gprs_ns2_prim_str(enum gprs_ns2_prim val)
Obtain a human-readable string for NS primitives.
Definition gprs_ns2.h:62
gprs_ns2_ip_bind_set_sns_weight
void gprs_ns2_ip_bind_set_sns_weight(struct gprs_ns2_vc_bind *bind, uint8_t signalling, uint8_t data)
set the signalling and data weight for this bind
Definition gprs_ns2_udp.c:591
gprs_ns2_vc_mode
gprs_ns2_vc_mode
Definition gprs_ns2.h:25
GPRS_NS2_VC_MODE_BLOCKRESET
@ GPRS_NS2_VC_MODE_BLOCKRESET
The VC will use RESET/BLOCK/UNBLOCK to start the connection and do ALIVE/ACK.
Definition gprs_ns2.h:29
GPRS_NS2_VC_MODE_ALIVE
@ GPRS_NS2_VC_MODE_ALIVE
The VC will only use ALIVE/ACK (no RESET/BLOCK/UNBLOCK), which is for Gb-IP interface compliant to 3G...
Definition gprs_ns2.h:32
gprs_ns2_fr_nsvc_by_dlci
struct gprs_ns2_vc * gprs_ns2_fr_nsvc_by_dlci(struct gprs_ns2_vc_bind *bind, uint16_t dlci)
Return the nsvc by dlci.
Definition gprs_ns2_fr.c:955
gprs_ns2_foreach_nsvc_cb
int(* gprs_ns2_foreach_nsvc_cb)(struct gprs_ns2_vc *nsvc, void *ctx)
a callback to iterate over all NSVC
Definition gprs_ns2.h:153
gprs_ns2_fr_bind
int gprs_ns2_fr_bind(struct gprs_ns2_inst *nsi, const char *name, const char *netif, struct osmo_fr_network *fr_network, enum osmo_fr_role fr_role, struct gprs_ns2_vc_bind **result)
Create a new bind for NS over FR.
Definition gprs_ns2_fr.c:703
gprs_ns2_vty_init
int gprs_ns2_vty_init(struct gprs_ns2_inst *nsi)
Definition gprs_ns2_vty.c:2306
gprs_ns2_fr_nsvc_dlci
uint16_t gprs_ns2_fr_nsvc_dlci(const struct gprs_ns2_vc *nsvc)
Return the dlci of the nsvc.
Definition gprs_ns2_fr.c:976
gprs_ns2_fr_connect
struct gprs_ns2_vc * gprs_ns2_fr_connect(struct gprs_ns2_vc_bind *bind, struct gprs_ns2_nse *nse, uint16_t nsvci, uint16_t dlci)
Create, connect and activate a new FR-based NS-VC.
Definition gprs_ns2_fr.c:876
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.
Definition gprs_ns2_sns.c:286
gprs_ns2_is_fr_bind
int gprs_ns2_is_fr_bind(struct gprs_ns2_vc_bind *bind)
determine if given bind is for FR-GRE encapsulation.
Definition gprs_ns2_fr.c:326
gprs_ns2_frgre_bind
int gprs_ns2_frgre_bind(struct gprs_ns2_inst *nsi, const char *name, const struct osmo_sockaddr *local, int dscp, struct gprs_ns2_vc_bind **result)
Create a new bind for NS over FR-GRE.
Definition gprs_ns2_frgre.c:554
gprs_ns2_ip_vc_remote
const struct osmo_sockaddr * gprs_ns2_ip_vc_remote(const struct gprs_ns2_vc *nsvc)
Return the socket address of the remote peer of a NS-VC.
Definition gprs_ns2_udp.c:418
gprs_ns2_prim
gprs_ns2_prim
Osmocom NS primitives according to 48.016 5.2 Service primitives.
Definition gprs_ns2.h:52
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
gprs_ns2_congestion_cause
gprs_ns2_congestion_cause
Osmocom NS primitives according to 48.016 5.2.2.4 Service primitives.
Definition gprs_ns2.h:70
GPRS_NS2_CONG_CAUSE_BACKWARD_BEGIN
@ GPRS_NS2_CONG_CAUSE_BACKWARD_BEGIN
Definition gprs_ns2.h:71
GPRS_NS2_CONG_CAUSE_BACKWARD_END
@ GPRS_NS2_CONG_CAUSE_BACKWARD_END
Definition gprs_ns2.h:72
GPRS_NS2_CONG_CAUSE_FORWARD_END
@ GPRS_NS2_CONG_CAUSE_FORWARD_END
Definition gprs_ns2.h:74
GPRS_NS2_CONG_CAUSE_FORWARD_BEGIN
@ GPRS_NS2_CONG_CAUSE_FORWARD_BEGIN
Definition gprs_ns2.h:73
gprs_ns2_sns_add_endpoint
int gprs_ns2_sns_add_endpoint(struct gprs_ns2_nse *nse, const struct osmo_sockaddr *saddr)
gprs_ns2_sns_add_endpoint
Definition gprs_ns2_sns.c:2483
gprs_ns2_ip_vc_local
const struct osmo_sockaddr * gprs_ns2_ip_vc_local(const struct gprs_ns2_vc *nsvc)
Return the socket address of the local peer of a NS-VC.
Definition gprs_ns2_udp.c:404
gprs_ns2_affecting_cause
gprs_ns2_affecting_cause
Osmocom NS primitives according to 48.016 5.2.2.6 Service primitives.
Definition gprs_ns2.h:78
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
gprs_ns2_fr_bind_role
enum osmo_fr_role gprs_ns2_fr_bind_role(struct gprs_ns2_vc_bind *bind)
Return the frame relay role of a bind.
Definition gprs_ns2_fr.c:818
gprs_ns2_ip_bind_set_dscp
int gprs_ns2_ip_bind_set_dscp(struct gprs_ns2_vc_bind *bind, int dscp)
Set the DSCP (TOS) bit value of the given bind.
Definition gprs_ns2_udp.c:482
gprs_ns2_ll
gprs_ns2_ll
Osmocom NS link layer types.
Definition gprs_ns2.h:44
GPRS_NS2_LL_FR
@ GPRS_NS2_LL_FR
NS/FR.
Definition gprs_ns2.h:47
GPRS_NS2_LL_UNDEF
@ GPRS_NS2_LL_UNDEF
undefined, used by vty
Definition gprs_ns2.h:45
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
gprs_ns2_nsvc_by_sockaddr_bind
struct gprs_ns2_vc * gprs_ns2_nsvc_by_sockaddr_bind(struct gprs_ns2_vc_bind *bind, const struct osmo_sockaddr *rem_addr)
Find a NS-VC by its remote socket address.
Definition gprs_ns2_udp.c:125
gprs_ns2_sns_del_bind
int gprs_ns2_sns_del_bind(struct gprs_ns2_nse *nse, struct gprs_ns2_vc_bind *bind)
Definition gprs_ns2_sns.c:2685
gprs_ns2_change_ip_endpoint
gprs_ns2_change_ip_endpoint
Osmocom NS primitives according to 48.016 5.2.2.7 Service primitives.
Definition gprs_ns2.h:97
GPRS_NS2_ENDPOINT_REQUEST_CHANGE
@ GPRS_NS2_ENDPOINT_REQUEST_CHANGE
Definition gprs_ns2.h:99
GRPS_NS2_ENDPOINT_NO_CHANGE
@ GRPS_NS2_ENDPOINT_NO_CHANGE
Definition gprs_ns2.h:98
GPRS_NS2_ENDPOINT_CONFIRM_CHANGE
@ GPRS_NS2_ENDPOINT_CONFIRM_CHANGE
Definition gprs_ns2.h:100
gprs_ns2_sns_add_bind
int gprs_ns2_sns_add_bind(struct gprs_ns2_nse *nse, struct gprs_ns2_vc_bind *bind)
Definition gprs_ns2_sns.c:2654
gprs_ns2_ip_vc_equal
bool gprs_ns2_ip_vc_equal(const struct gprs_ns2_vc *nsvc, const struct osmo_sockaddr *local, const struct osmo_sockaddr *remote, uint16_t nsvci)
Compare the NS-VC with the given parameter.
Definition gprs_ns2_udp.c:436
gprs_ns2_sns_count
int gprs_ns2_sns_count(struct gprs_ns2_nse *nse)
gprs_ns2_sns_count
Definition gprs_ns2_sns.c:2576
gprs_ns2_dialect
gprs_ns2_dialect
Definition gprs_ns2.h:35
GPRS_NS2_DIALECT_IPACCESS
@ GPRS_NS2_DIALECT_IPACCESS
Definition gprs_ns2.h:39
GPRS_NS2_DIALECT_STATIC_RESETBLOCK
@ GPRS_NS2_DIALECT_STATIC_RESETBLOCK
Definition gprs_ns2.h:38
GPRS_NS2_DIALECT_STATIC_ALIVE
@ GPRS_NS2_DIALECT_STATIC_ALIVE
Definition gprs_ns2.h:37
GPRS_NS2_DIALECT_UNDEF
@ GPRS_NS2_DIALECT_UNDEF
Definition gprs_ns2.h:36
GPRS_NS2_DIALECT_SNS
@ GPRS_NS2_DIALECT_SNS
Definition gprs_ns2.h:40
gprs_ns2_lltype_str
static const char * gprs_ns2_lltype_str(enum gprs_ns2_ll val)
Obtain a human-readable string for NS link-layer type.
Definition gprs_ns2.h:66
gprs_ns2_ip_bind
int gprs_ns2_ip_bind(struct gprs_ns2_inst *nsi, const char *name, const struct osmo_sockaddr *local, int dscp, struct gprs_ns2_vc_bind **result)
Bind to an IPv4/IPv6 address.
Definition gprs_ns2_udp.c:277
gprs_ns2_sns_del_endpoint
int gprs_ns2_sns_del_endpoint(struct gprs_ns2_nse *nse, const struct osmo_sockaddr *saddr)
gprs_ns2_sns_del_endpoint
Definition gprs_ns2_sns.c:2523
gprs_ns2_free_binds
void gprs_ns2_free_binds(struct gprs_ns2_inst *nsi)
Definition gprs_ns2.c:1521
ns_cause
ns_cause
NS Cause (TS 08.16, Section 10.3.2, Table 13)
Definition gsm_08_16.h:83
gprs_ns2_free
void gprs_ns2_free(struct gprs_ns2_inst *inst)
Destroy a NS Instance (including all its NSEs, binds, ...).
Definition gprs_ns2.c:1461
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.
Definition gprs_ns2.c:886
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.
Definition gprs_ns2.c:1178
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.
Definition gprs_ns2.c:330
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.
Definition gprs_ns2.c:252
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.
Definition gprs_ns2.c:1474
gprs_ns2_free_bind
void gprs_ns2_free_bind(struct gprs_ns2_vc_bind *bind)
Destroy a given bind.
Definition gprs_ns2.c:1492
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.
Definition gprs_ns2.c:1271
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.
Definition gprs_ns2.c:786
gprs_ns2_lltype_strs
const struct value_string gprs_ns2_lltype_strs[]
Definition gprs_ns2.c:240
gprs_ns2_cause_strs
const struct value_string gprs_ns2_cause_strs[]
Definition gprs_ns2.c:140
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.
Definition gprs_ns2.c:1537
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.
Definition gprs_ns2.c:309
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).
Definition gprs_ns2.c:486
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.
Definition gprs_ns2.c:1245
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.
Definition gprs_ns2.c:319
gprs_ns2_prim_strs
const struct value_string gprs_ns2_prim_strs[]
Definition gprs_ns2.c:233
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.
Definition gprs_ns2.c:1429
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.
Definition gprs_ns2.c:1203
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.
Definition gprs_ns2.c:1224
gprs_ns2_aff_cause_prim_strs
const struct value_string gprs_ns2_aff_cause_prim_strs[]
Definition gprs_ns2.c:221
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.
Definition gprs_ns2.c:770
gprs_ns2_free_nsvcs
void gprs_ns2_free_nsvcs(struct gprs_ns2_nse *nse)
Destroy/release all NS-VC of given NSE.
Definition gprs_ns2.c:682
gprs_ns2_free_nse
void gprs_ns2_free_nse(struct gprs_ns2_nse *nse)
Destroy given NS Entity.
Definition gprs_ns2.c:903
gprs_ns2_nse_nsei
uint16_t gprs_ns2_nse_nsei(struct gprs_ns2_nse *nse)
Return the NSEI.
Definition gprs_ns2.c:896
gprs_ns2_free_nses
void gprs_ns2_free_nses(struct gprs_ns2_inst *nsi)
Definition gprs_ns2.c:924
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 local_sgsn_role)
Create a NS Entity within given NS instance.
Definition gprs_ns2.c:806
gprs_ns2_free_nsvc
void gprs_ns2_free_nsvc(struct gprs_ns2_vc *nsvc)
Destroy/release given NS-VC.
Definition gprs_ns2.c:641
get_value_string
const char * get_value_string(const struct value_string *vs, uint32_t val)
gsm_08_16.h
GPRS Networks Service (NS) messages on the Gb interface.
prim.h
gprs_ns2_inst
An instance of the NS protocol stack.
Definition gprs_ns2_internal.h:166
gprs_ns2_inst::cb_data
void * cb_data
callback data
Definition gprs_ns2_internal.h:171
gprs_ns2_inst::cb
osmo_prim_cb cb
callback to the user for incoming UNIT DATA IND
Definition gprs_ns2_internal.h:168
gprs_ns2_nse
Structure repesenting a NSE.
Definition gprs_ns2_internal.h:190
gprs_ns2_nse::dialect
enum gprs_ns2_dialect dialect
which dialect does this NSE speaks?
Definition gprs_ns2_internal.h:219
gprs_ns2_nse::nsi
struct gprs_ns2_inst * nsi
entry back to ns2_inst
Definition gprs_ns2_internal.h:194
gprs_ns2_nse::nsvc
struct llist_head nsvc
llist head to hold all nsvc
Definition gprs_ns2_internal.h:200
gprs_ns2_vc_bind
Structure repesenting a bind instance.
Definition gprs_ns2_internal.h:299
gprs_ns2_vc_bind::name
const char * name
unique name
Definition gprs_ns2_internal.h:301
gprs_ns2_vc_bind::nsi
struct gprs_ns2_inst * nsi
a pointer back to the nsi
Definition gprs_ns2_internal.h:309
gprs_ns2_vc_driver
Definition gprs_ns2_internal.h:345
gprs_ns2_vc
Structure representing a single NS-VC.
Definition gprs_ns2_internal.h:246
gprs_ns2_vc::bind
struct gprs_ns2_vc_bind * bind
pointer to NS VL bind.
Definition gprs_ns2_internal.h:257
gprs_ns2_vc::nse
struct gprs_ns2_nse * nse
pointer to NS Instance
Definition gprs_ns2_internal.h:254
gprs_ns2_vc::nsvci
uint16_t nsvci
uniquely identifies NS-VC if VC contains nsvci
Definition gprs_ns2_internal.h:263
gprs_ns_ie_ip4_elem
Section 10.3.2c List of IP4 Elements.
Definition gsm_08_16.h:24
gprs_ns_ie_ip6_elem
Section 10.3.2d List of IP6 Elements.
Definition gsm_08_16.h:32
osmo_fr_network
Definition frame_relay.h:54
osmo_gprs_ns2_prim
Definition gprs_ns2.h:109
osmo_gprs_ns2_prim::u
union osmo_gprs_ns2_prim::@20 u
osmo_gprs_ns2_prim::transfer
int transfer
Definition gprs_ns2.h:132
osmo_gprs_ns2_prim::persistent
bool persistent
Definition gprs_ns2.h:135
osmo_gprs_ns2_prim::link_selector
uint32_t link_selector
Definition gprs_ns2.h:118
osmo_gprs_ns2_prim::mtu
uint16_t mtu
Definition gprs_ns2.h:140
osmo_gprs_ns2_prim::first
bool first
Definition gprs_ns2.h:138
osmo_gprs_ns2_prim::change
enum gprs_ns2_change_ip_endpoint change
Definition gprs_ns2.h:117
osmo_gprs_ns2_prim::nsei
uint16_t nsei
Definition gprs_ns2.h:112
osmo_gprs_ns2_prim::cause
enum gprs_ns2_congestion_cause cause
Definition gprs_ns2.h:126
osmo_gprs_ns2_prim::_resource_distribution_placeholder1
long long _resource_distribution_placeholder1
Definition gprs_ns2.h:121
osmo_gprs_ns2_prim::oph
struct osmo_prim_hdr oph
Definition gprs_ns2.h:110
osmo_gprs_ns2_prim::nsvc
char * nsvc
Definition gprs_ns2.h:130
osmo_gprs_ns2_prim::_resource_distribution_placeholder2
long long _resource_distribution_placeholder2
Definition gprs_ns2.h:122
osmo_gprs_ns2_prim::bvci
uint16_t bvci
Definition gprs_ns2.h:113
osmo_gprs_ns2_prim::cause
enum gprs_ns2_affecting_cause cause
Definition gprs_ns2.h:129
osmo_gprs_ns2_prim::_resource_distribution_placeholder3
long long _resource_distribution_placeholder3
Definition gprs_ns2.h:123
osmo_prim_hdr
osmo_sockaddr_str
osmo_sockaddr
value_string