Module: sip-router
Branch: master
Commit: bbab41f73fc086f8d14668c40a9879fb47ecfbc0
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=bbab41f…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Thu Apr 8 23:34:15 2010 +0200
pv: added $true
- return integer value 1, useful to create infinite loops via
while($true) { ...}
- suggested by Ovidiu Sas and Juha Heinanen
---
modules_k/pv/pv.c | 3 +++
modules_k/pv/pv_core.c | 7 +++++++
modules_k/pv/pv_core.h | 4 ++++
3 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/modules_k/pv/pv.c b/modules_k/pv/pv.c
index 5475271..2076de0 100644
--- a/modules_k/pv/pv.c
+++ b/modules_k/pv/pv.c
@@ -351,6 +351,9 @@ static pv_export_t mod_pvs[] = {
{{"to.user", (sizeof("to.user")-1)}, /* */
PVT_OTHER, pv_get_to_attr, 0,
0, 0, pv_init_iname, 2},
+ {{"true", (sizeof("true")-1)}, /* */
+ PVT_OTHER, pv_get_true, 0,
+ 0, 0, 0, 0},
{{"Tf", (sizeof("Tf")-1)}, /* */
PVT_CONTEXT, pv_get_timef, 0,
0, 0, 0, 0},
diff --git a/modules_k/pv/pv_core.c b/modules_k/pv/pv_core.c
index f52905a..966bed8 100644
--- a/modules_k/pv/pv_core.c
+++ b/modules_k/pv/pv_core.c
@@ -49,6 +49,7 @@
static str str_udp = { "UDP", 3 };
static str str_5060 = { "5060", 4 };
+static str pv_str_1 = { "1", 1 };
int _pv_pid = 0;
@@ -78,6 +79,12 @@ int pv_get_5060(struct sip_msg *msg, pv_param_t *param, pv_value_t
*res)
return pv_get_strintval(msg, param, res, &str_5060, 5060);
}
+int pv_get_true(struct sip_msg *msg, pv_param_t *param,
+ pv_value_t *res)
+{
+ return pv_get_intstrval(msg, param, res, 1, &pv_str_1);
+}
+
/*extern int _last_returned_code;
int pv_get_return_code(struct sip_msg *msg, pv_param_t *param,
pv_value_t *res)
diff --git a/modules_k/pv/pv_core.h b/modules_k/pv/pv_core.h
index f0e4e0e..1831071 100644
--- a/modules_k/pv/pv_core.h
+++ b/modules_k/pv/pv_core.h
@@ -186,6 +186,10 @@ int pv_get_hdr(struct sip_msg *msg, pv_param_t *param, pv_value_t
*res);
int pv_get_scriptvar(struct sip_msg *msg, pv_param_t *param,
pv_value_t *res);
+
+int pv_get_true(struct sip_msg *msg, pv_param_t *param,
+ pv_value_t *res);
+
/********* end PV get functions *********/
/********* start PV set functions *********/