diff --git a/smmapdfw/libsmmapdfw/Makefile.am b/smmapdfw/libsmmapdfw/Makefile.am index fd72e73..09e5e19 100644 --- a/smmapdfw/libsmmapdfw/Makefile.am +++ b/smmapdfw/libsmmapdfw/Makefile.am @@ -1,5 +1,5 @@ -include_HEADERS=containers_public.h queue.h smtp.h cfg.h count.h safe_write.h sunos_comp.h htdns.h smmapd.h htmalloc.h +include_HEADERS=containers_public.h queue.h smtp.h cfg.h count.h safe_write.h sunos_comp.h htdns.h smmapd.h htmalloc.h stats.h lib_LTLIBRARIES = libsmmapdfw.la -libsmmapdfw_la_SOURCES = cfg.c queue.c count.c safe_write.c config_public.c htdns.c smtp.c htmalloc.c +libsmmapdfw_la_SOURCES = cfg.c queue.c count.c safe_write.c config_public.c htdns.c smtp.c htmalloc.c stats.c diff --git a/smmapdfw/libsmmapdfw/stats.c b/smmapdfw/libsmmapdfw/stats.c new file mode 100644 index 0000000..78f1a8c --- /dev/null +++ b/smmapdfw/libsmmapdfw/stats.c @@ -0,0 +1,46 @@ +/* + Copyright (C) 2004, Wolfgang Hottgenroth + + This file is part of smmapdfw. + + smmapdfw is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + smmapdfw is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with smmapdfw. If not, write to the Free Software Foundation, 59 + Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + + +#include + +#include "stats.h" + +count_t statCounter[STAT_CNT_MAXNUM]; + + +void initStatCounter() { + int i; + + for (i=0; i= 0) && (cnt_idx < STAT_CNT_MAXNUM)); + return count_get(&statCounter[cnt_idx]); +} + +void incStatCounter(int cnt_idx) { + assert((cnt_idx >= 0) && (cnt_idx < STAT_CNT_MAXNUM)); + count_inc(&statCounter[cnt_idx]); +} + diff --git a/smmapdfw/libsmmapdfw/stats.h b/smmapdfw/libsmmapdfw/stats.h new file mode 100644 index 0000000..0c46b6d --- /dev/null +++ b/smmapdfw/libsmmapdfw/stats.h @@ -0,0 +1,40 @@ +/* + Copyright (C) 2004, Wolfgang Hottgenroth + + This file is part of smmapdfw. + + smmapdfw is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + smmapdfw is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public + License for more details. + + You should have received a copy of the GNU General Public License + along with smmapdfw. If not, write to the Free Software Foundation, 59 + Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + + +#ifndef _STATS_H +#define _STATS_H + + +#define STAT_CNT_ACCEPTED 0 +#define STAT_CNT_FAILED 1 +#define STAT_CNT_OK_RETURNED 2 +#define STAT_CNT_PERM_RETURNED 3 +#define STAT_CNT_TEMP_RETURNED 4 +#define STAT_CNT_NOTFOUND_RETURNED 5 +#define STAT_CNT_CLASS_NOT_FOUND_FAILURE 6 +#define STAT_CNT_NETSTRING_FAILURE 7 +#define STAT_CNT_MAXNUM 8 + +void initStatCounter(); +unsigned int getStatCounter(int cnt_idx); +void incStatCounter(int cnt_idx); + +#endif _STATS_H_