Difference between revisions of "Unit Services"

From Ultibo.org
Jump to: navigation, search
Line 470: Line 470:
 
----
 
----
  
''To be documented''
+
 
 +
'''NTP short'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PNTPShort = ^TNTPShort;</code>
 +
 
 +
<code>TNTPShort = packed record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: NTP Short Format
 +
|-
 +
| <code>Seconds:Word;</code>
 +
| Seconds
 +
|-
 +
| <code>Fraction:Word;</code>
 +
| Fraction
 +
|-
 +
|}
 +
</div></div>
 +
 +
'''NTP timestamp'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PNTPTimestamp = ^TNTPTimestamp;</code>
 +
 
 +
<code>TNTPTimestamp = packed record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: NTP Timestamp Format
 +
|-
 +
| <code>Seconds:LongWord;</code>
 +
| Seconds
 +
|-
 +
| <code>Fraction:LongWord;</code>
 +
| Seconds Fraction (0-padded)
 +
|-
 +
|}
 +
</div></div> 
 +
 
 +
'''NTP date format'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PNTPDate = ^TNTPDate;</code>
 +
 
 +
<code>TNTPDate = packed record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>EraNumber:LongWord;</code>
 +
| Era Number
 +
|-
 +
| <code>EraOffset:LongWord;</code>
 +
| Era Offset
 +
|-
 +
| <code>Fraction:Int64;</code>
 +
| Fraction
 +
|-
 +
|}
 +
</div></div> 
 +
 
 +
'''NTP packet'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PNTPPacket = ^TNTPPacket;</code>
 +
 
 +
<code>TNTPPacket = packed record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>LeapVersionMode:Byte;</code>
 +
| Leap Indicator (2 bits) / Version (3 bits) / Mode (3 bits)
 +
|-
 +
| <code>Stratum:Byte;</code>
 +
| This is an eight-bit unsigned integer indicating the stratum
 +
|-
 +
| <code>PollInterval:Byte;</code>
 +
| This is an eight-bit unsigned integer used as an exponent of two, where the resulting value is the maximum interval between successive messages in seconds.
 +
|-
 +
| <code>Precision:ShortInt;</code>
 +
| This is an eight-bit signed integer used as an exponent of two, where the resulting value is the precision of the system clock in seconds.
 +
|-
 +
| <code>RootDelay:LongInt;</code>
 +
| This is a 32-bit signed fixed-point number indicating the total roundtrip delay to the primary reference source, in seconds with the fraction point between bits 15 and 16.
 +
|-
 +
| <code>RootDispersion:LongWord;</code>
 +
| This is a 32-bit unsigned fixed-point number indicating the maximum error due to the clock frequency tolerance, in seconds with the fraction point between bits 15 and 16.
 +
|-
 +
| <code>ReferenceIdentifier:array[0..3] of Byte;</code>
 +
| This is a 32-bit bitstring identifying the particular reference source
 +
|-
 +
| <code>ReferenceTimestamp:TNTPTimestamp;</code>
 +
| This field is the time the system clock was last set or corrected, in 64-bit timestamp format.
 +
|-
 +
| <code>OriginateTimestamp:TNTPTimestamp;</code>
 +
| This is the time at which the request departed the client for the server, in 64-bit timestamp format.
 +
|-
 +
| <code>ReceiveTimestamp:TNTPTimestamp;</code>
 +
| This is the time at which the request arrived at the server or the reply arrived at the client, in 64-bit timestamp format.
 +
|-
 +
| <code>TransmitTimestamp:TNTPTimestamp;</code>
 +
| This is the time at which the request departed the client or the reply departed the server, in 64-bit timestamp format.
 +
|-
 +
| <code>KeyIdentifier:LongWord;</code>
 +
| Optional for NTP authentication
 +
|-
 +
| <code>MessageDigest:array[0..15] of Byte;</code>
 +
| Optional for NTP authentication
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''Syslog logging'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PSyslogLogging = ^TSyslogLogging;</code>
 +
 
 +
<code>TSyslogLogging = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|''Logging Properties''
 +
|-
 +
| <code>Logging:TLoggingDevice;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
|colspan="2"|''Syslog Properties''
 +
|-
 +
| <code>Client:TSyslogClient;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
<br />
  
 
=== Class definitions ===
 
=== Class definitions ===

Revision as of 03:23, 25 January 2017

Return to Unit Reference


Description


Ultibo Services interface unit

To be documented

Constants



[Expand]
NTP specific constants NTP_*


[Expand]
NTP leap indicator constants NTP_LEAP_*


[Expand]
NTP mode constants NTP_MODE_*


[Expand]
NTP stratum constants NTP_STRATUM_*


[Expand]
Telnet char constants TELNET_CHAR_*


[Expand]
Telnet state constants TELNET_STATE_*


[Expand]
Telnet command constants TELNET_COMMAND_*


[Expand]
Telnet option constants TELNET_OPTION_*


[Expand]
SysLog facility code constants SYSLOG_FACILITY_*


[Expand]
SysLog severity code constants SYSLOG_SEVERITY_*


[Expand]
Service logging constants 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


Class definitions


To be documented

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


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);
Description: To be documented


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


[Expand]
procedure ServiceLogDebug(const AText:String);
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 ClockTimeToNTPTimestamp(const Time:Int64):TNTPTimestamp;
Description: To be documented


[Expand]
function NTPTimestampToClockTime(const Timestamp:TNTPTimestamp):Int64;
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