ircu2.10.12 pk910 fork
[ircu2.10.12-pk.git] / include / s_misc.h
1 /** @file s_misc.h
2  * @brief Miscellaneous support functions and declarations.
3  * @version $Id: s_misc.h 1436 2005-06-27 13:11:52Z entrope $
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
17 struct Client;
18 struct StatDesc;
19 struct 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. */
48 struct 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
77 extern int check_registered(struct Client *sptr);
78 extern int check_registered_user(struct Client *sptr);
79 extern int exit_client(struct Client *cptr, struct Client *bcptr,
80     struct Client *sptr, const char *comment);
81 extern char *myctime(time_t value);
82 extern int exit_client_msg(struct Client *cptr, struct Client *bcptr,
83                            struct Client *sptr, const char *pattern, ...);
84 extern void initstats(void);
85 extern char *date(time_t clock);
86 extern int vexit_client_msg(struct Client *cptr, struct Client *bcptr,
87     struct Client *sptr, const char *pattern, va_list vl);
88 extern void tstats(struct Client *cptr, const struct StatDesc *sd,
89                    char *param);
90
91 extern struct ServerStatistics* ServerStats;
92
93 #endif /* INCLUDED_s_misc_h */
94