/usr/include/bobcat/hostent is in libbobcat-dev 2.20.01-1.
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 114 115 116 117 118 119 120 121 122 123 124 125 | #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);
Hostent(Hostent &&tmp);
explicit Hostent(hostent const *other);
~Hostent();
Hostent &operator=(Hostent const &other);
Hostent &operator=(Hostent &&tmp);
char const *alias(size_t nr) const;
char const *binaryAddress(size_t nr) const; // length bytes!
char const * const *beginAlias() const;
std::string dottedDecimalAddress(size_t nr) const;
char const * const *endAlias() const;
char const *hostname() const;
size_t nAliases() const;
size_t nAddresses() const;
size_t addressLength() const;
size_t addressType() const;
void swap(Hostent &other);
Hostent(Hostent const &&tmp); // Deprecated
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 Hostent &Hostent::operator=(Hostent &&tmp)
{
swap(tmp);
return *this;
}
inline Hostent::Hostent(Hostent const &other)
{
copy(&other, other.d_nAliases, other.d_nAddresses);
}
inline Hostent::~Hostent()
{
destroy();
}
inline char const *Hostent::alias(size_t nr) const
{
return nr >= d_nAliases ? 0 : h_aliases[nr];
}
inline char const *Hostent::binaryAddress(size_t nr) const
{
return nr >= nAddresses() ? 0 : h_addr_list[nr];
}
inline char const * const *Hostent::beginAlias() const
{
return h_aliases;
}
inline char const * const *Hostent::endAlias() const
{
return h_aliases + nAliases();
}
inline char const *Hostent::hostname() const
{
return h_name;
}
inline size_t Hostent::nAliases() const
{
return d_nAliases - 1;
}
inline size_t Hostent::nAddresses() const
{
return d_nAddresses - 1;
}
inline size_t Hostent::addressLength() const
{
return h_length;
}
inline size_t Hostent::addressType() const
{
return h_addrtype;
}
} // FBB
#endif
|