Indy 9 | Content | Index | Reference

TIpStruct
Example, Unit: IdNetworkCalculator
Provides storage for the components of an IP address or network mask.

    TIpStruct = record
      case integer of
        0: (Byte1: byte;
            Byte2: byte;
            Byte3: byte;
            Byte4: byte;);
        1: (FullAddr: Longword;);
      end;

Unit
IdNetworkCalculator
Members
Byte1: byte;
Byte1 represents one Byte of the 4-byte IP address or network mask. Use FullAddr to access the LongWord variant of TIpStruct.
Byte2: byte;
Byte2 represents one Byte of the 4-byte IP address or network mask. Use FullAddr to access the LongWord variant of TIpStruct.
Byte3: byte;
Byte3 represents one Byte of the 4-byte IP address or network mask. Use FullAddr to access the LongWord variant of TIpStruct.
Byte4: byte;
Byte4 represents one Byte of the 4-byte IP address or network mask. Use FullAddr to access the LongWord variant of TIpStruct.
FullAddr: Longword;
FullAddr represents the IP address or network mask as a 32-bit LongWord value. Use Byte1, Byte2, Byte3, or Byte4 to access the Byte variant of TIpStruct.
Description
TIpStruct is a variant record used to store IP address values. TIpStruct has the following format:

    +-------+-------+-------+-------+
    | Byte4 | Byte3 | Byte2 | Byte1 | (Byte variant)
    +-------+-------+-------+-------+
    |           FullAddr            | (LongWord variant)
    +-------------------------------+

TIpStruct provides access to the value of the IP address as a sequence of Byte values using Byte1, Byte2, Byte3, and Byte4. TIpStruct also provides access to the value of the IP address as a LongWord value using FullAddr.

TIpStruct is used by TIpProperty and the functions IP and StrToIP to store IP addresses.

Created with Doc-O-Matic 2 donated to Project JEDI. Commercial license available from the Doc-O-Matic site.