syslog_client.h File Reference

Syslog client. More...

#include "core/net.h"

Go to the source code of this file.

Data Structures

struct  SyslogClientContext
 Syslog client context. More...
 

Macros

#define SYSLOG_CLIENT_SUPPORT   DISABLED
 
#define SYSLOG_CLIENT_BUFFER_SIZE   512
 
#define SYSLOG_CLIENT_PRIVATE_CONTEXT
 

Enumerations

enum  SyslogFacility {
  SYSLOG_FACILITY_KERNEL = 0 , SYSLOG_FACILITY_USER_LEVEL = 1 , SYSLOG_FACILITY_MAIL = 2 , SYSLOG_FACILITY_SYSTEM = 3 ,
  SYSLOG_FACILITY_SEC_AUTH = 4 , SYSLOG_FACILITY_INTENAL = 5 , SYSLOG_FACILITY_LINE_PRINTER = 6 , SYSLOG_FACILITY_NETWORK_NEWS = 7 ,
  SYSLOG_FACILITY_UUCP = 8 , SYSLOG_FACILITY_CLOCK = 9 , SYSLOG_FACILITY_SEC_AUTH2 = 10 , SYSLOG_FACILITY_FTP = 11 ,
  SYSLOG_FACILITY_NTP = 12 , SYSLOG_FACILITY_LOG_AUDIT = 13 , SYSLOG_FACILITY_LOG_ALERT = 14 , SYSLOG_FACILITY_Clock = 15 ,
  SYSLOG_FACILITY_LOCAL0 = 16 , SYSLOG_FACILITY_LOCAL1 = 17 , SYSLOG_FACILITY_LOCAL2 = 18 , SYSLOG_FACILITY_LOCAL3 = 19 ,
  SYSLOG_FACILITY_LOCAL4 = 20 , SYSLOG_FACILITY_LOCAL5 = 21 , SYSLOG_FACILITY_LOCAL6 = 22 , SYSLOG_FACILITY_LOCAL7 = 23
}
 Syslog facility values. More...
 
enum  SyslogSeverity {
  SYSLOG_SEVERITY_EMERGENCY = 0 , SYSLOG_SEVERITY_ALERT = 1 , SYSLOG_SEVERITY_CRITICAL = 2 , SYSLOG_SEVERITY_ERROR = 3 ,
  SYSLOG_SEVERITY_WARNING = 4 , SYSLOG_SEVERITY_NOTICE = 5 , SYSLOG_SEVERITY_INFO = 6 , SYSLOG_SEVERITY_DEBUG = 7
}
 Syslog severity values. More...
 

Functions

error_t syslogClientInit (SyslogClientContext *context)
 Syslog client initialization. More...
 
error_t syslogClientBindToInterface (SyslogClientContext *context, NetInterface *interface)
 Bind the Syslog client to a particular network interface. More...
 
error_t syslogClientConnect (SyslogClientContext *context, const IpAddr *serverIpAddr, uint16_t serverPort)
 Specify the address of the Syslog server. More...
 
error_t syslogClientSendMessage (SyslogClientContext *context, uint_t facility, uint_t severity, const char_t *message)
 Send Syslog message. More...
 
error_t syslogClientFormatMessage (SyslogClientContext *context, uint_t facility, uint_t severity, const char_t *format,...)
 Format Syslog message. More...
 
error_t syslogClientClose (SyslogClientContext *context)
 Close the connection with the Syslog server. More...
 
void syslogClientDeinit (SyslogClientContext *context)
 Release Syslog client context. More...
 

Detailed Description

Syslog client.

License

SPDX-License-Identifier: GPL-2.0-or-later

Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneTCP Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
2.4.0

Definition in file syslog_client.h.

Macro Definition Documentation

◆ SYSLOG_CLIENT_BUFFER_SIZE

#define SYSLOG_CLIENT_BUFFER_SIZE   512

Definition at line 46 of file syslog_client.h.

◆ SYSLOG_CLIENT_PRIVATE_CONTEXT

#define SYSLOG_CLIENT_PRIVATE_CONTEXT

Definition at line 53 of file syslog_client.h.

◆ SYSLOG_CLIENT_SUPPORT

#define SYSLOG_CLIENT_SUPPORT   DISABLED

Definition at line 39 of file syslog_client.h.

Enumeration Type Documentation

◆ SyslogFacility

Syslog facility values.

Enumerator
SYSLOG_FACILITY_KERNEL 

Kernel messages.

SYSLOG_FACILITY_USER_LEVEL 

User-level messages.

SYSLOG_FACILITY_MAIL 

Mail system.

SYSLOG_FACILITY_SYSTEM 

System daemons.

SYSLOG_FACILITY_SEC_AUTH 

Security/authorization messages.

SYSLOG_FACILITY_INTENAL 

Messages generated internally by syslogd.

SYSLOG_FACILITY_LINE_PRINTER 

Line printer subsystem.

SYSLOG_FACILITY_NETWORK_NEWS 

Network news subsystem.

SYSLOG_FACILITY_UUCP 

UUCP subsystem.

SYSLOG_FACILITY_CLOCK 

Clock daemon.

SYSLOG_FACILITY_SEC_AUTH2 

Security/authorization messages.

SYSLOG_FACILITY_FTP 

FTP daemon.

SYSLOG_FACILITY_NTP 

NTP subsystem.

SYSLOG_FACILITY_LOG_AUDIT 

Log audit.

SYSLOG_FACILITY_LOG_ALERT 

Log alert.

SYSLOG_FACILITY_Clock 

Clock daemon.

SYSLOG_FACILITY_LOCAL0 

Local use 0.

SYSLOG_FACILITY_LOCAL1 

Local use 1.

SYSLOG_FACILITY_LOCAL2 

Local use 2.

SYSLOG_FACILITY_LOCAL3 

Local use 3.

SYSLOG_FACILITY_LOCAL4 

Local use 4.

SYSLOG_FACILITY_LOCAL5 

Local use 5.

SYSLOG_FACILITY_LOCAL6 

Local use 6.

SYSLOG_FACILITY_LOCAL7 

Local use 7.

Definition at line 66 of file syslog_client.h.

◆ SyslogSeverity

Syslog severity values.

Enumerator
SYSLOG_SEVERITY_EMERGENCY 

System is unusable.

SYSLOG_SEVERITY_ALERT 

Action must be taken immediately.

SYSLOG_SEVERITY_CRITICAL 

Critical conditions.

SYSLOG_SEVERITY_ERROR 

Error conditions.

SYSLOG_SEVERITY_WARNING 

Warning conditions.

SYSLOG_SEVERITY_NOTICE 

Normal but significant condition.

SYSLOG_SEVERITY_INFO 

Informational messages.

SYSLOG_SEVERITY_DEBUG 

Debug-level messages.

Definition at line 99 of file syslog_client.h.

Function Documentation

◆ syslogClientBindToInterface()

error_t syslogClientBindToInterface ( SyslogClientContext context,
NetInterface interface 
)

Bind the Syslog client to a particular network interface.

Parameters
[in]contextPointer to the Syslog client context
[in]interfaceNetwork interface to be used
Returns
Error code

Definition at line 86 of file syslog_client.c.

◆ syslogClientClose()

error_t syslogClientClose ( SyslogClientContext context)

Close the connection with the Syslog server.

Parameters
[in]contextPointer to the Syslog client context
Returns
Error code

Definition at line 308 of file syslog_client.c.

◆ syslogClientConnect()

error_t syslogClientConnect ( SyslogClientContext context,
const IpAddr serverIpAddr,
uint16_t  serverPort 
)

Specify the address of the Syslog server.

Parameters
[in]contextPointer to the Syslog client context
[in]serverIpAddrIP address of the Syslog server to connect to
[in]serverPortUDP port number
Returns
Error code

Definition at line 109 of file syslog_client.c.

◆ syslogClientDeinit()

void syslogClientDeinit ( SyslogClientContext context)

Release Syslog client context.

Parameters
[in]contextPointer to the Syslog client context

Definition at line 331 of file syslog_client.c.

◆ syslogClientFormatMessage()

error_t syslogClientFormatMessage ( SyslogClientContext context,
uint_t  facility,
uint_t  severity,
const char_t format,
  ... 
)

Format Syslog message.

Parameters
[in]contextPointer to the Syslog client context
[in]facilityFacility value
[in]severitySeverity value
[in]formatNULL-terminated string that that contains a format string
[in]...Optional arguments
Returns
Error code

Definition at line 241 of file syslog_client.c.

◆ syslogClientInit()

error_t syslogClientInit ( SyslogClientContext context)

Syslog client initialization.

Parameters
[in]contextPointer to the Syslog client context
Returns
Error code

Definition at line 56 of file syslog_client.c.

◆ syslogClientSendMessage()

error_t syslogClientSendMessage ( SyslogClientContext context,
uint_t  facility,
uint_t  severity,
const char_t message 
)

Send Syslog message.

Parameters
[in]contextPointer to the Syslog client context
[in]facilityFacility value
[in]severitySeverity value
[in]messageNULL-terminated string that holds the message
Returns
Error code

Definition at line 168 of file syslog_client.c.