Module: sip-router
Branch: master
Commit: aea4043106b7b3e44529385293616b7af640c892
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=aea4043…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Fri Dec 28 19:21:28 2012 +0100
core: added a fuction that adds an xavp with an xavp value
---
xavp.c | 32 ++++++++++++++++++++++++++++++++
xavp.h | 1 +
2 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/xavp.c b/xavp.c
index f04ac90..9b36562 100644
--- a/xavp.c
+++ b/xavp.c
@@ -183,6 +183,38 @@ sr_xavp_t *xavp_add_value(str *name, sr_xval_t *val, sr_xavp_t
**list)
return avp;
}
+sr_xavp_t *xavp_add_xavp_value(str *rname, str *name, sr_xval_t *val, sr_xavp_t **list)
+{
+ sr_xavp_t *ravp=0;
+ sr_xavp_t *cavp=0;
+ sr_xval_t rval;
+
+ cavp = xavp_new_value(name, val);
+ if (cavp==NULL)
+ return NULL;
+
+ memset(&rval, 0, sizeof(sr_xval_t));
+ rval.type = SR_XTYPE_XAVP;
+ rval.v.xavp = cavp;
+
+ ravp = xavp_new_value(rname, &rval);
+ if (ravp==NULL) {
+ xavp_destroy_list(&cavp);
+ return NULL;
+ }
+
+ /* Prepend new value to the list */
+ if(list) {
+ ravp->next = *list;
+ *list = ravp;
+ } else {
+ ravp->next = *_xavp_list_crt;
+ *_xavp_list_crt = ravp;
+ }
+
+ return ravp;
+}
+
sr_xavp_t *xavp_set_value(str *name, int idx, sr_xval_t *val, sr_xavp_t **list)
{
sr_xavp_t *avp;
diff --git a/xavp.h b/xavp.h
index 0ffce2a..b581c08 100644
--- a/xavp.h
+++ b/xavp.h
@@ -81,6 +81,7 @@ void avpx_free(sr_xavp_t *xa);
int xavp_add(sr_xavp_t *xavp, sr_xavp_t **list);
int xavp_add_last(sr_xavp_t *xavp, sr_xavp_t **list);
sr_xavp_t *xavp_add_value(str *name, sr_xval_t *val, sr_xavp_t **list);
+sr_xavp_t *xavp_add_xavp_value(str *rname, str *name, sr_xval_t *val, sr_xavp_t **list);
sr_xavp_t *xavp_set_value(str *name, int idx, sr_xval_t *val, sr_xavp_t **list);
sr_xavp_t *xavp_get(str *name, sr_xavp_t *start);
sr_xavp_t *xavp_get_by_index(str *name, int idx, sr_xavp_t **start);