libosmogb  1.9.0.12-9519.202310132026
Osmocom Gb library
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>
11 #include <osmocom/gprs/gprs_ns2.h>
12 
13 #define LOGNSE(nse, lvl, fmt, args ...) \
14  LOGP(DLNS, lvl, "NSE(%05u) " fmt, (nse)->nsei, ## args)
15 
16 #define LOGBIND(bind, lvl, fmt, args ...) \
17  LOGP(DLNS, lvl, "BIND(%s) " fmt, (bind)->name, ## args)
18 
19 #define LOGNSVC_SS(ss, nsvc, lvl, fmt, args ...) \
20  do { \
21  if ((nsvc)->nsvci_is_valid) { \
22  LOGP(ss, lvl, "NSE(%05u)-NSVC(%05u) " fmt, \
23  (nsvc)->nse->nsei, (nsvc)->nsvci, ## args); \
24  } else { \
25  LOGP(ss, lvl, "NSE(%05u)-NSVC(none) " fmt, \
26  (nsvc)->nse->nsei, ## args); \
27  } \
28  } while (0)
29 
30 #define LOGNSVC(nsvc, lvl, fmt, args ...) \
31  LOGNSVC_SS(DLNS, nsvc, lvl, fmt, ## args)
32 
33 #define LOG_NS_SIGNAL(nsvc, direction, pdu_type, lvl, fmt, args ...) \
34  LOGNSVC_SS(DLNSSIGNAL, nsvc, lvl, "%s %s" fmt, direction, get_value_string(gprs_ns_pdu_strings, pdu_type), ## args)
35 
36 #define LOG_NS_DATA(nsvc, direction, pdu_type, lvl, fmt, args ...) \
37  LOGNSVC_SS(DLNSDATA, nsvc, lvl, "%s %s" fmt, direction, get_value_string(gprs_ns_pdu_strings, pdu_type), ## args)
38 
39 #define LOG_NS_RX_SIGNAL(nsvc, pdu_type) LOG_NS_SIGNAL(nsvc, "Rx", pdu_type, LOGL_INFO, "\n")
40 #define LOG_NS_TX_SIGNAL(nsvc, pdu_type) LOG_NS_SIGNAL(nsvc, "Tx", pdu_type, LOGL_INFO, "\n")
41 
42 #define RATE_CTR_INC_NS(nsvc, ctr) \
43  do { \
44  struct gprs_ns2_vc *_nsvc = (nsvc); \
45  rate_ctr_inc(rate_ctr_group_get_ctr(_nsvc->ctrg, ctr)); \
46  rate_ctr_inc(rate_ctr_group_get_ctr(_nsvc->nse->ctrg, ctr)); \
47  } while (0)
48 
49 #define RATE_CTR_ADD_NS(nsvc, ctr, val) \
50  do { \
51  struct gprs_ns2_vc *_nsvc = (nsvc); \
52  rate_ctr_add(rate_ctr_group_get_ctr(_nsvc->ctrg, ctr), val); \
53  rate_ctr_add(rate_ctr_group_get_ctr(_nsvc->nse->ctrg, ctr), val); \
54  } while (0)
55 
56 
57 struct osmo_fsm_inst;
58 struct tlv_parsed;
59 struct vty;
60 
61 struct gprs_ns2_vc_driver;
62 struct gprs_ns2_vc_bind;
63 
64 #define NS_TIMERS_COUNT 11
65 #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|tsns-procedures-retries)"
66 #define NS_TIMERS_HELP \
67  "(un)blocking Timer (Tns-block) timeout\n" \
68  "(un)blocking Timer (Tns-block) number of retries\n" \
69  "Reset Timer (Tns-reset) timeout\n" \
70  "Reset Timer (Tns-reset) number of retries\n" \
71  "Test Timer (Tns-test) timeout\n" \
72  "Alive Timer (Tns-alive) timeout\n" \
73  "Alive Timer (Tns-alive) number of retries\n" \
74  "SNS Provision Timer (Tsns-prov) timeout\n" \
75  "SNS Size number of retries\n" \
76  "SNS Config number of retries\n" \
77  "SNS Procedures number of retries\n" \
78 
79 /* Educated guess - LLC user payload is 1500 bytes plus possible headers */
80 #define NS_ALLOC_SIZE 3072
81 #define NS_ALLOC_HEADROOM 20
82 
83 #define NS_DEFAULT_TXQUEUE_MAX_LENGTH 128
84 
97 };
98 
100  /* standard timers */
105 };
106 
109 };
110 
113 };
114 
116 enum ns2_cs {
122 };
123 
124 enum ns_ctr {
140 };
141 
142 #define NSE_S_BLOCKED 0x0001
143 #define NSE_S_ALIVE 0x0002
144 #define NSE_S_RESET 0x0004
145 
146 #define NS_DESC_B(st) ((st) & NSE_S_BLOCKED ? "BLOCKED" : "UNBLOCKED")
147 #define NS_DESC_A(st) ((st) & NSE_S_ALIVE ? "ALIVE" : "DEAD")
148 #define NS_DESC_R(st) ((st) & NSE_S_RESET ? "RESET" : "UNRESET")
149 
154 
156  void *cb_data;
157 
160 
162  struct llist_head nse;
163 
165 
169 
171 };
172 
173 
175 struct gprs_ns2_nse {
176  uint16_t nsei;
177 
180 
182  struct llist_head list;
183 
185  struct llist_head nsvc;
186 
189 
192 
195  bool first;
196 
198  bool alive;
199 
201  enum gprs_ns2_ll ll;
202 
204  enum gprs_ns2_dialect dialect;
205 
207 
209  uint32_t sum_data_weight;
210 
212  uint32_t sum_sig_weight;
213 
215  uint16_t mtu;
216 
219 
222 
224  bool freed;
225 
227  struct timespec ts_alive_change;
228 };
229 
231 struct gprs_ns2_vc {
233  struct llist_head list;
234 
236  struct llist_head blist;
237 
239  struct gprs_ns2_nse *nse;
240 
243 
246 
248  uint16_t nsvci;
249 
251  uint8_t sig_weight;
252 
254  uint8_t sig_counter;
255 
257  uint8_t data_weight;
258 
260  void *priv;
261 
264  bool sns_only;
265 
268 
270 
271  struct osmo_fsm_inst *fi;
272 
274  bool freed;
275 
278 
280  struct timespec ts_alive_change;
281 };
282 
286  const char *name;
288  struct llist_head list;
290  struct llist_head nsvc;
292  void *priv;
296 
299 
302 
304  uint16_t mtu;
305 
307  enum gprs_ns2_ll ll;
308 
310  int (*send_vc)(struct gprs_ns2_vc *nsvc, struct msgb *msg);
311 
313  void (*free_vc)(struct gprs_ns2_vc *nsvc);
314 
316  void (*dump_vty)(const struct gprs_ns2_vc_bind *bind,
317  struct vty *vty, bool stats);
318 
320  uint8_t sns_sig_weight;
323 
325 
327  bool freed;
328 };
329 
331  const char *name;
332  void *priv;
334 };
335 
353 };
354 
355 enum ns2_cs ns2_create_vc(struct gprs_ns2_vc_bind *bind,
356  struct msgb *msg,
357  const struct osmo_sockaddr *remote,
358  const char *logname,
359  struct msgb **reject,
360  struct gprs_ns2_vc **success);
361 
362 int ns2_recv_vc(struct gprs_ns2_vc *nsvc,
363  struct msgb *msg);
364 
366  struct gprs_ns2_nse *nse,
367  bool initiater,
368  enum gprs_ns2_vc_mode vc_mode,
369  const char *id);
370 
371 void ns2_free_nsvcs(struct gprs_ns2_nse *nse);
372 int ns2_bind_alloc(struct gprs_ns2_inst *nsi, const char *name,
373  struct gprs_ns2_vc_bind **result);
374 
375 struct msgb *ns2_msgb_alloc(void);
376 
377 void ns2_sns_write_vty(struct vty *vty, const struct gprs_ns2_nse *nse);
378 void ns2_sns_dump_vty(struct vty *vty, const char *prefix, const struct gprs_ns2_nse *nse, bool stats);
380  struct gprs_ns2_vc *nsvc,
381  uint16_t bvci,
382  enum gprs_ns2_affecting_cause cause);
383 void ns2_nse_notify_alive(struct gprs_ns2_vc *nsvc, bool alive);
384 void ns2_nse_update_mtu(struct gprs_ns2_nse *nse);
385 int ns2_nse_set_dialect(struct gprs_ns2_nse *nse, enum gprs_ns2_dialect dialect);
386 
387 /* message */
388 int ns2_validate(struct gprs_ns2_vc *nsvc,
389  uint8_t pdu_type,
390  struct msgb *msg,
391  struct tlv_parsed *tp,
392  uint8_t *cause);
393 
394 /* SNS messages */
395 int ns2_tx_sns_ack(struct gprs_ns2_vc *nsvc, uint8_t trans_id, uint8_t *cause,
396  const struct gprs_ns_ie_ip4_elem *ip4_elems,
397  unsigned int num_ip4_elems,
398  const struct gprs_ns_ie_ip6_elem *ip6_elems,
399  unsigned int num_ip6_elems);
400 int ns2_tx_sns_config(struct gprs_ns2_vc *nsvc, bool end_flag,
401  const struct gprs_ns_ie_ip4_elem *ip4_elems,
402  unsigned int num_ip4_elems,
403  const struct gprs_ns_ie_ip6_elem *ip6_elems,
404  unsigned int num_ip6_elems);
405 int ns2_tx_sns_config_ack(struct gprs_ns2_vc *nsvc, uint8_t *cause);
406 int ns2_tx_sns_size(struct gprs_ns2_vc *nsvc, bool reset_flag, uint16_t max_nr_nsvc,
407  int ip4_ep_nr, int ip6_ep_nr);
408 int ns2_tx_sns_size_ack(struct gprs_ns2_vc *nsvc, uint8_t *cause);
409 
410 int ns2_tx_sns_add(struct gprs_ns2_vc *nsvc,
411  uint8_t trans_id,
412  const struct gprs_ns_ie_ip4_elem *ip4_elems,
413  unsigned int num_ip4_elems,
414  const struct gprs_ns_ie_ip6_elem *ip6_elems,
415  unsigned int num_ip6_elems);
416 int ns2_tx_sns_change_weight(struct gprs_ns2_vc *nsvc,
417  uint8_t trans_id,
418  const struct gprs_ns_ie_ip4_elem *ip4_elems,
419  unsigned int num_ip4_elems,
420  const struct gprs_ns_ie_ip6_elem *ip6_elems,
421  unsigned int num_ip6_elems);
422 int ns2_tx_sns_del(struct gprs_ns2_vc *nsvc,
423  uint8_t trans_id,
424  const struct gprs_ns_ie_ip4_elem *ip4_elems,
425  unsigned int num_ip4_elems,
426  const struct gprs_ns_ie_ip6_elem *ip6_elems,
427  unsigned int num_ip6_elems);
428 
429 /* transmit message over a VC */
430 int ns2_tx_block(struct gprs_ns2_vc *nsvc, uint8_t cause, uint16_t *nsvci);
431 int ns2_tx_block_ack(struct gprs_ns2_vc *nsvc, uint16_t *nsvci);
432 
433 int ns2_tx_reset(struct gprs_ns2_vc *nsvc, uint8_t cause);
434 int ns2_tx_reset_ack(struct gprs_ns2_vc *nsvc);
435 
436 int ns2_tx_unblock(struct gprs_ns2_vc *nsvc);
437 int ns2_tx_unblock_ack(struct gprs_ns2_vc *nsvc);
438 
439 int ns2_tx_alive(struct gprs_ns2_vc *nsvc);
440 int ns2_tx_alive_ack(struct gprs_ns2_vc *nsvc);
441 
442 int ns2_tx_unit_data(struct gprs_ns2_vc *nsvc,
443  uint16_t bvci, uint8_t sducontrol,
444  struct msgb *msg);
445 
446 int ns2_tx_status(struct gprs_ns2_vc *nsvc, uint8_t cause,
447  uint16_t bvci, struct msgb *orig_msg, uint16_t *nsvci);
448 
449 /* driver */
451  struct gprs_ns2_nse *nse,
452  const struct osmo_sockaddr *remote);
453 int ns2_ip_count_bind(struct gprs_ns2_inst *nsi, struct osmo_sockaddr *remote);
455  struct osmo_sockaddr *remote,
456  int index);
457 void ns2_ip_set_txqueue_max_length(struct gprs_ns2_vc_bind *bind, unsigned int max_length);
458 
459 /* sns */
460 int ns2_sns_rx(struct gprs_ns2_vc *nsvc, struct msgb *msg, struct tlv_parsed *tp);
462  const char *id);
463 struct osmo_fsm_inst *ns2_sns_sgsn_fsm_alloc(struct gprs_ns2_nse *nse, const char *id);
464 void ns2_sns_replace_nsvc(struct gprs_ns2_vc *nsvc);
465 void ns2_sns_notify_alive(struct gprs_ns2_nse *nse, struct gprs_ns2_vc *nsvc, bool alive);
466 void ns2_sns_update_weights(struct gprs_ns2_vc_bind *bind);
467 
468 /* vc */
469 struct osmo_fsm_inst *ns2_vc_fsm_alloc(struct gprs_ns2_vc *nsvc,
470  const char *id, bool initiate);
471 int ns2_vc_fsm_start(struct gprs_ns2_vc *nsvc);
472 int ns2_vc_force_unconfigured(struct gprs_ns2_vc *nsvc);
473 int ns2_vc_rx(struct gprs_ns2_vc *nsvc, struct msgb *msg, struct tlv_parsed *tp);
474 int ns2_vc_is_alive(struct gprs_ns2_vc *nsvc);
475 int ns2_vc_is_unblocked(struct gprs_ns2_vc *nsvc);
476 int ns2_vc_block(struct gprs_ns2_vc *nsvc);
477 int ns2_vc_reset(struct gprs_ns2_vc *nsvc);
478 int ns2_vc_unblock(struct gprs_ns2_vc *nsvc);
479 void ns2_vty_dump_nsvc(struct vty *vty, struct gprs_ns2_vc *nsvc, bool stats);
480 
481 /* nse */
482 void ns2_nse_notify_unblocked(struct gprs_ns2_vc *nsvc, bool unblocked);
485  uint16_t bvci);
486 
487 /* 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:605
Structure representing a single NS-VC.
Definition: gprs_ns2_internal.h:231
remove a local bind from this NSE
Definition: gprs_ns2_internal.h:351
Definition: gprs_ns2_internal.h:102
Definition: gprs_ns2_internal.h:344
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:769
a bind changed its weight
Definition: gprs_ns2_internal.h:352
Skipped message.
Definition: gprs_ns2_internal.h:120
Definition: gprs_ns2_internal.h:136
ns_ctr
Definition: gprs_ns.c:128
void ns2_free_nsvcs(struct gprs_ns2_nse *nse)
Definition: gprs_ns2.c:668
bool accept_sns
Definition: gprs_ns2_internal.h:298
void * priv
can be used by the bind/driver of the virtual circuit.
Definition: gprs_ns2_internal.h:260
int ns2_count_transfer_cap(struct gprs_ns2_nse *nse, uint16_t bvci)
calculate the transfer capabilities for a nse
Definition: gprs_ns2.c:1610
bool persistent
true if this NSE was created by VTY or pcu socket)
Definition: gprs_ns2_internal.h:191
Failed to process message.
Definition: gprs_ns2_internal.h:121
A NSVC object has been created.
Definition: gprs_ns2_internal.h:117
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:1392
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:790
int ns2_vc_fsm_start(struct gprs_ns2_vc *nsvc)
Start a NS-VC FSM.
Definition: gprs_ns2_vc_fsm.c:813
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:297
Definition: gprs_ns2_internal.h:125
static void free_vc(struct gprs_ns2_vc *nsvc)
Definition: gprs_ns2_fr.c:118
uint8_t sig_weight
signalling weight.
Definition: gprs_ns2_internal.h:251
Structure repesenting a bind instance.
Definition: gprs_ns2_internal.h:284
uint16_t nsvci
uniquely identifies NS-VC if VC contains nsvci
Definition: gprs_ns2_internal.h:248
Definition: gprs_ns2_internal.h:89
Definition: gprs_ns2_internal.h:95
Structure repesenting a NSE.
Definition: gprs_ns2_internal.h:175
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:273
Definition: gprs_ns2_internal.h:91
add a new local bind to this NSE
Definition: gprs_ns2_internal.h:350
void ns2_sns_notify_alive(struct gprs_ns2_nse *nse, struct gprs_ns2_vc *nsvc, bool alive)
Definition: gprs_ns2_sns.c:2587
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:550
osmo_prim_cb cb
callback to the user for incoming UNIT DATA IND
Definition: gprs_ns2_internal.h:153
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:376
Definition: gprs_ns2_internal.h:93
int ns2_tx_block_ack(struct gprs_ns2_vc *nsvc, uint16_t *nsvci)
Transmit a NS-BLOCK-ACK on a given NS-VC.
Definition: gprs_ns2_message.c:239
ns2_cs
Osmocom NS2 VC create status.
Definition: gprs_ns2_internal.h:116
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:131
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:151
uint8_t sns_data_weight
the IP-SNS data weight when doing dynamic configuration
Definition: gprs_ns2_internal.h:322
Definition: gprs_ns2_internal.h:138
ns2_vc_stat
Definition: gprs_ns2_internal.h:107
uint16_t nsei
Definition: gprs_ns2_internal.h:176
Definition: gprs_ns2_internal.h:345
Definition: gprs_ns2_internal.h:343
bool alive
true if this NSE has at least one alive VC
Definition: gprs_ns2_internal.h:198
struct msgb * ns2_msgb_alloc(void)
Allocate a message buffer for use with the NS2 stack.
Definition: gprs_ns2.c:695
Definition: gprs_ns2_internal.h:340
Definition: gprs_ns2_internal.h:330
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:356
Definition: gprs_ns2_internal.h:87
Rejected and answered message.
Definition: gprs_ns2_internal.h:119
Definition: gprs_ns2_internal.h:90
Select a SNS endpoint from the list.
Definition: gprs_ns2_internal.h:337
uint16_t mtu
MTU of a NS PDU on this bind.
Definition: gprs_ns2_internal.h:304
bool om_blocked
if blocked by O&M/vty
Definition: gprs_ns2_internal.h:277
ns2_bind_stat
Definition: gprs_ns2_internal.h:111
struct osmo_stat_item_group * statg
Definition: gprs_ns2_internal.h:267
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:723
Definition: gprs_ns2_internal.h:339
Definition: gprs_ns2_internal.h:133
int ns2_vc_is_alive(struct gprs_ns2_vc *nsvc)
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:1005
uint8_t sig_counter
signalling packet counter for the load sharing function
Definition: gprs_ns2_internal.h:254
struct rate_ctr_group * ctrg
NSE-wide statistics.
Definition: gprs_ns2_internal.h:221
uint32_t sum_sig_weight
sum of all the signalling weight of alive NS-VCs
Definition: gprs_ns2_internal.h:212
int ns2_vc_reset(struct gprs_ns2_vc *nsvc)
Reset a NS-VC.
Definition: gprs_ns2_vc_fsm.c:856
void ns2_nse_update_mtu(struct gprs_ns2_nse *nse)
Definition: gprs_ns2.c:1580
Definition: gprs_ns2_internal.h:101
struct gprs_ns2_inst * nsi
entry back to ns2_inst
Definition: gprs_ns2_internal.h:179
uint16_t timeout[NS_TIMERS_COUNT]
Definition: gprs_ns2_internal.h:164
gprs_ns2_vc_mode
Definition: gprs_ns2.h:25
Definition: gprs_ns2_internal.h:86
void ns2_vty_dump_nsvc(struct vty *vty, struct gprs_ns2_vc *nsvc, bool stats)
Definition: gprs_ns2_vty.c:1900
struct gprs_ns2_nse * nse
pointer to NS Instance
Definition: gprs_ns2_internal.h:239
struct llist_head nse
linked lists of all NSVC in this instance
Definition: gprs_ns2_internal.h:162
A NSVC object has been found.
Definition: gprs_ns2_internal.h:118
gprs_ns2_dialect
Definition: gprs_ns2.h:35
static void dump_vty(const struct gprs_ns2_vc_bind *bind, struct vty *vty, bool stats)
Definition: gprs_ns2_fr.c:131
Definition: gprs_ns2_internal.h:137
Definition: gprs_ns2_internal.h:112
int ns2_tx_block(struct gprs_ns2_vc *nsvc, uint8_t cause, uint16_t *nsvci)
Transmit a NS-BLOCK on a given NS-VC.
Definition: gprs_ns2_message.c:202
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:667
Rx of SNS-ACK (response to ADD/DELETE/CHG_WEIGHT.
Definition: gprs_ns2_internal.h:346
const char * name
Definition: gprs_ns2_internal.h:331
uint8_t sns_sig_weight
the IP-SNS signalling weight when doing dynamic configuration
Definition: gprs_ns2_internal.h:320
int ns2_vc_force_unconfigured(struct gprs_ns2_vc *nsvc)
Reset a NS-VC FSM.
Definition: gprs_ns2_vc_fsm.c:824
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:552
Section 10.3.2d List of IP6 Elements.
Definition: gsm_08_16.h:32
void * cb_data
callback data
Definition: gprs_ns2_internal.h:156
bool accept_ipaccess
Definition: gprs_ns2_internal.h:297
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:324
SNS-CONFIG with end flag received.
Definition: gprs_ns2_internal.h:341
Definition: gprs_ns2_internal.h:130
Definition: gprs_ns2_internal.h:88
const char * name
unique name
Definition: gprs_ns2_internal.h:286
int ns2_sns_add_sns_default_binds(struct gprs_ns2_nse *nse)
Definition: gprs_ns2_vty.c:1626
struct gprs_ns2_vc_driver * driver
Definition: gprs_ns2_internal.h:295
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:2437
Definition: gprs_ns2_internal.h:96
Definition: gprs_ns2_internal.h:132
int ns2_nse_set_dialect(struct gprs_ns2_nse *nse, enum gprs_ns2_dialect dialect)
Definition: gprs_ns2.c:847
uint16_t bvci
Definition: gprs_msgb.h:261
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:586
int ns2_vc_block(struct gprs_ns2_vc *nsvc)
Block a NS-VC.
Definition: gprs_ns2_vc_fsm.c:832
Definition: gprs_ns2_internal.h:127
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:1654
void * priv
Definition: gprs_ns2_internal.h:332
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:817
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:866
int ns2_tx_status(struct gprs_ns2_vc *nsvc, uint8_t cause, uint16_t bvci, struct msgb *orig_msg, uint16_t *nsvci)
Transmit a NS-STATUS on a given NS-VC.
Definition: gprs_ns2_message.c:423
int nsvc_count
count all active NSVCs
Definition: gprs_ns2_internal.h:188
Definition: gprs_ns2_internal.h:104
uint32_t bind_rate_ctr_idx
Definition: gprs_ns2_internal.h:168
void ns2_sns_update_weights(struct gprs_ns2_vc_bind *bind)
Definition: gprs_ns2_sns.c:2711
a NS-VC became alive
Definition: gprs_ns2_internal.h:349
free all NS-VCs
Definition: gprs_ns2_internal.h:348
struct osmo_fsm_inst * fi
Definition: gprs_ns2_internal.h:271
no more NS-VC remaining (all dead)
Definition: gprs_ns2_internal.h:347
uint32_t txqueue_max_length
Definition: gprs_ns2_internal.h:170
uint8_t data_weight
data weight.
Definition: gprs_ns2_internal.h:257
struct gprs_ns2_inst * nsi
a pointer back to the nsi
Definition: gprs_ns2_internal.h:294
Definition: gprs_ns2_internal.h:128
int ns2_tx_alive(struct gprs_ns2_vc *nsvc)
Transmit a NS-ALIVE on a given NS-VC.
Definition: gprs_ns2_message.c:365
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:530
uint8_t mode
Section 10.3.2c List of IP4 Elements.
Definition: gsm_08_16.h:24
Definition: gprs_ns2_internal.h:103
int(* osmo_prim_cb)(struct osmo_prim_hdr *oph, void *ctx)
uint8_t msg[0]
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:3072
bool freed
recursive anchor
Definition: gprs_ns2_internal.h:224
int transfer_capability
transfer capability in mbit
Definition: gprs_ns2_internal.h:301
static void free_bind(struct gprs_ns2_vc_bind *bind)
clean up all private driver state.
Definition: gprs_ns2_fr.c:154
Definition: gprs_ns2_internal.h:134
bool nsvci_is_valid
Definition: gprs_ns2_internal.h:262
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:2399
ns2_timeout
Definition: gprs_ns2_internal.h:85
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:304
enum gprs_ns2_vc_mode ns2_dialect_to_vc_mode(enum gprs_ns2_dialect dialect)
Definition: gprs_ns2.c:1549
uint32_t sum_data_weight
sum of all the data weight of alive NS-VCs
Definition: gprs_ns2_internal.h:209
bool ip_sns_role_sgsn
are we implementing the SGSN role?
Definition: gprs_ns2_internal.h:218
bool first
true if this NSE wasn&#39;t yet alive at all.
Definition: gprs_ns2_internal.h:195
Definition: gprs_ns2_internal.h:338
uint16_t mtu
MTU of a NS PDU.
Definition: gprs_ns2_internal.h:215
Definition: gprs_ns2_internal.h:92
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:568
bool sns_only
should this NS-VC only be used for SNS-SIZE and SNS-CONFIG?
Definition: gprs_ns2_internal.h:264
GPRS Networks Service (NS) messages on the Gb interface.
Definition: gprs_ns2_internal.h:342
int ns2_vc_is_unblocked(struct gprs_ns2_vc *nsvc)
is the given NS-VC unblocked?
Definition: gprs_ns2_vc_fsm.c:983
bool freed
recursive anchor
Definition: gprs_ns2_internal.h:327
Definition: gprs_ns2_internal.h:135
bool persistent
true if this NS was created by VTY or pcu socket)
Definition: gprs_ns2_internal.h:245
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:1290
ns2_sns_event
Definition: gprs_ns2_internal.h:336
uint32_t nsvc_rate_ctr_idx
workaround for rate counter until rate counter accepts char str as index
Definition: gprs_ns2_internal.h:167
struct osmo_fsm_inst * bss_sns_fi
Definition: gprs_ns2_internal.h:206
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:390
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:139
struct gprs_ns2_vc_bind * bind
pointer to NS VL bind.
Definition: gprs_ns2_internal.h:242
Definition: gprs_ns2_internal.h:129
struct llist_head nsvc
list of all VC
Definition: gprs_ns2_internal.h:290
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:844
Definition: gprs_ns2_internal.h:139
#define NS_TIMERS_COUNT
Definition: gprs_ns2_internal.h:64
int ns2_tx_unblock(struct gprs_ns2_vc *nsvc)
Transmit a NS-UNBLOCK on a given NS-VC.
Definition: gprs_ns2_message.c:338
Definition: gprs_ns2_internal.h:94
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:159
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:2310
void ns2_ip_set_txqueue_max_length(struct gprs_ns2_vc_bind *bind, unsigned int max_length)
Definition: gprs_ns2_udp.c:578
Definition: gprs_ns2_internal.h:126
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:2275
struct rate_ctr_group * ctrg
Definition: gprs_ns2_internal.h:266
Definition: gprs_ns2_internal.h:108
void * priv
driver private structure
Definition: gprs_ns2_internal.h:292
bool freed
recursive anchor
Definition: gprs_ns2_internal.h:274
uint8_t pdu_type
NS PDU type.
Definition: gsm_08_16.h:9
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:352