2 * @brief Miscellaneous support functions and declarations.
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
11 #ifndef INCLUDED_sys_types_h
12 #include <sys/types.h> /* time_t */
13 #define INCLUDED_sys_types_h
21 /*-----------------------------------------------------------------------------
25 /** Return value from various functions to indicate the source has
26 * been disconnected. */
27 #define CPTR_KILLED -2
33 #ifdef HAVE_INTTYPES_H
34 # ifndef INCLUDED_inttypes_h
35 # include <inttypes.h>
36 # define INCLUDED_inttypes_h
40 # ifndef INCLUDED_stdint_h
42 # define INCLUDED_stdint_h
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 */
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,
91 extern struct ServerStatistics* ServerStats;
93 #endif /* INCLUDED_s_misc_h */