aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--openbsc/include/openbsc/control_cmd.h3
-rw-r--r--openbsc/src/libctrl/control_if.c15
2 files changed, 18 insertions, 0 deletions
diff --git a/openbsc/include/openbsc/control_cmd.h b/openbsc/include/openbsc/control_cmd.h
index f4785690..da598c51 100644
--- a/openbsc/include/openbsc/control_cmd.h
+++ b/openbsc/include/openbsc/control_cmd.h
@@ -10,6 +10,8 @@
#define CTRL_CMD_HANDLED 0
#define CTRL_CMD_REPLY 1
+struct ctrl_handle;
+
enum ctrl_node_type {
CTRL_NODE_ROOT, /* Root elements */
CTRL_NODE_NET, /* Network specific (net.) */
@@ -75,6 +77,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_handle(struct ctrl_cmd *cmd, void *data);
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_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);
diff --git a/openbsc/src/libctrl/control_if.c b/openbsc/src/libctrl/control_if.c
index f68cb809..350e8e1c 100644
--- a/openbsc/src/libctrl/control_if.c
+++ b/openbsc/src/libctrl/control_if.c
@@ -65,6 +65,21 @@
vector ctrl_node_vec;
+/* Send command to all */
+int ctrl_cmd_send_to_all(struct ctrl_handle *ctrl, struct ctrl_cmd *cmd)
+{
+ struct ctrl_connection *ccon;
+ int ret = 0;
+
+ llist_for_each_entry(ccon, &ctrl->ccon_list, list_entry) {
+ if (ccon == cmd->ccon)
+ continue;
+ if (ctrl_cmd_send(&ccon->write_queue, cmd))
+ ret++;
+ }
+ return ret;
+}
+
int ctrl_cmd_send(struct osmo_wqueue *queue, struct ctrl_cmd *cmd)
{
int ret;