Module: sip-router
Branch: master
Commit: 5a9340a2309e7689da4d34eeeef12b0bed2f6e09
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=5a9340a…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Thu Aug 16 20:24:02 2012 +0200
core: added pv_get_strzval(...) helper function for pv
---
pvapi.c | 15 +++++++++++++++
pvar.h | 2 ++
2 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/pvapi.c b/pvapi.c
index d1ebfe6..957086f 100644
--- a/pvapi.c
+++ b/pvapi.c
@@ -457,6 +457,21 @@ int pv_get_strval(struct sip_msg *msg, pv_param_t *param,
}
/**
+ * convert strz to pv_value_t
+ */
+int pv_get_strzval(struct sip_msg *msg, pv_param_t *param,
+ pv_value_t *res, char *sval)
+{
+ if(res==NULL)
+ return -1;
+
+ res->rs.s = sval;
+ res->rs.len = strlen(sval);
+ res->flags = PV_VAL_STR;
+ return 0;
+}
+
+/**
* convert str-int to pv_value_t (type is str)
*/
int pv_get_strintval(struct sip_msg *msg, pv_param_t *param,
diff --git a/pvar.h b/pvar.h
index df83e69..eaa7556 100644
--- a/pvar.h
+++ b/pvar.h
@@ -216,6 +216,8 @@ int pv_get_sintval(struct sip_msg *msg, pv_param_t *param,
pv_value_t *res, int sival);
int pv_get_strval(struct sip_msg *msg, pv_param_t *param,
pv_value_t *res, str *sval);
+int pv_get_strzval(struct sip_msg *msg, pv_param_t *param,
+ pv_value_t *res, char *sval);
int pv_get_strintval(struct sip_msg *msg, pv_param_t *param,
pv_value_t *res, str *sval, int ival);
int pv_get_intstrval(struct sip_msg *msg, pv_param_t *param,