FBB::Hostent(3bobcat)

struct hostent wrapper
(libbobcat-dev_6.04.00)

2005-2023

NAME

FBB::Hostent - Wrapper around a struct hostent

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

The default, copy and move constructors (and the copy and move assignment operators) are available.

MEMBER FUNCTIONS

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("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;
    }
        

FILES

bobcat/hostent - defines the class interface

SEE ALSO

bobcat(7)

BUGS

None Reported.

BOBCAT PROJECT FILES

BOBCAT

Bobcat is an acronym of `Brokken's Own Base Classes And Templates'.

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