Difference between revisions of "Unit RAW"

From Ultibo.org
Jump to: navigation, search
Line 81: Line 81:
  
  
'''RAW protocol transport'''
+
'''Raw 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>TRAWProtocolTransport = class(TProtocolTransport)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
| [[TRAWProtocolTransport|<code>TRAWProtocolTransport = class(TProtocolTransport)</code>]]
|-
+
|colspan="2"|&nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
|colspan="2"|&nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''RAW protocol'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TRAWProtocol = class(TNetworkProtocol)</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>
+
| [[TRAWProtocol|<code>TRAWProtocol = class(TNetworkProtocol)</code>]]
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>function PacketHandler(AHandle:THandle; ASource,ADest,APacket:Pointer; ASize:Integer; ABroadcast:Boolean):Boolean;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>function SelectCheck(ASource,ADest:PFDSet; ACode:Integer):Integer; override;</code>
+
| &nbsp;
+
|-
+
| <code>function SelectWait(ASocket:TProtocolSocket; ACode:Integer; ATimeout:LongWord):Integer; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function SendPacket(ASocket:TProtocolSocket; ASource,ADest:Pointer; ASourcePort,ADestPort:Word; APacket:PPacketFragment; ASize,AFlags:Integer):Integer; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>function Accept(ASocket:TProtocolSocket; ASockAddr:PSockAddr; AAddrLength:PInteger):TProtocolSocket; override;</code>
+
| &nbsp;
+
|-
+
| <code>function Bind(ASocket:TProtocolSocket; var ASockAddr:TSockAddr; AAddrLength:Integer):Integer; override;</code>
+
| &nbsp;
+
|-
+
| <code>function CloseSocket(ASocket:TProtocolSocket):Integer; override;</code>
+
| &nbsp;
+
|-
+
| <code>function Connect(ASocket:TProtocolSocket; var ASockAddr:TSockAddr; AAddrLength:Integer):Integer; override;</code>
+
| &nbsp;
+
|-
+
| <code>function IoctlSocket(ASocket:TProtocolSocket; ACmd:DWORD; var AArg:u_long):Integer; override;</code>
+
| &nbsp;
+
|-
+
| <code>function GetPeerName(ASocket:TProtocolSocket; var ASockAddr:TSockAddr; var AAddrLength:Integer):Integer; override;</code>
+
| &nbsp;
+
|-
+
| <code>function GetSockName(ASocket:TProtocolSocket; var ASockAddr:TSockAddr; var AAddrLength:Integer):Integer; override;</code>
+
| &nbsp;
+
|-
+
| <code>function GetSockOpt(ASocket:TProtocolSocket; ALevel,AOptName:Integer; AOptValue:PChar; var AOptLength:Integer):Integer; override;</code>
+
| &nbsp;
+
|-
+
| <code>function Listen(ASocket:TProtocolSocket; ABacklog:Integer):Integer; override;</code>
+
| &nbsp;
+
|-
+
| <code>function Recv(ASocket:TProtocolSocket; var ABuffer; ALength,AFlags:Integer):Integer; override;</code>
+
| &nbsp;
+
|-
+
| <code>function RecvFrom(ASocket:TProtocolSocket; var ABuffer; ALength,AFlags:Integer; var AFromAddr:TSockAddr; var AFromLength:Integer):Integer; override;</code>
+
| &nbsp;
+
|-
+
| <code>function Select(ANfds:Integer; AReadfds,AWritefds,AExceptfds:PFDSet; ATimeout:PTimeVal):LongInt; override;</code>
+
| &nbsp;
+
|-
+
| <code>function Send(ASocket:TProtocolSocket; var ABuffer; ALength,AFlags:Integer):Integer; override;</code>
+
| &nbsp;
+
|-
+
| <code>function SendTo(ASocket:TProtocolSocket; var ABuffer; ALength,AFlags:Integer; var AToAddr:TSockAddr; AToLength:Integer):Integer; override;</code>
+
| &nbsp;
+
|-
+
| <code>function SetSockOpt(ASocket:TProtocolSocket; ALevel,AOptName:Integer; AOptValue:PChar; AOptLength:Integer):Integer; override;</code>
+
| &nbsp;
+
|-
+
| <code>function Shutdown(ASocket:TProtocolSocket; AHow:Integer):Integer; override;</code>
+
| &nbsp;
+
|-
+
| <code>function Socket(AFamily,AStruct,AProtocol:Integer):TProtocolSocket; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function AddTransport(ATransport:TNetworkTransport):Boolean; override;</code>
+
| &nbsp;
+
|-
+
| <code>function RemoveTransport(ATransport:TNetworkTransport):Boolean; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function FindSocket(AFamily,AStruct,AProtocol:Word; ALocalAddress,ARemoteAddress:Pointer; ALocalPort,ARemotePort:Word; ABroadcast,AListen,ALock:Boolean; AState:LongWord):TProtocolSocket; override;</code>
+
| &nbsp;
+
|-
+
| <code>procedure FlushSockets(All:Boolean); override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function StartProtocol:Boolean; override;</code>
+
| &nbsp;
+
|-
+
| <code>function StopProtocol:Boolean; override;</code>
+
| &nbsp;
+
|-
+
| <code>function ProcessProtocol:Boolean; override;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''RAW socket'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TRAWSocket = class(TProtocolSocket)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
 
|-
 
|-
|colspan="2"|Note: SOCK_RAW
+
| [[TRAWSocket|<code>TRAWSocket = class(TProtocolSocket)</code>]]
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>constructor Create(AProtocol:TNetworkProtocol; ATransport:TNetworkTransport);</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FRecvData:TRAWBuffer;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>property RecvData:TRAWBuffer read FRecvData;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function IoCtl(ACommand:DWORD; var AArgument:u_long):Integer; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function IsConnected(ALocalAddress,ARemoteAddress:Pointer; ALocalPort,ARemotePort:Word; ABroadcast:Boolean):Boolean; override;</code>
+
| &nbsp;
+
|-
+
| <code>function IsListening(ALocalAddress,ARemoteAddress:Pointer; ALocalPort,ARemotePort:Word; ABroadcast:Boolean):Boolean; override;</code>
+
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
+
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 
+
'''RAW buffer'''
+
 
+
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
+
 
+
<code>TRAWBuffer = class(TSocketBuffer)</code>
+
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
+
{| class="wikitable" style="font-size: 14px; background: white;"
+
|-
+
| <code>constructor Create(ASocket:TTransportSocket);</code>
+
| style="width: 50%;"|&nbsp;
+
|-
+
| <code>destructor Destroy; override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''private'''</div>
+
|-
+
| <code>FOffset:Word;</code>
+
| Offset to RemoteAddress
+
|-
+
| <code>FLength:Word;</code>
+
| Length of RemoteAddress
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FRead:Pointer;</code>
+
| Pointer to Next Read from Buffer
+
|-
+
| <code>FWrite:Pointer;</code>
+
| Pointer to Next Write to Buffer
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FCount:LongWord;</code>
+
| Number of Packets in Buffer
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>FFirst:PRAWPacket;</code>
+
| Pointer to First Packet
+
|-
+
| <code>FLast:PRAWPacket;</code>
+
| Pointer to Last Packet
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function AddPacket(ASize:Integer):Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>function RemovePacket:Boolean;</code>
+
| &nbsp;
+
|-
+
| <code>procedure FlushPackets;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''protected'''</div>
+
|-
+
| <code>procedure SetSize(ASize:LongWord); override;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|<div style="font-family: monospace,courier;">'''public'''</div>
+
|-
+
| <code>function GetNext:Integer;</code>
+
| &nbsp;
+
|-
+
| <code>function GetCount:LongWord;</code>
+
| &nbsp;
+
|-
+
|colspan="2"|&nbsp;
+
|-
+
| <code>function ReadBuffer(var ABuffer; var ASize:Integer; ARemoteAddress:Pointer; AFlags:Integer):Boolean;</code>
+
| &nbsp;
+
 
|-
 
|-
| <code>function WriteBuffer(var ABuffer; ASize:Integer; ARemoteAddress:Pointer):Boolean;</code>
+
| [[TRAWBuffer|<code>TRAWBuffer = class(TSocketBuffer)</code>]]
| &nbsp;
+
 
|-
 
|-
 
|}
 
|}
</div></div>
 
 
<br />
 
<br />
  

Revision as of 06:19, 25 May 2018

Return to Unit Reference


Description


Ultibo Raw Socket Protocol unit

To be documented

Constants



Raw specific constants RAW_*
Note: Some RAW definitions are in the Protocol or IP modules
 
IP_PROTOCOL_NAME = 'IP';  
RAW_PROTOCOL_NAME = 'RAW';  
 
RAW_TIMEOUT = 0; Wait forever on a RAW Read
RAW_BUFFER_SIZE = 65536; RAW Receive Buffer Size
 
RAW_HEADER_SIZE = 0; No Header for RAW
 
RAW_PACKET_SIZE = 8; SizeOf(TRAWPacket)


Type definitions



Raw packet

PRAWPacket = ^TRAWPacket;

TRAWPacket = record

Note: Some RAW definitions are in the Protocol or IP modules
Note: 8 Bytes (Used by RAWBuffer)
Size:LongWord; LongWord to keep size even
Next:PRAWPacket; Followed by RemoteAddress (4 or 16 Bytes)


Class definitions



Raw specific classes

TRAWProtocolTransport = class(TProtocolTransport)
TRAWProtocol = class(TNetworkProtocol)
TRAWSocket = class(TProtocolSocket)
TRAWBuffer = class(TSocketBuffer)


Public variables


None defined

Function declarations



Initialization functions

procedure RAWInit;
Description: To be documented
Note None documented


Return to Unit Reference