Difference between revisions of "Unit UDP"

From Ultibo.org
Jump to: navigation, search
 
(10 intermediate revisions by the same user not shown)
Line 6: Line 6:
  
 
'''Ultibo UDP (User Datagram Protocol) unit'''
 
'''Ultibo UDP (User Datagram Protocol) unit'''
 
''To be documented''
 
  
 
=== Constants ===
 
=== Constants ===
Line 60: Line 58:
 
<br />  
 
<br />  
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
<div style="font-size: 14px; padding-left: 12px;">'''UDP socket option constants'''</div>
+
<div style="font-size: 14px; padding-left: 12px;">'''UDP socket option'''</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;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
Line 70: Line 68:
 
<br />  
 
<br />  
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 20px; padding-bottom: 15px;">
<div style="font-size: 14px; padding-left: 12px;">'''UDP port constants''' <code> UDP_PORT_* </code></div>
+
<div style="font-size: 14px; padding-left: 12px;">'''UDP port''' <code> UDP_PORT_* </code></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;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
Line 87: Line 85:
 
----
 
----
  
''To be documented''
+
 
 +
'''UDP header'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PUDPHeader = ^TUDPHeader;</code>
 +
 
 +
<code>TUDPHeader = packed record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: Some UDP definitions are in the Protocol or IP modules
 +
|-
 +
|colspan="2"|Note: 8 Bytes
 +
|-
 +
| <code>SourcePort:Word;</code>
 +
| Network Order
 +
|-
 +
| <code>DestPort:Word;</code>
 +
| Network Order
 +
|-
 +
| <code>Length:Word;</code>
 +
| Network Order
 +
|-
 +
| <code>Checksum:Word;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div> 
 +
 
 +
'''UDP datagram''' 
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PUDPDatagram = ^TUDPDatagram;</code>
 +
 
 +
<code>TUDPDatagram = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|Note: 8 Bytes (Used by UDPBuffer)
 +
|-
 +
| <code>Size:Word;</code>
 +
| Word to keep size even
 +
|-
 +
| <code>RemotePort:Word;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Next:PUDPDatagram;</code>
 +
| Followed by RemoteAddress (4 or 16 Bytes)
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
 
 +
=== Class definitions ===
 +
----
 +
 
 +
 
 +
'''UDP specific classes'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| [[TUDPProtocolTransport|<code>TUDPProtocolTransport = class(TProtocolTransport)</code>]]
 +
|-
 +
|}
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| [[TUDPProtocol|<code>TUDPProtocol = class(TNetworkProtocol)</code>]]
 +
|-
 +
|}
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| [[TUDPSocket|<code>TUDPSocket = class(TProtocolSocket)</code>]]
 +
|-
 +
|}
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| [[TUDPState|<code>TUDPState = class(TProtocolState)</code>]]
 +
|-
 +
|}
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| [[TUDPBuffer|<code>TUDPBuffer = class(TSocketBuffer)</code>]]
 +
|-
 +
|}
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| [[TUDPOptions|<code>TUDPOptions = class(TProtocolOptions)</code>]]
 +
|-
 +
|}
 +
<br />
  
 
=== Public variables ===
 
=== Public variables ===
 
----
 
----
  
''To be documented''
+
''None defined''
  
 
=== Function declarations ===
 
=== Function declarations ===
Line 98: Line 185:
  
  
'''Initialization Functions'''
+
'''Initialization functions'''
  
 
<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;">
Line 106: Line 193:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 121: Line 208:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Buffer'''
+
! Buffer
 
| The complete packet including Transport header
 
| The complete packet including Transport header
 
|-
 
|-
! '''Note'''
+
! Note
| If checksum is zero then no checksum was added, return True
+
| If checksum is zero then no checksum was added, return True.
 
|-
 
|-
 
|}
 
|}
Line 136: Line 223:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Buffer'''
+
! Buffer
 
| The complete packet including Transport header
 
| The complete packet including Transport header
 
|-
 
|-
Line 148: Line 235:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Buffer'''
+
! Buffer
 
| The complete packet including Transport header
 
| The complete packet including Transport header
 
|-
 
|-
Line 160: Line 247:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Buffer'''
+
! Buffer
 
| The complete packet including Transport header
 
| The complete packet including Transport header
 
|-
 
|-
Line 172: Line 259:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Buffer'''
+
! Buffer
 
| The complete packet including Transport header
 
| The complete packet including Transport header
 
|-
 
|-
Line 184: Line 271:
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
|-
 
|-
! '''Note'''
+
! Note
 
| None documented
 
| None documented
 
|-
 
|-
Line 196: Line 283:
 
{| 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:33, 31 August 2021

Return to Unit Reference


Description


Ultibo UDP (User Datagram Protocol) unit

Constants



[Expand]
UDP specific constants UDP_*


[Expand]
UDP socket option


[Expand]
UDP port UDP_PORT_*


Type definitions



UDP header

[Expand]

PUDPHeader = ^TUDPHeader;

TUDPHeader = packed record

UDP datagram

[Expand]

PUDPDatagram = ^TUDPDatagram;

TUDPDatagram = record


Class definitions



UDP specific classes

TUDPProtocolTransport = class(TProtocolTransport)
TUDPProtocol = class(TNetworkProtocol)
TUDPSocket = class(TProtocolSocket)
TUDPState = class(TProtocolState)
TUDPBuffer = class(TSocketBuffer)
TUDPOptions = class(TProtocolOptions)


Public variables


None defined

Function declarations



Initialization functions

[Expand]
procedure UDPInit;
Description: To be documented


UDP functions

[Expand]
function CheckUDP(AFamily:Word; ABuffer:Pointer):Boolean;
Description: Verify that the packet is a valid UDP packet


[Expand]
function GetUDPHeaderOffset(AFamily:Word; ABuffer:Pointer):Word;
Description: To be documented


[Expand]
function GetUDPHeaderLength(AFamily:Word; ABuffer:Pointer):Word;
Description: To be documented


[Expand]
function GetUDPDataOffset(AFamily:Word; ABuffer:Pointer):Word;
Description: To be documented


[Expand]
function GetUDPDataLength(AFamily:Word; ABuffer:Pointer):Word;
Description: To be documented


[Expand]
function ChecksumUDPRecv(AFamily:Word; APseudo:PIPPseudo; ABuffer:Pointer; AOffset,ALength:Word):Word;
Description: Validate the Checksum of UDP Pseudo, Header and Data on Receive


[Expand]
function ChecksumUDPSend(AFamily:Word; APseudo:PIPPseudo; AHeader:PUDPHeader; AData:Pointer; ALength:Word):Word;
Description: Checksum the UDP Pseudo, Header and Data on Send


Return to Unit Reference