aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libbsc
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2017-01-11 18:37:55 +0100
committerMax <msuraev@sysmocom.de>2017-01-25 11:52:45 +0000
commitf6e51709fc3a79274646135fec1a603d4316acf6 (patch)
tree9003843cb78270a629b56dccc7820beeee302ba0 /openbsc/src/libbsc
parent76f048a1fdf8247ba28a373d989215a5493895ea (diff)
CTRL: remove boilerplate
Use CTRL_CMD_DEFINE_RO(), CTRL_CMD_DEFINE_WO() and CTRL_CMD_DEFINE_WO_NOVRF() where appropriate to get rid of boilerplate code. Change-Id: I5bcea0b4f4b8f535bef2b423f2013b8b4a218b5b
Diffstat (limited to 'openbsc/src/libbsc')
-rw-r--r--openbsc/src/libbsc/bsc_ctrl_commands.c77
1 files changed, 6 insertions, 71 deletions
diff --git a/openbsc/src/libbsc/bsc_ctrl_commands.c b/openbsc/src/libbsc/bsc_ctrl_commands.c
index 7e84797..14e8d71 100644
--- a/openbsc/src/libbsc/bsc_ctrl_commands.c
+++ b/openbsc/src/libbsc/bsc_ctrl_commands.c
@@ -70,17 +70,6 @@ CTRL_CMD_DEFINE_RANGE(net_mcc, "mcc", struct gsm_network, country_code, 1, 999);
CTRL_CMD_VTY_STRING(net_short_name, "short-name", struct gsm_network, name_short);
CTRL_CMD_VTY_STRING(net_long_name, "long-name", struct gsm_network, name_long);
-static int verify_net_apply_config(struct ctrl_cmd *cmd, const char *v, void *d)
-{
- return 0;
-}
-
-static int get_net_apply_config(struct ctrl_cmd *cmd, void *data)
-{
- cmd->reply = "Write only attribute";
- return CTRL_CMD_ERROR;
-}
-
static int set_net_apply_config(struct ctrl_cmd *cmd, void *data)
{
struct gsm_network *net = cmd->node;
@@ -107,7 +96,7 @@ static int set_net_apply_config(struct ctrl_cmd *cmd, void *data)
return CTRL_CMD_REPLY;
}
-CTRL_CMD_DEFINE(net_apply_config, "apply-configuration");
+CTRL_CMD_DEFINE_WO_NOVRF(net_apply_config, "apply-configuration");
static int verify_net_mcc_mnc_apply(struct ctrl_cmd *cmd, const char *value, void *d)
{
@@ -126,12 +115,6 @@ static int verify_net_mcc_mnc_apply(struct ctrl_cmd *cmd, const char *value, voi
return 0;
}
-static int get_net_mcc_mnc_apply(struct ctrl_cmd *cmd, void *data)
-{
- cmd->reply = "Write only attribute";
- return CTRL_CMD_ERROR;
-}
-
static int set_net_mcc_mnc_apply(struct ctrl_cmd *cmd, void *data)
{
struct gsm_network *net = cmd->node;
@@ -165,23 +148,12 @@ oom:
cmd->reply = "OOM";
return CTRL_CMD_ERROR;
}
-CTRL_CMD_DEFINE(net_mcc_mnc_apply, "mcc-mnc-apply");
+CTRL_CMD_DEFINE_WO(net_mcc_mnc_apply, "mcc-mnc-apply");
/* BTS related commands below */
CTRL_CMD_DEFINE_RANGE(bts_lac, "location-area-code", struct gsm_bts, location_area_code, 0, 65535);
CTRL_CMD_DEFINE_RANGE(bts_ci, "cell-identity", struct gsm_bts, cell_identity, 0, 65535);
-static int verify_bts_apply_config(struct ctrl_cmd *cmd, const char *v, void *d)
-{
- return 0;
-}
-
-static int get_bts_apply_config(struct ctrl_cmd *cmd, void *data)
-{
- cmd->reply = "Write only attribute";
- return CTRL_CMD_ERROR;
-}
-
static int set_bts_apply_config(struct ctrl_cmd *cmd, void *data)
{
struct gsm_bts *bts = cmd->node;
@@ -196,18 +168,7 @@ static int set_bts_apply_config(struct ctrl_cmd *cmd, void *data)
return CTRL_CMD_REPLY;
}
-CTRL_CMD_DEFINE(bts_apply_config, "apply-configuration");
-
-static int verify_bts_si(struct ctrl_cmd *cmd, const char *v, void *d)
-{
- return 0;
-}
-
-static int get_bts_si(struct ctrl_cmd *cmd, void *data)
-{
- cmd->reply = "Write only attribute";
- return CTRL_CMD_ERROR;
-}
+CTRL_CMD_DEFINE_WO_NOVRF(bts_apply_config, "apply-configuration");
static int set_bts_si(struct ctrl_cmd *cmd, void *data)
{
@@ -223,12 +184,7 @@ static int set_bts_si(struct ctrl_cmd *cmd, void *data)
cmd->reply = "Generated new System Information";
return CTRL_CMD_REPLY;
}
-CTRL_CMD_DEFINE(bts_si, "send-new-system-informations");
-
-static int verify_bts_chan_load(struct ctrl_cmd *cmd, const char *v, void *d)
-{
- return 0;
-}
+CTRL_CMD_DEFINE_WO_NOVRF(bts_si, "send-new-system-informations");
static int get_bts_chan_load(struct ctrl_cmd *cmd, void *data)
{
@@ -271,23 +227,7 @@ error:
return CTRL_CMD_ERROR;
}
-static int set_bts_chan_load(struct ctrl_cmd *cmd, void *data)
-{
- cmd->reply = "Read only attribute";
- return CTRL_CMD_ERROR;
-}
-CTRL_CMD_DEFINE(bts_chan_load, "channel-load");
-
-static int verify_bts_oml_conn(struct ctrl_cmd *cmd, const char *value, void *_data)
-{
- struct gsm_bts *bts = cmd->node;
-
- if (!is_ipaccess_bts(bts)) {
- cmd->reply = "";
- return -1;
- }
- return 0;
-}
+CTRL_CMD_DEFINE_RO(bts_chan_load, "channel-load");
static int get_bts_oml_conn(struct ctrl_cmd *cmd, void *data)
{
@@ -297,12 +237,7 @@ static int get_bts_oml_conn(struct ctrl_cmd *cmd, void *data)
return CTRL_CMD_REPLY;
}
-static int set_bts_oml_conn(struct ctrl_cmd *cmd, void *data)
-{
- cmd->reply = "Read only attribute";
- return CTRL_CMD_ERROR;
-}
-CTRL_CMD_DEFINE(bts_oml_conn, "oml-connection-state");
+CTRL_CMD_DEFINE_RO(bts_oml_conn, "oml-connection-state");
static int verify_bts_gprs_mode(struct ctrl_cmd *cmd, const char *value, void *_data)
{