FBB::Hostent(3bobcat)
π FBB::Hostent β it's in the 3bobcat manual, bestie π
okay so welcome to FBB::Hostent(3bobcat), the lil' struct-hostent-wrapper that lives in the bobcat fam. she's giving "glow-up for a C struct" and honestly? she ate. π¦
β¨ NAME β¨
FBB::Hostent β a Wrapper around a struct hostent. that's it, that's the whole vibe π
β¨ SYNOPSIS β¨
#include <bobcat/hostent>
Linking option: -lbobcat
yk how you link things β you gotta pass -lbobcat or she simply will not show up. periodt. π
πΈ DESCRIPTION πΈ
@CLASS objects are wrappers around hostent structs, and other objects can use them, which is the entire point, no cap. a struct hostent is defined like this, and you're getting it verbatim because we do not mess with the lore:
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
}
so the address fields are binary values of the addresses, and every single address needs h_length bytes to itself. the last address is equal to 0, which is the little "we're done here" signal π. the @CLASS objects are out here offering a C++-like interface to this struct, and honestly she's iconic for it. β¨
π NAMESPACE π
FBB
every constructor, member, operator and manipulator mentioned in this man-page (yes, all of them, i checked π«Ά) is defined in the namespace FBB.
π INHERITS FROM π
-
that's a big fat nothing bestie. she inherits from no one. she's self-made. main character energy fr fr. π
π CONSTRUCTORS π
Hostent(hostent const *hostentPtr)β this constructor initializes an@CLASSobject from an existinghostentstruct. and like, functions such asgethostbyname(3)andgethostbyaddress(3)return pointers tohostentstructs, so that's where you'd get your pointer from. π₯
the default, copy and move constructors (and the copy and move assignment operators) are all available too β so you can copy her, move her, whatever. she's flexible. π
π¦ MEMBER FUNCTIONS π¦
size_t addressLength() constβ gives you the length of the binary addresses, in bytes. πsize_t addressType() constβ gives you the type of the address. currently this is alwaysAF_INET. always. every time. πchar const *alias(size_t index) constβ gives you aliasindexof the host, and the first alias has index0(zero-indexed girlies rise up π). if aliasindexdoesn't exist, you get0back. no alias, no problem.char const * const *beginAlias() constβ gives you an iterator to the first alias. heads up tho: the hostname itself is not included in the list of aliases. she's separate. independent. πchar const *binaryAddress(size_t index) constβ gives you the binary addressindexof the host, first address is index0. if addressindexdoesn't exist,0comes back. the pointer to the binary address points to a series ofaddressLength()bytes. note β the returned address is in network byte order, and you can convert it to host byte order with the functions described inbyteorder(3). so flip it if you need to, bestie. πstd::string dottedDecimalAddress(size_t index) constβ gives you addressindexas a dotted decimal address, in a string, nice and readable. first address is index0. if addressindexdoesn't exist, you get an empty string. π«char const * const *endAlias() constβ gives you an iterator pointing beyond the last alias. classic end-iterator behaviour, we love a range. β¨char const *hostname() constβ gives you the standard (first) name of the host. her government name, if you will. πsize_t nAddresses() constβ gives you the number of addresses available. so when you're requesting a particular address, the index you ask for should be less than the value this member returns. otherwise, nothing. π«size_t nAliases() constβ gives you the number of aliases available. same rule, bestie: when requesting a particular alias, the index you ask for should be less than the value this member returns. π―void swap(Hostent &other)β swaps the currentHostentobject's content with theotherobject's content. theirs is yours, yours is theirs, we're trading π«Ά
π EXAMPLE π
here's a whole program, copy it exactly, don't be shy:
#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;
}
look at her go. localhost, aliases, addresses, the whole slay. π₯
π FILES π
bobcat/hostentβ defines the class interface. that's where she lives. that's her address (pun absolutely intended). π
π SEE ALSO π
π BUGS π
None Reported.
(we love a clean bug report. ngl, very demure, very mindful. β¨)
π BOBCAT PROJECT FILES π
https://fbb-git.gitlab.io/bobcat/β gitlab project page;
Debian Bobcat project files:
libbobcat6β debian package containing the shared library, changelog and copyright note;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.
like. the name is a whole acronym. that's so cool of her. π«Ά
π COPYRIGHT π
This is free software, distributed under the terms of the GNU General Public License (GPL).
free software, free as in freedom, free as in you can literally just have it. π
πΈ AUTHOR πΈ
Frank B. Brokken (f.b.brokken@rug.nl).
and that's the whole page, bestie!! this one came out as libbobcat-dev_6.15.01 and she's been doing her thing from 2005-2026 β a whole era, honestly, she's been serving FBB::Hostent(3bobcat) since forever. mwah. ππβ¨π¦π
π¦ where this page comes from
- ubuntu stonking: libbobcat-dev 6.15.01-1 Β· GPL-3.0-or-later WITH OpenSSL exception
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms