stumpless 2.2.0
Loading...
Searching...
No Matches
NetworkTarget.hpp
Go to the documentation of this file.
1#ifndef __NETWORKTARGET_HPP
2#define __NETWORKTARGET_HPP
3
4#include <stumpless/target.h>
5#include <NetworkProtocol.hpp>
7#include <stumpless/Entry.hpp>
8#include <stddef.h>
9#include <stumpless/target/network.h>
10
11namespace stumpless {
12
18 public:
19
26 static const char *DEFAULT_TRANSPORT_PORT;
33 static const size_t DEFAULT_UDP_MAX_MESSAGE_SIZE;
34
35 struct stumpless_target *equivalent;
36
37 NetworkTarget( struct stumpless_target *equivalent );
50 NetworkTarget( const char *name, const char *destination, NetworkProtocol network_protocol, TransportProtocol transport_protocol );
63 const char *GetDefaultAppName( void );
71 const char *GetDefaultMsgid( void );
86 stumpless_filter_func_t GetFilter( void );
96 int GetMask( void );
104 const char *GetName( void );
115 int GetOption( int option );
121 bool IsOpen( void );
135 NetworkTarget& Log( const char *message, ... );
152 NetworkTarget& Log( int priority, const char *message, ... );
169 NetworkTarget& Log( Facility facility, Severity severity, const char *message, ... );
181 void Open( void );
189 NetworkTarget& SetDefaultAppName( const char *app_name );
206 NetworkTarget& SetDefaultMsgid( const char *msgid );
215 NetworkTarget& SetFilter( stumpless_filter_func_t filter );
227 NetworkTarget& SetMask( int mask );
235 NetworkTarget& SetOption( int option );
250 const char *GetDestination( void );
257 const char *GetTransportPort( void );
263 size_t GetUdpMaxMessageSize( void );
278 static NetworkTarget NewPausedTarget( const char *name, NetworkProtocol network_protocol, TransportProtocol transport_protocol );
288 static NetworkTarget NewPausedTcp4Target( const char *name );
298 static NetworkTarget NewPausedTcp6Target( const char *name );
308 static NetworkTarget NewPausedUdp4Target( const char *name );
318 static NetworkTarget NewPausedUdp6Target( const char *name );
331 static NetworkTarget OpenTcp4Target( const char *name, const char *destination );
344 static NetworkTarget OpenTcp6Target( const char *name, const char *destination );
357 static NetworkTarget OpenUdp4Target( const char *name, const char *destination );
370 static NetworkTarget OpenUdp6Target( const char *name, const char *destination );
381 NetworkTarget& SetDestination( const char *destination );
392 NetworkTarget& SetTransportPort( const char *port );
411 NetworkTarget& SetUdpMaxMessageSize( size_t max_msg_size );
412 };
413
414}
415
416#endif
A log entry.
Definition Entry.hpp:19
Network targets allow traditional syslog messages to be sent to a remote server.
Definition NetworkTarget.hpp:17
static NetworkTarget OpenTcp4Target(const char *name, const char *destination)
Creates a new network network target using TCP over IPv4 with the given parameters and opens it.
static NetworkTarget OpenUdp6Target(const char *name, const char *destination)
Creates a new network network target using UDP over IPv6 with the given parameters and opens it.
const char * GetName(void)
Returns the name of this target.
int GetOption(int option)
Gets the given option for this target.
NetworkTarget & SetDefaultAppName(const char *app_name)
Sets the default app name for this target.
static NetworkTarget OpenUdp4Target(const char *name, const char *destination)
Creates a new network network target using UDP over IPv4 with the given parameters and opens it.
static NetworkTarget OpenTcp6Target(const char *name, const char *destination)
Creates a new network network target using TCP over IPv6 with the given parameters and opens it.
NetworkTarget & SetUdpMaxMessageSize(size_t max_msg_size)
Sets the maximum message size of a UDP network target.
const char * GetDefaultAppName(void)
Returns the default app name used by this target.
static const char * DEFAULT_TRANSPORT_PORT
The default transport port for network targets.
Definition NetworkTarget.hpp:26
bool IsOpen(void)
Checks to see if this target is open.
NetworkTarget & UnsetOption(int option)
Unsets an option on a target.
NetworkTarget(struct stumpless_target *equivalent)
stumpless_filter_func_t GetFilter(void)
Returns the current filter used by this target to determine if entries should be allowed through it.
const char * GetDestination(void)
Gets the destination of the target.
NetworkTarget & Log(Entry entry)
Writes an Entry to this target.
~NetworkTarget(void)
Closes this target and releases all memory and other resources held by it.
const char * GetTransportPort(void)
Gets the transport port number of the target.
static NetworkTarget NewPausedUdp4Target(const char *name)
Creates a new network target using UDP over IPv4 with the given name.
NetworkTarget & SetDefaultMsgid(const char *msgid)
Sets the default message id for this target.
NetworkTarget & Log(const char *message,...)
Writes a string message to this target.
NetworkTarget & SetMask(int mask)
Sets the log mask of a target.
static NetworkTarget NewPausedTarget(const char *name, NetworkProtocol network_protocol, TransportProtocol transport_protocol)
Creates a new network target with the given parameters but does not open it.
void Open(void)
Opens this target if it has been paused.
Facility GetDefaultFacility(void)
Gets the default facility of this target.
NetworkTarget & SetDefaultFacility(int facility)
Sets the default facility of the target.
static NetworkTarget NewPausedUdp6Target(const char *name)
Creates a new network target using UDP over IPv6 with the given name.
NetworkTarget & SetFilter(stumpless_filter_func_t filter)
Sets the filter used by this target to determine whether entries should be logged to it.
static NetworkTarget NewPausedTcp6Target(const char *name)
Creates a new network target using TCP over IPv6 with the given name.
struct stumpless_target * equivalent
Definition NetworkTarget.hpp:35
NetworkTarget & Log(Facility facility, Severity severity, const char *message,...)
Writes a log message with the given facility and severity to this target.
NetworkTarget(const char *name, const char *destination, NetworkProtocol network_protocol, TransportProtocol transport_protocol)
Creates a new network target with the given parameters and opens it.
NetworkTarget & Log(int priority, const char *message,...)
Writes a log message with the given priority to this target.
size_t GetUdpMaxMessageSize(void)
Gets the current maximum message size of a UDP network target.
NetworkTarget & SetDestination(const char *destination)
Sets the destination of the target.
const char * GetDefaultMsgid(void)
Returns the default msgid used by this target.
static NetworkTarget NewPausedTcp4Target(const char *name)
Creates a new network target using TCP over IPv4 with the given name.
NetworkTarget & SetTransportPort(const char *port)
Sets the transport port of the target.
NetworkTarget & SetOption(int option)
Sets an option on a target.
int GetMask(void)
Gets the log mask of this target.
static const size_t DEFAULT_UDP_MAX_MESSAGE_SIZE
The default message size for UDP network targets.
Definition NetworkTarget.hpp:33
Definition AddressFailure.hpp:7
NetworkProtocol
Network protocols used by network targets.
Definition NetworkProtocol.hpp:11
Facility
Facilities (as defined in RFC 5424) describe the general classification of an event.
Definition Facility.hpp:17
TransportProtocol
Transport protocols used by network targets.
Definition TransportProtocol.hpp:11
Severity
Severities (as defined in RFC 5424) describe the level of importance of a given log entry.
Definition Severity.hpp:15