home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / inetd10.zip / SYSLOG.H < prev   
Text File  |  1994-06-04  |  6KB  |  154 lines

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