diff options
author | Daniel Willmann <daniel@totalueberwachung.de> | 2011-07-22 18:08:31 +0200 |
---|---|---|
committer | Daniel Willmann <daniel@totalueberwachung.de> | 2011-07-28 19:40:26 +0200 |
commit | 72feed7c708a4f06acdd4a1e85525fc38d7a4ca9 (patch) | |
tree | cd986f14a6b2c43b98c6f93be8dc2124e180dd39 /openbsc | |
parent | e7a75b6be26951cd00a401655d806aa36d48059d (diff) |
libctrl: Add trap helper function
Diffstat (limited to 'openbsc')
-rw-r--r-- | openbsc/include/openbsc/control_cmd.h | 1 | ||||
-rw-r--r-- | openbsc/src/libctrl/control_if.c | 14 |
2 files changed, 15 insertions, 0 deletions
diff --git a/openbsc/include/openbsc/control_cmd.h b/openbsc/include/openbsc/control_cmd.h index 97b27d7f1..b75514b34 100644 --- a/openbsc/include/openbsc/control_cmd.h +++ b/openbsc/include/openbsc/control_cmd.h @@ -87,6 +87,7 @@ int ctrl_cmd_send_to_all(struct ctrl_handle *ctrl, 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_trap(struct ctrl_cmd *cmd); #define CTRL_CMD_DEFINE_RANGE(cmdname, cmdstr, dtype, element, min, max) \ int get_##cmdname(struct ctrl_cmd *cmd, void *data) \ diff --git a/openbsc/src/libctrl/control_if.c b/openbsc/src/libctrl/control_if.c index d09b41889..21136f538 100644 --- a/openbsc/src/libctrl/control_if.c +++ b/openbsc/src/libctrl/control_if.c @@ -99,6 +99,20 @@ int ctrl_cmd_send(struct osmo_wqueue *queue, struct ctrl_cmd *cmd) return ret; } +struct ctrl_cmd *ctrl_cmd_trap(struct ctrl_cmd *cmd) +{ + struct ctrl_cmd *trap; + + trap = ctrl_cmd_cpy(tall_bsc_ctx, cmd); + if (!trap) { + return NULL; + } + trap->ccon = cmd->ccon; + trap->type = CTRL_TYPE_TRAP; + + return trap; +} + int ctrl_cmd_handle(struct ctrl_cmd *cmd, void *data) { char *token, *request; |