|
ProtoCore v1.0.16
Deterministic, zero-heap network stack for embedded targets
|
The syslog originator (RFC 5424), carried one message per UDP datagram (RFC 5426). More...
#include "protocore_config.h"Go to the source code of this file.
The syslog originator (RFC 5424), carried one message per UDP datagram (RFC 5426).
RFC 5424 sec 3 names the ends: an originator "generates syslog content to be carried in a message", a collector "gathers syslog content for further analysis". This module is the originator, and the collector is a UDP endpoint on the well-known port 514 (RFC 5426 sec 3.3).
RFC 5424 sec 6 gives the message:
SYSLOG-MSG = HEADER SP STRUCTURED-DATA [SP MSG] HEADER = PRI VERSION SP TIMESTAMP SP HOSTNAME SP APP-NAME SP PROCID SP MSGID
The line built here is <PRIVAL>1 - HOSTNAME APP-NAME - - - MSG. VERSION is "1" (sec 6.2.2), PRIVAL is Facility * 8 + Severity in 0..191 (sec 6.2.1), and TIMESTAMP (sec 6.2.3), PROCID (sec 6.2.6), MSGID (sec 6.2.7) and STRUCTURED-DATA (sec 6.3) are each the NILVALUE "-" (sec 6, NILVALUE = "-"). MSG is MSG-ANY, the caller's octets with no leading BOM (sec 6.4).
RFC 5426 sec 3.1: one syslog message per datagram, no additional data in the payload. Nothing is acknowledged (RFC 5426 sec 4.1), so a send reports only that the stack took the octets.
PROTOCORE_SYSLOG_MSG_MAX bounds the line a log builds; RFC 5426 sec 3.2 puts the receiver floor at 480 octets for IPv4 and 1180 for IPv6. A line that does not fit reports 0 bytes and no datagram leaves.
HOSTNAME and APP-NAME are copied into fixed storage at init, so nothing a caller passes has to outlive the call.
The module exports one symbol, Syslog. Everything in syslog.c has internal linkage.
Definition in file syslog.h.