20 #define NS_TIMERS_COUNT 8
21 #define NS_TIMERS "(tns-block|tns-block-retries|tns-reset|tns-reset-retries|tns-test|tns-alive|tns-alive-retries|tsns-prov)"
22 #define NS_TIMERS_HELP \
23 "(un)blocking Timer (Tns-block) timeout\n" \
24 "(un)blocking Timer (Tns-block) number of retries\n" \
25 "Reset Timer (Tns-reset) timeout\n" \
26 "Reset Timer (Tns-reset) number of retries\n" \
27 "Test Timer (Tns-test) timeout\n" \
28 "Alive Timer (Tns-alive) timeout\n" \
29 "Alive Timer (Tns-alive) number of retries\n" \
30 "SNS Provision Timer (Tsns-prov) timeout\n"
33 #define NS_ALLOC_SIZE 3072
34 #define NS_ALLOC_HEADROOM 20
76 #define NSE_S_BLOCKED 0x0001
77 #define NSE_S_ALIVE 0x0002
78 #define NSE_S_RESET 0x0004
80 #define NS_DESC_B(st) ((st) & NSE_S_BLOCKED ? "BLOCKED" : "UNBLOCKED")
81 #define NS_DESC_A(st) ((st) & NSE_S_ALIVE ? "ALIVE" : "DEAD")
82 #define NS_DESC_R(st) ((st) & NSE_S_RESET ? "RESET" : "UNRESET")
198 struct vty *
vty,
bool stats);
210 struct msgb **reject,
238 unsigned int num_ip4_elems,
240 unsigned int num_ip6_elems);
243 unsigned int num_ip4_elems,
245 unsigned int num_ip6_elems);
248 int ip4_ep_nr,
int ip6_ep_nr);
265 uint16_t
bvci, uint8_t sducontrol,
269 uint16_t
bvci,
struct msgb *orig_msg);
286 const char *
id,
bool initiate);
uint16_t bvci
Definition: gprs_msgb.h:8
gprs_ns2_vc_mode
Definition: gprs_ns2.h:22
gprs_ns2_affecting_cause
Osmocom NS primitives according to 48.016 5.2.2.6 Service primitves.
Definition: gprs_ns2.h:48
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:541
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:1220
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:209
int gprs_ns2_vc_is_alive(struct gprs_ns2_vc *nsvc)
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
@ NSVC_TIMER_TNS_RESET
Definition: gprs_ns2_internal.h:51
@ NSVC_TIMER_TNS_ALIVE
Definition: gprs_ns2_internal.h:50
@ NSVC_TIMER_TNS_TEST
Definition: gprs_ns2_internal.h:49
@ _NSVC_TIMER_NR
Definition: gprs_ns2_internal.h:52
void gprs_ns2_sns_dump_vty(struct vty *vty, const struct gprs_ns2_nse *nse, bool stats)
Dump the IP-SNS state to a vty.
Definition: gprs_ns2_sns.c:1456
gprs_ns2_cs
Osmocom NS2 VC create status.
Definition: gprs_ns2_internal.h:67
@ GPRS_NS2_CS_CREATED
A NSVC object has been created.
Definition: gprs_ns2_internal.h:68
@ GPRS_NS2_CS_SKIPPED
Skipped message.
Definition: gprs_ns2_internal.h:71
@ GPRS_NS2_CS_ERROR
Failed to process message.
Definition: gprs_ns2_internal.h:72
@ GPRS_NS2_CS_REJECTED
Rejected and answered message.
Definition: gprs_ns2_internal.h:70
@ GPRS_NS2_CS_FOUND
A NSVC object has been found.
Definition: gprs_ns2_internal.h:69
int gprs_ns2_vc_fsm_start(struct gprs_ns2_vc *nsvc)
Start a NS-VC FSM.
Definition: gprs_ns2_vc_fsm.c:591
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:594
int ns2_tx_alive(struct gprs_ns2_vc *nsvc)
Transmit a NS-ALIVE on a given NS-VC.
Definition: gprs_ns2_message.c:369
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:354
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:381
int gprs_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:1375
struct osmo_fsm_inst * gprs_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:568
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:637
void ns2_nse_notify_alive(struct gprs_ns2_vc *nsvc, bool alive)
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:682
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:483
struct gprs_ns2_vc * gprs_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:374
#define NS_TIMERS_COUNT
Definition: gprs_ns2_internal.h:20
int gprs_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:604
ns2_timeout
Definition: gprs_ns2_internal.h:36
@ NS_TOUT_TSNS_PROV
Definition: gprs_ns2_internal.h:44
@ NS_TOUT_TNS_BLOCK
Definition: gprs_ns2_internal.h:37
@ NS_TOUT_TNS_RESET
Definition: gprs_ns2_internal.h:39
@ NS_TOUT_TNS_BLOCK_RETRIES
Definition: gprs_ns2_internal.h:38
@ NS_TOUT_TNS_TEST
Definition: gprs_ns2_internal.h:41
@ NS_TOUT_TNS_ALIVE_RETRIES
Definition: gprs_ns2_internal.h:43
@ NS_TOUT_TNS_RESET_RETRIES
Definition: gprs_ns2_internal.h:40
@ NS_TOUT_TNS_ALIVE
Definition: gprs_ns2_internal.h:42
@ GPRS_NS_LL_FR_GRE
NS/FR/GRE/IP.
Definition: gprs_ns2_internal.h:63
@ GPRS_NS_LL_UDP
NS/UDP/IP.
Definition: gprs_ns2_internal.h:61
@ GPRS_NS_LL_E1
NS/E1.
Definition: gprs_ns2_internal.h:62
int ns2_tx_unblock(struct gprs_ns2_vc *nsvc)
Transmit a NS-UNBLOCK on a given NS-VC.
Definition: gprs_ns2_message.c:338
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:303
void ns2_vty_bind_apply(struct gprs_ns2_vc_bind *bind)
ns2_vty_bind_apply will be called when a new bind is created to apply vty settings
Definition: gprs_ns2_vty.c:834
int gprs_ns2_vc_is_unblocked(struct gprs_ns2_vc *nsvc)
is the given NS-VC unblocked?
Definition: gprs_ns2_vc_fsm.c:659
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:241
int ns2_sns_bss_fsm_start(struct gprs_ns2_nse *nse, struct gprs_ns2_vc *nsvc, const struct osmo_sockaddr *remote)
Start an IP-SNS FSM.
Definition: gprs_ns2_sns.c:1248
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:396
int gprs_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:152
void ns2_sns_free_nsvc(struct gprs_ns2_vc *nsvc)
called when a nsvc is beeing freed
Definition: gprs_ns2_sns.c:213
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:426
nsvc_timer_mode
Definition: gprs_ns.h:113
gprs_ns_ll
Osmocom NS link layer types.
Definition: gprs_ns.h:53
uint8_t pdu_type
NS PDU type.
Definition: gsm_08_16.h:0
ns_stat
Definition: gprs_ns.c:166
@ NS_STAT_ALIVE_DELAY
Definition: gprs_ns2_internal.h:56
struct gprs_ns2_vc * ns2_vc_alloc(struct gprs_ns2_vc_bind *bind, struct gprs_ns2_nse *nse, bool initiater)
Allocate a NS-VC within the given bind + NSE.
Definition: gprs_ns2.c:368
void ns2_prim_status_ind(struct gprs_ns2_nse *nse, uint16_t bvci, enum gprs_ns2_affecting_cause cause)
Send a STATUS.ind primitive to the specified NS instance user.
Definition: gprs_ns2.c:347
enum gprs_ns2_cs ns2_create_vc(struct gprs_ns2_vc_bind *bind, struct msgb *msg, 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:630
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:886
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:960
struct msgb * gprs_ns2_msgb_alloc(void)
Allocate a message buffer for use with the NS2 stack.
Definition: gprs_ns2.c:438
int(* osmo_prim_cb)(struct osmo_prim_hdr *oph, void *ctx)
GPRS Networks Service (NS) messages on the Gb interface.
An instance of the NS protocol stack.
Definition: gprs_ns2_internal.h:85
struct llist_head nse
linked lists of all NSVC in this instance
Definition: gprs_ns2_internal.h:96
struct llist_head binding
linked lists of all NSVC binds (e.g.
Definition: gprs_ns2_internal.h:93
bool create_nse
create dynamic NSE on receiving packages
Definition: gprs_ns2_internal.h:99
void * cb_data
callback data
Definition: gprs_ns2_internal.h:90
osmo_prim_cb cb
callback to the user for incoming UNIT DATA IND
Definition: gprs_ns2_internal.h:87
uint16_t timeout[NS_TIMERS_COUNT]
Definition: gprs_ns2_internal.h:101
uint32_t rate_ctr_idx
workaround for rate counter until rate counter accepts char str as index
Definition: gprs_ns2_internal.h:104
Structure repesenting a NSE.
Definition: gprs_ns2_internal.h:108
struct gprs_ns2_inst * nsi
entry back to ns2_inst
Definition: gprs_ns2_internal.h:112
struct llist_head nsvc
llist head to hold all nsvc
Definition: gprs_ns2_internal.h:118
bool persistent
true if this NSE was created by VTY or pcu socket)
Definition: gprs_ns2_internal.h:121
struct llist_head list
llist entry for gprs_ns2_inst
Definition: gprs_ns2_internal.h:115
bool first
true if this NSE wasn't yet alive at all.
Definition: gprs_ns2_internal.h:125
struct osmo_fsm_inst * bss_sns_fi
Definition: gprs_ns2_internal.h:130
uint16_t nsei
Definition: gprs_ns2_internal.h:109
bool alive
true if this NSE has at least one alive VC
Definition: gprs_ns2_internal.h:128
Structure repesenting a bind instance.
Definition: gprs_ns2_internal.h:176
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:197
enum gprs_ns2_vc_mode vc_mode
if VCs use reset/block/unblock method.
Definition: gprs_ns2_internal.h:188
void(* free_vc)(struct gprs_ns2_vc *nsvc)
free the vc priv data
Definition: gprs_ns2_internal.h:194
int(* send_vc)(struct gprs_ns2_vc *nsvc, struct msgb *msg)
send a msg over a VC
Definition: gprs_ns2_internal.h:191
struct llist_head nsvc
list of all VC
Definition: gprs_ns2_internal.h:180
void * priv
driver private structure
Definition: gprs_ns2_internal.h:182
struct llist_head list
list entry in nsi
Definition: gprs_ns2_internal.h:178
struct gprs_ns2_inst * nsi
a pointer back to the nsi
Definition: gprs_ns2_internal.h:184
struct gprs_ns2_vc_driver * driver
Definition: gprs_ns2_internal.h:185
Definition: gprs_ns2_internal.h:201
void * priv
Definition: gprs_ns2_internal.h:203
void(* free_bind)(struct gprs_ns2_vc_bind *driver)
Definition: gprs_ns2_internal.h:204
const char * name
Definition: gprs_ns2_internal.h:202
Structure representing a single NS-VC.
Definition: gprs_ns2_internal.h:134
struct osmo_fsm_inst * fi
Definition: gprs_ns2_internal.h:172
enum gprs_ns_ll ll
which link-layer are we based on?
Definition: gprs_ns2_internal.h:169
bool sns_only
Definition: gprs_ns2_internal.h:163
bool persistent
true if this NS was created by VTY or pcu socket)
Definition: gprs_ns2_internal.h:148
bool nsvci_is_valid
Definition: gprs_ns2_internal.h:162
struct gprs_ns2_vc_bind * bind
pointer to NS VL bind.
Definition: gprs_ns2_internal.h:145
struct llist_head blist
list of NS-VCs within bind, bind is the owner!
Definition: gprs_ns2_internal.h:139
uint8_t sig_weight
signalling weight.
Definition: gprs_ns2_internal.h:154
struct gprs_ns2_nse * nse
pointer to NS Instance
Definition: gprs_ns2_internal.h:142
enum gprs_ns2_vc_mode mode
Definition: gprs_ns2_internal.h:170
struct llist_head list
list of NS-VCs within NSE
Definition: gprs_ns2_internal.h:136
uint8_t data_weight
signaling weight.
Definition: gprs_ns2_internal.h:157
uint16_t nsvci
uniquely identifies NS-VC if VC contains nsvci
Definition: gprs_ns2_internal.h:151
void * priv
can be used by the bind/driver of the virtual circuit.
Definition: gprs_ns2_internal.h:160
struct rate_ctr_group * ctrg
Definition: gprs_ns2_internal.h:165
struct osmo_stat_item_group * statg
Definition: gprs_ns2_internal.h:166
Section 10.3.2c List of IP4 Elements.
Definition: gsm_08_16.h:24
Section 10.3.2d List of IP6 Elements.
Definition: gsm_08_16.h:32