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.
This commit is contained in:
Holger Hans Peter Freyther 2014-05-14 09:50:27 +02:00 committed by Harald Welte
parent 141de62b06
commit c08c55186f
1 changed files with 14 additions and 0 deletions

View File

@ -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 */