diff options
author | Pau Espin Pedrol <pespin@espeweb.net> | 2020-12-16 15:59:45 +0100 |
---|---|---|
committer | pespin <pespin@sysmocom.de> | 2021-01-05 10:34:25 +0000 |
commit | da971ee5026479e869ed75d944404d398c548497 (patch) | |
tree | 30bf447c2d828264e51d09f5422ea05421c48d47 /src/bts.h | |
parent | 86fad1ec4e246110b9d8ae66fd7bc30e1cedb5de (diff) |
Convert GprsMS and helpers classes to C
As we integrate osmo-pcu more and more with libosmocore features, it
becomes really hard to use them since libosmocore relies heavily on C
specific compilation features, which are not available in old C++
compilers (such as designated initializers for complex types in FSMs).
GprsMs is right now a quite simple object since initial design of
osmo-pcu made it optional and most of the logic was placed and stored
duplicated in TBF objects. However, that's changing as we introduce more
features, with the GprsMS class getting more weight. Hence, let's move
it now to be a C struct in order to be able to easily use libosmocore
features there, such as FSMs.
Some helper classes which GprsMs uses are also mostly move to C since
they are mostly structs with methods, so there's no point in having
duplicated APIs for C++ and C for such simple cases.
For some more complex classes, like (ul_,dl_)tbf, C API bindings are
added where needed so that GprsMs can use functionalitites from that
class. Most of those APIs can be kept afterwards and drop the C++ ones
since they provide no benefit in general.
Change-Id: I0b50e3367aaad9dcada76da97b438e452c8b230c
Diffstat (limited to 'src/bts.h')
-rw-r--r-- | src/bts.h | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -90,15 +90,14 @@ struct gprs_rlcmac_trx { struct BTS *bts; uint8_t trx_no; -#ifdef __cplusplus - void reserve_slots(enum gprs_rlcmac_tbf_direction dir, uint8_t slots); - void unreserve_slots(enum gprs_rlcmac_tbf_direction dir, uint8_t slots); -#endif }; #ifdef __cplusplus extern "C" { #endif +void bts_trx_reserve_slots(struct gprs_rlcmac_trx *trx, enum gprs_rlcmac_tbf_direction dir, uint8_t slots); +void bts_trx_unreserve_slots(struct gprs_rlcmac_trx *trx, enum gprs_rlcmac_tbf_direction dir, uint8_t slots); + void bts_update_tbf_ta(const char *p, uint32_t fn, uint8_t trx_no, uint8_t ts, int8_t ta, bool is_rach); #ifdef __cplusplus } @@ -372,10 +371,11 @@ public: LListHead<gprs_rlcmac_tbf>& ul_tbfs(); LListHead<gprs_rlcmac_tbf>& dl_tbfs(); + + struct gprs_rlcmac_bts m_bts; private: int m_cur_fn; int m_cur_blk_fn; - struct gprs_rlcmac_bts m_bts; uint8_t m_max_cs_dl, m_max_cs_ul; uint8_t m_max_mcs_dl, m_max_mcs_ul; PollController m_pollController; @@ -459,11 +459,17 @@ inline void BTS::stat_item_add(unsigned int stat_id, int inc) { extern "C" { #endif void bts_cleanup(); + struct gprs_rlcmac_bts *bts_data(struct BTS *bts); struct gprs_rlcmac_bts *bts_main_data(); struct rate_ctr_group *bts_main_data_stats(); struct osmo_stat_item_group *bts_main_data_stat_items(); void bts_set_max_cs(struct gprs_rlcmac_bts *bts, uint8_t cs_dl, uint8_t cs_ul); void bts_set_max_mcs(struct gprs_rlcmac_bts *bts, uint8_t mcs_dl, uint8_t mcs_ul); + struct GprsMs *bts_ms_by_imsi(struct BTS *bts, const char *imsi); + uint8_t bts_max_cs_dl(const struct BTS *bts); + uint8_t bts_max_cs_ul(const struct BTS *bts); + uint8_t bts_max_mcs_dl(const struct BTS *bts); + uint8_t bts_max_mcs_ul(const struct BTS *bts); #ifdef __cplusplus } |