home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / bootpd-2.zip / SYSLOG.H < prev    next >
Text File  |  1994-11-28  |  6KB  |  157 lines

  1. /*  
  2. **  Modified by Jochen Friedrich <jochen@audio.ruessel.sub.org> for OS/2.
  3. */
  4. /* $Revision: 1.3 $
  5.  * Copyright (c) 1982, 1986, 1988 Regents of the University of California.
  6.  * All rights reserved.
  7.  *
  8.  * Redistribution is only permitted until one year after the first shipment
  9.  * of 4.4BSD by the Regents.  Otherwise, redistribution and use in source and
  10.  * binary forms are permitted provided that: (1) source distributions retain
  11.  * this entire copyright notice and comment, and (2) distributions including
  12.  * binaries display the following acknowledgement:  This product includes
  13.  * software developed by the University of California, Berkeley and its
  14.  * contributors'' in the documentation or other materials provided with the
  15.  * distribution and in all advertising materials mentioning features or use
  16.  * of this software.  Neither the name of the University nor the names of
  17.  * its contributors may be used to endorse or promote products derived from
  18.  * this software without specific prior written permission.
  19.  * THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
  20.  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
  21.  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  22.  *
  23.  *    @(#)syslog.h    7.16 (Berkeley) 6/28/90
  24.  */
  25.  
  26. /*
  27.  * priorities/facilities are encoded into a single 32-bit quantity, where the
  28.  * bottom 3 bits are the priority (0-7) and the top 28 bits are the facility
  29.  * (0-big number).  Both the priorities and the facilities map roughly
  30.  * one-to-one to strings in the syslogd(8) source code.  This mapping is
  31.  * included in this file.
  32.  *
  33.  * priorities (these are ordered)
  34.  */
  35.  
  36. void syslog(int, char *,...);
  37. void vsyslog(int, char *, char *);
  38. void openlog(char *, int, int);
  39. void closelog(void);
  40. int setlogmask(int);
  41.  
  42.  
  43. #define    LOG_EMERG    0    /* system is unusable */
  44. #define    LOG_ALERT    1    /* action must be taken immediately */
  45. #define    LOG_CRIT    2    /* critical conditions */
  46. #define    LOG_ERR    3    /* error conditions */
  47. #define    LOG_WARNING    4    /* warning conditions */
  48. #define    LOG_NOTICE    5    /* normal but significant condition */
  49. #define    LOG_INFO    6    /* informational */
  50. #define    LOG_DEBUG    7    /* debug-level messages */
  51.  
  52. #define    LOG_PRIMASK    0x007    /* mask to extract priority part (internal) */
  53.                 /* extract priority */
  54. #define    LOG_PRI(p)    ((p) & LOG_PRIMASK)
  55. #define    LOG_MAKEPRI(fac, pri)    (((fac) << 3) | (pri))
  56.  
  57. #ifdef SYSLOG_NAMES
  58. #define    INTERNAL_NOPRI    0x10    /* the "no priority" priority */
  59.                 /* mark "facility" */
  60. #define    INTERNAL_MARK    LOG_MAKEPRI(LOG_NFACILITIES, 0)
  61. typedef struct _code {
  62.     char    *c_name;
  63.     int    c_val;
  64. } CODE;
  65.  
  66. CODE prioritynames[] = {
  67.     "alert",    LOG_ALERT,
  68.     "crit",    LOG_CRIT,
  69.     "debug",    LOG_DEBUG,
  70.     "emerg",    LOG_EMERG,
  71.     "err",        LOG_ERR,
  72.     "error",    LOG_ERR,        /* DEPRECATED */
  73.     "info",    LOG_INFO,
  74.     "none",    INTERNAL_NOPRI,    /* INTERNAL */
  75.     "notice",    LOG_NOTICE,
  76.     "panic",     LOG_EMERG,        /* DEPRECATED */
  77.     "warn",    LOG_WARNING,        /* DEPRECATED */
  78.     "warning",    LOG_WARNING,
  79.     NULL,        -1,
  80. };
  81. #endif
  82.  
  83. /* facility codes */
  84. #define    LOG_KERN    (0<<3)    /* kernel messages */
  85. #define    LOG_USER    (1<<3)    /* random user-level messages */
  86. #define    LOG_MAIL    (2<<3)    /* mail system */
  87. #define    LOG_DAEMON    (3<<3)    /* system daemons */
  88. #define    LOG_AUTH    (4<<3)    /* security/authorization messages */
  89. #define    LOG_SYSLOG    (5<<3)    /* messages generated internally by syslogd */
  90. #define    LOG_LPR    (6<<3)    /* line printer subsystem */
  91. #define    LOG_NEWS    (7<<3)    /* network news subsystem */
  92. #define    LOG_UUCP    (8<<3)    /* UUCP subsystem */
  93. #define    LOG_CRON    (15<<3)    /* clock daemon */
  94.     /* other codes through 15 reserved for system use */
  95. #define    LOG_LOCAL0    (16<<3)    /* reserved for local use */
  96. #define    LOG_LOCAL1    (17<<3)    /* reserved for local use */
  97. #define    LOG_LOCAL2    (18<<3)    /* reserved for local use */
  98. #define    LOG_LOCAL3    (19<<3)    /* reserved for local use */
  99. #define    LOG_LOCAL4    (20<<3)    /* reserved for local use */
  100. #define    LOG_LOCAL5    (21<<3)    /* reserved for local use */
  101. #define    LOG_LOCAL6    (22<<3)    /* reserved for local use */
  102. #define    LOG_LOCAL7    (23<<3)    /* reserved for local use */
  103.  
  104. #define    LOG_NFACILITIES    24    /* current number of facilities */
  105. #define    LOG_FACMASK    0x03f8    /* mask to extract facility part */
  106.                 /* facility of pri */
  107. #define    LOG_FAC(p)    (((p) & LOG_FACMASK) >> 3)
  108.  
  109. #ifdef SYSLOG_NAMES
  110. CODE facilitynames[] = {
  111.     "auth",    LOG_AUTH,
  112.     "cron",     LOG_CRON,
  113.     "daemon",    LOG_DAEMON,
  114.     "kern",    LOG_KERN,
  115.     "lpr",        LOG_LPR,
  116.     "mail",    LOG_MAIL,
  117.     "mark",     INTERNAL_MARK,        /* INTERNAL */
  118.     "news",    LOG_NEWS,
  119.     "security",    LOG_AUTH,        /* DEPRECATED */
  120.     "syslog",    LOG_SYSLOG,
  121.     "user",    LOG_USER,
  122.     "uucp",    LOG_UUCP,
  123.     "local0",    LOG_LOCAL0,
  124.     "local1",    LOG_LOCAL1,
  125.     "local2",    LOG_LOCAL2,
  126.     "local3",    LOG_LOCAL3,
  127.     "local4",    LOG_LOCAL4,
  128.     "local5",    LOG_LOCAL5,
  129.     "local6",    LOG_LOCAL6,
  130.     "local7",    LOG_LOCAL7,
  131.     NULL,        -1,
  132. };
  133. #endif
  134.  
  135. #ifdef KERNEL
  136. #define    LOG_PRINTF    -1    /* pseudo-priority to indicate use of printf */
  137. #endif
  138.  
  139. /*
  140.  * arguments to setlogmask.
  141.  */
  142. #define    LOG_MASK(pri)    (1 << (pri))        /* mask for one priority */
  143. #define    LOG_UPTO(pri)    ((1 << ((pri)+1)) - 1)    /* all priorities through pri */
  144.  
  145. /*
  146.  * Option flags for openlog.
  147.  *
  148.  * LOG_ODELAY no longer does anything.
  149.  * LOG_NDELAY is the inverse of what it used to be.
  150.  */
  151. #define    LOG_PID        0x01    /* log the pid with each message */
  152. #define    LOG_CONS    0x02    /* log on the console if errors in sending */
  153. #define    LOG_ODELAY    0x04    /* delay open until first syslog() (default) */
  154. #define    LOG_NDELAY    0x08    /* don't delay open */
  155. #define    LOG_NOWAIT    0x10    /* don't wait for console forks: DEPRECATED */
  156. #define    LOG_PERROR    0x20    /* log to stderr as well */
  157.