88. IP

IP manipulation routines

88.1. Summary of Module Globals

List of Global Functions

  • BitsToIPv4 - Converts 32 bit binary number to its IPv4 repserentation.

  • Check - Check syntax of IP address

  • Check4 - Check syntax of IPv4 address

  • Check6 - Check syntax of IPv6 address

  • ComputeBroadcast - Compute IPv4 broadcast address from ip4 address and network mask.

  • ComputeNetwork - Compute IPv4 network address from ip4 address and network mask.

  • IPv4ToBits - Converts IPv4 into its 32 bit binary representation.

  • ToHex - Converts IPv4 address from string to hex format

  • ToInteger - Convert IPv4 address from string to integer

  • ToString - Convert IPv4 address from integer to string

  • Valid4 - Describe a valid IPv4 address

List of Global Variables

    88.2. Global Functions

    88.2.1. BitsToIPv4

    Converts 32 bit binary number to its IPv4 repserentation.

    Function parameters

    • string bits

    Return value

    • string - ipv4

    Example 18. 

         BitsToIPv4("10111100000110001110001100000101") -> "188.24.227.5"
         BitsToIPv4("00110101000110001110001001100101") -> "53.24.226.101"


    88.2.2. Check

    Check syntax of IP address

    Function parameters

    • string ip

    Return value

    • boolean - true if correct

    88.2.3. Check4

    Check syntax of IPv4 address

    Function parameters

    • string ip

    Return value

    • boolean - true if correct

    88.2.4. Check6

    Check syntax of IPv6 address

    Function parameters

    • string ip

    Return value

    • boolean - true if correct

    88.2.5. ComputeBroadcast

    Compute IPv4 broadcast address from ip4 address and network mask.

    Function parameters

    • string ip

    • string mask

    Return value

    • string - computed broadcast

    88.2.6. ComputeNetwork

    Compute IPv4 network address from ip4 address and network mask.

    Function parameters

    • string ip

    • string mask

    Return value

    • string - computed subnet

    88.2.7. IPv4ToBits

    Converts IPv4 into its 32 bit binary representation.

    Function parameters

    • string ipv4

    Return value

    • string - binary

    Example 19. 

         IPv4ToBits("80.25.135.2")    -> "01010000000110011000011100000010"
         IPv4ToBits("172.24.233.211") -> "10101100000110001110100111010011"


    88.2.8. ToHex

    Converts IPv4 address from string to hex format

    Function parameters

    • string ip

    Return value

    • string - representing IP in Hex

    Example 20. 

     IP::ToHex("192.168.1.1") -> "0xC0A80101"
     IP::ToHex("10.10.0.1") -> "0x0A0A0001"


    88.2.9. ToInteger

    Convert IPv4 address from string to integer

    Function parameters

    • string ip

    Return value

    • integer - ip address as integer

    88.2.10. ToString

    Convert IPv4 address from integer to string

    Function parameters

    • integer ip

    Return value

    • string - ip address as string

    88.2.11. Valid4

    Describe a valid IPv4 address

    Return value

    • string - describtion a valid IPv4 address

    88.3. Global Variables

    88.4. Module Requirements

    none