6 #include "struct.h" /* Needed for HOSTLEN */
11 /*=============================================================================
15 #define Debug(x) debug x
19 * defined debugging levels
22 #define DEBUG_ERROR 1 /* report_error() and other
23 errors that are found */
24 #define DEBUG_NOTICE 3
25 #define DEBUG_DNS 4 /* used by all DNS related routines - a *lot* */
26 #define DEBUG_INFO 5 /* general usful info */
27 #define DEBUG_NUM 6 /* numerics */
28 #define DEBUG_SEND 7 /* everything that is sent out */
29 #define DEBUG_DEBUG 8 /* anything to do with debugging,
31 #define DEBUG_MALLOC 9 /* malloc/free calls */
32 #define DEBUG_LIST 10 /* debug list use */
34 /*=============================================================================
38 extern void vdebug(int level, const char *form, va_list vl);
39 extern void debug(int level, const char *form, ...)
40 __attribute__ ((format(printf, 2, 3)));
41 extern void send_usage(aClient *cptr, char *nick);
43 #else /* !DEBUGMODE */
46 #define LOGFILE "/dev/null"
48 #endif /* !DEBUGMODE */
50 extern void count_memory(aClient *cptr, char *nick);
51 extern char serveropts[];
53 /*=============================================================================
54 * Message logging service
58 * Message levels: these are inclusive, i.e. a message that is LEVEL_MAP
59 * affects also clients and channels and is propagated and needs a query of
60 * some status, and therefore belongs to all the classes, in the same way
61 * _every_ message is parsed so belongs to LEVEL_PARSED
64 /* Messages that affect servers' map */
67 /* Messages that affect clients existance */
68 #define LEVEL_CLIENT 5
70 /* Messages that affect channel existance */
71 #define LEVEL_CHANNEL 4
73 /* Messages that affect channel modes */
76 /* Messages that are only to be propagated somewhere */
77 #define LEVEL_PROPAGATE 2
80 * Messages that only perform queries
81 * note how every message may need some status query over data structs
82 * and at the same time every query might need to be propagated
83 * somewhere... so the distinction between levels PROPAGATE and
84 * QUERY is quite fuzzy
88 /* Messages that only perform queries */
89 #define LEVEL_PARSED 0
93 /*=============================================================================
97 #define LogMessage(x) Log_Message x
98 #define StoreBuffer(x) Store_Buffer x
100 /* Logging mask, selection on type of connection */
101 #define LOG_PING (0x8000 >> (8 + STAT_PING))
102 #define LOG_LOG (0x8000 >> (8 + STAT_LOG))
103 #define LOG_MASTER (0x8000 >> (8 + STAT_MASTER))
104 #define LOG_CONNECTING (0x8000 >> (8 + STAT_CONNECTING))
105 #define LOG_HANDSHAKE (0x8000 >> (8 + STAT_HANDSHAKE))
106 #define LOG_ME (0x8000 >> (8 + STAT_ME))
107 #define LOG_UNKNOWN (0x8000 >> (8 + STAT_UNKNOWN))
108 #define LOG_SERVER (0x8000 >> (8 + STAT_SERVER))
109 #define LOG_CLIENT (0x8000 >> (8 + STAT_USER))
112 * Define here the type of connection(s) that will be monitored.
113 * Default is to log messages coming from any connection.
115 #define LOG_MASK_TYPE \
116 ( LOG_PING | LOG_LOG | LOG_MASTER | LOG_CONNECTING | \
117 LOG_HANDSHAKE | LOG_ME | LOG_UNKNOWN | LOG_SERVER | LOG_CLIENT )
119 /*=============================================================================
125 char cptr_name[HOSTLEN + 1];
130 char sptr_name[HOSTLEN + 1];
132 char sptr_from_name[HOSTLEN + 1];
136 /* The following may be lost before log gets used,
137 anyhow they are only here for usage through gdb */
143 /*=============================================================================
147 extern void Log_Message(aClient *sptr, int msgclass);
148 extern void Store_Buffer(char *buf, aClient *cptr);
150 #else /* !MSGLOG_ENABLED */
152 #define LogMessage(x)
153 #define StoreBuffer(x)
155 #endif /* !MSGLOG_ENABLED */
157 #endif /* S_DEBUG_H */