Module: sip-router Branch: master Commit: 742ce3ae28a4d1294ce0b7f63f0bc0968bff8ea3 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=742ce3ae...
Author: Andrei Pelinescu-Onciul andrei@iptel.org Committer: Andrei Pelinescu-Onciul andrei@iptel.org Date: Wed Aug 18 20:01:31 2010 +0200
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).
---
kstats_types.h | 69 ++++++++++++++++++++++++++++++++++++++++++++ lib/kcore/kstats_wrapper.h | 27 ++--------------- sr_module.h | 2 +- statistics.h | 33 --------------------- 4 files changed, 73 insertions(+), 58 deletions(-)
diff --git a/kstats_types.h b/kstats_types.h new file mode 100644 index 0000000..b8d1629 --- /dev/null +++ b/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: */ diff --git a/lib/kcore/kstats_wrapper.h b/lib/kcore/kstats_wrapper.h index 1d6ba47..1c9559b 100644 --- a/lib/kcore/kstats_wrapper.h +++ b/lib/kcore/kstats_wrapper.h @@ -35,12 +35,15 @@ * History: * -------- * 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 #define __kstats_wrapper_h
#include "../../counters.h" +#include "../../kstats_types.h"
/* k stat flags */ #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_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
diff --git a/sr_module.h b/sr_module.h index baf1081..4d32514 100644 --- a/sr_module.h +++ b/sr_module.h @@ -68,7 +68,7 @@ #include "str.h"
/* kamailio compat */ -#include "statistics.h" +#include "kstats_types.h" #include "mi/mi_types.h" #include "pvar.h"
diff --git a/statistics.h b/statistics.h deleted file mode 100644 index e9e430a..0000000 --- a/statistics.h +++ /dev/null @@ -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_ */