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