xref: /freebsd/crypto/openssh/log.h (revision 1e413cf93298b5b97441a21d9a50fdcd0ee9945e)
1 /* $OpenBSD: log.h,v 1.15 2006/08/18 09:13:25 deraadt Exp $ */
2 /* $FreeBSD$ */
3 
4 /*
5  * Author: Tatu Ylonen <ylo@cs.hut.fi>
6  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
7  *                    All rights reserved
8  *
9  * As far as I am concerned, the code I have written for this software
10  * can be used freely for any purpose.  Any derived versions of this
11  * software must be clearly marked as such, and if the derived work is
12  * incompatible with the protocol description in the RFC file, it must be
13  * called by a name other than "ssh" or "Secure Shell".
14  */
15 
16 #ifndef SSH_LOG_H
17 #define SSH_LOG_H
18 
19 /* Supported syslog facilities and levels. */
20 typedef enum {
21 	SYSLOG_FACILITY_DAEMON,
22 	SYSLOG_FACILITY_USER,
23 	SYSLOG_FACILITY_AUTH,
24 #ifdef LOG_AUTHPRIV
25 	SYSLOG_FACILITY_AUTHPRIV,
26 #endif
27 	SYSLOG_FACILITY_LOCAL0,
28 	SYSLOG_FACILITY_LOCAL1,
29 	SYSLOG_FACILITY_LOCAL2,
30 	SYSLOG_FACILITY_LOCAL3,
31 	SYSLOG_FACILITY_LOCAL4,
32 	SYSLOG_FACILITY_LOCAL5,
33 	SYSLOG_FACILITY_LOCAL6,
34 	SYSLOG_FACILITY_LOCAL7,
35 	SYSLOG_FACILITY_NOT_SET = -1
36 }       SyslogFacility;
37 
38 typedef enum {
39 	SYSLOG_LEVEL_QUIET,
40 	SYSLOG_LEVEL_FATAL,
41 	SYSLOG_LEVEL_ERROR,
42 	SYSLOG_LEVEL_INFO,
43 	SYSLOG_LEVEL_VERBOSE,
44 	SYSLOG_LEVEL_DEBUG1,
45 	SYSLOG_LEVEL_DEBUG2,
46 	SYSLOG_LEVEL_DEBUG3,
47 	SYSLOG_LEVEL_NOT_SET = -1
48 }       LogLevel;
49 
50 void     log_init(char *, LogLevel, SyslogFacility, int);
51 
52 SyslogFacility	log_facility_number(char *);
53 LogLevel log_level_number(char *);
54 
55 #define fatal	ssh_fatal
56 #define error	ssh_error
57 #define logit	ssh_logit
58 #define verbose	ssh_verbose
59 #define debug	ssh_debug
60 #define debug2	ssh_debug2
61 #define debug3	ssh_debug3
62 
63 void     fatal(const char *, ...) __dead __attribute__((format(printf, 1, 2)));
64 void     error(const char *, ...) __attribute__((format(printf, 1, 2)));
65 void     sigdie(const char *, ...) __attribute__((format(printf, 1, 2)));
66 void     logit(const char *, ...) __attribute__((format(printf, 1, 2)));
67 void     verbose(const char *, ...) __attribute__((format(printf, 1, 2)));
68 void     debug(const char *, ...) __attribute__((format(printf, 1, 2)));
69 void     debug2(const char *, ...) __attribute__((format(printf, 1, 2)));
70 void     debug3(const char *, ...) __attribute__((format(printf, 1, 2)));
71 
72 void	 do_log(LogLevel, const char *, va_list);
73 void	 cleanup_exit(int) __dead;
74 #endif
75