summaryrefslogtreecommitdiffstats
path: root/openbsc/include/openbsc
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-05-14 09:50:27 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-05-15 15:30:52 +0200
commit1159005ae02f8c9e42624769ec1b2a8d84c9dee5 (patch)
tree6a229dad6dc61d84de77cd98a4a8d8ed65578eb9 /openbsc/include/openbsc
parent268b2e65446fef5c3ddb3bb4423ddf376929e731 (diff)
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.
Diffstat (limited to 'openbsc/include/openbsc')
-rw-r--r--openbsc/include/openbsc/control_cmd.h14
1 files changed, 14 insertions, 0 deletions
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 */