From a6b34015af942e4eabb0d4f8b0a9a53daa34c3e1 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Mon, 22 Aug 2011 23:44:32 +0200 Subject: libctrl: Add a function to create the cmd --- openbsc/include/openbsc/control_cmd.h | 1 + openbsc/src/libctrl/control_cmd.c | 12 ++++++++++++ 2 files changed, 13 insertions(+) (limited to 'openbsc') diff --git a/openbsc/include/openbsc/control_cmd.h b/openbsc/include/openbsc/control_cmd.h index 24292ead..2a5391f5 100644 --- a/openbsc/include/openbsc/control_cmd.h +++ b/openbsc/include/openbsc/control_cmd.h @@ -78,6 +78,7 @@ int ctrl_cmd_send(struct osmo_wqueue *queue, struct ctrl_cmd *cmd); 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_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 7a75e0e2..3c4efc06 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; -- cgit v1.2.3