]> jfr.im git - irc/quakenet/snircd.git/blame - include/s_misc.h
forward port of asuka-check.patch to .12
[irc/quakenet/snircd.git] / include / s_misc.h
CommitLineData
189935b1 1/** @file s_misc.h
2 * @brief Miscellaneous support functions and declarations.
3 * @version $Id: s_misc.h,v 1.10 2005/06/27 13:11:52 entrope Exp $
4 */
5#ifndef INCLUDED_s_misc_h
6#define INCLUDED_s_misc_h
7#ifndef INCLUDED_stdarg_h
8#include <stdarg.h> /* va_list */
9#define INCLUDED_stdarg_h
10#endif
11#ifndef INCLUDED_sys_types_h
12#include <sys/types.h> /* time_t */
13#define INCLUDED_sys_types_h
14#endif
15
16
17struct Client;
18struct StatDesc;
19struct ConfItem;
20
21/*-----------------------------------------------------------------------------
22 * Macros
23 */
24
25/** Return value from various functions to indicate the source has
26 * been disconnected. */
27#define CPTR_KILLED -2
28
29/*
30 * Structures
31 */
32
33#ifdef HAVE_INTTYPES_H
34# ifndef INCLUDED_inttypes_h
35# include <inttypes.h>
36# define INCLUDED_inttypes_h
37# endif
38#else
39# ifdef HAVE_STDINT_H
40# ifndef INCLUDED_stdint_h
41# include <stdint.h>
42# define INCLUDED_stdint_h
43# endif
44# endif
45#endif
46
47/** Structure used to count many server-wide statistics. */
48struct ServerStatistics {
49 unsigned int is_cl; /**< number of client connections */
50 unsigned int is_sv; /**< number of server connections */
51 unsigned int is_ni; /**< connection but no idea who it was */
52 uint64_t is_cbs; /**< bytes sent to clients */
53 uint64_t is_cbr; /**< bytes received to clients */
54 uint64_t is_sbs; /**< bytes sent to servers */
55 uint64_t is_sbr; /**< bytes received to servers */
56 uint64_t is_cti; /**< time spent connected by clients */
57 uint64_t is_sti; /**< time spent connected by servers */
58 unsigned int is_ac; /**< connections accepted */
59 unsigned int is_ref; /**< accepts refused */
60 unsigned int is_unco; /**< unknown commands */
61 unsigned int is_wrdi; /**< command going in wrong direction */
62 unsigned int is_unpf; /**< unknown prefix */
63 unsigned int is_empt; /**< empty message */
64 unsigned int is_num; /**< numeric message */
65 unsigned int is_kill; /**< number of kills generated on collisions */
66 unsigned int is_fake; /**< MODE 'fakes' */
67 unsigned int is_asuc; /**< successful auth requests */
68 unsigned int is_abad; /**< bad auth requests */
69 unsigned int is_loc; /**< local connections made */
70 unsigned int uping_recv; /**< UDP Pings received */
71};
72
73/*
74 * Prototypes
75 */
76
77extern int check_registered(struct Client *sptr);
78extern int check_registered_user(struct Client *sptr);
79extern int exit_client(struct Client *cptr, struct Client *bcptr,
80 struct Client *sptr, const char *comment);
81extern char *myctime(time_t value);
82extern int exit_client_msg(struct Client *cptr, struct Client *bcptr,
83 struct Client *sptr, const char *pattern, ...);
84extern void initstats(void);
85extern char *date(time_t clock);
86extern int vexit_client_msg(struct Client *cptr, struct Client *bcptr,
87 struct Client *sptr, const char *pattern, va_list vl);
88extern void tstats(struct Client *cptr, const struct StatDesc *sd,
89 char *param);
90
91extern struct ServerStatistics* ServerStats;
92
93#endif /* INCLUDED_s_misc_h */
94