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

Function prep_gen_msg

modules/clusterer/clusterer.c:644–667  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

642
643
644static int prep_gen_msg(bin_packet_t *packet, int cluster_id, int dst_id,
645 str *gen_msg, str *exchg_tag, int req_like)
646{
647 /* build packet */
648 if (bin_init(packet, &cl_extra_cap, CLUSTERER_GENERIC_MSG, BIN_VERSION, 0) < 0) {
649 LM_ERR("Failed to init bin send buffer\n");
650 return -1;
651 }
652
653 /* mark this message as request-like if it is the case */
654 if (bin_push_int(packet, req_like) < 0)
655 return -1;
656 /* include an 'exchange tag' in order to possbily correlate the messages
657 * sent with replies to be received (which should contain the same tag) */
658 if (bin_push_str(packet, exchg_tag) < 0)
659 return -1;
660 if (bin_push_str(packet, gen_msg) < 0)
661 return -1;
662 /* add the trailer as for an usual module message */
663 if (msg_add_trailer(packet, cluster_id, dst_id) < 0)
664 return -1;
665
666 return 0;
667}
668
669int has_bridge(int src_cluster_id)
670{

Callers 2

send_gen_msgFunction · 0.85
bcast_gen_msgFunction · 0.85

Calls 3

bin_push_intFunction · 0.85
bin_push_strFunction · 0.85
msg_add_trailerFunction · 0.85

Tested by

no test coverage detected