23 #ifndef __ccxx_SocketAddress_hxx 24 #define __ccxx_SocketAddress_hxx 33 #include <sys/types.h> 34 #include <sys/socket.h> 35 #include <netinet/in.h> 94 void setHost(
const String& host);
116 inline operator sockaddr*()
120 inline operator sockaddr_in*()
121 {
return(&_insaddr); }
131 {
return(!
operator==(other)); }
137 struct sockaddr _saddr;
138 struct sockaddr_in _insaddr;
145 return(stream << cstr_a.
data());
150 #endif // __ccxx_SocketAddress_hxx
static uint16_t networkToHost(uint16_t n)
Convert an unsigned 16-bit integer from network to host byte-order.
Definition: ByteOrder.h++:55
const char * data() const
Get a pointer to the character array.
Definition: CString.h++:58
bool operator==(const Blob &b1, const Blob &b2)
Definition: Blob.h++:344
uint16_t getPort() const
Get the port number for this address.
Definition: SocketAddress.h++:97
sockaddr getSocketAddress() const
Get the address as a sockaddr structure.
Definition: SocketAddress.h++:109
A socket endpoint network address.
Definition: SocketAddress.h++:46
std::ostream & operator<<(std::ostream &stream, const BitSet &bs)
Definition: BitSet.h++:383
static uint16_t hostToNetwork(uint16_t n)
Convert an unsigned 16-bit integer from host to network byte-order.
Definition: ByteOrder.h++:44
bool operator!=(const SocketAddress &other) const
Inequality operator.
Definition: SocketAddress.h++:130
#define COMMONCPP_API
Definition: Common.h++:126
A flexible, reference counted, copy-on-write, thread-safe, nullable string.
Definition: String.h++:50
An implicitly shared, reference-counted container for an immutable, NUL-terminated C string...
Definition: CString.h++:39
void setSocketAddress(const struct sockaddr &addr)
Set the address from a sockaddr structure.
Definition: SocketAddress.h++:105
CString toUTF8() const
Return the contents of the string as an immutable C string.
Definition: String.c++:1143
An IPv4 Internet address.
Definition: InetAddress.h++:64
Definition: AllocationMap.c++:25
String toString() const
Get a String representation for this address.
Definition: SocketAddress.c++:161
void setPort(uint16_t port)
Set the port number for this address.
Definition: SocketAddress.h++:101