Harald Welte | 17a892f | 2020-12-07 21:39:03 +0100 | [diff] [blame] | 1 | #pragma once |
| 2 | #include <stdint.h> |
| 3 | |
| 4 | #include <osmocom/gprs/protocol/gsm_08_18.h> |
| 5 | #include <osmocom/gprs/gprs_ns2.h> |
| 6 | |
Harald Welte | 4394bb9 | 2020-12-08 20:40:44 +0100 | [diff] [blame] | 7 | struct bssgp2_flow_ctrl; |
Harald Welte | 17a892f | 2020-12-07 21:39:03 +0100 | [diff] [blame] | 8 | struct gprs_ns2_inst; |
| 9 | struct gprs_ra_id; |
| 10 | struct msgb; |
| 11 | |
Harald Welte | 4394bb9 | 2020-12-08 20:40:44 +0100 | [diff] [blame] | 12 | struct bssgp2_flow_ctrl { |
| 13 | uint8_t tag; |
| 14 | /* maximum bucket size (Bmax) in bytes */ |
| 15 | uint64_t bucket_size_max; |
| 16 | /*! bucket leak rate in _bytes_ per second */ |
| 17 | uint64_t bucket_leak_rate; |
| 18 | /* percentage how full the given bucket is */ |
| 19 | uint8_t bucket_full_ratio; |
| 20 | bool bucket_full_ratio_present; |
| 21 | union { |
| 22 | /*! FC-BVC specifi members */ |
| 23 | struct { |
| 24 | /*! default maximum bucket size per MS in bytes */ |
| 25 | uint64_t bmax_default_ms; |
| 26 | /*! default bucket leak rate (R) for MS flow control bucket */ |
| 27 | uint64_t r_default_ms; |
| 28 | |
| 29 | /*! average milliseconds of queueing delay for a BVC */ |
| 30 | uint32_t measurement; |
| 31 | bool measurement_present; |
| 32 | } bvc; |
| 33 | /*! FC-MS specifi members */ |
| 34 | struct { |
| 35 | /*! TLLI of the MS */ |
| 36 | uint32_t tlli; |
| 37 | } ms; |
| 38 | } u; |
| 39 | }; |
| 40 | |
| 41 | |
Harald Welte | 17a892f | 2020-12-07 21:39:03 +0100 | [diff] [blame] | 42 | int bssgp2_nsi_tx_ptp(struct gprs_ns2_inst *nsi, uint16_t nsei, uint16_t bvci, |
| 43 | struct msgb *msg, uint32_t lsp); |
| 44 | |
| 45 | int bssgp2_nsi_tx_sig(struct gprs_ns2_inst *nsi, uint16_t nsei, struct msgb *msg, uint32_t lsp); |
| 46 | |
| 47 | struct msgb *bssgp2_enc_bvc_block(uint16_t bvci, enum gprs_bssgp_cause cause); |
| 48 | |
| 49 | struct msgb *bssgp2_enc_bvc_block_ack(uint16_t bvci); |
| 50 | |
| 51 | struct msgb *bssgp2_enc_bvc_unblock(uint16_t bvci); |
| 52 | |
| 53 | struct msgb *bssgp2_enc_bvc_unblock_ack(uint16_t bvci); |
| 54 | |
| 55 | struct msgb *bssgp2_enc_bvc_reset(uint16_t bvci, enum gprs_bssgp_cause cause, |
| 56 | const struct gprs_ra_id *ra_id, uint16_t cell_id, |
| 57 | const uint8_t *feat_bm, const uint8_t *ext_feat_bm); |
| 58 | |
| 59 | struct msgb *bssgp2_enc_bvc_reset_ack(uint16_t bvci, const struct gprs_ra_id *ra_id, uint16_t cell_id, |
| 60 | const uint8_t *feat_bm, const uint8_t *ext_feat_bm); |
| 61 | |
| 62 | struct msgb *bssgp2_enc_status(uint8_t cause, const uint16_t *bvci, const struct msgb *orig_msg); |
Harald Welte | 4394bb9 | 2020-12-08 20:40:44 +0100 | [diff] [blame] | 63 | |
| 64 | |
| 65 | int bssgp2_dec_fc_bvc(struct bssgp2_flow_ctrl *fc, const struct tlv_parsed *tp); |
| 66 | struct msgb *bssgp2_enc_fc_bvc(const struct bssgp2_flow_ctrl *fc, enum bssgp_fc_granularity *gran); |
| 67 | struct msgb *bssgp2_enc_fc_bvc_ack(uint8_t tag); |
| 68 | int bssgp2_dec_fc_ms(struct bssgp2_flow_ctrl *fc, struct tlv_parsed *tp); |
| 69 | struct msgb *bssgp2_enc_fc_ms(const struct bssgp2_flow_ctrl *fc, enum bssgp_fc_granularity *gran); |
| 70 | struct msgb *bssgp2_enc_fc_ms_ack(uint32_t tlli, uint8_t tag); |