Browse code

kstats: cleanup - move type defs. to separate file

- moved kamailio statistics type defs to kstats_types.h (from
lib/kcore/kstats_wrapper.h). This removes core dependency on
lib/kcore include files (the statistics types are needed for the
kamailio module interface defs).
- removed statistics.h (it is obsolete, counters.h should be used
instead and if somebody really needs it, it should include
lib/kcore/kstats_wrapper.h or lib/kcore/statistics.h).

Andrei Pelinescu-Onciul authored on 18/08/2010 18:01:31
Showing 4 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,69 @@
0
+/* 
1
+ * $Id$
2
+ * 
3
+ * Copyright (C) 2010 iptelorg GmbH
4
+ *
5
+ * Permission to use, copy, modify, and distribute this software for any
6
+ * purpose with or without fee is hereby granted, provided that the above
7
+ * copyright notice and this permission notice appear in all copies.
8
+ *
9
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16
+ */
17
+/** kamailio statistics types.
18
+ * This file contains type declaration for kamailio statistics.
19
+ * They are needed when modules are loaded (sr_module.c).
20
+ * The rest of kamailio stats are in lib/kcore (include
21
+ * lib/kcore/kstats_wrapper.h or lib/kcore/statistics.h and link with
22
+ * libkcore).
23
+ * Note: kamailio statistics are obsolete. Use sr counters in new code
24
+ * (counters.h).
25
+ * @file kstats_types.h
26
+ * @ingroup: core
27
+ */
28
+/*
29
+ * History:
30
+ * --------
31
+ *  2010-08-18  initial version (andrei)
32
+*/
33
+
34
+#ifndef __kstats_types_h
35
+#define __kstats_types_h
36
+
37
+#include "counters.h"
38
+
39
+/* types */
40
+
41
+typedef counter_val_t    stat_val;
42
+/* stat_var is always used as a pointer in k, we missuse
43
+   stat_var* for holding out counter id */
44
+typedef void stat_var;
45
+/* get val callback
46
+ * TODO: change it to counter_cbk_f compatible callback?
47
+ */
48
+typedef counter_val_t (*stat_function)(void);
49
+
50
+/* statistic module interface */
51
+struct stat_export_s {
52
+	char* name;
53
+	int flags;
54
+	stat_var** stat_pointer; /* pointer to the memory location
55
+								(where a counter handle will be stored)
56
+								Note: it's a double pointer because of
57
+								the original k version which needed it
58
+								allocated in shm. This version
59
+								will store the counter id at *stat_pointer.
60
+							  */
61
+};
62
+
63
+typedef struct stat_export_s stat_export_t;
64
+
65
+
66
+#endif /*__kstats_types_h*/
67
+
68
+/* vi: set ts=4 sw=4 tw=79:ai:cindent: */
... ...
@@ -35,12 +35,15 @@
35 35
  * History:
36 36
  * --------
37 37
  *  2010-08-08  initial version (andrei)
38
+ *  2010-08-18  type declaration needed by sr_module.c moved to
39
+ *               ../../kstats_types.h (andrei)
38 40
 */
39 41
 
40 42
 #ifndef __kstats_wrapper_h
41 43
 #define __kstats_wrapper_h
42 44
 
43 45
 #include "../../counters.h"
46
+#include "../../kstats_types.h"
44 47
 
45 48
 /* k stat flags */
46 49
 #define STAT_NO_RESET	1  /* used in dialog(k), nat_traversal(k),
... ...
@@ -49,31 +52,7 @@
49 49
 #define STAT_SHM_NAME	4 /* used only from usrloc(k) */
50 50
 #define STAT_IS_FUNC	8
51 51
 
52
-/* types */
53 52
 
54
-typedef counter_val_t    stat_val;
55
-/* stat_var is always used as a pointer in k, we missuse
56
-   stat_var* for holding out counter id */
57
-typedef void stat_var;
58
-/* get val callback
59
- * TODO: change it to counter_cbk_f compatible callback?
60
- */
61
-typedef counter_val_t (*stat_function)(void);
62
-
63
-/* statistic module interface */
64
-struct stat_export_s {
65
-	char* name;
66
-	int flags;
67
-	stat_var** stat_pointer; /* pointer to the memory location
68
-								(where a counter handle will be stored)
69
-								Note: it's a double pointer because of
70
-								the original k version which needed it
71
-								allocated in shm. This version
72
-								will store the counter id at *stat_pointer.
73
-							  */
74
-};
75
-
76
-typedef struct stat_export_s stat_export_t;
77 53
 
78 54
 #ifdef STATISTICS
79 55
 
... ...
@@ -68,7 +68,7 @@
68 68
 #include "str.h"
69 69
 
70 70
 /* kamailio compat */
71
-#include "statistics.h"
71
+#include "kstats_types.h"
72 72
 #include "mi/mi_types.h"
73 73
 #include "pvar.h"
74 74
 
75 75
deleted file mode 100644
... ...
@@ -1,33 +0,0 @@
1
-/*
2
- * $Id$
3
- *
4
- * Copyright (C) 2008 iptelorg GmbH
5
- *
6
- * Permission to use, copy, modify, and distribute this software for any
7
- * purpose with or without fee is hereby granted, provided that the above
8
- * copyright notice and this permission notice appear in all copies.
9
- *
10
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
- */
18
-/*
19
- * statistics compatibility wrapper for kamailio
20
- * for now it doesn't do anything
21
- * (obsolete, do not use anymore)
22
- *
23
- * History:
24
- * --------
25
- *  2008-11-17  initial version compatible with kamailio statistics.h (andrei)
26
- */
27
-
28
-#ifndef _STATISTICS_H_
29
-#define _STATISTICS_H_
30
-
31
-#include "lib/kcore/statistics.h"
32
-
33
-#endif /* _STATISTICS_H_ */