Browse Source

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 15 years ago
parent
commit
742ce3ae28
4 changed files with 73 additions and 58 deletions
  1. 69 0
      kstats_types.h
  2. 3 24
      lib/kcore/kstats_wrapper.h
  3. 1 1
      sr_module.h
  4. 0 33
      statistics.h

+ 69 - 0
kstats_types.h

@@ -0,0 +1,69 @@
+/* 
+ * $Id$
+ * 
+ * Copyright (C) 2010 iptelorg GmbH
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/** kamailio statistics types.
+ * This file contains type declaration for kamailio statistics.
+ * They are needed when modules are loaded (sr_module.c).
+ * The rest of kamailio stats are in lib/kcore (include
+ * lib/kcore/kstats_wrapper.h or lib/kcore/statistics.h and link with
+ * libkcore).
+ * Note: kamailio statistics are obsolete. Use sr counters in new code
+ * (counters.h).
+ * @file kstats_types.h
+ * @ingroup: core
+ */
+/*
+ * History:
+ * --------
+ *  2010-08-18  initial version (andrei)
+*/
+
+#ifndef __kstats_types_h
+#define __kstats_types_h
+
+#include "counters.h"
+
+/* types */
+
+typedef counter_val_t    stat_val;
+/* stat_var is always used as a pointer in k, we missuse
+   stat_var* for holding out counter id */
+typedef void stat_var;
+/* get val callback
+ * TODO: change it to counter_cbk_f compatible callback?
+ */
+typedef counter_val_t (*stat_function)(void);
+
+/* statistic module interface */
+struct stat_export_s {
+	char* name;
+	int flags;
+	stat_var** stat_pointer; /* pointer to the memory location
+								(where a counter handle will be stored)
+								Note: it's a double pointer because of
+								the original k version which needed it
+								allocated in shm. This version
+								will store the counter id at *stat_pointer.
+							  */
+};
+
+typedef struct stat_export_s stat_export_t;
+
+
+#endif /*__kstats_types_h*/
+
+/* vi: set ts=4 sw=4 tw=79:ai:cindent: */

+ 3 - 24
lib/kcore/kstats_wrapper.h

@@ -35,12 +35,15 @@
  * History:
  * History:
  * --------
  * --------
  *  2010-08-08  initial version (andrei)
  *  2010-08-08  initial version (andrei)
+ *  2010-08-18  type declaration needed by sr_module.c moved to
+ *               ../../kstats_types.h (andrei)
 */
 */
 
 
 #ifndef __kstats_wrapper_h
 #ifndef __kstats_wrapper_h
 #define __kstats_wrapper_h
 #define __kstats_wrapper_h
 
 
 #include "../../counters.h"
 #include "../../counters.h"
+#include "../../kstats_types.h"
 
 
 /* k stat flags */
 /* k stat flags */
 #define STAT_NO_RESET	1  /* used in dialog(k), nat_traversal(k),
 #define STAT_NO_RESET	1  /* used in dialog(k), nat_traversal(k),
@@ -49,31 +52,7 @@
 #define STAT_SHM_NAME	4 /* used only from usrloc(k) */
 #define STAT_SHM_NAME	4 /* used only from usrloc(k) */
 #define STAT_IS_FUNC	8
 #define STAT_IS_FUNC	8
 
 
-/* types */
 
 
-typedef counter_val_t    stat_val;
-/* stat_var is always used as a pointer in k, we missuse
-   stat_var* for holding out counter id */
-typedef void stat_var;
-/* get val callback
- * TODO: change it to counter_cbk_f compatible callback?
- */
-typedef counter_val_t (*stat_function)(void);
-
-/* statistic module interface */
-struct stat_export_s {
-	char* name;
-	int flags;
-	stat_var** stat_pointer; /* pointer to the memory location
-								(where a counter handle will be stored)
-								Note: it's a double pointer because of
-								the original k version which needed it
-								allocated in shm. This version
-								will store the counter id at *stat_pointer.
-							  */
-};
-
-typedef struct stat_export_s stat_export_t;
 
 
 #ifdef STATISTICS
 #ifdef STATISTICS
 
 

+ 1 - 1
sr_module.h

@@ -68,7 +68,7 @@
 #include "str.h"
 #include "str.h"
 
 
 /* kamailio compat */
 /* kamailio compat */
-#include "statistics.h"
+#include "kstats_types.h"
 #include "mi/mi_types.h"
 #include "mi/mi_types.h"
 #include "pvar.h"
 #include "pvar.h"
 
 

+ 0 - 33
statistics.h

@@ -1,33 +0,0 @@
-/*
- * $Id$
- *
- * Copyright (C) 2008 iptelorg GmbH
- *
- * Permission to use, copy, modify, and distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-/*
- * statistics compatibility wrapper for kamailio
- * for now it doesn't do anything
- * (obsolete, do not use anymore)
- *
- * History:
- * --------
- *  2008-11-17  initial version compatible with kamailio statistics.h (andrei)
- */
-
-#ifndef _STATISTICS_H_
-#define _STATISTICS_H_
-
-#include "lib/kcore/statistics.h"
-
-#endif /* _STATISTICS_H_ */