summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2017-12-16 01:05:25 +0100
committerHarald Welte <laforge@gnumonks.org>2017-12-18 23:05:50 +0000
commitf2e83ad40d231e87e2604ec4c97c810a8182e145 (patch)
tree89870f38e0f9977172ce13942507228046f22866 /include
parent1b8b152e791df579035f7b7c8dd621938f7de3c0 (diff)
add ctrl_cmd_parse2() to return parsing errors
If a control command fails to parse, we so far discard specific error messages and instead send just "Command parser error". In ctrl_cmd_parse() we actually compose detailed error replies, but in the end simply talloc_free() them and return NULL. A first step to report these errors to the ctrl command issuer is to not return NULL and instead return the cmd with type = CTRL_TYPE_ERROR. Add ctrl_cmd_parse2() to return such instead of NULL. To stay API compatible, provide ctrl_cmd_parse2() to return a cmd on errors. ctrl_cmd_parse() retains identical behavior but becomes just a simple wrapper around ctrl_cmd_parse2() which discards the cmd on error. No need really to deprecate ctrl_cmd_parse() yet; especially as long as compiler warnings might break jenkins builds. Change-Id: I5047c9f977d70b03eea77cbcfd2b96d43ea46880
Diffstat (limited to 'include')
-rw-r--r--include/osmocom/ctrl/control_cmd.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/osmocom/ctrl/control_cmd.h b/include/osmocom/ctrl/control_cmd.h
index 4372e257..865b006b 100644
--- a/include/osmocom/ctrl/control_cmd.h
+++ b/include/osmocom/ctrl/control_cmd.h
@@ -103,6 +103,7 @@ int ctrl_cmd_exec(vector vline, struct ctrl_cmd *command, vector node, void *dat
int ctrl_cmd_install(enum ctrl_node_type node, struct ctrl_cmd_element *cmd);
int ctrl_cmd_send(struct osmo_wqueue *queue, struct ctrl_cmd *cmd);
int ctrl_cmd_send_to_all(struct ctrl_handle *ctrl, struct ctrl_cmd *cmd);
+struct ctrl_cmd *ctrl_cmd_parse2(void *ctx, struct msgb *msg);
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);