Module: kamailio
Branch: master
Commit: d9a4b2929ec999127c46256a6f497520df017488
URL:
https://github.com/kamailio/kamailio/commit/d9a4b2929ec999127c46256a6f49752…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2019-04-18T09:37:36+02:00
core: xavp - helper function to remove child value
---
Modified: src/core/xavp.c
Modified: src/core/xavp.h
---
Diff:
https://github.com/kamailio/kamailio/commit/d9a4b2929ec999127c46256a6f49752…
Patch:
https://github.com/kamailio/kamailio/commit/d9a4b2929ec999127c46256a6f49752…
---
diff --git a/src/core/xavp.c b/src/core/xavp.c
index 1e25862650..be3bba423f 100644
--- a/src/core/xavp.c
+++ b/src/core/xavp.c
@@ -447,6 +447,20 @@ int xavp_rm_by_index(str *name, int idx, sr_xavp_t **head)
return xavp_rm_internal(name, head, idx);
}
+int xavp_rm_child_by_index(str *rname, str *cname, int idx)
+{
+ sr_xavp_t *avp=NULL;
+
+ if (idx<0) {
+ return 0;
+ }
+ avp = xavp_get(rname, NULL);
+
+ if(avp == NULL || avp->val.type!=SR_XTYPE_XAVP) {
+ return 0;
+ }
+ return xavp_rm_internal(cname, &avp->val.v.xavp, idx);
+}
int xavp_count(str *name, sr_xavp_t **start)
{
diff --git a/src/core/xavp.h b/src/core/xavp.h
index c97123e190..4cd333eaaf 100644
--- a/src/core/xavp.h
+++ b/src/core/xavp.h
@@ -88,6 +88,7 @@ sr_xavp_t *xavp_get_last(str *xname, sr_xavp_t **list);
int xavp_rm_by_name(str *name, int all, sr_xavp_t **head);
int xavp_rm_by_index(str *name, int idx, sr_xavp_t **head);
int xavp_rm(sr_xavp_t *xa, sr_xavp_t **head);
+int xavp_rm_child_by_index(str *rname, str *cname, int idx);
int xavp_count(str *name, sr_xavp_t **start);
void xavp_destroy_list_unsafe(sr_xavp_t **head);
void xavp_destroy_list(sr_xavp_t **head);