1*9e39c5baSBill Taylor /*
2*9e39c5baSBill Taylor  * CDDL HEADER START
3*9e39c5baSBill Taylor  *
4*9e39c5baSBill Taylor  * The contents of this file are subject to the terms of the
5*9e39c5baSBill Taylor  * Common Development and Distribution License (the "License").
6*9e39c5baSBill Taylor  * You may not use this file except in compliance with the License.
7*9e39c5baSBill Taylor  *
8*9e39c5baSBill Taylor  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*9e39c5baSBill Taylor  * or http://www.opensolaris.org/os/licensing.
10*9e39c5baSBill Taylor  * See the License for the specific language governing permissions
11*9e39c5baSBill Taylor  * and limitations under the License.
12*9e39c5baSBill Taylor  *
13*9e39c5baSBill Taylor  * When distributing Covered Code, include this CDDL HEADER in each
14*9e39c5baSBill Taylor  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*9e39c5baSBill Taylor  * If applicable, add the following below this CDDL HEADER, with the
16*9e39c5baSBill Taylor  * fields enclosed by brackets "[]" replaced with your own identifying
17*9e39c5baSBill Taylor  * information: Portions Copyright [yyyy] [name of copyright owner]
18*9e39c5baSBill Taylor  *
19*9e39c5baSBill Taylor  * CDDL HEADER END
20*9e39c5baSBill Taylor  */
21*9e39c5baSBill Taylor 
22*9e39c5baSBill Taylor /*
23*9e39c5baSBill Taylor  * Copyright (c) 2002-2003, Network Appliance, Inc. All rights reserved.
24*9e39c5baSBill Taylor  */
25*9e39c5baSBill Taylor 
26*9e39c5baSBill Taylor /*
27*9e39c5baSBill Taylor  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
28*9e39c5baSBill Taylor  * Use is subject to license terms.
29*9e39c5baSBill Taylor  */
30*9e39c5baSBill Taylor 
31*9e39c5baSBill Taylor /*
32*9e39c5baSBill Taylor  *
33*9e39c5baSBill Taylor  * HEADER: dapl_debug.h
34*9e39c5baSBill Taylor  *
35*9e39c5baSBill Taylor  * PURPOSE: defines common deuggging flags & data for the DAPL reference
36*9e39c5baSBill Taylor  * implemenation
37*9e39c5baSBill Taylor  *
38*9e39c5baSBill Taylor  * Description:
39*9e39c5baSBill Taylor  *
40*9e39c5baSBill Taylor  *
41*9e39c5baSBill Taylor  * $Id: dapl_debug.h,v 1.4 2003/07/31 13:55:18 hobie16 Exp $
42*9e39c5baSBill Taylor  */
43*9e39c5baSBill Taylor 
44*9e39c5baSBill Taylor #ifndef _DAPL_DEBUG_H_
45*9e39c5baSBill Taylor #define	_DAPL_DEBUG_H_
46*9e39c5baSBill Taylor 
47*9e39c5baSBill Taylor #ifdef __cplusplus
48*9e39c5baSBill Taylor extern "C" {
49*9e39c5baSBill Taylor #endif
50*9e39c5baSBill Taylor 
51*9e39c5baSBill Taylor /*
52*9e39c5baSBill Taylor  * Debug level switches
53*9e39c5baSBill Taylor  *
54*9e39c5baSBill Taylor  * Use these bits to enable various tracing/debug options. Each bit
55*9e39c5baSBill Taylor  * represents debugging in a particular subsystem or area of the code.
56*9e39c5baSBill Taylor  *
57*9e39c5baSBill Taylor  * The ERR bit should always be on unless someone disables it for a
58*9e39c5baSBill Taylor  * reason: The ERR flag is used sparingly and will print useful
59*9e39c5baSBill Taylor  * information if it fires.
60*9e39c5baSBill Taylor  */
61*9e39c5baSBill Taylor typedef enum
62*9e39c5baSBill Taylor {
63*9e39c5baSBill Taylor 	DAPL_DBG_TYPE_ERR		= 0x0001,
64*9e39c5baSBill Taylor 	DAPL_DBG_TYPE_WARN		= 0x0002,
65*9e39c5baSBill Taylor 	DAPL_DBG_TYPE_EVD		= 0x0004,
66*9e39c5baSBill Taylor 	DAPL_DBG_TYPE_CM		= 0x0008,
67*9e39c5baSBill Taylor 	DAPL_DBG_TYPE_EP		= 0x0010,
68*9e39c5baSBill Taylor 	DAPL_DBG_TYPE_UTIL		= 0x0020,
69*9e39c5baSBill Taylor 	DAPL_DBG_TYPE_CALLBACK		= 0x0040,
70*9e39c5baSBill Taylor 	DAPL_DBG_TYPE_DTO_COMP_ERR	= 0x0080,
71*9e39c5baSBill Taylor 	DAPL_DBG_TYPE_API		= 0x0100,
72*9e39c5baSBill Taylor 	DAPL_DBG_TYPE_RTN		= 0x0200,
73*9e39c5baSBill Taylor 	DAPL_DBG_TYPE_EXCEPTION		= 0x0400
74*9e39c5baSBill Taylor } DAPL_DBG_TYPE;
75*9e39c5baSBill Taylor 
76*9e39c5baSBill Taylor typedef enum
77*9e39c5baSBill Taylor {
78*9e39c5baSBill Taylor     DAPL_DBG_DEST_STDOUT  	= 0x0001,
79*9e39c5baSBill Taylor     DAPL_DBG_DEST_SYSLOG  	= 0x0002
80*9e39c5baSBill Taylor } DAPL_DBG_DEST;
81*9e39c5baSBill Taylor 
82*9e39c5baSBill Taylor 
83*9e39c5baSBill Taylor extern void dapl_internal_dbg_log(DAPL_DBG_TYPE type, const char *fmt,  ...);
84*9e39c5baSBill Taylor #if defined(DAPL_DBG)
85*9e39c5baSBill Taylor 
86*9e39c5baSBill Taylor extern DAPL_DBG_TYPE 	g_dapl_dbg_type;
87*9e39c5baSBill Taylor extern DAPL_DBG_DEST 	g_dapl_dbg_dest;
88*9e39c5baSBill Taylor 
89*9e39c5baSBill Taylor #define	dapl_dbg_log	g_dapl_dbg_type == 0 ? (void) 1 : dapl_internal_dbg_log
90*9e39c5baSBill Taylor 
91*9e39c5baSBill Taylor #else  /* !DAPL_DBG */
92*9e39c5baSBill Taylor 
93*9e39c5baSBill Taylor #define	dapl_dbg_log	if (0) dapl_internal_dbg_log
94*9e39c5baSBill Taylor 
95*9e39c5baSBill Taylor #endif /* !DAPL_DBG */
96*9e39c5baSBill Taylor 
97*9e39c5baSBill Taylor #ifdef __cplusplus
98*9e39c5baSBill Taylor }
99*9e39c5baSBill Taylor #endif
100*9e39c5baSBill Taylor 
101*9e39c5baSBill Taylor #endif /* _DAPL_DEBUG_H_ */