FBB::Hostent
Wrapper around a struct hostent
- Provided by: libbobcat-dev (Version: 6.11.00-1)
- Source: bobcat
- Report a bug
Wrapper around a struct hostent
#include <bobcat/hostent>
Linking option: -lbobcat
@CLASS objects are wrappers around hostent structs which may be used by other objects. A struct hostent is defined as follows:
struct hostent
{
char *h_name; // official name of host
char **h_aliases; // alias list
int h_addrtype; // host address type (always AF_INET)
int h_length; // length of address
char **h_addr_list; // list of addresses
}
The address fields are binary values of the addresses, each address requiring h_length bytes, the last address being equal to 0. The @CLASS objects offer a C++-like interface to this struct.
FBB
All constructors, members, operators and manipulators, mentioned in this
man-page, are defined in the namespace FBB.
-
The default, copy and move constructors (and the copy and move assignment operators) are available.
#include <iostream>
#include <algorithm>
#include <iterator>
#include <bobcat/hostent>
using namespace std;
using namespace FBB;
int main(int argc, char **argv)
{
Hostent he(gethostbyname("localhost"));
cout << "The local hostname = " << he.hostname() << endl;
cout << "All aliases: " << endl;
copy(he.beginAlias(), he.endAlias(),
ostream_iterator<char const *>(cout, "\n"));
cout << "Addresses:\n";
for (size_t idx = 0; idx < he.nAddresses(); idx++)
cout << he.dottedDecimalAddress(idx) << endl;
}
bobcat/hostent - defines the class interface
None Reported.
Debian Bobcat project files:
Bobcat is an acronym of `Brokken’s Own Base Classes And Templates’.
This is free software, distributed under the terms of the GNU General Public License (GPL).
Frank B. Brokken (f.b.brokken@rug.nl).