Difference between revisions of "Unit Protocol"
Line 296: | Line 296: | ||
---- | ---- | ||
− | '' | + | |
+ | '''Protocol manager''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | |||
+ | <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> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>destructor Destroy; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | ||
+ | |- | ||
+ | | <code>FLock:TSynchronizerHandle;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FSettings:TNetworkSettings;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FTransports:TTransportManager;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <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"| | ||
+ | |- | ||
+ | | <code>function ReaderLock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function ReaderUnlock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function WriterLock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function WriterUnlock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>property Settings:TNetworkSettings read FSettings;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property Transports:TTransportManager read FTransports;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function AddProtocol(AProtocol:TNetworkProtocol):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function RemoveProtocol(AProtocol:TNetworkProtocol):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function GetProtocolByType(AProtocol,ASocketType:Word; ALock:Boolean; AState:LongWord):TNetworkProtocol;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function GetProtocolByProtocol(AProtocol:TNetworkProtocol; ALock:Boolean; AState:LongWord):TNetworkProtocol;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function GetProtocolByNext(APrevious:TNetworkProtocol; ALock,AUnlock:Boolean; AState:LongWord):TNetworkProtocol;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function AddFilter(AFilter:TNetworkFilter):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function RemoveFilter(AFilter:TNetworkFilter):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function GetFilterByProtocol(AProtocol:Word; ALock:Boolean; AState:LongWord):TNetworkFilter;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function GetFilterByFilter(AFilter:TNetworkFilter; ALock:Boolean; AState:LongWord):TNetworkFilter;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function GetFilterByNext(APrevious:TNetworkFilter; ALock,AUnlock:Boolean; AState:LongWord):TNetworkFilter;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function AddConfig(AConfig:TNetworkConfig):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function RemoveConfig(AConfig:TNetworkConfig):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function GetConfigByType(AConfigType:Word; ALock:Boolean; AState:LongWord):TNetworkConfig;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function GetConfigByConfig(AConfig:TNetworkConfig; ALock:Boolean; AState:LongWord):TNetworkConfig;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function GetConfigByNext(APrevious:TNetworkConfig; ALock,AUnlock:Boolean; AState:LongWord):TNetworkConfig;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function SetConfigByType(AConfigType:Word; AInitDelay,ARetryCount,ARetryTimeout:LongWord):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function StartProtocols:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function StopProtocols:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function ProcessProtocols:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function ProcessSockets:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function EnumerateProtocols(ACallback:TProtocolCallback):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function BindProtocols(ATransport:TNetworkTransport):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function UnbindProtocols(ATransport:TNetworkTransport):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function StartFilters:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function StopFilters:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function ProcessFilters:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function EnumerateFilters(ACallback:TFilterCallback):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function BindFilters(ATransport:TNetworkTransport):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function UnbindFilters(ATransport:TNetworkTransport):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function StartConfigs:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function StopConfigs:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function ProcessConfigs:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function EnumerateConfigs(ACallback:TConfigCallback):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function BindConfigs(ATransport:TNetworkTransport):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function UnbindConfigs(ATransport:TNetworkTransport):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function CheckSocket(ASocket:TSocket; ALock:Boolean; AState:LongWord):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function Select(ANfds:Integer; AReadfds,AWritefds,AExceptfds:PFDSet; ATimeout:PTimeVal):LongInt;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function Socket(AFamily,AStruct,AProtocol:Integer):TSocket;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''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 | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>constructor Create;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>destructor Destroy; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | ||
+ | |- | ||
+ | | <code>FLock:TSynchronizerHandle;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>Handle:THandle;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>Protocol:Word;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>Transport:TNetworkTransport;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function ReaderLock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function ReaderUnlock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function WriterLock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function WriterUnlock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''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> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>destructor Destroy; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | ||
+ | |- | ||
+ | | <code>FLock:TSynchronizerHandle;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div> | ||
+ | |- | ||
+ | | <code>FManager:TProtocolManager;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FName:String;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>FProtocol:Word;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FSocketType:Word;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FTransports:TNetworkList;</code> | ||
+ | | List of TProtocolTransport objects | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <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"| | ||
+ | |- | ||
+ | | <code>FStatistics:TProtocolStatistics;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function GetTransportByHandle(AHandle:THandle; ALock:Boolean; AState:LongWord):TProtocolTransport;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function GetTransportByFamily(AFamily:Word; ALock:Boolean; AState:LongWord):TProtocolTransport;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function GetTransportByTransport(ATransport:TNetworkTransport; ALock:Boolean; AState:LongWord):TProtocolTransport;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function GetTransportByNext(APrevious:TProtocolTransport; ALock,AUnlock:Boolean; AState:LongWord):TProtocolTransport;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function AddTransport(ATransport:TNetworkTransport):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function RemoveTransport(ATransport:TNetworkTransport):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function OpenPort(ASocket:TProtocolSocket; APort:Word):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function ClosePort(ASocket:TProtocolSocket):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function FindPort(APort:Word; AWrite,ALock:Boolean):TProtocolPort; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function GetSocketByNext(APrevious:TProtocolSocket; ALock,AUnlock:Boolean; AState:LongWord):TProtocolSocket;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function CheckSocket(ASocket:TProtocolSocket; ALock:Boolean; AState:LongWord):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function FindSocket(AFamily,AStruct,AProtocol:Word; ALocalAddress,ARemoteAddress:Pointer; ALocalPort,ARemotePort:Word; ABroadcast,AListen,ALock:Boolean; AState:LongWord):TProtocolSocket; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure FlushSockets(All:Boolean); virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function SelectStart(ASource,ADest:PFDSet):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function SelectCheck(ASource,ADest:PFDSet;ACode:Integer):Integer; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function SendPacket(ASocket:TProtocolSocket; ASource,ADest:Pointer; ASourcePort,ADestPort:Word; APacket:PPacketFragment; ASize,AFlags:Integer):Integer; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>property Manager:TProtocolManager read FManager;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property Name:String read FName; </code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>property Protocol:Word read FProtocol;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property SocketType:Word read FSocketType;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function Accept(ASocket:TProtocolSocket; ASockAddr:PSockAddr; AAddrLength:PInteger):TProtocolSocket; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function Bind(ASocket:TProtocolSocket; var ASockAddr:TSockAddr; AAddrLength:Integer):Integer; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function CloseSocket(ASocket:TProtocolSocket):Integer; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function Connect(ASocket:TProtocolSocket; var ASockAddr:TSockAddr; AAddrLength:Integer):Integer; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function IoctlSocket(ASocket:TProtocolSocket; ACmd:DWORD; var AArg:u_long):Integer; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function GetPeerName(ASocket:TProtocolSocket; var ASockAddr:TSockAddr; var AAddrLength:Integer):Integer; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function GetSockName(ASocket:TProtocolSocket; var ASockAddr:TSockAddr; var AAddrLength:Integer):Integer; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function GetSockOpt(ASocket:TProtocolSocket; ALevel,AOptName:Integer; AOptValue:PChar; var AOptLength:Integer):Integer; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function Listen(ASocket:TProtocolSocket; ABacklog:Integer):Integer; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function Recv(ASocket:TProtocolSocket; var ABuffer; ALength,AFlags:Integer):Integer; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function RecvFrom(ASocket:TProtocolSocket; var ABuffer; ALength,AFlags:Integer; var AFromAddr:TSockAddr; var AFromLength:Integer):Integer; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function Select(ANfds:Integer; AReadfds,AWritefds,AExceptfds:PFDSet; ATimeout:PTimeVal):LongInt; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function Send(ASocket:TProtocolSocket; var ABuffer; ALength,AFlags:Integer):Integer; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function SendTo(ASocket:TProtocolSocket; var ABuffer; ALength,AFlags:Integer; var AToAddr:TSockAddr; AToLength:Integer):Integer; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function SetSockOpt(ASocket:TProtocolSocket; ALevel,AOptName:Integer; AOptValue:PChar; AOptLength:Integer):Integer; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function Shutdown(ASocket:TProtocolSocket; AHow:Integer):Integer; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function Socket(AFamily,AStruct,AProtocol:Integer):TProtocolSocket; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function ReaderLock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function ReaderUnlock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function WriterLock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function WriterUnlock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function GetStatistics:TProtocolStatistics; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function StartProtocol:Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function StopProtocol:Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function ProcessProtocol:Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function ProcessSockets:Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function ProcessSocket(ASocket:TProtocolSocket):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function BindProtocol(ATransport:TNetworkTransport):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function UnbindProtocol(ATransport:TNetworkTransport):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function CheckTimer:Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function ProcessTimer:Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function SendSocket(ASocket:TProtocolSocket):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function ScheduleSocket(ASocket:TProtocolSocket; ATimeout:LongWord):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function UnscheduleSocket(ASocket:TProtocolSocket):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''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> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>destructor Destroy; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div> | ||
+ | |- | ||
+ | | <code>FProtocol:TNetworkProtocol;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>FLock:TMutexHandle;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FInterval:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FCheckTimer:TTimerHandle;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FProcessSemaphore:TSemaphoreHandle;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>FCount:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>FFirst:PSocketTimerItem;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FLast:PSocketTimerItem;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function AcquireLock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function ReleaseLock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function Dequeue(AMax:Integer):TProtocolSocket;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function FirstKey:Integer;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function InsertKey(ASocket:TProtocolSocket; AKey:Integer):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function DeleteKey(ASocket:TProtocolSocket):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function DecrementKey:Integer;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>property Count:LongWord read FCount;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function StartTimer(AInterval:LongWord):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function StopTimer:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function CheckTimer:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function ProcessTimer:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function ScheduleSocket(ASocket:TProtocolSocket; ATimeout:LongWord):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function UnscheduleSocket(ASocket:TProtocolSocket):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''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> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>destructor Destroy; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div> | ||
+ | |- | ||
+ | | <code>FProtocol:TNetworkProtocol;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>procedure Execute; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>function SendSocket(ASocket:TProtocolSocket):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''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> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>destructor Destroy; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | ||
+ | |- | ||
+ | | <code>FLock:TMutexHandle;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>Port:Word;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>Sockets:TList;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function AcquireLock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function ReleaseLock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''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> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>destructor Destroy; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | ||
+ | |- | ||
+ | | <code>FSocketChange:TEventHandle;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div> | ||
+ | |- | ||
+ | | <code>FProtocol:TNetworkProtocol;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>FProtocolState:TProtocolState;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FProtocolOptions:TProtocolOptions;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function CheckSocket(ASocket:TProtocolSocket; ALock:Boolean; AState:LongWord):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>property ProtocolState:TProtocolState read FProtocolState;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property ProtocolOptions:TProtocolOptions read FProtocolOptions;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>property Protocol:TNetworkProtocol read FProtocol;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function WaitChange:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function WaitChangeEx(ATimeout:LongWord):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function SignalChange:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function SendSocket:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function ScheduleSocket(ATimeout:LongWord):Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function UnscheduleSocket:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''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> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>destructor Destroy; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | ||
+ | |- | ||
+ | | <code>FLock:TCriticalSectionHandle;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div> | ||
+ | |- | ||
+ | | <code>FLocalPort:Word;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FRemotePort:Word;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function AcquireLock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function ReleaseLock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>procedure SetLocalPort(ALocalPort:Word);</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>procedure SetRemotePort(ARemotePort:Word);</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>property LocalPort:Word read FLocalPort write SetLocalPort;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property RemotePort:Word read FRemotePort write SetRemotePort;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''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) | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>constructor Create;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>destructor Destroy; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | ||
+ | |- | ||
+ | | <code>FLock:TCriticalSectionHandle;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div> | ||
+ | |- | ||
+ | | <code>function AcquireLock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function ReleaseLock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''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 | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>constructor Create;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>destructor Destroy; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | ||
+ | |- | ||
+ | | <code>FLock:TSynchronizerHandle;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>Handle:THandle;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>Protocol:Word;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>Transport:TNetworkTransport;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function ReaderLock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function ReaderUnlock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function WriterLock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function WriterUnlock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''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 | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>constructor Create(AManager:TProtocolManager);</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>destructor Destroy; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | ||
+ | |- | ||
+ | | <code>FLock:TSynchronizerHandle;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div> | ||
+ | |- | ||
+ | | <code>FManager:TProtocolManager;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>FProtocol:Word;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FTransports:TNetworkList;</code> | ||
+ | | List of TFilterTransport objects | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function GetTransportByHandle(AHandle:THandle; ALock:Boolean; AState:LongWord):TFilterTransport;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function GetTransportByFamily(AFamily:Word; ALock:Boolean; AState:LongWord):TFilterTransport;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function GetTransportByTransport(ATransport:TNetworkTransport; ALock:Boolean; AState:LongWord):TFilterTransport;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function GetTransportByNext(APrevious:TFilterTransport; ALock,AUnlock:Boolean; AState:LongWord):TFilterTransport;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function AddTransport(ATransport:TNetworkTransport):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function RemoveTransport(ATransport:TNetworkTransport):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>property Manager:TProtocolManager read FManager;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property Protocol:Word read FProtocol;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function ReaderLock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function ReaderUnlock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function WriterLock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function WriterUnlock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function StartFilter:Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function StopFilter:Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function ProcessFilter:Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function BindFilter(ATransport:TNetworkTransport):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function UnbindFilter(ATransport:TNetworkTransport):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''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 | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>constructor Create;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>destructor Destroy; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | ||
+ | |- | ||
+ | | <code>FLock:TSynchronizerHandle;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>Handle:THandle;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>ConfigType:Word;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>Transport:TNetworkTransport;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function ReaderLock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function ReaderUnlock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function WriterLock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function WriterUnlock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''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 | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>constructor Create(AManager:TProtocolManager);</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>destructor Destroy; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | ||
+ | |- | ||
+ | | <code>FLock:TSynchronizerHandle;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div> | ||
+ | |- | ||
+ | | <code>FManager:TProtocolManager;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>FConfigType:Word;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FInitDelay:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FRetryCount:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FRetryTimeout:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FTransports:TNetworkList;</code> | ||
+ | | List of TConfigTransport objects | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function GetTransportByHandle(AHandle:THandle; ALock:Boolean; AState:LongWord):TConfigTransport;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function GetTransportByFamily(AFamily:Word; ALock:Boolean; AState:LongWord):TConfigTransport;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function GetTransportByTransport(ATransport:TNetworkTransport; ALock:Boolean; AState:LongWord):TConfigTransport;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function GetTransportByNext(APrevious:TConfigTransport; ALock,AUnlock:Boolean; AState:LongWord):TConfigTransport;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function AddTransport(ATransport:TNetworkTransport):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function RemoveTransport(ATransport:TNetworkTransport):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>property Manager:TProtocolManager read FManager;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property ConfigType:Word read FConfigType;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property InitDelay:LongWord read FInitDelay;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property RetryCount:LongWord read FRetryCount;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>property RetryTimeout:LongWord read FRetryTimeout;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function ReaderLock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function ReaderUnlock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function WriterLock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function WriterUnlock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function StartConfig:Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function StopConfig:Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function ProcessConfig:Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function BindConfig(ATransport:TNetworkTransport):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function UnbindConfig(ATransport:TNetworkTransport):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function SetConfig(AInitDelay,ARetryCount,ARetryTimeout:LongWord):Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''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 | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>constructor Create(AProtocol:TNetworkProtocol);</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>destructor Destroy; override;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div> | ||
+ | |- | ||
+ | | <code>FLock:TSynchronizerHandle;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div> | ||
+ | |- | ||
+ | | <code>FProtocol:TNetworkProtocol;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div> | ||
+ | |- | ||
+ | | <code>property Protocol:TNetworkProtocol read FProtocol;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function ReaderLock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function ReaderUnlock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function WriterLock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function WriterUnlock:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"| | ||
+ | |- | ||
+ | | <code>function StartClient:Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>function StopClient:Boolean; virtual;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
=== Public variables === | === Public variables === |
Revision as of 06:28, 17 March 2017
Return to Unit Reference
Contents
Description
Ultibo Network Protocol interface unit
To be documented
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 |
SOCKET_TIMER_*
SOCKET_TIMER_KEY_NONE = TIMER_KEY_NONE;
|
|
SOCKET_TIMER_KEY_MAX = TIMER_KEY_MAX;
|
|
SOCKET_TIMER_KEY_MIN = TIMER_KEY_MIN;
|
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_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_*
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 |
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 manager
TProtocolManager = class(TObject)
constructor Create(ASettings:TNetworkSettings; ATransports:TTransportManager);
|
|
destructor Destroy; override;
|
|
private
| |
FLock:TSynchronizerHandle;
|
|
FSettings:TNetworkSettings;
|
|
FTransports:TTransportManager;
|
|
FProtocols:TNetworkList;
|
List of TNetworkProtocol objects |
FFilters:TNetworkList;
|
List of TNetworkFilter objects |
FConfigs:TNetworkList;
|
List of TNetworkConfig objects |
function ReaderLock:Boolean;
|
|
function ReaderUnlock:Boolean;
|
|
function WriterLock:Boolean;
|
|
function WriterUnlock:Boolean;
|
|
public
| |
property Settings:TNetworkSettings read FSettings;
|
|
property Transports:TTransportManager read FTransports;
|
|
function AddProtocol(AProtocol:TNetworkProtocol):Boolean;
|
|
function RemoveProtocol(AProtocol:TNetworkProtocol):Boolean;
|
|
function GetProtocolByType(AProtocol,ASocketType:Word; ALock:Boolean; AState:LongWord):TNetworkProtocol;
|
|
function GetProtocolByProtocol(AProtocol:TNetworkProtocol; ALock:Boolean; AState:LongWord):TNetworkProtocol;
|
|
function GetProtocolByNext(APrevious:TNetworkProtocol; ALock,AUnlock:Boolean; AState:LongWord):TNetworkProtocol;
|
|
function AddFilter(AFilter:TNetworkFilter):Boolean;
|
|
function RemoveFilter(AFilter:TNetworkFilter):Boolean;
|
|
function GetFilterByProtocol(AProtocol:Word; ALock:Boolean; AState:LongWord):TNetworkFilter;
|
|
function GetFilterByFilter(AFilter:TNetworkFilter; ALock:Boolean; AState:LongWord):TNetworkFilter;
|
|
function GetFilterByNext(APrevious:TNetworkFilter; ALock,AUnlock:Boolean; AState:LongWord):TNetworkFilter;
|
|
function AddConfig(AConfig:TNetworkConfig):Boolean;
|
|
function RemoveConfig(AConfig:TNetworkConfig):Boolean;
|
|
function GetConfigByType(AConfigType:Word; ALock:Boolean; AState:LongWord):TNetworkConfig;
|
|
function GetConfigByConfig(AConfig:TNetworkConfig; ALock:Boolean; AState:LongWord):TNetworkConfig;
|
|
function GetConfigByNext(APrevious:TNetworkConfig; ALock,AUnlock:Boolean; AState:LongWord):TNetworkConfig;
|
|
function SetConfigByType(AConfigType:Word; AInitDelay,ARetryCount,ARetryTimeout:LongWord):Boolean;
|
|
function StartProtocols:Boolean;
|
|
function StopProtocols:Boolean;
|
|
function ProcessProtocols:Boolean;
|
|
function ProcessSockets:Boolean;
|
|
function EnumerateProtocols(ACallback:TProtocolCallback):Boolean;
|
|
function BindProtocols(ATransport:TNetworkTransport):Boolean;
|
|
function UnbindProtocols(ATransport:TNetworkTransport):Boolean;
|
|
function StartFilters:Boolean;
|
|
function StopFilters:Boolean;
|
|
function ProcessFilters:Boolean;
|
|
function EnumerateFilters(ACallback:TFilterCallback):Boolean;
|
|
function BindFilters(ATransport:TNetworkTransport):Boolean;
|
|
function UnbindFilters(ATransport:TNetworkTransport):Boolean;
|
|
function StartConfigs:Boolean;
|
|
function StopConfigs:Boolean;
|
|
function ProcessConfigs:Boolean;
|
|
function EnumerateConfigs(ACallback:TConfigCallback):Boolean;
|
|
function BindConfigs(ATransport:TNetworkTransport):Boolean;
|
|
function UnbindConfigs(ATransport:TNetworkTransport):Boolean;
|
|
function CheckSocket(ASocket:TSocket; ALock:Boolean; AState:LongWord):Boolean;
|
|
function Select(ANfds:Integer; AReadfds,AWritefds,AExceptfds:PFDSet; ATimeout:PTimeVal):LongInt;
|
|
function Socket(AFamily,AStruct,AProtocol:Integer):TSocket;
|
Protocol transport
TProtocolTransport = class(TListObject)
Note: Downstream | |
constructor Create;
|
|
destructor Destroy; override;
|
|
private
| |
FLock:TSynchronizerHandle;
|
|
public
| |
Handle:THandle;
|
|
Protocol:Word;
|
|
Transport:TNetworkTransport;
|
|
function ReaderLock:Boolean;
|
|
function ReaderUnlock:Boolean;
|
|
function WriterLock:Boolean;
|
|
function WriterUnlock:Boolean;
|
Network protocol
TNetworkProtocol = class(TListObject)
constructor Create(AManager:TProtocolManager; const AName:String);
|
|
destructor Destroy; override;
|
|
private
| |
FLock:TSynchronizerHandle;
|
|
protected
| |
FManager:TProtocolManager;
|
|
FName:String;
|
|
FProtocol:Word;
|
|
FSocketType:Word;
|
|
FTransports:TNetworkList;
|
List of TProtocolTransport objects |
FTimer:TSocketTimer;
|
Timer for socket processing |
FThread:TSocketThread;
|
Thread for socket processing |
FPorts:TNetworkList;
|
List of TProtocolPort objects |
FSockets:TNetworkList;
|
List of TProtocolSocket objects |
FStatistics:TProtocolStatistics;
|
|
function GetTransportByHandle(AHandle:THandle; ALock:Boolean; AState:LongWord):TProtocolTransport;
|
|
function GetTransportByFamily(AFamily:Word; ALock:Boolean; AState:LongWord):TProtocolTransport;
|
|
function GetTransportByTransport(ATransport:TNetworkTransport; ALock:Boolean; AState:LongWord):TProtocolTransport;
|
|
function GetTransportByNext(APrevious:TProtocolTransport; ALock,AUnlock:Boolean; AState:LongWord):TProtocolTransport;
|
|
function AddTransport(ATransport:TNetworkTransport):Boolean; virtual;
|
|
function RemoveTransport(ATransport:TNetworkTransport):Boolean; virtual;
|
|
function OpenPort(ASocket:TProtocolSocket; APort:Word):Boolean; virtual;
|
|
function ClosePort(ASocket:TProtocolSocket):Boolean; virtual;
|
|
function FindPort(APort:Word; AWrite,ALock:Boolean):TProtocolPort; virtual;
|
|
function GetSocketByNext(APrevious:TProtocolSocket; ALock,AUnlock:Boolean; AState:LongWord):TProtocolSocket;
|
|
function CheckSocket(ASocket:TProtocolSocket; ALock:Boolean; AState:LongWord):Boolean; virtual;
|
|
function FindSocket(AFamily,AStruct,AProtocol:Word; ALocalAddress,ARemoteAddress:Pointer; ALocalPort,ARemotePort:Word; ABroadcast,AListen,ALock:Boolean; AState:LongWord):TProtocolSocket; virtual;
|
|
procedure FlushSockets(All:Boolean); virtual;
|
|
function SelectStart(ASource,ADest:PFDSet):Boolean; virtual;
|
|
function SelectCheck(ASource,ADest:PFDSet;ACode:Integer):Integer; virtual;
|
|
function SendPacket(ASocket:TProtocolSocket; ASource,ADest:Pointer; ASourcePort,ADestPort:Word; APacket:PPacketFragment; ASize,AFlags:Integer):Integer; virtual;
|
|
public
| |
property Manager:TProtocolManager read FManager;
|
|
property Name:String read FName;
|
|
property Protocol:Word read FProtocol;
|
|
property SocketType:Word read FSocketType;
|
|
function Accept(ASocket:TProtocolSocket; ASockAddr:PSockAddr; AAddrLength:PInteger):TProtocolSocket; virtual;
|
|
function Bind(ASocket:TProtocolSocket; var ASockAddr:TSockAddr; AAddrLength:Integer):Integer; virtual;
|
|
function CloseSocket(ASocket:TProtocolSocket):Integer; virtual;
|
|
function Connect(ASocket:TProtocolSocket; var ASockAddr:TSockAddr; AAddrLength:Integer):Integer; virtual;
|
|
function IoctlSocket(ASocket:TProtocolSocket; ACmd:DWORD; var AArg:u_long):Integer; virtual;
|
|
function GetPeerName(ASocket:TProtocolSocket; var ASockAddr:TSockAddr; var AAddrLength:Integer):Integer; virtual;
|
|
function GetSockName(ASocket:TProtocolSocket; var ASockAddr:TSockAddr; var AAddrLength:Integer):Integer; virtual;
|
|
function GetSockOpt(ASocket:TProtocolSocket; ALevel,AOptName:Integer; AOptValue:PChar; var AOptLength:Integer):Integer; virtual;
|
|
function Listen(ASocket:TProtocolSocket; ABacklog:Integer):Integer; virtual;
|
|
function Recv(ASocket:TProtocolSocket; var ABuffer; ALength,AFlags:Integer):Integer; virtual;
|
|
function RecvFrom(ASocket:TProtocolSocket; var ABuffer; ALength,AFlags:Integer; var AFromAddr:TSockAddr; var AFromLength:Integer):Integer; virtual;
|
|
function Select(ANfds:Integer; AReadfds,AWritefds,AExceptfds:PFDSet; ATimeout:PTimeVal):LongInt; virtual;
|
|
function Send(ASocket:TProtocolSocket; var ABuffer; ALength,AFlags:Integer):Integer; virtual;
|
|
function SendTo(ASocket:TProtocolSocket; var ABuffer; ALength,AFlags:Integer; var AToAddr:TSockAddr; AToLength:Integer):Integer; virtual;
|
|
function SetSockOpt(ASocket:TProtocolSocket; ALevel,AOptName:Integer; AOptValue:PChar; AOptLength:Integer):Integer; virtual;
|
|
function Shutdown(ASocket:TProtocolSocket; AHow:Integer):Integer; virtual;
|
|
function Socket(AFamily,AStruct,AProtocol:Integer):TProtocolSocket; virtual;
|
|
function ReaderLock:Boolean;
|
|
function ReaderUnlock:Boolean;
|
|
function WriterLock:Boolean;
|
|
function WriterUnlock:Boolean;
|
|
function GetStatistics:TProtocolStatistics; virtual;
|
|
function StartProtocol:Boolean; virtual;
|
|
function StopProtocol:Boolean; virtual;
|
|
function ProcessProtocol:Boolean; virtual;
|
|
function ProcessSockets:Boolean; virtual;
|
|
function ProcessSocket(ASocket:TProtocolSocket):Boolean; virtual;
|
|
function BindProtocol(ATransport:TNetworkTransport):Boolean; virtual;
|
|
function UnbindProtocol(ATransport:TNetworkTransport):Boolean; virtual;
|
|
function CheckTimer:Boolean; virtual;
|
|
function ProcessTimer:Boolean; virtual;
|
|
function SendSocket(ASocket:TProtocolSocket):Boolean; virtual;
|
|
function ScheduleSocket(ASocket:TProtocolSocket; ATimeout:LongWord):Boolean; virtual;
|
|
function UnscheduleSocket(ASocket:TProtocolSocket):Boolean; virtual;
|
Socket timer
TSocketTimer = class(TObject)
constructor Create(AProtocol:TNetworkProtocol);
|
|
destructor Destroy; override;
|
|
protected
| |
FProtocol:TNetworkProtocol;
|
|
FLock:TMutexHandle;
|
|
FInterval:LongWord;
|
|
FCheckTimer:TTimerHandle;
|
|
FProcessSemaphore:TSemaphoreHandle;
|
|
FCount:LongWord;
|
|
FFirst:PSocketTimerItem;
|
|
FLast:PSocketTimerItem;
|
|
function AcquireLock:Boolean;
|
|
function ReleaseLock:Boolean;
|
|
function Dequeue(AMax:Integer):TProtocolSocket;
|
|
function FirstKey:Integer;
|
|
function InsertKey(ASocket:TProtocolSocket; AKey:Integer):Boolean;
|
|
function DeleteKey(ASocket:TProtocolSocket):Boolean;
|
|
function DecrementKey:Integer;
|
|
public
| |
property Count:LongWord read FCount;
|
|
function StartTimer(AInterval:LongWord):Boolean;
|
|
function StopTimer:Boolean;
|
|
function CheckTimer:Boolean;
|
|
function ProcessTimer:Boolean;
|
|
function ScheduleSocket(ASocket:TProtocolSocket; ATimeout:LongWord):Boolean;
|
|
function UnscheduleSocket(ASocket:TProtocolSocket):Boolean;
|
Socket thread
TSocketThread = class(TThread)
constructor Create(AProtocol:TNetworkProtocol);
|
|
destructor Destroy; override;
|
|
protected
| |
FProtocol:TNetworkProtocol;
|
|
procedure Execute; override;
|
|
public
| |
function SendSocket(ASocket:TProtocolSocket):Boolean;
|
Protocol port
TProtocolPort = class(TListObject)
constructor Create;
|
|
destructor Destroy; override;
|
|
private
| |
FLock:TMutexHandle;
|
|
public
| |
Port:Word;
|
|
Sockets:TList;
|
|
function AcquireLock:Boolean;
|
|
function ReleaseLock:Boolean;
|
Protocol socket
TProtocolSocket = class(TTransportSocket)
constructor Create(AProtocol:TNetworkProtocol; ATransport:TNetworkTransport);
|
|
destructor Destroy; override;
|
|
private
| |
FSocketChange:TEventHandle;
|
|
protected
| |
FProtocol:TNetworkProtocol;
|
|
FProtocolState:TProtocolState;
|
|
FProtocolOptions:TProtocolOptions;
|
|
function CheckSocket(ASocket:TProtocolSocket; ALock:Boolean; AState:LongWord):Boolean;
|
|
public
| |
property ProtocolState:TProtocolState read FProtocolState;
|
|
property ProtocolOptions:TProtocolOptions read FProtocolOptions;
|
|
property Protocol:TNetworkProtocol read FProtocol;
|
|
function WaitChange:Boolean;
|
|
function WaitChangeEx(ATimeout:LongWord):Boolean;
|
|
function SignalChange:Boolean;
|
|
function SendSocket:Boolean;
|
|
function ScheduleSocket(ATimeout:LongWord):Boolean;
|
|
function UnscheduleSocket:Boolean;
|
Protocol state
TProtocolState = class(TObject)
constructor Create;
|
|
destructor Destroy; override;
|
|
private
| |
FLock:TCriticalSectionHandle;
|
|
protected
| |
FLocalPort:Word;
|
|
FRemotePort:Word;
|
|
function AcquireLock:Boolean;
|
|
function ReleaseLock:Boolean;
|
|
procedure SetLocalPort(ALocalPort:Word);
|
|
procedure SetRemotePort(ARemotePort:Word);
|
|
public
| |
property LocalPort:Word read FLocalPort write SetLocalPort;
|
|
property RemotePort:Word read FRemotePort write SetRemotePort;
|
Protocol options
TProtocolOptions = class(TObject)
Note: For Get/Set Options at the Protocol Level (eg IPPROTO_TCP, IPPROTO_UDP) | |
constructor Create;
|
|
destructor Destroy; override;
|
|
private
| |
FLock:TCriticalSectionHandle;
|
|
protected
| |
function AcquireLock:Boolean;
|
|
function ReleaseLock:Boolean;
|
Filter transport
TFilterTransport = class(TListObject)
Note: Downstream | |
constructor Create;
|
|
destructor Destroy; override;
|
|
private
| |
FLock:TSynchronizerHandle;
|
|
public
| |
Handle:THandle;
|
|
Protocol:Word;
|
|
Transport:TNetworkTransport;
|
|
function ReaderLock:Boolean;
|
|
function ReaderUnlock:Boolean;
|
|
function WriterLock:Boolean;
|
|
function WriterUnlock:Boolean;
|
Network filter
TNetworkFilter = class(TListObject)
Note: eg IP Filter | |
constructor Create(AManager:TProtocolManager);
|
|
destructor Destroy; override;
|
|
private
| |
FLock:TSynchronizerHandle;
|
|
protected
| |
FManager:TProtocolManager;
|
|
FProtocol:Word;
|
|
FTransports:TNetworkList;
|
List of TFilterTransport objects |
function GetTransportByHandle(AHandle:THandle; ALock:Boolean; AState:LongWord):TFilterTransport;
|
|
function GetTransportByFamily(AFamily:Word; ALock:Boolean; AState:LongWord):TFilterTransport;
|
|
function GetTransportByTransport(ATransport:TNetworkTransport; ALock:Boolean; AState:LongWord):TFilterTransport;
|
|
function GetTransportByNext(APrevious:TFilterTransport; ALock,AUnlock:Boolean; AState:LongWord):TFilterTransport;
|
|
function AddTransport(ATransport:TNetworkTransport):Boolean; virtual;
|
|
function RemoveTransport(ATransport:TNetworkTransport):Boolean; virtual;
|
|
public
| |
property Manager:TProtocolManager read FManager;
|
|
property Protocol:Word read FProtocol;
|
|
function ReaderLock:Boolean;
|
|
function ReaderUnlock:Boolean;
|
|
function WriterLock:Boolean;
|
|
function WriterUnlock:Boolean;
|
|
function StartFilter:Boolean; virtual;
|
|
function StopFilter:Boolean; virtual;
|
|
function ProcessFilter:Boolean; virtual;
|
|
function BindFilter(ATransport:TNetworkTransport):Boolean; virtual;
|
|
function UnbindFilter(ATransport:TNetworkTransport):Boolean; virtual;
|
Configuration transport
TConfigTransport = class(TListObject)
Note: Downstream | |
constructor Create;
|
|
destructor Destroy; override;
|
|
private
| |
FLock:TSynchronizerHandle;
|
|
public
| |
Handle:THandle;
|
|
ConfigType:Word;
|
|
Transport:TNetworkTransport;
|
|
function ReaderLock:Boolean;
|
|
function ReaderUnlock:Boolean;
|
|
function WriterLock:Boolean;
|
|
function WriterUnlock:Boolean;
|
Network configuration
TNetworkConfig = class(TListObject)
Note: eg DHCP/BOOTP/RARP/STATIC/PSEUDO | |
constructor Create(AManager:TProtocolManager);
|
|
destructor Destroy; override;
|
|
private
| |
FLock:TSynchronizerHandle;
|
|
protected
| |
FManager:TProtocolManager;
|
|
FConfigType:Word;
|
|
FInitDelay:LongWord;
|
|
FRetryCount:LongWord;
|
|
FRetryTimeout:LongWord;
|
|
FTransports:TNetworkList;
|
List of TConfigTransport objects |
function GetTransportByHandle(AHandle:THandle; ALock:Boolean; AState:LongWord):TConfigTransport;
|
|
function GetTransportByFamily(AFamily:Word; ALock:Boolean; AState:LongWord):TConfigTransport;
|
|
function GetTransportByTransport(ATransport:TNetworkTransport; ALock:Boolean; AState:LongWord):TConfigTransport;
|
|
function GetTransportByNext(APrevious:TConfigTransport; ALock,AUnlock:Boolean; AState:LongWord):TConfigTransport;
|
|
function AddTransport(ATransport:TNetworkTransport):Boolean; virtual;
|
|
function RemoveTransport(ATransport:TNetworkTransport):Boolean; virtual;
|
|
public
| |
property Manager:TProtocolManager read FManager;
|
|
property ConfigType:Word read FConfigType;
|
|
property InitDelay:LongWord read FInitDelay;
|
|
property RetryCount:LongWord read FRetryCount;
|
|
property RetryTimeout:LongWord read FRetryTimeout;
|
|
function ReaderLock:Boolean;
|
|
function ReaderUnlock:Boolean;
|
|
function WriterLock:Boolean;
|
|
function WriterUnlock:Boolean;
|
|
function StartConfig:Boolean; virtual;
|
|
function StopConfig:Boolean; virtual;
|
|
function ProcessConfig:Boolean; virtual;
|
|
function BindConfig(ATransport:TNetworkTransport):Boolean; virtual;
|
|
function UnbindConfig(ATransport:TNetworkTransport):Boolean; virtual;
|
|
function SetConfig(AInitDelay,ARetryCount,ARetryTimeout:LongWord):Boolean; virtual;
|
Network client
TNetworkClient = class(TListObject)
Note: eg DNS/WINS | |
constructor Create(AProtocol:TNetworkProtocol);
|
|
destructor Destroy; override;
|
|
private
| |
FLock:TSynchronizerHandle;
|
|
protected
| |
FProtocol:TNetworkProtocol;
|
|
public
| |
property Protocol:TNetworkProtocol read FProtocol;
|
|
function ReaderLock:Boolean;
|
|
function ReaderUnlock:Boolean;
|
|
function WriterLock:Boolean;
|
|
function WriterUnlock:Boolean;
|
|
function StartClient:Boolean; virtual;
|
|
function StopClient:Boolean; virtual;
|
Public variables
None defined
Function declarations
Initialization functions
procedure ProtocolInit;
Note | None documented |
---|
function ProtocolStart:LongWord;
Note | None documented |
---|
function ProtocolStop:LongWord;
Note | None documented |
---|
Protocol helper functions
procedure ProtocolCheckTimer(Data:Pointer);
Note | None documented |
---|
Return to Unit Reference