-#ifndef S_MISC_H
-#define S_MISC_H
-
-/*=============================================================================
- * General defines
+/** @file s_misc.h
+ * @brief Miscellaneous support functions and declarations.
+ * @version $Id$
*/
+#ifndef INCLUDED_s_misc_h
+#define INCLUDED_s_misc_h
+#ifndef INCLUDED_stdarg_h
+#include <stdarg.h> /* va_list */
+#define INCLUDED_stdarg_h
+#endif
+#ifndef INCLUDED_sys_types_h
+#include <sys/types.h> /* time_t */
+#define INCLUDED_sys_types_h
+#endif
+
+
+struct Client;
+struct StatDesc;
+struct ConfItem;
/*-----------------------------------------------------------------------------
- * Macro's
+ * Macros
*/
-#define CPTR_KILLED -2
+/** Return value from various functions to indicate the source has
+ * been disconnected. */
+#define CPTR_KILLED -2
-/*=============================================================================
+/*
* Structures
*/
-struct stats {
- unsigned int is_cl; /* number of client connections */
- unsigned int is_sv; /* number of server connections */
- unsigned int is_ni; /* connection but no idea who it was */
- unsigned short int is_cbs; /* bytes sent to clients */
- unsigned short int is_cbr; /* bytes received to clients */
- unsigned short int is_sbs; /* bytes sent to servers */
- unsigned short int is_sbr; /* bytes received to servers */
- unsigned int is_cks; /* k-bytes sent to clients */
- unsigned int is_ckr; /* k-bytes received to clients */
- unsigned int is_sks; /* k-bytes sent to servers */
- unsigned int is_skr; /* k-bytes received to servers */
- time_t is_cti; /* time spent connected by clients */
- time_t is_sti; /* time spent connected by servers */
- unsigned int is_ac; /* connections accepted */
- unsigned int is_ref; /* accepts refused */
- unsigned int is_unco; /* unknown commands */
- unsigned int is_wrdi; /* command going in wrong direction */
- unsigned int is_unpf; /* unknown prefix */
- unsigned int is_empt; /* empty message */
- unsigned int is_num; /* numeric message */
- unsigned int is_kill; /* number of kills generated on collisions */
- unsigned int is_fake; /* MODE 'fakes' */
- unsigned int is_asuc; /* successful auth requests */
- unsigned int is_abad; /* bad auth requests */
- unsigned int is_udp; /* packets recv'd on udp port */
- unsigned int is_loc; /* local connections made */
+#ifdef HAVE_INTTYPES_H
+# ifndef INCLUDED_inttypes_h
+# include <inttypes.h>
+# define INCLUDED_inttypes_h
+# endif
+#else
+# ifdef HAVE_STDINT_H
+# ifndef INCLUDED_stdint_h
+# include <stdint.h>
+# define INCLUDED_stdint_h
+# endif
+# endif
+#endif
+
+/** Structure used to count many server-wide statistics. */
+struct ServerStatistics {
+ unsigned int is_cl; /**< number of client connections */
+ unsigned int is_sv; /**< number of server connections */
+ unsigned int is_ni; /**< connection but no idea who it was */
+ uint64_t is_cbs; /**< bytes sent to clients */
+ uint64_t is_cbr; /**< bytes received to clients */
+ uint64_t is_sbs; /**< bytes sent to servers */
+ uint64_t is_sbr; /**< bytes received to servers */
+ uint64_t is_cti; /**< time spent connected by clients */
+ uint64_t is_sti; /**< time spent connected by servers */
+ unsigned int is_ac; /**< connections accepted */
+ unsigned int is_ref; /**< accepts refused */
+ unsigned int is_unco; /**< unknown commands */
+ unsigned int is_wrdi; /**< command going in wrong direction */
+ unsigned int is_unpf; /**< unknown prefix */
+ unsigned int is_empt; /**< empty message */
+ unsigned int is_num; /**< numeric message */
+ unsigned int is_kill; /**< number of kills generated on collisions */
+ unsigned int is_fake; /**< MODE 'fakes' */
+ unsigned int is_asuc; /**< successful auth requests */
+ unsigned int is_abad; /**< bad auth requests */
+ unsigned int is_loc; /**< local connections made */
+ unsigned int uping_recv; /**< UDP Pings received */
};
-/*=============================================================================
- * Proto types
+/*
+ * Prototypes
*/
-extern int check_registered(aClient *sptr);
-extern int check_registered_user(aClient *sptr);
-extern int exit_client(aClient *cptr, aClient *bcptr,
- aClient *sptr, char *comment);
+extern int check_registered(struct Client *sptr);
+extern int check_registered_user(struct Client *sptr);
+extern int exit_client(struct Client *cptr, struct Client *bcptr,
+ struct Client *sptr, const char *comment);
extern char *myctime(time_t value);
-extern char *get_client_name(aClient *sptr, int showip);
-extern int exit_client_msg(aClient *cptr, aClient *bcptr,
- aClient *sptr, char *pattern, ...) __attribute__ ((format(printf, 4, 5)));
+extern int exit_client_msg(struct Client *cptr, struct Client *bcptr,
+ struct Client *sptr, const char *pattern, ...);
extern void initstats(void);
extern char *date(time_t clock);
-extern char *get_client_host(aClient *cptr);
-extern void get_sockhost(aClient *cptr, char *host);
-extern char *my_name_for_link(char *name, aConfItem *aconf);
-extern int vexit_client_msg(aClient *cptr, aClient *bcptr,
- aClient *sptr, char *pattern, va_list vl);
-extern void checklist(void);
-extern void tstats(aClient *cptr, char *name);
+extern int vexit_client_msg(struct Client *cptr, struct Client *bcptr,
+ struct Client *sptr, const char *pattern, va_list vl);
+extern void tstats(struct Client *cptr, const struct StatDesc *sd,
+ char *param);
+
+extern struct ServerStatistics* ServerStats;
-extern struct stats *ircstp;
+#endif /* INCLUDED_s_misc_h */
-#endif /* S_MISC_H */