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

Function patch

modules/mangler/utils.c:36–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34
35
36int
37patch (struct sip_msg *msg, char *oldstr, unsigned int oldlen, char *newstr,
38 unsigned int newlen)
39{
40 int off;
41 struct lump *anchor;
42
43 if (oldstr == NULL)
44 return -1;
45
46 if (newstr == NULL)
47 return -2;
48 off = oldstr - msg->buf;
49 if (off < 0)
50 return -3;
51 if ((anchor = del_lump (msg, off, oldlen, 0)) == 0)
52 {
53 LM_ERR("lumping with del_lump\n");
54 return -4;
55 }
56 if ((insert_new_lump_after (anchor, newstr, newlen, 0)) == 0)
57 {
58 LM_ERR("lumping with insert_new_lump_after\n");
59 return -5;
60 }
61
62 return 0;
63}
64
65
66/* TESTED */

Callers 3

patch_content_lengthFunction · 0.85
encode_contactFunction · 0.85
decode_contact_headerFunction · 0.85

Calls 2

del_lumpFunction · 0.85
insert_new_lump_afterFunction · 0.85

Tested by

no test coverage detected