libosmogb 1.13.1.1-afb4 Osmocom Gb library

gprs_ns2.h
Go to the documentation of this file.
1
4#pragma once
5
6#include <stdint.h>
7#include <netinet/in.h>
8
9#include <osmocom/core/prim.h>
10#include <osmocom/gprs/protocol/gsm_08_16.h>
11#include <osmocom/gprs/frame_relay.h>
12
13 struct osmo_sockaddr;
14 struct osmo_sockaddr_str;
15 struct osmo_fr_network;
16
17 struct gprs_ns2_inst;
18 struct gprs_ns2_nse;
19 struct gprs_ns2_vc;
20 struct gprs_ns2_vc_bind;
21 struct gprs_ns2_vc_driver;
22 struct gprs_ns_ie_ip4_elem;
23 struct gprs_ns_ie_ip6_elem;
24
25 enum gprs_ns2_vc_mode {
29 GPRS_NS2_VC_MODE_BLOCKRESET,
32 GPRS_NS2_VC_MODE_ALIVE,
33};
34
35 enum gprs_ns2_dialect {
36 GPRS_NS2_DIALECT_UNDEF,
37 GPRS_NS2_DIALECT_STATIC_ALIVE,
38 GPRS_NS2_DIALECT_STATIC_RESETBLOCK,
39 GPRS_NS2_DIALECT_IPACCESS,
40 GPRS_NS2_DIALECT_SNS,
41};
42
44 enum gprs_ns2_ll {
45 GPRS_NS2_LL_UNDEF,
46 GPRS_NS2_LL_UDP,
47 GPRS_NS2_LL_FR,
48 GPRS_NS2_LL_FR_GRE,
49};
50
52 enum gprs_ns2_prim {
53 GPRS_NS2_PRIM_UNIT_DATA,
54 GPRS_NS2_PRIM_CONGESTION,
55 GPRS_NS2_PRIM_STATUS,
56};
57
58 extern const struct value_string gprs_ns2_prim_strs[];
59 extern const struct value_string gprs_ns2_lltype_strs[];
60
62 static inline const char *gprs_ns2_prim_str(enum gprs_ns2_prim val)
63{ return get_value_string(gprs_ns2_prim_strs, val); }
64
66 static inline const char *gprs_ns2_lltype_str(enum gprs_ns2_ll val)
67{ return get_value_string(gprs_ns2_lltype_strs, val); }
68
70 enum gprs_ns2_congestion_cause {
71 GPRS_NS2_CONG_CAUSE_BACKWARD_BEGIN,
72 GPRS_NS2_CONG_CAUSE_BACKWARD_END,
73 GPRS_NS2_CONG_CAUSE_FORWARD_BEGIN,
74 GPRS_NS2_CONG_CAUSE_FORWARD_END,
75};
76
78 enum gprs_ns2_affecting_cause {
79 GPRS_NS2_AFF_CAUSE_VC_FAILURE,
80 GPRS_NS2_AFF_CAUSE_VC_RECOVERY,
81 GPRS_NS2_AFF_CAUSE_FAILURE,
82 GPRS_NS2_AFF_CAUSE_RECOVERY,
83 /* osmocom own causes */
84 GPRS_NS2_AFF_CAUSE_SNS_CONFIGURED,
85 GPRS_NS2_AFF_CAUSE_SNS_FAILURE,
86 GPRS_NS2_AFF_CAUSE_SNS_NO_ENDPOINTS,
87 GPRS_NS2_AFF_CAUSE_MTU_CHANGE,
88};
89
90 extern const struct value_string gprs_ns2_aff_cause_prim_strs[];
91
93 static inline const char *gprs_ns2_aff_cause_prim_str(enum gprs_ns2_affecting_cause val)
94{ return get_value_string(gprs_ns2_aff_cause_prim_strs, val); }
95
97 enum gprs_ns2_change_ip_endpoint {
98 GRPS_NS2_ENDPOINT_NO_CHANGE,
99 GPRS_NS2_ENDPOINT_REQUEST_CHANGE,
100 GPRS_NS2_ENDPOINT_CONFIRM_CHANGE,
101};
102
103 extern const struct value_string gprs_ns2_cause_strs[];
104
106 static inline const char *gprs_ns2_cause_str(enum ns_cause val)
107{ return get_value_string(gprs_ns2_cause_strs, val); }
108
109 struct osmo_gprs_ns2_prim {
110 struct osmo_prim_hdr oph;
111
112 uint16_t nsei;
113 uint16_t bvci;
114
115 union {
116 struct {
117 enum gprs_ns2_change_ip_endpoint change;
118 uint32_t link_selector;
119 /* TODO: implement resource distribution
120 * add place holder for the link selector */
121 long long _resource_distribution_placeholder1;
122 long long _resource_distribution_placeholder2;
123 long long _resource_distribution_placeholder3;
124 } unitdata;
125 struct {
126 enum gprs_ns2_congestion_cause cause;
127 } congestion;
128 struct {
129 enum gprs_ns2_affecting_cause cause;
130 char *nsvc;
131 /* 48.016 5.2.2.6 transfer capability */
132 int transfer;
133 /* osmocom specific */
134 /* Persistent NSE/NSVC are configured by vty */
135 bool persistent;
136 /* Only true on the first time it's available.
137 * Allow the BSSGP layer to reset persistent NSE */
138 bool first;
139 /* MTU of a NS SDU. It's the lowest MTU of all (alive & dead) NSVCs */
140 uint16_t mtu;
141 } status;
142 } u;
143};
144
145/* instance */
146 struct gprs_ns2_inst *gprs_ns2_instantiate(void *ctx, osmo_prim_cb cb, void *cb_data);
147 void gprs_ns2_free(struct gprs_ns2_inst *inst);
148
149/* Entrypoint for primitives from the NS USER */
150 int gprs_ns2_recv_prim(struct gprs_ns2_inst *nsi, struct osmo_prim_hdr *oph);
151
153 typedef int (*gprs_ns2_foreach_nsvc_cb)(struct gprs_ns2_vc *nsvc, void *ctx);
154
155 int gprs_ns2_nse_foreach_nsvc(struct gprs_ns2_nse *nse,
156 gprs_ns2_foreach_nsvc_cb cb, void *cb_data);
157 struct gprs_ns2_nse *gprs_ns2_nse_by_nsei(struct gprs_ns2_inst *nsi, uint16_t nsei);
158 struct gprs_ns2_nse *gprs_ns2_create_nse(struct gprs_ns2_inst *nsi, uint16_t nsei,
159 enum gprs_ns2_ll linklayer,
160 enum gprs_ns2_dialect dialect);
161 struct gprs_ns2_nse *gprs_ns2_create_nse2(struct gprs_ns2_inst *nsi, uint16_t nsei,
162 enum gprs_ns2_ll linklayer,
163 enum gprs_ns2_dialect dialect, bool local_sgsn_role);
164uint16_t gprs_ns2_nse_nsei(struct gprs_ns2_nse *nse);
165 void gprs_ns2_free_nse(struct gprs_ns2_nse *nse);
166 void gprs_ns2_free_nses(struct gprs_ns2_inst *nsi);
167
168/* create vc */
169 void gprs_ns2_free_nsvc(struct gprs_ns2_vc *nsvc);
170 void gprs_ns2_free_nsvcs(struct gprs_ns2_nse *nse);
171 struct gprs_ns2_vc *gprs_ns2_nsvc_by_nsvci(struct gprs_ns2_inst *nsi, uint16_t nsvci);
172
173/* generic VL driver */
174 struct gprs_ns2_vc_bind *gprs_ns2_bind_by_name(struct gprs_ns2_inst *nsi,
175 const char *name);
176
177/* IP VL driver */
178 int gprs_ns2_ip_bind(struct gprs_ns2_inst *nsi,
179 const char *name,
180 const struct osmo_sockaddr *local,
181 int dscp,
182 struct gprs_ns2_vc_bind **result);
183 struct gprs_ns2_vc_bind *gprs_ns2_ip_bind_by_sockaddr(struct gprs_ns2_inst *nsi,
184 const struct osmo_sockaddr *sockaddr);
185
186/* FR VL driver */
187 struct gprs_ns2_vc_bind *gprs_ns2_fr_bind_by_netif(
188 struct gprs_ns2_inst *nsi,
189 const char *netif);
190 const char *gprs_ns2_fr_bind_netif(struct gprs_ns2_vc_bind *bind);
191 enum osmo_fr_role gprs_ns2_fr_bind_role(struct gprs_ns2_vc_bind *bind);
192 int gprs_ns2_fr_bind(struct gprs_ns2_inst *nsi,
193 const char *name,
194 const char *netif,
195 struct osmo_fr_network *fr_network,
196 enum osmo_fr_role fr_role,
197 struct gprs_ns2_vc_bind **result);
198 int gprs_ns2_is_fr_bind(struct gprs_ns2_vc_bind *bind);
199 struct gprs_ns2_vc *gprs_ns2_fr_nsvc_by_dlci(struct gprs_ns2_vc_bind *bind, uint16_t dlci);
200 struct gprs_ns2_vc *gprs_ns2_fr_connect(struct gprs_ns2_vc_bind *bind,
201 struct gprs_ns2_nse *nse,
202 uint16_t nsvci,
203 uint16_t dlci);
204 struct gprs_ns2_vc *gprs_ns2_fr_connect2(struct gprs_ns2_vc_bind *bind,
205 uint16_t nsei,
206 uint16_t nsvci,
207 uint16_t dlci);
208
209/* create a VC connection */
210 struct gprs_ns2_vc *gprs_ns2_ip_connect(struct gprs_ns2_vc_bind *bind,
211 const struct osmo_sockaddr *remote,
212 struct gprs_ns2_nse *nse,
213 uint16_t nsvci);
214
215 struct gprs_ns2_vc *gprs_ns2_ip_connect2(struct gprs_ns2_vc_bind *bind,
216 const struct osmo_sockaddr *remote,
217 uint16_t nsei,
218 uint16_t nsvci,
219 enum gprs_ns2_dialect dialect);
220 struct gprs_ns2_vc *gprs_ns2_ip_connect_inactive(struct gprs_ns2_vc_bind *bind,
221 const struct osmo_sockaddr *remote,
222 struct gprs_ns2_nse *nse,
223 uint16_t nsvci);
224 void gprs_ns2_ip_bind_set_sns_weight(struct gprs_ns2_vc_bind *bind,
225 uint8_t signalling, uint8_t data);
226
227 void gprs_ns2_free_bind(struct gprs_ns2_vc_bind *bind);
228 void gprs_ns2_free_binds(struct gprs_ns2_inst *nsi);
229
230/* create a VC SNS connection */
231 int gprs_ns2_sns_count(struct gprs_ns2_nse *nse);
232 int gprs_ns2_sns_add_endpoint(struct gprs_ns2_nse *nse,
233 const struct osmo_sockaddr *saddr);
234 int gprs_ns2_sns_del_endpoint(struct gprs_ns2_nse *nse,
235 const struct osmo_sockaddr *saddr);
236 int gprs_ns2_sns_add_bind(struct gprs_ns2_nse *nse, struct gprs_ns2_vc_bind *bind);
237 int gprs_ns2_sns_del_bind(struct gprs_ns2_nse *nse, struct gprs_ns2_vc_bind *bind);
238 const struct osmo_sockaddr *gprs_ns2_nse_sns_remote(struct gprs_ns2_nse *nse);
239
240 const struct osmo_sockaddr *gprs_ns2_ip_vc_remote(const struct gprs_ns2_vc *nsvc);
241 const struct osmo_sockaddr *gprs_ns2_ip_vc_local(const struct gprs_ns2_vc *nsvc);
242 bool gprs_ns2_ip_vc_equal(const struct gprs_ns2_vc *nsvc,
243 const struct osmo_sockaddr *local,
244 const struct osmo_sockaddr *remote,
245 uint16_t nsvci);
246 const struct osmo_sockaddr *gprs_ns2_ip_bind_sockaddr(struct gprs_ns2_vc_bind *bind);
247 int gprs_ns2_is_ip_bind(struct gprs_ns2_vc_bind *bind);
248 int gprs_ns2_ip_bind_set_dscp(struct gprs_ns2_vc_bind *bind, int dscp);
249 int gprs_ns2_ip_bind_set_priority(struct gprs_ns2_vc_bind *bind, uint8_t priority);
250 struct gprs_ns2_vc *gprs_ns2_nsvc_by_sockaddr_bind(
251 struct gprs_ns2_vc_bind *bind,
252 const struct osmo_sockaddr *rem_addr);
253
254 int gprs_ns2_frgre_bind(struct gprs_ns2_inst *nsi,
255 const char *name,
256 const struct osmo_sockaddr *local,
257 int dscp,
258 struct gprs_ns2_vc_bind **result);
259 int gprs_ns2_is_frgre_bind(struct gprs_ns2_vc_bind *bind);
260uint16_t gprs_ns2_fr_nsvc_dlci(const struct gprs_ns2_vc *nsvc);
261
262 struct gprs_ns2_vc *gprs_ns2_nsvc_by_sockaddr_nse(
263 struct gprs_ns2_nse *nse,
264 const struct osmo_sockaddr *sockaddr);
265 void gprs_ns2_start_alive_all_nsvcs(struct gprs_ns2_nse *nse);
266
267/* VC information */
268 const char *gprs_ns2_ll_str(struct gprs_ns2_vc *nsvc);
269 char *gprs_ns2_ll_str_buf(char *buf, size_t buf_len, struct gprs_ns2_vc *nsvc);
270 char *gprs_ns2_ll_str_c(const void *ctx, struct gprs_ns2_vc *nsvc);
271 const char *gprs_ns2_nsvc_state_name(struct gprs_ns2_vc *nsvc);
272
273/* vty */
274 int gprs_ns2_vty_init(struct gprs_ns2_inst *nsi);
275
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
priority
unsigned int priority
name
const char * name
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
data
uint8_t data[0]
variable-length payload
Definition: gsm_08_16.h:1
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
osmo_prim_cb
int(* osmo_prim_cb)(struct osmo_prim_hdr *oph, void *ctx)
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::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::unitdata
struct osmo_gprs_ns2_prim::@20::@21 unitdata
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::status
struct osmo_gprs_ns2_prim::@20::@23 status
osmo_gprs_ns2_prim::congestion
struct osmo_gprs_ns2_prim::@20::@22 congestion
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