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