154359Sroberto/* 254359Sroberto * A hack for platforms which require specially built syslog facilities 354359Sroberto */ 454359Sroberto 554359Sroberto#ifndef NTP_SYSLOG_H 654359Sroberto#define NTP_SYSLOG_H 754359Sroberto 8290001Sglebius#include <ntp_types.h> /* u_int32 type */ 9290001Sglebius 10290001Sglebius#ifdef VMS 1154359Srobertoextern void msyslog(); 12290001Sglebiusextern void mvsyslog(); 13290001Sglebius#else 14290001Sglebius# ifndef SYS_VXWORKS 15290001Sglebius# include <syslog.h> 16290001Sglebius# endif 17290001Sglebius#endif /* VMS */ 18290001Sglebius#include <stdio.h> 1954359Sroberto 20290001Sglebiusextern int syslogit; 21290001Sglebiusextern int msyslog_term; /* duplicate to stdout/err */ 22290001Sglebiusextern int msyslog_term_pid; 23290001Sglebiusextern int msyslog_include_timestamp; 24290001Sglebiusextern FILE * syslog_file; /* if syslogit is FALSE, log to 25290001Sglebius this file and not syslog */ 26290001Sglebiusextern char * syslog_fname; 27290001Sglebiusextern char * syslog_abs_fname; 2854359Sroberto 2954359Sroberto#if defined(VMS) || defined (SYS_VXWORKS) 3054359Sroberto#define LOG_EMERG 0 /* system is unusable */ 3154359Sroberto#define LOG_ALERT 1 /* action must be taken immediately */ 3254359Sroberto#define LOG_CRIT 2 /* critical conditions */ 3354359Sroberto#define LOG_ERR 3 /* error conditions */ 3454359Sroberto#define LOG_WARNING 4 /* warning conditions */ 3554359Sroberto#define LOG_NOTICE 5 /* normal but signification condition */ 3654359Sroberto#define LOG_INFO 6 /* informational */ 3754359Sroberto#define LOG_DEBUG 7 /* debug-level messages */ 3854359Sroberto#endif /* VMS || VXWORKS */ 3954359Sroberto 4054359Sroberto/* 4154359Sroberto * syslog output control 4254359Sroberto */ 4354359Sroberto#define NLOG_INFO 0x00000001 4454359Sroberto#define NLOG_EVENT 0x00000002 4554359Sroberto#define NLOG_STATUS 0x00000004 4654359Sroberto#define NLOG_STATIST 0x00000008 4754359Sroberto 4854359Sroberto#define NLOG_OSYS 0 /* offset for system flags */ 49290001Sglebius#define NLOG_SYSMASK 0x0000000F /* system log events */ 5054359Sroberto#define NLOG_SYSINFO 0x00000001 /* system info log events */ 5154359Sroberto#define NLOG_SYSEVENT 0x00000002 /* system events */ 5254359Sroberto#define NLOG_SYSSTATUS 0x00000004 /* system status (sync/unsync) */ 5354359Sroberto#define NLOG_SYSSTATIST 0x00000008 /* system statistics output */ 5454359Sroberto 5554359Sroberto#define NLOG_OPEER 4 /* offset for peer flags */ 56290001Sglebius#define NLOG_PEERMASK 0x000000F0 /* peer log events */ 5754359Sroberto#define NLOG_PEERINFO 0x00000010 /* peer info log events */ 5854359Sroberto#define NLOG_PEEREVENT 0x00000020 /* peer events */ 5954359Sroberto#define NLOG_PEERSTATUS 0x00000040 /* peer status (sync/unsync) */ 6054359Sroberto#define NLOG_PEERSTATIST 0x00000080 /* peer statistics output */ 6154359Sroberto 6254359Sroberto#define NLOG_OCLOCK 8 /* offset for clock flags */ 63290001Sglebius#define NLOG_CLOCKMASK 0x00000F00 /* clock log events */ 6454359Sroberto#define NLOG_CLOCKINFO 0x00000100 /* clock info log events */ 6554359Sroberto#define NLOG_CLOCKEVENT 0x00000200 /* clock events */ 6654359Sroberto#define NLOG_CLOCKSTATUS 0x00000400 /* clock status (sync/unsync) */ 6754359Sroberto#define NLOG_CLOCKSTATIST 0x00000800 /* clock statistics output */ 6854359Sroberto 6954359Sroberto#define NLOG_OSYNC 12 /* offset for sync flags */ 70290001Sglebius#define NLOG_SYNCMASK 0x0000F000 /* sync log events */ 7154359Sroberto#define NLOG_SYNCINFO 0x00001000 /* sync info log events */ 7254359Sroberto#define NLOG_SYNCEVENT 0x00002000 /* sync events */ 7354359Sroberto#define NLOG_SYNCSTATUS 0x00004000 /* sync status (sync/unsync) */ 7454359Sroberto#define NLOG_SYNCSTATIST 0x00008000 /* sync statistics output */ 7554359Sroberto 76290001Sglebiusextern u_int32 ntp_syslogmask; 7754359Sroberto 78290001Sglebius#define NLOG(bits) if (ntp_syslogmask & (bits)) 79290001Sglebius 80290001Sglebius#define LOGIF(nlog_suffix, msl_args) \ 81290001Sglebiusdo { \ 82290001Sglebius NLOG(NLOG_##nlog_suffix) /* like "if (...) */ \ 83290001Sglebius msyslog msl_args; \ 84290001Sglebius} while (FALSE) 85290001Sglebius 8654359Sroberto#endif /* NTP_SYSLOG_H */ 87