tbf: Add tbf_as_{ul,dl}_tbf_const func helpers

This way we can easily get the subclass from the parent if the pointer
is const. Similar to what we already have for the opposite direction
{ul,dl}_tbf_as_tbf_const().

Change-Id: I35e650d13ecf3a5020d136e7d8d99837786503e2
This commit is contained in:
Pau Espin 2022-11-17 20:57:34 +01:00
parent ac9ee9aa8d
commit 1e1275faee
4 changed files with 18 additions and 0 deletions

View File

@ -1272,3 +1272,11 @@ struct gprs_rlcmac_dl_tbf *tbf_as_dl_tbf(struct gprs_rlcmac_tbf *tbf)
else
return NULL;
}
const struct gprs_rlcmac_dl_tbf *tbf_as_dl_tbf_const(const struct gprs_rlcmac_tbf *tbf)
{
if (tbf && tbf->direction == GPRS_RLCMAC_DL_TBF)
return static_cast<const gprs_rlcmac_dl_tbf *>(tbf);
else
return NULL;
}

View File

@ -130,6 +130,7 @@ struct gprs_rlcmac_dl_tbf *dl_tbf_alloc(struct gprs_rlcmac_bts *bts, struct Gprs
int8_t use_trx, bool single_slot);
struct gprs_rlcmac_dl_tbf *tbf_as_dl_tbf(struct gprs_rlcmac_tbf *tbf);
const struct gprs_rlcmac_dl_tbf *tbf_as_dl_tbf_const(const struct gprs_rlcmac_tbf *tbf);
/* dispatch Unitdata.DL messages */
int dl_tbf_handle(struct gprs_rlcmac_bts *bts,
const uint32_t tlli, const uint32_t old_tlli,

View File

@ -729,6 +729,14 @@ struct gprs_rlcmac_ul_tbf *tbf_as_ul_tbf(struct gprs_rlcmac_tbf *tbf)
return NULL;
}
const struct gprs_rlcmac_ul_tbf *tbf_as_ul_tbf_const(const struct gprs_rlcmac_tbf *tbf)
{
if (tbf && tbf->direction == GPRS_RLCMAC_UL_TBF)
return static_cast<const gprs_rlcmac_ul_tbf *>(tbf);
else
return NULL;
}
void tbf_usf_timeout(struct gprs_rlcmac_ul_tbf *tbf)
{
tbf->usf_timeout();

View File

@ -136,6 +136,7 @@ struct gprs_rlcmac_ul_tbf *ul_tbf_alloc(struct gprs_rlcmac_bts *bts, struct Gprs
void update_tbf_ta(struct gprs_rlcmac_ul_tbf *tbf, int8_t ta_delta);
void set_tbf_ta(struct gprs_rlcmac_ul_tbf *tbf, uint8_t ta);
struct gprs_rlcmac_ul_tbf *tbf_as_ul_tbf(struct gprs_rlcmac_tbf *tbf);
const struct gprs_rlcmac_ul_tbf *tbf_as_ul_tbf_const(const struct gprs_rlcmac_tbf *tbf);
void tbf_usf_timeout(struct gprs_rlcmac_ul_tbf *tbf);
void ul_tbf_contention_resolution_start(struct gprs_rlcmac_ul_tbf *tbf);
void ul_tbf_contention_resolution_success(struct gprs_rlcmac_ul_tbf *tbf);