libosmogb  1.5.1.205-e67e
Osmocom Gb library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules
gprs_ns2_internal.h
Go to the documentation of this file.
1 
3 #pragma once
4 
5 #include <stdbool.h>
6 #include <stdint.h>
7 
8 #include <osmocom/core/logging.h>
10 #include <osmocom/gprs/gprs_ns2.h>
11 
12 #define LOGNSE(nse, lvl, fmt, args ...) \
13  LOGP(DLNS, lvl, "NSE(%05u) " fmt, (nse)->nsei, ## args)
14 
15 #define LOGBIND(bind, lvl, fmt, args ...) \
16  LOGP(DLNS, lvl, "BIND(%s) " fmt, (bind)->name, ## args)
17 
18 #define LOGNSVC_SS(ss, nsvc, lvl, fmt, args ...) \
19  do { \
20  if ((nsvc)->nsvci_is_valid) { \
21  LOGP(ss, lvl, "NSE(%05u)-NSVC(%05u) " fmt, \
22  (nsvc)->nse->nsei, (nsvc)->nsvci, ## args); \
23  } else { \
24  LOGP(ss, lvl, "NSE(%05u)-NSVC(none) " fmt, \
25  (nsvc)->nse->nsei, ## args); \
26  } \
27  } while (0)
28 
29 #define LOGNSVC(nsvc, lvl, fmt, args ...) \
30  LOGNSVC_SS(DLNS, nsvc, lvl, fmt, ## args)
31 
32 #define LOG_NS_SIGNAL(nsvc, direction, pdu_type, lvl, fmt, args ...) \
33  LOGNSVC_SS(DLNSSIGNAL, nsvc, lvl, "%s %s" fmt, direction, get_value_string(gprs_ns_pdu_strings, pdu_type), ## args)
34 
35 #define LOG_NS_DATA(nsvc, direction, pdu_type, lvl, fmt, args ...) \
36  LOGNSVC_SS(DLNSDATA, nsvc, lvl, "%s %s" fmt, direction, get_value_string(gprs_ns_pdu_strings, pdu_type), ## args)
37 
38 #define LOG_NS_RX_SIGNAL(nsvc, pdu_type) LOG_NS_SIGNAL(nsvc, "Rx", pdu_type, LOGL_INFO, "\n")
39 #define LOG_NS_TX_SIGNAL(nsvc, pdu_type) LOG_NS_SIGNAL(nsvc, "Tx", pdu_type, LOGL_INFO, "\n")
40 
41 #define RATE_CTR_INC_NS(nsvc, ctr) \
42  do { \
43  struct gprs_ns2_vc *_nsvc = (nsvc); \
44  rate_ctr_inc(rate_ctr_group_get_ctr(_nsvc->ctrg, ctr)); \
45  rate_ctr_inc(rate_ctr_group_get_ctr(_nsvc->nse->ctrg, ctr)); \
46  } while (0)
47 
48 #define RATE_CTR_ADD_NS(nsvc, ctr, val) \
49  do { \
50  struct gprs_ns2_vc *_nsvc = (nsvc); \
51  rate_ctr_add(rate_ctr_group_get_ctr(_nsvc->ctrg, ctr), val); \
52  rate_ctr_add(rate_ctr_group_get_ctr(_nsvc->nse->ctrg, ctr), val); \
53  } while (0)
54 
55 
56 struct osmo_fsm_inst;
57 struct tlv_parsed;
58 struct vty;
59 
60 struct gprs_ns2_vc_driver;
61 struct gprs_ns2_vc_bind;
62 
63 #define NS_TIMERS_COUNT 10
64 #define NS_TIMERS "(tns-block|tns-block-retries|tns-reset|tns-reset-retries|tns-test|tns-alive|tns-alive-retries|tsns-prov|tsns-size-retries|tsns-config-retries)"
65 #define NS_TIMERS_HELP \
66  "(un)blocking Timer (Tns-block) timeout\n" \
67  "(un)blocking Timer (Tns-block) number of retries\n" \
68  "Reset Timer (Tns-reset) timeout\n" \
69  "Reset Timer (Tns-reset) number of retries\n" \
70  "Test Timer (Tns-test) timeout\n" \
71  "Alive Timer (Tns-alive) timeout\n" \
72  "Alive Timer (Tns-alive) number of retries\n" \
73  "SNS Provision Timer (Tsns-prov) timeout\n" \
74  "SNS Size number of retries\n" \
75  "SNS Config number of retries\n" \
76 
77 /* Educated guess - LLC user payload is 1500 bytes plus possible headers */
78 #define NS_ALLOC_SIZE 3072
79 #define NS_ALLOC_HEADROOM 20
80 
92 };
93 
95  /* standard timers */
100 };
101 
104 };
105 
108 };
109 
111 enum ns2_cs {
117 };
118 
119 enum ns_ctr {
135 };
136 
137 #define NSE_S_BLOCKED 0x0001
138 #define NSE_S_ALIVE 0x0002
139 #define NSE_S_RESET 0x0004
140 
141 #define NS_DESC_B(st) ((st) & NSE_S_BLOCKED ? "BLOCKED" : "UNBLOCKED")
142 #define NS_DESC_A(st) ((st) & NSE_S_ALIVE ? "ALIVE" : "DEAD")
143 #define NS_DESC_R(st) ((st) & NSE_S_RESET ? "RESET" : "UNRESET")
144 
149 
151  void *cb_data;
152 
155 
157  struct llist_head nse;
158 
160 
164 
167 };
168 
169 
171 struct gprs_ns2_nse {
172  uint16_t nsei;
173 
176 
178  struct llist_head list;
179 
181  struct llist_head nsvc;
182 
185 
188 
191  bool first;
192 
194  bool alive;
195 
198 
201 
203 
205  uint32_t sum_data_weight;
206 
208  uint32_t sum_sig_weight;
209 
211  uint16_t mtu;
212 
215 
218 
220  bool freed;
221 };
222 
224 struct gprs_ns2_vc {
226  struct llist_head list;
227 
230 
232  struct gprs_ns2_nse *nse;
233 
236 
239 
241  uint16_t nsvci;
242 
244  uint8_t sig_weight;
245 
247  uint8_t sig_counter;
248 
250  uint8_t data_weight;
251 
253  void *priv;
254 
257  bool sns_only;
258 
261 
263 
264  struct osmo_fsm_inst *fi;
265 
267  bool freed;
268 };
269 
273  const char *name;
275  struct llist_head list;
277  struct llist_head nsvc;
279  void *priv;
283 
286 
289 
291  uint16_t mtu;
292 
295 
297  int (*send_vc)(struct gprs_ns2_vc *nsvc, struct msgb *msg);
298 
300  void (*free_vc)(struct gprs_ns2_vc *nsvc);
301 
303  void (*dump_vty)(const struct gprs_ns2_vc_bind *bind,
304  struct vty *vty, bool stats);
305 
307  uint8_t sns_sig_weight;
310 
312 
314  bool freed;
315 };
316 
318  const char *name;
319  void *priv;
321 };
322 
323 enum ns2_cs ns2_create_vc(struct gprs_ns2_vc_bind *bind,
324  struct msgb *msg,
325  const struct osmo_sockaddr *remote,
326  const char *logname,
327  struct msgb **reject,
328  struct gprs_ns2_vc **success);
329 
330 int ns2_recv_vc(struct gprs_ns2_vc *nsvc,
331  struct msgb *msg);
332 
334  struct gprs_ns2_nse *nse,
335  bool initiater,
336  enum gprs_ns2_vc_mode vc_mode,
337  const char *id);
338 
339 int ns2_bind_alloc(struct gprs_ns2_inst *nsi, const char *name,
340  struct gprs_ns2_vc_bind **result);
341 
342 struct msgb *ns2_msgb_alloc(void);
343 
344 void ns2_sns_write_vty(struct vty *vty, const struct gprs_ns2_nse *nse);
345 void ns2_sns_dump_vty(struct vty *vty, const char *prefix, const struct gprs_ns2_nse *nse, bool stats);
346 void ns2_prim_status_ind(struct gprs_ns2_nse *nse,
347  struct gprs_ns2_vc *nsvc,
348  uint16_t bvci,
349  enum gprs_ns2_affecting_cause cause);
350 void ns2_nse_notify_alive(struct gprs_ns2_vc *nsvc, bool alive);
351 void ns2_nse_update_mtu(struct gprs_ns2_nse *nse);
352 int ns2_nse_set_dialect(struct gprs_ns2_nse *nse, enum gprs_ns2_dialect dialect);
353 
354 /* message */
355 int ns2_validate(struct gprs_ns2_vc *nsvc,
356  uint8_t pdu_type,
357  struct msgb *msg,
358  struct tlv_parsed *tp,
359  uint8_t *cause);
360 
361 /* SNS messages */
362 int ns2_tx_sns_ack(struct gprs_ns2_vc *nsvc, uint8_t trans_id, uint8_t *cause,
363  const struct gprs_ns_ie_ip4_elem *ip4_elems,
364  unsigned int num_ip4_elems,
365  const struct gprs_ns_ie_ip6_elem *ip6_elems,
366  unsigned int num_ip6_elems);
367 int ns2_tx_sns_config(struct gprs_ns2_vc *nsvc, bool end_flag,
368  const struct gprs_ns_ie_ip4_elem *ip4_elems,
369  unsigned int num_ip4_elems,
370  const struct gprs_ns_ie_ip6_elem *ip6_elems,
371  unsigned int num_ip6_elems);
372 int ns2_tx_sns_config_ack(struct gprs_ns2_vc *nsvc, uint8_t *cause);
373 int ns2_tx_sns_size(struct gprs_ns2_vc *nsvc, bool reset_flag, uint16_t max_nr_nsvc,
374  int ip4_ep_nr, int ip6_ep_nr);
375 int ns2_tx_sns_size_ack(struct gprs_ns2_vc *nsvc, uint8_t *cause);
376 
377 int ns2_tx_sns_add(struct gprs_ns2_vc *nsvc,
378  uint8_t trans_id,
379  const struct gprs_ns_ie_ip4_elem *ip4_elems,
380  unsigned int num_ip4_elems,
381  const struct gprs_ns_ie_ip6_elem *ip6_elems,
382  unsigned int num_ip6_elems);
383 int ns2_tx_sns_change_weight(struct gprs_ns2_vc *nsvc,
384  uint8_t trans_id,
385  const struct gprs_ns_ie_ip4_elem *ip4_elems,
386  unsigned int num_ip4_elems,
387  const struct gprs_ns_ie_ip6_elem *ip6_elems,
388  unsigned int num_ip6_elems);
389 int ns2_tx_sns_del(struct gprs_ns2_vc *nsvc,
390  uint8_t trans_id,
391  const struct gprs_ns_ie_ip4_elem *ip4_elems,
392  unsigned int num_ip4_elems,
393  const struct gprs_ns_ie_ip6_elem *ip6_elems,
394  unsigned int num_ip6_elems);
395 
396 /* transmit message over a VC */
397 int ns2_tx_block(struct gprs_ns2_vc *nsvc, uint8_t cause);
398 int ns2_tx_block_ack(struct gprs_ns2_vc *nsvc);
399 
400 int ns2_tx_reset(struct gprs_ns2_vc *nsvc, uint8_t cause);
401 int ns2_tx_reset_ack(struct gprs_ns2_vc *nsvc);
402 
403 int ns2_tx_unblock(struct gprs_ns2_vc *nsvc);
404 int ns2_tx_unblock_ack(struct gprs_ns2_vc *nsvc);
405 
406 int ns2_tx_alive(struct gprs_ns2_vc *nsvc);
407 int ns2_tx_alive_ack(struct gprs_ns2_vc *nsvc);
408 
409 int ns2_tx_unit_data(struct gprs_ns2_vc *nsvc,
410  uint16_t bvci, uint8_t sducontrol,
411  struct msgb *msg);
412 
413 int ns2_tx_status(struct gprs_ns2_vc *nsvc, uint8_t cause,
414  uint16_t bvci, struct msgb *orig_msg);
415 
416 /* driver */
418  struct gprs_ns2_nse *nse,
419  const struct osmo_sockaddr *remote);
420 int ns2_ip_count_bind(struct gprs_ns2_inst *nsi, struct osmo_sockaddr *remote);
422  struct osmo_sockaddr *remote,
423  int index);
424 
425 /* sns */
426 int ns2_sns_rx(struct gprs_ns2_vc *nsvc, struct msgb *msg, struct tlv_parsed *tp);
428  const char *id);
429 struct osmo_fsm_inst *ns2_sns_sgsn_fsm_alloc(struct gprs_ns2_nse *nse, const char *id);
430 void ns2_sns_replace_nsvc(struct gprs_ns2_vc *nsvc);
431 void ns2_sns_notify_alive(struct gprs_ns2_nse *nse, struct gprs_ns2_vc *nsvc, bool alive);
432 void ns2_sns_update_weights(struct gprs_ns2_vc_bind *bind);
433 
434 /* vc */
435 struct osmo_fsm_inst *ns2_vc_fsm_alloc(struct gprs_ns2_vc *nsvc,
436  const char *id, bool initiate);
437 int ns2_vc_fsm_start(struct gprs_ns2_vc *nsvc);
438 int ns2_vc_force_unconfigured(struct gprs_ns2_vc *nsvc);
439 int ns2_vc_rx(struct gprs_ns2_vc *nsvc, struct msgb *msg, struct tlv_parsed *tp);
440 int ns2_vc_is_alive(struct gprs_ns2_vc *nsvc);
441 int ns2_vc_is_unblocked(struct gprs_ns2_vc *nsvc);
442 int ns2_vc_block(struct gprs_ns2_vc *nsvc);
443 int ns2_vc_reset(struct gprs_ns2_vc *nsvc);
444 int ns2_vc_unblock(struct gprs_ns2_vc *nsvc);
445 void ns2_vty_dump_nsvc(struct vty *vty, struct gprs_ns2_vc *nsvc, bool stats);
446 
447 /* nse */
448 void ns2_nse_notify_unblocked(struct gprs_ns2_vc *nsvc, bool unblocked);
450 int ns2_count_transfer_cap(struct gprs_ns2_nse *nse,
451  uint16_t bvci);
452 
453 /* vty */
int ns2_tx_sns_ack(struct gprs_ns2_vc *nsvc, uint8_t trans_id, uint8_t *cause, const struct gprs_ns_ie_ip4_elem *ip4_elems, unsigned int num_ip4_elems, const struct gprs_ns_ie_ip6_elem *ip6_elems, unsigned int num_ip6_elems)
Encode + Transmit a SNS-ACK as per Section 9.3.1.
Definition: gprs_ns2_message.c:598
Structure representing a single NS-VC.
Definition: gprs_ns2_internal.h:224
Definition: gprs_ns2_internal.h:97
int ns2_tx_sns_size(struct gprs_ns2_vc *nsvc, bool reset_flag, uint16_t max_nr_nsvc, int ip4_ep_nr, int ip6_ep_nr)
Encode + transmit a SNS-SIZE as per Section 9.3.7.
Definition: gprs_ns2_message.c:762
Skipped message.
Definition: gprs_ns2_internal.h:115
Definition: gprs_ns2_internal.h:131
ns_ctr
Definition: gprs_ns.c:128
bool accept_sns
Definition: gprs_ns2_internal.h:285
void * priv
can be used by the bind/driver of the virtual circuit.
Definition: gprs_ns2_internal.h:253
int ns2_count_transfer_cap(struct gprs_ns2_nse *nse, uint16_t bvci)
calculate the transfer capabilities for a nse
Definition: gprs_ns2.c:1584
bool persistent
true if this NSE was created by VTY or pcu socket)
Definition: gprs_ns2_internal.h:187
Failed to process message.
Definition: gprs_ns2_internal.h:116
A NSVC object has been created.
Definition: gprs_ns2_internal.h:112
void ns2_nse_notify_unblocked(struct gprs_ns2_vc *nsvc, bool unblocked)
Notify a nse about the change of a NS-VC.
Definition: gprs_ns2.c:1380
struct osmo_fsm_inst * ns2_vc_fsm_alloc(struct gprs_ns2_vc *nsvc, const char *id, bool initiate)
gprs_ns2_vc_fsm_alloc
Definition: gprs_ns2_vc_fsm.c:748
int ns2_vc_fsm_start(struct gprs_ns2_vc *nsvc)
Start a NS-VC FSM.
Definition: gprs_ns2_vc_fsm.c:771
void ns2_sns_replace_nsvc(struct gprs_ns2_vc *nsvc)
called when a nsvc is beeing freed or the nsvc became dead
Definition: gprs_ns2_sns.c:276
int ns2_tx_status(struct gprs_ns2_vc *nsvc, uint8_t cause, uint16_t bvci, struct msgb *orig_msg)
Transmit a NS-STATUS on a given NS-VC.
Definition: gprs_ns2_message.c:420
Definition: gprs_ns2_internal.h:120
uint8_t sig_weight
signalling weight.
Definition: gprs_ns2_internal.h:244
Structure repesenting a bind instance.
Definition: gprs_ns2_internal.h:271
uint16_t nsvci
uniquely identifies NS-VC if VC contains nsvci
Definition: gprs_ns2_internal.h:241
Definition: gprs_ns2_internal.h:85
Definition: gprs_ns2_internal.h:91
Structure repesenting a NSE.
Definition: gprs_ns2_internal.h:171
int ns2_tx_reset(struct gprs_ns2_vc *nsvc, uint8_t cause)
Transmit a NS-RESET on a given NS-VC.
Definition: gprs_ns2_message.c:271
Definition: gprs_ns2_internal.h:87
void ns2_sns_notify_alive(struct gprs_ns2_nse *nse, struct gprs_ns2_vc *nsvc, bool alive)
Definition: gprs_ns2_sns.c:1960
int ns2_tx_sns_add(struct gprs_ns2_vc *nsvc, uint8_t trans_id, const struct gprs_ns_ie_ip4_elem *ip4_elems, unsigned int num_ip4_elems, const struct gprs_ns_ie_ip6_elem *ip6_elems, unsigned int num_ip6_elems)
Encode + Transmit a SNS-ADD as per Section 9.3.2.
Definition: gprs_ns2_message.c:543
int(* send_vc)(struct gprs_ns2_vc *nsvc, struct msgb *msg)
send a msg over a VC
Definition: gprs_ns2_internal.h:297
osmo_prim_cb cb
callback to the user for incoming UNIT DATA IND
Definition: gprs_ns2_internal.h:148
int ns2_tx_alive_ack(struct gprs_ns2_vc *nsvc)
Transmit a NS-ALIVE-ACK on a given NS-VC.
Definition: gprs_ns2_message.c:374
Definition: gprs_ns2_internal.h:89
struct llist_head list
llist entry for gprs_ns2_inst
Definition: gprs_ns2_internal.h:178
ns2_cs
Osmocom NS2 VC create status.
Definition: gprs_ns2_internal.h:111
gprs_ns2_affecting_cause
Osmocom NS primitives according to 48.016 5.2.2.6 Service primitives.
Definition: gprs_ns2.h:78
Definition: gprs_ns2_internal.h:126
void ns2_prim_status_ind(struct gprs_ns2_nse *nse, struct gprs_ns2_vc *nsvc, uint16_t bvci, enum gprs_ns2_affecting_cause cause)
Send a STATUS.ind primitive to the specified NS instance user.
Definition: gprs_ns2.c:551
An instance of the NS protocol stack.
Definition: gprs_ns2_internal.h:146
uint8_t sns_data_weight
the IP-SNS data weight when doing dynamic configuration
Definition: gprs_ns2_internal.h:309
Definition: gprs_ns2_internal.h:133
ns2_vc_stat
Definition: gprs_ns2_internal.h:102
uint16_t nsei
Definition: gprs_ns2_internal.h:172
struct osmo_mnl * linkmon_mnl
libmnl netlink socket for link state monitoring
Definition: gprs_ns2_internal.h:166
bool alive
true if this NSE has at least one alive VC
Definition: gprs_ns2_internal.h:194
struct msgb * ns2_msgb_alloc(void)
Allocate a message buffer for use with the NS2 stack.
Definition: gprs_ns2.c:683
Definition: gprs_ns2_internal.h:317
struct gprs_ns2_vc * ns2_ip_bind_connect(struct gprs_ns2_vc_bind *bind, struct gprs_ns2_nse *nse, const struct osmo_sockaddr *remote)
Create new NS-VC to a given remote address.
Definition: gprs_ns2_udp.c:384
Definition: gprs_ns2_internal.h:83
Rejected and answered message.
Definition: gprs_ns2_internal.h:114
Definition: gprs_ns2_internal.h:86
uint16_t mtu
MTU of a NS PDU on this bind.
Definition: gprs_ns2_internal.h:291
void(* dump_vty)(const struct gprs_ns2_vc_bind *bind, struct vty *vty, bool stats)
allow to show information for the vty
Definition: gprs_ns2_internal.h:303
ns2_bind_stat
Definition: gprs_ns2_internal.h:106
struct osmo_stat_item_group * statg
Definition: gprs_ns2_internal.h:260
int ns2_tx_sns_config_ack(struct gprs_ns2_vc *nsvc, uint8_t *cause)
Encode + Transmit a SNS-CONFIG-ACK as per Section 9.3.5.
Definition: gprs_ns2_message.c:716
Definition: gprs_ns2_internal.h:128
int ns2_vc_is_alive(struct gprs_ns2_vc *nsvc)
struct llist_head blist
list of NS-VCs within bind, bind is the owner!
Definition: gprs_ns2_internal.h:229
enum ns2_cs ns2_create_vc(struct gprs_ns2_vc_bind *bind, struct msgb *msg, const struct osmo_sockaddr *remote, const char *logname, struct msgb **reject, struct gprs_ns2_vc **success)
Create a new NS-VC based on a [received] message.
Definition: gprs_ns2.c:993
uint8_t sig_counter
signalling packet counter for the load sharing function
Definition: gprs_ns2_internal.h:247
struct rate_ctr_group * ctrg
NSE-wide statistics.
Definition: gprs_ns2_internal.h:217
uint32_t sum_sig_weight
sum of all the signalling weight of alive NS-VCs
Definition: gprs_ns2_internal.h:208
int ns2_vc_reset(struct gprs_ns2_vc *nsvc)
Reset a NS-VC.
Definition: gprs_ns2_vc_fsm.c:814
void ns2_nse_update_mtu(struct gprs_ns2_nse *nse)
Definition: gprs_ns2.c:1554
Definition: gprs_ns2_internal.h:96
struct gprs_ns2_inst * nsi
entry back to ns2_inst
Definition: gprs_ns2_internal.h:175
uint16_t timeout[NS_TIMERS_COUNT]
Definition: gprs_ns2_internal.h:159
gprs_ns2_vc_mode
Definition: gprs_ns2.h:25
Definition: gprs_ns2_internal.h:82
void ns2_vty_dump_nsvc(struct vty *vty, struct gprs_ns2_vc *nsvc, bool stats)
Definition: gprs_ns2_vty.c:1874
struct gprs_ns2_nse * nse
pointer to NS Instance
Definition: gprs_ns2_internal.h:232
struct llist_head nse
linked lists of all NSVC in this instance
Definition: gprs_ns2_internal.h:157
A NSVC object has been found.
Definition: gprs_ns2_internal.h:113
gprs_ns2_dialect
Definition: gprs_ns2.h:35
int(* osmo_prim_cb)(struct osmo_prim_hdr *oph, void *ctx)
Definition: gprs_ns2_internal.h:132
Definition: gprs_ns2_internal.h:107
int ns2_tx_sns_config(struct gprs_ns2_vc *nsvc, bool end_flag, const struct gprs_ns_ie_ip4_elem *ip4_elems, unsigned int num_ip4_elems, const struct gprs_ns_ie_ip6_elem *ip6_elems, unsigned int num_ip6_elems)
Encode + Transmit a SNS-CONFIG as per Section 9.3.4.
Definition: gprs_ns2_message.c:660
struct llist_head nsvc
llist head to hold all nsvc
Definition: gprs_ns2_internal.h:181
const char * name
Definition: gprs_ns2_internal.h:318
uint8_t sns_sig_weight
the IP-SNS signalling weight when doing dynamic configuration
Definition: gprs_ns2_internal.h:307
int ns2_vc_force_unconfigured(struct gprs_ns2_vc *nsvc)
Reset a NS-VC FSM.
Definition: gprs_ns2_vc_fsm.c:782
struct gprs_ns2_vc_bind * ns2_ip_get_bind_by_index(struct gprs_ns2_inst *nsi, struct osmo_sockaddr *remote, int index)
Definition: gprs_ns2_udp.c:580
Section 10.3.2d List of IP6 Elements.
Definition: gsm_08_16.h:32
void * cb_data
callback data
Definition: gprs_ns2_internal.h:151
bool accept_ipaccess
Definition: gprs_ns2_internal.h:284
struct gprs_ns2_vc * ns2_vc_alloc(struct gprs_ns2_vc_bind *bind, struct gprs_ns2_nse *nse, bool initiater, enum gprs_ns2_vc_mode vc_mode, const char *id)
Allocate a NS-VC within the given bind + NSE.
Definition: gprs_ns2.c:590
struct osmo_stat_item_group * statg
Definition: gprs_ns2_internal.h:311
Definition: gprs_ns2_internal.h:125
Definition: gprs_ns2_internal.h:84
const char * name
unique name
Definition: gprs_ns2_internal.h:273
int ns2_sns_add_sns_default_binds(struct gprs_ns2_nse *nse)
Definition: gprs_ns2_vty.c:1621
struct gprs_ns2_vc_driver * driver
Definition: gprs_ns2_internal.h:282
void ns2_sns_write_vty(struct vty *vty, const struct gprs_ns2_nse *nse)
write IP-SNS to a vty
Definition: gprs_ns2_sns.c:1810
Definition: gprs_ns2_internal.h:127
int ns2_nse_set_dialect(struct gprs_ns2_nse *nse, enum gprs_ns2_dialect dialect)
Definition: gprs_ns2.c:834
uint16_t bvci
Definition: gprs_msgb.h:260
int ns2_tx_sns_del(struct gprs_ns2_vc *nsvc, uint8_t trans_id, const struct gprs_ns_ie_ip4_elem *ip4_elems, unsigned int num_ip4_elems, const struct gprs_ns_ie_ip6_elem *ip6_elems, unsigned int num_ip6_elems)
Encode + Transmit a SNS-DEL as per Section 9.3.6.
Definition: gprs_ns2_message.c:579
int ns2_vc_block(struct gprs_ns2_vc *nsvc)
Block a NS-VC.
Definition: gprs_ns2_vc_fsm.c:790
Definition: gprs_ns2_internal.h:122
enum gprs_ns2_ll ll
which link-layer are we based on?
Definition: gprs_ns2_internal.h:294
int ns2_bind_alloc(struct gprs_ns2_inst *nsi, const char *name, struct gprs_ns2_vc_bind **result)
common allocation + low-level initialization of a bind.
Definition: gprs_ns2.c:1628
void * priv
Definition: gprs_ns2_internal.h:319
int ns2_tx_sns_size_ack(struct gprs_ns2_vc *nsvc, uint8_t *cause)
Encode + Transmit a SNS-SIZE-ACK as per Section 9.3.8.
Definition: gprs_ns2_message.c:810
nsvc_timer_mode
Definition: gprs_ns.h:113
int ns2_vc_rx(struct gprs_ns2_vc *nsvc, struct msgb *msg, struct tlv_parsed *tp)
entry point for messages from the driver/VL
Definition: gprs_ns2_vc_fsm.c:824
int nsvc_count
count all active NSVCs
Definition: gprs_ns2_internal.h:184
Definition: gprs_ns2_internal.h:99
uint32_t bind_rate_ctr_idx
Definition: gprs_ns2_internal.h:163
struct llist_head list
list of NS-VCs within NSE
Definition: gprs_ns2_internal.h:226
void ns2_sns_update_weights(struct gprs_ns2_vc_bind *bind)
Definition: gprs_ns2_sns.c:2067
struct osmo_fsm_inst * fi
Definition: gprs_ns2_internal.h:264
uint8_t data_weight
data weight.
Definition: gprs_ns2_internal.h:250
struct gprs_ns2_inst * nsi
a pointer back to the nsi
Definition: gprs_ns2_internal.h:281
Definition: gprs_ns2_internal.h:123
int ns2_tx_alive(struct gprs_ns2_vc *nsvc)
Transmit a NS-ALIVE on a given NS-VC.
Definition: gprs_ns2_message.c:363
int ns2_ip_count_bind(struct gprs_ns2_inst *nsi, struct osmo_sockaddr *remote)
Count UDP binds compatible with remote.
Definition: gprs_ns2_udp.c:558
Section 10.3.2c List of IP4 Elements.
Definition: gsm_08_16.h:24
Definition: gprs_ns2_internal.h:98
uint8_t msg[0]
enum gprs_ns2_ll ll
which link-layer are we based on?
Definition: gprs_ns2_internal.h:197
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.
Definition: gprs_ns2_sns.c:2358
bool freed
recursive anchor
Definition: gprs_ns2_internal.h:220
int transfer_capability
transfer capability in mbit
Definition: gprs_ns2_internal.h:288
Definition: gprs_ns2_internal.h:129
bool nsvci_is_valid
Definition: gprs_ns2_internal.h:255
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.
Definition: gprs_ns2_sns.c:1772
ns2_timeout
Definition: gprs_ns2_internal.h:81
int ns2_tx_reset_ack(struct gprs_ns2_vc *nsvc)
Transmit a NS-RESET-ACK on a given NS-VC.
Definition: gprs_ns2_message.c:302
enum gprs_ns2_vc_mode ns2_dialect_to_vc_mode(enum gprs_ns2_dialect dialect)
Definition: gprs_ns2.c:1523
uint32_t sum_data_weight
sum of all the data weight of alive NS-VCs
Definition: gprs_ns2_internal.h:205
bool ip_sns_role_sgsn
are we implementing the SGSN role?
Definition: gprs_ns2_internal.h:214
bool first
true if this NSE wasn't yet alive at all.
Definition: gprs_ns2_internal.h:191
uint16_t mtu
MTU of a NS PDU.
Definition: gprs_ns2_internal.h:211
Definition: gprs_ns2_internal.h:88
int ns2_tx_sns_change_weight(struct gprs_ns2_vc *nsvc, uint8_t trans_id, const struct gprs_ns_ie_ip4_elem *ip4_elems, unsigned int num_ip4_elems, const struct gprs_ns_ie_ip6_elem *ip6_elems, unsigned int num_ip6_elems)
Encode + Transmit a SNS-CHANGE-WEIGHT as per Section 9.3.3.
Definition: gprs_ns2_message.c:561
bool sns_only
should this NS-VC only be used for SNS-SIZE and SNS-CONFIG?
Definition: gprs_ns2_internal.h:257
GPRS Networks Service (NS) messages on the Gb interface.
int ns2_vc_is_unblocked(struct gprs_ns2_vc *nsvc)
is the given NS-VC unblocked?
Definition: gprs_ns2_vc_fsm.c:910
bool freed
recursive anchor
Definition: gprs_ns2_internal.h:314
Definition: gprs_ns2_internal.h:130
bool persistent
true if this NS was created by VTY or pcu socket)
Definition: gprs_ns2_internal.h:238
int ns2_recv_vc(struct gprs_ns2_vc *nsvc, struct msgb *msg)
Bottom-side entry-point for received NS PDU from the driver/bind.
Definition: gprs_ns2.c:1278
uint32_t nsvc_rate_ctr_idx
workaround for rate counter until rate counter accepts char str as index
Definition: gprs_ns2_internal.h:162
struct osmo_fsm_inst * bss_sns_fi
Definition: gprs_ns2_internal.h:202
int ns2_tx_unit_data(struct gprs_ns2_vc *nsvc, uint16_t bvci, uint8_t sducontrol, struct msgb *msg)
Transmit NS-UNITDATA on a given NS-VC.
Definition: gprs_ns2_message.c:388
int ns2_validate(struct gprs_ns2_vc *nsvc, uint8_t pdu_type, struct msgb *msg, struct tlv_parsed *tp, uint8_t *cause)
Definition: gprs_ns2_message.c:135
struct gprs_ns2_vc_bind * bind
pointer to NS VL bind.
Definition: gprs_ns2_internal.h:235
Definition: gprs_ns2_internal.h:124
struct llist_head nsvc
list of all VC
Definition: gprs_ns2_internal.h:277
gprs_ns2_ll
Osmocom NS link layer types.
Definition: gprs_ns2.h:44
int ns2_vc_unblock(struct gprs_ns2_vc *nsvc)
Unblock a NS-VC.
Definition: gprs_ns2_vc_fsm.c:802
Definition: gprs_ns2_internal.h:134
struct llist_head list
list entry in nsi
Definition: gprs_ns2_internal.h:275
int ns2_tx_block(struct gprs_ns2_vc *nsvc, uint8_t cause)
Transmit a NS-BLOCK on a given NS-VC.
Definition: gprs_ns2_message.c:211
enum gprs_ns2_dialect dialect
which dialect does this NSE speaks?
Definition: gprs_ns2_internal.h:200
#define NS_TIMERS_COUNT
Definition: gprs_ns2_internal.h:63
int ns2_tx_unblock(struct gprs_ns2_vc *nsvc)
Transmit a NS-UNBLOCK on a given NS-VC.
Definition: gprs_ns2_message.c:336
void(* free_bind)(struct gprs_ns2_vc_bind *driver)
Definition: gprs_ns2_internal.h:320
Definition: gprs_ns2_internal.h:90
void ns2_nse_notify_alive(struct gprs_ns2_vc *nsvc, bool alive)
struct llist_head binding
linked lists of all NSVC binds (e.g.
Definition: gprs_ns2_internal.h:154
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.
Definition: gprs_ns2_sns.c:1682
enum gprs_ns2_vc_mode mode
Definition: gprs_ns2_internal.h:262
Definition: gprs_ns2_internal.h:121
struct osmo_fsm_inst * ns2_sns_bss_fsm_alloc(struct gprs_ns2_nse *nse, const char *id)
Allocate an IP-SNS FSM for the BSS side.
Definition: gprs_ns2_sns.c:1648
struct rate_ctr_group * ctrg
Definition: gprs_ns2_internal.h:259
void(* free_vc)(struct gprs_ns2_vc *nsvc)
free the vc priv data
Definition: gprs_ns2_internal.h:300
int ns2_tx_block_ack(struct gprs_ns2_vc *nsvc)
Transmit a NS-BLOCK-ACK on a given NS-VC.
Definition: gprs_ns2_message.c:242
Definition: gprs_ns2_internal.h:103
void * priv
driver private structure
Definition: gprs_ns2_internal.h:279
bool freed
recursive anchor
Definition: gprs_ns2_internal.h:267
uint8_t pdu_type
NS PDU type.
Definition: gsm_08_16.h:201
int ns2_tx_unblock_ack(struct gprs_ns2_vc *nsvc)
Transmit a NS-UNBLOCK-ACK on a given NS-VC.
Definition: gprs_ns2_message.c:350