GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  HOSTENT (3)

NAME

FBB::Hostent - Wrapper around a struct hostent

CONTENTS

SYNOPSIS

#include <bobcat/hostent>
Linking option: -lbobcat

DESCRIPTION

@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.

NAMESPACE

FBB
All constructors, members, operators and manipulators, mentioned in this man-page, are defined in the namespace FBB.

INHERITS FROM

-

CONSTRUCTORS

o Hostent(hostent const *hostentPtr):
This constructor initializes an @CLASS object from an existing hostent struct. Functions like gethostbyname(3) and gethostbyaddress(3) return pointers to hostent structs.

The default, copy and move constructors are available.

MEMBER FUNCTIONS

o size_t addressLength() const:
This member returns the length of the binary addresses in bytes.
o size_t addressType() const:
This member returns the type of the address. Currently this is always AF_INET.
o char const *alias(size_t index) const:
This member returns alias ‘index\(cq of the host. The first alias has index 0. If alias ‘index\(cq does not exist, 0 is returned.
o char const * const *beginAlias() const:
This member returns an iterator to the first alias. The hostname itself is not included in the list of aliases.
o char const *binaryAddress(size_t index) const:
This member returns the binary address ‘index\(cq of the host. The first address has index 0. If address ‘index\(cq does not exist, 0 is returned. The pointer to the binary address points to a series of addressLength() bytes. Note that the returned address is in network byte order. It can be converted to host byte order by the functions described in byteorder(3).
o std::string dottedDecimalAddress(size_t index) const:
This member returns address ‘index\(cq as a dotted decimal address in a string. The first address has index 0. If address ‘index\(cq does not exist, an empty string is returned.
o char const * const *endAlias() const:
This member returns an iterator pointing beyond the last alias.
o char const *hostname() const:
This member returns the standard (first) name of the host.
o size_t nAddresses() const:
This member returns the number of addresses that are available. When requesting a particular address, the requested index should be less than the value returned by this member.
o size_t nAliases() const:
This member returns the number of aliases that are available. When requesting a particular alias, the requested index should be less than the value returned by this member.
o void swap(Hostent &other):
The current Hostent object\(cqs contents are swapped with the other object\(cqs contents.

The overloaded assignment operator and the move-aware overloaded assignment operators are available.

EXAMPLE

#include <iostream> #include <algorithm> #include <iterator> #include <bobcat/hostent> using namespace std; using namespace FBB; int main(int argc, char **argv) { Hostent he(gethostbyname(\(dqlocalhost\(dq));

cout << \(dqThe local hostname = \(dq << he.hostname() << endl;

cout << \(dqAll aliases: \(dq << endl; copy(he.beginAlias(), he.endAlias(), ostream_iterator<char const *>(cout, \(dq\n\(dq));

cout << \(dqAddresses:\n\(dq; for (size_t idx = 0; idx < he.nAddresses(); idx++) cout << he.dottedDecimalAddress(idx) << endl;

return 0; }

FILES

bobcat/hostent - defines the class interface

SEE ALSO

bobcat(7)

BUGS

None Reported.

DISTRIBUTION FILES

o bobcat_3.25.01-x.dsc: detached signature;
o bobcat_3.25.01-x.tar.gz: source archive;
o bobcat_3.25.01-x_i386.changes: change log;
o libbobcat1_3.25.01-x_*.deb: debian package holding the libraries;
o libbobcat1-dev_3.25.01-x_*.deb: debian package holding the libraries, headers and manual pages;
o http://sourceforge.net/projects/bobcat: public archive location;

BOBCAT

Bobcat is an acronym of ‘Brokken\(cqs Own Base Classes And Templates\(cq.

COPYRIGHT

This is free software, distributed under the terms of the GNU General Public License (GPL).

AUTHOR

Frank B. Brokken (f.b.brokken@rug.nl).

Search for    or go to Top of page |  Section 3 |  Main Index


libbobcat-dev_3&.25&.01-x&.tar&.gz FBB::HOSTENT (3bobcat) 2005-2015

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.