hostname(3bobcat)

hostname3bobcat

Contains name/address info about a host

Usage

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

Overview

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.

Namespace

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

Inherits from

FBB::Hostent

Constructors

o

Hostname():
The default constructor initializes an empty FBB::Hostname object.

o

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.

o

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.

Member functions

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

Examples

#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;
        }
    }
}

Files

bobcat/hostname - defines the class interface

Bobcat project files

o

https://fbb-git.gitlab.io/bobcat/: gitlab project page;

Debian Bobcat project files:

o

libbobcat6: debian package containing the shared library, changelog and copyright note;

o

libbobcat-dev: debian package containing the static library, headers, manual pages, and developer info;

Bobcat

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

Releases

10 releases since Debian 4.0 (Etch); the text changed 9 times.

  1. 4.0
  2. 5.0
  3. 6.0
  4. 7
  5. 8
  6. 9
  7. 10
  8. 11
  9. 12
  10. 13

Bugs

None Reported.

Author

Frank B. Brokken ([email protected]).

From libbobcat-dev 6.07.01-2 in Debian 13 (Trixie). Parsed by carta from the page's man source.