diff options
author | Daniel Willmann <daniel@totalueberwachung.de> | 2011-05-06 16:38:11 +0200 |
---|---|---|
committer | Daniel Willmann <daniel@totalueberwachung.de> | 2011-07-28 19:40:26 +0200 |
commit | e7a75b6be26951cd00a401655d806aa36d48059d (patch) | |
tree | bead24900852152a2a1b2170b735bb5c078e2af9 | |
parent | 81671d54b0141b2db57df386ebf8dd7131131a24 (diff) |
libctrl: Add function ctrl_cmd_send_to_all
Sends a command to all ctrl connections except the one it originated
from.
-rw-r--r-- | openbsc/include/openbsc/control_cmd.h | 1 | ||||
-rw-r--r-- | openbsc/src/libctrl/control_if.c | 15 |
2 files changed, 16 insertions, 0 deletions
diff --git a/openbsc/include/openbsc/control_cmd.h b/openbsc/include/openbsc/control_cmd.h index a41a710ea..97b27d7f1 100644 --- a/openbsc/include/openbsc/control_cmd.h +++ b/openbsc/include/openbsc/control_cmd.h @@ -83,6 +83,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 fc28bb69d..d09b41889 100644 --- a/openbsc/src/libctrl/control_if.c +++ b/openbsc/src/libctrl/control_if.c @@ -62,6 +62,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; |