Difference between revisions of "Unit Network"

From Ultibo.org
Jump to: navigation, search
Line 735: Line 735:
 
----
 
----
  
''To be documented''
+
 
 +
'''Hardware address'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PHardwareAddress = ^THardwareAddress;</code>
 +
 
 +
<code>THardwareAddress = array[0..HARDWARE_ADDRESS_SIZE - 1] of Byte;</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| &nbsp;
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''Hardware addresses'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PHardwareAddresses = ^THardwareAddresses;</code>
 +
 
 +
<code>THardwareAddresses = array[0..0] of THardwareAddress;</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| &nbsp;
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''Multicast addresses'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PMulticastAddresses = ^TMulticastAddresses;</code>
 +
 
 +
<code>TMulticastAddresses = array[0..MAX_MULTICAST_ADDRESS - 1] of THardwareAddress;</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| &nbsp;
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''Network packet'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PNetworkPacket = ^TNetworkPacket;</code>
 +
 
 +
<code>TNetworkPacket = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>Buffer:Pointer;</code>
 +
| Pointer to buffer (Set by driver that owns this packet)
 +
|-
 +
| <code>Data:Pointer;</code>
 +
| Start of data within buffer (Set by driver that owns this packet)
 +
|-
 +
| <code>Length:LongInt;</code>
 +
| Length of packet data (Set by driver on Receive / Set by caller on Transmit, contains maximum length on Allocate)
 +
|-
 +
| <code>Flags:LongWord;</code>
 +
| Packet specific flags (eg Error, Broadcast etc) (Dependent on network type)
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''Network Buffer'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PNetworkBuffer = ^TNetworkBuffer;</code>
 +
 
 +
<code>TNetworkBuffer = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>Wait:TSemaphoreHandle;</code>
 +
| Packet ready semaphore
 +
|-
 +
| <code>Start:LongWord;</code>
 +
| Index of first packet ready
 +
|-
 +
| <code>Count:LongWord;</code>
 +
| Number of packets ready in buffer
 +
|-
 +
| <code>Packets:array[0..(NETWORK_BUFFER_SIZE - 1)] of PNetworkPacket;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
 +
'''Network entry'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PNetworkEntry = ^TNetworkEntry;</code>
 +
 
 +
<code>TNetworkEntry = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>Buffer:Pointer;</code>
 +
| Pointer to buffer (Allocated by driver that owns this entry)
 +
|-
 +
| <code>Size:LongWord;</code>
 +
| Size of the buffer (Total size, usable size is Size minus Offset)
 +
|-
 +
| <code>Offset:LongWord;</code>
 +
| Offset to start of data (Data for first packet will be at Buffer plus Offset, must be less than size)
 +
|-
 +
| <code>Count:LongWord;</code>
 +
| Number of packets in the entry (Set by driver that owns this entry, must be at least one)
 +
|-
 +
| <code>DriverData:Pointer;</code>
 +
| Driver private data (Managed by driver that owns this entry)
 +
|-
 +
| <code>Packets:array of TNetworkPacket; {Array of 0 to Count - 1 packets in this entry</code>
 +
| Allocated by driver that owns this entry, must be at least one)
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''Network queue'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PNetworkQueue = ^TNetworkQueue;</code>
 +
 
 +
<code>TNetworkQueue = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>Buffer:TBufferHandle;</code>
 +
| Handle for entry buffers
 +
|-
 +
| <code>Wait:TSemaphoreHandle;</code>
 +
| Entry ready semaphore
 +
|-
 +
| <code>Start:LongWord;</code>
 +
| Index of first entry ready
 +
|-
 +
| <code>Count:LongWord;</code>
 +
| Number of entries ready in queue
 +
|-
 +
| <code>Flags:LongWord;</code>
 +
| Queue specific flags (eg Paused, Halted etc) (Managed by driver)
 +
|-
 +
| <code>Entries:array of PNetworkEntry;</code>
 +
| Array of 0 to Total - 1 entries in this queue (Allocated by driver that owns this queue)
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''Network enumeration callback'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TNetworkEnumerate = function(Network:PNetworkDevice; Data:Pointer):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''Network notification callback'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TNetworkNotification = function(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''Network device open'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TNetworkDeviceOpen = function(Network:PNetworkDevice):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''Network device close'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TNetworkDeviceClose = function(Network:PNetworkDevice):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''Network device read'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TNetworkDeviceRead = function(Network:PNetworkDevice; Buffer:Pointer; Size:LongWord; var Length:LongWord):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''Network device write'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TNetworkDeviceWrite = function(Network:PNetworkDevice; Buffer:Pointer; Size:LongWord; var Length:LongWord):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''Network device control'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TNetworkDeviceControl = function(Network:PNetworkDevice; Request:Integer; Argument1:PtrUInt; var Argument2:PtrUInt):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''Network buffer allocate'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TNetworkBufferAllocate = function(Network:PNetworkDevice; var Entry:PNetworkEntry):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''Network buffer release'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TNetworkBufferRelease = function(Network:PNetworkDevice; Entry:PNetworkEntry):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''Network buffer receive'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TNetworkBufferReceive = function(Network:PNetworkDevice; var Entry:PNetworkEntry):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''Network buffer transmit'''
 +
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TNetworkBufferTransmit = function(Network:PNetworkDevice; Entry:PNetworkEntry):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 +
'''Network device types'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PNetworkDevice = ^TNetworkDevice;</code>
 +
 
 +
<code>TNetworkDevice = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|''Device Properties''
 +
|-
 +
| <code>Device:TDevice;</code>
 +
| The Device entry for this Network
 +
|-
 +
|colspan="2"|''Network Properties''
 +
|-
 +
| <code>NetworkId:LongWord;</code>
 +
| Unique Id of this Network in the Network table
 +
|-
 +
| <code>NetworkState:LongWord;</code>
 +
| Network state (eg NETWORK_STATE_OPEN)
 +
|-
 +
| <code>NetworkStatus:LongWord;</code>
 +
| Network status (eg NETWORK_STATUS_UP)
 +
|-
 +
| <code>DeviceOpen:TNetworkDeviceOpen;</code>
 +
| A Device specific DeviceOpen method implementing a standard Network device interface
 +
|-
 +
| <code>DeviceClose:TNetworkDeviceClose;</code>
 +
| A Device specific DeviceClose method implementing a standard Network device interface
 +
|-
 +
| <code>DeviceRead:TNetworkDeviceRead;</code>
 +
| A Device specific DeviceRead method implementing a standard Network device interface
 +
|-
 +
| <code>DeviceWrite:TNetworkDeviceWrite;</code>
 +
| A Device specific DeviceWrite method implementing a standard Network device interface
 +
|-
 +
| <code>DeviceControl:TNetworkDeviceControl;</code>
 +
| A Device specific DeviceControl method implementing a standard Network device interface
 +
|-
 +
| <code>BufferAllocate:TNetworkBufferAllocate;</code>
 +
| A Device specific BufferAllocate method implementing a standard Network device interface
 +
|-
 +
| <code>BufferRelease:TNetworkBufferRelease;</code>
 +
| A Device specific BufferRelease method implementing a standard Network device interface
 +
|-
 +
| <code>BufferReceive:TNetworkBufferReceive;</code>
 +
| A Device specific BufferReceive method implementing a standard Network device interface
 +
|-
 +
| <code>BufferTransmit:TNetworkBufferTransmit;</code>
 +
| A Device specific BufferTransmit method implementing a standard Network device interface
 +
|-
 +
|colspan="2"|''Driver Properties''
 +
|-
 +
| <code>Lock:TMutexHandle;</code>
 +
| Network lock
 +
|-
 +
| <code>Buffer:TNetworkBuffer;</code>
 +
| Network receive buffer
 +
|-
 +
| <code>TransmitWait:TSemaphoreHandle;</code>
 +
| Transmit complete semaphore
 +
|-
 +
| <code>ReceiveBuffer:TBufferHandle;</code>
 +
| Buffer for receive packets
 +
|-
 +
| <code>TransmitBuffer:TBufferHandle;</code>
 +
| Buffer for transmit packets
 +
|-
 +
|colspan="2"|&nbsp;
 +
|-
 +
| <code>ReceiveQueue:TNetworkQueue;</code>
 +
| Queue for receive packets
 +
|-
 +
| <code>TransmitQueue:TNetworkQueue;</code>
 +
| Queue for transmit packets (If applicable)
 +
|-
 +
|colspan="2"|''Statistics Properties''
 +
|-
 +
| <code>ReceiveCount:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
| <code>ReceiveErrors:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
| <code>TransmitCount:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
| <code>TransmitErrors:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
| <code>BufferOverruns:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
| <code>BufferUnavailable:LongWord;</code>
 +
| &nbsp;
 +
|-
 +
|colspan="2"|''Internal Properties''
 +
|-
 +
| <code>Prev:PNetworkDevice;</code>
 +
| Previous entry in Network table
 +
|-
 +
| <code>Next:PNetworkDevice;</code>
 +
| Next entry in Network table
 +
|-
 +
|}
 +
</div></div> 
 +
 +
'''Network event callback'''
 +
 
 +
{| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;"
 +
|-
 +
| <code>TNetworkEventCallback = function(Data:Pointer; Event:LongWord):LongWord;</code>
 +
| style="width: 40%;"|
 +
|-
 +
|}
 +
 
 +
'''Network Event'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PNetworkEvent = ^TNetworkEvent;</code>
 +
 
 +
<code>TNetworkEvent = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
|colspan="2"|''Event Properties''
 +
|-
 +
| <code>Signature:LongWord;</code>
 +
| Signature for entry validation
 +
|-
 +
| <code>EventState:LongWord;</code>
 +
| Event state (eg Registered/Unregistered)
 +
|-
 +
| <code>EventFlags:LongWord;</code>
 +
| Event flags (eg NETWORK_EVENT_FLAG_NONE)
 +
|-
 +
| <code>Callback:TNetworkEventCallback;</code>
 +
| The callback for network events
 +
|-
 +
| <code>Data:Pointer;</code>
 +
| A pointer to callback specific data to be passed with events (Optional)
 +
|-
 +
| <code>Event:LongWord;</code>
 +
| The mask of events to notify on (eg NETWORK_EVENT_SYSTEM_START etc)
 +
|-
 +
|colspan="2"|''Internal Properties''
 +
|-
 +
| <code>Prev:PNetworkEvent;</code>
 +
| Previous entry in Event table
 +
|-
 +
| <code>Next:PNetworkEvent;</code>
 +
| Next entry in Event table
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''Packet fragment'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PPacketFragment = ^TPacketFragment;</code>
 +
 
 +
<code>TPacketFragment = packed record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>Size:Integer;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>Data:Pointer;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Next:PPacketFragment;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''Ethernet 802.3 network'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PLLCHeader = ^TLLCHeader;</code>
 +
 
 +
<code>TLLCHeader = 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: FRAME_TYPE_ETHERNET_8022
 +
|-
 +
| <code>DSAP:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>SSAP:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Control:Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Information:array[0..0] of Byte;</code>
 +
| Optional (Control byte can be 1 or 2 octets)
 +
|-
 +
|}
 +
</div></div> 
 +
 
 +
'''Ethernet SNAP network'''
 +
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PSNAPHeader = ^TSNAPHeader;</code>
 +
 
 +
<code>TSNAPHeader = 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: FRAME_TYPE_ETHERNET_SNAP
 +
|-
 +
| <code>OUI:array[0..2] of Byte;</code>
 +
| &nbsp;
 +
|-
 +
| <code>ProtocolID:Word;</code>
 +
| &nbsp;
 +
|-
 +
| <code>Data:array[0..0] of Byte;</code>
 +
| Not part of header, included to provide a pointer to the start of data
 +
|-
 +
|}
 +
</div></div> 
 +
 
 +
'''Token ring network'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PTokenRingAddress = ^TTokenRingAddress;</code>
 +
 
 +
<code>TTokenRingAddress = array[0..5] of Byte;</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| &nbsp;
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''Token ring header'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PTokenRingHeader = ^TTokenRingHeader;</code>
 +
 
 +
<code>TTokenRingHeader = packed record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| &nbsp;
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''Adapter params'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PAdapterParams = ^TAdapterParams;</code>
 +
 
 +
<code>TAdapterParams = packed record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>Version:Word;</code>
 +
| Driver version
 +
|-
 +
| <code>FrameType:Byte;</code>
 +
| Driver class
 +
|-
 +
| <code>AdapterType:Word;</code>
 +
| Driver type
 +
|-
 +
| <code>Number:Byte;</code>
 +
| Driver number
 +
|-
 +
| <code>Name:PChar;</code>
 +
| Driver name
 +
|-
 +
| <code>Functionality:Byte;</code>
 +
| How good is this driver
 +
|-
 +
|}
 +
</div></div> 
 +
 
 +
'''Network params'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PNetworkParams = ^TNetworkParams;</code>
 +
 
 +
<code>TNetworkParams = packed record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>MajorRevision:Byte;</code>
 +
| Major revision ID of packet specs
 +
|-
 +
| <code>MinorRevision:Byte;</code>
 +
| Minor revision ID of packet specs
 +
|-
 +
| <code>ParamLength:Byte;</code>
 +
| Length of structure in Bytes
 +
|-
 +
| <code>AddressLength:Byte;</code>
 +
| Length of a MAC address
 +
|-
 +
| <code>MTU:Word;</code>
 +
| MTU, including MAC headers
 +
|-
 +
| <code>MulticastAvailable:Word;</code>
 +
| buffer size for multicast addr.
 +
|-
 +
| <code>RxBuffers:Word;</code>
 +
| No of back-to-back MTU rcvs) - 1
 +
|-
 +
| <code>TxBuffers:Word;</code>
 +
| No of successive xmits) - 1
 +
|-
 +
| <code>IntNo:Word;</code>
 +
| Interrupt No to hook for post-EOI processing, 0 = none
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''Adapter statistics'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PAdapterStatistics = ^TAdapterStatistics;</code>
 +
 
 +
<code>TAdapterStatistics = record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>PacketsIn:Int64;</code>
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
| <code>PacketsOut:Int64;</code>
 +
| &nbsp;
 +
|-
 +
| <code>BytesIn:Int64;</code>
 +
| &nbsp;
 +
|-
 +
| <code>BytesOut:Int64;</code>
 +
| &nbsp;
 +
|-
 +
| <code>ErrorsIn:Int64;</code>
 +
| &nbsp;
 +
|-
 +
| <code>ErrorsOut:Int64;</code>
 +
| &nbsp;
 +
|-
 +
| <code>PacketsLost:Int64;</code>
 +
| &nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''Ethernet address'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PEthernetAddress = ^TEthernetAddress;</code>
 +
 
 +
<code>TEthernetAddress = array[0..ETHERNET_ADDRESS_SIZE - 1] of Byte;</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| &nbsp;
 +
| style="width: 50%;"|&nbsp;
 +
|-
 +
|}
 +
</div></div>
 +
 
 +
'''Ethernet header'''
 +
 
 +
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;">
 +
<code>PEthernetHeader = ^TEthernetHeader;</code>
 +
 
 +
<code>TEthernetHeader = packed record</code>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
| <code>DestAddress:THardwareAddress;</code>
 +
| &nbsp;
 +
|-
 +
| <code>SourceAddress:THardwareAddress;</code>
 +
| &nbsp;
 +
|-
 +
| <code>TypeLength:Word;</code>
 +
| Length or Type (IEEE 802.3 or BlueBook/DIX Ethernet)
 +
|-
 +
| <code>Data:array[0..0] of Byte;</code>
 +
| Not part of header, included to provide a pointer to the start of data
 +
|-
 +
|}
 +
</div></div>
 +
<br />
  
 
=== Class definitions ===
 
=== Class definitions ===

Revision as of 04:00, 22 January 2017

Return to Unit Reference


Description


Ultibo Network interface unit

To be documented

Constants



[Expand]
Network specific constants NETWORK_*


[Expand]
Network device type constants NETWORK_TYPE_*


[Expand]
Network device state constants NETWORK_STATE_*


[Expand]
Network device status constants NETWORK_STATUS_*


[Expand]
Network device flag constants NETWORK_FLAG_*


[Expand]
Network device control code constants NETWORK_CONTROL_*


[Expand]
Network lock state constants NETWORK_LOCK_*


[Expand]
Network buffer size constants NETWORK_BUFFER_*


[Expand]
Network event constants NETWORK_EVENT_*


[Expand]
Network event signature constants NETWORK_EVENT_SIGNATURE*


[Expand]
Network event state constants NETWORK_EVENT_STATE_*


[Expand]
Network event flag constants NETWORK_EVENT_FLAG_*


[Expand]
Adapter type constants ADAPTER_TYPE_*


[Expand]
Adapter thread constants ADAPTER_THREAD_*


[Expand]
Adapter state constants ADAPTER_STATE_*


[Expand]
Adapter status constants ADAPTER_STATUS_*


[Expand]
Configuration type constants CONFIG_TYPE_*


[Expand]
Authentication type constants AUTH_TYPE_*


[Expand]
Frame type constants FRAME_TYPE_*


[Expand]
Configuration command constants CONFIG_*


[Expand]
Authentication command constants AUTH_COMMAND_*


[Expand]
Multicast addressing constants MAX_MULTICAST_*


[Expand]
Hardware addressing constants HARDWARE_ADDRESS_*


[Expand]
Media type constants MEDIA_TYPE_*


[Expand]
Packet type constants PACKET_TYPE_*


[Expand]
Ethernet network constants *_ETHERNET_PACKET


[Expand]
Ethernet 802.3 network constants LLC_HEADER_*


[Expand]
Ethernet SNAP network constants SNAP_HEADER_*


[Expand]
Service set constants SERVICE_SET_*


[Expand]
Network logging constants NETWORK_LOG_*


[Expand]
Ethernet specific constants ETHERNET_*


[Expand]
Ethernet specific size constants ETHERNET_*_SIZE*


[Expand]
Network specific constants


[Expand]
Ethernet specific constants


Type definitions



Hardware address

[Expand]

PHardwareAddress = ^THardwareAddress;

THardwareAddress = array[0..HARDWARE_ADDRESS_SIZE - 1] of Byte;

Hardware addresses

[Expand]

PHardwareAddresses = ^THardwareAddresses;

THardwareAddresses = array[0..0] of THardwareAddress;

Multicast addresses

[Expand]

PMulticastAddresses = ^TMulticastAddresses;

TMulticastAddresses = array[0..MAX_MULTICAST_ADDRESS - 1] of THardwareAddress;

Network packet

[Expand]

PNetworkPacket = ^TNetworkPacket;

TNetworkPacket = record

Network Buffer

[Expand]

PNetworkBuffer = ^TNetworkBuffer;

TNetworkBuffer = record

Network entry

[Expand]

PNetworkEntry = ^TNetworkEntry;

TNetworkEntry = record

Network queue

[Expand]

PNetworkQueue = ^TNetworkQueue;

TNetworkQueue = record

Network enumeration callback

TNetworkEnumerate = function(Network:PNetworkDevice; Data:Pointer):LongWord;

Network notification callback

TNetworkNotification = function(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;

Network device open

TNetworkDeviceOpen = function(Network:PNetworkDevice):LongWord;

Network device close

TNetworkDeviceClose = function(Network:PNetworkDevice):LongWord;

Network device read

TNetworkDeviceRead = function(Network:PNetworkDevice; Buffer:Pointer; Size:LongWord; var Length:LongWord):LongWord;

Network device write

TNetworkDeviceWrite = function(Network:PNetworkDevice; Buffer:Pointer; Size:LongWord; var Length:LongWord):LongWord;

Network device control

TNetworkDeviceControl = function(Network:PNetworkDevice; Request:Integer; Argument1:PtrUInt; var Argument2:PtrUInt):LongWord;

Network buffer allocate

TNetworkBufferAllocate = function(Network:PNetworkDevice; var Entry:PNetworkEntry):LongWord;

Network buffer release

TNetworkBufferRelease = function(Network:PNetworkDevice; Entry:PNetworkEntry):LongWord;

Network buffer receive

TNetworkBufferReceive = function(Network:PNetworkDevice; var Entry:PNetworkEntry):LongWord;

Network buffer transmit

TNetworkBufferTransmit = function(Network:PNetworkDevice; Entry:PNetworkEntry):LongWord;

Network device types

[Expand]

PNetworkDevice = ^TNetworkDevice;

TNetworkDevice = record

Network event callback

TNetworkEventCallback = function(Data:Pointer; Event:LongWord):LongWord;

Network Event

[Expand]

PNetworkEvent = ^TNetworkEvent;

TNetworkEvent = record

Packet fragment

[Expand]

PPacketFragment = ^TPacketFragment;

TPacketFragment = packed record

Ethernet 802.3 network

[Expand]

PLLCHeader = ^TLLCHeader;

TLLCHeader = packed record

Ethernet SNAP network

[Expand]

PSNAPHeader = ^TSNAPHeader;

TSNAPHeader = packed record

Token ring network

[Expand]

PTokenRingAddress = ^TTokenRingAddress;

TTokenRingAddress = array[0..5] of Byte;

Token ring header

[Expand]

PTokenRingHeader = ^TTokenRingHeader;

TTokenRingHeader = packed record

Adapter params

[Expand]

PAdapterParams = ^TAdapterParams;

TAdapterParams = packed record

Network params

[Expand]

PNetworkParams = ^TNetworkParams;

TNetworkParams = packed record

Adapter statistics

[Expand]

PAdapterStatistics = ^TAdapterStatistics;

TAdapterStatistics = record

Ethernet address

[Expand]

PEthernetAddress = ^TEthernetAddress;

TEthernetAddress = array[0..ETHERNET_ADDRESS_SIZE - 1] of Byte;

Ethernet header

[Expand]

PEthernetHeader = ^TEthernetHeader;

TEthernetHeader = packed record


Class definitions


To be documented

Public variables



Network logging

NETWORK_DEFAULT_LOG_LEVEL:LongWord = NETWORK_LOG_LEVEL_DEBUG; Minimum level for Network messages. Only messages with level greater than or equal to this will be printed.
NETWORK_LOG_ENABLED:Boolean;


Function declarations


Initialization functions

[Expand]
procedure NetworkInit;
Description: To be documented


[Expand]
function NetworkStart:LongWord;
Description: To be documented


[Expand]
function NetworkStop:LongWord;
Description: To be documented


[Expand]
function NetworkStartCompleted:Boolean;
Description: To be documented


Network functions

[Expand]
function NetworkDeviceOpen(Network:PNetworkDevice):LongWord;
Description: To be documented


[Expand]
function NetworkDeviceClose(Network:PNetworkDevice):LongWord;
Description: To be documented


[Expand]
function NetworkDeviceRead(Network:PNetworkDevice; Buffer:Pointer; Size:LongWord; var Length:LongWord):LongWord;
Description: To be documented


[Expand]
function NetworkDeviceWrite(Network:PNetworkDevice; Buffer:Pointer; Size:LongWord; var Length:LongWord):LongWord;
Description: To be documented


[Expand]
function NetworkDeviceControl(Network:PNetworkDevice; Request:Integer; Argument1:PtrUInt; var Argument2:PtrUInt):LongWord;
Description: To be documented


[Expand]
function NetworkBufferAllocate(Network:PNetworkDevice; var Entry:PNetworkEntry):LongWord;
Description: Allocate a transmit buffer from the specified network device, the returned entry will include a buffer for writing data to as well as an offfset value to allow the driver data to be written to the start of the buffer. When the data has been copied to the buffer, pass the entry to NetworkBufferTransmit.


[Expand]
function NetworkBufferRelease(Network:PNetworkDevice; Entry:PNetworkEntry):LongWord;
Description: Release a receive buffer to the specified network device, the entry must have been returned from NetworkBufferReceive


[Expand]
function NetworkBufferReceive(Network:PNetworkDevice; var Entry:PNetworkEntry):LongWord;
Description: Receive a completed receive buffer from the specified network device. The returned entry will contain a one or more packets of data to read from. When the data has been processed pass the returned buffer to NetworkBufferRelease.


[Expand]
function NetworkBufferTransmit(Network:PNetworkDevice; Entry:PNetworkEntry):LongWord;
Description: Transmit a completed transmit buffer to the specified network device. The entry must have been allocated using NetworkBufferAllocate.


[Expand]
function NetworkDeviceSetState(Network:PNetworkDevice; State:LongWord):LongWord;
Description: Set the state of the specified network and send a notification


[Expand]
function NetworkDeviceSetStatus(Network:PNetworkDevice; Status:LongWord):LongWord;
Description: Set the status of the specified network and send a notification


[Expand]
function NetworkDeviceCreate:PNetworkDevice;
Description: Create a new Network entry


[Expand]
function NetworkDeviceCreateEx(Size:LongWord):PNetworkDevice;
Description: Create a new Network entry


[Expand]
function NetworkDeviceDestroy(Network:PNetworkDevice):LongWord;
Description: Destroy an existing Network entry


[Expand]
function NetworkDeviceRegister(Network:PNetworkDevice):LongWord;
Description: Register a new Network in the Network table


[Expand]
function NetworkDeviceDeregister(Network:PNetworkDevice):LongWord;
Description: Deregister a Network from the Network table


[Expand]
function NetworkDeviceFind(NetworkId:LongWord):PNetworkDevice;
Description: To be documented


[Expand]
function NetworkDeviceFindByName(const Name:String):PNetworkDevice; inline;
Description: To be documented


[Expand]
function NetworkDeviceFindByDescription(const Description:String):PNetworkDevice; inline;
Description: To be documented


[Expand]
function NetworkDeviceEnumerate(Callback:TNetworkEnumerate; Data:Pointer):LongWord;
Description: To be documented


[Expand]
function NetworkDeviceNotification(Network:PNetworkDevice; Callback:TNetworkNotification; Data:Pointer; Notification,Flags:LongWord):LongWord;
Description: To be documented


[Expand]
function NetworkEventAllocate(Callback:TNetworkEventCallback; Data:Pointer; Event:LongWord):PNetworkEvent;
Description: Create and Register a new Event entry in the Event table


[Expand]
function NetworkEventRelease(Event:PNetworkEvent):LongWord;
Description: Deregister and Destroy a Event from the Event table


[Expand]
function NetworkEventRegister(Callback:TNetworkEventCallback; Data:Pointer; Event:LongWord):THandle;
Description: Register a callback for one or more network events


[Expand]
function NetworkEventDeregister(Handle:THandle):LongWord;
Description: Deregister a network event callback


[Expand]
function NetworkEventNotify(Event:LongWord):LongWord;
Description: To be documented


RTL network functions

[Expand]
function SysHostGetName:String;
Description: To be documented


[Expand]
function SysHostSetName(const AName:String):Boolean;
Description: To be documented


[Expand]
function SysHostGetDomain:String;
Description: To be documented


[Expand]
function SysHostSetDomain(const ADomain:String):Boolean;
Description: To be documented


Network helper functions

[Expand]
function NetworkGetCount:LongWord; inline;
Description: Get the current network count


[Expand]
function NetworkDeviceCheck(Network:PNetworkDevice):PNetworkDevice;
Description: Check if the supplied Network is in the network table


[Expand]
function NetworkDeviceTypeToString(NetworkType:LongWord):String;
Description: To be documented


[Expand]
function NetworkDeviceStateToString(NetworkState:LongWord):String;
Description: To be documented


[Expand]
function NetworkDeviceStatusToString(NetworkStatus:LongWord):String;
Description: To be documented


[Expand]
function NetworkDeviceStateToNotification(State:LongWord):LongWord;
Description: Convert a Network state value into the notification code for device notifications


[Expand]
function NetworkDeviceStatusToNotification(Status:LongWord):LongWord;
Description: Convert a Network status value into the notification code for device notifications


[Expand]
function NetworkEventCheck(Event:PNetworkEvent):PNetworkEvent;
Description: Check if the supplied Event is in the event table


[Expand]
procedure NetworkLog(Level:LongWord; Network:PNetworkDevice; const AText:String);
Description: To be documented


[Expand]
procedure NetworkLogInfo(Network:PNetworkDevice; const AText:String);
Description: To be documented


[Expand]
procedure NetworkLogError(Network:PNetworkDevice; const AText:String);
Description: To be documented


[Expand]
procedure NetworkLogDebug(Network:PNetworkDevice; const AText:String);
Description: To be documented


[Expand]
function HardwareAddressToString(const AAddress:THardwareAddress):String;
Description: To be documented


[Expand]
function StringToHardwareAddress(const AAddress:String):THardwareAddress;
Description: To be documented


[Expand]
function CompareHardwareAddress(const AAddress1,AAddress2:THardwareAddress):Boolean;
Description: To be documented


[Expand]
function CompareHardwareDefault(const AAddress:THardwareAddress):Boolean;
Description: To be documented


[Expand]
function CompareHardwareBroadcast(const AAddress:THardwareAddress):Boolean;
Description: To be documented


[Expand]
function CompareHardwareMulticast(const AAddress:THardwareAddress):Boolean;
Description: To be documented


[Expand]
function AdapterTypeToString(AType:Word):String;
Description: To be documented


[Expand]
function AdapterModeToString(AMode:Word):String;
Description: To be documented


[Expand]
function AdapterConfigToString(AConfig:Word):String;
Description: To be documented


[Expand]
function AdapterStateToString(AState:Integer):String;
Description: To be documented


[Expand]
function AdapterStatusToString(AStatus:Integer):String;
Description: To be documented


[Expand]
function FrameTypeToString(AType:Word):String;
Description: To be documented


[Expand]
function MediaTypeToString(AType:Word):String;
Description: To be documented


[Expand]
function PacketTypetoString(AType:Word):String;
Description: To be documented


[Expand]
function ConfigTypeToString(AType:Word):String;
Description: To be documented


[Expand]
function ConfigCommandToString(ACommand:Word):String;
Description: To be documented


[Expand]
function AuthTypeToString(AType:Word):String;
Description: To be documented


[Expand]
function AuthCommandToString(ACommand:Word):String;
Description: To be documented


Return to Unit Reference