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