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 @@
1
+/* 
2
+ * $Id$
3
+ * 
4
+ * Copyright (C) 2010 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
+/** kamailio statistics types.
19
+ * This file contains type declaration for kamailio statistics.
20
+ * They are needed when modules are loaded (sr_module.c).
21
+ * The rest of kamailio stats are in lib/kcore (include
22
+ * lib/kcore/kstats_wrapper.h or lib/kcore/statistics.h and link with
23
+ * libkcore).
24
+ * Note: kamailio statistics are obsolete. Use sr counters in new code
25
+ * (counters.h).
26
+ * @file kstats_types.h
27
+ * @ingroup: core
28
+ */
29
+/*
30
+ * History:
31
+ * --------
32
+ *  2010-08-18  initial version (andrei)
33
+*/
34
+
35
+#ifndef __kstats_types_h
36
+#define __kstats_types_h
37
+
38
+#include "counters.h"
39
+
40
+/* types */
41
+
42
+typedef counter_val_t    stat_val;
43
+/* stat_var is always used as a pointer in k, we missuse
44
+   stat_var* for holding out counter id */
45
+typedef void stat_var;
46
+/* get val callback
47
+ * TODO: change it to counter_cbk_f compatible callback?
48
+ */
49
+typedef counter_val_t (*stat_function)(void);
50
+
51
+/* statistic module interface */
52
+struct stat_export_s {
53
+	char* name;
54
+	int flags;
55
+	stat_var** stat_pointer; /* pointer to the memory location
56
+								(where a counter handle will be stored)
57
+								Note: it's a double pointer because of
58
+								the original k version which needed it
59
+								allocated in shm. This version
60
+								will store the counter id at *stat_pointer.
61
+							  */
62
+};
63
+
64
+typedef struct stat_export_s stat_export_t;
65
+
66
+
67
+#endif /*__kstats_types_h*/
68
+
69
+/* 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 52
 #define STAT_SHM_NAME	4 /* used only from usrloc(k) */
50 53
 #define STAT_IS_FUNC	8
51 54
 
52
-/* types */
53 55
 
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 56
 
78 57
 #ifdef STATISTICS
79 58
 
... ...
@@ -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_ */