Imported Upstream version 2.7
[ossec-hids.git] / src / headers / debug_op.h
1 /* @(#) $Id: ./src/headers/debug_op.h, 2011/09/08 dcid Exp $
2  */
3
4 /* Copyright (C) 2009 Trend Micro Inc.
5  * All right reserved.
6  *
7  * This program is a free software; you can redistribute it
8  * and/or modify it under the terms of the GNU General Public
9  * License (version 2) as published by the FSF - Free Software
10  * Foundation
11  */
12
13
14 /* Part of the OSSEC HIDS
15  * Available at http://www.ossec.net
16  */
17
18 /* Functions to generate debug/verbose/err reports.
19  * Right now, we have two debug levels: 1,2,
20  * a verbose mode and a error (merror) function.
21  * To see these messages, use the "-d","-v" options
22  * (or "-d" twice to see debug2). The merror is printed
23  * by default when an important error occur.
24  * */
25
26 #ifndef __DEBUG_H
27
28 #define __DEBUG_H
29
30 #ifndef __GNUC__
31 #define __attribute__(x)
32 #endif
33
34 void debug1(const char *msg,...) __attribute__((format(printf, 1, 2)));
35
36 void debug2(const char *msg,...) __attribute__((format(printf, 1, 2)));
37
38 void merror(const char *msg,...) __attribute__((format(printf, 1, 2)));
39
40 void verbose(const char *msg,...) __attribute__((format(printf, 1, 2)));
41
42 void print_out(const char *msg,...) __attribute__((format(printf, 1, 2)));
43
44 void log2file(const char * msg,... ) __attribute__((format(printf, 1, 2)));
45
46 void ErrorExit(const char *msg,...) __attribute__((format(printf, 1, 2)));
47
48
49 /* Use these three functions to set when you
50  * enter in debug, chroot or daemon mode
51  */
52 void nowDebug();
53
54 void nowChroot();
55
56 void nowDaemon();
57
58 int isChroot();
59
60 /* Debug analysisd */
61 #ifdef DEBUGAD
62     #define DEBUG_MSG(x,y,z) verbose(x,y,z)
63 #else
64     #define DEBUG_MSG(x,y,z)
65 #endif /* end debug analysisd */
66
67 #endif