/* * * $Id: sl_stats.c,v 1.12 2004/08/24 09:00:38 janakj Exp $ * * * Copyright (C) 2001-2003 FhG Fokus * * This file is part of ser, a free SIP server. * * ser 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 * * For a license to use the ser software under conditions * other than those described here, or to purchase support for this * software, please contact iptel.org by e-mail at the following addresses: * info@iptel.org * * ser 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 this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "../../mem/shm_mem.h" #include "../../globals.h" #include "../../fifo_server.h" #include "../../unixsock_server.h" #include "../../config.h" #include "../../pt.h" #include "sl_stats.h" #include #include static struct sl_stats *sl_stats; static void add_sl_stats( struct sl_stats *t, struct sl_stats *i) { enum reply_type rt; for (rt=0; rterr[rt]+=i->err[rt]; t->failures+=i->failures; } static int print_sl_stats(FILE *reply_file) { struct sl_stats total; int p; memset(&total, 0, sizeof(struct sl_stats)); if (dont_fork) { add_sl_stats(&total, &sl_stats[0]); } else for (p=0; p=700 || code <200 ) { my_stats->err[RT_xxx]++; } else if (code>=600) { my_stats->err[RT_6xx]++; } else if (code>=500) { switch(code) { case 500: my_stats->err[RT_500]++; break; default: my_stats->err[RT_5xx]++; break; } } else if (code>=400) { switch(code) { case 400: my_stats->err[RT_400]++; break; case 401: my_stats->err[RT_401]++; break; case 403: my_stats->err[RT_403]++; break; case 404: my_stats->err[RT_404]++; break; case 407: my_stats->err[RT_407]++; break; case 408: my_stats->err[RT_408]++; break; case 483: my_stats->err[RT_483]++; break; default: my_stats->err[RT_4xx]++; break; } } else if (code>=300) { switch(code) { case 300: my_stats->err[RT_300]++; break; case 301: my_stats->err[RT_301]++; break; case 302: my_stats->err[RT_302]++; break; default: my_stats->err[RT_3xx]++; break; } } else { /* 2xx */ switch(code) { case 200: my_stats->err[RT_200]++; break; case 202: my_stats->err[RT_202]++; break; default: my_stats->err[RT_2xx]++; break; } } }