/usr/include/bobcat/hostent is in libbobcat-dev 3.19.01-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | #ifndef INCLUDED_BOBCAT_HOSTENT_
#define INCLUDED_BOBCAT_HOSTENT_
#include <netdb.h>
#include <string>
namespace FBB
{
class Hostent: private hostent
{
union PTR
{
char const * const *p2;
char const *p1;
};
size_t d_nAliases;
size_t d_nAddresses;
public:
Hostent();
Hostent(Hostent const &other); // hostent1.f
Hostent(Hostent &&tmp);
explicit Hostent(hostent const *other);
~Hostent(); // destructor.f
Hostent &operator=(Hostent const &other);
Hostent &operator=(Hostent &&tmp); // opis.f
char const *alias(size_t nr) const; // .f
char const *binaryAddress(size_t nr) const; // .f length bytes!
char const * const *beginAlias() const; // .f
std::string dottedDecimalAddress(size_t nr) const;
char const * const *endAlias() const; // .f
char const *hostname() const; // .f
size_t nAliases() const; // .f
size_t nAddresses() const; // .f
size_t addressLength() const; // .f
size_t addressType() const; // .f
void swap(Hostent &other);
private:
static char *xstrdup(char const *src);
void copy(hostent const *other, size_t n_aliases,
size_t n_addresses);
void destroy();
// the count functions also count
// the final 0-values.
size_t countAliases(char const * const *alias) const;
size_t countAddresses(char const * const *addresses,
size_t length) const;
};
inline size_t Hostent::addressLength() const
{
return h_length;
}
inline size_t Hostent::addressType() const
{
return h_addrtype;
}
inline char const *Hostent::alias(size_t nr) const
{
return nr >= d_nAliases ? 0 : h_aliases[nr];
}
inline char const * const *Hostent::beginAlias() const
{
return h_aliases;
}
inline char const *Hostent::binaryAddress(size_t nr) const
{
return nr >= nAddresses() ? 0 : h_addr_list[nr];
}
inline Hostent::~Hostent()
{
destroy();
}
inline char const * const *Hostent::endAlias() const
{
return h_aliases + nAliases();
}
inline Hostent::Hostent(Hostent const &other)
{
copy(&other, other.d_nAliases, other.d_nAddresses);
}
inline char const *Hostent::hostname() const
{
return h_name;
}
inline size_t Hostent::nAddresses() const
{
return d_nAddresses - 1;
}
inline size_t Hostent::nAliases() const
{
return d_nAliases - 1;
}
inline Hostent &Hostent::operator=(Hostent &&tmp)
{
swap(tmp);
return *this;
}
} // FBB
#endif
|