home *** CD-ROM | disk | FTP | other *** search
/ Network CD 2 / Network CD - Volume 2.iso / programs / internet / tcp / amitcp / amitcp-api-22.lha / AmiTCP-2.2 / netinclude / sys / syslog.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-08-12  |  8.0 KB  |  228 lines

  1. /*
  2.  * $Id: syslog.h,v 1.14 1993/06/04 11:16:15 jraja Exp $
  3.  *
  4.  * Copyright (c) 1993 AmiTCP/IP Group, <amitcp-group@hut.fi>
  5.  *                    Helsinki University of Technology, Finland.
  6.  *                    All rights reserved.
  7.  *
  8.  * HISTORY
  9.  * $Log: syslog.h,v $
  10.  * Revision 1.14  1993/06/04  11:16:15  jraja
  11.  * Fixes for first public release.
  12.  *
  13.  * Revision 1.13  1993/05/24  19:30:54  ppessi
  14.  * Moved sys/syslog.h into netinclude; sanitized prototypes
  15.  *
  16.  * Revision 1.12  1993/05/17  01:02:04  ppessi
  17.  * Changed RCS version
  18.  *
  19.  * Revision 1.11  1993/04/28  13:01:19  puhuri
  20.  * Fixed stdargs.h to stdarg.h
  21.  *
  22.  * Revision 1.10  93/04/27  18:17:47  18:17:47  puhuri (Markus Peuhkuri)
  23.  * Changed default names of console and log.
  24.  * 
  25.  * Revision 1.9  93/04/27  10:27:11  10:27:11  puhuri (Markus Peuhkuri)
  26.  * Removed AMITCP-defined thing, add stub/prototype for syslog().
  27.  * 
  28.  * Revision 1.8  93/04/21  19:12:07  19:12:07  puhuri (Markus Peuhkuri)
  29.  * Removed somen constants and fixed path names.
  30.  * 
  31.  * Revision 1.7  93/03/10  17:17:58  17:17:58  puhuri (Markus Peuhkuri)
  32.  * Now Log file is inet:SysLog
  33.  * 
  34.  * Revision 1.6  93/03/03  18:37:30  18:37:30  jraja (Jarno Tapio Rajahalme)
  35.  * Removed (optional) definitions which would define storage (name tables).
  36.  * (with #ifndef AMITCP)
  37.  * 
  38.  * Revision 1.5  93/03/03  15:54:49  15:54:49  jraja (Jarno Tapio Rajahalme)
  39.  * Cleanup.
  40.  * 
  41.  * Revision 1.4  93/02/25  19:42:37  19:42:37  puhuri (Markus Peuhkuri)
  42.  * Organized better, removed function declarations (in sys/systm.h),
  43.  * moved log_msg to kern/amiga_log.h
  44.  * 
  45.  * Revision 1.3  93/02/24  17:40:39  17:40:39  puhuri (Markus Peuhkuri)
  46.  * AmiTCP version of syslog.h. Contains Amiga-specifig declarations
  47.  * 
  48.  * Revision 1.1  92/12/17  18:24:51  puhuri
  49.  * Initial revision
  50.  * 
  51.  */
  52.  
  53. /*
  54.  * Copyright (c) 1982, 1986, 1988 Regents of the University of California.
  55.  * All rights reserved.
  56.  *
  57.  * Redistribution and use in source and binary forms, with or without
  58.  * modification, are permitted provided that the following conditions
  59.  * are met:
  60.  * 1. Redistributions of source code must retain the above copyright
  61.  *    notice, this list of conditions and the following disclaimer.
  62.  * 2. Redistributions in binary form must reproduce the above copyright
  63.  *    notice, this list of conditions and the following disclaimer in the
  64.  *    documentation and/or other materials provided with the distribution.
  65.  * 3. All advertising materials mentioning features or use of this software
  66.  *    must display the following acknowledgement:
  67.  *    This product includes software developed by the University of
  68.  *    California, Berkeley and its contributors.
  69.  * 4. Neither the name of the University nor the names of its contributors
  70.  *    may be used to endorse or promote products derived from this software
  71.  *    without specific prior written permission.
  72.  *
  73.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  74.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  75.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  76.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  77.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  78.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  79.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  80.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  81.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  82.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  83.  * SUCH DAMAGE.
  84.  *
  85.  *    @(#)syslog.h    7.20 (Berkeley) 2/23/91
  86.  */
  87.  
  88. #ifndef SYS_SYSLOG_H
  89. #define SYS_SYSLOG_H
  90.  
  91. #define    _PATH_LOG    "t:AmiTCP.log"
  92. #define _PATH_CON       "con:0/0/600/100/AmiTCPIP Log/AUTO"
  93.  
  94.  
  95. /*
  96.  * priorities/facilities are encoded into a single 32-bit quantity, where the
  97.  * bottom 3 bits are the priority (0-7) and the top 28 bits are the facility
  98.  * (0-big number).  Both the priorities and the facilities map roughly
  99.  * one-to-one to strings in the syslogd(8) source code.  This mapping is
  100.  * included in this file.
  101.  *
  102.  * priorities (these are ordered)
  103.  */
  104. #define    LOG_EMERG    0    /* system is unusable */
  105. #define    LOG_ALERT    1    /* action must be taken immediately */
  106. #define    LOG_CRIT    2    /* critical conditions */
  107. #define    LOG_ERR        3    /* error conditions */
  108. #define    LOG_WARNING    4    /* warning conditions */
  109. #define    LOG_NOTICE    5    /* normal but significant condition */
  110. #define    LOG_INFO    6    /* informational */
  111. #define    LOG_DEBUG    7    /* debug-level messages */
  112.  
  113. #define    LOG_PRIMASK    0x07    /* mask to extract priority part (internal) */
  114.                 /* extract priority */
  115. #define    LOG_PRI(p)    ((p) & LOG_PRIMASK)
  116. #define    LOG_MAKEPRI(fac, pri)    (((fac) << 3) | (pri))
  117.  
  118. #ifndef AMITCP      /* this would define data, not needed */
  119. #ifdef SYSLOG_NAMES
  120. #define    INTERNAL_NOPRI    0x10    /* the "no priority" priority */
  121.                 /* mark "facility" */
  122. #define    INTERNAL_MARK    LOG_MAKEPRI(LOG_NFACILITIES, 0)
  123. typedef struct _code {
  124.     char    *c_name;
  125.     int    c_val;
  126. } CODE;
  127.  
  128. CODE prioritynames[] = {
  129.     "alert",    LOG_ALERT,
  130.     "crit",        LOG_CRIT,
  131.     "debug",    LOG_DEBUG,
  132.     "emerg",    LOG_EMERG,
  133.     "err",        LOG_ERR,
  134.     "error",    LOG_ERR,        /* DEPRECATED */
  135.     "info",        LOG_INFO,
  136.     "none",        INTERNAL_NOPRI,        /* INTERNAL */
  137.     "notice",    LOG_NOTICE,
  138.     "panic",     LOG_EMERG,        /* DEPRECATED */
  139.     "warn",        LOG_WARNING,        /* DEPRECATED */
  140.     "warning",    LOG_WARNING,
  141.     NULL,        -1,
  142. };
  143. #endif
  144. #endif /* !AMITCP */
  145.  
  146. /* facility codes */
  147. #define    LOG_KERN    (0<<3)    /* kernel messages */
  148. #define    LOG_USER    (1<<3)    /* random user-level messages */
  149. #define    LOG_MAIL    (2<<3)    /* mail system */
  150. #define    LOG_DAEMON    (3<<3)    /* system daemons */
  151. #define    LOG_AUTH    (4<<3)    /* security/authorization messages */
  152. #define    LOG_SYSLOG    (5<<3)    /* messages generated internally by syslogd */
  153. #define    LOG_LPR        (6<<3)    /* line printer subsystem */
  154. #define    LOG_NEWS    (7<<3)    /* network news subsystem */
  155. #define    LOG_UUCP    (8<<3)    /* UUCP subsystem */
  156. #define    LOG_CRON    (9<<3)    /* clock daemon */
  157. #define    LOG_AUTHPRIV    (10<<3)    /* security/authorization messages (private) */
  158.  
  159.     /* other codes through 15 reserved for system use */
  160. #define    LOG_LOCAL0    (16<<3)    /* reserved for local use */
  161. #define    LOG_LOCAL1    (17<<3)    /* reserved for local use */
  162. #define    LOG_LOCAL2    (18<<3)    /* reserved for local use */
  163. #define    LOG_LOCAL3    (19<<3)    /* reserved for local use */
  164. #define    LOG_LOCAL4    (20<<3)    /* reserved for local use */
  165. #define    LOG_LOCAL5    (21<<3)    /* reserved for local use */
  166. #define    LOG_LOCAL6    (22<<3)    /* reserved for local use */
  167. #define    LOG_LOCAL7    (23<<3)    /* reserved for local use */
  168.  
  169. #define    LOG_NFACILITIES    24    /* current number of facilities */
  170. #define    LOG_FACMASK    0x03f8    /* mask to extract facility part */
  171.                 /* facility of pri */
  172. #define    LOG_FAC(p)    (((p) & LOG_FACMASK) >> 3)
  173.  
  174.  
  175. #ifndef AMITCP      /* this would define data, not needed */
  176. #ifdef SYSLOG_NAMES
  177. CODE facilitynames[] = {
  178.     "auth",        LOG_AUTH,
  179.     "authpriv",    LOG_AUTHPRIV,
  180.     "cron",     LOG_CRON,
  181.     "daemon",    LOG_DAEMON,
  182.     "kern",        LOG_KERN,
  183.     "lpr",        LOG_LPR,
  184.     "mail",        LOG_MAIL,
  185.     "mark",     INTERNAL_MARK,        /* INTERNAL */
  186.     "news",        LOG_NEWS,
  187.     "security",    LOG_AUTH,        /* DEPRECATED */
  188.     "syslog",    LOG_SYSLOG,
  189.     "user",        LOG_USER,
  190.     "uucp",        LOG_UUCP,
  191.     "local0",    LOG_LOCAL0,
  192.     "local1",    LOG_LOCAL1,
  193.     "local2",    LOG_LOCAL2,
  194.     "local3",    LOG_LOCAL3,
  195.     "local4",    LOG_LOCAL4,
  196.     "local5",    LOG_LOCAL5,
  197.     "local6",    LOG_LOCAL6,
  198.     "local7",    LOG_LOCAL7,
  199.     NULL,        -1,
  200. };
  201. #endif
  202. #endif /* !AMITCP */
  203.  
  204. #ifdef KERNEL
  205. #define    LOG_PRINTF    -1    /* pseudo-priority to indicate use of printf */
  206. #endif
  207.  
  208. /*
  209.  * arguments to setlogmask.
  210.  */
  211. #define    LOG_MASK(pri)    (1 << (pri))        /* mask for one priority */
  212. #define    LOG_UPTO(pri)    ((1 << ((pri)+1)) - 1)    /* all priorities through pri */
  213.  
  214. /*
  215.  * Option flags for openlog.
  216.  *
  217.  * LOG_ODELAY no longer does anything.
  218.  * LOG_NDELAY is the inverse of what it used to be.
  219.  */
  220. #define    LOG_PID        0x01    /* log the pid with each message */
  221. #define    LOG_CONS    0x02    /* log on the console if errors in sending */
  222. #define    LOG_ODELAY    0x04    /* delay open until first syslog() (default) */
  223. #define    LOG_NDELAY    0x08    /* don't delay open */
  224. #define    LOG_NOWAIT    0x10    /* don't wait for console forks: DEPRECATED */
  225. #define    LOG_PERROR    0x20    /* log to stderr as well */
  226.  
  227. #endif /* !SYS_SYSLOG_H */
  228.