MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / send_mi_cmd

Function send_mi_cmd

modules/clusterer/clusterer.c:769–806  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

767}
768
769enum 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
808enum clusterer_send_ret bcast_remove_node(int cluster_id, int target_node)
809{

Callers 2

cluster_send_miFunction · 0.85
cluster_bcast_miFunction · 0.85

Calls 7

bin_push_strFunction · 0.85
bin_push_intFunction · 0.85
get_mi_arr_param_stringFunction · 0.85
msg_add_trailerFunction · 0.85
clusterer_send_msgFunction · 0.85
clusterer_bcast_msgFunction · 0.85
bin_free_packetFunction · 0.85

Tested by

no test coverage detected