X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=include%2Fs_debug.h;h=5bdf57e8109641d0f952661edbbd57b5f76a98cc;hb=refs%2Fheads%2Fupstream-ssl;hp=80872a119d54d185dc2327ebf6d8c77f8d62317e;hpb=b70944c4b84fc2b707d0853ddf03975569dac2bd;p=ircu2.10.12-pk.git diff --git a/include/s_debug.h b/include/s_debug.h index 80872a1..5bdf57e 100644 --- a/include/s_debug.h +++ b/include/s_debug.h @@ -1,44 +1,57 @@ -#ifndef S_DEBUG_H -#define S_DEBUG_H - +/* @file s_debug.h + * @brief Debug APIs for the ircd. + * @version $Id$ + */ +#ifndef INCLUDED_s_debug_h +#define INCLUDED_s_debug_h +#ifndef INCLUDED_config_h +#include "config.h" /* Needed for DEBUGMODE */ +#endif +#ifndef INCLUDED_ircd_defs_h +#include "ircd_defs.h" /* Needed for HOSTLEN */ +#endif +#ifndef INCLUDED_stdarg_h #include -#ifdef MSGLOG_ENABLED -#include "struct.h" /* Needed for HOSTLEN */ +#define INCLUDED_stdarg_h #endif +struct Client; +struct StatDesc; + #ifdef DEBUGMODE -/*============================================================================= +/* * Macro's */ +/** If DEBUGMODE is defined, output the debug message. + * @param x A two-or-more element list containing level, format and arguments. + */ #define Debug(x) debug x -#define LOGFILE LPATH +#define LOGFILE LPATH /**< Path to debug log file. */ /* * defined debugging levels */ -#define DEBUG_FATAL 0 -#define DEBUG_ERROR 1 /* report_error() and other - errors that are found */ -#define DEBUG_NOTICE 3 -#define DEBUG_DNS 4 /* used by all DNS related routines - a *lot* */ -#define DEBUG_INFO 5 /* general usful info */ -#define DEBUG_NUM 6 /* numerics */ -#define DEBUG_SEND 7 /* everything that is sent out */ -#define DEBUG_DEBUG 8 /* anything to do with debugging, - ie unimportant :) */ -#define DEBUG_MALLOC 9 /* malloc/free calls */ -#define DEBUG_LIST 10 /* debug list use */ +#define DEBUG_FATAL 0 /**< fatal error */ +#define DEBUG_ERROR 1 /**< report_error() and other errors that are found */ +#define DEBUG_NOTICE 3 /**< somewhat useful, but non-critical, messages */ +#define DEBUG_DNS 4 /**< used by all DNS related routines - a *lot* */ +#define DEBUG_INFO 5 /**< general useful info */ +#define DEBUG_SEND 7 /**< everything that is sent out */ +#define DEBUG_DEBUG 8 /**< everything that is received */ +#define DEBUG_MALLOC 9 /**< malloc/free calls */ +#define DEBUG_LIST 10 /**< debug list use */ +#define DEBUG_ENGINE 11 /**< debug event engine; can dump gigabyte logs */ -/*============================================================================= +/* * proto types */ extern void vdebug(int level, const char *form, va_list vl); -extern void debug(int level, const char *form, ...) - __attribute__ ((format(printf, 2, 3))); -extern void send_usage(aClient *cptr, char *nick); +extern void debug(int level, const char *form, ...); +extern void send_usage(struct Client *cptr, const struct StatDesc *sd, + char *param); #else /* !DEBUGMODE */ @@ -47,111 +60,9 @@ extern void send_usage(aClient *cptr, char *nick); #endif /* !DEBUGMODE */ -extern void count_memory(aClient *cptr, char *nick); -extern char serveropts[]; - -/*============================================================================= - * Message logging service - */ - -/* - * Message levels: these are inclusive, i.e. a message that is LEVEL_MAP - * affects also clients and channels and is propagated and needs a query of - * some status, and therefore belongs to all the classes, in the same way - * _every_ message is parsed so belongs to LEVEL_PARSED - */ - -/* Messages that affect servers' map */ -#define LEVEL_MAP 6 - -/* Messages that affect clients existance */ -#define LEVEL_CLIENT 5 - -/* Messages that affect channel existance */ -#define LEVEL_CHANNEL 4 - -/* Messages that affect channel modes */ -#define LEVEL_MODE 3 - -/* Messages that are only to be propagated somewhere */ -#define LEVEL_PROPAGATE 2 - -/* - * Messages that only perform queries - * note how every message may need some status query over data structs - * and at the same time every query might need to be propagated - * somewhere... so the distinction between levels PROPAGATE and - * QUERY is quite fuzzy - */ -#define LEVEL_QUERY 1 - -/* Messages that only perform queries */ -#define LEVEL_PARSED 0 - -#ifdef MSGLOG_ENABLED - -/*============================================================================= - * Macro's - */ - -#define LogMessage(x) Log_Message x -#define StoreBuffer(x) Store_Buffer x - -/* Logging mask, selection on type of connection */ -#define LOG_PING (0x8000 >> (8 + STAT_PING)) -#define LOG_LOG (0x8000 >> (8 + STAT_LOG)) -#define LOG_MASTER (0x8000 >> (8 + STAT_MASTER)) -#define LOG_CONNECTING (0x8000 >> (8 + STAT_CONNECTING)) -#define LOG_HANDSHAKE (0x8000 >> (8 + STAT_HANDSHAKE)) -#define LOG_ME (0x8000 >> (8 + STAT_ME)) -#define LOG_UNKNOWN (0x8000 >> (8 + STAT_UNKNOWN)) -#define LOG_SERVER (0x8000 >> (8 + STAT_SERVER)) -#define LOG_CLIENT (0x8000 >> (8 + STAT_USER)) - -/* - * Define here the type of connection(s) that will be monitored. - * Default is to log messages coming from any connection. - */ -#define LOG_MASK_TYPE \ - ( LOG_PING | LOG_LOG | LOG_MASTER | LOG_CONNECTING | \ - LOG_HANDSHAKE | LOG_ME | LOG_UNKNOWN | LOG_SERVER | LOG_CLIENT ) - -/*============================================================================= - * data structures - */ - -struct log_entry { - int cptr_status; - char cptr_name[HOSTLEN + 1]; - char cptr_yxx[3]; - int cptr_fd; - - int sptr_status; - char sptr_name[HOSTLEN + 1]; - char sptr_yxx[4]; - char sptr_from_name[HOSTLEN + 1]; - - char buffer[512]; - - /* The following may be lost before log gets used, - anyhow they are only here for usage through gdb */ - - aClient *cptr; - aClient *sptr; -}; - -/*============================================================================= - * proto types - */ - -extern void Log_Message(aClient *sptr, int msgclass); -extern void Store_Buffer(char *buf, aClient *cptr); - -#else /* !MSGLOG_ENABLED */ - -#define LogMessage(x) -#define StoreBuffer(x) - -#endif /* !MSGLOG_ENABLED */ +extern const char* debug_serveropts(void); +extern void debug_init(int use_tty); +extern void count_memory(struct Client *cptr, const struct StatDesc *sd, + char *param); -#endif /* S_DEBUG_H */ +#endif /* INCLUDED_s_debug_h */