<html>
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   
      <title>::ipExtension::</title><style type="text/css">
    @import url(/atsdoc/css/atsdoc.css);
  </style></head>
   <body bgcolor="FFFFFF"><a name="top"></a><table border="0" cellspacing="1" cellpadding="0" width="700">
         <tr>
            <td class="nav" width="233" align="center" valign="middle"><a href="#over">Library Header</a></td>
            <td class="nav" width="233" align="center" valign="middle"><a href="#files">Procedure 
                  Summary</a></td>
            <td class="nav" width="233" align="center" valign="middle"><a href="#procs">Procedure 
                  Details </a></td>
         </tr>
      </table><br><table border="0" cellspacing="0" cellpadding="2" width="700">
         <tr>
            <td><a href="http://wwwin-ats.cisco.com/cgi/tcl2html.cgi?file_path=/auto/nsite-l3vpn/users/aakhter/l3vpn-proj/lib/tcl/ipExtension/ipExtension.tcl">
                  View Code</a>
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
               File Name:  ipExtension.tcl
            </td>
         </tr>
      </table><a name="over"></a><table border="0" cellspacing="0" cellpadding="2" width="700">
         <tr>
            <td bgcolor="#c0c0c0" class="head1" align="center">Library Header</td>
         </tr>
      </table>
      <table border="0" cellspacing="0" cellpadding="2" width="700">
         <tr>
            <td bgcolor="#cccccc" height="25" class="head2">Library Name: ::ipExtension::</td>
         </tr>
      </table>
      <table width="700" bgcolor="#eeeeee" border="0" cellpadding="2" cellspacing="0">
         <tr>
            <td class="key" colspan="2">Author(s)</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630">Aamer Akhter / aakhter@cisco.com</td>
         </tr>
         <tr>
            <td class="key" colspan="2">Support Alias</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630">aakhter@cisco.com</td>
         </tr>
         <tr>
            <td class="key" colspan="2">Purpose</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630">an extension to tcllib ip library</td>
         </tr>
         <tr>
            <td class="key" colspan="2">Description</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630">
               <p>A detailed description of the functionality provided by the library.</p>
            </td>
         </tr>
         <tr>
            <td class="key" colspan="2">Usage</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td><pre><font face="Arial, Helvetica, san-serif"></font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Requirements</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
package require logger
package require ip
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Variables</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
namespace   ::ipExtension::
id:         CVS ID: keyword extraction
version:    current version of package
packageDir: directory where package is located
log:        instance log
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Notes</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
1.
</font></pre></td>
         </tr>
      </table>
      <div style="position: absolute; left: 685px"><a href="#top">Top</a></div><br><a name="global"></a><a name="files"></a><table border="0" cellspacing="0" cellpadding="2" width="700">
         <tr>
            <td bgcolor="#cccccc" class="head2">Procedures Summary</td>
         </tr>
      </table>
      <table width="700" bgcolor="#eeeeee" border="0" cellpadding="2" cellspacing="0">
         <tr>
            <td width="60">&nbsp;</td>
            <td colspan="2"><a href="#::ip::prefixToNative"><b>::ip::prefixToNative</b></a></td>
            <td width="100">&nbsp;</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="60">&nbsp;</td>
            <td>convert from dotted from to native (hex) form</td>
            <td width="100">&nbsp;</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td colspan="2"><a href="#::ip::nativeToPrefix"><b>::ip::nativeToPrefix</b></a></td>
            <td width="100">&nbsp;</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="60">&nbsp;</td>
            <td>convert from native (hex) form to dotted form</td>
            <td width="100">&nbsp;</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td colspan="2"><a href="#::ip::intToString"><b>::ip::intToString</b></a></td>
            <td width="100">&nbsp;</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="60">&nbsp;</td>
            <td>convert from an integer/hex to dotted form</td>
            <td width="100">&nbsp;</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td colspan="2"><a href="#::ip::toInteger"><b>::ip::toInteger</b></a></td>
            <td width="100">&nbsp;</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="60">&nbsp;</td>
            <td>convert dotted form ip to integer</td>
            <td width="100">&nbsp;</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td colspan="2"><a href="#::ip::toHex"><b>::ip::toHex</b></a></td>
            <td width="100">&nbsp;</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="60">&nbsp;</td>
            <td>convert dotted form ip to hex</td>
            <td width="100">&nbsp;</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td colspan="2"><a href="#::ip::maskToInt"><b>::ip::maskToInt</b></a></td>
            <td width="100">&nbsp;</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="60">&nbsp;</td>
            <td>convert mask to integer</td>
            <td width="100">&nbsp;</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td colspan="2"><a href="#::ip::broadcastAddress"><b>::ip::broadcastAddress</b></a></td>
            <td width="100">&nbsp;</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="60">&nbsp;</td>
            <td>return broadcast address given prefix</td>
            <td width="100">&nbsp;</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td colspan="2"><a href="#::ip::maskToLength"><b>::ip::maskToLength</b></a></td>
            <td width="100">&nbsp;</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="60">&nbsp;</td>
            <td>converts dotted or integer form of mask to length</td>
            <td width="100">&nbsp;</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td colspan="2"><a href="#::ip::lengthToMask"><b>::ip::lengthToMask</b></a></td>
            <td width="100">&nbsp;</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="60">&nbsp;</td>
            <td>converts mask length to dotted mask form</td>
            <td width="100">&nbsp;</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td colspan="2"><a href="#::ip::nextNet"><b>::ip::nextNet</b></a></td>
            <td width="100">&nbsp;</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="60">&nbsp;</td>
            <td>returns next an ipaddress in same position in next network</td>
            <td width="100">&nbsp;</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td colspan="2"><a href="#::ip::isOverlap"><b>::ip::isOverlap</b></a></td>
            <td width="100">&nbsp;</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="60">&nbsp;</td>
            <td>checks to see if prefixes overlap</td>
            <td width="100">&nbsp;</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td colspan="2"><a href="#::ip::isOverlapNative"><b>::ip::isOverlapNative</b></a></td>
            <td width="100">&nbsp;</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="60">&nbsp;</td>
            <td>checks to see if prefixes overlap (optimized native form)</td>
            <td width="100">&nbsp;</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td colspan="2"><a href="#::ip::ipToLayer2Multicast"><b>::ip::ipToLayer2Multicast</b></a></td>
            <td width="100">&nbsp;</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="60">&nbsp;</td>
            <td>converts ipv4 address to a layer 2 multicast address</td>
            <td width="100">&nbsp;</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td colspan="2"><a href="#::ip::ipHostFromPrefix"><b>::ip::ipHostFromPrefix</b></a></td>
            <td width="100">&nbsp;</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="60">&nbsp;</td>
            <td>gives back a host address from a prefix</td>
            <td width="100">&nbsp;</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td colspan="2"><a href="#::ip::reduceToAggregates"><b>::ip::reduceToAggregates</b></a></td>
            <td width="100">&nbsp;</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="60">&nbsp;</td>
            <td>finds nets that overlap and filters out the more specifc nets</td>
            <td width="100">&nbsp;</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td colspan="2"><a href="#::ip::longestPrefixMatch"><b>::ip::longestPrefixMatch</b></a></td>
            <td width="100">&nbsp;</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="60">&nbsp;</td>
            <td>given host IP finds longest prefix match from set of prefixes</td>
            <td width="100">&nbsp;</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td colspan="2"><a href="#::ip::cmpDotIP"><b>::ip::cmpDotIP</b></a></td>
            <td width="100">&nbsp;</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="60">&nbsp;</td>
            <td>helper function for dotted ip address for use in lsort</td>
            <td width="100">&nbsp;</td>
         </tr>
      </table><br><table width="700" bgcolor="#eeeeee" border="0" cellpadding="2" cellspacing="0"></table><br><a name="procs"></a><table border="0" cellspacing="0" cellpadding="2" width="700">
         <tr>
            <td bgcolor="#cccccc" class="head2">Procedure Details</td>
         </tr>
      </table><br><table width="700" bgcolor="#eeeeee" border="0" cellpadding="2" cellspacing="0">
         <tr>
            <td bgcolor="#dedede" class="head3" colspan="2"><a name="::ip::prefixToNative"></a>
               External Procedure Name: ::ip::prefixToNative
            </td>
         </tr>
         <tr>
            <td class="key" colspan="2">Purpose</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630">convert from dotted from to native (hex) form</td>
         </tr>
         <tr>
            <td class="key" colspan="2">Synopsis</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
prefixToNative &lt;prefix&gt;
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Arguments</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
&lt;prefix&gt;
    string in the &lt;ipaddr&gt;/&lt;mask&gt; format
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Return Output</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
&lt;prefix&gt; in native format {&lt;hexip&gt; &lt;hexmask&gt;}
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Examples</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif" color="green">
% ip::prefixToNative 1.1.1.0/24
0x01010100 0xffffff00
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Notes</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
fixed bug in C extension that modified 
 calling context variable
</font></pre></td>
         </tr>
      </table>
      <div style="position: absolute; left: 685px"><a href="#top">Top</a></div><br><table width="700" bgcolor="#eeeeee" border="0" cellpadding="2" cellspacing="0">
         <tr>
            <td bgcolor="#dedede" class="head3" colspan="2"><a name="::ip::nativeToPrefix"></a>
               External Procedure Name: ::ip::nativeToPrefix
            </td>
         </tr>
         <tr>
            <td class="key" colspan="2">Purpose</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630">convert from native (hex) form to dotted form</td>
         </tr>
         <tr>
            <td class="key" colspan="2">Synopsis</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
nativeToPrefix &lt;nativeList&gt;|&lt;native&gt; [-ipv4]
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Arguments</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
&lt;nativeList&gt; 
    list of native form ip addresses native form is:
&lt;native&gt;
    tcllist in format {&lt;hexip&gt; &lt;hexmask&gt;}
-ipv4
    the provided native format addresses are in ipv4 format (default)
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Return Output</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
if nativeToPrefix is called with &lt;native&gt; a single (non-listified) address
    is returned
if nativeToPrefix is called with a &lt;nativeList&gt; address list, then 
    a list of addresses is returned

return form is: &lt;ipaddr&gt;/&lt;mask&gt;
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Examples</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif" color="green">
% ip::nativeToPrefix {0x01010100 0xffffff00} -ipv4
1.1.1.0/24
</font></pre></td>
         </tr>
      </table>
      <div style="position: absolute; left: 685px"><a href="#top">Top</a></div><br><table width="700" bgcolor="#eeeeee" border="0" cellpadding="2" cellspacing="0">
         <tr>
            <td bgcolor="#dedede" class="head3" colspan="2"><a name="::ip::intToString"></a>
               External Procedure Name: ::ip::intToString
            </td>
         </tr>
         <tr>
            <td class="key" colspan="2">Purpose</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630">convert from an integer/hex to dotted form</td>
         </tr>
         <tr>
            <td class="key" colspan="2">Synopsis</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
intToString &lt;integer/hex&gt; [-ipv4]
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Arguments</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
&lt;integer&gt;
    ip address in integer form
-ipv4
    the provided integer addresses is ipv4 (default)
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Return Output</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
ip address in dotted form
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Examples</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif" color="green">
ip::intToString 4294967295
255.255.255.255
</font></pre></td>
         </tr>
      </table>
      <div style="position: absolute; left: 685px"><a href="#top">Top</a></div><br><table width="700" bgcolor="#eeeeee" border="0" cellpadding="2" cellspacing="0">
         <tr>
            <td bgcolor="#dedede" class="head3" colspan="2"><a name="::ip::toInteger"></a>
               External Procedure Name: ::ip::toInteger
            </td>
         </tr>
         <tr>
            <td class="key" colspan="2">Purpose</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630">convert dotted form ip to integer</td>
         </tr>
         <tr>
            <td class="key" colspan="2">Synopsis</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
toInteger &lt;ipaddr&gt;
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Arguments</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
&lt;ipaddr&gt;
    decimal dotted from ip address
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Return Output</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
integer form of &lt;ipaddr&gt;
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Examples</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif" color="green">
% ::ip::toInteger 1.1.1.0
16843008
</font></pre></td>
         </tr>
      </table>
      <div style="position: absolute; left: 685px"><a href="#top">Top</a></div><br><table width="700" bgcolor="#eeeeee" border="0" cellpadding="2" cellspacing="0">
         <tr>
            <td bgcolor="#dedede" class="head3" colspan="2"><a name="::ip::toHex"></a>
               External Procedure Name: ::ip::toHex
            </td>
         </tr>
         <tr>
            <td class="key" colspan="2">Purpose</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630">convert dotted form ip to hex</td>
         </tr>
         <tr>
            <td class="key" colspan="2">Synopsis</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
toHex &lt;ipaddr&gt;
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Arguments</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
&lt;ipaddr&gt;
    decimal dotted from ip address
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Return Output</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
hex form of &lt;ipaddr&gt;
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Examples</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif" color="green">
% ::ip::toHex 1.1.1.0
0x01010100
</font></pre></td>
         </tr>
      </table>
      <div style="position: absolute; left: 685px"><a href="#top">Top</a></div><br><table width="700" bgcolor="#eeeeee" border="0" cellpadding="2" cellspacing="0">
         <tr>
            <td bgcolor="#dedede" class="head3" colspan="2"><a name="::ip::maskToInt"></a>
               External Procedure Name: ::ip::maskToInt
            </td>
         </tr>
         <tr>
            <td class="key" colspan="2">Purpose</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630">convert mask to integer</td>
         </tr>
         <tr>
            <td class="key" colspan="2">Synopsis</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
maskToInt &lt;mask&gt;
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Arguments</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
&lt;mask&gt;
    mask in either dotted form or mask length form (255.255.255.0 or 24)
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Return Output</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
integer form of mask
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Examples</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif" color="green">
::ip::maskToInt 24
4294967040
</font></pre></td>
         </tr>
      </table>
      <div style="position: absolute; left: 685px"><a href="#top">Top</a></div><br><table width="700" bgcolor="#eeeeee" border="0" cellpadding="2" cellspacing="0">
         <tr>
            <td bgcolor="#dedede" class="head3" colspan="2"><a name="::ip::broadcastAddress"></a>
               External Procedure Name: ::ip::broadcastAddress
            </td>
         </tr>
         <tr>
            <td class="key" colspan="2">Purpose</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630">return broadcast address given prefix</td>
         </tr>
         <tr>
            <td class="key" colspan="2">Synopsis</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
broadcastAddress &lt;prefix&gt; [-ipv4]
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Arguments</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
&lt;prefix&gt;
    route in the form of &lt;ipaddr&gt;/&lt;mask&gt; or native form {&lt;hexip&gt; &lt;hexmask&gt;}
-ipv4
    the provided native format addresses are in ipv4 format (default)
    note: broadcast addresses are not valid in ipv6
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Return Output</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
ipaddress of broadcast
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Examples</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif" color="green">
::ip::broadcastAddress 1.1.1.0/24
1.1.1.255

::ip::broadcastAddress {0x01010100 0xffffff00}
0x010101ff
</font></pre></td>
         </tr>
      </table>
      <div style="position: absolute; left: 685px"><a href="#top">Top</a></div><br><table width="700" bgcolor="#eeeeee" border="0" cellpadding="2" cellspacing="0">
         <tr>
            <td bgcolor="#dedede" class="head3" colspan="2"><a name="::ip::maskToLength"></a>
               External Procedure Name: ::ip::maskToLength
            </td>
         </tr>
         <tr>
            <td class="key" colspan="2">Purpose</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630">converts dotted or integer form of mask to length</td>
         </tr>
         <tr>
            <td class="key" colspan="2">Synopsis</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
maskToLength &lt;dottedMask&gt;|&lt;integerMask&gt;|&lt;hexMask&gt; [-ipv4]
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Arguments</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
&lt;dottedMask&gt;
&lt;integerMask&gt;
&lt;hexMask&gt;
    mask to convert to prefix length format (eg /24)
 -ipv4
    the provided integer/hex format masks are ipv4 (default)
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Return Output</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
prefix length
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Examples</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif" color="green">
::ip::maskToLength 0xffffff00 -ipv4
24

% ::ip::maskToLength 255.255.255.0
24
</font></pre></td>
         </tr>
      </table>
      <div style="position: absolute; left: 685px"><a href="#top">Top</a></div><br><table width="700" bgcolor="#eeeeee" border="0" cellpadding="2" cellspacing="0">
         <tr>
            <td bgcolor="#dedede" class="head3" colspan="2"><a name="::ip::lengthToMask"></a>
               External Procedure Name: ::ip::lengthToMask
            </td>
         </tr>
         <tr>
            <td class="key" colspan="2">Purpose</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630">converts mask length to dotted mask form</td>
         </tr>
         <tr>
            <td class="key" colspan="2">Synopsis</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
lengthToMask &lt;maskLength&gt; [-ipv4]
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Arguments</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
&lt;maskLength&gt;
    mask length   
-ipv4
    the provided mask length is ipv4 (default)
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Return Output</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
mask in dotted form
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Examples</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif" color="green">
::ip::lengthToMask 24
255.255.255.0
</font></pre></td>
         </tr>
      </table>
      <div style="position: absolute; left: 685px"><a href="#top">Top</a></div><br><table width="700" bgcolor="#eeeeee" border="0" cellpadding="2" cellspacing="0">
         <tr>
            <td bgcolor="#dedede" class="head3" colspan="2"><a name="::ip::nextNet"></a>
               External Procedure Name: ::ip::nextNet
            </td>
         </tr>
         <tr>
            <td class="key" colspan="2">Purpose</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630">returns next an ipaddress in same position in next network</td>
         </tr>
         <tr>
            <td class="key" colspan="2">Synopsis</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
nextNet &lt;ipaddr&gt; &lt;mask&gt; [&lt;count&gt;] [-ipv4]
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Arguments</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
&lt;ipaddress&gt;
    in hex/integer/dotted format
&lt;mask&gt;
    mask in hex/integer/dotted/maskLen format
&lt;count&gt;
    number of nets to skip over (default is 1)
-ipv4
    the provided hex/integer addresses are in ipv4 format (default)
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Return Output</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
ipaddress in same position in next network in hex
</font></pre></td>
         </tr>
      </table>
      <div style="position: absolute; left: 685px"><a href="#top">Top</a></div><br><table width="700" bgcolor="#eeeeee" border="0" cellpadding="2" cellspacing="0">
         <tr>
            <td bgcolor="#dedede" class="head3" colspan="2"><a name="::ip::isOverlap"></a>
               External Procedure Name: ::ip::isOverlap
            </td>
         </tr>
         <tr>
            <td class="key" colspan="2">Purpose</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630">checks to see if prefixes overlap</td>
         </tr>
         <tr>
            <td class="key" colspan="2">Synopsis</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
isOverlap &lt;prefix&gt; &lt;prefix1&gt; &lt;prefix2&gt;...
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Arguments</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
&lt;prefix&gt;
    in form &lt;ipaddr&gt;/&lt;mask&gt; prefix to compare &lt;prefixN&gt; against
&lt;prefixN&gt;
    in form &lt;ipaddr&gt;/&lt;mask&gt; prefixes to compare against
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Return Output</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
1 if there is an overlap
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Examples</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif" color="green">
% ::ip::isOverlap 1.1.1.0/24 2.1.0.1/32
0

::ip::isOverlap 1.1.1.0/24 2.1.0.1/32 1.1.1.1/32
1
</font></pre></td>
         </tr>
      </table>
      <div style="position: absolute; left: 685px"><a href="#top">Top</a></div><br><table width="700" bgcolor="#eeeeee" border="0" cellpadding="2" cellspacing="0">
         <tr>
            <td bgcolor="#dedede" class="head3" colspan="2"><a name="::ip::isOverlapNative"></a>
               External Procedure Name: ::ip::isOverlapNative
            </td>
         </tr>
         <tr>
            <td class="key" colspan="2">Purpose</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630">checks to see if prefixes overlap (optimized native form)</td>
         </tr>
         <tr>
            <td class="key" colspan="2">Synopsis</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
isOverlap &lt;hexipaddr&gt; &lt;hexmask&gt; {{&lt;hexipaddr1&gt; &lt;hexmask1&gt;} {&lt;hexipaddr2&gt; &lt;hexmask2&gt;...}
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Arguments</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
-all
    return all overlaps rather than the first one
-inline
    rather than returning index values, return the actual overlap prefixes
&lt;hexipaddr&gt;
    ipaddress in hex/integer form
&lt;hexMask&gt;
    mask in hex/integer form
-ipv4
    the provided native format addresses are in ipv4 format (default)
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Return Output</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
non-zero if there is an overlap, value is element # in list with overlap
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Description</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630">
               <p>isOverlapNative is avaliabel both as a C extension and in a native tcl form
                  if the extension is loaded (tried automatically), isOverlapNative will be
                  linked to isOverlapNativeC. If an extension is not loaded, then isOverlapNative
                  will be linked to the native tcl proc: ipOverlapNativeTcl.
               </p>
            </td>
         </tr>
         <tr>
            <td class="key" colspan="2">Examples</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif" color="green">
% ::ip::isOverlapNative 0x01010100 0xffffff00 {{0x02010001 0xffffffff}}
0

%::ip::isOverlapNative 0x01010100 0xffffff00 {{0x02010001 0xffffffff} {0x01010101 0xffffffff}}
2
</font></pre></td>
         </tr>
      </table>
      <div style="position: absolute; left: 685px"><a href="#top">Top</a></div><br><table width="700" bgcolor="#eeeeee" border="0" cellpadding="2" cellspacing="0">
         <tr>
            <td bgcolor="#dedede" class="head3" colspan="2"><a name="::ip::ipToLayer2Multicast"></a>
               External Procedure Name: ::ip::ipToLayer2Multicast
            </td>
         </tr>
         <tr>
            <td class="key" colspan="2">Purpose</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630">converts ipv4 address to a layer 2 multicast address</td>
         </tr>
         <tr>
            <td class="key" colspan="2">Synopsis</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
ipToLayer2Multicast &lt;ipaddr&gt;
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Arguments</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
&lt;ipaddr&gt;
    ipaddress in dotted form
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Return Output</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
mac address in xx.xx.xx.xx.xx.xx form
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Examples</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif" color="green">
% ::ip::ipToLayer2Multicast 224.0.0.2
01.00.5e.00.00.02
</font></pre></td>
         </tr>
      </table>
      <div style="position: absolute; left: 685px"><a href="#top">Top</a></div><br><table width="700" bgcolor="#eeeeee" border="0" cellpadding="2" cellspacing="0">
         <tr>
            <td bgcolor="#dedede" class="head3" colspan="2"><a name="::ip::ipHostFromPrefix"></a>
               External Procedure Name: ::ip::ipHostFromPrefix
            </td>
         </tr>
         <tr>
            <td class="key" colspan="2">Purpose</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630">gives back a host address from a prefix</td>
         </tr>
         <tr>
            <td class="key" colspan="2">Synopsis</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
::ip::ipHostFromPrefix &lt;prefix&gt; [-exclude &lt;list of prefixes&gt;]
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Arguments</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
&lt;prefix&gt;
    prefix is &lt;ipaddr&gt;/&lt;masklen&gt;
-exclude &lt;list of prefixes&gt;
    list if ipprefixes that host should not be in
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Return Output</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
ip address
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Examples</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif" color="green">
%::ip::ipHostFromPrefix  1.1.1.5/24
1.1.1.1

%::ip::ipHostFromPrefix  1.1.1.1/32
1.1.1.1
</font></pre></td>
         </tr>
      </table>
      <div style="position: absolute; left: 685px"><a href="#top">Top</a></div><br><table width="700" bgcolor="#eeeeee" border="0" cellpadding="2" cellspacing="0">
         <tr>
            <td bgcolor="#dedede" class="head3" colspan="2"><a name="::ip::reduceToAggregates"></a>
               External Procedure Name: ::ip::reduceToAggregates
            </td>
         </tr>
         <tr>
            <td class="key" colspan="2">Purpose</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630">finds nets that overlap and filters out the more specifc nets</td>
         </tr>
         <tr>
            <td class="key" colspan="2">Synopsis</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
::ip::reduceToAggregates &lt;prefixList&gt;
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Arguments</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
&lt;prefixList&gt;
    prefixList a list in the from of
    is &lt;ipaddr&gt;/&lt;masklen&gt; or native format
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Return Output</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
non-overlapping ip prefixes
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Examples</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif" color="green">

  % ::ip::reduceToAggregates {1.1.1.0/24 1.1.0.0/8  2.1.1.0/24 1.1.1.1/32 }
  1.0.0.0/8 2.1.1.0/24
</font></pre></td>
         </tr>
      </table>
      <div style="position: absolute; left: 685px"><a href="#top">Top</a></div><br><table width="700" bgcolor="#eeeeee" border="0" cellpadding="2" cellspacing="0">
         <tr>
            <td bgcolor="#dedede" class="head3" colspan="2"><a name="::ip::longestPrefixMatch"></a>
               External Procedure Name: ::ip::longestPrefixMatch
            </td>
         </tr>
         <tr>
            <td class="key" colspan="2">Purpose</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630">given host IP finds longest prefix match from set of prefixes</td>
         </tr>
         <tr>
            <td class="key" colspan="2">Synopsis</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
::ip::longestPrefixMatch &lt;ipaddr&gt; &lt;prefixList&gt; [-ipv4]
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Arguments</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
&lt;prefixList&gt;
    is list of &lt;ipaddr&gt; in native or dotted form
&lt;ipaddr&gt;
    ip address in &lt;ipprefix&gt; format, dotted form, or integer form
-ipv4
    the provided integer format addresses are in ipv4 format (default)
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Return Output</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
&lt;ipprefix&gt; that is the most specific match to &lt;ipaddr&gt;
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Examples</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif" color="green">
% ::ip::longestPrefixMatch 1.1.1.1 {1.1.1.0/24 1.0.0.0/8  2.1.1.0/24 1.1.1.0/28 }
1.1.1.0/28
</font></pre></td>
         </tr>
      </table>
      <div style="position: absolute; left: 685px"><a href="#top">Top</a></div><br><table width="700" bgcolor="#eeeeee" border="0" cellpadding="2" cellspacing="0">
         <tr>
            <td bgcolor="#dedede" class="head3" colspan="2"><a name="::ip::cmpDotIP"></a>
               External Procedure Name: ::ip::cmpDotIP
            </td>
         </tr>
         <tr>
            <td class="key" colspan="2">Purpose</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630">helper function for dotted ip address for use in lsort</td>
         </tr>
         <tr>
            <td class="key" colspan="2">Synopsis</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
::ip::cmpDotIP &lt;ipaddr1&gt; &lt;ipaddr2&gt;
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Arguments</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
&lt;ipaddr1&gt; &lt;ipaddr2&gt;
    prefix is in dotted ip address format
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Return Output</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif">
-1 if ipaddr1 is less that ipaddr2
 1 if ipaddr1 is more that ipaddr2
 0 if ipaddr1 and ipaddr2 are equal
</font></pre></td>
         </tr>
         <tr>
            <td class="key" colspan="2">Examples</td>
         </tr>
         <tr>
            <td width="60">&nbsp;</td>
            <td width="630"><pre><font face="Arial, Helvetica, san-serif" color="green">
% lsort -command ip::cmpDotIP {1.0.0.0 2.2.0.0 128.0.0.0 3.3.3.3}
1.0.0.0 2.2.0.0 3.3.3.3 128.0.0.0
</font></pre></td>
         </tr>
      </table>
      <div style="position: absolute; left: 685px"><a href="#top">Top</a></div><a name="over"></a><p>&nbsp;</p>
      <div style="font-family: Arial, Helvetica, sans-serif; font-size: 11px;">
         <table width="700" border="0" cellspacing="2" cellpadding="2">
            <tr>
               <td>
                  <div style="font-family: Arial, Helvetica, sans-serif; font-size: 11px;"><strong>Copyright (c) Cisco Systems, Inc. 
                        <a href="http://wwwin.cisco.com/infosec/policies/info_sensitivity.html">Internal 
                           Use Only</a></strong><br><script language="JavaScript">
               document.write("Last Modified on: " + document.lastModified );
            </script></div>
               </td>
            </tr>
         </table>
      </div>
   </body>
</html>