Tcl Library Source Code

Documentation
Login


[ Main Table Of Contents | Table Of Contents | Keyword Index | Categories | Modules | Applications ]

NAME

tcllib_ip - IPv4 and IPv6 address manipulation

Table Of Contents

SYNOPSIS

package require Tcl 8.5 9
package require ip ?1.5.1?

::ip::version address
::ip::is class address
::ip::equal address address
::ip::normalize address
::ip::contract address
::ip::distance ipaddr1 ipaddr2
::ip::nextIp ipaddr ?offset?
::ip::prefix address
::ip::type address
::ip::mask address
::ip::prefixToNative prefix
::ip::nativeToPrefix nativeList|native ?-ipv4?
::ip::intToString number ?-ipv4?
::ip::toInteger ipaddr
::ip::toHex ipaddr
::ip::maskToInt ipmask
::ip::broadcastAddress prefix ?-ipv4?
::ip::maskToLength dottedMask|integerMask|hexMask ?-ipv4?
::ip::lengthToMask maskLength ?-ipv4?
::ip::nextNet ipaddr ipmask ?count? ?-ipv4?
::ip::isOverlap prefix prefix...
::ip::isOverlapNative ?-all? ?-inline? ?-ipv4? hexipaddr hexipmask hexiplist
::ip::ipToLayer2Multicast ipaddr
::ip::ipHostFromPrefix prefix ?-exclude prefixExcludeList?
::ip::reduceToAggregates prefixlist
::ip::longestPrefixMatch ipaddr prefixlist ?-ipv4?
::ip::collapse prefixlist
::ip::subtract prefixlist

DESCRIPTION

This package provides a set of commands to help in parsing, displaying and comparing internet addresses. The package can handle both IPv4 (1) and IPv6 (2) address types.

COMMANDS

EXAMPLES

% ip::version ::1
6
% ip::version 127.0.0.1
4

% ip::normalize 127/8
127.0.0.0/8
% ip::contract 192.168.0.0
192.168
%
% ip::normalize fec0::1
fec0:0000:0000:0000:0000:0000:0000:0001
% ip::contract fec0:0000:0000:0000:0000:0000:0000:0001
fec0::1

% ip::equal 192.168.0.4/16 192.168.0.0/16
1
% ip::equal fec0::1/10 fec0::fe01/10
1

REFERENCES

  1. Postel, J. "Internet Protocol." RFC 791, September 1981, (http://www.ietf.org/rfc/rfc791.txt)

  2. Hinden, R. and Deering, S., "Internet Protocol Version 6 (IPv6) Addressing Architecture", RFC 3513, April 2003 (http://www.ietf.org/rfc/rfc3513.txt)

AUTHORS

Pat Thoyts

Bugs, Ideas, Feedback

If you find errors in this document or bugs or problems with the package it describes, or if you want to suggest improvements for the documentation or the package, please use the Tcllib Trackers and specify dns as the category.

When proposing code changes, please provide unified diffs, i.e the output of diff -u.

Note further that attachments are strongly preferred over inlined patches. Attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar.

SEE ALSO

inet(3), ip(7), ipv6(7)

KEYWORDS

internet address, ip, ipv4, ipv6, rfc 3513

CATEGORY

Networking

COPYRIGHT

Copyright © 2004, Pat Thoyts
Copyright © 2005 Aamer Akhter