vty: introduce and use GPRS_CHECK_ENABLED() macro
Change-Id: I39907a569e80344fc73596bea32a1b474ec720e0
This commit is contained in:
parent
5e465d52cf
commit
f1d4f366d6
|
@ -2916,6 +2916,15 @@ DEFUN(cfg_bts_radio_link_timeout_inf, cfg_bts_radio_link_timeout_inf_cmd,
|
|||
|
||||
#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 @@ DEFUN(cfg_bts_prs_bvci, cfg_bts_gprs_bvci_cmd,
|
|||
/* 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 @@ DEFUN(cfg_bts_gprs_nsei, cfg_bts_gprs_nsei_cmd,
|
|||
{
|
||||
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 @@ DEFUN(cfg_bts_gprs_nsvci, cfg_bts_gprs_nsvci_cmd,
|
|||
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 @@ DEFUN(cfg_bts_gprs_nsvc_lport, cfg_bts_gprs_nsvc_lport_cmd,
|
|||
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 @@ DEFUN(cfg_bts_gprs_nsvc_rport, cfg_bts_gprs_nsvc_rport_cmd,
|
|||
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 @@ DEFUN(cfg_bts_gprs_nsvc_rip, cfg_bts_gprs_nsvc_rip_cmd,
|
|||
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 @@ DEFUN(cfg_bts_gprs_ns_timer, cfg_bts_gprs_ns_timer_cmd,
|
|||
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 @@ DEFUN(cfg_bts_gprs_cell_timer, cfg_bts_gprs_cell_timer_cmd,
|
|||
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 @@ DEFUN(cfg_bts_gprs_rac, cfg_bts_gprs_rac_cmd,
|
|||
{
|
||||
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 @@ DEFUN(cfg_bts_gprs_ctrl_ack, cfg_bts_gprs_ctrl_ack_cmd,
|
|||
{
|
||||
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 @@ DEFUN(cfg_no_bts_gprs_ctrl_ack, cfg_no_bts_gprs_ctrl_ack_cmd,
|
|||
{
|
||||
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 @@ DEFUN(cfg_bts_gprs_net_ctrl_ord, cfg_bts_gprs_net_ctrl_ord_cmd,
|
|||
{
|
||||
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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue