Difference between revisions of "TNetworkProtocol"

From Ultibo.org
Jump to: navigation, search
(Created page with "Return to Unit Protocol __TOC__ === Description === ---- ''To be documented'' === Class definitions === ---- <div class="toccolours mw-collapsible mw-...")
 
 
Line 305: Line 305:
  
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
<pre style="border: 0; padding-bottom:0px;">function</pre>
+
<pre style="border: 0; padding-bottom:0px;">constructor TNetworkProtocol.Create(AManager:TProtocolManager; const AName:String);</pre>
 
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' To be documented</div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">

Latest revision as of 04:46, 25 May 2018

Return to Unit Protocol


Description


To be documented

Class definitions



TNetworkProtocol = class(TListObject)

constructor Create(AManager:TProtocolManager; const AName:String);  
destructor Destroy; override;  
private
FLock:TSynchronizerHandle;  
FLocalLock:TMutexHandle;  
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 GetName:String;  
 
function AcquireLock:Boolean;  
function ReleaseLock:Boolean;  
 
function OpenPort(ASocket:TProtocolSocket; APort:Word):Boolean; virtual;  
function ClosePort(ASocket:TProtocolSocket):Boolean; virtual;  
function FindPort(APort:Word; AWrite,ALock:Boolean):TProtocolPort; virtual;  
 
function SelectGet(AReadfds,AWritefds,AExceptfds:PFDSet; var ACode:Integer):TProtocolSocket; virtual;  
 
function SelectStart(ASource,ADest:PFDSet):Boolean; virtual;  
function SelectCheck(ASource,ADest:PFDSet;ACode:Integer):Integer; virtual;  
function SelectWait(ASocket:TProtocolSocket; ACode:Integer; ATimeout:LongWord):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 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 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 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;  
 
function ScheduleSocketItem(ASocket:TProtocolSocket; AItem:PSocketTimerItem; ATimeout:LongWord):Boolean; virtual;  
function UnscheduleSocketItem(ASocket:TProtocolSocket; AItem:PSocketTimerItem):Boolean; virtual;  


Function declarations



constructor TNetworkProtocol.Create(AManager:TProtocolManager; const AName:String);
Description: To be documented
Note None documented


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


function TNetworkProtocol.GetName:String;
Description: To be documented
Note None documented


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


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


function TNetworkProtocol.OpenPort(ASocket:TProtocolSocket; APort:Word):Boolean;
Description: To be documented
Note None documented


function TNetworkProtocol.ClosePort(ASocket:TProtocolSocket):Boolean;
Description: To be documented
Note None documented


function TNetworkProtocol.FindPort(APort:Word; AWrite,ALock:Boolean):TProtocolPort;
Description: To be documented
Note None documented


function TNetworkProtocol.SelectGet(AReadfds,AWritefds,AExceptfds:PFDSet; var ACode:Integer):TProtocolSocket;
Description: Determine if select was called with a single socket to be checked
Note Readfds, Writefds and Exceptfds are the working sets to check


function TNetworkProtocol.SelectStart(ASource,ADest:PFDSet):Boolean;
Description: To be documented
Source Source is the set passed to Select
Dest Dest is the working set to check


function TNetworkProtocol.SelectCheck(ASource,ADest:PFDSet; ACode:Integer):Integer;
Description: To be documented
Source Source is the working set to check
Dest Dest is the set passed to Select


function TNetworkProtocol.SelectWait(ASocket:TProtocolSocket; ACode:Integer; ATimeout:LongWord):Integer;
Description: To be documented
Socket Socket is the single socket to check
Code Code is the type of check
Timeout Timeout is how long to wait


function TNetworkProtocol.SendPacket(ASocket:TProtocolSocket; ASource,ADest:Pointer; ASourcePort,ADestPort:Word; APacket:PPacketFragment; ASize,AFlags:Integer):Integer;
Description: To be documented
Note None documented


function TNetworkProtocol.Accept(ASocket:TProtocolSocket; ASockAddr:PSockAddr; AAddrLength:PInteger):TProtocolSocket;
Description: To be documented
Note None documented


function TNetworkProtocol.Bind(ASocket:TProtocolSocket; var ASockAddr:TSockAddr; AAddrLength:Integer):Integer;
Description: To be documented
Note None documented


function TNetworkProtocol.CloseSocket(ASocket:TProtocolSocket):Integer;
Description: To be documented
Note None documented


function TNetworkProtocol.Connect(ASocket:TProtocolSocket; var ASockAddr:TSockAddr; AAddrLength:Integer):Integer;
Description: To be documented
Note None documented


function TNetworkProtocol.IoctlSocket(ASocket:TProtocolSocket; ACmd:DWORD; var AArg:u_long):Integer;
Description: To be documented
Note None documented


function TNetworkProtocol.GetPeerName(ASocket:TProtocolSocket; var ASockAddr:TSockAddr; var AAddrLength:Integer):Integer;
Description: To be documented
Note None documented


function TNetworkProtocol.GetSockName(ASocket:TProtocolSocket; var ASockAddr:TSockAddr; var AAddrLength:Integer):Integer;
Description: To be documented
Note None documented


function TNetworkProtocol.GetSockOpt(ASocket:TProtocolSocket; ALevel,AOptName:Integer; AOptValue:PChar; var AOptLength:Integer):Integer;
Description: To be documented
Note None documented


function TNetworkProtocol.Listen(ASocket:TProtocolSocket; ABacklog:Integer):Integer;
Description: To be documented
Note None documented


function TNetworkProtocol.Recv(ASocket:TProtocolSocket; var ABuffer; ALength,AFlags:Integer):Integer;
Description: To be documented
Note None documented


function TNetworkProtocol.RecvFrom(ASocket:TProtocolSocket; var ABuffer; ALength,AFlags:Integer; var AFromAddr:TSockAddr; var AFromLength:Integer):Integer;
Description: To be documented
Note None documented


function TNetworkProtocol.Select(ANfds:Integer; AReadfds,AWritefds,AExceptfds:PFDSet; ATimeout:PTimeVal):LongInt;
Description: To be documented
Note None documented


function TNetworkProtocol.Send(ASocket:TProtocolSocket; var ABuffer; ALength,AFlags:Integer):Integer;
Description: To be documented
Note None documented


function TNetworkProtocol.SendTo(ASocket:TProtocolSocket; var ABuffer; ALength,AFlags:Integer; var AToAddr:TSockAddr; AToLength:Integer):Integer;
Description: To be documented
Note None documented


function TNetworkProtocol.SetSockOpt(ASocket:TProtocolSocket; ALevel,AOptName:Integer; AOptValue:PChar; AOptLength:Integer):Integer;
Description: To be documented
Note None documented


function TNetworkProtocol.Shutdown(ASocket:TProtocolSocket; AHow:Integer):Integer;
Description: To be documented
Note None documented


function TNetworkProtocol.Socket(AFamily,AStruct,AProtocol:Integer):TProtocolSocket;
Description: To be documented
Note None documented


function TNetworkProtocol.ReaderLock:Boolean;
Description: To be documented
Note None documented


function TNetworkProtocol.ReaderUnlock:Boolean;
Description: To be documented
Note None documented


function TNetworkProtocol.WriterLock:Boolean;
Description: To be documented
Note None documented


function TNetworkProtocol.WriterUnlock:Boolean;
Description: To be documented
Note None documented


function TNetworkProtocol.GetStatistics:TProtocolStatistics;
Description: To be documented
Note None documented


function TNetworkProtocol.GetTransportByHandle(AHandle:THandle; ALock:Boolean; AState:LongWord):TProtocolTransport;
Description: To be documented
Note None documented


function TNetworkProtocol.GetTransportByFamily(AFamily:Word; ALock:Boolean; AState:LongWord):TProtocolTransport;
Description: To be documented
Note None documented


function TNetworkProtocol.GetTransportByTransport(ATransport:TNetworkTransport; ALock:Boolean; AState:LongWord):TProtocolTransport;
Description: To be documented
Note None documented


function TNetworkProtocol.GetTransportByNext(APrevious:TProtocolTransport; ALock,AUnlock:Boolean; AState:LongWord):TProtocolTransport;
Description: To be documented
Note None documented


function TNetworkProtocol.AddTransport(ATransport:TNetworkTransport):Boolean;
Description: To be documented
Note None documented


function TNetworkProtocol.RemoveTransport(ATransport:TNetworkTransport):Boolean;
Description: To be documented
Note None documented


function TNetworkProtocol.GetSocketByNext(APrevious:TProtocolSocket; ALock,AUnlock:Boolean; AState:LongWord):TProtocolSocket;
Description: To be documented
Note None documented


function TNetworkProtocol.CheckSocket(ASocket:TProtocolSocket; ALock:Boolean; AState:LongWord):Boolean;
Description: To be documented
Note None documented


function TNetworkProtocol.FindSocket(AFamily,AStruct,AProtocol:Word; ALocalAddress,ARemoteAddress:Pointer; ALocalPort,ARemotePort:Word; ABroadcast,AListen,ALock:Boolean; AState:LongWord):TProtocolSocket;
Description: To be documented
Note None documented


procedure TNetworkProtocol.FlushSockets(All:Boolean);
Description: To be documented
Note None documented


function TNetworkProtocol.StartProtocol:Boolean;
Description: To be documented
Note None documented


function TNetworkProtocol.StopProtocol:Boolean;
Description: To be documented
Note None documented


function TNetworkProtocol.ProcessProtocol:Boolean;
Description: To be documented
Note None documented


function TNetworkProtocol.ProcessSockets:Boolean;
Description: To be documented
Note None documented


function TNetworkProtocol.ProcessSocket(ASocket:TProtocolSocket):Boolean;
Description: To be documented
Note None documented


function TNetworkProtocol.BindProtocol(ATransport:TNetworkTransport):Boolean;
Description: To be documented
Note None documented


function TNetworkProtocol.UnbindProtocol(ATransport:TNetworkTransport):Boolean;
Description: To be documented
Note None documented


function TNetworkProtocol.CheckTimer:Boolean;
Description: To be documented
Note None documented


function TNetworkProtocol.ProcessTimer:Boolean;
Description: To be documented
Note None documented


function TNetworkProtocol.SendSocket(ASocket:TProtocolSocket):Boolean;
Description: To be documented
Note None documented


function TNetworkProtocol.ScheduleSocket(ASocket:TProtocolSocket; ATimeout:LongWord):Boolean;
Description: To be documented
Note None documented


function TNetworkProtocol.UnscheduleSocket(ASocket:TProtocolSocket):Boolean;
Description: To be documented
Note None documented


function TNetworkProtocol.ScheduleSocketItem(ASocket:TProtocolSocket; AItem:PSocketTimerItem; ATimeout:LongWord):Boolean;
Description: To be documented
Note None documented


function TNetworkProtocol.UnscheduleSocketItem(ASocket:TProtocolSocket; AItem:PSocketTimerItem):Boolean;
Description: To be documented
Note None documented


Return to Unit Reference