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

Function mc_compact_cb

modules/compression/compression.c:681–1009  ·  view source on GitHub ↗

* */

Source from the content-addressed store, hash-verified

679 *
680 */
681static int mc_compact_cb(char** buf_p, struct mc_compact_args *mc_compact_args, int type, int* olen)
682{
683 int i;
684 int msg_total_len;
685 int rtpmap_val=0, rtpmap_len;
686 int new_body_len;
687 int hdr_len;
688
689 str msg_start;
690 str new_buf;
691
692 char *buf=*buf_p;
693 char *buf_cpy;
694 char *end=buf+*olen;
695
696 struct hdr_field *hf;
697 struct hdr_field** hdr_mask;
698
699 body_frag_p frg;
700 body_frag_p frg_head;
701 body_frag_p temp;
702
703 hdr_mask = pkg_malloc(HDR_EOH_T * sizeof(struct hdr_field*));
704
705 if (!hdr_mask)
706 goto memerr;
707
708 memset(hdr_mask, 0, HDR_EOH_T * sizeof(struct hdr_field*));
709
710 mc_parse_first_line( &msg_start, &buf);
711
712 msg_total_len = msg_start.len;
713
714 /* Start to parse the headers and print them*/
715 while (1) {
716 hf = pkg_malloc(sizeof(struct hdr_field));
717 if (hf == NULL) {
718 LM_ERR("no more pkg mem\n");
719 goto memerr;
720 }
721 memset(hf, 0, sizeof(struct hdr_field));
722 hf->type=HDR_ERROR_T;
723 buf=get_hdr_field(buf, end, hf);
724
725 if (hf->type == HDR_ERROR_T) {
726 pkg_free(hf);
727 goto free_mem;
728 }
729
730 if (hf->type == HDR_EOH_T) {
731 pkg_free(hf);
732 break;
733 }
734
735 if (mc_is_in_whitelist(hf, mc_compact_args->wh_list)) {
736 if (hdr_mask[hf->type]) {
737 /* If hdr already found or hdr of type other */
738 if (append_hf2lst(&hdr_mask[hf->type], hf,

Callers 2

wrap_tm_funcFunction · 0.85
wrap_msg_funcFunction · 0.85

Calls 12

mc_parse_first_lineFunction · 0.85
mc_is_in_whitelistFunction · 0.85
append_hf2lstFunction · 0.85
clean_hdr_fieldFunction · 0.85
get_compact_formFunction · 0.85
mc_ndigitsFunction · 0.85
int2strFunction · 0.85
wrap_reallocFunction · 0.85
wrap_copy_and_updateFunction · 0.85
shm_freeFunction · 0.85
shm_mallocFunction · 0.85
free_hdr_maskFunction · 0.85

Tested by

no test coverage detected