aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-07-24 09:45:18 +0200
committerDaniel Willmann <daniel@totalueberwachung.de>2011-08-22 19:27:49 +0200
commitb63c4be047eb2fc1de252c5a5bb6c9c6b163ad52 (patch)
tree56b770e1e336ccafbb7334c2c5b7d98aeff731e8
parent5fff97fa1cf2983dd8a7d67bffaf948e9216826b (diff)
ctrl: Add a function to create the cmd
-rw-r--r--openbsc/include/openbsc/control_cmd.h1
-rw-r--r--openbsc/src/libctrl/control_cmd.c12
2 files changed, 13 insertions, 0 deletions
diff --git a/openbsc/include/openbsc/control_cmd.h b/openbsc/include/openbsc/control_cmd.h
index e9683be08..3ee2174e1 100644
--- a/openbsc/include/openbsc/control_cmd.h
+++ b/openbsc/include/openbsc/control_cmd.h
@@ -88,6 +88,7 @@ struct ctrl_cmd *ctrl_cmd_parse(void *ctx, struct msgb *msg);
struct msgb *ctrl_cmd_make(struct ctrl_cmd *cmd);
struct ctrl_cmd *ctrl_cmd_cpy(void *ctx, struct ctrl_cmd *cmd);
struct ctrl_cmd *ctrl_cmd_trap(struct ctrl_cmd *cmd);
+struct ctrl_cmd *ctrl_cmd_create(void *ctx, enum ctrl_type);
#define CTRL_CMD_DEFINE_RANGE(cmdname, cmdstr, dtype, element, min, max) \
static int get_##cmdname(struct ctrl_cmd *cmd, void *data) \
diff --git a/openbsc/src/libctrl/control_cmd.c b/openbsc/src/libctrl/control_cmd.c
index 7a75e0e22..3c4efc06d 100644
--- a/openbsc/src/libctrl/control_cmd.c
+++ b/openbsc/src/libctrl/control_cmd.c
@@ -239,6 +239,18 @@ int ctrl_cmd_install(enum ctrl_node_type node, struct ctrl_cmd_element *cmd)
return 0;
}
+struct ctrl_cmd *ctrl_cmd_create(void *ctx, enum ctrl_type type)
+{
+ struct ctrl_cmd *cmd;
+
+ cmd = talloc_zero(ctx, struct ctrl_cmd);
+ if (!cmd)
+ return NULL;
+
+ cmd->type = type;
+ return cmd;
+}
+
struct ctrl_cmd *ctrl_cmd_cpy(void *ctx, struct ctrl_cmd *cmd)
{
struct ctrl_cmd *cmd2;