Browse code

modules_k/*: moved k modules in directory modules/

Daniel-Constantin Mierla authored on 20/01/2013 11:57:52
Showing 1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,116 +0,0 @@
1
-/*
2
- * $Id$
3
- *
4
- * Copyright (C) 2001-2003 FhG Fokus
5
- *
6
- * This file is part of Kamailio, a free SIP server.
7
- *
8
- * Kamailio is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation; either version 2 of the License, or
11
- * (at your option) any later version
12
- *
13
- * Kamailio is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
- * GNU General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU General Public License 
19
- * along with this program; if not, write to the Free Software 
20
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21
- */
22
-
23
-/*!
24
- * \file
25
- * \brief Implementation for Stats Pseudo-variables
26
- */
27
-
28
-#include "../../lib/kcore/statistics.h"
29
-#include "../../ver.h"
30
-#include "pv_stats.h"
31
-
32
-/**
33
- *
34
- */
35
-int pv_parse_stat_name(pv_spec_p sp, str *in)
36
-{
37
-	if (in == NULL || in->s == NULL || sp == NULL)
38
-		return -1;
39
-	sp->pvp.pvn.type = PV_NAME_INTSTR;
40
-	sp->pvp.pvn.u.isname.type = AVP_NAME_STR;
41
-	sp->pvp.pvn.u.isname.name.s = *in;
42
-	return 0;
43
-}
44
-
45
-
46
-/**
47
- *
48
- */
49
-int pv_get_stat(struct sip_msg *msg, pv_param_t *param, pv_value_t *res)
50
-{
51
-	stat_var *stat;
52
-
53
-	stat = get_stat(&param->pvn.u.isname.name.s);
54
-	if (stat == NULL) {
55
-		LM_WARN("No stat variable ``%.*s''\n",
56
-			param->pvn.u.isname.name.s.len, param->pvn.u.isname.name.s.s);
57
-		return pv_get_null(msg, param, res);
58
-	}
59
-	return pv_get_uintval(msg, param, res,
60
-			(unsigned int)get_stat_val(stat));
61
-}
62
-
63
-/**
64
- *
65
- */
66
-int pv_parse_sr_version_name(pv_spec_p sp, str *in)
67
-{
68
-	if(sp==NULL || in==NULL || in->len<=0)
69
-		return -1;
70
-
71
-	switch(in->len)
72
-	{
73
-		case 3:
74
-			if(strncmp(in->s, "num", 3)==0)
75
-				sp->pvp.pvn.u.isname.name.n = 0;
76
-			else goto error;
77
-		break;
78
-		case 4:
79
-			if(strncmp(in->s, "full", 4)==0)
80
-				sp->pvp.pvn.u.isname.name.n = 1;
81
-			else if(strncmp(in->s, "hash", 4)==0)
82
-				sp->pvp.pvn.u.isname.name.n = 2;
83
-			else goto error;
84
-		break;
85
-		default:
86
-			goto error;
87
-	}
88
-	sp->pvp.pvn.type = PV_NAME_INTSTR;
89
-	sp->pvp.pvn.u.isname.type = 0;
90
-
91
-	return 0;
92
-
93
-error:
94
-	LM_ERR("unknown PV version name %.*s\n", in->len, in->s);
95
-	return -1;
96
-}
97
-
98
-/**
99
- *
100
- */
101
-int pv_get_sr_version(sip_msg_t *msg, pv_param_t *param, pv_value_t *res)
102
-{
103
-	if(param==NULL)
104
-		return -1;
105
-
106
-	switch(param->pvn.u.isname.name.n)
107
-	{
108
-		case 1:
109
-			return pv_get_strzval(msg, param, res, (char*)full_version);
110
-		case 2:
111
-			return pv_get_strzval(msg, param, res, (char*)ver_id);
112
-		default:
113
-			return pv_get_strzval(msg, param, res, (char*)ver_version);
114
-	}
115
-}
116
-
Browse code

pv: new pv class $version(key)

- return attributes of the software version
- key can be:
- num - return version number
- full - return all version string
- hash - return git hash code and status

Daniel-Constantin Mierla authored on 16/08/2012 18:24:28
Showing 1 changed files
... ...
@@ -26,8 +26,12 @@
26 26
  */
27 27
 
28 28
 #include "../../lib/kcore/statistics.h"
29
+#include "../../ver.h"
29 30
 #include "pv_stats.h"
30 31
 
32
+/**
33
+ *
34
+ */
31 35
 int pv_parse_stat_name(pv_spec_p sp, str *in)
32 36
 {
33 37
 	if (in == NULL || in->s == NULL || sp == NULL)
... ...
@@ -39,6 +43,9 @@ int pv_parse_stat_name(pv_spec_p sp, str *in)
39 43
 }
40 44
 
41 45
 
46
+/**
47
+ *
48
+ */
42 49
 int pv_get_stat(struct sip_msg *msg, pv_param_t *param, pv_value_t *res)
43 50
 {
44 51
 	stat_var *stat;
... ...
@@ -53,3 +60,57 @@ int pv_get_stat(struct sip_msg *msg, pv_param_t *param, pv_value_t *res)
53 60
 			(unsigned int)get_stat_val(stat));
54 61
 }
55 62
 
63
+/**
64
+ *
65
+ */
66
+int pv_parse_sr_version_name(pv_spec_p sp, str *in)
67
+{
68
+	if(sp==NULL || in==NULL || in->len<=0)
69
+		return -1;
70
+
71
+	switch(in->len)
72
+	{
73
+		case 3:
74
+			if(strncmp(in->s, "num", 3)==0)
75
+				sp->pvp.pvn.u.isname.name.n = 0;
76
+			else goto error;
77
+		break;
78
+		case 4:
79
+			if(strncmp(in->s, "full", 4)==0)
80
+				sp->pvp.pvn.u.isname.name.n = 1;
81
+			else if(strncmp(in->s, "hash", 4)==0)
82
+				sp->pvp.pvn.u.isname.name.n = 2;
83
+			else goto error;
84
+		break;
85
+		default:
86
+			goto error;
87
+	}
88
+	sp->pvp.pvn.type = PV_NAME_INTSTR;
89
+	sp->pvp.pvn.u.isname.type = 0;
90
+
91
+	return 0;
92
+
93
+error:
94
+	LM_ERR("unknown PV version name %.*s\n", in->len, in->s);
95
+	return -1;
96
+}
97
+
98
+/**
99
+ *
100
+ */
101
+int pv_get_sr_version(sip_msg_t *msg, pv_param_t *param, pv_value_t *res)
102
+{
103
+	if(param==NULL)
104
+		return -1;
105
+
106
+	switch(param->pvn.u.isname.name.n)
107
+	{
108
+		case 1:
109
+			return pv_get_strzval(msg, param, res, (char*)full_version);
110
+		case 2:
111
+			return pv_get_strzval(msg, param, res, (char*)ver_id);
112
+		default:
113
+			return pv_get_strzval(msg, param, res, (char*)ver_version);
114
+	}
115
+}
116
+
Browse code

pv: cast the value of statistics for PV int value

Daniel-Constantin Mierla authored on 30/03/2011 19:24:54
Showing 1 changed files
... ...
@@ -49,6 +49,7 @@ int pv_get_stat(struct sip_msg *msg, pv_param_t *param, pv_value_t *res)
49 49
 			param->pvn.u.isname.name.s.len, param->pvn.u.isname.name.s.s);
50 50
 		return pv_get_null(msg, param, res);
51 51
 	}
52
-	return pv_get_uintval(msg, param, res, get_stat_val(stat));
52
+	return pv_get_uintval(msg, param, res,
53
+			(unsigned int)get_stat_val(stat));
53 54
 }
54 55
 
Browse code

Update module to use statistics from libkcore

This patch does two things:
* It links them modules with shared library libkcore which contains
all the statistics related stuff that was present in kamailio core and
is missing in the sip-router core.
* it fixes the path to statistics.h to point to the header in the shared
library.

Jan Janak authored on 10/03/2009 23:37:38
Showing 1 changed files
... ...
@@ -25,7 +25,7 @@
25 25
  * \brief Implementation for Stats Pseudo-variables
26 26
  */
27 27
 
28
-#include "../../statistics.h"
28
+#include "../../lib/kcore/statistics.h"
29 29
 #include "pv_stats.h"
30 30
 
31 31
 int pv_parse_stat_name(pv_spec_p sp, str *in)
Browse code

- added new files related to previous commit

git-svn-id: https://openser.svn.sourceforge.net/svnroot/openser/trunk@5230 689a6050-402a-0410-94f2-e92a70836424

Daniel-Constantin Mierla authored on 19/11/2008 15:53:47
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,54 @@
1
+/*
2
+ * $Id$
3
+ *
4
+ * Copyright (C) 2001-2003 FhG Fokus
5
+ *
6
+ * This file is part of Kamailio, a free SIP server.
7
+ *
8
+ * Kamailio is free software; you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation; either version 2 of the License, or
11
+ * (at your option) any later version
12
+ *
13
+ * Kamailio is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License 
19
+ * along with this program; if not, write to the Free Software 
20
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21
+ */
22
+
23
+/*!
24
+ * \file
25
+ * \brief Implementation for Stats Pseudo-variables
26
+ */
27
+
28
+#include "../../statistics.h"
29
+#include "pv_stats.h"
30
+
31
+int pv_parse_stat_name(pv_spec_p sp, str *in)
32
+{
33
+	if (in == NULL || in->s == NULL || sp == NULL)
34
+		return -1;
35
+	sp->pvp.pvn.type = PV_NAME_INTSTR;
36
+	sp->pvp.pvn.u.isname.type = AVP_NAME_STR;
37
+	sp->pvp.pvn.u.isname.name.s = *in;
38
+	return 0;
39
+}
40
+
41
+
42
+int pv_get_stat(struct sip_msg *msg, pv_param_t *param, pv_value_t *res)
43
+{
44
+	stat_var *stat;
45
+
46
+	stat = get_stat(&param->pvn.u.isname.name.s);
47
+	if (stat == NULL) {
48
+		LM_WARN("No stat variable ``%.*s''\n",
49
+			param->pvn.u.isname.name.s.len, param->pvn.u.isname.name.s.s);
50
+		return pv_get_null(msg, param, res);
51
+	}
52
+	return pv_get_uintval(msg, param, res, get_stat_val(stat));
53
+}
54
+