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
This commit is contained in:
Max 2017-01-11 17:47:04 +01:00
parent ace80bb569
commit 8928747a3e
1 changed files with 24 additions and 0 deletions

View File

@ -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;