/usr/share/doc/libbobcat4-dev/man/cidr.3.html is in libbobcat-dev 4.01.03-2ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | <!DOCTYPE html><html><head>
<meta charset="UTF-8">
<title>FBB::Cidr</title>
<style type="text/css">
figure {text-align: center;}
img {vertical-align: center;}
</style>
<link rev="made" href="mailto:Frank B. Brokken: f.b.brokken@rug.nl">
</head>
<body text="#27408B" bgcolor="#FFFAF0">
<hr>
<h1>FBB::Cidr</h1>
<h2>libbobcat-dev_4.01.03-x.tar.gz</h2>
<h2>2005-2015</h2>
<!DOCTYPE html><html><head>
<meta charset="UTF-8">
<style type="text/css">
figure {text-align: center;}
img {vertical-align: center;}
figure {text-align: center;}
img {vertical-align: center;}
</style>
<link rev="made" href="mailto:Frank B. Brokken: f.b.brokken@rug.nl">
</head>
<body text="#27408B" bgcolor="#FFFAF0">
<hr>
<h1></h1>
<!DOCTYPE html><html><head>
<meta charset="UTF-8">
<title>FBB::Cidr(3bobcat)</title>
<style type="text/css">
figure {text-align: center;}
img {vertical-align: center;}
figure {text-align: center;}
img {vertical-align: center;}
figure {text-align: center;}
img {vertical-align: center;}
</style>
<link rev="made" href="mailto:Frank B. Brokken: f.b.brokken@rug.nl">
</head>
<body text="#27408B" bgcolor="#FFFAF0">
<hr>
<h1>FBB::Cidr(3bobcat)</h1>
<h2>libbobcat-dev_4.01.03-x.tar.gz CIDR matching</h2>
<h2>2005-2015</h2>
<p>
<h2>NAME</h2>FBB::Cidr - Compares IP4 addresses to CIDR specifications
<p>
<h2>SYNOPSIS</h2>
<strong>#include <bobcat/cidr></strong><br>
Linking option: <em>-lbobcat</em>
<p>
<h2>DESCRIPTION</h2>
<p>
Objects of the class <em>Cidr</em> can be used for testing whether IP4 Internet
addresses belong to address ranges defined by Classless Inter-Domain Routing
(CIDR) address block specifications. CIDR blocks are specified as
<em>a.b.c.d/m</em> where <em>a.b.c.d</em> are the four octets of a dotted decimal IP4
address specification (e.g., 129.125.14.80) and <em>m</em> is a mask-size (ranging
from 0 to 32) defining the number of most significant bits to remain
as-is. The CIDR specification 129.125.14.80/16 defines a class B network,
with addresses ranging from 129.125.0.0 to 129.125.255.255.
<p>
The mask size does not have to be a multiple of 8. E.g., when specifying
129.125.14.80/5 only the most significant 5 bits of the first octed are fixed,
resulting in an address range ranging from 128.0.0.0 to 135.255.255.255.
<p>
CIDR specifications passed to a <em>Cidr</em> object must be of the form
<em>a.b.c.d</em> or <em>a.b.c.d/m</em>. If the mask is not specified a mask-size of 32
is used, effectively defining an address range of only one address. Mask
values of 0 are ignored. Mask values of 0 are ignored by <em>Cidr</em> objects.
<p>
When specifying CIDRs on a stream, empty lines and comment lines (having a
hash-character (#) as their first non-blank character) are ignored.
Non-empty lines must start with a CIDR specification, and the <em>Cidr</em> object
will ignore all information on a line trailing a CIDR specification.
<p>
<h2>NAMESPACE</h2>
<strong>FBB</strong><br>
All constructors, members, operators and manipulators, mentioned in this
man-page, are defined in the namespace <strong>FBB</strong>.
<p>
<h2>INHERITS FROM</h2>
-
<p>
<h2>CONSTRUCTORS</h2>
<ul>
<li> <strong>Cidr(std::string const &cidrPattern)</strong>:<br>
The <em>Cidr</em> object is initialized with a single CIDR specification.
<p>
<li> <strong>Cidr(std::istream &cidrStream)</strong>:<br>
The <em>Cidr</em> object is initialized with CIDR specifications
read from the <em>std::istream cidrStream</em>.
</ul>
The default, copy and move constructors are available.
<p>
<h2>OVERLOADED OPERATORS</h2>
<p>
The copy and move assignment operators are available.
<p>
<h2>MEMBER FUNCTIONS</h2>
<p>
The return valuess of the accessors (i.e., the <em>const</em> members) are only
defined following a successful match (see below, the <em>match</em> members).
<p>
<ul>
<li> <strong>std::string const &address() const</strong>:<br>
returns the address matching a CIDR.
<p>
<li> <strong>std::string cidr() const</strong>:<br>
returns the CIDR containing a specified address.
<p>
<li> <strong>std::string first() const</strong>:<br>
returns the first address of the range of addresses defined by the
CIDR specification.
<p>
<li> <strong>std::string last() const</strong>:<br>
returns the last address of the range of addresses defined by the
CIDR specification. Note that <em>first, last</em> do not define an
iterator range. The address returned by <em>last</em> still belongs to the
CIDR-range.
<p>
<li> <strong>bool match(std::istream &in)</strong>:<br>
The value <em>true</em> is returned when an IP4 address found in the lines
of <em>in</em> belongs to a CIDR range inspected by the <em>Cidr</em>
object. The <em>match</em> function returns <em>true</em> at the first matching
address. E.g., if a line contains the text
<pre>
This is address 1.2.3.4 and this is 5.6.7.8
</pre>
and the CIDR specifications
<pre>
5.1.1.1/8
1.2.1.1/16
</pre>
were provided to the <em>Cidr</em> object, then the object will report a
match for <em>5.6.7.8</em>.
<p>
As soon as a match is found <em>match</em> returns
<em>true</em>. If none of the addresses found in the lines of <em>in</em>
matches any of the object's CIDR specifications, <em>false</em> is
returned.
<p>
<li> <strong>std::string mask() const</strong>:<br>
returns the mask used by the <em>CIDR</em> specification.
<p>
<li> <strong>bool match(std::string const &line)</strong>:<br>
The value <em>true</em> is returned when an IP4 address found in <em>line</em>
belongs to a CIDR range inspected by the <em>Cidr</em> object. The
<em>match</em> function returns <em>true</em> at the first matching address.
<p>
If none of the addresses found in <em>line</em> matches any of the object's
CIDR specifications, <em>false</em> is returned.
<p>
<li> <strong>void setCidr(std::istream &cidrStream)</strong>:<br>
A new set of CIDR specification is loaded into the <em>Cidr</em> object,
reading the specifications from <em>cidrStream</em>.
<p>
<li> <strong>void setCidr(std::string const &cidrPattern)</strong>:<br>
A new CIDR specification is loaded into the <em>Cidr</em> object, using the
specification found in <em>cidrPattern</em>. The
<em>Cidr</em> object is initialized with a single CIDR specification which
must be of the form <em>a.b.c.d</em> or <em>a.b.c.d/m</em>. If the mask is not
specified a mask-size of 32 is used, effectively defining an address
range of only one address. Mask values of 0 are ignored.
</ul>
<p>
<h2>STATIC MEMBERS</h2>
<ul>
<li> <strong>size_t dotted2binary(std::string const &dotted)</strong>:<br>
Converts "a.b.c.d" to a 32-bits value
<p>
<li> <strong>std::string binary2dotted(size_t binary)</strong>:<br>
Converts a 32-bits value to a dotted decimal IP4 address
</ul>
<p>
<h2>EXAMPLE</h2>
<pre>
#include <fstream>
#include <iostream>
#include <bobcat/exception>
#ifdef BOBCAT
#include <bobcat/cidr>
#else
#include "cidr"
#endif
using namespace std;
using namespace FBB;
int main(int argc, char **argv)
{
enum Spec
{
NONE,
FILE,
CIN
};
Spec spec = CIN;
ifstream in;
if (argc > 1)
{
Exception::open(in, argv[1]); // file containing cidr-specs
spec = FILE;
}
while (true)
{
string cidrSpec;
if (spec == CIN)
{
cout << "Specify cidr (empty to quit): ";
if (!getline(cin, cidrSpec) || cidrSpec.empty())
break;
}
try
{
Cidr cidr;
switch (spec)
{
case NONE:
return 0;
case FILE:
cidr.setCidr(in);
spec = NONE;
break;
case CIN:
cidr.setCidr(cidrSpec);
}
while (true)
{
cout << "Specify address to test (empty to " <<
(spec == CIN ? "respec. CIDR" : "quit") << "): ";
string address;
if (!getline(cin, address) || address.empty())
break;
if (!cidr.match(address))
{
cout << "Address " << address << " not in ";
if (spec == CIN)
cout << cidrSpec << '\n';
else
cout << "specifications in " << argv[1] << '\n';
}
else
cout << "Address " << address << " in " << cidr.cidr() <<
"\n"
"Lowest address: " << cidr.first() << "\n"
"Highest address: " << cidr.last() << "\n"
"CIDR mask: " << cidr.mask() << "\n"
"Address: " << cidr.address() << '\n';
}
}
catch (exception const &err)
{
cout << "Oops... " << err.what() << "\n"
"Try again...\n";
}
}
}
</pre>
<p>
<h2>FILES</h2>
<em>bobcat/cidr</em> - defines the class interface
<p>
<h2>SEE ALSO</h2>
<strong>bobcat</strong>(7)
<p>
<h2>BUGS</h2>
Members of <em>Cidr</em> use static data. The current implementation of
<em>Cidr</em> is therefore not thread-safe.
<p>
<h2>DISTRIBUTION FILES</h2>
<ul>
<li> <em>bobcat_4.01.03-x.dsc</em>: detached signature;
<li> <em>bobcat_4.01.03-x.tar.gz</em>: source archive;
<li> <em>bobcat_4.01.03-x_i386.changes</em>: change log;
<li> <em>libbobcat1_4.01.03-x_*.deb</em>: debian package holding the
libraries;
<li> <em>libbobcat1-dev_4.01.03-x_*.deb</em>: debian package holding the
libraries, headers and manual pages;
<li> <em>http://sourceforge.net/projects/bobcat</em>: public archive location;
</ul>
<p>
<h2>BOBCAT</h2>
Bobcat is an acronym of `Brokken's Own Base Classes And Templates'.
<p>
<h2>COPYRIGHT</h2>
This is free software, distributed under the terms of the
GNU General Public License (GPL).
<p>
<h2>AUTHOR</h2>
Frank B. Brokken (<strong>f.b.brokken@rug.nl</strong>).
<p>
|