Module: kamailio
Branch: master
Commit: bca93fd8f6f8a5d3d8872e387585945329fe8205
URL:
https://github.com/kamailio/kamailio/commit/bca93fd8f6f8a5d3d8872e387585945…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2015-04-20T22:40:02+02:00
core: helper function for pvs to return values based on pairs (char*, len)
---
Modified: pvapi.c
Modified: pvar.h
---
Diff:
https://github.com/kamailio/kamailio/commit/bca93fd8f6f8a5d3d8872e387585945…
Patch:
https://github.com/kamailio/kamailio/commit/bca93fd8f6f8a5d3d8872e387585945…
---
diff --git a/pvapi.c b/pvapi.c
index ccf9814..d60aebc 100644
--- a/pvapi.c
+++ b/pvapi.c
@@ -539,6 +539,21 @@ int pv_get_strzval(struct sip_msg *msg, pv_param_t *param,
}
/**
+ * convert char* with len to pv_value_t
+ */
+int pv_get_strlval(struct sip_msg *msg, pv_param_t *param,
+ pv_value_t *res, char *sval, int slen)
+{
+ if(res==NULL)
+ return -1;
+
+ res->rs.s = sval;
+ res->rs.len = slen;
+ 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 da13806..3bdfe17 100644
--- a/pvar.h
+++ b/pvar.h
@@ -219,6 +219,8 @@ 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_strlval(struct sip_msg *msg, pv_param_t *param,
+ pv_value_t *res, char *sval, int slen);
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,