1 /*
2  * ProFTPD - FTP server daemon
3  * Copyright (c) 1997, 1998 Public Flood Software
4  * Copyright (c) 1999, 2000 MacGyver aka Habeeb J. Dihu <macgyver@tos.net>
5  * Copyright (c) 2001-2016 The ProFTPD Project team
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
20  *
21  * As a special exemption, Public Flood Software/MacGyver aka Habeeb J. Dihu
22  * and other respective copyright holders give permission to link this program
23  * with OpenSSL, and distribute the resulting executable, without including
24  * the source code for OpenSSL in the source distribution.
25  */
26 
27 /* ProFTPD internal implementation of syslog(3) routines */
28 
29 #include "conf.h"
30 
31 #ifndef PR_SYSLOG_H
32 #define PR_SYSLOG_H 1
33 
34 /* These are log levels used to determine at which level we should log to.
35  */
36 #ifdef HAVE_SYSLOG
37 
38 #define PR_LOG_EMERG     LOG_EMERG     /* system is unusable */
39 #define PR_LOG_ALERT     LOG_ALERT     /* action must be taken immediately */
40 #define PR_LOG_CRIT      LOG_CRIT      /* critical conditions */
41 #define PR_LOG_ERR       LOG_ERR       /* error conditions */
42 #define PR_LOG_WARNING   LOG_WARNING   /* warning conditions */
43 #define PR_LOG_NOTICE    LOG_NOTICE    /* normal but significant condition */
44 #define PR_LOG_INFO      LOG_INFO      /* informational */
45 #define PR_LOG_DEBUG     LOG_DEBUG     /* debug-level messages */
46 
47 #define PR_LOG_PRIMASK LOG_PRIMASK   /* mask off the level value */
48 
49 #else
50 
51 #define PR_LOG_EMERG            0       /* system is unusable */
52 #define PR_LOG_ALERT            1       /* action must be taken immediately */
53 #define PR_LOG_CRIT             2       /* critical conditions */
54 #define PR_LOG_ERR              3       /* error conditions */
55 #define PR_LOG_WARNING          4       /* warning conditions */
56 #define PR_LOG_NOTICE           5       /* normal but significant condition */
57 #define PR_LOG_INFO             6       /* informational */
58 #define PR_LOG_DEBUG            7       /* debug-level messages */
59 
60 #define PR_LOG_PRIMASK          7       /* mask off the level value */
61 
62 #endif /* HAVE_SYSLOG */
63 
64 #ifdef _PATH_LOG
65 # define PR_PATH_LOG	_PATH_LOG
66 #elif defined(__hpux)
67 # define PR_PATH_LOG	"/dev/log.un"
68 #else
69 # if defined(SOLARIS2)
70 #  define PR_PATH_LOG	"/dev/conslog"
71 # else
72 #  define PR_PATH_LOG	"/dev/log"
73 # endif /* !Solaris */
74 #endif
75 
76 /* Close descriptor used to write to system logger. */
77 void pr_closelog(int sockfd);
78 
79 /* Open a connection to system logger.  Returns a file descriptor to the socket
80  * opened for the connection, or -1 if there was an error.
81  */
82 int pr_openlog(const char *ident, int option, int facility);
83 
84 /* Set the log mask level.  */
85 int pr_setlogmask(int mask);
86 
87 /* Set the facility of the system logger.  */
88 int pr_setlogfacility(int facility);
89 
90 /* Generate a log message using the given format string and option arguments.
91  */
92 void pr_syslog(int sockfd, int pri, const char *fmt, ...);
93 
94 #endif /* PR_SYSLOG_H */
95