00001 #ifndef _SYS_SYSLOG_H_ 00002 #define _SYS_SYSLOG_H_ 00003 /* 00004 * Copyright (C) 2001-2004 by egnite Software GmbH. All rights reserved. 00005 * 00006 * Redistribution and use in source and binary forms, with or without 00007 * modification, are permitted provided that the following conditions 00008 * are met: 00009 * 00010 * 1. Redistributions of source code must retain the above copyright 00011 * notice, this list of conditions and the following disclaimer. 00012 * 2. Redistributions in binary form must reproduce the above copyright 00013 * notice, this list of conditions and the following disclaimer in the 00014 * documentation and/or other materials provided with the distribution. 00015 * 3. Neither the name of the copyright holders nor the names of 00016 * contributors may be used to endorse or promote products derived 00017 * from this software without specific prior written permission. 00018 * 00019 * THIS SOFTWARE IS PROVIDED BY EGNITE SOFTWARE GMBH AND CONTRIBUTORS 00020 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00021 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00022 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL EGNITE 00023 * SOFTWARE GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00024 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00025 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 00026 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 00027 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00028 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF 00029 * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00030 * SUCH DAMAGE. 00031 * 00032 * For additional information see http://www.ethernut.de/ 00033 * 00034 * - 00035 * Portions Copyright (c) 1982, 1986, 1988, 1993 00036 * The Regents of the University of California. All rights reserved. 00037 * 00038 * Redistribution and use in source and binary forms, with or without 00039 * modification, are permitted provided that the following conditions 00040 * are met: 00041 * 1. Redistributions of source code must retain the above copyright 00042 * notice, this list of conditions and the following disclaimer. 00043 * 2. Redistributions in binary form must reproduce the above copyright 00044 * notice, this list of conditions and the following disclaimer in the 00045 * documentation and/or other materials provided with the distribution. 00046 * 3. Neither the name of the University nor the names of its contributors 00047 * may be used to endorse or promote products derived from this software 00048 * without specific prior written permission. 00049 * 00050 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 00051 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00052 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00053 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 00054 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00055 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 00056 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00057 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00058 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 00059 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 00060 * SUCH DAMAGE. 00061 * 00062 */ 00063 00064 /* 00065 * $Log: syslog.h,v $ 00066 * Revision 1.5 2004/11/24 16:41:18 haraldkipp 00067 * Wrong prototypes for _P routines fixed 00068 * 00069 * Revision 1.4 2004/10/03 18:41:43 haraldkipp 00070 * RAM saving calls added 00071 * 00072 * Revision 1.3 2004/09/19 11:18:44 haraldkipp 00073 * Syslog client added 00074 * 00075 */ 00076 00077 /* 00078 * priorities/facilities are encoded into a single 32-bit quantity, where the 00079 * bottom 3 bits are the priority (0-7) and the top 28 bits are the facility 00080 * (0-big number). Both the priorities and the facilities map roughly 00081 * one-to-one to strings in the syslogd(8) source code. This mapping is 00082 * included in this file. 00083 * 00084 * priorities (these are ordered) 00085 */ 00086 00087 #include <sys/types.h> 00088 #include <stdarg.h> 00089 00090 #define LOG_EMERG 0 /* system is unusable */ 00091 #define LOG_ALERT 1 /* action must be taken immediately */ 00092 #define LOG_CRIT 2 /* critical conditions */ 00093 #define LOG_ERR 3 /* error conditions */ 00094 #define LOG_WARNING 4 /* warning conditions */ 00095 #define LOG_NOTICE 5 /* normal but significant condition */ 00096 #define LOG_INFO 6 /* informational */ 00097 #define LOG_DEBUG 7 /* debug-level messages */ 00098 00099 #define LOG_PRIMASK 0x07 /* mask to extract priority part (internal) */ 00100 /* extract priority */ 00101 #define LOG_PRI(p) ((p) & LOG_PRIMASK) 00102 #define LOG_MAKEPRI(fac, pri) (((fac) << 3) | (pri)) 00103 00104 /* facility codes */ 00105 #define LOG_KERN (0<<3) /* kernel messages */ 00106 #define LOG_USER (1<<3) /* random user-level messages */ 00107 #define LOG_MAIL (2<<3) /* mail system */ 00108 #define LOG_DAEMON (3<<3) /* system daemons */ 00109 #define LOG_AUTH (4<<3) /* security/authorization messages */ 00110 #define LOG_SYSLOG (5<<3) /* messages generated internally by syslogd */ 00111 #define LOG_LPR (6<<3) /* line printer subsystem */ 00112 #define LOG_NEWS (7<<3) /* network news subsystem */ 00113 #define LOG_UUCP (8<<3) /* UUCP subsystem */ 00114 #define LOG_CRON (9<<3) /* clock daemon */ 00115 #define LOG_AUTHPRIV (10<<3) /* security/authorization messages (private) */ 00116 #define LOG_FTP (11<<3) /* ftp daemon */ 00117 00118 /* other codes through 15 reserved for system use */ 00119 #define LOG_LOCAL0 (16<<3) /* reserved for local use */ 00120 #define LOG_LOCAL1 (17<<3) /* reserved for local use */ 00121 #define LOG_LOCAL2 (18<<3) /* reserved for local use */ 00122 #define LOG_LOCAL3 (19<<3) /* reserved for local use */ 00123 #define LOG_LOCAL4 (20<<3) /* reserved for local use */ 00124 #define LOG_LOCAL5 (21<<3) /* reserved for local use */ 00125 #define LOG_LOCAL6 (22<<3) /* reserved for local use */ 00126 #define LOG_LOCAL7 (23<<3) /* reserved for local use */ 00127 00128 #define LOG_NFACILITIES 24 /* current number of facilities */ 00129 #define LOG_FACMASK 0x03f8 /* mask to extract facility part */ 00130 /* facility of pri */ 00131 #define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3) 00132 00133 #define LOG_PRINTF -1 /* pseudo-priority to indicate use of printf */ 00134 00135 /* 00136 * arguments to setlogmask. 00137 */ 00138 #define LOG_MASK(pri) (1 << (pri)) /* mask for one priority */ 00139 #define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) /* all priorities through pri */ 00140 00141 /* 00142 * Option flags for openlog. 00143 * 00144 * LOG_ODELAY no longer does anything. 00145 * LOG_NDELAY is the inverse of what it used to be. 00146 */ 00147 #define LOG_PID 0x01 /* log the pid with each message */ 00148 #define LOG_CONS 0x02 /* log on the console if errors in sending */ 00149 #define LOG_ODELAY 0x04 /* delay open until first syslog() (default) */ 00150 #define LOG_NDELAY 0x08 /* don't delay open */ 00151 #define LOG_NOWAIT 0x10 /* don't wait for console forks: DEPRECATED */ 00152 #define LOG_PERROR 0x20 /* log to stderr as well */ 00153 00154 00155 __BEGIN_DECLS /* */ 00156 extern void closelog(void); 00157 extern void openlog(CONST char *, int, int); 00158 extern int setlogmask(int); 00159 extern u_long setlogserver(u_long ip, u_short port); 00160 extern void syslog(int, CONST char *, ...); 00161 extern void vsyslog(int, CONST char *, va_list); 00162 #ifdef __HARVARD_ARCH__ 00163 extern void syslog_P(int pri, PGM_P fmt, ...); 00164 extern void vsyslog_P(int pri, PGM_P fmt, va_list ap); 00165 #endif 00166 __END_DECLS /* */ 00167 #endif