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

Function wrap_msg_func

modules/compression/compression.c:350–397  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

348}
349
350int wrap_msg_func(str* buf, struct sip_msg* p_msg, int type)
351{
352 int ret = 0;
353 struct mc_comp_args* args;
354 struct mc_compact_args *mc_compact_args = NULL;
355 mc_whitelist_p wh_list = NULL;
356 int olen=buf->len;
357
358 if (current_processing_ctx == NULL) {
359 LM_DBG("null context. cb shall not be removed\n");
360 return 1;
361 }
362
363 switch (type) {
364 case COMPRESS_CB:
365 if ((args = GET_GLOBAL_CTX(compress_ctx_pos))==NULL)
366 break;
367
368 if ((ret = mc_compress_cb(&buf->s, args, PROCESSING_CB, &olen)) < 0)
369 LM_ERR("compression failed. Probably not requested message\n");
370
371 wh_list = args->hdr2compress_list;
372 pkg_free(args);
373 SET_GLOBAL_CTX(compress_ctx_pos, NULL);
374 break;
375
376 case COMPACT_CB:
377 if ((mc_compact_args = GET_GLOBAL_CTX(compact_ctx_pos))==NULL)
378 break;
379
380 if ((ret = mc_compact_cb(&buf->s, mc_compact_args, PROCESSING_CB, &olen)) < 0)
381 LM_ERR("compaction failed\n");
382
383 SET_GLOBAL_CTX(compact_ctx_pos, NULL);
384 break;
385 }
386
387 /* free whitelists for both actions */
388 if (wh_list)
389 free_whitelist(wh_list);
390 free_mc_compact_args(mc_compact_args);
391 if (ret < 0)
392 return -1;
393
394 buf->len = olen;
395
396 return 0;
397}
398
399/*
400 *

Callers 2

wrap_msg_compressFunction · 0.85
wrap_msg_compactFunction · 0.85

Calls 4

mc_compress_cbFunction · 0.85
mc_compact_cbFunction · 0.85
free_whitelistFunction · 0.85
free_mc_compact_argsFunction · 0.85

Tested by

no test coverage detected