aboutsummaryrefslogtreecommitdiffstats
path: root/src/pcu_vty.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-10-17 19:41:11 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-10-30 21:20:45 +0100
commitb6acfdaa24851e1aa95bfc4611709737aaafa5f1 (patch)
tree77ccb6c9ba4d387381fd82e3768189a6e7a334a7 /src/pcu_vty.c
parent67ed34eedb59320095396ff2f65f360c046d88c5 (diff)
bts: Introduce a singleton for the BTS and use it in the code
Compared to the previous code there will be a branch to get the global pointer so the code will be slightly slower than the previous version but it allows us to start creating objects but still use the code from C. It is best approach I have found so far. One downside of C++ is that by default talloc will not be used (unless we override the new operator to use talloc. Right now we need to memset the C data structure by hand. The benefit of enforcing a better structure should is more important though.
Diffstat (limited to 'src/pcu_vty.c')
-rw-r--r--src/pcu_vty.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/pcu_vty.c b/src/pcu_vty.c
index cdf808f0..66a351fd 100644
--- a/src/pcu_vty.c
+++ b/src/pcu_vty.c
@@ -77,7 +77,7 @@ gDEFUN(ournode_end, ournode_end_cmd, "end",
static int config_write_pcu(struct vty *vty)
{
- struct gprs_rlcmac_bts *bts = gprs_rlcmac_bts;
+ struct gprs_rlcmac_bts *bts = bts_main_data();
vty_out(vty, "pcu%s", VTY_NEWLINE);
vty_out(vty, " flow-control-interval %d%s", bts->fc_interval,
@@ -122,7 +122,7 @@ DEFUN(cfg_pcu_fc_interval,
"Interval between sending subsequent Flow Control PDUs\n"
"Interval time in seconds\n")
{
- struct gprs_rlcmac_bts *bts = gprs_rlcmac_bts;
+ struct gprs_rlcmac_bts *bts = bts_main_data();
bts->fc_interval = atoi(argv[0]);
@@ -135,7 +135,7 @@ DEFUN(cfg_pcu_cs,
"Set the Coding Scheme to be used, (overrides BTS config)\n"
"Initial CS used\nAlternative uplink CS")
{
- struct gprs_rlcmac_bts *bts = gprs_rlcmac_bts;
+ struct gprs_rlcmac_bts *bts = bts_main_data();
uint8_t cs = atoi(argv[0]);
bts->force_cs = 1;
@@ -153,7 +153,7 @@ DEFUN(cfg_pcu_no_cs,
"no cs",
NO_STR "Don't force given Coding Scheme, (use BTS config)\n")
{
- struct gprs_rlcmac_bts *bts = gprs_rlcmac_bts;
+ struct gprs_rlcmac_bts *bts = bts_main_data();
bts->force_cs = 0;
@@ -169,7 +169,7 @@ DEFUN(cfg_pcu_queue_lifetime,
"queue lifetime <1-65534>",
QUEUE_STR LIFETIME_STR "Lifetime in centi-seconds")
{
- struct gprs_rlcmac_bts *bts = gprs_rlcmac_bts;
+ struct gprs_rlcmac_bts *bts = bts_main_data();
uint8_t csec = atoi(argv[0]);
bts->force_llc_lifetime = csec;
@@ -182,7 +182,7 @@ DEFUN(cfg_pcu_queue_lifetime_inf,
"queue lifetime infinite",
QUEUE_STR LIFETIME_STR "Infinite lifetime")
{
- struct gprs_rlcmac_bts *bts = gprs_rlcmac_bts;
+ struct gprs_rlcmac_bts *bts = bts_main_data();
bts->force_llc_lifetime = 0xffff;
@@ -195,7 +195,7 @@ DEFUN(cfg_pcu_no_queue_lifetime,
NO_STR QUEUE_STR "Disable lifetime limit of LLC frame (use value given "
"by SGSN)\n")
{
- struct gprs_rlcmac_bts *bts = gprs_rlcmac_bts;
+ struct gprs_rlcmac_bts *bts = bts_main_data();
bts->force_llc_lifetime = 0;
@@ -209,7 +209,7 @@ DEFUN(cfg_pcu_alloc,
"PACCH\nSingle slot is assigned only\nMultiple slots are assigned for "
"semi-duplex operation")
{
- struct gprs_rlcmac_bts *bts = gprs_rlcmac_bts;
+ struct gprs_rlcmac_bts *bts = bts_main_data();
switch (argv[0][0]) {
case 'a':
@@ -228,7 +228,7 @@ DEFUN(cfg_pcu_two_phase,
"two-phase-access",
"Force two phase access when MS requests single phase access\n")
{
- struct gprs_rlcmac_bts *bts = gprs_rlcmac_bts;
+ struct gprs_rlcmac_bts *bts = bts_main_data();
bts->force_two_phase = 1;
@@ -240,7 +240,7 @@ DEFUN(cfg_pcu_no_two_phase,
"no two-phase-access",
NO_STR "Only use two phase access when requested my MS\n")
{
- struct gprs_rlcmac_bts *bts = gprs_rlcmac_bts;
+ struct gprs_rlcmac_bts *bts = bts_main_data();
bts->force_two_phase = 0;
@@ -254,7 +254,7 @@ DEFUN(cfg_pcu_alpha,
"NOTE: Be sure to set Alpha value at System information 13 too.\n"
"Alpha in units of 0.1\n")
{
- struct gprs_rlcmac_bts *bts = gprs_rlcmac_bts;
+ struct gprs_rlcmac_bts *bts = bts_main_data();
bts->alpha = atoi(argv[0]);
@@ -267,7 +267,7 @@ DEFUN(cfg_pcu_gamma,
"Gamma parameter for MS power control in units of dB (see TS 05.08)\n"
"Gamma in even unit of dBs\n")
{
- struct gprs_rlcmac_bts *bts = gprs_rlcmac_bts;
+ struct gprs_rlcmac_bts *bts = bts_main_data();
bts->gamma = atoi(argv[0]) / 2;