aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-11-07 07:32:51 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-11-07 07:32:51 +0100
commita1da251c10940291581f016e89e18d91803b9b95 (patch)
treec09f998a0651631ba03b69520ce04b5de8622c68 /src
parent096f6f9f39a078ee45bc9dcba6fb7cc2a10936cb (diff)
tbf: Move the tbf_handle and tbf_append_data into the class
Diffstat (limited to 'src')
-rw-r--r--src/gprs_bssgp_pcu.cpp2
-rw-r--r--src/tbf.cpp37
-rw-r--r--src/tbf.h14
3 files changed, 27 insertions, 26 deletions
diff --git a/src/gprs_bssgp_pcu.cpp b/src/gprs_bssgp_pcu.cpp
index db02584..4831c9e 100644
--- a/src/gprs_bssgp_pcu.cpp
+++ b/src/gprs_bssgp_pcu.cpp
@@ -153,7 +153,7 @@ static int gprs_bssgp_pcu_rx_dl_ud(struct msgb *msg, struct tlv_parsed *tp)
LOGP(DBSSGP, LOGL_INFO, "LLC [SGSN -> PCU] = TLLI: 0x%08x IMSI: %s len: %d\n", tlli, imsi, len);
- return tbf_handle(the_pcu.bts, tlli, imsi, ms_class, delay_csec, data, len);
+ return gprs_rlcmac_tbf::handle(the_pcu.bts, tlli, imsi, ms_class, delay_csec, data, len);
}
int gprs_bssgp_pcu_rx_paging_ps(struct msgb *msg, struct tlv_parsed *tp)
diff --git a/src/tbf.cpp b/src/tbf.cpp
index 84dc8b6..b10b729 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -89,26 +89,24 @@ static struct gprs_rlcmac_tbf *tbf_lookup_dl(BTS *bts,
return bts->tbf_by_tlli(tlli, GPRS_RLCMAC_DL_TBF);
}
-static int tbf_append_data(struct gprs_rlcmac_tbf *tbf,
- struct gprs_rlcmac_bts *bts,
- const uint8_t ms_class,
+int gprs_rlcmac_tbf::append_data(const uint8_t ms_class,
const uint16_t pdu_delay_csec,
const uint8_t *data, const uint16_t len)
{
- LOGP(DRLCMAC, LOGL_INFO, "%s append\n", tbf_name(tbf));
- if (tbf->state_is(GPRS_RLCMAC_WAIT_RELEASE)) {
+ LOGP(DRLCMAC, LOGL_INFO, "%s append\n", tbf_name(this));
+ if (state_is(GPRS_RLCMAC_WAIT_RELEASE)) {
LOGP(DRLCMAC, LOGL_DEBUG,
"%s in WAIT RELEASE state "
- "(T3193), so reuse TBF\n", tbf_name(tbf));
- tbf->m_llc.put_frame(data, len);
+ "(T3193), so reuse TBF\n", tbf_name(this));
+ m_llc.put_frame(data, len);
/* reset rlc states */
- memset(&tbf->dir.dl, 0, sizeof(tbf->dir.dl));
+ memset(&dir.dl, 0, sizeof(dir.dl));
/* keep to flags */
- tbf->state_flags &= GPRS_RLCMAC_FLAG_TO_MASK;
- tbf->state_flags &= ~(1 << GPRS_RLCMAC_FLAG_CCCH);
- tbf_update_ms_class(tbf, ms_class);
- tbf->update();
- tbf->bts->trigger_dl_ass(tbf, tbf, NULL);
+ state_flags &= GPRS_RLCMAC_FLAG_TO_MASK;
+ state_flags &= ~(1 << GPRS_RLCMAC_FLAG_CCCH);
+ tbf_update_ms_class(this, ms_class);
+ update();
+ bts->trigger_dl_ass(this, this, NULL);
} else {
/* the TBF exists, so we must write it in the queue
* we prepend lifetime in front of PDU */
@@ -120,8 +118,8 @@ static int tbf_append_data(struct gprs_rlcmac_tbf *tbf,
tv = (struct timeval *)msgb_put(llc_msg, sizeof(*tv));
uint16_t delay_csec;
- if (bts->force_llc_lifetime)
- delay_csec = bts->force_llc_lifetime;
+ if (bts_data()->force_llc_lifetime)
+ delay_csec = bts_data()->force_llc_lifetime;
else
delay_csec = pdu_delay_csec;
/* keep timestap at 0 for infinite delay */
@@ -136,8 +134,8 @@ static int tbf_append_data(struct gprs_rlcmac_tbf *tbf,
}
}
memcpy(msgb_put(llc_msg, len), data, len);
- tbf->m_llc.enqueue(llc_msg);
- tbf_update_ms_class(tbf, ms_class);
+ m_llc.enqueue(llc_msg);
+ tbf_update_ms_class(this, ms_class);
}
return 0;
@@ -221,7 +219,7 @@ static int tbf_new_dl_assignment(struct gprs_rlcmac_bts *bts,
/**
* TODO: split into unit test-able parts...
*/
-int tbf_handle(struct gprs_rlcmac_bts *bts,
+int gprs_rlcmac_tbf::handle(struct gprs_rlcmac_bts *bts,
const uint32_t tlli, const char *imsi,
const uint8_t ms_class, const uint16_t delay_csec,
const uint8_t *data, const uint16_t len)
@@ -231,8 +229,7 @@ int tbf_handle(struct gprs_rlcmac_bts *bts,
/* check for existing TBF */
tbf = tbf_lookup_dl(bts->bts, tlli, imsi);
if (tbf) {
- int rc = tbf_append_data(tbf, bts, ms_class,
- delay_csec, data, len);
+ int rc = tbf->append_data(ms_class, delay_csec, data, len);
if (rc >= 0)
tbf->assign_imsi(imsi);
return rc;
diff --git a/src/tbf.h b/src/tbf.h
index b6d5d30..dcaa650 100644
--- a/src/tbf.h
+++ b/src/tbf.h
@@ -131,6 +131,12 @@ struct gprs_rlcmac_tbf {
/* blocks were acked */
int rcv_data_block_acknowledged(const uint8_t *data, size_t len, int8_t rssi);
+ /* dispatch Unitdata.DL messages */
+ static int handle(struct gprs_rlcmac_bts *bts,
+ const uint32_t tlli, const char *imsi, const uint8_t ms_class,
+ const uint16_t delay_csec, const uint8_t *data, const uint16_t len);
+
+
int rlcmac_diag();
int update();
@@ -257,14 +263,12 @@ struct gprs_rlcmac_tbf {
protected:
gprs_rlcmac_bts *bts_data() const;
+ int append_data(const uint8_t ms_class,
+ const uint16_t pdu_delay_csec,
+ const uint8_t *data, const uint16_t len);
};
-/* dispatch Unitdata.DL messages */
-int tbf_handle(struct gprs_rlcmac_bts *bts,
- const uint32_t tlli, const char *imsi, const uint8_t ms_class,
- const uint16_t delay_csec, const uint8_t *data, const uint16_t len);
-
struct gprs_rlcmac_tbf *tbf_alloc_ul(struct gprs_rlcmac_bts *bts,
int8_t use_trx, uint8_t ms_class,
uint32_t tlli, uint8_t ta, struct gprs_rlcmac_tbf *dl_tbf);