Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
roc::address::SocketAddr Class Reference

Socket address. More...

#include <socket_addr.h>

Public Types

enum  { MaxStrLen = 196 }
 

Public Member Functions

 SocketAddr ()
 Construct empty address. More...
 
void clear ()
 Clear address. More...
 
bool has_host_port () const
 Check whether host and port are set. More...
 
ROC_ATTR_NODISCARD bool set_host_port (AddrFamily type, const char *host, int port)
 Set host address. More...
 
ROC_ATTR_NODISCARD bool set_host_port_auto (const char *host, int port)
 Set host address, auto-detect family. More...
 
ROC_ATTR_NODISCARD bool set_host_port_saddr (const sockaddr *sa)
 Set address from sockaddr struct. More...
 
AddrFamily family () const
 Get IP version (IPv4 or IPv6). More...
 
bool multicast () const
 Check whether this is multicast address. More...
 
ROC_ATTR_NODISCARD bool get_host (char *buf, size_t bufsz) const
 Get host IP address. More...
 
int port () const
 Get address port. More...
 
sockaddr * saddr ()
 Get sockaddr struct. More...
 
const sockaddr * saddr () const
 Get sockaddr struct. More...
 
socklen_t slen () const
 Get sockaddr struct length. More...
 
socklen_t max_slen () const
 Get maximum allowed sockaddr struct length. More...
 
 operator const struct unspecified_bool * () const
 Convert to bool. More...
 
bool operator== (const SocketAddr &other) const
 Compare addresses. More...
 
bool operator!= (const SocketAddr &other) const
 Compare addresses. More...
 

Detailed Description

Socket address.

Definition at line 26 of file socket_addr.h.

Constructor & Destructor Documentation

◆ SocketAddr()

roc::address::SocketAddr::SocketAddr ( )

Construct empty address.

Member Function Documentation

◆ clear()

void roc::address::SocketAddr::clear ( )

Clear address.

◆ family()

AddrFamily roc::address::SocketAddr::family ( ) const

Get IP version (IPv4 or IPv6).

◆ get_host()

ROC_ATTR_NODISCARD bool roc::address::SocketAddr::get_host ( char *  buf,
size_t  bufsz 
) const

Get host IP address.

◆ has_host_port()

bool roc::address::SocketAddr::has_host_port ( ) const

Check whether host and port are set.

◆ max_slen()

socklen_t roc::address::SocketAddr::max_slen ( ) const

Get maximum allowed sockaddr struct length.

◆ multicast()

bool roc::address::SocketAddr::multicast ( ) const

Check whether this is multicast address.

◆ operator const struct unspecified_bool *()

roc::address::SocketAddr::operator const struct unspecified_bool * ( ) const

Convert to bool.

◆ operator!=()

bool roc::address::SocketAddr::operator!= ( const SocketAddr other) const

Compare addresses.

◆ operator==()

bool roc::address::SocketAddr::operator== ( const SocketAddr other) const

Compare addresses.

◆ port()

int roc::address::SocketAddr::port ( ) const

Get address port.

◆ saddr() [1/2]

sockaddr* roc::address::SocketAddr::saddr ( )

Get sockaddr struct.

◆ saddr() [2/2]

const sockaddr* roc::address::SocketAddr::saddr ( ) const

Get sockaddr struct.

◆ set_host_port()

ROC_ATTR_NODISCARD bool roc::address::SocketAddr::set_host_port ( AddrFamily  type,
const char *  host,
int  port 
)

Set host address.

◆ set_host_port_auto()

ROC_ATTR_NODISCARD bool roc::address::SocketAddr::set_host_port_auto ( const char *  host,
int  port 
)

Set host address, auto-detect family.

◆ set_host_port_saddr()

ROC_ATTR_NODISCARD bool roc::address::SocketAddr::set_host_port_saddr ( const sockaddr *  sa)

Set address from sockaddr struct.

◆ slen()

socklen_t roc::address::SocketAddr::slen ( ) const

Get sockaddr struct length.


The documentation for this class was generated from the following file: