| 767 | } |
| 768 | |
| 769 | enum clusterer_send_ret send_mi_cmd(int cluster_id, int dst_id, str cmd_name, |
| 770 | mi_item_t *cmd_params_arr, int no_params) |
| 771 | { |
| 772 | bin_packet_t packet; |
| 773 | int i, rc; |
| 774 | str val; |
| 775 | |
| 776 | if (bin_init(&packet, &cl_extra_cap, CLUSTERER_MI_CMD, BIN_VERSION, 0) < 0) { |
| 777 | LM_ERR("Failed to init bin send buffer\n"); |
| 778 | return CLUSTERER_SEND_ERR; |
| 779 | } |
| 780 | |
| 781 | if (bin_push_str(&packet, &cmd_name) < 0) |
| 782 | return CLUSTERER_SEND_ERR; |
| 783 | if (bin_push_int(&packet, no_params) < 0) |
| 784 | return CLUSTERER_SEND_ERR; |
| 785 | for (i = 0; i < no_params; i++) { |
| 786 | if (get_mi_arr_param_string(cmd_params_arr, i, &val.s, &val.len) < 0) |
| 787 | return CLUSTERER_SEND_ERR; |
| 788 | |
| 789 | if (bin_push_str(&packet, &val) < 0) |
| 790 | return CLUSTERER_SEND_ERR; |
| 791 | } |
| 792 | |
| 793 | if (msg_add_trailer(&packet, cluster_id, dst_id ? dst_id : -1) < 0) { |
| 794 | LM_ERR("Failed to add trailer to module's message\n"); |
| 795 | return CLUSTERER_SEND_ERR; |
| 796 | } |
| 797 | |
| 798 | if (dst_id) |
| 799 | rc = clusterer_send_msg(&packet, cluster_id, dst_id, 0, 0); |
| 800 | else |
| 801 | rc = clusterer_bcast_msg(&packet, cluster_id, NODE_CMP_ANY, 0); |
| 802 | |
| 803 | bin_free_packet(&packet); |
| 804 | |
| 805 | return rc; |
| 806 | } |
| 807 | |
| 808 | enum clusterer_send_ret bcast_remove_node(int cluster_id, int target_node) |
| 809 | { |
no test coverage detected