TSyslogListener

From Ultibo.org
Jump to: navigation, search

Return to Unit Services


Description


To be documented

Class definitions



TSyslogListener = class(TObject)

public
constructor Create;  
destructor Destroy; override;  
private
FLock:TMutexHandle;  
 
FActive:Boolean;  
FProtocol:LongWord;  
FBoundPort:Word;  
FBufferSize:Integer;  
FMinThreads:Integer;  
FMaxThreads:Integer;  
FThreadLimit:Integer;  
FThreadWait:LongWord;  
FBSDFormat:Boolean; If True expect messages in BSD format (RFC 3164), otherwise expect messages in IETF format (RFC 5424)
FAutoDetect:Boolean; If True then auto detect the message format
FOctetCounting:Boolean;  
 
FListenerName:String;  
FListenerPriority:LongWord;  
FListenerStackSize:SizeUInt;  
 
FServerName:String;  
FServerPriority:LongWord;  
FServerStackSize:SizeUInt;  
 
FUDPListener:TWinsock2UDPListener;  
FTCPListener:TWinsock2TCPListener;  
 
FOnRecvMessage:TSyslogRecvMessage;  
FOnDecodeMessage:TSyslogDecodeMessage;  
FOnDecodeMessageExt:TSyslogDecodeMessageExt;  
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  
 
procedure SetActive(AActive:Boolean);  
procedure SetProtocol(AProtocol:LongWord);  
procedure SetBoundPort(ABoundPort:Word);  
procedure SetBufferSize(ABufferSize:Integer);  
procedure SetMinThreads(AMinThreads:Integer);  
procedure SetMaxThreads(AMaxThreads:Integer);  
procedure SetThreadLimit(AThreadLimit:Integer);  
procedure SetThreadWait(AThreadWait:LongWord);  
procedure SetBSDFormat(ABSDFormat:Boolean);  
procedure SetAutoDetect(AAutoDetect:Boolean);  
procedure SetOctetCounting(AOctetCounting:Boolean);  
 
procedure SetListenerName(const AListenerName:String);  
procedure SetListenerPriority(AListenerPriority:LongWord);  
procedure SetListenerStackSize(AListenerStackSize:SizeUInt);  
 
procedure SetServerName(const AServerName:String);  
procedure SetServerPriority(AServerPriority:LongWord);  
procedure SetServerStackSize(AServerStackSize:SizeUInt);  
 
function DoUDPExecute(AThread:TWinsock2UDPServerThread):Boolean;  
function DoTCPExecute(AThread:TWinsock2TCPServerThread):Boolean;  
 
procedure DoRecvMessage(const AAddress,AData:String);  
function DoDecodeMessage(const AAddress,AData:String):Boolean;  
function DoDecodeMessageExt(const AAddress,AData:String):Boolean;  
protected
function GetFacility(const APriority:String):LongWord;  
function GetSeverity(const APriority:String):LongWord;  
public
property Active:Boolean read FActive write SetActive;  
property Protocol:LongWord read FProtocol write SetProtocol;  
property BoundPort:Word read FBoundPort write SetBoundPort;  
property BufferSize:Integer read FBufferSize write SetBufferSize;  
property MinThreads:Integer read FMinThreads write SetMinThreads;  
property MaxThreads:Integer read FMaxThreads write SetMaxThreads;  
property ThreadLimit:Integer read FThreadLimit write SetThreadLimit;  
property ThreadWait:LongWord read FThreadWait write SetThreadWait;  
property BSDFormat:Boolean read FBSDFormat write SetBSDFormat;  
property AutoDetect:Boolean read FAutoDetect write SetAutoDetect;  
property OctetCounting:Boolean read FOctetCounting write SetOctetCounting;  
 
property ListenerName:String read FListenerName write SetListenerName;  
property ListenerPriority:LongWord read FListenerPriority write SetListenerPriority;  
property ListenerStackSize:SizeUInt read FListenerStackSize write SetListenerStackSize;  
 
property ServerName:String read FServerName write SetServerName;  
property ServerPriority:LongWord read FServerPriority write SetServerPriority;  
property ServerStackSize:SizeUInt read FServerStackSize write SetServerStackSize;  
 
property OnRecvMessage:TSyslogRecvMessage read FOnRecvMessage write FOnRecvMessage;  
property OnDecodeMessage:TSyslogDecodeMessage read FOnDecodeMessage write FOnDecodeMessage;  
property OnDecodeMessageExt:TSyslogDecodeMessageExt read FOnDecodeMessageExt write FOnDecodeMessageExt;  


Function declarations



constructor TSyslogListener.Create;
Description: To be documented
Note None documented


destructor TSyslogListener.Destroy;
Description: To be documented
Note None documented


function TSyslogListener.AcquireLock:Boolean;
Description: To be documented
Note None documented


function TSyslogListener.ReleaseLock:Boolean;
Description: To be documented
Note None documented


procedure TSyslogListener.SetActive(AActive:Boolean);
Description: To be documented
Note None documented


procedure TSyslogListener.SetProtocol(AProtocol:LongWord);
Description: To be documented
Note None documented


procedure TSyslogListener.SetBoundPort(ABoundPort:Word);
Description: To be documented
Note None documented


procedure TSyslogListener.SetBufferSize(ABufferSize:Integer);
Description: To be documented
Note None documented


procedure TSyslogListener.SetMinThreads(AMinThreads:Integer);
Description: To be documented
Note None documented


procedure TSyslogListener.SetMaxThreads(AMaxThreads:Integer);
Description: To be documented
Note None documented


procedure TSyslogListener.SetThreadLimit(AThreadLimit:Integer);
Description: To be documented
Note None documented


procedure TSyslogListener.SetThreadWait(AThreadWait:LongWord);
Description: To be documented
Note None documented


procedure TSyslogListener.SetBSDFormat(ABSDFormat:Boolean);
Description: To be documented
Note None documented


procedure TSyslogListener.SetAutoDetect(AAutoDetect:Boolean);
Description: To be documented
Note None documented


procedure TSyslogListener.SetOctetCounting(AOctetCounting:Boolean);
Description: To be documented
Note None documented


procedure TSyslogListener.SetListenerName(const AListenerName:String);
Description: To be documented
Note None documented


procedure TSyslogListener.SetListenerPriority(AListenerPriority:LongWord);
Description: To be documented
Note None documented


procedure TSyslogListener.SetListenerStackSize(AListenerStackSize:SizeUInt);
Description: To be documented
Note None documented


procedure TSyslogListener.SetServerName(const AServerName:String);
Description: To be documented
Note None documented


procedure TSyslogListener.SetServerPriority(AServerPriority:LongWord);
Description: To be documented
Note None documented


procedure TSyslogListener.SetServerStackSize(AServerStackSize:SizeUInt);
Description: To be documented
Note None documented


function TSyslogListener.DoUDPExecute(AThread:TWinsock2UDPServerThread):Boolean;
Description: To be documented
Note None documented


function TSyslogListener.DoTCPExecute(AThread:TWinsock2TCPServerThread):Boolean;
Description: To be documented
Note None documented


procedure TSyslogListener.DoRecvMessage(const AAddress,AData:String);
Description: To be documented
Note None documented


function TSyslogListener.DoDecodeMessage(const AAddress,AData:String):Boolean;
Description: BSD Syslog Message Format
Note PRI (Required) - Enclosed by <>, TIMESTAMP (Required) - Formatted as mmm dd hh:nn:ss, HOST (Required) - Separated by space, TAG (Optional) - Separated by space and delineated from content by a non alpha numeric character, CONTENT (Optional) - Remainder of message


function TSyslogListener.DoDecodeMessageExt(const AAddress,AData:String):Boolean;
Description: IETF Syslog Message Format
Note PRI (Required) - Enclosed by <>, VERSION (Required) - Always 1, TIMESTAMP (Optional) - Separated by space (- if not present), HOSTNAME (Optional) - Separated by space (- if not present), APP-NAME (Optional) - Separated by space (- if not present), PROCID (Optional) - Separated by space (- if not present), MSGID (Optional)- Separated by space (- if not present), STRUCTURED-DATA (Optional) - Separated by space and enclosed by [] (- if not present), MSG (Optional) - Separated by space (Remainder of message with or without BOM)


function TSyslogListener.GetFacility(const APriority:String):LongWord;
Description: To be documented
Note None documented


function TSyslogListener.GetSeverity(const APriority:String):LongWord;
Description: To be documented
Note None documented


Return to Unit Reference