xref: /titanic_41/usr/src/lib/libdhcputil/common/dhcpmsg.h (revision 70025d765b044c6d8594bb965a2247a61e991a99)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 1999 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #ifndef	_DHCPMSG_H
28 #define	_DHCPMSG_H
29 
30 #pragma ident	"%W%	%E% SMI"
31 
32 #include <sys/types.h>
33 #include <stdarg.h>
34 #include <syslog.h>
35 #include <errno.h>		/* since consumers may want to 0 errno */
36 
37 /*
38  * dhcpmsg.[ch] comprise the interface used to log messages, either to
39  * syslog(3C), or to the screen, depending on the debug level.  see
40  * dhcpmsg.c for documentation on how to use the exported functions.
41  */
42 
43 #ifdef	__cplusplus
44 extern "C" {
45 #endif
46 
47 /*
48  * the syslog levels, while useful, do not provide enough flexibility
49  * to do everything we want.  consequently, we introduce another set
50  * of levels, which map to a syslog level, but also potentially add
51  * additional behavior.
52  */
53 
54 enum {
55 	MSG_DEBUG,		/* LOG_DEBUG, only if debug_level is 1 */
56 	MSG_DEBUG2,		/* LOG_DEBUG, only if debug_level is 1 or 2 */
57 	MSG_INFO,		/* LOG_INFO */
58 	MSG_VERBOSE,		/* LOG_INFO, only if is_verbose is true */
59 	MSG_NOTICE,		/* LOG_NOTICE */
60 	MSG_WARNING,		/* LOG_WARNING */
61 	MSG_ERR,		/* LOG_ERR, use errno if nonzero */
62 	MSG_ERROR,		/* LOG_ERR */
63 	MSG_CRIT		/* LOG_CRIT */
64 };
65 
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