From 1159005ae02f8c9e42624769ec1b2a8d84c9dee5 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Wed, 14 May 2014 09:50:27 +0200 Subject: ctrl: Introduce a macro for read-only attributes and use it Certain attributes are read-only. Add a macro to make it more easy to define those. --- openbsc/include/openbsc/control_cmd.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'openbsc/include/openbsc') diff --git a/openbsc/include/openbsc/control_cmd.h b/openbsc/include/openbsc/control_cmd.h index 8aede15df..a87c469a8 100644 --- a/openbsc/include/openbsc/control_cmd.h +++ b/openbsc/include/openbsc/control_cmd.h @@ -172,6 +172,20 @@ static struct ctrl_cmd_element cmd_##cmdname = { \ .verify = &verify_##cmdname, \ } +#define CTRL_CMD_DEFINE_RO(cmdname, cmdstr) \ +static int get_##cmdname(struct ctrl_cmd *cmd, void *data); \ +static int set_##cmdname(struct ctrl_cmd *cmd, void *data) \ +{ \ + cmd->reply = "Read Only attribute"; \ + return CTRL_CMD_ERROR; \ +} \ +static int verify_##cmdname(struct ctrl_cmd *cmd, const char *value, void *data) \ +{ \ + cmd->reply = "Read Only attribute"; \ + return 1; \ +} \ +CTRL_CMD_DEFINE(cmdname, cmdstr) + struct gsm_network; #endif /* _CONTROL_CMD_H */ -- cgit v1.2.3