2015-05-06 16:30:48 +00:00
|
|
|
/*
|
|
|
|
* MsTest.cpp
|
|
|
|
*
|
|
|
|
* Copyright (C) 2015 by Sysmocom s.f.m.c. GmbH
|
|
|
|
*
|
|
|
|
* All Rights Reserved
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "tbf.h"
|
2019-09-25 15:47:02 +00:00
|
|
|
#include "tbf_ul.h"
|
2015-05-06 16:30:48 +00:00
|
|
|
#include "gprs_debug.h"
|
|
|
|
#include "gprs_ms.h"
|
2015-05-12 15:54:33 +00:00
|
|
|
#include "gprs_ms_storage.h"
|
2015-06-12 08:52:34 +00:00
|
|
|
#include "bts.h"
|
2015-05-06 16:30:48 +00:00
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
#include "pcu_vty.h"
|
|
|
|
|
|
|
|
#include <osmocom/core/application.h>
|
|
|
|
#include <osmocom/core/msgb.h>
|
|
|
|
#include <osmocom/core/talloc.h>
|
|
|
|
#include <osmocom/core/utils.h>
|
|
|
|
#include <osmocom/vty/vty.h>
|
|
|
|
}
|
|
|
|
|
|
|
|
#include <errno.h>
|
2015-05-28 13:43:53 +00:00
|
|
|
#include <unistd.h>
|
2015-05-06 16:30:48 +00:00
|
|
|
|
2020-03-26 14:56:15 +00:00
|
|
|
#include <new>
|
|
|
|
|
2015-05-06 16:30:48 +00:00
|
|
|
void *tall_pcu_ctx;
|
|
|
|
int16_t spoof_mnc = 0, spoof_mcc = 0;
|
2018-02-20 23:39:07 +00:00
|
|
|
bool spoof_mnc_3_digits = false;
|
2015-05-06 16:30:48 +00:00
|
|
|
|
2021-05-14 12:33:28 +00:00
|
|
|
static int ul_tbf_dtor(struct gprs_rlcmac_ul_tbf *tbf)
|
|
|
|
{
|
|
|
|
tbf->~gprs_rlcmac_ul_tbf();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int dl_tbf_dtor(struct gprs_rlcmac_dl_tbf *tbf)
|
|
|
|
{
|
|
|
|
tbf->~gprs_rlcmac_dl_tbf();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gprs_rlcmac_ul_tbf *alloc_ul_tbf(struct gprs_rlcmac_bts *bts, GprsMs *ms)
|
|
|
|
{
|
|
|
|
gprs_rlcmac_ul_tbf *ul_tbf;
|
|
|
|
ul_tbf = talloc_zero(tall_pcu_ctx, struct gprs_rlcmac_ul_tbf);
|
|
|
|
talloc_set_destructor(ul_tbf, ul_tbf_dtor);
|
|
|
|
new (ul_tbf) gprs_rlcmac_ul_tbf(bts, ms);
|
|
|
|
return ul_tbf;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gprs_rlcmac_dl_tbf *alloc_dl_tbf(struct gprs_rlcmac_bts *bts, GprsMs *ms)
|
|
|
|
{
|
|
|
|
gprs_rlcmac_dl_tbf *dl_tbf;
|
|
|
|
dl_tbf = talloc_zero(tall_pcu_ctx, struct gprs_rlcmac_dl_tbf);
|
|
|
|
talloc_set_destructor(dl_tbf, dl_tbf_dtor);
|
|
|
|
new (dl_tbf) gprs_rlcmac_dl_tbf(bts, ms);
|
|
|
|
return dl_tbf;
|
|
|
|
}
|
|
|
|
|
2015-05-06 16:30:48 +00:00
|
|
|
static void test_ms_state()
|
|
|
|
{
|
|
|
|
uint32_t tlli = 0xffeeddbb;
|
|
|
|
gprs_rlcmac_dl_tbf *dl_tbf;
|
|
|
|
gprs_rlcmac_ul_tbf *ul_tbf;
|
2021-01-18 16:14:14 +00:00
|
|
|
struct gprs_rlcmac_bts *bts = bts_alloc(the_pcu, 0);
|
2015-05-06 16:30:48 +00:00
|
|
|
GprsMs *ms;
|
|
|
|
|
|
|
|
printf("=== start %s ===\n", __func__);
|
|
|
|
|
2021-01-14 15:48:38 +00:00
|
|
|
ms = ms_alloc(bts, tlli);
|
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
2020-12-16 14:59:45 +00:00
|
|
|
OSMO_ASSERT(ms_is_idle(ms));
|
2015-05-06 16:30:48 +00:00
|
|
|
|
2021-05-14 12:33:28 +00:00
|
|
|
dl_tbf = alloc_dl_tbf(bts, ms);
|
|
|
|
ul_tbf = alloc_ul_tbf(bts, ms);
|
2015-05-06 16:30:48 +00:00
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_attach_tbf(ms, ul_tbf);
|
|
|
|
OSMO_ASSERT(!ms_is_idle(ms));
|
|
|
|
OSMO_ASSERT(ms_ul_tbf(ms) == ul_tbf);
|
|
|
|
OSMO_ASSERT(ms_dl_tbf(ms) == NULL);
|
2015-05-06 16:30:48 +00:00
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_attach_tbf(ms, dl_tbf);
|
|
|
|
OSMO_ASSERT(!ms_is_idle(ms));
|
|
|
|
OSMO_ASSERT(ms_ul_tbf(ms) == ul_tbf);
|
|
|
|
OSMO_ASSERT(ms_dl_tbf(ms) == dl_tbf);
|
2015-05-06 16:30:48 +00:00
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
OSMO_ASSERT(ms_tbf(ms, GPRS_RLCMAC_UL_TBF) == ul_tbf);
|
|
|
|
OSMO_ASSERT(ms_tbf(ms, GPRS_RLCMAC_DL_TBF) == dl_tbf);
|
2015-06-29 12:18:46 +00:00
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_detach_tbf(ms, ul_tbf);
|
|
|
|
OSMO_ASSERT(!ms_is_idle(ms));
|
|
|
|
OSMO_ASSERT(ms_ul_tbf(ms) == NULL);
|
|
|
|
OSMO_ASSERT(ms_dl_tbf(ms) == dl_tbf);
|
2015-05-06 16:30:48 +00:00
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_detach_tbf(ms, dl_tbf);
|
2015-05-06 16:30:48 +00:00
|
|
|
/* The ms object is freed now */
|
|
|
|
ms = NULL;
|
|
|
|
|
|
|
|
talloc_free(dl_tbf);
|
|
|
|
talloc_free(ul_tbf);
|
2021-01-14 15:48:38 +00:00
|
|
|
talloc_free(bts);
|
2015-05-06 16:30:48 +00:00
|
|
|
printf("=== end %s ===\n", __func__);
|
|
|
|
}
|
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
static enum {CB_UNKNOWN, CB_IS_IDLE, CB_IS_ACTIVE} last_cb = CB_UNKNOWN;
|
|
|
|
static void ms_idle_cb(struct GprsMs *ms)
|
|
|
|
{
|
|
|
|
OSMO_ASSERT(ms_is_idle(ms));
|
|
|
|
printf(" ms_idle() was called\n");
|
|
|
|
last_cb = CB_IS_IDLE;
|
|
|
|
}
|
|
|
|
static void ms_active_cb(struct GprsMs *ms)
|
|
|
|
{
|
|
|
|
OSMO_ASSERT(!ms_is_idle(ms));
|
|
|
|
printf(" ms_active() was called\n");
|
|
|
|
last_cb = CB_IS_ACTIVE;
|
|
|
|
}
|
|
|
|
static struct gpr_ms_callback ms_cb = {
|
|
|
|
.ms_idle = ms_idle_cb,
|
|
|
|
.ms_active = ms_active_cb
|
|
|
|
};
|
2015-05-06 16:30:48 +00:00
|
|
|
static void test_ms_callback()
|
|
|
|
{
|
|
|
|
uint32_t tlli = 0xffeeddbb;
|
|
|
|
gprs_rlcmac_dl_tbf *dl_tbf;
|
|
|
|
gprs_rlcmac_ul_tbf *ul_tbf;
|
2021-01-18 16:14:14 +00:00
|
|
|
struct gprs_rlcmac_bts *bts = bts_alloc(the_pcu, 0);
|
2015-05-06 16:30:48 +00:00
|
|
|
GprsMs *ms;
|
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
2020-12-16 14:59:45 +00:00
|
|
|
last_cb = CB_UNKNOWN;
|
2015-05-06 16:30:48 +00:00
|
|
|
|
|
|
|
printf("=== start %s ===\n", __func__);
|
|
|
|
|
2021-01-14 15:48:38 +00:00
|
|
|
ms = ms_alloc(bts, tlli);
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_set_callback(ms, &ms_cb);
|
2015-05-06 16:30:48 +00:00
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
OSMO_ASSERT(ms_is_idle(ms));
|
2015-05-06 16:30:48 +00:00
|
|
|
|
2021-05-14 12:33:28 +00:00
|
|
|
dl_tbf = alloc_dl_tbf(bts, ms);
|
|
|
|
ul_tbf = alloc_ul_tbf(bts, ms);
|
2015-05-06 16:30:48 +00:00
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
OSMO_ASSERT(last_cb == CB_UNKNOWN);
|
2015-05-06 16:30:48 +00:00
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_attach_tbf(ms, ul_tbf);
|
|
|
|
OSMO_ASSERT(!ms_is_idle(ms));
|
|
|
|
OSMO_ASSERT(ms_ul_tbf(ms) == ul_tbf);
|
|
|
|
OSMO_ASSERT(ms_dl_tbf(ms) == NULL);
|
|
|
|
OSMO_ASSERT(last_cb == CB_IS_ACTIVE);
|
2015-05-06 16:30:48 +00:00
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
last_cb = CB_UNKNOWN;
|
2015-05-06 16:30:48 +00:00
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_attach_tbf(ms, dl_tbf);
|
|
|
|
OSMO_ASSERT(!ms_is_idle(ms));
|
|
|
|
OSMO_ASSERT(ms_ul_tbf(ms) == ul_tbf);
|
|
|
|
OSMO_ASSERT(ms_dl_tbf(ms) == dl_tbf);
|
|
|
|
OSMO_ASSERT(last_cb == CB_UNKNOWN);
|
2015-05-06 16:30:48 +00:00
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_detach_tbf(ms, ul_tbf);
|
|
|
|
OSMO_ASSERT(!ms_is_idle(ms));
|
|
|
|
OSMO_ASSERT(ms_ul_tbf(ms) == NULL);
|
|
|
|
OSMO_ASSERT(ms_dl_tbf(ms) == dl_tbf);
|
|
|
|
OSMO_ASSERT(last_cb == CB_UNKNOWN);
|
2015-05-06 16:30:48 +00:00
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_detach_tbf(ms, dl_tbf);
|
|
|
|
OSMO_ASSERT(ms_is_idle(ms));
|
|
|
|
OSMO_ASSERT(ms_ul_tbf(ms) == NULL);
|
|
|
|
OSMO_ASSERT(ms_dl_tbf(ms) == NULL);
|
|
|
|
OSMO_ASSERT(last_cb == CB_IS_IDLE);
|
2015-05-06 16:30:48 +00:00
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
last_cb = CB_UNKNOWN;
|
|
|
|
talloc_free(ms);
|
2015-05-06 16:30:48 +00:00
|
|
|
|
|
|
|
talloc_free(dl_tbf);
|
|
|
|
talloc_free(ul_tbf);
|
2021-01-14 15:48:38 +00:00
|
|
|
talloc_free(bts);
|
2015-05-06 16:30:48 +00:00
|
|
|
printf("=== end %s ===\n", __func__);
|
|
|
|
}
|
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
static bool was_idle;
|
|
|
|
static void ms_replace_tbf_idle_cb(struct GprsMs *ms)
|
|
|
|
{
|
|
|
|
OSMO_ASSERT(ms_is_idle(ms));
|
|
|
|
printf(" ms_idle() was called\n");
|
|
|
|
was_idle = true;
|
|
|
|
}
|
|
|
|
static void ms_replace_tbf_active_cb(struct GprsMs *ms)
|
|
|
|
{
|
|
|
|
OSMO_ASSERT(!ms_is_idle(ms));
|
|
|
|
printf(" ms_active() was called\n");
|
|
|
|
}
|
|
|
|
static struct gpr_ms_callback ms_replace_tbf_cb = {
|
|
|
|
.ms_idle = ms_replace_tbf_idle_cb,
|
|
|
|
.ms_active = ms_replace_tbf_active_cb
|
|
|
|
};
|
2015-05-06 16:30:48 +00:00
|
|
|
static void test_ms_replace_tbf()
|
|
|
|
{
|
|
|
|
uint32_t tlli = 0xffeeddbb;
|
|
|
|
gprs_rlcmac_dl_tbf *dl_tbf[2];
|
|
|
|
gprs_rlcmac_ul_tbf *ul_tbf;
|
2021-01-18 16:14:14 +00:00
|
|
|
struct gprs_rlcmac_bts *bts = bts_alloc(the_pcu, 0);
|
2015-05-06 16:30:48 +00:00
|
|
|
GprsMs *ms;
|
|
|
|
|
|
|
|
printf("=== start %s ===\n", __func__);
|
|
|
|
|
2021-01-14 15:48:38 +00:00
|
|
|
ms = ms_alloc(bts, tlli);
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_set_callback(ms, &ms_replace_tbf_cb);
|
2015-05-06 16:30:48 +00:00
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
OSMO_ASSERT(ms_is_idle(ms));
|
2015-05-06 16:30:48 +00:00
|
|
|
was_idle = false;
|
|
|
|
|
2021-05-14 12:33:28 +00:00
|
|
|
dl_tbf[0] = alloc_dl_tbf(bts, ms);
|
|
|
|
dl_tbf[1] = alloc_dl_tbf(bts, ms);
|
|
|
|
ul_tbf = alloc_ul_tbf(bts, ms);
|
2015-05-06 16:30:48 +00:00
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_attach_tbf(ms, dl_tbf[0]);
|
|
|
|
OSMO_ASSERT(!ms_is_idle(ms));
|
|
|
|
OSMO_ASSERT(ms_ul_tbf(ms) == NULL);
|
|
|
|
OSMO_ASSERT(ms_dl_tbf(ms) == dl_tbf[0]);
|
|
|
|
OSMO_ASSERT(llist_empty(&ms->old_tbfs));
|
2015-05-06 16:30:48 +00:00
|
|
|
OSMO_ASSERT(!was_idle);
|
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_attach_tbf(ms, dl_tbf[1]);
|
|
|
|
OSMO_ASSERT(!ms_is_idle(ms));
|
|
|
|
OSMO_ASSERT(ms_ul_tbf(ms) == NULL);
|
|
|
|
OSMO_ASSERT(ms_dl_tbf(ms) == dl_tbf[1]);
|
|
|
|
OSMO_ASSERT(!llist_empty(&ms->old_tbfs));
|
2015-05-06 16:30:48 +00:00
|
|
|
OSMO_ASSERT(!was_idle);
|
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_attach_tbf(ms, ul_tbf);
|
|
|
|
OSMO_ASSERT(!ms_is_idle(ms));
|
|
|
|
OSMO_ASSERT(ms_ul_tbf(ms) == ul_tbf);
|
|
|
|
OSMO_ASSERT(ms_dl_tbf(ms) == dl_tbf[1]);
|
|
|
|
OSMO_ASSERT(!llist_empty(&ms->old_tbfs));
|
2015-05-06 16:30:48 +00:00
|
|
|
OSMO_ASSERT(!was_idle);
|
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_detach_tbf(ms, ul_tbf);
|
|
|
|
OSMO_ASSERT(!ms_is_idle(ms));
|
|
|
|
OSMO_ASSERT(ms_ul_tbf(ms) == NULL);
|
|
|
|
OSMO_ASSERT(ms_dl_tbf(ms) == dl_tbf[1]);
|
|
|
|
OSMO_ASSERT(!llist_empty(&ms->old_tbfs));
|
2015-05-06 16:30:48 +00:00
|
|
|
OSMO_ASSERT(!was_idle);
|
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_detach_tbf(ms, dl_tbf[0]);
|
|
|
|
OSMO_ASSERT(!ms_is_idle(ms));
|
|
|
|
OSMO_ASSERT(ms_ul_tbf(ms) == NULL);
|
|
|
|
OSMO_ASSERT(ms_dl_tbf(ms) == dl_tbf[1]);
|
|
|
|
OSMO_ASSERT(llist_empty(&ms->old_tbfs));
|
2015-05-06 16:30:48 +00:00
|
|
|
OSMO_ASSERT(!was_idle);
|
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_detach_tbf(ms, dl_tbf[1]);
|
|
|
|
OSMO_ASSERT(ms_is_idle(ms));
|
|
|
|
OSMO_ASSERT(ms_ul_tbf(ms) == NULL);
|
|
|
|
OSMO_ASSERT(ms_dl_tbf(ms) == NULL);
|
|
|
|
OSMO_ASSERT(llist_empty(&ms->old_tbfs));
|
2015-05-06 16:30:48 +00:00
|
|
|
OSMO_ASSERT(was_idle);
|
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
talloc_free(ms);
|
2015-05-06 16:30:48 +00:00
|
|
|
|
|
|
|
talloc_free(dl_tbf[0]);
|
|
|
|
talloc_free(dl_tbf[1]);
|
|
|
|
talloc_free(ul_tbf);
|
2021-01-14 15:48:38 +00:00
|
|
|
talloc_free(bts);
|
2015-05-06 16:30:48 +00:00
|
|
|
printf("=== end %s ===\n", __func__);
|
|
|
|
}
|
|
|
|
|
2015-05-15 13:50:43 +00:00
|
|
|
static void test_ms_change_tlli()
|
|
|
|
{
|
|
|
|
uint32_t start_tlli = 0xaa000000;
|
|
|
|
uint32_t new_ms_tlli = 0xff001111;
|
|
|
|
uint32_t other_sgsn_tlli = 0xff00eeee;
|
2021-01-18 16:14:14 +00:00
|
|
|
struct gprs_rlcmac_bts *bts = bts_alloc(the_pcu, 0);
|
2015-05-15 13:50:43 +00:00
|
|
|
GprsMs *ms;
|
|
|
|
|
|
|
|
printf("=== start %s ===\n", __func__);
|
|
|
|
|
2021-01-14 15:48:38 +00:00
|
|
|
ms = ms_alloc(bts, start_tlli);
|
2015-05-15 13:50:43 +00:00
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
OSMO_ASSERT(ms_is_idle(ms));
|
2015-05-15 13:50:43 +00:00
|
|
|
|
|
|
|
/* MS announces TLLI, SGSN uses it immediately */
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_set_tlli(ms, new_ms_tlli);
|
|
|
|
OSMO_ASSERT(ms_tlli(ms) == new_ms_tlli);
|
|
|
|
OSMO_ASSERT(ms_check_tlli(ms, new_ms_tlli));
|
|
|
|
OSMO_ASSERT(ms_check_tlli(ms, start_tlli));
|
2015-05-15 13:50:43 +00:00
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_confirm_tlli(ms, new_ms_tlli);
|
|
|
|
OSMO_ASSERT(ms_tlli(ms) == new_ms_tlli);
|
|
|
|
OSMO_ASSERT(ms_check_tlli(ms, new_ms_tlli));
|
|
|
|
OSMO_ASSERT(!ms_check_tlli(ms, start_tlli));
|
2015-05-15 13:50:43 +00:00
|
|
|
|
|
|
|
/* MS announces TLLI, SGSN uses it later */
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_set_tlli(ms, start_tlli);
|
|
|
|
ms_confirm_tlli(ms, start_tlli);
|
2015-05-15 13:50:43 +00:00
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_set_tlli(ms, new_ms_tlli);
|
|
|
|
OSMO_ASSERT(ms_tlli(ms) == new_ms_tlli);
|
|
|
|
OSMO_ASSERT(ms_check_tlli(ms, new_ms_tlli));
|
|
|
|
OSMO_ASSERT(ms_check_tlli(ms, start_tlli));
|
2015-05-15 13:50:43 +00:00
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_confirm_tlli(ms, start_tlli);
|
|
|
|
OSMO_ASSERT(ms_tlli(ms) == new_ms_tlli);
|
|
|
|
OSMO_ASSERT(ms_check_tlli(ms, new_ms_tlli));
|
|
|
|
OSMO_ASSERT(ms_check_tlli(ms, start_tlli));
|
2015-05-15 13:50:43 +00:00
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_set_tlli(ms, new_ms_tlli);
|
|
|
|
OSMO_ASSERT(ms_tlli(ms) == new_ms_tlli);
|
|
|
|
OSMO_ASSERT(ms_check_tlli(ms, new_ms_tlli));
|
|
|
|
OSMO_ASSERT(ms_check_tlli(ms, start_tlli));
|
2015-05-15 13:50:43 +00:00
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_confirm_tlli(ms, new_ms_tlli);
|
|
|
|
OSMO_ASSERT(ms_tlli(ms) == new_ms_tlli);
|
|
|
|
OSMO_ASSERT(ms_check_tlli(ms, new_ms_tlli));
|
|
|
|
OSMO_ASSERT(!ms_check_tlli(ms, start_tlli));
|
2015-05-15 13:50:43 +00:00
|
|
|
|
|
|
|
/* MS announces TLLI, SGSN uses it later after another new TLLI */
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_set_tlli(ms, start_tlli);
|
|
|
|
ms_confirm_tlli(ms, start_tlli);
|
|
|
|
|
|
|
|
ms_set_tlli(ms, new_ms_tlli);
|
|
|
|
OSMO_ASSERT(ms_tlli(ms) == new_ms_tlli);
|
|
|
|
OSMO_ASSERT(ms_check_tlli(ms, new_ms_tlli));
|
|
|
|
OSMO_ASSERT(ms_check_tlli(ms, start_tlli));
|
|
|
|
|
|
|
|
ms_confirm_tlli(ms, other_sgsn_tlli);
|
|
|
|
OSMO_ASSERT(ms_tlli(ms) == new_ms_tlli);
|
|
|
|
OSMO_ASSERT(ms_check_tlli(ms, new_ms_tlli));
|
|
|
|
OSMO_ASSERT(ms_check_tlli(ms, other_sgsn_tlli));
|
|
|
|
|
|
|
|
ms_set_tlli(ms, new_ms_tlli);
|
|
|
|
OSMO_ASSERT(ms_tlli(ms) == new_ms_tlli);
|
|
|
|
OSMO_ASSERT(ms_check_tlli(ms, new_ms_tlli));
|
|
|
|
OSMO_ASSERT(ms_check_tlli(ms, other_sgsn_tlli));
|
|
|
|
|
|
|
|
ms_confirm_tlli(ms, new_ms_tlli);
|
|
|
|
OSMO_ASSERT(ms_tlli(ms) == new_ms_tlli);
|
|
|
|
OSMO_ASSERT(ms_check_tlli(ms, new_ms_tlli));
|
|
|
|
OSMO_ASSERT(!ms_check_tlli(ms, start_tlli));
|
|
|
|
OSMO_ASSERT(!ms_check_tlli(ms, other_sgsn_tlli));
|
2015-05-15 13:50:43 +00:00
|
|
|
|
|
|
|
/* SGSN uses the new TLLI before it is announced by the MS (shouldn't
|
|
|
|
* happen in normal use) */
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_set_tlli(ms, start_tlli);
|
|
|
|
ms_confirm_tlli(ms, start_tlli);
|
2015-05-15 13:50:43 +00:00
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_confirm_tlli(ms, new_ms_tlli);
|
|
|
|
OSMO_ASSERT(ms_tlli(ms) == start_tlli);
|
|
|
|
OSMO_ASSERT(ms_check_tlli(ms, new_ms_tlli));
|
|
|
|
OSMO_ASSERT(ms_check_tlli(ms, start_tlli));
|
2015-05-15 13:50:43 +00:00
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_set_tlli(ms, new_ms_tlli);
|
|
|
|
OSMO_ASSERT(ms_tlli(ms) == new_ms_tlli);
|
|
|
|
OSMO_ASSERT(ms_check_tlli(ms, new_ms_tlli));
|
|
|
|
OSMO_ASSERT(!ms_check_tlli(ms, start_tlli));
|
2015-05-15 13:50:43 +00:00
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
talloc_free(ms);
|
2021-01-14 15:48:38 +00:00
|
|
|
talloc_free(bts);
|
2015-05-15 13:50:43 +00:00
|
|
|
printf("=== end %s ===\n", __func__);
|
|
|
|
}
|
|
|
|
|
2019-03-12 11:53:27 +00:00
|
|
|
static GprsMs *prepare_ms(GprsMsStorage *st, uint32_t tlli, enum gprs_rlcmac_tbf_direction dir)
|
|
|
|
{
|
|
|
|
GprsMs *ms = st->get_ms(tlli);
|
|
|
|
if (ms)
|
|
|
|
return ms;
|
|
|
|
|
|
|
|
ms = st->create_ms();
|
|
|
|
|
|
|
|
if (dir == GPRS_RLCMAC_UL_TBF)
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_set_tlli(ms, tlli);
|
2019-03-12 11:53:27 +00:00
|
|
|
else
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_confirm_tlli(ms, tlli);
|
2019-03-12 11:53:27 +00:00
|
|
|
|
|
|
|
return ms;
|
|
|
|
}
|
|
|
|
|
2015-05-12 15:54:33 +00:00
|
|
|
static void test_ms_storage()
|
|
|
|
{
|
|
|
|
uint32_t tlli = 0xffeeddbb;
|
2015-05-21 09:07:53 +00:00
|
|
|
const char *imsi1 = "001001987654321";
|
|
|
|
const char *imsi2 = "001001987654322";
|
|
|
|
|
2015-05-12 15:54:33 +00:00
|
|
|
gprs_rlcmac_ul_tbf *ul_tbf;
|
2021-01-18 16:14:14 +00:00
|
|
|
struct gprs_rlcmac_bts *bts = bts_alloc(the_pcu, 0);
|
2015-05-21 14:58:22 +00:00
|
|
|
GprsMs *ms, *ms_tmp;
|
2021-01-14 15:48:38 +00:00
|
|
|
GprsMsStorage store(bts);
|
2015-05-12 15:54:33 +00:00
|
|
|
|
|
|
|
printf("=== start %s ===\n", __func__);
|
|
|
|
|
|
|
|
ms = store.get_ms(tlli + 0);
|
|
|
|
OSMO_ASSERT(ms == NULL);
|
|
|
|
|
2019-03-12 11:53:27 +00:00
|
|
|
ms = prepare_ms(&store, tlli + 0, GPRS_RLCMAC_UL_TBF);
|
2015-05-21 14:58:22 +00:00
|
|
|
OSMO_ASSERT(ms != NULL);
|
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
2020-12-16 14:59:45 +00:00
|
|
|
OSMO_ASSERT(ms_tlli(ms) == tlli + 0);
|
|
|
|
ms_set_imsi(ms, imsi1);
|
|
|
|
OSMO_ASSERT(strcmp(ms_imsi(ms), imsi1) == 0);
|
2015-05-12 15:54:33 +00:00
|
|
|
|
2015-05-21 14:58:22 +00:00
|
|
|
ms_tmp = store.get_ms(tlli + 0);
|
|
|
|
OSMO_ASSERT(ms == ms_tmp);
|
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
2020-12-16 14:59:45 +00:00
|
|
|
OSMO_ASSERT(ms_tlli(ms) == tlli + 0);
|
2015-05-12 15:54:33 +00:00
|
|
|
|
2015-05-21 09:07:53 +00:00
|
|
|
ms_tmp = store.get_ms(0, 0, imsi1);
|
|
|
|
OSMO_ASSERT(ms == ms_tmp);
|
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
2020-12-16 14:59:45 +00:00
|
|
|
OSMO_ASSERT(strcmp(ms_imsi(ms), imsi1) == 0);
|
2015-05-21 09:07:53 +00:00
|
|
|
ms_tmp = store.get_ms(0, 0, imsi2);
|
|
|
|
OSMO_ASSERT(ms_tmp == NULL);
|
|
|
|
|
2019-03-12 11:53:27 +00:00
|
|
|
ms = prepare_ms(&store, tlli + 1, GPRS_RLCMAC_UL_TBF);
|
2015-05-21 14:58:22 +00:00
|
|
|
OSMO_ASSERT(ms != NULL);
|
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
2020-12-16 14:59:45 +00:00
|
|
|
OSMO_ASSERT(ms_tlli(ms) == tlli + 1);
|
|
|
|
ms_set_imsi(ms, imsi2);
|
|
|
|
OSMO_ASSERT(strcmp(ms_imsi(ms), imsi2) == 0);
|
2015-05-12 15:54:33 +00:00
|
|
|
|
2015-05-21 14:58:22 +00:00
|
|
|
ms_tmp = store.get_ms(tlli + 1);
|
|
|
|
OSMO_ASSERT(ms == ms_tmp);
|
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
2020-12-16 14:59:45 +00:00
|
|
|
OSMO_ASSERT(ms_tlli(ms) == tlli + 1);
|
2015-05-12 15:54:33 +00:00
|
|
|
|
2015-05-21 09:07:53 +00:00
|
|
|
ms_tmp = store.get_ms(0, 0, imsi1);
|
|
|
|
OSMO_ASSERT(ms_tmp != NULL);
|
|
|
|
OSMO_ASSERT(ms_tmp != ms);
|
|
|
|
ms_tmp = store.get_ms(0, 0, imsi2);
|
|
|
|
OSMO_ASSERT(ms == ms_tmp);
|
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
2020-12-16 14:59:45 +00:00
|
|
|
OSMO_ASSERT(strcmp(ms_imsi(ms), imsi2) == 0);
|
2015-05-21 09:07:53 +00:00
|
|
|
|
2015-05-12 15:54:33 +00:00
|
|
|
/* delete ms */
|
|
|
|
ms = store.get_ms(tlli + 0);
|
|
|
|
OSMO_ASSERT(ms != NULL);
|
2021-05-14 12:33:28 +00:00
|
|
|
ul_tbf = alloc_ul_tbf(bts, ms);
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_attach_tbf(ms, ul_tbf);
|
|
|
|
ms_detach_tbf(ms, ul_tbf);
|
2015-05-12 15:54:33 +00:00
|
|
|
ms = store.get_ms(tlli + 0);
|
|
|
|
OSMO_ASSERT(ms == NULL);
|
|
|
|
ms = store.get_ms(tlli + 1);
|
|
|
|
OSMO_ASSERT(ms != NULL);
|
|
|
|
|
|
|
|
/* delete ms */
|
|
|
|
ms = store.get_ms(tlli + 1);
|
|
|
|
OSMO_ASSERT(ms != NULL);
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_attach_tbf(ms, ul_tbf);
|
|
|
|
ms_detach_tbf(ms, ul_tbf);
|
2015-05-12 15:54:33 +00:00
|
|
|
ms = store.get_ms(tlli + 1);
|
|
|
|
OSMO_ASSERT(ms == NULL);
|
|
|
|
|
|
|
|
talloc_free(ul_tbf);
|
2021-01-14 15:48:38 +00:00
|
|
|
talloc_free(bts);
|
2015-05-12 15:54:33 +00:00
|
|
|
printf("=== end %s ===\n", __func__);
|
|
|
|
}
|
|
|
|
|
2015-05-28 13:43:53 +00:00
|
|
|
static void test_ms_timeout()
|
|
|
|
{
|
|
|
|
uint32_t tlli = 0xffeeddbb;
|
|
|
|
gprs_rlcmac_dl_tbf *dl_tbf;
|
|
|
|
gprs_rlcmac_ul_tbf *ul_tbf;
|
2021-01-18 16:14:14 +00:00
|
|
|
struct gprs_rlcmac_bts *bts = bts_alloc(the_pcu, 0);
|
2015-05-28 13:43:53 +00:00
|
|
|
GprsMs *ms;
|
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
2020-12-16 14:59:45 +00:00
|
|
|
last_cb = CB_UNKNOWN;
|
2015-05-28 13:43:53 +00:00
|
|
|
|
|
|
|
printf("=== start %s ===\n", __func__);
|
|
|
|
|
2021-01-14 15:48:38 +00:00
|
|
|
ms = ms_alloc(bts, tlli);
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_set_callback(ms, &ms_cb);
|
|
|
|
ms_set_timeout(ms, 1);
|
2015-05-28 13:43:53 +00:00
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
OSMO_ASSERT(ms_is_idle(ms));
|
2015-05-28 13:43:53 +00:00
|
|
|
|
2021-05-14 12:33:28 +00:00
|
|
|
dl_tbf = alloc_dl_tbf(bts, ms);
|
|
|
|
ul_tbf = alloc_ul_tbf(bts, ms);
|
2015-05-28 13:43:53 +00:00
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
OSMO_ASSERT(last_cb == CB_UNKNOWN);
|
2015-05-28 13:43:53 +00:00
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_attach_tbf(ms, ul_tbf);
|
|
|
|
OSMO_ASSERT(!ms_is_idle(ms));
|
|
|
|
OSMO_ASSERT(last_cb == CB_IS_ACTIVE);
|
2015-05-28 13:43:53 +00:00
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
last_cb = CB_UNKNOWN;
|
2015-05-28 13:43:53 +00:00
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_attach_tbf(ms, dl_tbf);
|
|
|
|
OSMO_ASSERT(!ms_is_idle(ms));
|
|
|
|
OSMO_ASSERT(last_cb == CB_UNKNOWN);
|
2015-05-28 13:43:53 +00:00
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_detach_tbf(ms, ul_tbf);
|
|
|
|
OSMO_ASSERT(!ms_is_idle(ms));
|
|
|
|
OSMO_ASSERT(last_cb == CB_UNKNOWN);
|
2015-05-28 13:43:53 +00:00
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_detach_tbf(ms, dl_tbf);
|
|
|
|
OSMO_ASSERT(!ms_is_idle(ms));
|
|
|
|
OSMO_ASSERT(last_cb == CB_UNKNOWN);
|
2015-05-28 13:43:53 +00:00
|
|
|
|
|
|
|
usleep(1100000);
|
|
|
|
osmo_timers_update();
|
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
OSMO_ASSERT(ms_is_idle(ms));
|
|
|
|
OSMO_ASSERT(last_cb == CB_IS_IDLE);
|
2015-05-28 13:43:53 +00:00
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
last_cb = CB_UNKNOWN;
|
|
|
|
talloc_free(ms);
|
2015-05-28 13:43:53 +00:00
|
|
|
talloc_free(dl_tbf);
|
|
|
|
talloc_free(ul_tbf);
|
2021-01-14 15:48:38 +00:00
|
|
|
talloc_free(bts);
|
2015-05-28 13:43:53 +00:00
|
|
|
printf("=== end %s ===\n", __func__);
|
|
|
|
}
|
|
|
|
|
2015-06-12 08:52:34 +00:00
|
|
|
static void test_ms_cs_selection()
|
|
|
|
{
|
2021-01-18 16:14:14 +00:00
|
|
|
struct gprs_rlcmac_bts *bts = bts_alloc(the_pcu, 0);
|
2015-06-12 08:52:34 +00:00
|
|
|
uint32_t tlli = 0xffeeddbb;
|
|
|
|
|
|
|
|
gprs_rlcmac_dl_tbf *dl_tbf;
|
|
|
|
GprsMs *ms;
|
|
|
|
|
|
|
|
printf("=== start %s ===\n", __func__);
|
|
|
|
|
|
|
|
bts->initial_cs_dl = 4;
|
|
|
|
bts->initial_cs_ul = 1;
|
2021-01-14 12:20:55 +00:00
|
|
|
the_pcu->vty.cs_downgrade_threshold = 0;
|
2021-01-14 12:17:01 +00:00
|
|
|
the_pcu->vty.cs_adj_lower_limit = 0;
|
2015-06-12 08:52:34 +00:00
|
|
|
|
2021-01-14 15:48:38 +00:00
|
|
|
ms = ms_alloc(bts, tlli);
|
2015-06-12 08:52:34 +00:00
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
OSMO_ASSERT(ms_is_idle(ms));
|
2015-06-12 08:52:34 +00:00
|
|
|
|
2021-05-14 12:33:28 +00:00
|
|
|
dl_tbf = alloc_dl_tbf(bts, ms);
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_attach_tbf(ms, dl_tbf);
|
2015-06-12 08:52:34 +00:00
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
OSMO_ASSERT(!ms_is_idle(ms));
|
2015-06-12 08:52:34 +00:00
|
|
|
|
2021-01-25 11:05:32 +00:00
|
|
|
OSMO_ASSERT(mcs_chan_code(ms_current_cs_dl(ms, ms_mode(ms))) == 3);
|
2015-06-12 08:52:34 +00:00
|
|
|
|
2021-01-14 12:20:55 +00:00
|
|
|
the_pcu->vty.cs_downgrade_threshold = 200;
|
2015-06-12 08:52:34 +00:00
|
|
|
|
2021-01-25 11:05:32 +00:00
|
|
|
OSMO_ASSERT(mcs_chan_code(ms_current_cs_dl(ms, ms_mode(ms))) == 2);
|
2015-06-12 08:52:34 +00:00
|
|
|
|
|
|
|
talloc_free(dl_tbf);
|
2021-01-14 15:48:38 +00:00
|
|
|
talloc_free(bts);
|
2015-06-12 08:52:34 +00:00
|
|
|
printf("=== end %s ===\n", __func__);
|
|
|
|
}
|
|
|
|
|
2019-03-06 14:59:09 +00:00
|
|
|
static void dump_ms(const GprsMs *ms, const char *pref)
|
|
|
|
{
|
|
|
|
printf("%s MS DL %s/%s, UL %s/%s, mode %s, <%s>\n", pref,
|
2021-01-25 11:05:32 +00:00
|
|
|
mcs_name(ms_current_cs_dl(ms, ms_mode(ms))), mcs_name(ms_max_cs_dl(ms)),
|
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
2020-12-16 14:59:45 +00:00
|
|
|
mcs_name(ms_current_cs_ul(ms)), mcs_name(ms_max_cs_ul(ms)),
|
|
|
|
mode_name(ms_mode(ms)),
|
|
|
|
ms_is_idle(ms) ? "IDLE" : "ACTIVE");
|
2019-03-06 14:59:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void test_ms_mcs_mode()
|
|
|
|
{
|
2021-01-18 16:14:14 +00:00
|
|
|
struct gprs_rlcmac_bts *bts = bts_alloc(the_pcu, 0);
|
2019-03-06 14:59:09 +00:00
|
|
|
uint32_t tlli = 0xdeadbeef;
|
|
|
|
|
|
|
|
gprs_rlcmac_dl_tbf *dl_tbf;
|
|
|
|
GprsMs *ms1, *ms2;
|
|
|
|
|
|
|
|
printf("=== start %s ===\n", __func__);
|
|
|
|
|
2021-01-14 15:48:38 +00:00
|
|
|
ms1 = ms_alloc(bts, tlli);
|
2019-03-06 14:59:09 +00:00
|
|
|
dump_ms(ms1, "1: no BTS defaults ");
|
|
|
|
|
|
|
|
bts->initial_cs_dl = 4;
|
|
|
|
bts->initial_cs_ul = 1;
|
2021-01-14 12:20:55 +00:00
|
|
|
the_pcu->vty.cs_downgrade_threshold = 0;
|
2019-03-06 14:59:09 +00:00
|
|
|
|
2021-01-14 15:48:38 +00:00
|
|
|
ms2 = ms_alloc(bts, tlli + 1);
|
2019-03-06 14:59:09 +00:00
|
|
|
dump_ms(ms2, "2: with BTS defaults");
|
|
|
|
|
2021-05-14 12:33:28 +00:00
|
|
|
dl_tbf = alloc_dl_tbf(bts, ms2);
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_attach_tbf(ms2, dl_tbf);
|
2019-03-06 14:59:09 +00:00
|
|
|
|
|
|
|
dump_ms(ms2, "2: after TBF attach ");
|
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_set_mode(ms1, EGPRS);
|
2019-03-06 14:59:09 +00:00
|
|
|
dump_ms(ms1, "1: after mode set ");
|
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_set_mode(ms2, EGPRS);
|
2019-03-06 14:59:09 +00:00
|
|
|
dump_ms(ms2, "2: after mode set ");
|
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_set_current_cs_dl(ms1, MCS7);
|
2019-03-06 14:59:09 +00:00
|
|
|
dump_ms(ms1, "1: after MCS set ");
|
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_set_current_cs_dl(ms2, MCS8);
|
2019-03-06 14:59:09 +00:00
|
|
|
dump_ms(ms2, "2: after MCS set ");
|
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_set_mode(ms1, EGPRS_GMSK);
|
2019-03-06 14:59:09 +00:00
|
|
|
dump_ms(ms1, "1: after mode set ");
|
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_set_mode(ms2, EGPRS_GMSK);
|
2019-03-06 14:59:09 +00:00
|
|
|
dump_ms(ms2, "2: after mode set ");
|
|
|
|
|
|
|
|
// FIXME: following code triggers ASAN failure:
|
|
|
|
// ms2->detach_tbf(dl_tbf);
|
|
|
|
// dump_ms(ms2, "2: after TBF detach ");
|
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_set_mode(ms1, GPRS);
|
2019-03-06 14:59:09 +00:00
|
|
|
dump_ms(ms1, "1: after mode set ");
|
|
|
|
|
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
2020-12-16 14:59:45 +00:00
|
|
|
ms_set_mode(ms2, GPRS);
|
2019-03-06 14:59:09 +00:00
|
|
|
dump_ms(ms2, "2: after mode set ");
|
|
|
|
|
|
|
|
talloc_free(dl_tbf);
|
2021-01-14 15:48:38 +00:00
|
|
|
talloc_free(bts);
|
2019-03-06 14:59:09 +00:00
|
|
|
printf("=== end %s ===\n", __func__);
|
|
|
|
}
|
|
|
|
|
2015-05-06 16:30:48 +00:00
|
|
|
int main(int argc, char **argv)
|
|
|
|
{
|
|
|
|
struct vty_app_info pcu_vty_info = {0};
|
|
|
|
|
|
|
|
tall_pcu_ctx = talloc_named_const(NULL, 1, "MsTest context");
|
|
|
|
if (!tall_pcu_ctx)
|
|
|
|
abort();
|
|
|
|
|
2017-02-08 16:07:31 +00:00
|
|
|
msgb_talloc_ctx_init(tall_pcu_ctx, 0);
|
2018-04-01 14:54:40 +00:00
|
|
|
osmo_init_logging2(tall_pcu_ctx, &gprs_log_info);
|
2015-05-06 16:30:48 +00:00
|
|
|
log_set_use_color(osmo_stderr_target, 0);
|
2021-02-19 13:01:52 +00:00
|
|
|
log_set_print_filename2(osmo_stderr_target, LOG_FILENAME_NONE);
|
2015-05-06 16:30:48 +00:00
|
|
|
log_set_log_level(osmo_stderr_target, LOGL_INFO);
|
2021-02-19 13:00:48 +00:00
|
|
|
log_set_print_category(osmo_stderr_target, 0);
|
|
|
|
log_set_print_category_hex(osmo_stderr_target, 0);
|
2017-10-29 09:39:32 +00:00
|
|
|
log_parse_category_mask(osmo_stderr_target, "DPCU,3:DRLCMAC,3");
|
2015-05-06 16:30:48 +00:00
|
|
|
|
Split PCU global PCU object from BTS object
Currently the BTS object (and gprs_rlcmac_bts struct) are used to hold
both PCU global fields and BTS specific fields, all mangled together.
The BTS is even accessed in lots of places by means of a singleton.
This patch introduces a new struct gprs_pcu object aimed at holding all
global state, and several fields are already moved from BTS to it. The
new object can be accessed as global variable "the_pcu", reusing and
including an already exisitng "the_pcu" global variable only used for
bssgp related purposes so far.
This is only a first step towards having a complete split global pcu and
BTS, some fields are still kept in BTS and will be moved over follow-up
smaller patches in the future (since this patch is already quite big).
So far, the code still only supports one BTS, which can be accessed
using the_pcu->bts. In the future that field will be replaced with a
list, and the BTS singletons will be removed.
The cur_fn output changes in TbfTest are actually a side effect fix,
since the singleton main_bts() now points internally to the_pcu->bts,
hence the same we allocate and assign in the test. Beforehand, "the_bts"
was allocated in the stack while main_bts() still returned an unrelated
singleton BTS object instance.
Related: OS#4935
Change-Id: I88e3c6471b80245ce3798223f1a61190f14aa840
2021-01-13 17:54:38 +00:00
|
|
|
the_pcu = gprs_pcu_alloc(tall_pcu_ctx);
|
|
|
|
|
2015-05-06 16:30:48 +00:00
|
|
|
vty_init(&pcu_vty_info);
|
2019-08-05 12:30:44 +00:00
|
|
|
pcu_vty_init();
|
2015-05-06 16:30:48 +00:00
|
|
|
|
|
|
|
test_ms_state();
|
|
|
|
test_ms_callback();
|
|
|
|
test_ms_replace_tbf();
|
2015-05-15 13:50:43 +00:00
|
|
|
test_ms_change_tlli();
|
2015-05-12 15:54:33 +00:00
|
|
|
test_ms_storage();
|
2015-05-28 13:43:53 +00:00
|
|
|
test_ms_timeout();
|
2015-06-12 08:52:34 +00:00
|
|
|
test_ms_cs_selection();
|
2019-03-06 14:59:09 +00:00
|
|
|
test_ms_mcs_mode();
|
2015-05-06 16:30:48 +00:00
|
|
|
|
Split PCU global PCU object from BTS object
Currently the BTS object (and gprs_rlcmac_bts struct) are used to hold
both PCU global fields and BTS specific fields, all mangled together.
The BTS is even accessed in lots of places by means of a singleton.
This patch introduces a new struct gprs_pcu object aimed at holding all
global state, and several fields are already moved from BTS to it. The
new object can be accessed as global variable "the_pcu", reusing and
including an already exisitng "the_pcu" global variable only used for
bssgp related purposes so far.
This is only a first step towards having a complete split global pcu and
BTS, some fields are still kept in BTS and will be moved over follow-up
smaller patches in the future (since this patch is already quite big).
So far, the code still only supports one BTS, which can be accessed
using the_pcu->bts. In the future that field will be replaced with a
list, and the BTS singletons will be removed.
The cur_fn output changes in TbfTest are actually a side effect fix,
since the singleton main_bts() now points internally to the_pcu->bts,
hence the same we allocate and assign in the test. Beforehand, "the_bts"
was allocated in the stack while main_bts() still returned an unrelated
singleton BTS object instance.
Related: OS#4935
Change-Id: I88e3c6471b80245ce3798223f1a61190f14aa840
2021-01-13 17:54:38 +00:00
|
|
|
talloc_free(the_pcu);
|
|
|
|
|
2015-05-06 16:30:48 +00:00
|
|
|
if (getenv("TALLOC_REPORT_FULL"))
|
|
|
|
talloc_report_full(tall_pcu_ctx, stderr);
|
|
|
|
|
|
|
|
return EXIT_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
void l1if_pdch_req() { abort(); }
|
|
|
|
void l1if_connect_pdch() { abort(); }
|
|
|
|
void l1if_close_pdch() { abort(); }
|
|
|
|
void l1if_open_pdch() { abort(); }
|
|
|
|
}
|