log.h revision 114972
1106121Sdes/*	$OpenBSD: log.h,v 1.8 2002/07/19 15:43:33 markus Exp $	*/
2114955Sdes/*	$FreeBSD: head/crypto/openssh/log.h 114972 2003-05-13 10:18:49Z des $	*/
376259Sgreen
476259Sgreen/*
576259Sgreen * Author: Tatu Ylonen <ylo@cs.hut.fi>
676259Sgreen * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
776259Sgreen *                    All rights reserved
876259Sgreen *
976259Sgreen * As far as I am concerned, the code I have written for this software
1076259Sgreen * can be used freely for any purpose.  Any derived versions of this
1176259Sgreen * software must be clearly marked as such, and if the derived work is
1276259Sgreen * incompatible with the protocol description in the RFC file, it must be
1376259Sgreen * called by a name other than "ssh" or "Secure Shell".
1476259Sgreen */
1576259Sgreen
1676259Sgreen#ifndef SSH_LOG_H
1776259Sgreen#define SSH_LOG_H
1876259Sgreen
1998937Sdes#include <syslog.h> /* Needed for LOG_AUTHPRIV (if present) */
2098937Sdes
2176259Sgreen/* Supported syslog facilities and levels. */
2276259Sgreentypedef enum {
2376259Sgreen	SYSLOG_FACILITY_DAEMON,
2476259Sgreen	SYSLOG_FACILITY_USER,
2576259Sgreen	SYSLOG_FACILITY_AUTH,
2698937Sdes#ifdef LOG_AUTHPRIV
2798937Sdes	SYSLOG_FACILITY_AUTHPRIV,
2898937Sdes#endif
2976259Sgreen	SYSLOG_FACILITY_LOCAL0,
3076259Sgreen	SYSLOG_FACILITY_LOCAL1,
3176259Sgreen	SYSLOG_FACILITY_LOCAL2,
3276259Sgreen	SYSLOG_FACILITY_LOCAL3,
3376259Sgreen	SYSLOG_FACILITY_LOCAL4,
3476259Sgreen	SYSLOG_FACILITY_LOCAL5,
3576259Sgreen	SYSLOG_FACILITY_LOCAL6,
3692555Sdes	SYSLOG_FACILITY_LOCAL7,
3798675Sdes	SYSLOG_FACILITY_NOT_SET = -1
3876259Sgreen}       SyslogFacility;
3976259Sgreen
4076259Sgreentypedef enum {
4176259Sgreen	SYSLOG_LEVEL_QUIET,
4276259Sgreen	SYSLOG_LEVEL_FATAL,
4376259Sgreen	SYSLOG_LEVEL_ERROR,
4476259Sgreen	SYSLOG_LEVEL_INFO,
4576259Sgreen	SYSLOG_LEVEL_VERBOSE,
4676259Sgreen	SYSLOG_LEVEL_DEBUG1,
4776259Sgreen	SYSLOG_LEVEL_DEBUG2,
4892555Sdes	SYSLOG_LEVEL_DEBUG3,
4998675Sdes	SYSLOG_LEVEL_NOT_SET = -1
5076259Sgreen}       LogLevel;
5176259Sgreen
5292555Sdesvoid     log_init(char *, LogLevel, SyslogFacility, int);
5376259Sgreen
5492555SdesSyslogFacility	log_facility_number(char *);
5592555SdesLogLevel log_level_number(char *);
5676259Sgreen
57114955Sdes#define fatal	ssh_fatal
58114955Sdes#define error	ssh_error
59114955Sdes#define log	ssh_log
60114955Sdes#define verbose	ssh_verbose
61114955Sdes#define debug	ssh_debug
62114955Sdes#define debug2	ssh_debug2
63114955Sdes#define debug3	ssh_debug3
6476259Sgreen
65114972Sdesvoid     fatal(const char *, ...) __attribute__((format(printf, 1, 2)));
66114972Sdesvoid     error(const char *, ...) __attribute__((format(printf, 1, 2)));
67114972Sdesvoid     log(const char *, ...) __attribute__((format(printf, 1, 2)));
68114972Sdesvoid     verbose(const char *, ...) __attribute__((format(printf, 1, 2)));
69114972Sdesvoid     debug(const char *, ...) __attribute__((format(printf, 1, 2)));
70114972Sdesvoid     debug2(const char *, ...) __attribute__((format(printf, 1, 2)));
71114972Sdesvoid     debug3(const char *, ...) __attribute__((format(printf, 1, 2)));
72114955Sdes
7392555Sdesvoid     fatal_cleanup(void);
7492555Sdesvoid     fatal_add_cleanup(void (*) (void *), void *);
7592555Sdesvoid     fatal_remove_cleanup(void (*) (void *), void *);
76106121Sdesvoid     fatal_remove_all_cleanups(void);
7776259Sgreen
7892555Sdesvoid	 do_log(LogLevel, const char *, va_list);
7976259Sgreen
8076259Sgreen#endif
81