This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/19552 )
Change subject: vty: introduce and use GPRS_CHECK_ENABLED() macro
......................................................................
vty: introduce and use GPRS_CHECK_ENABLED() macro
Change-Id: I39907a569e80344fc73596bea32a1b474ec720e0
---
M src/osmo-bsc/bsc_vty.c
1 file changed, 21 insertions(+), 48 deletions(-)
Approvals:
laforge: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c
index fc4ebd6..16935d3 100644
--- a/src/osmo-bsc/bsc_vty.c
+++ b/src/osmo-bsc/bsc_vty.c
@@ -2916,6 +2916,15 @@
#define GPRS_TEXT "GPRS Packet Network\n"
+#define GPRS_CHECK_ENABLED(bts) \
+ do { \
+ if (bts->gprs.mode == BTS_GPRS_NONE) { \
+ vty_out(vty, "%% GPRS is not enabled on BTS %u%s", \
+ bts->nr, VTY_NEWLINE); \
+ return CMD_WARNING; \
+ } \
+ } while (0)
+
DEFUN(cfg_bts_prs_bvci, cfg_bts_gprs_bvci_cmd,
"gprs cell bvci <2-65535>",
GPRS_TEXT
@@ -2926,10 +2935,7 @@
/* ETSI TS 101 343: values 0 and 1 are reserved for signalling and PTM */
struct gsm_bts *bts = vty->index;
- if (bts->gprs.mode == BTS_GPRS_NONE) {
- vty_out(vty, "%% GPRS not enabled on BTS %u%s", bts->nr, VTY_NEWLINE);
- return CMD_WARNING;
- }
+ GPRS_CHECK_ENABLED(bts);
bts->gprs.cell.bvci = atoi(argv[0]);
@@ -2944,10 +2950,7 @@
{
struct gsm_bts *bts = vty->index;
- if (bts->gprs.mode == BTS_GPRS_NONE) {
- vty_out(vty, "%% GPRS not enabled on BTS %u%s", bts->nr, VTY_NEWLINE);
- return CMD_WARNING;
- }
+ GPRS_CHECK_ENABLED(bts);
bts->gprs.nse.nsei = atoi(argv[0]);
@@ -2966,10 +2969,7 @@
struct gsm_bts *bts = vty->index;
int idx = atoi(argv[0]);
- if (bts->gprs.mode == BTS_GPRS_NONE) {
- vty_out(vty, "%% GPRS not enabled on BTS %u%s", bts->nr, VTY_NEWLINE);
- return CMD_WARNING;
- }
+ GPRS_CHECK_ENABLED(bts);
bts->gprs.nsvc[idx].nsvci = atoi(argv[1]);
@@ -2987,10 +2987,7 @@
struct gsm_bts *bts = vty->index;
int idx = atoi(argv[0]);
- if (bts->gprs.mode == BTS_GPRS_NONE) {
- vty_out(vty, "%% GPRS not enabled on BTS %u%s", bts->nr, VTY_NEWLINE);
- return CMD_WARNING;
- }
+ GPRS_CHECK_ENABLED(bts);
bts->gprs.nsvc[idx].local_port = atoi(argv[1]);
@@ -3008,10 +3005,7 @@
struct gsm_bts *bts = vty->index;
int idx = atoi(argv[0]);
- if (bts->gprs.mode == BTS_GPRS_NONE) {
- vty_out(vty, "%% GPRS not enabled on BTS %u%s", bts->nr, VTY_NEWLINE);
- return CMD_WARNING;
- }
+ GPRS_CHECK_ENABLED(bts);
bts->gprs.nsvc[idx].remote_port = atoi(argv[1]);
@@ -3029,10 +3023,7 @@
int idx = atoi(argv[0]);
struct in_addr ia;
- if (bts->gprs.mode == BTS_GPRS_NONE) {
- vty_out(vty, "%% GPRS not enabled on BTS %u%s", bts->nr, VTY_NEWLINE);
- return CMD_WARNING;
- }
+ GPRS_CHECK_ENABLED(bts);
inet_aton(argv[1], &ia);
bts->gprs.nsvc[idx].remote_ip = ntohl(ia.s_addr);
@@ -3062,10 +3053,7 @@
int idx = get_string_value(gprs_ns_timer_strs, argv[0]);
int val = atoi(argv[1]);
- if (bts->gprs.mode == BTS_GPRS_NONE) {
- vty_out(vty, "%% GPRS not enabled on BTS %u%s", bts->nr, VTY_NEWLINE);
- return CMD_WARNING;
- }
+ GPRS_CHECK_ENABLED(bts);
if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.nse.timer))
return CMD_WARNING;
@@ -3099,10 +3087,7 @@
int idx = get_string_value(gprs_bssgp_cfg_strs, argv[0]);
int val = atoi(argv[1]);
- if (bts->gprs.mode == BTS_GPRS_NONE) {
- vty_out(vty, "%% GPRS not enabled on BTS %u%s", bts->nr, VTY_NEWLINE);
- return CMD_WARNING;
- }
+ GPRS_CHECK_ENABLED(bts);
if (idx < 0 || idx >= ARRAY_SIZE(bts->gprs.cell.timer))
return CMD_WARNING;
@@ -3121,10 +3106,7 @@
{
struct gsm_bts *bts = vty->index;
- if (bts->gprs.mode == BTS_GPRS_NONE) {
- vty_out(vty, "%% GPRS not enabled on BTS %u%s", bts->nr, VTY_NEWLINE);
- return CMD_WARNING;
- }
+ GPRS_CHECK_ENABLED(bts);
bts->gprs.rac = atoi(argv[0]);
@@ -3138,10 +3120,7 @@
{
struct gsm_bts *bts = vty->index;
- if (bts->gprs.mode == BTS_GPRS_NONE) {
- vty_out(vty, "%% GPRS not enabled on BTS %u%s", bts->nr, VTY_NEWLINE);
- return CMD_WARNING;
- }
+ GPRS_CHECK_ENABLED(bts);
bts->gprs.ctrl_ack_type_use_block = false;
@@ -3155,10 +3134,7 @@
{
struct gsm_bts *bts = vty->index;
- if (bts->gprs.mode == BTS_GPRS_NONE) {
- vty_out(vty, "%% GPRS not enabled on BTS %u%s", bts->nr, VTY_NEWLINE);
- return CMD_WARNING;
- }
+ GPRS_CHECK_ENABLED(bts);
bts->gprs.ctrl_ack_type_use_block = true;
@@ -3175,10 +3151,7 @@
{
struct gsm_bts *bts = vty->index;
- if (bts->gprs.mode == BTS_GPRS_NONE) {
- vty_out(vty, "%% GPRS not enabled on BTS %u%s", bts->nr, VTY_NEWLINE);
- return CMD_WARNING;
- }
+ GPRS_CHECK_ENABLED(bts);
bts->gprs.net_ctrl_ord = atoi(argv[0] + 2);
--
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/19552
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I39907a569e80344fc73596bea32a1b474ec720e0
Gerrit-Change-Number: 19552
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200811/8f4c720f/attachment.htm>