diff options
author | Martin Samuelsson <msamuelsson@storvix.eu> | 2023-02-24 14:31:43 +0100 |
---|---|---|
committer | cos <cos> | 2023-03-02 07:40:47 +0100 |
commit | c3e521e4ac4725daff075653c5c9163bfcb15526 (patch) | |
tree | f8bb8270b1d81079be065ca9c765f393fb5589e7 /libsyslog/src/facility.rs | |
parent | 8ccef7cbe4c11c1638f82e1a9f4a36f5b643551a (diff) | |
download | libsyslog-rs-c3e521e4ac4725daff075653c5c9163bfcb15526.zip |
Add actual implementationlibsyslog_v0.1.0libsyslog-sys_v0.1.0
Diffstat (limited to 'libsyslog/src/facility.rs')
-rw-r--r-- | libsyslog/src/facility.rs | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/libsyslog/src/facility.rs b/libsyslog/src/facility.rs new file mode 100644 index 0000000..679403a --- /dev/null +++ b/libsyslog/src/facility.rs @@ -0,0 +1,107 @@ +use libsyslog_sys::*; + +/// Typesafe representation of syslog facility constants. +#[derive(Debug)] +pub enum Facility { + /// [LOG_KERN][`libsyslog_sys::LOG_KERN`] + /// Kernel messages. Not to sent from userland processes. + #[cfg(any(target_os = "freebsd", target_os="haiku", target_os = "linux", target_os = "netbsd", target_os = "illumos", target_os = "openbsd"))] + Kern = LOG_KERN as isize, + /// [LOG_MAIL][`libsyslog_sys::LOG_MAIL`] + /// Email system. + #[cfg(any(target_os = "freebsd", target_os="haiku", target_os = "linux", target_os = "netbsd", target_os = "illumos", target_os = "openbsd"))] + Mail = LOG_MAIL as isize, + /// [LOG_DAEMON][`libsyslog_sys::LOG_DAEMON`] + /// Daemons. + #[cfg(any(target_os = "freebsd", target_os="haiku", target_os = "linux", target_os = "netbsd", target_os = "illumos", target_os = "openbsd"))] + Daemon = LOG_DAEMON as isize, + /// [LOG_AUTH][`libsyslog_sys::LOG_AUTH`] + /// Authentication. + #[cfg(any(target_os = "freebsd", target_os="haiku", target_os = "linux", target_os = "netbsd", target_os = "illumos", target_os = "openbsd"))] + Auth = LOG_AUTH as isize, + /// [LOG_SYSLOG][`libsyslog_sys::LOG_SYSLOG`] + /// Internal messages from syslog. Not to be sent from other processes. + #[cfg(any(target_os = "freebsd", target_os="haiku", target_os = "linux", target_os = "netbsd", target_os = "illumos", target_os = "openbsd"))] + Syslog = LOG_SYSLOG as isize, + /// [LOG_LPR][`libsyslog_sys::LOG_LPR`] + /// Printing. + #[cfg(any(target_os = "freebsd", target_os="haiku", target_os = "linux", target_os = "netbsd", target_os = "illumos", target_os = "openbsd"))] + Lpr = LOG_LPR as isize, + /// [LOG_NEWS][`libsyslog_sys::LOG_NEWS`] + /// Usenet. + #[cfg(any(target_os = "freebsd", target_os="haiku", target_os = "linux", target_os = "netbsd", target_os = "illumos", target_os = "openbsd"))] + News = LOG_NEWS as isize, + /// [LOG_UUCP][`libsyslog_sys::LOG_UUCP`] + /// Unix to unix copy + #[cfg(any(target_os = "freebsd", target_os="haiku", target_os = "linux", target_os = "netbsd", target_os = "illumos", target_os = "openbsd"))] + Uucp = LOG_UUCP as isize, + /// [LOG_CRON][`libsyslog_sys::LOG_CRON`] + /// Scheduled jobs (at and cron). + #[cfg(any(target_os = "freebsd", target_os="haiku", target_os = "linux", target_os = "netbsd", target_os = "illumos", target_os = "openbsd"))] + Cron = LOG_CRON as isize, + /// [LOG_AUTHPRIV][`libsyslog_sys::LOG_AUTHPRIV`] + /// Authentication, sensitive data. + #[cfg(any(target_os = "freebsd", target_os="haiku", target_os = "linux", target_os = "netbsd", target_os = "illumos", target_os = "openbsd"))] + AuthPriv = LOG_AUTHPRIV as isize, + /// [LOG_FTP][`libsyslog_sys::LOG_FTP`] + /// File transfer protocol system. + #[cfg(any(target_os = "freebsd", target_os="haiku", target_os = "linux", target_os = "netbsd", target_os = "illumos", target_os = "openbsd"))] + Ftp = LOG_FTP as isize, + + /// [LOG_ALTCRON][`libsyslog_sys::LOG_ALTCRON`] + /// Scheduled jobs, BSD (at and cron). + #[cfg(target_os = "illumos")] + AltCron = LOG_ALTCRON as isize, + /// [LOG_NTP][`libsyslog_sys::LOG_NTP`] + /// Network time protocol. + #[cfg(any(target_os = "freebsd", target_os = "illumos"))] + Ntp = LOG_NTP as isize, + /// [LOG_AUDIT][`libsyslog_sys::LOG_AUDIT`] or LOG_SECURITY + /// Security/Audit. Low level constant varies between platforms. + #[cfg(target_os = "illumos")] + Security = LOG_AUDIT as isize, + /// LOG_AUDIT or [LOG_SECURITY][`libsyslog_sys::LOG_SECURITY`] + /// Security/Audit. Low level constant varies between platforms. + #[cfg(target_os = "freebsd")] + Security = LOG_SECURITY as isize, + /// [LOG_CONSOLE][`libsyslog_sys::LOG_CONSOLE`] + /// Console, BSD. + #[cfg(any(target_os = "freebsd", target_os = "illumos"))] + Console = LOG_CONSOLE as isize, + + /// [LOG_USER][`libsyslog_sys::LOG_USER`] + /// Default facility. + User = LOG_USER as isize, + /// [LOG_LOCAL0][`libsyslog_sys::LOG_LOCAL0`] + /// Site specific facility 0. + Local0 = LOG_LOCAL0 as isize, + /// [LOG_LOCAL1][`libsyslog_sys::LOG_LOCAL1`] + /// Site specific facility 1. + Local1 = LOG_LOCAL1 as isize, + /// [LOG_LOCAL2][`libsyslog_sys::LOG_LOCAL2`] + /// Site specific facility 2. + Local2 = LOG_LOCAL2 as isize, + /// [LOG_LOCAL3][`libsyslog_sys::LOG_LOCAL3`] + /// Site specific facility 3. + Local3 = LOG_LOCAL3 as isize, + /// [LOG_LOCAL4][`libsyslog_sys::LOG_LOCAL4`] + /// Site specific facility 4. + Local4 = LOG_LOCAL4 as isize, + /// [LOG_LOCAL5][`libsyslog_sys::LOG_LOCAL5`] + /// Site specific facility 5. + Local5 = LOG_LOCAL5 as isize, + /// [LOG_LOCAL6][`libsyslog_sys::LOG_LOCAL6`] + /// Site specific facility 6. + Local6 = LOG_LOCAL6 as isize, + /// [LOG_LOCAL7][`libsyslog_sys::LOG_LOCAL7`] + /// Site specific facility 7. + Local7 = LOG_LOCAL7 as isize, +} + +impl Default for Facility { + fn default() -> Facility { + //! Returns [`Facility::User`]. + + Facility::User + } +} |