This is essentially the old ctrl_cmd_send function with a different
name. As long as the connection between nat and osmo-bsc is not using
the generic socket infrastructure from libosmo-abis it is still needed.
---
 openbsc/include/openbsc/control_cmd.h |    1 +
 openbsc/src/libctrl/control_if.c      |   22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/openbsc/include/openbsc/control_cmd.h 
b/openbsc/include/openbsc/control_cmd.h
index 87db33f..8eeed99 100644
--- a/openbsc/include/openbsc/control_cmd.h
+++ b/openbsc/include/openbsc/control_cmd.h
@@ -61,6 +61,7 @@ struct ctrl_cmd_map {
 int ctrl_cmd_exec(vector vline, struct ctrl_cmd *command, vector node, void 
*data);
 int ctrl_cmd_install(enum ctrl_node_type node, struct ctrl_cmd_element *cmd);
 int ctrl_cmd_handle(struct ctrl_cmd *cmd, void *data);
+int ctrl_cmd_send_wqueue(struct osmo_wqueue *queue, struct ctrl_cmd *cmd);
 int ctrl_cmd_send(struct ipa_server_conn *ipa_server_conn, struct ctrl_cmd 
*cmd);
 struct ctrl_cmd *ctrl_cmd_parse(void *ctx, struct msgb *msg);
 struct msgb *ctrl_cmd_make(struct ctrl_cmd *cmd);
diff --git a/openbsc/src/libctrl/control_if.c b/openbsc/src/libctrl/control_if.c
index 99e4ccf..5476179 100644
--- a/openbsc/src/libctrl/control_if.c
+++ b/openbsc/src/libctrl/control_if.c
@@ -86,6 +86,28 @@ int ctrl_cmd_send(struct ipa_server_conn *ipa_server_conn, 
struct ctrl_cmd *cmd)
        return 0;
 }
 
+int ctrl_cmd_send_wqueue(struct osmo_wqueue *queue, struct ctrl_cmd *cmd)
+{
+       int ret;
+       struct msgb *msg;
+
+       msg = ctrl_cmd_make(cmd);
+       if (!msg) {
+               LOGP(DCTRL, LOGL_ERROR, "Could not generate msg\n");
+               return -1;
+       }
+
+       ipaccess_prepend_header_ext(msg, IPAC_PROTO_EXT_CTRL);
+       ipaccess_prepend_header(msg, IPAC_PROTO_OSMO);
+
+       ret = osmo_wqueue_enqueue(queue, msg);
+       if (ret != 0) {
+               LOGP(DCTRL, LOGL_ERROR, "Failed to enqueue the command");
+               msgb_free(msg);
+       }
+       return ret;
+}
+
 int ctrl_cmd_handle(struct ctrl_cmd *cmd, void *data)
 {
        char *token, *request;
-- 
1.7.6.1


Reply via email to