Difference between revisions of "Unit UDP"
From Ultibo.org
| Line 87: | Line 87: | ||
---- | ---- | ||
| − | '' | + | |
| + | '''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> | ||
| + | | | ||
| + | |- | ||
| + | |} | ||
| + | </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> | ||
| + | | | ||
| + | |- | ||
| + | | <code>Next:PUDPDatagram;</code> | ||
| + | | Followed by RemoteAddress (4 or 16 Bytes) | ||
| + | |- | ||
| + | |} | ||
| + | </div></div> | ||
| + | <br /> | ||
=== Class definitions === | === Class definitions === | ||
Revision as of 03:34, 26 January 2017
Return to Unit Reference
Contents
Description
Ultibo UDP (User Datagram Protocol) unit
To be documented
Constants
UDP specific constants
UDP_* | Note: Some UDP definitions are in the Protocol or IP modules | |
UDP_PROTOCOL_NAME = 'UDP';
|
|
MIN_UDP_PACKET = 8;
|
Not Counting Adapter and Transport Header |
MAX_UDP_PACKET = 8192;
|
Not Counting Adapter and Transport Header |
UDP_TIMEOUT = 0;
|
Wait forever on a UDP Read |
UDP_BUFFER_SIZE = 65536;
|
UDP Receive Buffer Size |
UDP_MAX_PORT = 65536;
|
|
UDP_HEADER_SIZE = 8;
|
SizeOf(TUDPHeader); |
UDP_DATAGRAM_SIZE = 8;
|
SizeOf(TUDPDatagram) |
UDP socket option constants
| See Sockets.pas |
UDP port constants
UDP_PORT_* UDP_PORT_START = 49152;
|
First dynamic port (Previously 1024) As per IANA assignment |
UDP_PORT_STOP = 65534;
|
Last dynamic port (Previously 5000) Short of IANA assignment to allow for rollover |
Type definitions
UDP header
PUDPHeader = ^TUDPHeader;
TUDPHeader = packed record
| Note: Some UDP definitions are in the Protocol or IP modules | |
| Note: 8 Bytes | |
SourcePort:Word;
|
Network Order |
DestPort:Word;
|
Network Order |
Length:Word;
|
Network Order |
Checksum:Word;
|
|
UDP datagram
PUDPDatagram = ^TUDPDatagram;
TUDPDatagram = record
| Note: 8 Bytes (Used by UDPBuffer) | |
Size:Word;
|
Word to keep size even |
RemotePort:Word;
|
|
Next:PUDPDatagram;
|
Followed by RemoteAddress (4 or 16 Bytes) |
Class definitions
To be documented
Public variables
None defined
Function declarations
Initialization Functions
procedure UDPInit;
Description: To be documented
| Note | None documented |
|---|
UDP functions
function CheckUDP(AFamily:Word; ABuffer:Pointer):Boolean;
Description: Verify that the packet is a valid UDP packet
| Buffer | The complete packet including Transport header |
|---|---|
| Note | If checksum is zero then no checksum was added, return True |
function GetUDPHeaderOffset(AFamily:Word; ABuffer:Pointer):Word;
Description: To be documented
| Buffer | The complete packet including Transport header |
|---|
function GetUDPHeaderLength(AFamily:Word; ABuffer:Pointer):Word;
Description: To be documented
| Buffer | The complete packet including Transport header |
|---|
function GetUDPDataOffset(AFamily:Word; ABuffer:Pointer):Word;
Description: To be documented
| Buffer | The complete packet including Transport header |
|---|
function GetUDPDataLength(AFamily:Word; ABuffer:Pointer):Word;
Description: To be documented
| Buffer | The complete packet including Transport header |
|---|
function ChecksumUDPRecv(AFamily:Word; APseudo:PIPPseudo; ABuffer:Pointer; AOffset,ALength:Word):Word;
Description: Validate the Checksum of UDP Pseudo, Header and Data on Receive
| Note | None documented |
|---|
function ChecksumUDPSend(AFamily:Word; APseudo:PIPPseudo; AHeader:PUDPHeader; AData:Pointer; ALength:Word):Word;
Description: Checksum the UDP Pseudo, Header and Data on Send
| Note | None documented |
|---|
Return to Unit Reference