libosmogb  1.5.1.124-fc02
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>
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 
42 struct osmo_fsm_inst;
43 struct tlv_parsed;
44 struct vty;
45 
46 struct gprs_ns2_vc_driver;
47 struct gprs_ns2_vc_bind;
48 
49 #define NS_TIMERS_COUNT 10
50 #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)"
51 #define NS_TIMERS_HELP \
52  "(un)blocking Timer (Tns-block) timeout\n" \
53  "(un)blocking Timer (Tns-block) number of retries\n" \
54  "Reset Timer (Tns-reset) timeout\n" \
55  "Reset Timer (Tns-reset) number of retries\n" \
56  "Test Timer (Tns-test) timeout\n" \
57  "Alive Timer (Tns-alive) timeout\n" \
58  "Alive Timer (Tns-alive) number of retries\n" \
59  "SNS Provision Timer (Tsns-prov) timeout\n" \
60  "SNS Size number of retries\n" \
61  "SNS Config number of retries\n" \
62 
63 /* Educated guess - LLC user payload is 1500 bytes plus possible headers */
64 #define NS_ALLOC_SIZE 3072
65 #define NS_ALLOC_HEADROOM 20
66 
78 };
79 
81  /* standard timers */
86 };
87 
90 };
91 
94 };
95 
97 enum ns2_cs {
103 };
104 
105 enum ns_ctr {
121 };
122 
123 #define NSE_S_BLOCKED 0x0001
124 #define NSE_S_ALIVE 0x0002
125 #define NSE_S_RESET 0x0004
126 
127 #define NS_DESC_B(st) ((st) & NSE_S_BLOCKED ? "BLOCKED" : "UNBLOCKED")
128 #define NS_DESC_A(st) ((st) & NSE_S_ALIVE ? "ALIVE" : "DEAD")
129 #define NS_DESC_R(st) ((st) & NSE_S_RESET ? "RESET" : "UNRESET")
130 
135 
137  void *cb_data;
138 
141 
143  struct llist_head nse;
144 
146 
150 
153 };
154 
155 
157 struct gprs_ns2_nse {
158  uint16_t nsei;
159 
162 
164  struct llist_head list;
165 
167  struct llist_head nsvc;
168 
171 
174 
177  bool first;
178 
180  bool alive;
181 
183  enum gprs_ns2_ll ll;
184 
186  enum gprs_ns2_dialect dialect;
187 
189 
191  uint32_t sum_data_weight;
192 
194  uint32_t sum_sig_weight;
195 
197  uint16_t mtu;
198 
201 };
202 
204 struct gprs_ns2_vc {
206  struct llist_head list;
207 
209  struct llist_head blist;
210 
212  struct gprs_ns2_nse *nse;
213 
216 
219 
221  uint16_t nsvci;
222 
224  uint8_t sig_weight;
225 
227  uint8_t sig_counter;
228 
230  uint8_t data_weight;
231 
233  void *priv;
234 
237  bool sns_only;
238 
241 
243 
244  struct osmo_fsm_inst *fi;
245 };
246 
250  const char *name;
252  struct llist_head list;
254  struct llist_head nsvc;
256  void *priv;
260 
263 
266 
268  uint16_t mtu;
269 
271  enum gprs_ns2_ll ll;
272 
274  int (*send_vc)(struct gprs_ns2_vc *nsvc, struct msgb *msg);
275 
277  void (*free_vc)(struct gprs_ns2_vc *nsvc);
278 
280  void (*dump_vty)(const struct gprs_ns2_vc_bind *bind,
281  struct vty *vty, bool stats);
282 
284  uint8_t sns_sig_weight;
287 
289 };
290 
292  const char *name;
293  void *priv;
295 };
296 
297 enum ns2_cs ns2_create_vc(struct gprs_ns2_vc_bind *bind,
298  struct msgb *msg,
299  const struct osmo_sockaddr *remote,
300  const char *logname,
301  struct msgb **reject,
302  struct gprs_ns2_vc **success);
303 
304 int ns2_recv_vc(struct gprs_ns2_vc *nsvc,
305  struct msgb *msg);
306 
308  struct gprs_ns2_nse *nse,
309  bool initiater,
310  enum gprs_ns2_vc_mode vc_mode,
311  const char *id);
312 
313 int ns2_bind_alloc(struct gprs_ns2_inst *nsi, const char *name,
314  struct gprs_ns2_vc_bind **result);
315 
316 struct msgb *ns2_msgb_alloc(void);
317 
318 void ns2_sns_write_vty(struct vty *vty, const struct gprs_ns2_nse *nse);
319 void ns2_sns_dump_vty(struct vty *vty, const char *prefix, const struct gprs_ns2_nse *nse, bool stats);
321  struct gprs_ns2_vc *nsvc,
322  uint16_t bvci,
323  enum gprs_ns2_affecting_cause cause);
324 void ns2_nse_notify_alive(struct gprs_ns2_vc *nsvc, bool alive);
325 void ns2_nse_update_mtu(struct gprs_ns2_nse *nse);
326 int ns2_nse_set_dialect(struct gprs_ns2_nse *nse, enum gprs_ns2_dialect dialect);
327 
328 /* message */
329 int ns2_validate(struct gprs_ns2_vc *nsvc,
330  uint8_t pdu_type,
331  struct msgb *msg,
332  struct tlv_parsed *tp,
333  uint8_t *cause);
334 
335 /* SNS messages */
336 int ns2_tx_sns_ack(struct gprs_ns2_vc *nsvc, uint8_t trans_id, uint8_t *cause,
337  const struct gprs_ns_ie_ip4_elem *ip4_elems,
338  unsigned int num_ip4_elems,
339  const struct gprs_ns_ie_ip6_elem *ip6_elems,
340  unsigned int num_ip6_elems);
341 int ns2_tx_sns_config(struct gprs_ns2_vc *nsvc, bool end_flag,
342  const struct gprs_ns_ie_ip4_elem *ip4_elems,
343  unsigned int num_ip4_elems,
344  const struct gprs_ns_ie_ip6_elem *ip6_elems,
345  unsigned int num_ip6_elems);
346 int ns2_tx_sns_config_ack(struct gprs_ns2_vc *nsvc, uint8_t *cause);
347 int ns2_tx_sns_size(struct gprs_ns2_vc *nsvc, bool reset_flag, uint16_t max_nr_nsvc,
348  int ip4_ep_nr, int ip6_ep_nr);
349 int ns2_tx_sns_size_ack(struct gprs_ns2_vc *nsvc, uint8_t *cause);
350 
351 int ns2_tx_sns_add(struct gprs_ns2_vc *nsvc,
352  uint8_t trans_id,
353  const struct gprs_ns_ie_ip4_elem *ip4_elems,
354  unsigned int num_ip4_elems,
355  const struct gprs_ns_ie_ip6_elem *ip6_elems,
356  unsigned int num_ip6_elems);
357 int ns2_tx_sns_change_weight(struct gprs_ns2_vc *nsvc,
358  uint8_t trans_id,
359  const struct gprs_ns_ie_ip4_elem *ip4_elems,
360  unsigned int num_ip4_elems,
361  const struct gprs_ns_ie_ip6_elem *ip6_elems,
362  unsigned int num_ip6_elems);
363 int ns2_tx_sns_del(struct gprs_ns2_vc *nsvc,
364  uint8_t trans_id,
365  const struct gprs_ns_ie_ip4_elem *ip4_elems,
366  unsigned int num_ip4_elems,
367  const struct gprs_ns_ie_ip6_elem *ip6_elems,
368  unsigned int num_ip6_elems);
369 
370 /* transmit message over a VC */
371 int ns2_tx_block(struct gprs_ns2_vc *nsvc, uint8_t cause);
372 int ns2_tx_block_ack(struct gprs_ns2_vc *nsvc);
373 
374 int ns2_tx_reset(struct gprs_ns2_vc *nsvc, uint8_t cause);
375 int ns2_tx_reset_ack(struct gprs_ns2_vc *nsvc);
376 
377 int ns2_tx_unblock(struct gprs_ns2_vc *nsvc);
378 int ns2_tx_unblock_ack(struct gprs_ns2_vc *nsvc);
379 
380 int ns2_tx_alive(struct gprs_ns2_vc *nsvc);
381 int ns2_tx_alive_ack(struct gprs_ns2_vc *nsvc);
382 
383 int ns2_tx_unit_data(struct gprs_ns2_vc *nsvc,
384  uint16_t bvci, uint8_t sducontrol,
385  struct msgb *msg);
386 
387 int ns2_tx_status(struct gprs_ns2_vc *nsvc, uint8_t cause,
388  uint16_t bvci, struct msgb *orig_msg);
389 
390 /* driver */
392  struct gprs_ns2_nse *nse,
393  const struct osmo_sockaddr *remote);
394 int ns2_ip_count_bind(struct gprs_ns2_inst *nsi, struct osmo_sockaddr *remote);
396  struct osmo_sockaddr *remote,
397  int index);
398 
399 /* sns */
400 int ns2_sns_rx(struct gprs_ns2_vc *nsvc, struct msgb *msg, struct tlv_parsed *tp);
402  const char *id);
403 struct osmo_fsm_inst *ns2_sns_sgsn_fsm_alloc(struct gprs_ns2_nse *nse, const char *id);
404 void ns2_sns_replace_nsvc(struct gprs_ns2_vc *nsvc);
405 void ns2_sns_notify_alive(struct gprs_ns2_nse *nse, struct gprs_ns2_vc *nsvc, bool alive);
406 void ns2_sns_update_weights(struct gprs_ns2_vc_bind *bind);
407 
408 /* vc */
409 struct osmo_fsm_inst *ns2_vc_fsm_alloc(struct gprs_ns2_vc *nsvc,
410  const char *id, bool initiate);
411 int ns2_vc_fsm_start(struct gprs_ns2_vc *nsvc);
412 int ns2_vc_force_unconfigured(struct gprs_ns2_vc *nsvc);
413 int ns2_vc_rx(struct gprs_ns2_vc *nsvc, struct msgb *msg, struct tlv_parsed *tp);
414 int ns2_vc_is_alive(struct gprs_ns2_vc *nsvc);
415 int ns2_vc_is_unblocked(struct gprs_ns2_vc *nsvc);
416 int ns2_vc_block(struct gprs_ns2_vc *nsvc);
417 int ns2_vc_reset(struct gprs_ns2_vc *nsvc);
418 int ns2_vc_unblock(struct gprs_ns2_vc *nsvc);
419 void ns2_vty_dump_nsvc(struct vty *vty, struct gprs_ns2_vc *nsvc, bool stats);
420 
421 /* nse */
422 void ns2_nse_notify_unblocked(struct gprs_ns2_vc *nsvc, bool unblocked);
425  uint16_t bvci);
426 
427 /* 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:204
Definition: gprs_ns2_internal.h:83
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:101
Definition: gprs_ns2_internal.h:117
ns_ctr
Definition: gprs_ns.c:128
bool accept_sns
Definition: gprs_ns2_internal.h:262
void * priv
can be used by the bind/driver of the virtual circuit.
Definition: gprs_ns2_internal.h:233
int ns2_count_transfer_cap(struct gprs_ns2_nse *nse, uint16_t bvci)
calculate the transfer capabilities for a nse
Definition: gprs_ns2.c:1553
bool persistent
true if this NSE was created by VTY or pcu socket)
Definition: gprs_ns2_internal.h:173
Failed to process message.
Definition: gprs_ns2_internal.h:102
A NSVC object has been created.
Definition: gprs_ns2_internal.h:98
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:1350
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:743
int ns2_vc_fsm_start(struct gprs_ns2_vc *nsvc)
Start a NS-VC FSM.
Definition: gprs_ns2_vc_fsm.c:766
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:265
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:106
static void free_vc(struct gprs_ns2_vc *nsvc)
Definition: gprs_ns2_fr.c:125
uint8_t sig_weight
signalling weight.
Definition: gprs_ns2_internal.h:224
Structure repesenting a bind instance.
Definition: gprs_ns2_internal.h:248
uint16_t nsvci
uniquely identifies NS-VC if VC contains nsvci
Definition: gprs_ns2_internal.h:221
Definition: gprs_ns2_internal.h:71
Definition: gprs_ns2_internal.h:77
Structure repesenting a NSE.
Definition: gprs_ns2_internal.h:157
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:73
void ns2_sns_notify_alive(struct gprs_ns2_nse *nse, struct gprs_ns2_vc *nsvc, bool alive)
Definition: gprs_ns2_sns.c:1905
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
osmo_prim_cb cb
callback to the user for incoming UNIT DATA IND
Definition: gprs_ns2_internal.h:134
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:75
ns2_cs
Osmocom NS2 VC create status.
Definition: gprs_ns2_internal.h:97
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:112
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:541
An instance of the NS protocol stack.
Definition: gprs_ns2_internal.h:132
uint8_t sns_data_weight
the IP-SNS data weight when doing dynamic configuration
Definition: gprs_ns2_internal.h:286
Definition: gprs_ns2_internal.h:119
ns2_vc_stat
Definition: gprs_ns2_internal.h:88
uint16_t nsei
Definition: gprs_ns2_internal.h:158
struct osmo_mnl * linkmon_mnl
libmnl netlink socket for link state monitoring
Definition: gprs_ns2_internal.h:152
bool alive
true if this NSE has at least one alive VC
Definition: gprs_ns2_internal.h:180
struct msgb * ns2_msgb_alloc(void)
Allocate a message buffer for use with the NS2 stack.
Definition: gprs_ns2.c:670
Definition: gprs_ns2_internal.h:291
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:382
Definition: gprs_ns2_internal.h:69
Rejected and answered message.
Definition: gprs_ns2_internal.h:100
Definition: gprs_ns2_internal.h:72
uint16_t mtu
MTU of a NS PDU on this bind.
Definition: gprs_ns2_internal.h:268
ns2_bind_stat
Definition: gprs_ns2_internal.h:92
struct osmo_stat_item_group * statg
Definition: gprs_ns2_internal.h:240
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:114
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:968
uint8_t sig_counter
signalling packet counter for the load sharing function
Definition: gprs_ns2_internal.h:227
uint32_t sum_sig_weight
sum of all the signalling weight of alive NS-VCs
Definition: gprs_ns2_internal.h:194
int ns2_vc_reset(struct gprs_ns2_vc *nsvc)
Reset a NS-VC.
Definition: gprs_ns2_vc_fsm.c:809
void ns2_nse_update_mtu(struct gprs_ns2_nse *nse)
Definition: gprs_ns2.c:1523
Definition: gprs_ns2_internal.h:82
struct gprs_ns2_inst * nsi
entry back to ns2_inst
Definition: gprs_ns2_internal.h:161
uint16_t timeout[NS_TIMERS_COUNT]
Definition: gprs_ns2_internal.h:145
gprs_ns2_vc_mode
Definition: gprs_ns2.h:25
Definition: gprs_ns2_internal.h:68
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:212
struct llist_head nse
linked lists of all NSVC in this instance
Definition: gprs_ns2_internal.h:143
A NSVC object has been found.
Definition: gprs_ns2_internal.h:99
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:138
Definition: gprs_ns2_internal.h:118
Definition: gprs_ns2_internal.h:93
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
const char * name
Definition: gprs_ns2_internal.h:292
uint8_t sns_sig_weight
the IP-SNS signalling weight when doing dynamic configuration
Definition: gprs_ns2_internal.h:284
int ns2_vc_force_unconfigured(struct gprs_ns2_vc *nsvc)
Reset a NS-VC FSM.
Definition: gprs_ns2_vc_fsm.c:777
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:576
Section 10.3.2d List of IP6 Elements.
Definition: gsm_08_16.h:32
void * cb_data
callback data
Definition: gprs_ns2_internal.h:137
bool accept_ipaccess
Definition: gprs_ns2_internal.h:261
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:580
struct osmo_stat_item_group * statg
Definition: gprs_ns2_internal.h:288
Definition: gprs_ns2_internal.h:111
Definition: gprs_ns2_internal.h:70
const char * name
unique name
Definition: gprs_ns2_internal.h:250
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:259
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:1755
Definition: gprs_ns2_internal.h:113
int ns2_nse_set_dialect(struct gprs_ns2_nse *nse, enum gprs_ns2_dialect dialect)
Definition: gprs_ns2.c:815
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:785
Definition: gprs_ns2_internal.h:108
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:1597
void * priv
Definition: gprs_ns2_internal.h:293
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:819
int nsvc_count
count all active NSVCs
Definition: gprs_ns2_internal.h:170
Definition: gprs_ns2_internal.h:85
uint32_t bind_rate_ctr_idx
Definition: gprs_ns2_internal.h:149
void ns2_sns_update_weights(struct gprs_ns2_vc_bind *bind)
Definition: gprs_ns2_sns.c:2012
struct osmo_fsm_inst * fi
Definition: gprs_ns2_internal.h:244
uint8_t data_weight
data weight.
Definition: gprs_ns2_internal.h:230
struct gprs_ns2_inst * nsi
a pointer back to the nsi
Definition: gprs_ns2_internal.h:258
Definition: gprs_ns2_internal.h:109
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:554
uint8_t mode
Section 10.3.2c List of IP4 Elements.
Definition: gsm_08_16.h:24
Definition: gprs_ns2_internal.h:84
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:2289
int transfer_capability
transfer capability in mbit
Definition: gprs_ns2_internal.h:265
static void free_bind(struct gprs_ns2_vc_bind *bind)
clean up all private driver state.
Definition: gprs_ns2_fr.c:161
Definition: gprs_ns2_internal.h:115
bool nsvci_is_valid
Definition: gprs_ns2_internal.h:235
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:1717
ns2_timeout
Definition: gprs_ns2_internal.h:67
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:1492
uint32_t sum_data_weight
sum of all the data weight of alive NS-VCs
Definition: gprs_ns2_internal.h:191
bool ip_sns_role_sgsn
are we implementing the SGSN role?
Definition: gprs_ns2_internal.h:200
bool first
true if this NSE wasn&#39;t yet alive at all.
Definition: gprs_ns2_internal.h:177
uint16_t mtu
MTU of a NS PDU.
Definition: gprs_ns2_internal.h:197
Definition: gprs_ns2_internal.h:74
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:237
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:905
Definition: gprs_ns2_internal.h:116
bool persistent
true if this NS was created by VTY or pcu socket)
Definition: gprs_ns2_internal.h:218
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:1248
uint32_t nsvc_rate_ctr_idx
workaround for rate counter until rate counter accepts char str as index
Definition: gprs_ns2_internal.h:148
struct osmo_fsm_inst * bss_sns_fi
Definition: gprs_ns2_internal.h:188
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:215
Definition: gprs_ns2_internal.h:110
struct llist_head nsvc
list of all VC
Definition: gprs_ns2_internal.h:254
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:797
Definition: gprs_ns2_internal.h:120
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
#define NS_TIMERS_COUNT
Definition: gprs_ns2_internal.h:49
int ns2_tx_unblock(struct gprs_ns2_vc *nsvc)
Transmit a NS-UNBLOCK on a given NS-VC.
Definition: gprs_ns2_message.c:336
Definition: gprs_ns2_internal.h:76
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:140
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:1627
Definition: gprs_ns2_internal.h:107
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:1593
struct rate_ctr_group * ctrg
Definition: gprs_ns2_internal.h:239
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:89
void * priv
driver private structure
Definition: gprs_ns2_internal.h:256
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