This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Max gerrit-no-reply at lists.osmocom.orgMax has submitted this change and it was merged.
Change subject: CTRL: add write-only helpers
......................................................................
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
---
M include/osmocom/ctrl/control_cmd.h
1 file changed, 24 insertions(+), 0 deletions(-)
Approvals:
Harald Welte: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/include/osmocom/ctrl/control_cmd.h b/include/osmocom/ctrl/control_cmd.h
index 8f2eaa2..a63557d 100644
--- a/include/osmocom/ctrl/control_cmd.h
+++ b/include/osmocom/ctrl/control_cmd.h
@@ -187,4 +187,28 @@
} \
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;
--
To view, visit https://gerrit.osmocom.org/1574
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I66b7990db590c1f8e56326e392e6c1d2eafebd9a
Gerrit-PatchSet: 4
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>