RTP Audio System
2.0.0
|
#include <socketaddress.h>
Public Types | |
enum | PrintFormat { PF_Address = (1 << 0), PF_Hostname = (1 << 1), PF_Full = (PF_Address | PF_Hostname), PF_HidePort = (1 << 15), PF_Legacy = (1 << 16), PF_Default = (PF_Address | PF_Legacy) } |
Public Member Functions | |
virtual | ~SocketAddress () |
virtual SocketAddress * | duplicate () const =0 |
virtual void | reset ()=0 |
virtual bool | isValid () const =0 |
cardinal | getPrintFormat () const |
void | setPrintFormat (const cardinal format) |
virtual card16 | getPort () const =0 |
virtual void | setPort (const card16 port)=0 |
virtual integer | getFamily () const =0 |
virtual String | getAddressString (const cardinal format=PF_Default) const =0 |
virtual cardinal | getSystemAddress (sockaddr *buffer, const socklen_t length, const cardinal type=AF_UNSPEC) const =0 |
virtual bool | setSystemAddress (const sockaddr *address, const socklen_t length)=0 |
Static Public Member Functions | |
static SocketAddress * | getLocalAddress (const SocketAddress &peer) |
static SocketAddress * | createSocketAddress (const integer family) |
static SocketAddress * | createSocketAddress (const cardinal flags, const String &name) |
static SocketAddress * | createSocketAddress (const cardinal flags, const String &name, const card16 port) |
static SocketAddress * | createSocketAddress (const cardinal flags, sockaddr *address, const socklen_t length) |
static SocketAddress ** | newAddressList (const cardinal entries) |
static void | deleteAddressList (SocketAddress **&addressArray) |
Static Public Attributes | |
static const cardinal | MaxSockLen |
Protected Attributes | |
cardinal | Format |
Friends | |
std::ostream & | operator<< (std::ostream &os, const SocketAddress &sa) |
setPrintFormat() printing formats.
SocketAddress::~SocketAddress | ( | ) | [virtual] |
Destructor.
SocketAddress * SocketAddress::createSocketAddress | ( | const integer | family | ) | [static] |
Create SocketAddress object for given address family.
family | Address family (e.g. AF_INET or AF_UNIX). |
SocketAddress * SocketAddress::createSocketAddress | ( | const cardinal | flags, |
const String & | name | ||
) | [static] |
Create SocketAddress object from address string.
flags | flags |
string | Address string. |
SocketAddress * SocketAddress::createSocketAddress | ( | const cardinal | flags, |
const String & | name, | ||
const card16 | port | ||
) | [static] |
Create SocketAddress object from address string and port number.
flags | flags |
string | Address string. |
port | Port number. |
SocketAddress * SocketAddress::createSocketAddress | ( | const cardinal | flags, |
sockaddr * | address, | ||
const socklen_t | length | ||
) | [static] |
Create SocketAddress object from system's sockaddr structure.
flags | flags. |
address | sockaddr. |
length | Length of sockaddr. |
void SocketAddress::deleteAddressList | ( | SocketAddress **& | addressArray | ) | [static] |
Deallocate NULL-terminated list of SocketAddress objects.
addressArray | Address list. |
virtual SocketAddress* SocketAddress::duplicate | ( | ) | const [pure virtual] |
Create a duplicate of the SocketAddress object.
Implemented in InternetAddress, PacketAddress, UnixAddress, and InternetFlow.
virtual String SocketAddress::getAddressString | ( | const cardinal | format = PF_Default | ) | const [pure virtual] |
Get address string.
Implemented in InternetAddress, PacketAddress, UnixAddress, and InternetFlow.
virtual integer SocketAddress::getFamily | ( | ) | const [pure virtual] |
Get family of address.
Implemented in InternetAddress, PacketAddress, and UnixAddress.
SocketAddress * SocketAddress::getLocalAddress | ( | const SocketAddress & | peer | ) | [static] |
Get the local host address. The parameter peer gives the address of the other host.
peer | Address of peer. |
Examples: localhost => localhost address (127.0.0.1 or ::1). ethernet-host => ethernet interface address. internet-address => dynamic-ip address set by pppd.
virtual card16 SocketAddress::getPort | ( | ) | const [pure virtual] |
cardinal SocketAddress::getPrintFormat | ( | ) | const [inline] |
Get printing format.
virtual cardinal SocketAddress::getSystemAddress | ( | sockaddr * | buffer, |
const socklen_t | length, | ||
const cardinal | type = AF_UNSPEC |
||
) | const [pure virtual] |
Get system's sockaddr structure for the address.
buffer | Buffer to write sockaddr to. |
length | Length of buffer. |
type | Socket address type, e.g. AF_INET or AF_INET6. |
Implemented in InternetAddress, PacketAddress, UnixAddress, and InternetFlow.
virtual bool SocketAddress::isValid | ( | ) | const [pure virtual] |
Check, if address is valid.
Implemented in InternetAddress, PacketAddress, and UnixAddress.
SocketAddress ** SocketAddress::newAddressList | ( | const cardinal | entries | ) | [static] |
Allocate memory for NULL-terminated SocketAddress list with given number of entries.
entries | Number of entries. |
virtual void SocketAddress::reset | ( | ) | [pure virtual] |
Reset address.
Implemented in InternetAddress, PacketAddress, UnixAddress, and InternetFlow.
virtual void SocketAddress::setPort | ( | const card16 | port | ) | [pure virtual] |
Set port of address.
Implemented in InternetAddress, PacketAddress, and UnixAddress.
void SocketAddress::setPrintFormat | ( | const cardinal | format | ) | [inline] |
Set printing format.
format | Print format. |
virtual bool SocketAddress::setSystemAddress | ( | const sockaddr * | address, |
const socklen_t | length | ||
) | [pure virtual] |
Initialize the socket address from the system's sockaddr structure.
address | sockaddr. |
length | Length of sockaddr. |
Implemented in InternetAddress, PacketAddress, and UnixAddress.
std::ostream& operator<< | ( | std::ostream & | os, |
const SocketAddress & | sa | ||
) | [friend] |
Output operator.
cardinal SocketAddress::Format [protected] |
Print format.
const cardinal SocketAddress::MaxSockLen [static] |
(sizeof(sockaddr_un) > sizeof(sockaddr_storage)) ? sizeof(sockaddr_un) : sizeof(sockaddr_storage)
Maximum sockaddr length in bytes.