225 uint8_t signalling, uint8_t
data);
osmo_fr_role
Definition: frame_relay.h:38
uint16_t nsei
Identifiers of a BTS, equal to 'struct bssgp_bts_ctx'.
Definition: gprs_msgb.h:7
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
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
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
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
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
static const char * gprs_ns2_cause_str(enum ns_cause val)
Obtain a human-readable string for NS primitives.
Definition: gprs_ns2.h:106
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
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
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
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
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
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
Definition: gprs_ns2.h:25
@ 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
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
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
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
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
int gprs_ns2_vty_init(struct gprs_ns2_inst *nsi)
Definition: gprs_ns2_vty.c:2306
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
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
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
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
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
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
Osmocom NS primitives according to 48.016 5.2 Service primitives.
Definition: gprs_ns2.h:52
@ GPRS_NS2_PRIM_CONGESTION
Definition: gprs_ns2.h:54
@ GPRS_NS2_PRIM_STATUS
Definition: gprs_ns2.h:55
@ GPRS_NS2_PRIM_UNIT_DATA
Definition: gprs_ns2.h:53
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
Definition: gprs_ns2.h:71
@ GPRS_NS2_CONG_CAUSE_BACKWARD_END
Definition: gprs_ns2.h:72
@ GPRS_NS2_CONG_CAUSE_FORWARD_END
Definition: gprs_ns2.h:74
@ GPRS_NS2_CONG_CAUSE_FORWARD_BEGIN
Definition: gprs_ns2.h:73
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
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
Osmocom NS primitives according to 48.016 5.2.2.6 Service primitives.
Definition: gprs_ns2.h:78
@ GPRS_NS2_AFF_CAUSE_FAILURE
Definition: gprs_ns2.h:81
@ GPRS_NS2_AFF_CAUSE_VC_FAILURE
Definition: gprs_ns2.h:79
@ GPRS_NS2_AFF_CAUSE_MTU_CHANGE
Definition: gprs_ns2.h:87
@ GPRS_NS2_AFF_CAUSE_VC_RECOVERY
Definition: gprs_ns2.h:80
@ GPRS_NS2_AFF_CAUSE_RECOVERY
Definition: gprs_ns2.h:82
@ GPRS_NS2_AFF_CAUSE_SNS_FAILURE
Definition: gprs_ns2.h:85
@ GPRS_NS2_AFF_CAUSE_SNS_CONFIGURED
Definition: gprs_ns2.h:84
@ GPRS_NS2_AFF_CAUSE_SNS_NO_ENDPOINTS
Definition: gprs_ns2.h:86
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
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
Osmocom NS link layer types.
Definition: gprs_ns2.h:44
@ GPRS_NS2_LL_FR
NS/FR.
Definition: gprs_ns2.h:47
@ GPRS_NS2_LL_UNDEF
undefined, used by vty
Definition: gprs_ns2.h:45
@ GPRS_NS2_LL_FR_GRE
NS/FR/GRE/IP.
Definition: gprs_ns2.h:48
@ GPRS_NS2_LL_UDP
NS/UDP/IP.
Definition: gprs_ns2.h:46
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
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
Osmocom NS primitives according to 48.016 5.2.2.7 Service primitives.
Definition: gprs_ns2.h:97
@ GPRS_NS2_ENDPOINT_REQUEST_CHANGE
Definition: gprs_ns2.h:99
@ GRPS_NS2_ENDPOINT_NO_CHANGE
Definition: gprs_ns2.h:98
@ GPRS_NS2_ENDPOINT_CONFIRM_CHANGE
Definition: gprs_ns2.h:100
int gprs_ns2_sns_add_bind(struct gprs_ns2_nse *nse, struct gprs_ns2_vc_bind *bind)
Definition: gprs_ns2_sns.c:2654
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
int gprs_ns2_sns_count(struct gprs_ns2_nse *nse)
gprs_ns2_sns_count
Definition: gprs_ns2_sns.c:2576
gprs_ns2_dialect
Definition: gprs_ns2.h:35
@ GPRS_NS2_DIALECT_IPACCESS
Definition: gprs_ns2.h:39
@ GPRS_NS2_DIALECT_STATIC_RESETBLOCK
Definition: gprs_ns2.h:38
@ GPRS_NS2_DIALECT_STATIC_ALIVE
Definition: gprs_ns2.h:37
@ GPRS_NS2_DIALECT_UNDEF
Definition: gprs_ns2.h:36
@ GPRS_NS2_DIALECT_SNS
Definition: gprs_ns2.h:40
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
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
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
void gprs_ns2_free_binds(struct gprs_ns2_inst *nsi)
Definition: gprs_ns2.c:1521
ns_cause
NS Cause (TS 08.16, Section 10.3.2, Table 13)
Definition: gsm_08_16.h:83
void gprs_ns2_free(struct gprs_ns2_inst *inst)
Destroy a NS Instance (including all its NSEs, binds, ...).
Definition: gprs_ns2.c:1461
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
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
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
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
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
void gprs_ns2_free_bind(struct gprs_ns2_vc_bind *bind)
Destroy a given bind.
Definition: gprs_ns2.c:1492
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
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
const struct value_string gprs_ns2_lltype_strs[]
Definition: gprs_ns2.c:240
const struct value_string gprs_ns2_cause_strs[]
Definition: gprs_ns2.c:140
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
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
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
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
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
const struct value_string gprs_ns2_prim_strs[]
Definition: gprs_ns2.c:233
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
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
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
const struct value_string gprs_ns2_aff_cause_prim_strs[]
Definition: gprs_ns2.c:221
uint8_t data[0]
variable-length payload
Definition: gsm_08_16.h:1
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
void gprs_ns2_free_nsvcs(struct gprs_ns2_nse *nse)
Destroy/release all NS-VC of given NSE.
Definition: gprs_ns2.c:682
void gprs_ns2_free_nse(struct gprs_ns2_nse *nse)
Destroy given NS Entity.
Definition: gprs_ns2.c:903
uint16_t gprs_ns2_nse_nsei(struct gprs_ns2_nse *nse)
Return the NSEI.
Definition: gprs_ns2.c:896
void gprs_ns2_free_nses(struct gprs_ns2_inst *nsi)
Definition: gprs_ns2.c:924
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
void gprs_ns2_free_nsvc(struct gprs_ns2_vc *nsvc)
Destroy/release given NS-VC.
Definition: gprs_ns2.c:641
int(* osmo_prim_cb)(struct osmo_prim_hdr *oph, void *ctx)
const char * get_value_string(const struct value_string *vs, uint32_t val)
GPRS Networks Service (NS) messages on the Gb interface.
An instance of the NS protocol stack.
Definition: gprs_ns2_internal.h:166
void * cb_data
callback data
Definition: gprs_ns2_internal.h:171
osmo_prim_cb cb
callback to the user for incoming UNIT DATA IND
Definition: gprs_ns2_internal.h:168
Structure repesenting a NSE.
Definition: gprs_ns2_internal.h:190
enum gprs_ns2_dialect dialect
which dialect does this NSE speaks?
Definition: gprs_ns2_internal.h:219
struct gprs_ns2_inst * nsi
entry back to ns2_inst
Definition: gprs_ns2_internal.h:194
struct llist_head nsvc
llist head to hold all nsvc
Definition: gprs_ns2_internal.h:200
Structure repesenting a bind instance.
Definition: gprs_ns2_internal.h:299
struct gprs_ns2_inst * nsi
a pointer back to the nsi
Definition: gprs_ns2_internal.h:309
Definition: gprs_ns2_internal.h:345
Structure representing a single NS-VC.
Definition: gprs_ns2_internal.h:246
struct gprs_ns2_vc_bind * bind
pointer to NS VL bind.
Definition: gprs_ns2_internal.h:257
struct gprs_ns2_nse * nse
pointer to NS Instance
Definition: gprs_ns2_internal.h:254
uint16_t nsvci
uniquely identifies NS-VC if VC contains nsvci
Definition: gprs_ns2_internal.h:263
Section 10.3.2c List of IP4 Elements.
Definition: gsm_08_16.h:24
Section 10.3.2d List of IP6 Elements.
Definition: gsm_08_16.h:32
Definition: frame_relay.h:54
Definition: gprs_ns2.h:109
union osmo_gprs_ns2_prim::@20 u
int transfer
Definition: gprs_ns2.h:132
bool persistent
Definition: gprs_ns2.h:135
uint32_t link_selector
Definition: gprs_ns2.h:118
struct osmo_gprs_ns2_prim::@20::@21 unitdata
uint16_t mtu
Definition: gprs_ns2.h:140
bool first
Definition: gprs_ns2.h:138
enum gprs_ns2_change_ip_endpoint change
Definition: gprs_ns2.h:117
uint16_t nsei
Definition: gprs_ns2.h:112
enum gprs_ns2_congestion_cause cause
Definition: gprs_ns2.h:126
long long _resource_distribution_placeholder1
Definition: gprs_ns2.h:121
struct osmo_prim_hdr oph
Definition: gprs_ns2.h:110
char * nsvc
Definition: gprs_ns2.h:130
long long _resource_distribution_placeholder2
Definition: gprs_ns2.h:122
uint16_t bvci
Definition: gprs_ns2.h:113
enum gprs_ns2_affecting_cause cause
Definition: gprs_ns2.h:129
struct osmo_gprs_ns2_prim::@20::@23 status
struct osmo_gprs_ns2_prim::@20::@22 congestion
long long _resource_distribution_placeholder3
Definition: gprs_ns2.h:123