Difference between revisions of "Unit Protocol"

From Ultibo.org
Jump to: navigation, search
 
(3 intermediate revisions by the same user not shown)
Line 5: Line 5:
 
----
 
----
  
'''Ultibo Network Protocol interface unit'''
+
'''Ultibo Network Protocol Interface unit'''
 
+
''To be documented''
+
  
 
=== Constants ===
 
=== Constants ===
Line 317: Line 315:
  
  
'''Protocol manager'''
+
'''Protocol specific 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>TProtocolManager = class(TObject)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
| <code>constructor Create(ASettings:TNetworkSettings; ATransports:TTransportManager);</code>
+
| [[TProtocolManager|<code>TProtocolManager = class(TObject)</code>]]
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FLock:TSynchronizerHandle;</code>
+
| &nbsp;
+
|-
+
| <code>FSettings:TNetworkSettings;</code>
+
| &nbsp;
+
|-
+
| <code>FTransports:TTransportManager;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FProtocols:TNetworkList;</code>
+
| List of TNetworkProtocol objects
+
|-
+
| <code>FFilters:TNetworkList;</code>
+
| List of TNetworkFilter objects
+
|-
+
| <code>FConfigs:TNetworkList;</code>
+
| List of TNetworkConfig objects
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function ReaderLock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ReaderUnlock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function WriterLock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function WriterUnlock:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property Settings:TNetworkSettings read FSettings;</code>
+
| &nbsp;
+
|-
+
| <code>property Transports:TTransportManager read FTransports;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function AddProtocol(AProtocol:TNetworkProtocol):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function RemoveProtocol(AProtocol:TNetworkProtocol):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetProtocolByType(AProtocol,ASocketType:Word; ALock:Boolean; AState:LongWord):TNetworkProtocol;</code>
+
| &nbsp;
+
|-
+
| <code>function GetProtocolByProtocol(AProtocol:TNetworkProtocol; ALock:Boolean; AState:LongWord):TNetworkProtocol;</code>
+
| &nbsp;
+
|-
+
| <code>function GetProtocolBySocket(ASocket:TProtocolSocket; ALock:Boolean; AState:LongWord):TNetworkProtocol;</code>
+
| &nbsp;
+
|-
+
| <code>function GetProtocolByNext(APrevious:TNetworkProtocol; ALock,AUnlock:Boolean; AState:LongWord):TNetworkProtocol;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function AddFilter(AFilter:TNetworkFilter):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function RemoveFilter(AFilter:TNetworkFilter):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetFilterByProtocol(AProtocol:Word; ALock:Boolean; AState:LongWord):TNetworkFilter;</code>
+
| &nbsp;
+
|-
+
| <code>function GetFilterByFilter(AFilter:TNetworkFilter; ALock:Boolean; AState:LongWord):TNetworkFilter;</code>
+
| &nbsp;
+
|-
+
| <code>function GetFilterByNext(APrevious:TNetworkFilter; ALock,AUnlock:Boolean; AState:LongWord):TNetworkFilter;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function AddConfig(AConfig:TNetworkConfig):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function RemoveConfig(AConfig:TNetworkConfig):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetConfigByType(AConfigType:Word; ALock:Boolean; AState:LongWord):TNetworkConfig;</code>
+
| &nbsp;
+
|-
+
| <code>function GetConfigByConfig(AConfig:TNetworkConfig; ALock:Boolean; AState:LongWord):TNetworkConfig;</code>
+
| &nbsp;
+
|-
+
| <code>function GetConfigByNext(APrevious:TNetworkConfig; ALock,AUnlock:Boolean; AState:LongWord):TNetworkConfig;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function SetConfigByType(AConfigType:Word; AInitDelay,ARetryCount,ARetryTimeout:LongWord):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function StartProtocols:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function StopProtocols:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ProcessProtocols:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function ProcessSockets:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function EnumerateProtocols(ACallback:TProtocolCallback):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function BindProtocols(ATransport:TNetworkTransport):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function UnbindProtocols(ATransport:TNetworkTransport):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function StartFilters:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function StopFilters:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ProcessFilters:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function EnumerateFilters(ACallback:TFilterCallback):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function BindFilters(ATransport:TNetworkTransport):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function UnbindFilters(ATransport:TNetworkTransport):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function StartConfigs:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function StopConfigs:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ProcessConfigs:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function EnumerateConfigs(ACallback:TConfigCallback):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function BindConfigs(ATransport:TNetworkTransport):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function UnbindConfigs(ATransport:TNetworkTransport):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function CheckSocket(ASocket:TSocket; ALock:Boolean; AState:LongWord):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function Select(ANfds:Integer; AReadfds,AWritefds,AExceptfds:PFDSet; ATimeout:PTimeVal):LongInt;</code>
+
| &nbsp;
+
|-
+
| <code>function Socket(AFamily,AStruct,AProtocol:Integer):TSocket;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''Protocol transport'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TProtocolTransport = 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"|Note: Downstream
+
| [[TProtocolTransport|<code>TProtocolTransport = class(TListObject)</code>]]
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <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:TSynchronizerHandle;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>Handle:THandle;</code>
+
| &nbsp;
+
|-
+
| <code>Protocol:Word;</code>
+
| &nbsp;
+
|-
+
| <code>Transport:TNetworkTransport;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function ReaderLock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ReaderUnlock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function WriterLock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function WriterUnlock:Boolean;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''Network protocol'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TNetworkProtocol = class(TListObject)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
| <code>constructor Create(AManager:TProtocolManager; const AName:String);</code>
+
| [[TNetworkProtocol|<code>TNetworkProtocol = class(TListObject)</code>]]
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FLock:TSynchronizerHandle;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>FManager:TProtocolManager;</code>
+
| &nbsp;
+
|-
+
| <code>FName:String;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FProtocol:Word;</code>
+
| &nbsp;
+
|-
+
| <code>FSocketType:Word;</code>
+
| &nbsp;
+
|-
+
| <code>FTransports:TNetworkList;</code>
+
| List of TProtocolTransport objects
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FTimer:TSocketTimer;</code>
+
| Timer for socket processing
+
|-
+
| <code>FThread:TSocketThread;</code>
+
| Thread for socket processing
+
|-
+
| <code>FPorts:TNetworkList;</code>
+
| List of TProtocolPort objects
+
|-
+
| <code>FSockets:TNetworkList;</code>
+
| List of TProtocolSocket objects
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FStatistics:TProtocolStatistics;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetTransportByHandle(AHandle:THandle; ALock:Boolean; AState:LongWord):TProtocolTransport;</code>
+
| &nbsp;
+
|-
+
| <code>function GetTransportByFamily(AFamily:Word; ALock:Boolean; AState:LongWord):TProtocolTransport;</code>
+
| &nbsp;
+
|-
+
| <code>function GetTransportByTransport(ATransport:TNetworkTransport; ALock:Boolean; AState:LongWord):TProtocolTransport;</code>
+
| &nbsp;
+
|-
+
| <code>function GetTransportByNext(APrevious:TProtocolTransport; ALock,AUnlock:Boolean; AState:LongWord):TProtocolTransport;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function AddTransport(ATransport:TNetworkTransport):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function RemoveTransport(ATransport:TNetworkTransport):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function OpenPort(ASocket:TProtocolSocket; APort:Word):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function ClosePort(ASocket:TProtocolSocket):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function FindPort(APort:Word; AWrite,ALock:Boolean):TProtocolPort; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetSocketByNext(APrevious:TProtocolSocket; ALock,AUnlock:Boolean; AState:LongWord):TProtocolSocket;</code>
+
| &nbsp;
+
|-
+
| <code>function CheckSocket(ASocket:TProtocolSocket; ALock:Boolean; AState:LongWord):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function FindSocket(AFamily,AStruct,AProtocol:Word; ALocalAddress,ARemoteAddress:Pointer; ALocalPort,ARemotePort:Word; ABroadcast,AListen,ALock:Boolean; AState:LongWord):TProtocolSocket; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>procedure FlushSockets(All:Boolean); virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function SelectGet(AReadfds,AWritefds,AExceptfds:PFDSet; var ACode:Integer):TProtocolSocket; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function SelectStart(ASource,ADest:PFDSet):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function SelectCheck(ASource,ADest:PFDSet;ACode:Integer):Integer; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function SelectWait(ASocket:TProtocolSocket; ACode:Integer; ATimeout:LongWord):Integer; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function SendPacket(ASocket:TProtocolSocket; ASource,ADest:Pointer; ASourcePort,ADestPort:Word; APacket:PPacketFragment; ASize,AFlags:Integer):Integer; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property Manager:TProtocolManager read FManager;</code>
+
| &nbsp;
+
|-
+
| <code>property Name:String read FName; </code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property Protocol:Word read FProtocol;</code>
+
| &nbsp;
+
|-
+
| <code>property SocketType:Word read FSocketType;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function Accept(ASocket:TProtocolSocket; ASockAddr:PSockAddr; AAddrLength:PInteger):TProtocolSocket; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function Bind(ASocket:TProtocolSocket; var ASockAddr:TSockAddr; AAddrLength:Integer):Integer; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function CloseSocket(ASocket:TProtocolSocket):Integer; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function Connect(ASocket:TProtocolSocket; var ASockAddr:TSockAddr; AAddrLength:Integer):Integer; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function IoctlSocket(ASocket:TProtocolSocket; ACmd:DWORD; var AArg:u_long):Integer; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function GetPeerName(ASocket:TProtocolSocket; var ASockAddr:TSockAddr; var AAddrLength:Integer):Integer; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function GetSockName(ASocket:TProtocolSocket; var ASockAddr:TSockAddr; var AAddrLength:Integer):Integer; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function GetSockOpt(ASocket:TProtocolSocket; ALevel,AOptName:Integer; AOptValue:PChar; var AOptLength:Integer):Integer; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function Listen(ASocket:TProtocolSocket; ABacklog:Integer):Integer; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function Recv(ASocket:TProtocolSocket; var ABuffer; ALength,AFlags:Integer):Integer; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function RecvFrom(ASocket:TProtocolSocket; var ABuffer; ALength,AFlags:Integer; var AFromAddr:TSockAddr; var AFromLength:Integer):Integer; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function Select(ANfds:Integer; AReadfds,AWritefds,AExceptfds:PFDSet; ATimeout:PTimeVal):LongInt; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function Send(ASocket:TProtocolSocket; var ABuffer; ALength,AFlags:Integer):Integer; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function SendTo(ASocket:TProtocolSocket; var ABuffer; ALength,AFlags:Integer; var AToAddr:TSockAddr; AToLength:Integer):Integer; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function SetSockOpt(ASocket:TProtocolSocket; ALevel,AOptName:Integer; AOptValue:PChar; AOptLength:Integer):Integer; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function Shutdown(ASocket:TProtocolSocket; AHow:Integer):Integer; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function Socket(AFamily,AStruct,AProtocol:Integer):TProtocolSocket; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function ReaderLock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ReaderUnlock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function WriterLock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function WriterUnlock:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetStatistics:TProtocolStatistics; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function StartProtocol:Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function StopProtocol:Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function ProcessProtocol:Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function ProcessSockets:Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function ProcessSocket(ASocket:TProtocolSocket):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function BindProtocol(ATransport:TNetworkTransport):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function UnbindProtocol(ATransport:TNetworkTransport):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function CheckTimer:Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function ProcessTimer:Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function SendSocket(ASocket:TProtocolSocket):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function ScheduleSocket(ASocket:TProtocolSocket; ATimeout:LongWord):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function UnscheduleSocket(ASocket:TProtocolSocket):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function ScheduleSocketItem(ASocket:TProtocolSocket; AItem:PSocketTimerItem; ATimeout:LongWord):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function UnscheduleSocketItem(ASocket:TProtocolSocket; AItem:PSocketTimerItem):Boolean; virtual;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
+
'''Socket timer'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TSocketTimer = class(TObject)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
| <code>constructor Create(AProtocol:TNetworkProtocol);</code>
+
| [[TSocketTimer|<code>TSocketTimer = class(TObject)</code>]]
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>FProtocol:TNetworkProtocol;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FLock:TMutexHandle;</code>
+
| &nbsp;
+
|-
+
| <code>FInterval:LongWord;</code>
+
| &nbsp;
+
|-
+
| <code>FCheckTimer:TTimerHandle;</code>
+
| &nbsp;
+
|-
+
| <code>FProcessSemaphore:TSemaphoreHandle;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FCount:LongWord;</code>
+
| &nbsp;
+
|-
+
| <code>FMaxCount:LongWord;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FFirst:PSocketTimerItem;</code>
+
| &nbsp;
+
|-
+
| <code>FLast:PSocketTimerItem;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function AcquireLock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ReleaseLock:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function Dequeue(AMax:Integer):TProtocolSocket;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function FirstKey:Integer;</code>
+
| &nbsp;
+
|-
+
| <code>function InsertKey(ASocket:TProtocolSocket; AItem:PSocketTimerItem; AKey:Integer):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function DeleteKey(ASocket:TProtocolSocket; AItem:PSocketTimerItem):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function DecrementKey:Integer;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property Count:LongWord read FCount;</code>
+
| &nbsp;
+
|-
+
| <code>property MaxCount:LongWord read FMaxCount;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function StartTimer(AInterval:LongWord):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function StopTimer:Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function CheckTimer:Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function ProcessTimer:Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function ScheduleSocket(ASocket:TProtocolSocket; ATimeout:LongWord):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function UnscheduleSocket(ASocket:TProtocolSocket):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function ScheduleSocketItem(ASocket:TProtocolSocket; AItem:PSocketTimerItem; ATimeout:LongWord):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function UnscheduleSocketItem(ASocket:TProtocolSocket; AItem:PSocketTimerItem):Boolean; virtual;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''Socket thread'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TSocketThread = class(TThread)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
| <code>constructor Create(AProtocol:TNetworkProtocol);</code>
+
| [[TSocketThread|<code>TSocketThread = class(TThread)</code>]]
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>FProtocol:TNetworkProtocol;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure Execute; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>function SendSocket(ASocket:TProtocolSocket):Boolean;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''Protocol port'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TProtocolPort = class(TListObject)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
| <code>constructor Create;</code>
+
| [[TProtocolPort|<code>TProtocolPort = class(TListObject)</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"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>Port:Word;</code>
+
| &nbsp;
+
|-
+
| <code>Sockets:TList;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function AcquireLock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ReleaseLock:Boolean;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''Protocol socket'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TProtocolSocket = class(TTransportSocket)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
| <code>constructor Create(AProtocol:TNetworkProtocol; ATransport:TNetworkTransport);</code>
+
| [[TProtocolSocket|<code>TProtocolSocket = class(TTransportSocket)</code>]]
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FSocketChange:TEventHandle;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>FProtocol:TNetworkProtocol;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FProtocolState:TProtocolState;</code>
+
| &nbsp;
+
|-
+
| <code>FProtocolOptions:TProtocolOptions;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function CheckSocket(ASocket:TProtocolSocket; ALock:Boolean; AState:LongWord):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property ProtocolState:TProtocolState read FProtocolState;</code>
+
| &nbsp;
+
|-
+
| <code>property ProtocolOptions:TProtocolOptions read FProtocolOptions;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>property Protocol:TNetworkProtocol read FProtocol;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function WaitChange:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function WaitChangeEx(ATimeout:LongWord):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function SignalChange:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function SendSocket:Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function ScheduleSocket(ATimeout:LongWord):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function UnscheduleSocket:Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function ScheduleSocketItem(AItem:PSocketTimerItem; ATimeout:LongWord):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function UnscheduleSocketItem(AItem:PSocketTimerItem):Boolean; virtual;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''Protocol state'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TProtocolState = class(TObject)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
| <code>constructor Create;</code>
+
| [[TProtocolState|<code>TProtocolState = class(TObject)</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"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>FLocalPort:Word;</code>
+
| &nbsp;
+
|-
+
| <code>FRemotePort:Word;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function AcquireLock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ReleaseLock:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>procedure SetLocalPort(ALocalPort:Word);</code>
+
| &nbsp;
+
|-
+
| <code>procedure SetRemotePort(ARemotePort:Word);</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property LocalPort:Word read FLocalPort write SetLocalPort;</code>
+
| &nbsp;
+
|-
+
| <code>property RemotePort:Word read FRemotePort write SetRemotePort;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''Protocol options'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TProtocolOptions = 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"|Note: For Get/Set Options at the Protocol Level (eg IPPROTO_TCP, IPPROTO_UDP)
+
| [[TProtocolOptions|<code>TProtocolOptions = class(TObject)</code>]]
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <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"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>function AcquireLock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ReleaseLock:Boolean;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''Filter transport'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TFilterTransport = 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"|Note: Downstream
+
| [[TFilterTransport|<code>TFilterTransport = class(TListObject)</code>]]
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <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:TSynchronizerHandle;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>Handle:THandle;</code>
+
| &nbsp;
+
|-
+
| <code>Protocol:Word;</code>
+
| &nbsp;
+
|-
+
| <code>Transport:TNetworkTransport;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function ReaderLock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ReaderUnlock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function WriterLock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function WriterUnlock:Boolean;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''Network filter'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TNetworkFilter = 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"|Note: eg IP Filter
+
| [[TNetworkFilter|<code>TNetworkFilter = class(TListObject)</code>]]
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>constructor Create(AManager:TProtocolManager);</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FLock:TSynchronizerHandle;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>FManager:TProtocolManager;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FProtocol:Word;</code>
+
| &nbsp;
+
|-
+
| <code>FTransports:TNetworkList;</code>
+
| List of TFilterTransport objects
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetTransportByHandle(AHandle:THandle; ALock:Boolean; AState:LongWord):TFilterTransport;</code>
+
| &nbsp;
+
|-
+
| <code>function GetTransportByFamily(AFamily:Word; ALock:Boolean; AState:LongWord):TFilterTransport;</code>
+
| &nbsp;
+
|-
+
| <code>function GetTransportByTransport(ATransport:TNetworkTransport; ALock:Boolean; AState:LongWord):TFilterTransport;</code>
+
| &nbsp;
+
|-
+
| <code>function GetTransportByNext(APrevious:TFilterTransport; ALock,AUnlock:Boolean; AState:LongWord):TFilterTransport;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function AddTransport(ATransport:TNetworkTransport):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function RemoveTransport(ATransport:TNetworkTransport):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property Manager:TProtocolManager read FManager;</code>
+
| &nbsp;
+
|-
+
| <code>property Protocol:Word read FProtocol;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function ReaderLock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ReaderUnlock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function WriterLock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function WriterUnlock:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function StartFilter:Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function StopFilter:Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function ProcessFilter:Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function BindFilter(ATransport:TNetworkTransport):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function UnbindFilter(ATransport:TNetworkTransport):Boolean; virtual;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''Configuration transport'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TConfigTransport = 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"|Note: Downstream
+
| [[TConfigTransport|<code>TConfigTransport = class(TListObject)</code>]]
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <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:TSynchronizerHandle;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>Handle:THandle;</code>
+
| &nbsp;
+
|-
+
| <code>ConfigType:Word;</code>
+
| &nbsp;
+
|-
+
| <code>Transport:TNetworkTransport;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function ReaderLock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ReaderUnlock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function WriterLock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function WriterUnlock:Boolean;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div> 
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''Network configuration'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TNetworkConfig = 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"|Note: eg DHCP/BOOTP/RARP/STATIC/PSEUDO
+
| [[TNetworkConfig|<code>TNetworkConfig = class(TListObject)</code>]]
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>constructor Create(AManager:TProtocolManager);</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FLock:TSynchronizerHandle;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>FManager:TProtocolManager;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FConfigType:Word;</code>
+
| &nbsp;
+
|-
+
| <code>FInitDelay:LongWord;</code>
+
| &nbsp;
+
|-
+
| <code>FRetryCount:LongWord;</code>
+
| &nbsp;
+
|-
+
| <code>FRetryTimeout:LongWord;</code>
+
| &nbsp;
+
|-
+
| <code>FTransports:TNetworkList;</code>
+
| List of TConfigTransport objects
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function GetTransportByHandle(AHandle:THandle; ALock:Boolean; AState:LongWord):TConfigTransport;</code>
+
| &nbsp;
+
|-
+
| <code>function GetTransportByFamily(AFamily:Word; ALock:Boolean; AState:LongWord):TConfigTransport;</code>
+
| &nbsp;
+
|-
+
| <code>function GetTransportByTransport(ATransport:TNetworkTransport; ALock:Boolean; AState:LongWord):TConfigTransport;</code>
+
| &nbsp;
+
|-
+
| <code>function GetTransportByNext(APrevious:TConfigTransport; ALock,AUnlock:Boolean; AState:LongWord):TConfigTransport;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function AddTransport(ATransport:TNetworkTransport):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function RemoveTransport(ATransport:TNetworkTransport):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property Manager:TProtocolManager read FManager;</code>
+
| &nbsp;
+
|-
+
| <code>property ConfigType:Word read FConfigType;</code>
+
| &nbsp;
+
|-
+
| <code>property InitDelay:LongWord read FInitDelay;</code>
+
| &nbsp;
+
|-
+
| <code>property RetryCount:LongWord read FRetryCount;</code>
+
| &nbsp;
+
|-
+
| <code>property RetryTimeout:LongWord read FRetryTimeout;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function ReaderLock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ReaderUnlock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function WriterLock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function WriterUnlock:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function StartConfig:Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function StopConfig:Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function ProcessConfig:Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function BindConfig(ATransport:TNetworkTransport):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function UnbindConfig(ATransport:TNetworkTransport):Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function SetConfig(AInitDelay,ARetryCount,ARetryTimeout:LongWord):Boolean; virtual;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''Network client'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TNetworkClient = 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"|Note: eg DNS/WINS
+
| [[TNetworkClient|<code>TNetworkClient = class(TListObject)</code>]]
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>constructor Create(AProtocol:TNetworkProtocol);</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FLock:TSynchronizerHandle;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>FProtocol:TNetworkProtocol;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property Protocol:TNetworkProtocol read FProtocol;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function ReaderLock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function ReaderUnlock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function WriterLock:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function WriterUnlock:Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function StartClient:Boolean; virtual;</code>
+
| &nbsp;
+
|-
+
| <code>function StopClient:Boolean; virtual;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div> 
 
 
<br />
 
<br />
  
Line 1,632: Line 415:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,644: Line 427:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,656: Line 439:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 1,671: Line 454:
 
{| 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 05:29, 31 August 2021

Return to Unit Reference


Description


Ultibo Network Protocol Interface unit

Constants



Protocol specific constants PROTOCOL_*
PROTOCOL_THREAD_NAME = 'Network Protocol'; Thread name for Network protocol threads
PROTOCOL_THREAD_PRIORITY = THREAD_PRIORITY_HIGHER; Thread priority for Network protocol threads


Protocol timer key values SOCKET_TIMER_KEY_*
SOCKET_TIMER_KEY_NONE = TIMER_KEY_NONE;  
SOCKET_TIMER_KEY_MAX = TIMER_KEY_MAX;  
SOCKET_TIMER_KEY_MIN = TIMER_KEY_MIN;  


Protocol timer flag values SOCKET_TIMER_FLAG_*
SOCKET_TIMER_FLAG_NONE = $00000000;  
SOCKET_TIMER_FLAG_ACTIVE = $00000001; The socket timer item is active in a timer
SOCKET_TIMER_FLAG_DYNAMIC = $00000002; The socket timer item was allocated dynamically


ICMP header type ICMP_*
ICMP_ECHOREPLY = 0; echo reply
ICMP_UNREACH = 3; dest unreachable
ICMP_SOURCEQUENCH = 4; packet lost, slow down
ICMP_REDIRECT = 5; shorter route
ICMP_ECHO = 8; echo service
ICMP_ROUTERADVERT = 9; router advertisement
ICMP_ROUTERSOLICIT = 10; router solicitation
ICMP_TIMXCEED = 11; time exceeded
ICMP_PARAMPROB = 12; ip header bad
ICMP_TSTAMP = 13; timestamp request
ICMP_TSTAMPREPLY = 14; timestamp reply
ICMP_IREQ = 15; information request
ICMP_IREQREPLY = 16; information reply
ICMP_MASKREQ = 17; address mask request
ICMP_MASKREPLY = 18; address mask reply


ICMP header code ICMP_UNREACH_*
ICMP_UNREACH_NET = 0; bad net
ICMP_UNREACH_HOST = 1; bad host
ICMP_UNREACH_PROTOCOL = 2; bad protocol
ICMP_UNREACH_PORT = 3; bad port
ICMP_UNREACH_NEEDFRAG = 4; IP_DF caused drop
ICMP_UNREACH_SRCFAIL = 5; src route failed
ICMP_UNREACH_NET_UNKNOWN = 6; unknown net
ICMP_UNREACH_HOST_UNKNOWN = 7; unknown host
ICMP_UNREACH_ISOLATED = 8; src host isolated
ICMP_UNREACH_NET_PROHIB = 9; prohibited access
ICMP_UNREACH_HOST_PROHIB = 10; ditto
ICMP_UNREACH_TOSNET = 11; bad tos for net
ICMP_UNREACH_TOSHOST = 12; bad tos for host
ICMP_UNREACH_FILTER_PROHIB = 13; admin prohib
ICMP_UNREACH_HOST_PRECEDENCE = 14; host prec vio.
ICMP_UNREACH_PRECEDENCE_CUTOFF = 15; prec cutoff
 
ICMP_REDIRECT_NET = 0; for network
ICMP_REDIRECT_HOST = 1; for host
ICMP_REDIRECT_TOSNET = 2; for tos and net
ICMP_REDIRECT_TOSHOST = 3; for tos and host
 
ICMP_TIMXCEED_INTRANS = 0; ttl=0 in transit
ICMP_TIMXCEED_REASS = 1; ttl=0 in reassembly
 
ICMP_PARAMPROB_OPTABSENT = 1; req. opt. absent


IGMP header type IGMP_*
IGMP_VERSION = 2;  
IGMP_QUERY = $0011;  
IGMP_REPORTV1 = $0012;  
IGMP_REPORTV2 = $0016;  
IGMP_LEAVE = $0017;  


Type definitions



Protocol statistics

PProtocolStatistics = ^TProtocolStatistics;

TProtocolStatistics = record

PacketsIn:Int64;  
PacketsOut:Int64;  
BytesIn:Int64;  
BytesOut:Int64;  
ErrorsIn:Int64;  
ErrorsOut:Int64;  
PacketsLost:Int64;  

Socket timer item

PSocketTimerItem = ^TSocketTimerItem;

TSocketTimerItem = record

Key:Integer; Ordering key for timer list
Flags:LongWord; Flags for this timer item
Socket:TObject; The socket referenced by this timer list item
Prev:PSocketTimerItem; Previous item in timer list
Next:PSocketTimerItem; Next item in timer list

Protocol callback

TProtocolCallback = function(AProtocol:TNetworkProtocol):Boolean of object;

Filter callback

TFilterCallback = function(AFilter:TNetworkFilter):Boolean of object;

Configuration callback

TConfigCallback = function(AConfig:TNetworkConfig):Boolean of object;


Class definitions



Protocol specific classes

TProtocolManager = class(TObject)
TProtocolTransport = class(TListObject)
TNetworkProtocol = class(TListObject)
TSocketTimer = class(TObject)
TSocketThread = class(TThread)
TProtocolPort = class(TListObject)
TProtocolSocket = class(TTransportSocket)
TProtocolState = class(TObject)
TProtocolOptions = class(TObject)
TFilterTransport = class(TListObject)
TNetworkFilter = class(TListObject)
TConfigTransport = class(TListObject)
TNetworkConfig = class(TListObject)
TNetworkClient = class(TListObject)


Public variables



Protocol specific variables

ProtocolManager:TProtocolManager;


Function declarations



Initialization functions

procedure ProtocolInit;
Description: To be documented
Note None documented


function ProtocolStart:LongWord;
Description: To be documented
Note None documented


function ProtocolStop:LongWord;
Description: To be documented
Note None documented


Protocol helper functions

procedure ProtocolCheckTimer(Data:Pointer);
Description: To be documented
Note None documented


Return to Unit Reference