1*9034ec65Schristos /* $NetBSD: ntp_syslog.h,v 1.6 2020/05/25 20:47:20 christos Exp $ */ 2abb0f93cSkardel 3abb0f93cSkardel /* 4abb0f93cSkardel * A hack for platforms which require specially built syslog facilities 5abb0f93cSkardel */ 6abb0f93cSkardel 7abb0f93cSkardel #ifndef NTP_SYSLOG_H 8abb0f93cSkardel #define NTP_SYSLOG_H 9abb0f93cSkardel 104305584aSkardel #include <ntp_types.h> /* u_int32 type */ 114305584aSkardel 12abb0f93cSkardel #ifdef VMS 13abb0f93cSkardel extern void msyslog(); 1409f14f80Schristos extern void mvsyslog(); 15abb0f93cSkardel #else 16abb0f93cSkardel # ifndef SYS_VXWORKS 17abb0f93cSkardel # include <syslog.h> 18abb0f93cSkardel # endif 19abb0f93cSkardel #endif /* VMS */ 20abb0f93cSkardel #include <stdio.h> 21abb0f93cSkardel 22abb0f93cSkardel extern int syslogit; 234305584aSkardel extern int msyslog_term; /* duplicate to stdout/err */ 242b3787f6Schristos extern int msyslog_term_pid; 252b3787f6Schristos extern int msyslog_include_timestamp; 264305584aSkardel extern FILE * syslog_file; /* if syslogit is FALSE, log to 274305584aSkardel this file and not syslog */ 282b3787f6Schristos extern char * syslog_fname; 292b3787f6Schristos extern char * syslog_abs_fname; 30abb0f93cSkardel 31abb0f93cSkardel #if defined(VMS) || defined (SYS_VXWORKS) 32abb0f93cSkardel #define LOG_EMERG 0 /* system is unusable */ 33abb0f93cSkardel #define LOG_ALERT 1 /* action must be taken immediately */ 34abb0f93cSkardel #define LOG_CRIT 2 /* critical conditions */ 35abb0f93cSkardel #define LOG_ERR 3 /* error conditions */ 36abb0f93cSkardel #define LOG_WARNING 4 /* warning conditions */ 37abb0f93cSkardel #define LOG_NOTICE 5 /* normal but signification condition */ 38abb0f93cSkardel #define LOG_INFO 6 /* informational */ 39abb0f93cSkardel #define LOG_DEBUG 7 /* debug-level messages */ 40abb0f93cSkardel #endif /* VMS || VXWORKS */ 41abb0f93cSkardel 42abb0f93cSkardel /* 43abb0f93cSkardel * syslog output control 44abb0f93cSkardel */ 45abb0f93cSkardel #define NLOG_INFO 0x00000001 46abb0f93cSkardel #define NLOG_EVENT 0x00000002 47abb0f93cSkardel #define NLOG_STATUS 0x00000004 48abb0f93cSkardel #define NLOG_STATIST 0x00000008 49abb0f93cSkardel 50abb0f93cSkardel #define NLOG_OSYS 0 /* offset for system flags */ 51abb0f93cSkardel #define NLOG_SYSMASK 0x0000000F /* system log events */ 52abb0f93cSkardel #define NLOG_SYSINFO 0x00000001 /* system info log events */ 53abb0f93cSkardel #define NLOG_SYSEVENT 0x00000002 /* system events */ 54abb0f93cSkardel #define NLOG_SYSSTATUS 0x00000004 /* system status (sync/unsync) */ 55abb0f93cSkardel #define NLOG_SYSSTATIST 0x00000008 /* system statistics output */ 56abb0f93cSkardel 57abb0f93cSkardel #define NLOG_OPEER 4 /* offset for peer flags */ 58abb0f93cSkardel #define NLOG_PEERMASK 0x000000F0 /* peer log events */ 59abb0f93cSkardel #define NLOG_PEERINFO 0x00000010 /* peer info log events */ 60abb0f93cSkardel #define NLOG_PEEREVENT 0x00000020 /* peer events */ 61abb0f93cSkardel #define NLOG_PEERSTATUS 0x00000040 /* peer status (sync/unsync) */ 62abb0f93cSkardel #define NLOG_PEERSTATIST 0x00000080 /* peer statistics output */ 63abb0f93cSkardel 64abb0f93cSkardel #define NLOG_OCLOCK 8 /* offset for clock flags */ 65abb0f93cSkardel #define NLOG_CLOCKMASK 0x00000F00 /* clock log events */ 66abb0f93cSkardel #define NLOG_CLOCKINFO 0x00000100 /* clock info log events */ 67abb0f93cSkardel #define NLOG_CLOCKEVENT 0x00000200 /* clock events */ 68abb0f93cSkardel #define NLOG_CLOCKSTATUS 0x00000400 /* clock status (sync/unsync) */ 69abb0f93cSkardel #define NLOG_CLOCKSTATIST 0x00000800 /* clock statistics output */ 70abb0f93cSkardel 71abb0f93cSkardel #define NLOG_OSYNC 12 /* offset for sync flags */ 72abb0f93cSkardel #define NLOG_SYNCMASK 0x0000F000 /* sync log events */ 73abb0f93cSkardel #define NLOG_SYNCINFO 0x00001000 /* sync info log events */ 74abb0f93cSkardel #define NLOG_SYNCEVENT 0x00002000 /* sync events */ 75abb0f93cSkardel #define NLOG_SYNCSTATUS 0x00004000 /* sync status (sync/unsync) */ 76abb0f93cSkardel #define NLOG_SYNCSTATIST 0x00008000 /* sync statistics output */ 77abb0f93cSkardel 784305584aSkardel extern u_int32 ntp_syslogmask; 792b3787f6Schristos 802b3787f6Schristos #define NLOG(bits) if (ntp_syslogmask & (bits)) 812b3787f6Schristos 822b3787f6Schristos #define LOGIF(nlog_suffix, msl_args) \ 832b3787f6Schristos do { \ 842b3787f6Schristos NLOG(NLOG_##nlog_suffix) /* like "if (...) */ \ 852b3787f6Schristos msyslog msl_args; \ 862b3787f6Schristos } while (FALSE) 87abb0f93cSkardel 88*9034ec65Schristos extern int change_iobufs(int how); 89*9034ec65Schristos /* how: 0->unbuffered, 1->linebuffer, 2->full */ 90*9034ec65Schristos 91abb0f93cSkardel #endif /* NTP_SYSLOG_H */ 92