Unit Network

From Ultibo.org
Jump to: navigation, search

Return to Unit Reference


Description


Ultibo Network Interface unit

Constants



[Expand]
Network specific constants NETWORK_*


[Expand]
Network device type NETWORK_TYPE_*


[Expand]
Network device state NETWORK_STATE_*


[Expand]
Network device status NETWORK_STATUS_*


[Expand]
Network device flag NETWORK_FLAG_*


[Expand]
Network device control code NETWORK_CONTROL_*


[Expand]
Network link state NETWORK_LINK_*


[Expand]
Network speed state NETWORK_SPEED_*


[Expand]
Network duplex state NETWORK_DUPLEX_*


[Expand]
Network lock state NETWORK_LOCK_*


[Expand]
Network buffer size NETWORK_BUFFER_*


[Expand]
Network event NETWORK_EVENT_*


[Expand]
Network event signature NETWORK_EVENT_SIGNATURE*


[Expand]
Network event state NETWORK_EVENT_STATE_*


[Expand]
Network event flag NETWORK_EVENT_FLAG_*


[Expand]
Adapter type ADAPTER_TYPE_*


[Expand]
Adapter thread ADAPTER_THREAD_*


[Expand]
Adapter state ADAPTER_STATE_*


[Expand]
Adapter status ADAPTER_STATUS_*


[Expand]
Configuration type CONFIG_TYPE_*


[Expand]
Authentication type AUTH_TYPE_*


[Expand]
Frame type FRAME_TYPE_*


[Expand]
Configuration command CONFIG_*


[Expand]
Authentication command AUTH_COMMAND_*


[Expand]
Multicast addressing MAX_MULTICAST_*


[Expand]
Hardware addressing HARDWARE_ADDRESS_*


[Expand]
Media type MEDIA_TYPE_*


[Expand]
Packet type PACKET_TYPE_*


[Expand]
Generic MII registers (Management Interface) MII_*


[Expand]
Basic mode control register BMCR_*


[Expand]
Basic mode status register BMSR_*


[Expand]
Advertisement control register ADVERTISE_*


[Expand]
Link partner ability register LPA_*


[Expand]
Expansion register for auto-negotiation EXPANSION_*


[Expand]
Estatus register ESTATUS_*


[Expand]
N-way test register NWAYTEST_*


[Expand]
1000BASE-T control register *_1000*


[Expand]
1000BASE-T Status register LPA_1000*


[Expand]
Flow control flags FLOW_CTRL_*


[Expand]
MMD access control register fields MII_MMD_CTRL_*


[Expand]
PHY link state PHY_LINK_*


[Expand]
PHY interface mode PHY_INTERFACE_MODE_*


[Expand]
PHY link speed PHY_SPEED_*


[Expand]
PHY duplex mode PHY_DUPLEX_*


[Expand]
Service set SERVICE_SET_*


[Expand]
Network logging NETWORK_LOG_*


[Expand]
Ethernet specific constants ETHERNET_*


[Expand]
Ethernet size ETHERNET_*_SIZE*


[Expand]
Ethernet 802.3 network LLC_HEADER_*


[Expand]
Ethernet SNAP network SNAP_HEADER_*


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 address

[Expand]

PMulticastAddresses = ^TMulticastAddresses;

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

Packet fragment

[Expand]

PPacketFragment = ^TPacketFragment;

TPacketFragment = packed record

Adapter statistics

[Expand]

PAdapterStatistics = ^TAdapterStatistics;

TAdapterStatistics = record

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 statistics

[Expand]

PNetworkStatistics = ^TNetworkStatistics;

TNetworkStatistics = 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

[Expand]

PNetworkDevice = ^TNetworkDevice;

TNetworkDevice = record

Network event callback

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

Network Event

[Expand]

PNetworkEvent = ^TNetworkEvent;

TNetworkEvent = record

Ethernet address

[Expand]

PEthernetAddress = ^TEthernetAddress;

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

Ethernet header

[Expand]

PEthernetHeader = ^TEthernetHeader;

TEthernetHeader = packed record

Ethernet 802.3 network

[Expand]

PLLCHeader = ^TLLCHeader;

TLLCHeader = packed record

Ethernet SNAP network

[Expand]

PSNAPHeader = ^TSNAPHeader;

TSNAPHeader = packed record

Adapter callback

TAdapterCallback = function(AAdapter:TNetworkAdapter):Boolean of object;

Adapter packet handler

TAdapterPacketHandler = function(AHandle:THandle; ASource,ADest,APacket:Pointer; ASize:Integer; ABroadcast:Boolean):Boolean of object;

Adapter monitor handler

TAdapterMonitorHandler = function(AHandle:THandle; APacket:Pointer; ASize:Integer; AStatus:Pointer):Boolean of object;

Adapter authenticator handler

TAdapterAuthenticatorHandler = function(AHandle:THandle; ACommand:Word):Boolean of object;


Class definitions



Network specific classes

TAdapterManager = class(TObject)
TAdapterTransport = class(TListObject)
TAdapterBinding = class(TListObject)
TAdapterMonitor = class(TListObject)
TAdapterAuthenticator = class(TListObject)
TNetworkList = class(TLinkedObjList)
TNetworkAdapter = class(TListObject)
TAdapterThread = class(TThread)
TAdapterBuffer = class(TObject)
TWiredAdapter = class(TNetworkAdapter)
TNetworkSetting = class(TListObject)
TNetworkSettings = class(TObject)
TServiceSet = class(TListObject)


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;

Network specific variables

AdapterManager:TAdapterManager;
NetworkSettings:TNetworkSettings;


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 offset 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 an 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 NetworkGetLastError:LongInt;
Description: Get the last network error value for the current Thread


[Expand]
procedure NetworkSetLastError(Error:LongInt);
Description: Set the last network error value for the current Thread


[Expand]
function NetworkGetCount:LongWord;
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); inline;
Description: To be documented


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


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


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


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


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


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


[Expand]
function RandomHardwareAddress: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