Harald Welte | 17a892f | 2020-12-07 21:39:03 +0100 | [diff] [blame] | 1 | #pragma once |
| 2 | #include <stdint.h> |
| 3 | |
| 4 | struct gprs_ns2_inst; |
| 5 | struct osmo_fsm_inst; |
| 6 | struct gprs_ra_id; |
| 7 | |
| 8 | enum bssp_ptp_bvc_fsm_state { |
| 9 | BSSGP_BVCFSM_S_NULL, |
| 10 | BSSGP_BVCFSM_S_BLOCKED, |
| 11 | BSSGP_BVCFSM_S_WAIT_RESET_ACK, |
| 12 | BSSGP_BVCFSM_S_UNBLOCKED, |
| 13 | }; |
| 14 | |
| 15 | enum bssgp_ptp_bvc_fsm_event { |
| 16 | /* Rx of BSSGP PDUs from the remote side; 'data' is 'struct tlv_parsed', and |
| 17 | * the assumption is that the caller has already validated all mandatory IEs |
| 18 | * are present and of sufficient length */ |
| 19 | BSSGP_BVCFSM_E_RX_BLOCK, |
| 20 | BSSGP_BVCFSM_E_RX_BLOCK_ACK, |
| 21 | BSSGP_BVCFSM_E_RX_UNBLOCK, |
| 22 | BSSGP_BVCFSM_E_RX_UNBLOCK_ACK, |
| 23 | BSSGP_BVCFSM_E_RX_RESET, |
| 24 | BSSGP_BVCFSM_E_RX_RESET_ACK, |
| 25 | /* Requests of the local user */ |
| 26 | BSSGP_BVCFSM_E_REQ_BLOCK, /* data: uint8_t *cause */ |
| 27 | BSSGP_BVCFSM_E_REQ_UNBLOCK, |
| 28 | BSSGP_BVCFSM_E_REQ_RESET, /* data: uint8_t *cause */ |
| 29 | }; |
| 30 | |
| 31 | struct bssgp_bvc_fsm_ops { |
| 32 | /* call-back notifying the user of a state change */ |
| 33 | void (*state_chg_notification)(uint16_t nsei, uint16_t bvci, int old_state, int new_state, |
| 34 | void *priv); |
| 35 | /* call-back notifying the user of a BVC-RESET event */ |
| 36 | void (*reset_notification)(uint16_t nsei, uint16_t bvci, const struct gprs_ra_id *ra_id, |
| 37 | uint16_t cell_id, uint8_t cause, void *priv); |
| 38 | }; |
| 39 | |
| 40 | struct osmo_fsm_inst * |
| 41 | bssgp_bvc_fsm_alloc_sig_bss(void *ctx, struct gprs_ns2_inst *nsi, uint16_t nsei, uint32_t features); |
| 42 | |
| 43 | struct osmo_fsm_inst * |
| 44 | bssgp_bvc_fsm_alloc_ptp_bss(void *ctx, struct gprs_ns2_inst *nsi, uint16_t nsei, uint16_t bvci, |
| 45 | const struct gprs_ra_id *ra_id, uint16_t cell_id); |
| 46 | |
| 47 | struct osmo_fsm_inst * |
| 48 | bssgp_bvc_fsm_alloc_sig_sgsn(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_sgsn(void *ctx, struct gprs_ns2_inst *nsi, uint16_t nsei, uint16_t bvci); |
| 52 | |
| 53 | void bssgp_bvc_fsm_set_ops(struct osmo_fsm_inst *fi, const struct bssgp_bvc_fsm_ops *ops, void *ops_priv); |
| 54 | |
| 55 | bool bssgp_bvc_fsm_is_unblocked(struct osmo_fsm_inst *fi); |
| 56 | |
| 57 | uint8_t bssgp_bvc_fsm_get_block_cause(struct osmo_fsm_inst *fi); |
| 58 | |
| 59 | uint32_t bssgp_bvc_get_features_advertised(struct osmo_fsm_inst *fi); |
| 60 | uint32_t bssgp_bvc_get_features_received(struct osmo_fsm_inst *fi); |
| 61 | uint32_t bssgp_bvc_get_features_negotiated(struct osmo_fsm_inst *fi); |