xref: /illumos-gate/usr/src/lib/libldap5/include/ldap/ldaplog.h (revision 9c72db81a69bf1ea2a220c7cfc40eb0ef089be8c)
1 /*
2  * The contents of this file are subject to the Netscape Public
3  * License Version 1.1 (the "License"); you may not use this file
4  * except in compliance with the License. You may obtain a copy of
5  * the License at http://www.mozilla.org/NPL/
6  *
7  * Software distributed under the License is distributed on an "AS
8  * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
9  * implied. See the License for the specific language governing
10  * rights and limitations under the License.
11  *
12  * The Original Code is Mozilla Communicator client code, released
13  * March 31, 1998.
14  *
15  * The Initial Developer of the Original Code is Netscape
16  * Communications Corporation. Portions created by Netscape are
17  * Copyright (C) 1998-1999 Netscape Communications Corporation. All
18  * Rights Reserved.
19  *
20  * Contributor(s):
21  */
22 
23 #ifndef _LDAPLOG_H
24 #define _LDAPLOG_H
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 #define LDAP_DEBUG_TRACE	0x00001
31 #define LDAP_DEBUG_PACKETS	0x00002
32 #define LDAP_DEBUG_ARGS		0x00004
33 #define LDAP_DEBUG_CONNS	0x00008
34 #define LDAP_DEBUG_BER		0x00010
35 #define LDAP_DEBUG_FILTER	0x00020
36 #define LDAP_DEBUG_CONFIG	0x00040
37 #define LDAP_DEBUG_ACL		0x00080
38 #define LDAP_DEBUG_STATS	0x00100
39 #define LDAP_DEBUG_STATS2	0x00200
40 #define LDAP_DEBUG_SHELL	0x00400
41 #define LDAP_DEBUG_PARSE	0x00800
42 #define LDAP_DEBUG_HOUSE        0x01000
43 #define LDAP_DEBUG_REPL         0x02000
44 #define LDAP_DEBUG_ANY          0x04000
45 #define LDAP_DEBUG_CACHE        0x08000
46 #define LDAP_DEBUG_PLUGIN	0x10000
47 
48 /* debugging stuff */
49 /* Disable by default */
50 #define LDAPDebug( level, fmt, arg1, arg2, arg3 )
51 
52 #ifdef LDAP_DEBUG
53 #  undef LDAPDebug
54 
55 /* SLAPD_LOGGING should not be on for WINSOCK (16-bit Windows) */
56 #  if defined(SLAPD_LOGGING)
57 #    ifdef _WIN32
58        extern int	*module_ldap_debug;
59 #      define LDAPDebug( level, fmt, arg1, arg2, arg3 )	\
60        { \
61 		if ( *module_ldap_debug & level ) { \
62 		        slapd_log_error_proc( NULL, fmt, arg1, arg2, arg3 ); \
63 	    } \
64        }
65 #    else /* _WIN32 */
66        extern int	ldap_debug;
67 #      define LDAPDebug( level, fmt, arg1, arg2, arg3 )	\
68        { \
69 		if ( ldap_debug & level ) { \
70 		        slapd_log_error_proc( NULL, fmt, arg1, arg2, arg3 ); \
71 	    } \
72        }
73 #    endif /* Win32 */
74 #  else /* no SLAPD_LOGGING */
75      extern void ber_err_print( char * );
76      extern int	ldap_debug;
77 #    define LDAPDebug( level, fmt, arg1, arg2, arg3 ) \
78 		if ( ldap_debug & level ) { \
79 			char msg[256]; \
80 			sprintf( msg, fmt, arg1, arg2, arg3 ); \
81 			ber_err_print( msg ); \
82 		}
83 #  endif /* SLAPD_LOGGING */
84 #endif /* LDAP_DEBUG */
85 
86 #ifdef __cplusplus
87 }
88 #endif
89 
90 #endif /* _LDAP_H */
91