libosmogb 1.13.1.1-afb4 Osmocom Gb library

bssgp_bvc_fsm.h
Go to the documentation of this file.
1#pragma once
2#include <stdint.h>
3
4 struct gprs_ns2_inst;
5 struct osmo_fsm_inst;
6 struct gprs_ra_id;
7 struct bssgp2_flow_ctrl;
8
9 enum bssp_ptp_bvc_fsm_state {
10 BSSGP_BVCFSM_S_NULL,
11 BSSGP_BVCFSM_S_BLOCKED,
12 BSSGP_BVCFSM_S_WAIT_RESET_ACK,
13 BSSGP_BVCFSM_S_UNBLOCKED,
14};
15
16 enum bssgp_ptp_bvc_fsm_event {
17 /* Rx of BSSGP PDUs from the remote side; 'data' is 'struct tlv_parsed', and
18 * the assumption is that the caller has already validated all mandatory IEs
19 * are present and of sufficient length */
20 BSSGP_BVCFSM_E_RX_BLOCK,
21 BSSGP_BVCFSM_E_RX_BLOCK_ACK,
22 BSSGP_BVCFSM_E_RX_UNBLOCK,
23 BSSGP_BVCFSM_E_RX_UNBLOCK_ACK,
24 BSSGP_BVCFSM_E_RX_RESET,
25 BSSGP_BVCFSM_E_RX_RESET_ACK,
26 BSSGP_BVCFSM_E_RX_FC_BVC,
27 BSSGP_BVCFSM_E_RX_FC_BVC_ACK,
28 /* Requests of the local user */
29 BSSGP_BVCFSM_E_REQ_BLOCK, /* data: uint8_t *cause */
30 BSSGP_BVCFSM_E_REQ_UNBLOCK,
31 BSSGP_BVCFSM_E_REQ_RESET, /* data: uint8_t *cause */
32 BSSGP_BVCFSM_E_REQ_FC_BVC, /* data: struct bssgp2_flow_ctrl */
33};
34
35 struct bssgp_bvc_fsm_ops {
36 /* call-back notifying the user of a state change */
37 void (*state_chg_notification)(uint16_t nsei, uint16_t bvci, int old_state, int new_state,
38 void *priv);
39 /* call-back notifying the user of a BVC-RESET event */
40 void (*reset_notification)(uint16_t nsei, uint16_t bvci, const struct gprs_ra_id *ra_id,
41 uint16_t cell_id, uint8_t cause, void *priv);
42 void (*rx_fc_bvc)(uint16_t nsei, uint16_t bvci, const struct bssgp2_flow_ctrl *fc, void *priv);
43 void (*reset_ack_notification)(uint16_t nsei, uint16_t bvci, const struct gprs_ra_id *ra_id,
44 uint16_t cell_id, uint8_t cause, void *priv);
45};
46
47 struct osmo_fsm_inst *
48 bssgp_bvc_fsm_alloc_sig_bss(void *ctx, struct gprs_ns2_inst *nsi, uint16_t nsei, uint32_t features);
49
50 struct osmo_fsm_inst *
51 bssgp_bvc_fsm_alloc_ptp_bss(void *ctx, struct gprs_ns2_inst *nsi, uint16_t nsei, uint16_t bvci,
52 const struct gprs_ra_id *ra_id, uint16_t cell_id);
53
54 struct osmo_fsm_inst *
55 bssgp_bvc_fsm_alloc_sig_sgsn(void *ctx, struct gprs_ns2_inst *nsi, uint16_t nsei, uint32_t features);
56
57 struct osmo_fsm_inst *
58 bssgp_bvc_fsm_alloc_ptp_sgsn(void *ctx, struct gprs_ns2_inst *nsi, uint16_t nsei, uint16_t bvci);
59
60 void bssgp_bvc_fsm_set_ops(struct osmo_fsm_inst *fi, const struct bssgp_bvc_fsm_ops *ops, void *ops_priv);
61
62 bool bssgp_bvc_fsm_is_unblocked(struct osmo_fsm_inst *fi);
63
64uint8_t bssgp_bvc_fsm_get_block_cause(struct osmo_fsm_inst *fi);
65
66uint32_t bssgp_bvc_fsm_get_features_advertised(struct osmo_fsm_inst *fi);
67uint32_t bssgp_bvc_fsm_get_features_received(struct osmo_fsm_inst *fi);
68uint32_t bssgp_bvc_fsm_get_features_negotiated(struct osmo_fsm_inst *fi);
69
70 void bssgp_bvc_fsm_set_max_pdu_len(struct osmo_fsm_inst *fi, uint16_t max_pdu_len);
71uint16_t bssgp_bvc_fsm_get_max_pdu_len(const struct osmo_fsm_inst *fi);
bssgp_bvc_fsm_set_ops
void bssgp_bvc_fsm_set_ops(struct osmo_fsm_inst *fi, const struct bssgp_bvc_fsm_ops *ops, void *ops_priv)
Set the 'operations' callbacks + private data.
Definition: bssgp_bvc_fsm.c:782
bssgp_bvc_fsm_alloc_ptp_bss
struct osmo_fsm_inst * bssgp_bvc_fsm_alloc_ptp_bss(void *ctx, struct gprs_ns2_inst *nsi, uint16_t nsei, uint16_t bvci, const struct gprs_ra_id *ra_id, uint16_t cell_id)
Allocate a PTP-BVC FSM for the BSS role (facing a remote SGSN).
Definition: bssgp_bvc_fsm.c:717
bssgp_bvc_fsm_set_max_pdu_len
void bssgp_bvc_fsm_set_max_pdu_len(struct osmo_fsm_inst *fi, uint16_t max_pdu_len)
Set the maximum size of a BSSGP PDU.
Definition: bssgp_bvc_fsm.c:836
bssgp_bvc_fsm_get_block_cause
uint8_t bssgp_bvc_fsm_get_block_cause(struct osmo_fsm_inst *fi)
Determine the cause value why given BVC FSM is blocked.
Definition: bssgp_bvc_fsm.c:799
bssgp_bvc_fsm_get_max_pdu_len
uint16_t bssgp_bvc_fsm_get_max_pdu_len(const struct osmo_fsm_inst *fi)
Return the maximum size of a BSSGP PDU ! On the NS layer this corresponds to the size of an NS SDU in...
Definition: bssgp_bvc_fsm.c:845
bssgp_bvc_fsm_get_features_negotiated
uint32_t bssgp_bvc_fsm_get_features_negotiated(struct osmo_fsm_inst *fi)
Return the negotiated features / extended features.
Definition: bssgp_bvc_fsm.c:826
bssgp_bvc_fsm_alloc_sig_sgsn
struct osmo_fsm_inst * bssgp_bvc_fsm_alloc_sig_sgsn(void *ctx, struct gprs_ns2_inst *nsi, uint16_t nsei, uint32_t features)
Allocate a SIGNALING-BVC FSM for the SGSN role (facing a remote BSS).
Definition: bssgp_bvc_fsm.c:744
bssgp_bvc_fsm_alloc_ptp_sgsn
struct osmo_fsm_inst * bssgp_bvc_fsm_alloc_ptp_sgsn(void *ctx, struct gprs_ns2_inst *nsi, uint16_t nsei, uint16_t bvci)
Allocate a PTP-BVC FSM for the SGSN role (facing a remote BSS).
Definition: bssgp_bvc_fsm.c:765
bssp_ptp_bvc_fsm_state
bssp_ptp_bvc_fsm_state
Definition: bssgp_bvc_fsm.h:9
BSSGP_BVCFSM_S_WAIT_RESET_ACK
@ BSSGP_BVCFSM_S_WAIT_RESET_ACK
Definition: bssgp_bvc_fsm.h:12
BSSGP_BVCFSM_S_UNBLOCKED
@ BSSGP_BVCFSM_S_UNBLOCKED
Definition: bssgp_bvc_fsm.h:13
BSSGP_BVCFSM_S_BLOCKED
@ BSSGP_BVCFSM_S_BLOCKED
Definition: bssgp_bvc_fsm.h:11
BSSGP_BVCFSM_S_NULL
@ BSSGP_BVCFSM_S_NULL
Definition: bssgp_bvc_fsm.h:10
bssgp_bvc_fsm_is_unblocked
bool bssgp_bvc_fsm_is_unblocked(struct osmo_fsm_inst *fi)
Return if the given BVC FSM is in UNBLOCKED state.
Definition: bssgp_bvc_fsm.c:793
bssgp_bvc_fsm_get_features_advertised
uint32_t bssgp_bvc_fsm_get_features_advertised(struct osmo_fsm_inst *fi)
Return the advertised features / extended features.
Definition: bssgp_bvc_fsm.c:808
bssgp_bvc_fsm_get_features_received
uint32_t bssgp_bvc_fsm_get_features_received(struct osmo_fsm_inst *fi)
Return the received features / extended features.
Definition: bssgp_bvc_fsm.c:817
bssgp_ptp_bvc_fsm_event
bssgp_ptp_bvc_fsm_event
Definition: bssgp_bvc_fsm.h:16
BSSGP_BVCFSM_E_RX_FC_BVC_ACK
@ BSSGP_BVCFSM_E_RX_FC_BVC_ACK
Definition: bssgp_bvc_fsm.h:27
BSSGP_BVCFSM_E_RX_BLOCK_ACK
@ BSSGP_BVCFSM_E_RX_BLOCK_ACK
Definition: bssgp_bvc_fsm.h:21
BSSGP_BVCFSM_E_REQ_FC_BVC
@ BSSGP_BVCFSM_E_REQ_FC_BVC
Definition: bssgp_bvc_fsm.h:32
BSSGP_BVCFSM_E_RX_UNBLOCK_ACK
@ BSSGP_BVCFSM_E_RX_UNBLOCK_ACK
Definition: bssgp_bvc_fsm.h:23
BSSGP_BVCFSM_E_RX_FC_BVC
@ BSSGP_BVCFSM_E_RX_FC_BVC
Definition: bssgp_bvc_fsm.h:26
BSSGP_BVCFSM_E_REQ_BLOCK
@ BSSGP_BVCFSM_E_REQ_BLOCK
Definition: bssgp_bvc_fsm.h:29
BSSGP_BVCFSM_E_REQ_UNBLOCK
@ BSSGP_BVCFSM_E_REQ_UNBLOCK
Definition: bssgp_bvc_fsm.h:30
BSSGP_BVCFSM_E_REQ_RESET
@ BSSGP_BVCFSM_E_REQ_RESET
Definition: bssgp_bvc_fsm.h:31
BSSGP_BVCFSM_E_RX_BLOCK
@ BSSGP_BVCFSM_E_RX_BLOCK
Definition: bssgp_bvc_fsm.h:20
BSSGP_BVCFSM_E_RX_RESET
@ BSSGP_BVCFSM_E_RX_RESET
Definition: bssgp_bvc_fsm.h:24
BSSGP_BVCFSM_E_RX_UNBLOCK
@ BSSGP_BVCFSM_E_RX_UNBLOCK
Definition: bssgp_bvc_fsm.h:22
BSSGP_BVCFSM_E_RX_RESET_ACK
@ BSSGP_BVCFSM_E_RX_RESET_ACK
Definition: bssgp_bvc_fsm.h:25
bssgp_bvc_fsm_alloc_sig_bss
struct osmo_fsm_inst * bssgp_bvc_fsm_alloc_sig_bss(void *ctx, struct gprs_ns2_inst *nsi, uint16_t nsei, uint32_t features)
Allocate a SIGNALING-BVC FSM for the BSS role (facing a remote SGSN).
Definition: bssgp_bvc_fsm.c:694
bvci
uint16_t bvci
Definition: gprs_msgb.h:8
nsei
uint16_t nsei
Identifiers of a BTS, equal to 'struct bssgp_bts_ctx'.
Definition: gprs_msgb.h:7
cause
uint8_t cause
ra_id
uint8_t ra_id[6]
bssgp2_flow_ctrl
Definition: gprs_bssgp2.h:12
bssgp_bvc_fsm_ops
Definition: bssgp_bvc_fsm.h:35
bssgp_bvc_fsm_ops::state_chg_notification
void(* state_chg_notification)(uint16_t nsei, uint16_t bvci, int old_state, int new_state, void *priv)
Definition: bssgp_bvc_fsm.h:37
bssgp_bvc_fsm_ops::rx_fc_bvc
void(* rx_fc_bvc)(uint16_t nsei, uint16_t bvci, const struct bssgp2_flow_ctrl *fc, void *priv)
Definition: bssgp_bvc_fsm.h:42
bssgp_bvc_fsm_ops::reset_ack_notification
void(* reset_ack_notification)(uint16_t nsei, uint16_t bvci, const struct gprs_ra_id *ra_id, uint16_t cell_id, uint8_t cause, void *priv)
Definition: bssgp_bvc_fsm.h:43
bssgp_bvc_fsm_ops::reset_notification
void(* reset_notification)(uint16_t nsei, uint16_t bvci, const struct gprs_ra_id *ra_id, uint16_t cell_id, uint8_t cause, void *priv)
Definition: bssgp_bvc_fsm.h:40
gprs_ns2_inst
An instance of the NS protocol stack.
Definition: gprs_ns2_internal.h:166
gprs_ra_id
osmo_fsm_inst