2004-01-28 20:02:12 -05:00
|
|
|
/* Icecast
|
|
|
|
*
|
|
|
|
* This program is distributed under the GNU General Public License, version 2.
|
|
|
|
* A copy of this license is included with this source.
|
|
|
|
*
|
|
|
|
* Copyright 2000-2004, Jack Moffitt <jack@xiph.org,
|
|
|
|
* Michael Smith <msmith@xiph.org>,
|
|
|
|
* oddsock <oddsock@xiph.org>,
|
|
|
|
* Karl Heyes <karl@xiph.org>
|
|
|
|
* and others (see AUTHORS for details).
|
|
|
|
*/
|
|
|
|
|
2001-09-09 22:21:46 -04:00
|
|
|
#ifndef __STATS_H__
|
|
|
|
#define __STATS_H__
|
|
|
|
|
2002-02-11 04:11:18 -05:00
|
|
|
#include "connection.h"
|
2003-07-16 15:41:59 -04:00
|
|
|
#include "httpp/httpp.h"
|
2002-02-11 04:11:18 -05:00
|
|
|
#include "client.h"
|
2002-08-09 02:52:07 -04:00
|
|
|
#include <libxml/xmlmemory.h>
|
|
|
|
#include <libxml/parser.h>
|
|
|
|
#include <libxml/tree.h>
|
|
|
|
|
2002-02-11 04:11:18 -05:00
|
|
|
|
2001-09-09 22:21:46 -04:00
|
|
|
typedef struct _stats_node_tag
|
|
|
|
{
|
2003-03-14 21:10:19 -05:00
|
|
|
char *name;
|
|
|
|
char *value;
|
2004-11-22 13:21:48 -05:00
|
|
|
int hidden;
|
2001-09-09 22:21:46 -04:00
|
|
|
} stats_node_t;
|
|
|
|
|
|
|
|
typedef struct _stats_event_tag
|
|
|
|
{
|
2003-03-14 21:10:19 -05:00
|
|
|
char *source;
|
|
|
|
char *name;
|
|
|
|
char *value;
|
2004-11-22 13:21:48 -05:00
|
|
|
int hidden;
|
2004-10-25 10:03:42 -04:00
|
|
|
int action;
|
2001-09-09 22:21:46 -04:00
|
|
|
|
2003-03-14 21:10:19 -05:00
|
|
|
struct _stats_event_tag *next;
|
2001-09-09 22:21:46 -04:00
|
|
|
} stats_event_t;
|
|
|
|
|
|
|
|
typedef struct _stats_source_tag
|
|
|
|
{
|
2003-03-14 21:10:19 -05:00
|
|
|
char *source;
|
2004-11-22 13:21:48 -05:00
|
|
|
int hidden;
|
2003-03-14 21:10:19 -05:00
|
|
|
avl_tree *stats_tree;
|
2001-09-09 22:21:46 -04:00
|
|
|
} stats_source_t;
|
|
|
|
|
|
|
|
typedef struct _stats_tag
|
|
|
|
{
|
2003-03-14 21:10:19 -05:00
|
|
|
avl_tree *global_tree;
|
|
|
|
|
|
|
|
/* global stats
|
|
|
|
start_time
|
|
|
|
total_users
|
|
|
|
max_users
|
|
|
|
total_sources
|
|
|
|
max_sources
|
|
|
|
total_user_connections
|
|
|
|
total_source_connections
|
|
|
|
*/
|
|
|
|
|
|
|
|
avl_tree *source_tree;
|
|
|
|
|
|
|
|
/* stats by source, and for stats
|
|
|
|
start_time
|
|
|
|
total_users
|
|
|
|
max_users
|
|
|
|
*/
|
2001-09-09 22:21:46 -04:00
|
|
|
|
|
|
|
} stats_t;
|
|
|
|
|
|
|
|
void stats_initialize();
|
|
|
|
void stats_shutdown();
|
|
|
|
|
|
|
|
stats_t *stats_get_stats();
|
|
|
|
|
2004-10-25 10:03:42 -04:00
|
|
|
void stats_event(const char *source, const char *name, const char *value);
|
|
|
|
void stats_event_args(const char *source, char *name, char *format, ...);
|
|
|
|
void stats_event_inc(const char *source, const char *name);
|
|
|
|
void stats_event_add(const char *source, const char *name, unsigned long value);
|
|
|
|
void stats_event_dec(const char *source, const char *name);
|
2004-11-22 13:21:48 -05:00
|
|
|
void stats_event_hidden (const char *source, const char *name, int hidden);
|
2001-09-09 22:21:46 -04:00
|
|
|
|
|
|
|
void *stats_connection(void *arg);
|
2002-02-06 01:11:03 -05:00
|
|
|
void *stats_callback(void *arg);
|
2001-09-09 22:21:46 -04:00
|
|
|
|
2002-08-09 02:52:07 -04:00
|
|
|
void stats_transform_xslt(client_t *client, char *xslpath);
|
2001-09-09 22:21:46 -04:00
|
|
|
void stats_sendxml(client_t *client);
|
2004-11-22 13:21:48 -05:00
|
|
|
void stats_get_xml(xmlDocPtr *doc, int show_hidden);
|
2003-02-02 09:25:53 -05:00
|
|
|
char *stats_get_value(char *source, char *name);
|
2001-09-09 22:21:46 -04:00
|
|
|
|
|
|
|
#endif /* __STATS_H__ */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|