xref: /onnv-gate/usr/src/lib/libdhcputil/common/dhcpmsg.h (revision 3431:9f2d277dcffa)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*3431Scarlsonj  * Common Development and Distribution License (the "License").
6*3431Scarlsonj  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*3431Scarlsonj  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23*3431Scarlsonj  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef	_DHCPMSG_H
270Sstevel@tonic-gate #define	_DHCPMSG_H
280Sstevel@tonic-gate 
29*3431Scarlsonj #pragma ident	"%Z%%M%	%I%	%E% SMI"
300Sstevel@tonic-gate 
310Sstevel@tonic-gate #include <sys/types.h>
320Sstevel@tonic-gate #include <stdarg.h>
330Sstevel@tonic-gate #include <syslog.h>
340Sstevel@tonic-gate #include <errno.h>		/* since consumers may want to 0 errno */
350Sstevel@tonic-gate 
360Sstevel@tonic-gate /*
370Sstevel@tonic-gate  * dhcpmsg.[ch] comprise the interface used to log messages, either to
380Sstevel@tonic-gate  * syslog(3C), or to the screen, depending on the debug level.  see
390Sstevel@tonic-gate  * dhcpmsg.c for documentation on how to use the exported functions.
400Sstevel@tonic-gate  */
410Sstevel@tonic-gate 
420Sstevel@tonic-gate #ifdef	__cplusplus
430Sstevel@tonic-gate extern "C" {
440Sstevel@tonic-gate #endif
450Sstevel@tonic-gate 
460Sstevel@tonic-gate /*
470Sstevel@tonic-gate  * the syslog levels, while useful, do not provide enough flexibility
480Sstevel@tonic-gate  * to do everything we want.  consequently, we introduce another set
490Sstevel@tonic-gate  * of levels, which map to a syslog level, but also potentially add
500Sstevel@tonic-gate  * additional behavior.
510Sstevel@tonic-gate  */
520Sstevel@tonic-gate 
530Sstevel@tonic-gate enum {
540Sstevel@tonic-gate 	MSG_DEBUG,		/* LOG_DEBUG, only if debug_level is 1 */
550Sstevel@tonic-gate 	MSG_DEBUG2,		/* LOG_DEBUG, only if debug_level is 1 or 2 */
560Sstevel@tonic-gate 	MSG_INFO,		/* LOG_INFO */
570Sstevel@tonic-gate 	MSG_VERBOSE,		/* LOG_INFO, only if is_verbose is true */
580Sstevel@tonic-gate 	MSG_NOTICE,		/* LOG_NOTICE */
590Sstevel@tonic-gate 	MSG_WARNING,		/* LOG_WARNING */
600Sstevel@tonic-gate 	MSG_ERR,		/* LOG_ERR, use errno if nonzero */
610Sstevel@tonic-gate 	MSG_ERROR,		/* LOG_ERR */
620Sstevel@tonic-gate 	MSG_CRIT		/* LOG_CRIT */
630Sstevel@tonic-gate };
640Sstevel@tonic-gate 
65*3431Scarlsonj /* PRINTFLIKE2 */
660Sstevel@tonic-gate extern void	dhcpmsg(int, const char *, ...);
670Sstevel@tonic-gate extern void	dhcpmsg_init(const char *, boolean_t, boolean_t, int);
680Sstevel@tonic-gate extern void	dhcpmsg_fini(void);
690Sstevel@tonic-gate 
700Sstevel@tonic-gate #ifdef	__cplusplus
710Sstevel@tonic-gate }
720Sstevel@tonic-gate #endif
730Sstevel@tonic-gate 
740Sstevel@tonic-gate #endif	/* _DHCPMSG_H */
75