aboutsummaryrefslogtreecommitdiffstats
path: root/src/ctrl/control_if.c
diff options
context:
space:
mode:
authorPau Espin Pedrol <>2021-01-05 18:36:17 +0100
committerlaforge <laforge@osmocom.org>2021-01-06 12:32:36 +0000
commit9584cd718a033f31bf7d8ee1b58c57dfbd5fd28e (patch)
tree2ccf7eb14cd345e0702391073c902af567cd2686 /src/ctrl/control_if.c
parente4cd267ab18f2d9d66351cce5b5a1aa8cc893c51 (diff)
ctrl: Allow handling CTRL get/set replies in user defined code
Prior to this patch, it was not possible to gather SET/GET reply information when implementing a CTRL client using libosmocontrol. This is specially important when using the GET command, since one wants to receive the queried value. CTRL traps can also be handled this way by extending this patch in the future if needed. Change-Id: Id3c4631cd32c13e78e11b6e8194b8c16307ec4f1
Diffstat (limited to 'src/ctrl/control_if.c')
-rw-r--r--src/ctrl/control_if.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/ctrl/control_if.c b/src/ctrl/control_if.c
index ce2e3676..9e3e3a9e 100644
--- a/src/ctrl/control_if.c
+++ b/src/ctrl/control_if.c
@@ -221,6 +221,10 @@ int ctrl_cmd_handle(struct ctrl_handle *ctrl, struct ctrl_cmd *cmd,
if (cmd->type == CTRL_TYPE_SET_REPLY ||
cmd->type == CTRL_TYPE_GET_REPLY) {
+ if (ctrl->reply_cb) {
+ ctrl->reply_cb(ctrl, cmd, data);
+ return CTRL_CMD_HANDLED;
+ }
if (strncmp(cmd->reply, "OK", 2) == 0) {
LOGP(DLCTRL, LOGL_DEBUG, "%s <%s> for %s is OK\n",
get_value_string(ctrl_type_vals, cmd->type),