Thunderstone Software Document Retreival and Management
Search:
Advanced Search
Home | Products | Company | News | Tech Support | Demos | Contact Us
Texis Manual

Internet/IP address functions

The following functions manipulate IP network and/or host addresses. The addresses are varchar arguments in inet format: N[.N[.N[.

Unknown environment: tex2html_wrap_inline
$N]]]{$
/B|:
Unknown environment: tex2html_wrap_inline
$IP}]$
where N is a decimal, octal or hexadecimal integer from 0 to 255, B is a decimal, octal or hexadecimal netmask integer from 0 to 32, and IP is an IP address netmask of the form N[.N[.N[.N]]]. If only x Ns are specified, the last N may be 5-x bytes in size instead of 1 byte. Eg. ``1.2.65535'' is legal (last N is 2 bytes), whereas ``1.2.3.65535'' is not. If no netmask (/B|:IP) is specified, the netmask will be calculated from standard class A/B/C/D/E rules, but it will be at least large enough to include all specified bytes of the IP. If an IP netmask is specified, only the largest contiguous set of most-significant 1 bits are used. Examples: ``1.2.3.4'' (netmask is /32 because 4 bytes given), ``10'' (netmask is /8 because it is a Class A address), ``1.2.3.4/10'', ``67305985'' (eg. 4.3.2.1).

The inet functions were added in version 5.01.1113268256 of Apr 11 2005 and include the following. See also the Vortex <urlutil> equivalents:

  • inetabbrev(inet)
    Returns the shortest canonical representation of inet. This will include all contiguous most-significant bytes of the network, non-zero bytes of the host, and a netmask. Other trailing 0 bytes of the IP may be trimmed. Empty string is returned on error.

  • inetcanon(inet)
    Returns canonical representation of inet. This is dotted-decimal with all 4 bytes, and a /N netmask. Empty string is returned on error.

  • inetnetwork(inet)
    Returns 4-decimal IP address with the network bits of inet, and the host bits set to 0. Empty string is returned on error.

  • inethost(inet)
    Returns 4-decimal IP address with the host bits of inet, and the network bits set to 0. Empty string is returned on error.

  • inetbroadcast(inet)
    Returns 4-decimal IP broadcast address for inet, ie. with the network bits, and host bits set to 1. Empty string is returned on error.

  • inetnetmask(inet)
    Returns 4-decimal IP netmask for inet, ie. with the network bits set to 1, and host bits set to 0. Empty string is returned on error.

  • inetnetmasklen(inet)
    Returns integer netmask length of $inet. -1 is returned on error.

  • inetcontains(inetA, inetB)
    Returns 1 if inetA contains inetB, ie. every address in inetB occurs within the inetA network. 0 is returned if not, or -1 on error.

  • inetclass(inet)
    Returns class of inet, eg. A, B, C, D, E or classless if a different netmask is used. Empty string is returned on error.

  • inet2int(inet)
    Returns integer representation of IP network/host bits of inet (ie. without netmask). Useful for compact storage of IPv4 address as integers instead of strings. -1 is returned on error (note that -1 may also be legitimately returned for an all-ones IP address, eg. ``255.255.255.255'').

  • int2inet(i)
    Returns inet string for integer i taken as an IP address. Since no netmask can be stored in the integer form of an IP address, the returned IP string will not have a netmask. Empty string is returned on error.

Copyright © Thunderstone Software     Last updated: Wed Sep 10 11:42:21 EDT 2008
 
Home   ::   Products   ::   Company   ::   News   ::   Tech Support   ::   Demos   ::   Contact Us
Copyright © 2008 Thunderstone Software LLC. All rights reserved.