stumpless 2.2.0
Loading...
Searching...
No Matches
facility.h File Reference

Facility codes for classifying log entries. More...

Go to the source code of this file.

Macros

#define STUMPLESS_FACILITY_KERN_VALUE   0
 Kernel message facility code value.
 
#define STUMPLESS_FACILITY_USER_VALUE   ( 1 << 3 )
 User-level message facility code value.
 
#define STUMPLESS_FACILITY_MAIL_VALUE   ( 2 << 3 )
 Mail system facility code value.
 
#define STUMPLESS_FACILITY_DAEMON_VALUE   ( 3 << 3 )
 System daemons facility code value.
 
#define STUMPLESS_FACILITY_AUTH_VALUE   ( 4 << 3 )
 Facility code value for security/authorization messages.
 
#define STUMPLESS_FACILITY_SYSLOG_VALUE   ( 5 << 3 )
 Facility code value for messages generated internally by the logging daemon as defined by RFC 5424.
 
#define STUMPLESS_FACILITY_LPR_VALUE   ( 6 << 3 )
 Line printer subsystem facility code value.
 
#define STUMPLESS_FACILITY_NEWS_VALUE   ( 7 << 3 )
 Network news subsystem facility code value.
 
#define STUMPLESS_FACILITY_UUCP_VALUE   ( 8 << 3 )
 UUCP subsystem facility code value.
 
#define STUMPLESS_FACILITY_CRON_VALUE   ( 9 << 3 )
 Clock daemon facility code value.
 
#define STUMPLESS_FACILITY_AUTH2_VALUE   ( 10 << 3 )
 Security/authorization messages facility code value as defined by RFC 5424.
 
#define STUMPLESS_FACILITY_FTP_VALUE   ( 11 << 3 )
 FTP daemon facility code value as defined by RFC 5424.
 
#define STUMPLESS_FACILITY_NTP_VALUE   ( 12 << 3 )
 NTP subsystem facility code value as defined by RFC 5424.
 
#define STUMPLESS_FACILITY_AUDIT_VALUE   ( 13 << 3 )
 Log audit facility code value as defined by RFC 5424.
 
#define STUMPLESS_FACILITY_ALERT_VALUE   ( 14 << 3 )
 Log alert facility code value as defined by RFC 5424.
 
#define STUMPLESS_FACILITY_CRON2_VALUE   ( 15 << 3 )
 Clock daemon facility code value as defined by RFC 5424.
 
#define STUMPLESS_FACILITY_LOCAL0_VALUE   ( 16 << 3 )
 Local use 0 facility code value.
 
#define STUMPLESS_FACILITY_LOCAL1_VALUE   ( 17 << 3 )
 Local use 1 facility code value.
 
#define STUMPLESS_FACILITY_LOCAL2_VALUE   ( 18 << 3 )
 Local use 2 facility code value.
 
#define STUMPLESS_FACILITY_LOCAL3_VALUE   ( 19 << 3 )
 Local use 3 facility code value.
 
#define STUMPLESS_FACILITY_LOCAL4_VALUE   ( 20 << 3 )
 Local use 4 facility code value.
 
#define STUMPLESS_FACILITY_LOCAL5_VALUE   ( 21 << 3 )
 Local use 5 facility code value.
 
#define STUMPLESS_FACILITY_LOCAL6_VALUE   ( 22 << 3 )
 Local use 6 facility code value.
 
#define STUMPLESS_FACILITY_LOCAL7_VALUE   ( 23 << 3 )
 Local use 7 facility code value.
 
#define STUMPLESS_FOREACH_FACILITY(ACTION)
 A macro function that runs the provided action once for each facility, providing the symbol and value.
 

Enumerations

enum  stumpless_facility { STUMPLESS_GENERATE_ENUM =( STUMPLESS_FACILITY_KERN, 0 ) STUMPLESS_GENERATE_ENUM( STUMPLESS_FACILITY_USER, ( 1 << 3 ) ) STUMPLESS_GENERATE_ENUM( STUMPLESS_FACILITY_MAIL, ( 2 << 3 ) ) STUMPLESS_GENERATE_ENUM( STUMPLESS_FACILITY_DAEMON, ( 3 << 3 ) ) STUMPLESS_GENERATE_ENUM( STUMPLESS_FACILITY_AUTH, ( 4 << 3 ) ) STUMPLESS_GENERATE_ENUM( STUMPLESS_FACILITY_SYSLOG, ( 5 << 3 ) ) STUMPLESS_GENERATE_ENUM( STUMPLESS_FACILITY_LPR, ( 6 << 3 ) ) STUMPLESS_GENERATE_ENUM( STUMPLESS_FACILITY_NEWS, ( 7 << 3 ) ) STUMPLESS_GENERATE_ENUM( STUMPLESS_FACILITY_UUCP, ( 8 << 3 ) ) STUMPLESS_GENERATE_ENUM( STUMPLESS_FACILITY_CRON, ( 9 << 3 ) ) STUMPLESS_GENERATE_ENUM( STUMPLESS_FACILITY_AUTH2, ( 10 << 3 ) ) STUMPLESS_GENERATE_ENUM( STUMPLESS_FACILITY_FTP, ( 11 << 3 ) ) STUMPLESS_GENERATE_ENUM( STUMPLESS_FACILITY_NTP, ( 12 << 3 ) ) STUMPLESS_GENERATE_ENUM( STUMPLESS_FACILITY_AUDIT, ( 13 << 3 ) ) STUMPLESS_GENERATE_ENUM( STUMPLESS_FACILITY_ALERT, ( 14 << 3 ) ) STUMPLESS_GENERATE_ENUM( STUMPLESS_FACILITY_CRON2, ( 15 << 3 ) ) STUMPLESS_GENERATE_ENUM( STUMPLESS_FACILITY_LOCAL0, ( 16 << 3 ) ) STUMPLESS_GENERATE_ENUM( STUMPLESS_FACILITY_LOCAL1, ( 17 << 3 ) ) STUMPLESS_GENERATE_ENUM( STUMPLESS_FACILITY_LOCAL2, ( 18 << 3 ) ) STUMPLESS_GENERATE_ENUM( STUMPLESS_FACILITY_LOCAL3, ( 19 << 3 ) ) STUMPLESS_GENERATE_ENUM( STUMPLESS_FACILITY_LOCAL4, ( 20 << 3 ) ) STUMPLESS_GENERATE_ENUM( STUMPLESS_FACILITY_LOCAL5, ( 21 << 3 ) ) STUMPLESS_GENERATE_ENUM( STUMPLESS_FACILITY_LOCAL6, ( 22 << 3 ) ) STUMPLESS_GENERATE_ENUM( STUMPLESS_FACILITY_LOCAL7, ( 23 << 3 ) ) }
 All possible facility codes available to log entries. More...
 

Functions

STUMPLESS_PUBLIC_FUNCTION const char * stumpless_get_facility_string (enum stumpless_facility facility)
 Gets the string representation of the given facility.
 
STUMPLESS_PUBLIC_FUNCTION enum stumpless_facility stumpless_get_facility_enum (const char *facility_string)
 Gets the enum value corresponding to the given facility string.
 
STUMPLESS_PUBLIC_FUNCTION enum stumpless_facility stumpless_get_facility_enum_from_buffer (const char *facility_string, size_t facility_buffer_length)
 Gets the enum value corresponding to the given facility string.
 

Detailed Description

Facility codes for classifying log entries.

See RFC 5424 section 6.2.1 for details on these values. The underlying values of facilities are defined to be compatible with the syslog.h header if it is found on the system. Otherwise, they are defined as closely as possible to the RFC 5425 specification. Some facilities do not exist in the syslog.h header and as such are always defined according to the RFC.

Macro Definition Documentation

◆ STUMPLESS_FACILITY_ALERT_VALUE

#define STUMPLESS_FACILITY_ALERT_VALUE   ( 14 << 3 )

Log alert facility code value as defined by RFC 5424.

Since
release v2.0.0.

◆ STUMPLESS_FACILITY_AUDIT_VALUE

#define STUMPLESS_FACILITY_AUDIT_VALUE   ( 13 << 3 )

Log audit facility code value as defined by RFC 5424.

Since
release v2.0.0.

◆ STUMPLESS_FACILITY_AUTH2_VALUE

#define STUMPLESS_FACILITY_AUTH2_VALUE   ( 10 << 3 )

Security/authorization messages facility code value as defined by RFC 5424.

Since
release v2.0.0.

◆ STUMPLESS_FACILITY_AUTH_VALUE

#define STUMPLESS_FACILITY_AUTH_VALUE   ( 4 << 3 )

Facility code value for security/authorization messages.

Since
release v2.0.0.

◆ STUMPLESS_FACILITY_CRON2_VALUE

#define STUMPLESS_FACILITY_CRON2_VALUE   ( 15 << 3 )

Clock daemon facility code value as defined by RFC 5424.

Since
release v2.0.0.

◆ STUMPLESS_FACILITY_CRON_VALUE

#define STUMPLESS_FACILITY_CRON_VALUE   ( 9 << 3 )

Clock daemon facility code value.

Since
release v2.0.0.

◆ STUMPLESS_FACILITY_DAEMON_VALUE

#define STUMPLESS_FACILITY_DAEMON_VALUE   ( 3 << 3 )

System daemons facility code value.

Since
release v2.0.0.

◆ STUMPLESS_FACILITY_FTP_VALUE

#define STUMPLESS_FACILITY_FTP_VALUE   ( 11 << 3 )

FTP daemon facility code value as defined by RFC 5424.

Since
release v2.0.0.

◆ STUMPLESS_FACILITY_KERN_VALUE

#define STUMPLESS_FACILITY_KERN_VALUE   0

Kernel message facility code value.

Since
release v2.0.0.

◆ STUMPLESS_FACILITY_LOCAL0_VALUE

#define STUMPLESS_FACILITY_LOCAL0_VALUE   ( 16 << 3 )

Local use 0 facility code value.

Since
release v2.0.0.

◆ STUMPLESS_FACILITY_LOCAL1_VALUE

#define STUMPLESS_FACILITY_LOCAL1_VALUE   ( 17 << 3 )

Local use 1 facility code value.

Since
release v2.0.0.

◆ STUMPLESS_FACILITY_LOCAL2_VALUE

#define STUMPLESS_FACILITY_LOCAL2_VALUE   ( 18 << 3 )

Local use 2 facility code value.

Since
release v2.0.0.

◆ STUMPLESS_FACILITY_LOCAL3_VALUE

#define STUMPLESS_FACILITY_LOCAL3_VALUE   ( 19 << 3 )

Local use 3 facility code value.

Since
release v2.0.0.

◆ STUMPLESS_FACILITY_LOCAL4_VALUE

#define STUMPLESS_FACILITY_LOCAL4_VALUE   ( 20 << 3 )

Local use 4 facility code value.

Since
release v2.0.0.

◆ STUMPLESS_FACILITY_LOCAL5_VALUE

#define STUMPLESS_FACILITY_LOCAL5_VALUE   ( 21 << 3 )

Local use 5 facility code value.

Since
release v2.0.0.

◆ STUMPLESS_FACILITY_LOCAL6_VALUE

#define STUMPLESS_FACILITY_LOCAL6_VALUE   ( 22 << 3 )

Local use 6 facility code value.

Since
release v2.0.0.

◆ STUMPLESS_FACILITY_LOCAL7_VALUE

#define STUMPLESS_FACILITY_LOCAL7_VALUE   ( 23 << 3 )

Local use 7 facility code value.

Since
release v2.0.0.

◆ STUMPLESS_FACILITY_LPR_VALUE

#define STUMPLESS_FACILITY_LPR_VALUE   ( 6 << 3 )

Line printer subsystem facility code value.

Since
release v2.0.0.

◆ STUMPLESS_FACILITY_MAIL_VALUE

#define STUMPLESS_FACILITY_MAIL_VALUE   ( 2 << 3 )

Mail system facility code value.

Since
release v2.0.0.

◆ STUMPLESS_FACILITY_NEWS_VALUE

#define STUMPLESS_FACILITY_NEWS_VALUE   ( 7 << 3 )

Network news subsystem facility code value.

Since
release v2.0.0.

◆ STUMPLESS_FACILITY_NTP_VALUE

#define STUMPLESS_FACILITY_NTP_VALUE   ( 12 << 3 )

NTP subsystem facility code value as defined by RFC 5424.

Since
release v2.0.0.

◆ STUMPLESS_FACILITY_SYSLOG_VALUE

#define STUMPLESS_FACILITY_SYSLOG_VALUE   ( 5 << 3 )

Facility code value for messages generated internally by the logging daemon as defined by RFC 5424.

Since
release v2.0.0.

◆ STUMPLESS_FACILITY_USER_VALUE

#define STUMPLESS_FACILITY_USER_VALUE   ( 1 << 3 )

User-level message facility code value.

Since
release v2.0.0.

◆ STUMPLESS_FACILITY_UUCP_VALUE

#define STUMPLESS_FACILITY_UUCP_VALUE   ( 8 << 3 )

UUCP subsystem facility code value.

Since
release v2.0.0.

◆ STUMPLESS_FOREACH_FACILITY

#define STUMPLESS_FOREACH_FACILITY ( ACTION)

A macro function that runs the provided action once for each facility, providing the symbol and value.

The action must take two arguments, the first being the symbol name of the facility, and the second the numeric value of the facility.

Since
release v2.0.0.

Enumeration Type Documentation

◆ stumpless_facility

All possible facility codes available to log entries.

In versions prior to 2.0.0, these values were simply #define symbols. They have been changed to an enum to clearly convey proper usage.

Since
release v2.0.0.
Enumerator
STUMPLESS_GENERATE_ENUM 

Kernel messages.

Function Documentation

◆ stumpless_get_facility_enum()

STUMPLESS_PUBLIC_FUNCTION enum stumpless_facility stumpless_get_facility_enum ( const char * facility_string)

Gets the enum value corresponding to the given facility string.

Thread Safety: MT-Safe This function is thread safe.

Async Signal Safety: AS-Safe This function is safe to call from signal handlers.

Async Cancel Safety: AC-Safe This function is safe to call from threads that may be asynchronously cancelled.

Since
release v2.1.0.
Parameters
facility_stringThe facility name to get the enum from.
Returns
The enum integer corresponding to the given facility or -1 if the string is not a valid facility name.

◆ stumpless_get_facility_enum_from_buffer()

STUMPLESS_PUBLIC_FUNCTION enum stumpless_facility stumpless_get_facility_enum_from_buffer ( const char * facility_string,
size_t facility_buffer_length )

Gets the enum value corresponding to the given facility string.

Thread Safety: MT-Safe This function is thread safe.

Async Signal Safety: AS-Safe This function is safe to call from signal handlers.

Async Cancel Safety: AC-Safe This function is safe to call from threads that may be asynchronously cancelled.

Since
release v2.2.0.
Parameters
facility_stringThe facility name to get the enum from.
facility_buffer_lengthThe length of the buffer
Returns
The enum integer corresponding to the given facility or -1 if the string is not a valid facility name.

◆ stumpless_get_facility_string()

STUMPLESS_PUBLIC_FUNCTION const char * stumpless_get_facility_string ( enum stumpless_facility facility)

Gets the string representation of the given facility.

This is a string literal that should not be modified or freed by the caller.

Thread Safety: MT-Safe This function is thread safe.

Async Signal Safety: AS-Safe This function is safe to call from signal handlers.

Async Cancel Safety: AC-Safe This function is safe to call from threads that may be asynchronously cancelled.

Since
release v2.1.0.
Parameters
facilityThe facility to get the string from.
Returns
The string representation of the given facility.