xref: /titanic_50/usr/src/lib/libdhcputil/common/dhcpmsg.h (revision 0b5ce10aee80822ecc7df77df92a5e24078ba196)
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  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_DHCPMSG_H
27 #define	_DHCPMSG_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #include <sys/types.h>
32 #include <stdarg.h>
33 #include <syslog.h>
34 #include <errno.h>		/* since consumers may want to 0 errno */
35 
36 /*
37  * dhcpmsg.[ch] comprise the interface used to log messages, either to
38  * syslog(3C), or to the screen, depending on the debug level.  see
39  * dhcpmsg.c for documentation on how to use the exported functions.
40  */
41 
42 #ifdef	__cplusplus
43 extern "C" {
44 #endif
45 
46 /*
47  * the syslog levels, while useful, do not provide enough flexibility
48  * to do everything we want.  consequently, we introduce another set
49  * of levels, which map to a syslog level, but also potentially add
50  * additional behavior.
51  */
52 
53 enum {
54 	MSG_DEBUG,		/* LOG_DEBUG, only if debug_level is 1 */
55 	MSG_DEBUG2,		/* LOG_DEBUG, only if debug_level is 1 or 2 */
56 	MSG_INFO,		/* LOG_INFO */
57 	MSG_VERBOSE,		/* LOG_INFO, only if is_verbose is true */
58 	MSG_NOTICE,		/* LOG_NOTICE */
59 	MSG_WARNING,		/* LOG_WARNING */
60 	MSG_ERR,		/* LOG_ERR, use errno if nonzero */
61 	MSG_ERROR,		/* LOG_ERR */
62 	MSG_CRIT		/* LOG_CRIT */
63 };
64 
65 /* PRINTFLIKE2 */
66 extern void	dhcpmsg(int, const char *, ...);
67 extern void	dhcpmsg_init(const char *, boolean_t, boolean_t, int);
68 extern void	dhcpmsg_fini(void);
69 
70 #ifdef	__cplusplus
71 }
72 #endif
73 
74 #endif	/* _DHCPMSG_H */
75