aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPreston Brown <pbrown@redhat.com>2001-04-30 20:56:25 +0000
committerPreston Brown <pbrown@redhat.com>2001-04-30 20:56:25 +0000
commit4b0faa32f3ce02d731ddabf42759402fbee055e9 (patch)
tree5d0910efec30b10f3290ee31a2f790be12569e16
parent1db57c2ff10dc7e581c0c04dc8ce72832a49bcb4 (diff)
downloadinitscripts-4b0faa32f3ce02d731ddabf42759402fbee055e9.tar
initscripts-4b0faa32f3ce02d731ddabf42759402fbee055e9.tar.gz
initscripts-4b0faa32f3ce02d731ddabf42759402fbee055e9.tar.bz2
initscripts-4b0faa32f3ce02d731ddabf42759402fbee055e9.tar.xz
initscripts-4b0faa32f3ce02d731ddabf42759402fbee055e9.zip
documentation for ipcalc added.
-rw-r--r--src/doc/html/doxygen.css20
-rw-r--r--src/doc/html/doxygen.gifbin0 -> 2378 bytes
-rw-r--r--src/doc/html/files.html18
-rw-r--r--src/doc/html/globals.html27
-rw-r--r--src/doc/html/index.html18
-rw-r--r--src/doc/html/ipcalc_c.html381
-rw-r--r--src/doc/man/man3/ipcalc_c.3197
7 files changed, 661 insertions, 0 deletions
diff --git a/src/doc/html/doxygen.css b/src/doc/html/doxygen.css
new file mode 100644
index 00000000..7f8e5b88
--- /dev/null
+++ b/src/doc/html/doxygen.css
@@ -0,0 +1,20 @@
+H1 { text-align: center; }
+A.qindex {}
+A.qindexRef {}
+A.el { text-decoration: none; font-weight: bold }
+A.elRef { font-weight: bold }
+A.code { text-decoration: none; font-weight: normal; color: #4444ee }
+A.codeRef { font-weight: normal; color: #4444ee }
+DL.el { margin-left: -1cm }
+DIV.fragment { width: 100%; border: none; background-color: #eeeeee }
+DIV.ah { background-color: black; margin-bottom: 3; margin-top: 3 }
+TD.md { background-color: #f2f2ff }
+DIV.groupHeader { margin-left: 16; margin-top: 12; margin-bottom: 6; font-weight: bold }
+DIV.groupText { margin-left: 16; font-style: italic; font-size: smaller }
+FONT.keyword { color: #008000 }
+FONT.keywordtype { color: #604020 }
+FONT.keywordflow { color: #e08000 }
+FONT.comment { color: #800000 }
+FONT.preprocessor { color: #806020 }
+FONT.stringliteral { color: #002080 }
+FONT.charliteral { color: #008080 }
diff --git a/src/doc/html/doxygen.gif b/src/doc/html/doxygen.gif
new file mode 100644
index 00000000..192c83ce
--- /dev/null
+++ b/src/doc/html/doxygen.gif
Binary files differ
diff --git a/src/doc/html/files.html b/src/doc/html/files.html
new file mode 100644
index 00000000..22c982f1
--- /dev/null
+++ b/src/doc/html/files.html
@@ -0,0 +1,18 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html><head><meta name="robots" content="noindex">
+<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+<title>File Index</title>
+<link href="doxygen.css" rel="stylesheet" type="text/css">
+</head><body bgcolor="#ffffff">
+<!-- Generated by Doxygen 1.2.6 -->
+<center>
+<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="globals.html">Globals</a> &nbsp; </center>
+<hr><h1>initscripts File List</h1>Here is a list of all documented files with brief descriptions:<ul>
+<li><a class="el" href="ipcalc_c.html">ipcalc.c</a> (Provides utilities for manipulating IP addresses)</ul>
+<hr><address><small>Generated at Mon Apr 30 16:39:02 2001 for initscripts by
+<a href="http://www.doxygen.org/index.html">
+<img src="doxygen.gif" alt="doxygen" align="middle" border=0
+width=110 height=53></a>1.2.6 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>,
+ &copy;&nbsp;1997-2001</small></address>
+</body>
+</html>
diff --git a/src/doc/html/globals.html b/src/doc/html/globals.html
new file mode 100644
index 00000000..d1bb857b
--- /dev/null
+++ b/src/doc/html/globals.html
@@ -0,0 +1,27 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html><head><meta name="robots" content="noindex">
+<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+<title>File Member Index</title>
+<link href="doxygen.css" rel="stylesheet" type="text/css">
+</head><body bgcolor="#ffffff">
+<!-- Generated by Doxygen 1.2.6 -->
+<center>
+<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="globals.html">Globals</a> &nbsp; </center>
+<hr><h1>initscripts Globals</h1>Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation:<ul>
+<li>calc_broadcast()
+: <a class="el" href="ipcalc_c.html#a5">ipcalc.c</a><li>calc_network()
+: <a class="el" href="ipcalc_c.html#a6">ipcalc.c</a><li>default_netmask()
+: <a class="el" href="ipcalc_c.html#a4">ipcalc.c</a><li>get_hostname()
+: <a class="el" href="ipcalc_c.html#a7">ipcalc.c</a><li>IPBITS
+: <a class="el" href="ipcalc_c.html#a0">ipcalc.c</a><li>IPBYTES
+: <a class="el" href="ipcalc_c.html#a1">ipcalc.c</a><li>main()
+: <a class="el" href="ipcalc_c.html#a8">ipcalc.c</a><li>mask2prefix()
+: <a class="el" href="ipcalc_c.html#a3">ipcalc.c</a><li>prefix2mask()
+: <a class="el" href="ipcalc_c.html#a2">ipcalc.c</a></ul>
+<hr><address><small>Generated at Mon Apr 30 16:39:02 2001 for initscripts by
+<a href="http://www.doxygen.org/index.html">
+<img src="doxygen.gif" alt="doxygen" align="middle" border=0
+width=110 height=53></a>1.2.6 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>,
+ &copy;&nbsp;1997-2001</small></address>
+</body>
+</html>
diff --git a/src/doc/html/index.html b/src/doc/html/index.html
new file mode 100644
index 00000000..ef0fe17f
--- /dev/null
+++ b/src/doc/html/index.html
@@ -0,0 +1,18 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html><head><meta name="robots" content="noindex">
+<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+<title>Main Page</title>
+<link href="doxygen.css" rel="stylesheet" type="text/css">
+</head><body bgcolor="#ffffff">
+<!-- Generated by Doxygen 1.2.6 -->
+<center>
+<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="globals.html">Globals</a> &nbsp; </center>
+<hr><h1>initscripts Documentation</h1>
+<p>
+<h3 align="center">$id$</h3><hr><address><small>Generated at Mon Apr 30 16:39:02 2001 for initscripts by
+<a href="http://www.doxygen.org/index.html">
+<img src="doxygen.gif" alt="doxygen" align="middle" border=0
+width=110 height=53></a>1.2.6 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>,
+ &copy;&nbsp;1997-2001</small></address>
+</body>
+</html>
diff --git a/src/doc/html/ipcalc_c.html b/src/doc/html/ipcalc_c.html
new file mode 100644
index 00000000..b1a67d24
--- /dev/null
+++ b/src/doc/html/ipcalc_c.html
@@ -0,0 +1,381 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html><head><meta name="robots" content="noindex">
+<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
+<title>ipcalc.c File Reference</title>
+<link href="doxygen.css" rel="stylesheet" type="text/css">
+</head><body bgcolor="#ffffff">
+<!-- Generated by Doxygen 1.2.6 -->
+<center>
+<a class="qindex" href="index.html">Main Page</a> &nbsp; <a class="qindex" href="files.html">File List</a> &nbsp; <a class="qindex" href="globals.html">Globals</a> &nbsp; </center>
+<hr><h1>ipcalc.c File Reference</h1>provides utilities for manipulating IP addresses.
+<a href="#_details">More...</a>
+<p>
+<code>#include &lt;ctype.h&gt;</code><br>
+<code>#include &lt;popt.h&gt;</code><br>
+<code>#include &lt;stdio.h&gt;</code><br>
+<code>#include &lt;stdlib.h&gt;</code><br>
+<code>#include &lt;string.h&gt;</code><br>
+<code>#include &lt;sys/socket.h&gt;</code><br>
+<code>#include &lt;netinet/in.h&gt;</code><br>
+<code>#include &lt;arpa/inet.h&gt;</code><br>
+<code>#include &lt;netdb.h&gt;</code><br>
+<table border=0 cellpadding=0 cellspacing=0>
+<tr><td colspan=2><br><h2>Defines</h2></td></tr>
+<tr><td nowrap align=right valign=top><a name="a0" doxytag="ipcalc.c::IPBITS"></a>
+#define&nbsp;</td><td valign=bottom><a class="el" href="ipcalc_c.html#a0">IPBITS</a>&nbsp;&nbsp;&nbsp;(sizeof(unsigned long int) * 8)</td></tr>
+<tr><td>&nbsp;</td><td><font size=-1><em>the number of bits in an IP address.</em></font><br><br></td></tr>
+<tr><td nowrap align=right valign=top><a name="a1" doxytag="ipcalc.c::IPBYTES"></a>
+#define&nbsp;</td><td valign=bottom><a class="el" href="ipcalc_c.html#a1">IPBYTES</a>&nbsp;&nbsp;&nbsp;(sizeof(unsigned long int))</td></tr>
+<tr><td>&nbsp;</td><td><font size=-1><em>the number of bytes in an IP address.</em></font><br><br></td></tr>
+<tr><td colspan=2><br><h2>Functions</h2></td></tr>
+<tr><td nowrap align=right valign=top>unsigned long int&nbsp;</td><td valign=bottom><a class="el" href="ipcalc_c.html#a2">prefix2mask</a> (int prefix)</td></tr>
+<tr><td>&nbsp;</td><td><font size=-1><em>creates a netmask from a specified number of bits.</em> <a href="#a2">More...</a><em></em></font><br><br></td></tr>
+<tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="ipcalc_c.html#a3">mask2prefix</a> (unsigned long int mask)</td></tr>
+<tr><td>&nbsp;</td><td><font size=-1><em>calculates the number of bits masked off by a netmask.</em> <a href="#a3">More...</a><em></em></font><br><br></td></tr>
+<tr><td nowrap align=right valign=top>unsigned long int&nbsp;</td><td valign=bottom><a class="el" href="ipcalc_c.html#a4">default_netmask</a> (unsigned long int addr)</td></tr>
+<tr><td>&nbsp;</td><td><font size=-1><em>returns the default (canonical) netmask associated with specified IP address.</em> <a href="#a4">More...</a><em></em></font><br><br></td></tr>
+<tr><td nowrap align=right valign=top>unsigned long int&nbsp;</td><td valign=bottom><a class="el" href="ipcalc_c.html#a5">calc_broadcast</a> (unsigned long int addr, int prefix)</td></tr>
+<tr><td>&nbsp;</td><td><font size=-1><em>calculate broadcast address given an IP address and a prefix length.</em> <a href="#a5">More...</a><em></em></font><br><br></td></tr>
+<tr><td nowrap align=right valign=top>unsigned long int&nbsp;</td><td valign=bottom><a class="el" href="ipcalc_c.html#a6">calc_network</a> (unsigned long int addr, int prefix)</td></tr>
+<tr><td>&nbsp;</td><td><font size=-1><em>calculates the network address for a specified address and prefix.</em> <a href="#a6">More...</a><em></em></font><br><br></td></tr>
+<tr><td nowrap align=right valign=top>const char*&nbsp;</td><td valign=bottom><a class="el" href="ipcalc_c.html#a7">get_hostname</a> (unsigned long int addr)</td></tr>
+<tr><td>&nbsp;</td><td><font size=-1><em>returns the hostname associated with the specified IP address.</em> <a href="#a7">More...</a><em></em></font><br><br></td></tr>
+<tr><td nowrap align=right valign=top>int&nbsp;</td><td valign=bottom><a class="el" href="ipcalc_c.html#a8">main</a> (int argc, const char **argv)</td></tr>
+<tr><td>&nbsp;</td><td><font size=-1><em>wrapper program for ipcalc functions.</em> <a href="#a8">More...</a><em></em></font><br><br></td></tr>
+</table>
+<hr><a name="_details"></a><h2>Detailed Description</h2>
+provides utilities for manipulating IP addresses.
+<p>
+
+<p>
+
+<p>
+ ipcalc provides utilities and a front-end command line interface for manipulating IP addresses, and calculating various aspects of an ip address/netmask/network address/prefix/etc.
+<p>
+Functionality can be accessed from other languages from the library interface, documented here. To use ipcalc from the shell, read the ipcalc(1) manual page.
+<p>
+When passing parameters to the various functions, take note of whether they take host byte order or network byte order. Most take host byte order, and return host byte order, but there are some exceptions.
+<p>
+<hr><h2>Function Documentation</h2>
+<a name="a5" doxytag="ipcalc.c::calc_broadcast"></a><p>
+<table width="100%" cellpadding="2" cellspacing="0" border="0">
+ <tr>
+ <td class="md">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td nowrap valign="top"><b>
+unsigned long int calc_broadcast (
+ </b></td>
+ <td valign="bottom"><b>
+unsigned long int <em>addr</em>,
+ </b></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td><b>
+int <em>prefix</em>&nbsp;)
+ </b></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+calculate broadcast address given an IP address and a prefix length.
+<p>
+
+<p>
+ <dl compact><dt>
+<b>Parameters: </b><dd>
+<table border=0 cellspacing=2 cellpadding=0>
+<tr><td valign=top><em>addr</em>
+&nbsp;</td><td>
+an IP address in network byte order. </td></tr>
+<tr><td valign=top><em>prefix</em>
+&nbsp;</td><td>
+a prefix length.
+<p>
+</td></tr>
+</table>
+</dl><dl compact><dt>
+<b>Returns: </b><dd>
+the calculated broadcast address for the network, in network byte order. </dl> </td>
+ </tr>
+</table>
+<a name="a6" doxytag="ipcalc.c::calc_network"></a><p>
+<table width="100%" cellpadding="2" cellspacing="0" border="0">
+ <tr>
+ <td class="md">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td nowrap valign="top"><b>
+unsigned long int calc_network (
+ </b></td>
+ <td valign="bottom"><b>
+unsigned long int <em>addr</em>,
+ </b></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td><b>
+int <em>prefix</em>&nbsp;)
+ </b></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+calculates the network address for a specified address and prefix.
+<p>
+
+<p>
+ <dl compact><dt>
+<b>Parameters: </b><dd>
+<table border=0 cellspacing=2 cellpadding=0>
+<tr><td valign=top><em>addr</em>
+&nbsp;</td><td>
+an IP address, in network byte order </td></tr>
+<tr><td valign=top><em>prefix</em>
+&nbsp;</td><td>
+the network prefix </td></tr>
+</table>
+</dl><dl compact><dt>
+<b>Returns: </b><dd>
+the base address of the network that addr is associated with, in network byte order. </dl> </td>
+ </tr>
+</table>
+<a name="a4" doxytag="ipcalc.c::default_netmask"></a><p>
+<table width="100%" cellpadding="2" cellspacing="0" border="0">
+ <tr>
+ <td class="md">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td nowrap valign="top"><b>
+unsigned long int default_netmask (
+ </b></td>
+ <td valign="bottom"><b>
+unsigned long int <em>addr</em>&nbsp;)
+ </b></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+returns the default (canonical) netmask associated with specified IP address.
+<p>
+
+<p>
+ When the Internet was originally set up, various ranges of IP addresses were segmented into three network classes: A, B, and C. This function will return a netmask that is associated with the IP address specified defining where it falls in the predefined classes.<dl compact><dt>
+<b>Parameters: </b><dd>
+<table border=0 cellspacing=2 cellpadding=0>
+<tr><td valign=top><em>addr</em>
+&nbsp;</td><td>
+an IP address in network byte order. </td></tr>
+</table>
+</dl><dl compact><dt>
+<b>Returns: </b><dd>
+a netmask in network byte order. </dl> </td>
+ </tr>
+</table>
+<a name="a7" doxytag="ipcalc.c::get_hostname"></a><p>
+<table width="100%" cellpadding="2" cellspacing="0" border="0">
+ <tr>
+ <td class="md">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td nowrap valign="top"><b>
+const char * get_hostname (
+ </b></td>
+ <td valign="bottom"><b>
+unsigned long int <em>addr</em>&nbsp;)
+ </b></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+returns the hostname associated with the specified IP address.
+<p>
+
+<p>
+ <dl compact><dt>
+<b>Parameters: </b><dd>
+<table border=0 cellspacing=2 cellpadding=0>
+<tr><td valign=top><em>addr</em>
+&nbsp;</td><td>
+an IP address to find a hostname for, in network byte order
+<p>
+</td></tr>
+</table>
+</dl><dl compact><dt>
+<b>Returns: </b><dd>
+a hostname, or NULL if one cannot be determined. Hostname is stored in a static buffer that may disappear at any time, the caller should copy the data if it needs permanent storage. </dl> </td>
+ </tr>
+</table>
+<a name="a8" doxytag="ipcalc.c::main"></a><p>
+<table width="100%" cellpadding="2" cellspacing="0" border="0">
+ <tr>
+ <td class="md">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td nowrap valign="top"><b>
+main (
+ </b></td>
+ <td valign="bottom"><b>
+int <em>argc</em>,
+ </b></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td><b>
+const char ** <em>argv</em>&nbsp;)
+ </b></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+wrapper program for ipcalc functions.
+<p>
+
+<p>
+ This is a wrapper program for the functions that the ipcalc library provides. It can be used from shell scripts or directly from the command line.
+<p>
+For more information, please see the ipcalc(1) man page. </td>
+ </tr>
+</table>
+<a name="a3" doxytag="ipcalc.c::mask2prefix"></a><p>
+<table width="100%" cellpadding="2" cellspacing="0" border="0">
+ <tr>
+ <td class="md">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td nowrap valign="top"><b>
+int mask2prefix (
+ </b></td>
+ <td valign="bottom"><b>
+unsigned long int <em>mask</em>&nbsp;)
+ </b></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+calculates the number of bits masked off by a netmask.
+<p>
+
+<p>
+ This function calculates the significant bits in an IP address as specified by a netmask. See also <a class="el" href="ipcalc_c.html#a2">prefix2mask</a>.<dl compact><dt>
+<b>Parameters: </b><dd>
+<table border=0 cellspacing=2 cellpadding=0>
+<tr><td valign=top><em>mask</em>
+&nbsp;</td><td>
+is the netmask, specified as an unsigned long integer in network byte order. </td></tr>
+</table>
+</dl><dl compact><dt>
+<b>Returns: </b><dd>
+the number of significant bits. </dl> </td>
+ </tr>
+</table>
+<a name="a2" doxytag="ipcalc.c::prefix2mask"></a><p>
+<table width="100%" cellpadding="2" cellspacing="0" border="0">
+ <tr>
+ <td class="md">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td nowrap valign="top"><b>
+unsigned long int prefix2mask (
+ </b></td>
+ <td valign="bottom"><b>
+int <em>bits</em>&nbsp;)
+ </b></td>
+ </tr>
+
+ </table>
+ </td>
+ </tr>
+</table>
+<table cellspacing=5 cellpadding=0 border=0>
+ <tr>
+ <td>
+ &nbsp;
+ </td>
+ <td>
+
+<p>
+creates a netmask from a specified number of bits.
+<p>
+
+<p>
+ This function converts a prefix length to a netmask. As CIDR (classless internet domain internet domain routing) has taken off, more an more IP addresses are being specified in the format address/prefix (i.e. 192.168.2.3/24, with a corresponding netmask 255.255.255.0). If you need to see what netmask corresponds to the prefix part of the address, this is the function. See also <a class="el" href="ipcalc_c.html#a3">mask2prefix</a>.<dl compact><dt>
+<b>Parameters: </b><dd>
+<table border=0 cellspacing=2 cellpadding=0>
+<tr><td valign=top><em>prefix</em>
+&nbsp;</td><td>
+is the number of bits to create a mask for. </td></tr>
+</table>
+</dl><dl compact><dt>
+<b>Returns: </b><dd>
+a network mask, in network byte order. </dl> </td>
+ </tr>
+</table>
+<hr><address><small>Generated at Mon Apr 30 16:39:02 2001 for initscripts by
+<a href="http://www.doxygen.org/index.html">
+<img src="doxygen.gif" alt="doxygen" align="middle" border=0
+width=110 height=53></a>1.2.6 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>,
+ &copy;&nbsp;1997-2001</small></address>
+</body>
+</html>
diff --git a/src/doc/man/man3/ipcalc_c.3 b/src/doc/man/man3/ipcalc_c.3
new file mode 100644
index 00000000..04b0ac97
--- /dev/null
+++ b/src/doc/man/man3/ipcalc_c.3
@@ -0,0 +1,197 @@
+.TH "ipcalc.c" 3 "30 Apr 2001" "initscripts" \" -*- nroff -*-
+.ad l
+.nh
+.SH NAME
+ipcalc.c \- provides utilities for manipulating IP addresses.
+.SH SYNOPSIS
+.br
+.PP
+\fC#include <ctype.h>\fR
+.br
+\fC#include <popt.h>\fR
+.br
+\fC#include <stdio.h>\fR
+.br
+\fC#include <stdlib.h>\fR
+.br
+\fC#include <string.h>\fR
+.br
+\fC#include <sys/socket.h>\fR
+.br
+\fC#include <netinet/in.h>\fR
+.br
+\fC#include <arpa/inet.h>\fR
+.br
+\fC#include <netdb.h>\fR
+.br
+
+.SS Defines
+
+.in +1c
+.ti -1c
+.RI "#define \fBIPBITS\fR (sizeof(unsigned long int) * 8)"
+.br
+.RI "\fIthe number of bits in an IP address.\fR"
+.ti -1c
+.RI "#define \fBIPBYTES\fR (sizeof(unsigned long int))"
+.br
+.RI "\fIthe number of bytes in an IP address.\fR"
+.in -1c
+.SS Functions
+
+.in +1c
+.ti -1c
+.RI "unsigned long int \fBprefix2mask\fR (int prefix)"
+.br
+.RI "\fIcreates a netmask from a specified number of bits.\fR"
+.ti -1c
+.RI "int \fBmask2prefix\fR (unsigned long int mask)"
+.br
+.RI "\fIcalculates the number of bits masked off by a netmask.\fR"
+.ti -1c
+.RI "unsigned long int \fBdefault_netmask\fR (unsigned long int addr)"
+.br
+.RI "\fIreturns the default (canonical) netmask associated with specified IP address.\fR"
+.ti -1c
+.RI "unsigned long int \fBcalc_broadcast\fR (unsigned long int addr, int prefix)"
+.br
+.RI "\fIcalculate broadcast address given an IP address and a prefix length.\fR"
+.ti -1c
+.RI "unsigned long int \fBcalc_network\fR (unsigned long int addr, int prefix)"
+.br
+.RI "\fIcalculates the network address for a specified address and prefix.\fR"
+.ti -1c
+.RI "const char* \fBget_hostname\fR (unsigned long int addr)"
+.br
+.RI "\fIreturns the hostname associated with the specified IP address.\fR"
+.ti -1c
+.RI "int \fBmain\fR (int argc, const char **argv)"
+.br
+.RI "\fIwrapper program for ipcalc functions.\fR"
+.in -1c
+.SH DETAILED DESCRIPTION
+.PP
+provides utilities for manipulating IP addresses.
+.PP
+.PP
+ ipcalc provides utilities and a front-end command line interface for manipulating IP addresses, and calculating various aspects of an ip address/netmask/network address/prefix/etc.
+.PP
+Functionality can be accessed from other languages from the library interface, documented here. To use ipcalc from the shell, read the ipcalc(1) manual page.
+.PP
+When passing parameters to the various functions, take note of whether they take host byte order or network byte order. Most take host byte order, and return host byte order, but there are some exceptions.
+.PP
+.SH FUNCTION DOCUMENTATION
+.PP
+.SS unsigned long int calc_broadcast (unsigned long int addr, int prefix)
+.PP
+calculate broadcast address given an IP address and a prefix length.
+.PP
+.PP
+
+.PP
+\fBParameters: \fR
+.in +1c
+.TP
+\fB\fIaddr\fR\fR
+an IP address in network byte order.
+.TP
+\fB\fIprefix\fR\fR
+a prefix length.
+.PP
+\fBReturns: \fR
+.in +1c
+the calculated broadcast address for the network, in network byte order.
+.SS unsigned long int calc_network (unsigned long int addr, int prefix)
+.PP
+calculates the network address for a specified address and prefix.
+.PP
+.PP
+
+.PP
+\fBParameters: \fR
+.in +1c
+.TP
+\fB\fIaddr\fR\fR
+an IP address, in network byte order
+.TP
+\fB\fIprefix\fR\fR
+the network prefix
+.PP
+\fBReturns: \fR
+.in +1c
+the base address of the network that addr is associated with, in network byte order.
+.SS unsigned long int default_netmask (unsigned long int addr)
+.PP
+returns the default (canonical) netmask associated with specified IP address.
+.PP
+.PP
+ When the Internet was originally set up, various ranges of IP addresses were segmented into three network classes: A, B, and C. This function will return a netmask that is associated with the IP address specified defining where it falls in the predefined classes.
+.PP
+\fBParameters: \fR
+.in +1c
+.TP
+\fB\fIaddr\fR\fR
+an IP address in network byte order.
+.PP
+\fBReturns: \fR
+.in +1c
+a netmask in network byte order.
+.SS const char * get_hostname (unsigned long int addr)
+.PP
+returns the hostname associated with the specified IP address.
+.PP
+.PP
+
+.PP
+\fBParameters: \fR
+.in +1c
+.TP
+\fB\fIaddr\fR\fR
+an IP address to find a hostname for, in network byte order
+.PP
+\fBReturns: \fR
+.in +1c
+a hostname, or NULL if one cannot be determined. Hostname is stored in a static buffer that may disappear at any time, the caller should copy the data if it needs permanent storage.
+.SS main (int argc, const char ** argv)
+.PP
+wrapper program for ipcalc functions.
+.PP
+.PP
+ This is a wrapper program for the functions that the ipcalc library provides. It can be used from shell scripts or directly from the command line.
+.PP
+For more information, please see the ipcalc(1) man page.
+.SS int mask2prefix (unsigned long int mask)
+.PP
+calculates the number of bits masked off by a netmask.
+.PP
+.PP
+ This function calculates the significant bits in an IP address as specified by a netmask. See also \fBprefix2mask\fR.
+.PP
+\fBParameters: \fR
+.in +1c
+.TP
+\fB\fImask\fR\fR
+is the netmask, specified as an unsigned long integer in network byte order.
+.PP
+\fBReturns: \fR
+.in +1c
+the number of significant bits.
+.SS unsigned long int prefix2mask (int bits)
+.PP
+creates a netmask from a specified number of bits.
+.PP
+.PP
+ This function converts a prefix length to a netmask. As CIDR (classless internet domain internet domain routing) has taken off, more an more IP addresses are being specified in the format address/prefix (i.e. 192.168.2.3/24, with a corresponding netmask 255.255.255.0). If you need to see what netmask corresponds to the prefix part of the address, this is the function. See also \fBmask2prefix\fR.
+.PP
+\fBParameters: \fR
+.in +1c
+.TP
+\fB\fIprefix\fR\fR
+is the number of bits to create a mask for.
+.PP
+\fBReturns: \fR
+.in +1c
+a network mask, in network byte order.
+.SH AUTHOR
+.PP
+Generated automatically by Doxygen for initscripts from the source code. \ No newline at end of file