/usr/include/bobcat/inetaddress is in libbobcat-dev 4.04.00-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 | #ifndef INCLUDED_BOBCAT_INETADDRESS_
#define INCLUDED_BOBCAT_INETADDRESS_
#include <netinet/in.h>
#include <string>
/*
int-info coming in or going out: host byte order
*/
namespace FBB
{
class InetAddress
{
sockaddr_in d_address; // address/port: network byte order
// sa_family_t in_addr, uint16_t
// sin_family, sin_addr, sin_port
public:
uint16_t port() const; // .f
// replaces the formerly available getAddress() member.
std::string dottedDecimalAddress() const;
sockaddr const *sockaddrPtr() const; // 1.f
sockaddr_in const *sockaddr_inPtr() const; // 1.f
size_t size() const; // .f
protected:
InetAddress(std::string const &host, uint16_t port);
explicit InetAddress(uint16_t port); // 1.f
explicit InetAddress(sockaddr_in const &address); // 2.f
sockaddr *sockaddrPtr(); // 2.f
sockaddr_in *sockaddr_inPtr(); // 2.f
private:
void init(uint32_t addr, uint16_t port); // host byte order !
};
inline InetAddress::InetAddress(uint16_t port)
{
init(INADDR_ANY, port);
}
inline InetAddress::InetAddress(sockaddr_in const &address)
:
d_address(address)
{}
inline uint16_t InetAddress::port() const
{
return ntohs(d_address.sin_port);
}
inline size_t InetAddress::size() const
{
return sizeof(d_address);
}
inline sockaddr_in const *InetAddress::sockaddr_inPtr() const
{
return &d_address;
}
inline sockaddr_in *InetAddress::sockaddr_inPtr()
{
return &d_address;
}
inline sockaddr const *InetAddress::sockaddrPtr() const
{
return reinterpret_cast<sockaddr const *>(&d_address);
}
inline sockaddr *InetAddress::sockaddrPtr()
{
return reinterpret_cast<sockaddr *>(&d_address);
}
} // FBB
#endif
|