Define a syslog server interface.
More...
#include "util/gnuplot.h"
|
| ISyslogServer (const ISyslogServer &)=delete |
SyslogServerType | Type () const |
| Return s the type of server.
|
void | Address (const std::string &address) |
| Bind address of the server.
|
const std::string & | Address () const |
void | Name (const std::string &name) |
const std::string & | Name () const |
void | Port (uint16_t port) |
uint16_t | Port () const |
virtual void | AddMsg (const SyslogMessage &msg) |
std::optional< SyslogMessage > | GetMsg (bool block) |
| Returns the next message in the queue.
|
virtual void | Start () |
| Starts the worker thread in the server.
|
virtual void | Stop () |
| Stops the worker thread in the server.
|
size_t | NofMessages () const |
bool | IsOperable () const |
| Returns true if the receiver works as normal.
|
virtual size_t | NofConnections () const |
| Returns number of connections to the server.
|
|
| ISyslogServer ()=default |
| Default constructor.
|
In a syslog application consist of one or more syslog inputs. Each of these inputs is a syslog server object.
◆ AddMsg()
virtual void util::syslog::ISyslogServer::AddMsg |
( |
const SyslogMessage & | msg | ) |
|
|
virtual |
Adds a syslog message to the internal message queue.
◆ Address() [1/2]
const std::string & util::syslog::ISyslogServer::Address |
( |
| ) |
const |
|
inlinenodiscard |
< Returns the bind address
◆ Address() [2/2]
void util::syslog::ISyslogServer::Address |
( |
const std::string & | address | ) |
|
By default, the server binds to any incoming calls. By changing this value to 127.0.0.1. only local connections (messages) are allowed. This is recommended for UDP connections.
- Parameters
-
◆ GetMsg()
std::optional< SyslogMessage > util::syslog::ISyslogServer::GetMsg |
( |
bool | block | ) |
|
The function returns the next message in the internal message queue. The function may block the call until a message exist in the queue.
- Parameters
-
block | Set tor true if the call should block until a message exist. |
- Returns
- Returns a std::optional syslog message.
◆ IsOperable()
bool util::syslog::ISyslogServer::IsOperable |
( |
| ) |
const |
|
inlinenodiscard |
The operable flag is false if the receiving of messages fails of some reason. The receiver may fail if invalid messages is received.
- Returns
- Returns false if an error occurs in the server.
◆ Name() [1/2]
const std::string & util::syslog::ISyslogServer::Name |
( |
| ) |
const |
|
inline |
< Returns the display name of the server
◆ Name() [2/2]
void util::syslog::ISyslogServer::Name |
( |
const std::string & | name | ) |
|
|
inline |
< Sets the display name of the server.
◆ NofConnections()
virtual size_t util::syslog::ISyslogServer::NofConnections |
( |
| ) |
const |
|
nodiscardvirtual |
Returns number of connections to the server. In reality it is only TCP/IP servers that return number of connections.
- Returns
- Number of connected clients.
◆ NofMessages()
size_t util::syslog::ISyslogServer::NofMessages |
( |
| ) |
const |
|
inlinenodiscard |
< Returns the message queue size
◆ Port() [1/2]
uint16_t util::syslog::ISyslogServer::Port |
( |
| ) |
const |
|
inlinenodiscard |
< Returns the server port
◆ Port() [2/2]
void util::syslog::ISyslogServer::Port |
( |
uint16_t | port | ) |
|
|
inline |
◆ Type()
Return type of server or client.
- Returns
- Type of syslog server (or client)
The documentation for this class was generated from the following file: