1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<!-- lifted from troff+man by doclifter -->
<refentry id='goodmask3'>
<refmeta>
<refentrytitle>IPSEC-GOODMASK</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo class='date'>11 June 2001</refmiscinfo>
<refmiscinfo class="source">libreswan</refmiscinfo>
<refmiscinfo class="manual">Executable programs</refmiscinfo>
</refmeta>
<refnamediv id='name'>
<refname>ipsec-goodmask</refname>
<refname>ipsec-masktobits</refname>
<refname>ipsec-bitstomask</refname>
<refpurpose>check if Internet subnet mask is valid, convert Internet subnet mask to bit count, convert bit count to Internet subnet mask</refpurpose>
</refnamediv>
<!-- body begins here -->
<refsynopsisdiv id='synopsis'>
<funcsynopsis>
<funcsynopsisinfo>
#include <libreswan.h>
</funcsynopsisinfo>
<funcprototype>
<funcdef>int <function>goodmask</function></funcdef>
<paramdef>struct in_addr <parameter>mask</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>int <function>masktobits</function></funcdef>
<paramdef>struct in_addr <parameter>mask</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>struct in_addr <function>bitstomask</function></funcdef>
<paramdef>int <parameter>n</parameter></paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1 id='description'><title>DESCRIPTION</title>
<para>These functions are obsolete;
see
<citerefentry><refentrytitle>ipsec-masktocount</refentrytitle><manvolnum>3</manvolnum></citerefentry>
for a partial replacement.</para>
<para><emphasis>Goodmask</emphasis>
reports whether the subnet
<varname role='parameter'>mask</varname>
is a valid one,
i.e. consists of a (possibly empty) sequence of
<literal>1</literal>s
followed by a (possibly empty) sequence of
<literal>0</literal>s.
<emphasis>Masktobits</emphasis>
takes a (valid) subnet mask and returns the number of
<literal>1</literal>
bits in it.
<emphasis>Bitstomask</emphasis>
reverses this,
returning the subnet mask corresponding to bit count
<varname role='parameter'>n</varname>.</para>
<para>All masks are in network byte order.</para>
</refsect1>
<refsect1 id='see_also'><title>SEE ALSO</title>
<para><citerefentry><refentrytitle>inet</refentrytitle><manvolnum>3</manvolnum></citerefentry>, <citerefentry><refentrytitle>ipsec-atosubnet</refentrytitle><manvolnum>3</manvolnum></citerefentry></para>
</refsect1>
<refsect1 id='diagnostics'><title>DIAGNOSTICS</title>
<para><emphasis>Masktobits</emphasis>
returns
<option>-1</option>
for an invalid mask.
<emphasis>Bitstomask</emphasis>
returns an all-zeros mask for a negative or out-of-range
<varname role='parameter'>n</varname>.</para>
</refsect1>
<refsect1 id='history'><title>HISTORY</title>
<para>Written for the FreeS/WAN project by Henry Spencer.</para>
</refsect1>
<refsect1 id='bugs'><title>BUGS</title>
<para>The error-reporting convention of
<function>bitstomask</function>
is less than ideal;
zero is sometimes a legitimate mask.</para>
</refsect1>
<refsect1 id='author'>
<title>AUTHOR</title>
<para>
<emphasis role='strong'>Paul Wouters</emphasis>
</para>
</refsect1>
</refentry>
|