[sr-dev] git:master:15e6a4a9: pv: added kemi functions to test if xavp is null
Daniel-Constantin Mierla
miconda at gmail.com
Thu Jun 6 12:10:38 CEST 2019
Module: kamailio
Branch: master
Commit: 15e6a4a9548edbae5c553a8c6e59f3ffe0006d4f
URL: https://github.com/kamailio/kamailio/commit/15e6a4a9548edbae5c553a8c6e59f3ffe0006d4f
Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2019-06-06T11:33:14+02:00
pv: added kemi functions to test if xavp is null
---
Modified: src/modules/pv/pv.c
---
Diff: https://github.com/kamailio/kamailio/commit/15e6a4a9548edbae5c553a8c6e59f3ffe0006d4f.diff
Patch: https://github.com/kamailio/kamailio/commit/15e6a4a9548edbae5c553a8c6e59f3ffe0006d4f.patch
---
diff --git a/src/modules/pv/pv.c b/src/modules/pv/pv.c
index 0c5288b748..8031a56642 100644
--- a/src/modules/pv/pv.c
+++ b/src/modules/pv/pv.c
@@ -1061,6 +1061,23 @@ static int w_xavp_rm_child(sip_msg_t *msg, char *prname, char *pcname)
return ki_xavp_rm_child(msg, &rname, &cname);
}
+/**
+ *
+ */
+static int ki_xavp_is_null(sip_msg_t *msg, str *rname)
+{
+ sr_xavp_t *xavp=NULL;
+
+ xavp = xavp_get_by_index(rname, 0, NULL);
+ if(xavp==NULL) {
+ return 1;
+ }
+ if(xavp->val.type == SR_XTYPE_NULL) {
+ return 1;
+ }
+ return -1;
+}
+
/**
*
*/
@@ -1171,6 +1188,30 @@ static sr_kemi_xval_t* ki_xavp_getw(sip_msg_t *msg, str *rname)
return ki_xavp_get_mode(msg, rname, SR_KEMI_XVAL_NULL_PRINT);
}
+/**
+ *
+ */
+static int ki_xavp_child_is_null(sip_msg_t *msg, str *rname, str *cname)
+{
+ sr_xavp_t *xavp=NULL;
+
+ xavp = xavp_get_by_index(rname, 0, NULL);
+ if(xavp==NULL) {
+ return 1;
+ }
+ if(xavp->val.type != SR_XTYPE_XAVP) {
+ return 1;
+ }
+ xavp = xavp_get_by_index(cname, 0, &xavp->val.v.xavp);
+ if(xavp==NULL) {
+ return 1;
+ }
+ if(xavp->val.type == SR_XTYPE_NULL) {
+ return 1;
+ }
+ return -1;
+}
+
/**
*
*/
@@ -1637,11 +1678,21 @@ static sr_kemi_t sr_kemi_pvx_exports[] = {
{ SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
},
+ { str_init("pvx"), str_init("xavp_is_null"),
+ SR_KEMIP_INT, ki_xavp_is_null,
+ { SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
{ str_init("pvx"), str_init("xavp_rm_child"),
SR_KEMIP_INT, ki_xavp_rm_child,
{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
},
+ { str_init("pvx"), str_init("xavp_child_is_null"),
+ SR_KEMIP_INT, ki_xavp_child_is_null,
+ { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
{ str_init("pvx"), str_init("xavp_get"),
SR_KEMIP_XVAL, ki_xavp_get,
{ SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
More information about the sr-dev
mailing list