FBB::Hostname(3bobcat) Host Info FBB::Hostname(3bobcat)

FBB::Hostname - Contains name/address info about a host

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

FBB::Hostname objects inherit from Hostent, and offers information about a host, like Hostent. Apart from being initialized by a hostname or host address, they can also be initialized by a FBB::InetAddress object. Most of the functionality of an FBB::Hostname object is available through its parent-class FBB::Hostent.

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

FBB::Hostent

Hostname():
The default constructor initializes an empty FBB::Hostname object.
Hostname((std::string const &host)):
This constructor initializes an FBB::Hostname object from a string representing the name or dotted decimal address of a host. An FBB::Exception object is thrown if the hostname information could not be retrieved.
Hostname(InetAddress const &inetAddress):
This constructor initializes an FBB::Hostname object from an InetAddress object. An FBB::Exception object is thrown if the hostname information could not be retrieved.

Copy and move constructors (and assignment operators) are available.

All members of FBB::Hostent are available, as FBB::Hostname inherits from this class. There are no additional members.

#include <iostream>
#include <bobcat/hostname>
#include <bobcat/exception>
using namespace std;
using namespace FBB;
int main(int argc, char **argv)
{
    while (true)
    {
        cout << "Enter name or address:\n";
        string str;
        if (!getline(cin, str))
            return 0;
        if (str == "")
            break;
        try
        {
            Hostname h(str);
            cout << "Official name:\n";
                cout << h.hostname() << endl;
            cout << "Aliases:\n";
            for (size_t idx = 0; idx < h.nAliases(); idx++)
                cout << h.alias(idx) << " ";
            cout << endl;
            cout << "Adresses:\n";
            for (size_t idx = 0; idx < h.nAddresses(); idx++)
                cout << h.dottedDecimalAddress(idx) << " ";
            cout << endl;
        }
        catch (exception const &err)
        {
            cout << err.what() << endl;
        }
    }
}

bobcat/hostname - defines the class interface

bobcat(7), hostent(3bobcat)

None Reported.

https://fbb-git.gitlab.io/bobcat/: gitlab project page;
bobcat_6.06.02-x.dsc: detached signature;
bobcat_6.06.02-x.tar.gz: source archive;
bobcat_6.06.02-x_i386.changes: change log;
libbobcat1_6.06.02-x_*.deb: debian package containing the libraries;
libbobcat1-dev_6.06.02-x_*.deb: debian package containing the libraries, headers and manual pages;

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

2005-2024 libbobcat-dev_6.06.02