summaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-05-14 09:50:27 +0200
committerHarald Welte <laforge@gnumonks.org>2014-08-21 15:34:16 +0200
commitc08c55186fb03deb8d9439fe7c5b7bfc12a201bd (patch)
treeb653b64757e848d0bc1fd28573be461d54ef4884 /openbsc
parent141de62b06000fcbe582713a9f44a809ea2fbd62 (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')
-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 8aede15d..a87c469a 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 */