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