iPXE
Defines | Functions
syslog.h File Reference

Syslog protocol. More...

#include <syslog.h>

Go to the source code of this file.

Defines

#define SYSLOG_PORT   514
 Syslog server port.
#define SYSLOG_BUFSIZE   128
 Syslog line buffer size.
#define SYSLOG_DEFAULT_FACILITY   0 /* kernel */
 Syslog default facility.
#define SYSLOG_DEFAULT_SEVERITY   LOG_INFO
 Syslog default severity.
#define SYSLOG_PRIORITY(facility, severity)   ( 8 * (facility) + (severity) )
 Syslog priority.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
int syslog_send (struct interface *xfer, unsigned int severity, const char *message, const char *terminator)
 Transmit formatted syslog message.

Detailed Description

Syslog protocol.

Definition in file syslog.h.


Define Documentation

#define SYSLOG_PORT   514

Syslog server port.

Definition at line 15 of file syslog.h.

#define SYSLOG_BUFSIZE   128

Syslog line buffer size.

This is a policy decision

Definition at line 21 of file syslog.h.

#define SYSLOG_DEFAULT_FACILITY   0 /* kernel */

Syslog default facility.

This is a policy decision

Definition at line 27 of file syslog.h.

Referenced by syslog_send().

Syslog default severity.

This is a policy decision

Definition at line 33 of file syslog.h.

Referenced by syslog_handle_priority(), and syslogs_handle_priority().

#define SYSLOG_PRIORITY (   facility,
  severity 
)    ( 8 * (facility) + (severity) )

Syslog priority.

Definition at line 36 of file syslog.h.

Referenced by syslog_send().


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )
int syslog_send ( struct interface xfer,
unsigned int  severity,
const char *  message,
const char *  terminator 
)

Transmit formatted syslog message.

Parameters:
xferData transfer interface
severitySeverity
messageMessage
terminatorMessage terminator
Return values:
rcReturn status code

Definition at line 97 of file syslog.c.

References domain, SYSLOG_DEFAULT_FACILITY, syslog_domain, syslog_hostname, SYSLOG_PRIORITY, and xfer_printf().

Referenced by syslog_putchar(), and syslogs_putchar().

                                                                {
        const char *hostname = ( syslog_hostname ? syslog_hostname : "" );
        const char *domain = ( ( hostname[0] && syslog_domain ) ?
                               syslog_domain : "" );

        return xfer_printf ( xfer, "<%d>%s%s%s%sipxe: %s%s",
                             SYSLOG_PRIORITY ( SYSLOG_DEFAULT_FACILITY,
                                               severity ), hostname,
                             ( domain[0] ? "." : "" ), domain,
                             ( hostname[0] ? " " : "" ), message, terminator );
}