summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2017-01-11 17:47:04 +0100
committerMax <msuraev@sysmocom.de>2017-01-16 08:54:17 +0000
commit8928747a3ea1c1d02239b422c0ad25b8e22bcaf2 (patch)
treef67a4a1993d42b2794dfa5d2ac9d946ec7c7e7b2
parentace80bb5695e4e7cc61cddcb9190645500a331a7 (diff)
CTRL: add write-only helpers
Similar to CTRL_CMD_DEFINE_RO() add helper for control commands which are not meant to be read, only to set. Similarly, add CTRL_CMD_DEFINE_WO_NOVRF() for commands which do not perform inbound data verification. Change-Id: I66b7990db590c1f8e56326e392e6c1d2eafebd9a
-rw-r--r--include/osmocom/ctrl/control_cmd.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/osmocom/ctrl/control_cmd.h b/include/osmocom/ctrl/control_cmd.h
index 8f2eaa25..a63557d7 100644
--- a/include/osmocom/ctrl/control_cmd.h
+++ b/include/osmocom/ctrl/control_cmd.h
@@ -187,4 +187,28 @@ static int verify_##cmdname(struct ctrl_cmd *cmd, const char *value, void *data)
} \
CTRL_CMD_DEFINE_STRUCT(cmdname, cmdstr, verify_##cmdname)
+#define CTRL_CMD_DEFINE_WO(cmdname, cmdstr) \
+static int set_##cmdname(struct ctrl_cmd *cmd, void *data); \
+static int get_##cmdname(struct ctrl_cmd *cmd, void *data) \
+{ \
+ cmd->reply = "Write Only attribute"; \
+ return CTRL_CMD_ERROR; \
+} \
+static int verify_##cmdname(struct ctrl_cmd *cmd, const char *val, void *data); \
+CTRL_CMD_DEFINE_STRUCT(cmdname, cmdstr, verify_##cmdname)
+
+
+#define CTRL_CMD_DEFINE_WO_NOVRF(cmdname, cmdstr) \
+static int set_##cmdname(struct ctrl_cmd *cmd, void *data); \
+static int get_##cmdname(struct ctrl_cmd *cmd, void *data) \
+{ \
+ cmd->reply = "Write Only attribute"; \
+ return CTRL_CMD_ERROR; \
+} \
+static int verify_##cmdname(struct ctrl_cmd *cmd, const char *val, void *data) \
+{ \
+ return 0; \
+} \
+CTRL_CMD_DEFINE_STRUCT(cmdname, cmdstr, verify_##cmdname)
+
struct gsm_network;