The Micro C++ Library
|
A SocketAddress represents an abstract and protocol unspecific Socket address. More...
#include <micxx.hxx>
Inherits micxx::traits::ToString.
Inherited by micxx::InetAddress.
Public Member Functions | |
SocketAddress (short afamily, socklen_t asize) | |
Create a new SocketAddress for the specified address family. | |
SocketAddress (const SocketAddress &right) | |
Create a copy of SocketAddress right. | |
virtual | ~SocketAddress () |
Deallocate the stored struct sockaddr | |
virtual SocketAddress * | clone () const =0 |
Create an exact copy of this SocketAddress allocated by new . | |
virtual struct sockaddr * | getAddress () |
A pointer to the stored struct sockaddr . | |
virtual struct sockaddr * | getAddress () const |
The const version of getAddress(). | |
virtual short | getFamily () const |
The address family of this SocketAddress. | |
virtual socklen_t | getSize () const |
The size of the store struct sockaddr . | |
virtual SocketAddress & | operator= (const SocketAddress &right) |
Make this a copy of SocketAddress right. | |
virtual bool | operator== (const SocketAddress &right) const |
Check, if this and right have the same address (content). | |
virtual bool | operator!= (const SocketAddress &right) const |
Check, if this and right have a different address. | |
virtual void | setAddress (const struct sockaddr *address, socklen_t size) |
(Re)set the stored address to address with size size. | |
virtual void | setFamily (short family) |
(Re)set the address' family to family. | |
virtual std::string | toString () const |
A string representation describing this SocketAddress. |
A SocketAddress represents an abstract and protocol unspecific Socket address.
micxx::SocketAddress::SocketAddress | ( | short | afamily, |
socklen_t | asize | ||
) |
Create a new SocketAddress for the specified address family.
afamily | The address family, e.g. AF_INET in case of Internet Protocol (IP) addresses. |
asize | The size of the address structure, e.g. sizeof(struct sockaddr_in) in case of Internet Protocol (IP) addresses. If asize is greater than 0 , a struct sockaddr is allocated to be able to receive an address with the specified size. |
micxx::SocketAddress::SocketAddress | ( | const SocketAddress & | right | ) |
Create a copy of SocketAddress right.
right | The SocketAddress to copy from. |
virtual micxx::SocketAddress::~SocketAddress | ( | ) | [virtual] |
Deallocate the stored struct sockaddr
virtual SocketAddress* micxx::SocketAddress::clone | ( | ) | const [pure virtual] |
Create an exact copy of this SocketAddress allocated by new
.
new
. The calling application takes ownership of the allocated memory and it is in the responsibility of the calling application to delete the pointer when it is no more needed. Implemented in micxx::InetAddress, and micxx::MulticastAddress.
virtual struct sockaddr* micxx::SocketAddress::getAddress | ( | ) | [read, virtual] |
A pointer to the stored struct sockaddr
.
virtual struct sockaddr* micxx::SocketAddress::getAddress | ( | ) | const [read, virtual] |
The const
version of getAddress().
virtual short micxx::SocketAddress::getFamily | ( | ) | const [virtual] |
The address family of this SocketAddress.
virtual socklen_t micxx::SocketAddress::getSize | ( | ) | const [virtual] |
The size of the store struct sockaddr
.
virtual bool micxx::SocketAddress::operator!= | ( | const SocketAddress & | right | ) | const [virtual] |
Check, if this and right have a different address.
virtual SocketAddress& micxx::SocketAddress::operator= | ( | const SocketAddress & | right | ) | [virtual] |
Make this a copy of SocketAddress right.
right | To SocketAddress to copy from. |
virtual bool micxx::SocketAddress::operator== | ( | const SocketAddress & | right | ) | const [virtual] |
Check, if this and right have the same address (content).
virtual void micxx::SocketAddress::setAddress | ( | const struct sockaddr * | address, |
socklen_t | size | ||
) | [virtual] |
(Re)set the stored address to address with size size.
If the old stored address was not 0
, the old address is deleted before.
Reimplemented in micxx::InetAddress.
virtual void micxx::SocketAddress::setFamily | ( | short | family | ) | [virtual] |
(Re)set the address' family to family.
This setter must not be called, if the currently stored address is 0
.
virtual std::string micxx::SocketAddress::toString | ( | ) | const [virtual] |
A string representation describing this SocketAddress.
Reimplemented from micxx::traits::ToString.
Reimplemented in micxx::InetAddress, and micxx::MulticastAddress.