diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2020-10-23 21:00:23 +0200 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2020-10-24 22:14:42 +0200 |
commit | b3f239785ccba762d8ebbf704a3da21208bc9dca (patch) | |
tree | 1ac413f8fae5d3bdcdd5254dc47034f74cd662d7 /tests/tbf | |
parent | 834cbab97d096825d2f46e0cc9841adab3180997 (diff) |
tbf: Make window() available to tbf base class
Return an interface to the window base class so that the tbf base class
can access the common window methods, such as set_ws(). It will be used
in next commit to get rid of duplicated function enable_egprs in both
dl_tbf and ul_tbf subclasses.
The user of the function can then decide to access more specific
functionaltiites of the window class by static casting it to the
specific direction (which is known by the caller since it operates on a
ul_tbf or a dl_tbf).
Change-Id: Ia2e1decf91be1184668e28297c2126affb9c7ae4
Diffstat (limited to 'tests/tbf')
-rw-r--r-- | tests/tbf/TbfTest.cpp | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/tests/tbf/TbfTest.cpp b/tests/tbf/TbfTest.cpp index 15a79d0c..2b5bda51 100644 --- a/tests/tbf/TbfTest.cpp +++ b/tests/tbf/TbfTest.cpp @@ -322,10 +322,11 @@ static void test_tbf_final_ack(enum test_tbf_final_ack_mode test_mode) } /* Receive an ACK */ -#define RCV_ACK(fin, tbf, rbb) do { \ - tbf->rcvd_dl_ack(fin, tbf->window()->v_s(), rbb); \ +#define RCV_ACK(fin, tbf, rbb) do { \ + gprs_rlc_dl_window *w = static_cast<gprs_rlc_dl_window *>(tbf->window()); \ + tbf->rcvd_dl_ack(fin, w->v_s(), rbb); \ if (!fin) \ - OSMO_ASSERT(tbf->window()->window_empty()); \ + OSMO_ASSERT(w->window_empty()); \ } while(0) static void test_tbf_delayed_release() @@ -1748,7 +1749,7 @@ static void test_tbf_egprs_two_phase_puan(void) print_ta_tlli(ul_tbf, true); send_dl_data(&the_bts, tlli, imsi, test_data, sizeof(test_data)); - ul_tbf->window()->reset_state(); + static_cast<gprs_rlc_ul_window *>(ul_tbf->window())->reset_state(); /* Function to generate URBB with length */ ul_tbf = establish_ul_tbf_two_phase_puan_URBB_with_length(&the_bts, ts_no, tlli, &fn, qta, ms_class, egprs_ms_class, ul_tbf); @@ -1756,7 +1757,7 @@ static void test_tbf_egprs_two_phase_puan(void) print_ta_tlli(ul_tbf, true); send_dl_data(&the_bts, tlli, imsi, test_data, sizeof(test_data)); - ul_tbf->window()->reset_state(); + static_cast<gprs_rlc_ul_window *>(ul_tbf->window())->reset_state(); /* Function to generate CRBB */ bts->ws_base = 128; bts->ws_pdch = 64; @@ -2529,7 +2530,7 @@ static void test_tbf_epdan_out_of_rx_window(void) dl_tbf = create_dl_tbf(&the_bts, ms_class, egprs_ms_class, &trx_no); dl_tbf->update_ms(tlli, GPRS_RLCMAC_DL_TBF); - prlcdlwindow = dl_tbf->window(); + prlcdlwindow = static_cast<gprs_rlc_dl_window *>(dl_tbf->window()); prlcmvb = &prlcdlwindow->m_v_b; prlcdlwindow->m_v_s = 1288; prlcdlwindow->m_v_a = 1176; @@ -2562,7 +2563,7 @@ static void test_tbf_epdan_out_of_rx_window(void) Decoding::decode_egprs_acknack_bits( &ack_nack->EGPRS_AckNack.Desc, &bits, - &bsn_begin, &bsn_end, dl_tbf->window()); + &bsn_begin, &bsn_end, prlcdlwindow); dl_tbf->rcvd_dl_ack( ack_nack->EGPRS_AckNack.Desc.FINAL_ACK_INDICATION, @@ -2747,17 +2748,20 @@ static void tbf_cleanup(gprs_rlcmac_dl_tbf *dl_tbf) } #define NACK(tbf, x) do { \ - tbf->window()->m_v_b.mark_nacked(x); \ - OSMO_ASSERT(tbf->window()->m_v_b.is_nacked(x)); \ + gprs_rlc_dl_window *w = static_cast<gprs_rlc_dl_window *>(tbf->window()); \ + w->m_v_b.mark_nacked(x); \ + OSMO_ASSERT(w->m_v_b.is_nacked(x)); \ } while(0) #define CHECK_UNACKED(tbf, cs, bsn) do { \ - OSMO_ASSERT(tbf->window()->m_v_b.is_unacked(bsn)); \ + gprs_rlc_dl_window *w = static_cast<gprs_rlc_dl_window *>(tbf->window()); \ + OSMO_ASSERT(w->m_v_b.is_unacked(bsn)); \ OSMO_ASSERT(mcs_chan_code(tbf->m_rlc.block(bsn)->cs_current_trans) == cs - 1); \ } while(0) #define CHECK_NACKED(tbf, cs, bsn) do { \ - OSMO_ASSERT(tbf->window()->m_v_b.is_nacked(bsn)); \ + gprs_rlc_dl_window *w = static_cast<gprs_rlc_dl_window *>(tbf->window()); \ + OSMO_ASSERT(w->m_v_b.is_nacked(bsn)); \ OSMO_ASSERT(mcs_chan_code(tbf->m_rlc.block(bsn)->cs_current_trans) == cs - 1); \ } while(0) |