Difference between revisions of "Unit Services"

From Ultibo.org
Jump to: navigation, search
 
(5 intermediate revisions by the same user not shown)
Line 5: Line 5:
 
----
 
----
  
'''Ultibo Services interface unit'''
+
'''Ultibo Services Interface unit'''
 
+
''To be documented''
+
  
 
=== Constants ===
 
=== Constants ===
Line 13: Line 11:
  
  
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 +
<div style="font-size: 14px; padding-left: 12px;">'''Ping constants''' <code> PING_* </code></div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>PING_DEFAULT_SIZE = 32;</code>
 +
| Default number of bytes of data to send with echo (Ping) request
 +
|-
 +
| <code>PING_MAXIMUM_SIZE = 65500;</code>
 +
| Maximum number of bytes of data to send with echo (Ping) request
 +
|-
 +
| <code>PING_DEFAULT_COUNT = 4;</code>
 +
| Default number of echo (ping) requests to send in a sequence
 +
|-
 +
| <code>PING_DEFAULT_TIMEOUT = 3000;</code>
 +
| Default time to wait for echo (Ping) response (Milliseconds)
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 
<div style="font-size: 14px; padding-left: 12px;">'''NTP specific constants''' <code> NTP_* </code></div>
 
<div style="font-size: 14px; padding-left: 12px;">'''NTP specific constants''' <code> NTP_* </code></div>
Line 764: Line 782:
  
  
'''Ping client'''
+
'''Ping classes'''
  
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
<code>TPingClient = class(TWinsock2RAWClient)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
| [[TPingClient|<code>TPingClient = class(TWinsock2RAWClient)</code>]]
|-
+
|colspan="2"|&nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
|colspan="2"|&nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''NTP client'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TNTPClient = class(TWinsock2UDPClient)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
| [[TNTPClient|<code>TNTPClient = class(TWinsock2UDPClient)</code>]]
|-
+
| <code>constructor Create;</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FLock:TMutexHandle;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FPollInterval:LongWord;</code>
+
| How often to poll the server (in seconds)
+
|-
+
| <code>FPollTimeout:LongWord;</code>
+
| How long before receive or send timeout occurs (in milliseconds)
+
|-
+
| <code>FPollRetries:LongWord;</code>
+
| How many times to retry a poll
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FRetryTimeout:LongWord;</code>
+
| How long to wait between poll retries (in milliseconds)
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FInitialClockGet:Boolean;</code>
+
| Has the time been obtained at least once
+
|-
+
| <code>FInitialClockCount:LongWord;</code>
+
| How many times have we tried to obtain the initial clock
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FTimerHandle:TTimerHandle;</code>
+
| Handle for the NTP update timer
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function AcquireLock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ReleaseLock:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure SetPollInterval(APollInterval:LongWord);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetPollTimeout(APollTimeout:LongWord);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetPollRetries(APollRetries:LongWord);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure SetRetryTimeout(ARetryTimeout:LongWord);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure SetInitialClockGet(AInitialClockGet:Boolean);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetInitialClockCount(AInitialClockCount:LongWord);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure SetTimerHandle(ATimerHandle:TTimerHandle);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property PollInterval:LongWord read FPollInterval write SetPollInterval;</code>
+
| &nbsp;
+
|-
+
| <code>property PollTimeout:LongWord read FPollTimeout write SetPollTimeout;</code>
+
| &nbsp;
+
|-
+
| <code>property PollRetries:LongWord read FPollRetries write SetPollRetries;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property RetryTimeout:LongWord read FRetryTimeout write SetRetryTimeout;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property InitialClockGet:Boolean read FInitialClockGet write SetInitialClockGet;</code>
+
| &nbsp;
+
|-
+
| <code>property InitialClockCount:LongWord read FInitialClockCount write SetInitialClockCount;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property TimerHandle:TTimerHandle read FTimerHandle write SetTimerHandle;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetTime:Int64;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure IncrementInitialClockCount;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
 
  
'''Telnet buffer'''
+
'''Telnet classes'''
  
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
<code>TTelnetBuffer = class(TObject)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
| [[TTelnetBuffer|<code>TTelnetBuffer = class(TObject)</code>]]
|-
+
| <code>constructor Create(ASize:LongWord);</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FLock:TCriticalSectionHandle;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FData:Pointer;</code>
+
| &nbsp;
+
|-
+
| <code>FSize:LongWord;</code>
+
| &nbsp;
+
|-
+
| <code>FCount:LongWord;</code>
+
| &nbsp;
+
|-
+
| <code>FStart:LongWord;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function AcquireLock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ReleaseLock:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetCount:LongWord;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property Count:LongWord read GetCount;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function ReadData:Char;</code>
+
| &nbsp;
+
|-
+
| <code>function WriteData(AChar:Char):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function WriteLock(var ASize:LongWord):Pointer;</code>
+
| &nbsp;
+
|-
+
| <code>function WriteUnlock(ACount:LongWord):Boolean;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''Telnet connection'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TTelnetConnection = class(TListObject)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
| [[TTelnetConnection|<code>TTelnetConnection = class(TListObject)</code>]]
|-
+
| <code>constructor Create;</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FLock:TCriticalSectionHandle;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FHandle:LongWord;</code>
+
| &nbsp;
+
|-
+
| <code>FRxByteCount:Int64;</code>
+
| Bytes Recv Count from Connection
+
|-
+
| <code>FTxByteCount:Int64;</code>
+
| Bytes Sent Count to Connection
+
|-
+
| <code>FRequestCount:Int64;</code>
+
| Requests Recv Count from Connection
+
|-
+
| <code>FResponseCount:Int64;</code>
+
| Responses Sent Count to Connection
+
|-
+
| <code>FRequestTime:TDateTime;</code>
+
| Last Request Time
+
|-
+
| <code>FResponseTime:TDateTime;</code>
+
| Last Response Time
+
|-
+
| <code>FRemoteAddress:String;</code>
+
| Address of Remote Client
+
|-
+
| <code>FLocalState:LongWord;</code>
+
| Local connection state (eg TELNET_STATE_ECHO)
+
|-
+
| <code>FRemoteState:LongWord;</code>
+
| Remote connection state (eg TELNET_STATE_ECHO)
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FData:Pointer;</code>
+
| Private data for application
+
|-
+
| <code>FThread:TThread;</code>
+
| TWinsock2TCPServerThread
+
|-
+
| <code>FBuffer:TTelnetBuffer;</code>
+
| Buffer for received data
+
|-
+
| <code>FListener:TTelnetListener;</code>
+
| Listener for Connection
+
|-
+
|colspan="2"|&nbsp; 
+
|-
+
| <code>function AcquireLock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ReleaseLock:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp; 
+
|-
+
| <code>procedure SetHandle(AHandle:LongWord);</code>
+
| &nbsp;
+
|-
+
| <code>function GetRxByteCount:Int64;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetRxByteCount(const ARxByteCount:Int64);</code>
+
| &nbsp;
+
|-
+
| <code>function GetTxByteCount:Int64;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetTxByteCount(const ATxByteCount:Int64);</code>
+
| &nbsp;
+
|-
+
| <code>function GetRequestCount:Int64;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetRequestCount(const ARequestCount:Int64);</code>
+
| &nbsp;
+
|-
+
| <code>function GetResponseCount:Int64;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetResponseCount(const AResponseCount:Int64);</code>
+
| &nbsp;
+
|-
+
| <code>function GetRequestTime:TDateTime;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetRequestTime(const ARequestTime:TDateTime);</code>
+
| &nbsp;
+
|-
+
| <code>function GetResponseTime:TDateTime;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetResponseTime(const AResponseTime:TDateTime);</code>
+
| &nbsp;
+
|-
+
| <code>function GetRemoteAddress:String;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetRemoteAddress(const ARemoteAddress:String);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetLocalState(ALocalState:LongWord);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetRemoteState(ARemoteState:LongWord);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure SetData(AData:Pointer);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetThread(AThread:TThread);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetListener(AListener:TTelnetListener);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property Handle:LongWord read FHandle write SetHandle;</code>
+
| &nbsp;
+
|-
+
| <code>property RxByteCount:Int64 read GetRxByteCount write SetRxByteCount;</code>
+
| &nbsp;
+
|-
+
| <code>property TxByteCount:Int64 read GetTxByteCount write SetTxByteCount;</code>
+
| &nbsp;
+
|-
+
| <code>property RequestCount:Int64 read GetRequestCount write SetRequestCount;</code>
+
| &nbsp;
+
|-
+
| <code>property ResponseCount:Int64 read GetResponseCount write SetResponseCount;</code>
+
| &nbsp;
+
|-
+
| <code>property RequestTime:TDateTime read GetRequestTime write SetRequestTime;</code>
+
| &nbsp;
+
|-
+
| <code>property ResponseTime:TDateTime read GetResponseTime write SetResponseTime;</code>
+
| &nbsp;
+
|-
+
| <code>property RemoteAddress:String read GetRemoteAddress write SetRemoteAddress;</code>
+
| &nbsp;
+
|-
+
| <code>property LocalState:LongWord read FLocalState write SetLocalState;</code>
+
| &nbsp;
+
|-
+
| <code>property RemoteState:LongWord read FRemoteState write SetRemoteState;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property Data:Pointer read FData write SetData;</code>
+
| &nbsp;
+
|-
+
| <code>property Thread:TThread read FThread  write SetThread;</code>
+
| &nbsp;
+
|-
+
| <code>property Buffer:TTelnetBuffer read FBuffer;</code>
+
| &nbsp;
+
|-
+
| <code>property Listener:TTelnetListener read FListener write SetListener;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure IncrementRxByteCount(const ARxByteCount:Int64);</code>
+
| &nbsp;
+
|-
+
| <code>procedure IncrementTxByteCount(const ATxByteCount:Int64);</code>
+
| &nbsp;
+
|-
+
| <code>procedure IncrementRequestCount;</code>
+
| &nbsp;
+
|-
+
| <code>procedure IncrementResponseCount;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''Telnet listener'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TTelnetListener = class(TWinsock2TCPListener)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
| [[TTelnetListener|<code>TTelnetListener = class(TWinsock2TCPListener)</code>]]
|-
+
| <code>constructor Create;</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FOnConnected:TTelnetConnectionEvent;</code>
+
| &nbsp;
+
|-
+
| <code>FOnDisconnected:TTelnetConnectionEvent;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FOnCheckHost:TTelnetHostEvent;</code>
+
| &nbsp;
+
|-
+
| <code>FOnCheckCount:TTelnetCountEvent;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FOnInit:TTelnetInitEvent;</code>
+
| &nbsp;
+
|-
+
| <code>FOnChar:TTelnetCharEvent;</code>
+
| &nbsp;
+
|-
+
| <code>FOnCommand:TTelnetCommandEvent;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>procedure DoConnect(AThread:TWinsock2TCPServerThread); override;</code>
+
| &nbsp;
+
|-
+
| <code>procedure DoDisconnect(AThread:TWinsock2TCPServerThread); override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function DoCheckHost(AThread:TWinsock2TCPServerThread):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function DoCheckCount(AThread:TWinsock2TCPServerThread):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function DoExecute(AThread:TWinsock2TCPServerThread):Boolean; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure DoInit(AThread:TWinsock2TCPServerThread);</code>
+
| &nbsp;
+
|-
+
| <code>procedure DoChar(AThread:TWinsock2TCPServerThread; AChar:Char);</code>
+
| &nbsp;
+
|-
+
| <code>procedure DoCommand(AThread:TWinsock2TCPServerThread; ACommand,AOption:Byte; AData:Pointer; ASize:LongWord);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function SendEcho(AThread:TWinsock2TCPServerThread; AChar:Char):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property OnConnected:TTelnetConnectionEvent read FOnConnected write FOnConnected;</code>
+
| &nbsp;
+
|-
+
| <code>property OnDisconnected:TTelnetConnectionEvent read FOnDisconnected write FOnDisconnected;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property OnCheckHost:TTelnetHostEvent read FOnCheckHost write FOnCheckHost;</code>
+
| &nbsp;
+
|-
+
| <code>property OnCheckCount:TTelnetCountEvent read FOnCheckCount write FOnCheckCount;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property OnInit:TTelnetInitEvent read FOnInit write FOnInit;</code>
+
| &nbsp;
+
|-
+
| <code>property OnChar:TTelnetCharEvent read FOnChar write FOnChar;</code>
+
| &nbsp;
+
|-
+
| <code>property OnCommand:TTelnetCommandEvent read FOnCommand write FOnCommand;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetChar(AThread:TWinsock2TCPServerThread; var AChar:Char):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function SendChar(AThread:TWinsock2TCPServerThread; AChar:Char):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function SendText(AThread:TWinsock2TCPServerThread; const AText:String):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function SendCommand(AThread:TWinsock2TCPServerThread; ACommand,AOption:Byte; AData:Pointer; ASize:LongWord):Boolean;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
 
  
'''SysLog client'''
+
'''SysLog classes'''
  
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
<code>TSyslogClient = class(TObject)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
| [[TSyslogClient|<code>TSyslogClient = class(TObject)</code>]]
|-
+
| <code>constructor Create;</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FLock:TMutexHandle;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FProtocol:LongWord;</code>
+
| &nbsp;
+
|-
+
| <code>FBoundPort:Word;</code>
+
| &nbsp;
+
|-
+
| <code>FRemoteHost:String;</code>
+
| &nbsp;
+
|-
+
| <code>FRemotePort:Word;</code>
+
| &nbsp;
+
|-
+
| <code>FOctetCounting:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FUDPClient:TWinsock2UDPClient;</code>
+
| &nbsp;
+
|-
+
| <code>FTCPClient:TWinsock2TCPClient;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function AcquireLock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ReleaseLock:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure SetProtocol(AProtocol:LongWord);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetBoundPort(ABoundPort:Word);</code>
+
| &nbsp;
+
|-
+
| <code>function GetRemoteHost:String;</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetRemoteHost(const ARemoteHost:String);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetRemotePort(ARemotePort:Word);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetOctetCounting(AOctetCounting:Boolean);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>function GetPriority(AFacility,ASeverity:LongWord):String;</code>
+
| &nbsp;
+
|-
+
| <code>function GetMessage(const APriority,AAddress,ATag,AContent:String):String;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property Protocol:LongWord read FProtocol write SetProtocol;</code>
+
| &nbsp;
+
|-
+
| <code>property BoundPort:Word read FBoundPort write SetBoundPort;</code>
+
| &nbsp;
+
|-
+
| <code>property RemoteHost:String read GetRemoteHost write SetRemoteHost;</code>
+
| &nbsp;
+
|-
+
| <code>property RemotePort:Word read FRemotePort write SetRemotePort;</code>
+
| &nbsp;
+
|-
+
| <code>property OctetCounting:Boolean read FOctetCounting write SetOctetCounting;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function SendMessage(AFacility,ASeverity:LongWord; const ATag,AContent:String):LongWord;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div> 
 
 
<br />
 
<br />
  
Line 1,449: Line 854:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,464: Line 869:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function WholeSeconds(Time:Int64):Int64;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Truncate a time value in 100ns intervals to whole seconds only</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,479: Line 896:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,491: Line 908:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,503: Line 920:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,515: Line 932:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,527: Line 944:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,539: Line 956:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,554: Line 971:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,566: Line 983:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,578: Line 995:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,590: Line 1,007:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,602: Line 1,019:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,610: Line 1,027:
  
 
'''NTP helper functions'''
 
'''NTP helper functions'''
 +
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<pre style="border: 0; padding-bottom:0px;">function NTPTimestampToHost(const Timestamp:TNTPTimestamp):TNTPTimestamp;</pre>
 
<pre style="border: 0; padding-bottom:0px;">function NTPTimestampToHost(const Timestamp:TNTPTimestamp):TNTPTimestamp;</pre>
Line 1,616: Line 1,034:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,628: Line 1,046:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,640: Line 1,058:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
| Expects Timestamp to be in Host order
+
| Expects Timestamp to be in Network order. Returns Timestamp in Network order.
 
|-
 
|-
 
|}
 
|}
Line 1,652: Line 1,070:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
| Expects Timestamp to be in Host order
+
| Expects Timestamp to be in Network order. Returns Timestamp in Network order.
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function NTPTimestampDivide(const Timestamp:TNTPTimestamp; Divisor:LongWord):TNTPTimestamp;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| Expects Timestamp to be in Network order. Returns Timestamp in Network order.
 
|-
 
|-
 
|}
 
|}
Line 1,664: Line 1,094:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
| Returns Timestamp in Host order
+
| Returns Timestamp in Network order
 
|-
 
|-
 
|}
 
|}
Line 1,676: Line 1,106:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
| Expects Timestamp to be in Host order
+
| Expects Timestamp to be in Network order
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 +
<pre style="border: 0; padding-bottom:0px;">function NTPTimestampToString(const Timestamp:TNTPTimestamp):String;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! Note
 +
| Expects Timestamp to be in Network order
 
|-
 
|-
 
|}
 
|}
Line 1,691: Line 1,133:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,703: Line 1,145:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,715: Line 1,157:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,730: Line 1,172:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,742: Line 1,184:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,754: Line 1,196:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-

Latest revision as of 04:43, 2 November 2022

Return to Unit Reference


Description


Ultibo Services Interface unit

Constants



[Expand]
Ping constants PING_*


[Expand]
NTP specific constants NTP_*


[Expand]
NTP leap indicator NTP_LEAP_*


[Expand]
NTP mode NTP_MODE_*


[Expand]
NTP stratum NTP_STRATUM_*


[Expand]
Telnet character TELNET_CHAR_*


[Expand]
Telnet escape sequence TELNET_SEQUENCE_*


[Expand]
Telnet buffer TELNET_BUFFER_*


[Expand]
Telnet state TELNET_STATE_*


[Expand]
Telnet command TELNET_COMMAND_*


[Expand]
Telnet option TELNET_OPTION_*


[Expand]
SysLog logging SYSLOG_LOGGING_*


[Expand]
SysLog facility code SYSLOG_FACILITY_*


[Expand]
SysLog severity code SYSLOG_SEVERITY_*


[Expand]
Service logging SERVICE_LOG_*


Type definitions



NTP short

[Expand]

PNTPShort = ^TNTPShort;

TNTPShort = packed record

NTP timestamp

[Expand]

PNTPTimestamp = ^TNTPTimestamp;

TNTPTimestamp = packed record

NTP date format

[Expand]

PNTPDate = ^TNTPDate;

TNTPDate = packed record

NTP packet

[Expand]

PNTPPacket = ^TNTPPacket;

TNTPPacket = packed record

Syslog logging

[Expand]

PSyslogLogging = ^TSyslogLogging;

TSyslogLogging = record

Telnet host event

TTelnetHostEvent = function(AConnection:TTelnetConnection):Boolean of Object;

Telnet count event

TTelnetCountEvent = function(AConnection:TTelnetConnection):Boolean of Object;

Telnet initialize event

TTelnetInitEvent = function(AConnection:TTelnetConnection):Boolean of Object;

Telnet character event

TTelnetCharEvent = function(AConnection:TTelnetConnection; AChar:Char):Boolean of Object;

Telnet command event

TTelnetCommandEvent = function(AConnection:TTelnetConnection; ACommand,AOption:Byte; AData:Pointer; ASize:LongWord):Boolean of Object;

Telnet connection event

TTelnetConnectionEvent = procedure(AConnection:TTelnetConnection) of Object;


Class definitions



Ping classes

TPingClient = class(TWinsock2RAWClient)
TNTPClient = class(TWinsock2UDPClient)

Telnet classes

TTelnetBuffer = class(TObject)
TTelnetConnection = class(TListObject)
TTelnetListener = class(TWinsock2TCPListener)

SysLog classes

TSyslogClient = class(TObject)


Public variables



Service logging

SERVICE_DEFAULT_LOG_LEVEL:LongWord = SERVICE_LOG_LEVEL_DEBUG; Minimum level for Service messages. Only messages with level greater than or equal to this will be printed.
SERVICE_LOG_ENABLED:Boolean;


Function declarations



Initialization functions

[Expand]
procedure ServicesInit;
Description: To be documented


NTP functions

[Expand]
procedure NTPUpdateTime(Client:TNTPClient);
Description: To be documented


[Expand]
function WholeSeconds(Time:Int64):Int64;
Description: Truncate a time value in 100ns intervals to whole seconds only


SysLog functions

[Expand]
function SysLogLoggingStart(Logging:PLoggingDevice):LongWord;
Description: To be documented


[Expand]
function SysLogLoggingStop(Logging:PLoggingDevice):LongWord;
Description: To be documented


[Expand]
function SysLogLoggingOutput(Logging:PLoggingDevice; const Data:String):LongWord;
Description: To be documented


[Expand]
function SysLogLoggingOutputEx(Logging:PLoggingDevice; Facility,Severity:LongWord; const Tag,Content:String):LongWord;
Description: To be documented


[Expand]
function SysLogLoggingGetTarget(Logging:PLoggingDevice):String;
Description: To be documented


[Expand]
function SysLogLoggingSetTarget(Logging:PLoggingDevice; const Target:String):LongWord;
Description: To be documented


Service helper functions

[Expand]
procedure ServiceLog(Level:LongWord; const AText:String);
Description: To be documented


[Expand]
procedure ServiceLogInfo(const AText:String); inline;
Description: To be documented


[Expand]
procedure ServiceLogWarn(const AText:String); inline;
Description: To be documented


[Expand]
procedure ServiceLogError(const AText:String); inline;
Description: To be documented


[Expand]
procedure ServiceLogDebug(const AText:String); inline;
Description: To be documented


NTP helper functions

[Expand]
function NTPTimestampToHost(const Timestamp:TNTPTimestamp):TNTPTimestamp;
Description: Convert an NTP Timestamp to Host order


[Expand]
function NTPTimestampToNetwork(const Timestamp:TNTPTimestamp):TNTPTimestamp;
Description: Convert an NTP Timestamp to Network order


[Expand]
function NTPTimestampAdd(const Timestamp1,Timestamp2:TNTPTimestamp):TNTPTimestamp;
Description: To be documented


[Expand]
function NTPTimestampSubtract(const Timestamp1,Timestamp2:TNTPTimestamp):TNTPTimestamp;
Description: To be documented


[Expand]
function NTPTimestampDivide(const Timestamp:TNTPTimestamp; Divisor:LongWord):TNTPTimestamp;
Description: To be documented


[Expand]
function ClockTimeToNTPTimestamp(const Time:Int64):TNTPTimestamp;
Description: To be documented


[Expand]
function NTPTimestampToClockTime(const Timestamp:TNTPTimestamp):Int64;
Description: To be documented


[Expand]
function NTPTimestampToString(const Timestamp:TNTPTimestamp):String;
Description: To be documented


Telnet helper functions

[Expand]
function TelnetCommandToString(Command:Byte):String;
Description: To be documented


[Expand]
function TelnetCommandHasOption(Command:Byte):Boolean;
Description: To be documented


[Expand]
function TelnetOptionToString(Option:Byte):String;
Description: To be documented


SysLog helper functions

[Expand]
function FileTimeToSysLogDateTime(const AFileTime:TFileTime):String;
Description: To be documented


[Expand]
function LoggingFacilityToSysLogFacility(Facility:LongWord):LongWord;
Description: To be documented


[Expand]
function LoggingSeverityToSysLogSeverity(Severity:LongWord):LongWord;
Description: To be documented


Return to Unit Reference