Wizard
Software Engineering Project - Wizard
Loading...
Searching...
No Matches
sockpp::unix_address Class Reference

#include <unix_address.h>

Inheritance diagram for sockpp::unix_address:
sockpp::sock_address

Public Member Functions

 unix_address ()
 
 unix_address (const std::string &path)
 
 unix_address (const sockaddr &addr)
 
 unix_address (const sock_address &addr)
 
 unix_address (const sockaddr_un &addr)
 
 unix_address (const unix_address &addr)
 
bool is_set () const
 
std::string path () const
 
socklen_t size () const override
 
const sockaddr * sockaddr_ptr () const override
 
sockaddr * sockaddr_ptr () override
 
const sockaddr_un * sockaddr_un_ptr () const
 
sockaddr_un * sockaddr_un_ptr ()
 
std::string to_string () const
 
- Public Member Functions inherited from sockpp::sock_address
virtual ~sock_address ()
 
virtual sa_family_t family () const
 

Static Public Attributes

static constexpr sa_family_t ADDRESS_FAMILY = AF_UNIX
 
static constexpr size_t MAX_PATH_NAME = 108
 

Detailed Description

Class that represents a UNIX domain address. This inherits from the UNIX form of a socket address, sockaddr_un.

Constructor & Destructor Documentation

◆ unix_address() [1/6]

sockpp::unix_address::unix_address ( )
inline

Constructs an empty address. The address is initialized to all zeroes.

◆ unix_address() [2/6]

sockpp::unix_address::unix_address ( const std::string & path)

Constructs an address for the specified path.

Parameters
pathThe

◆ unix_address() [3/6]

sockpp::unix_address::unix_address ( const sockaddr & addr)
explicit

Constructs the address by copying the specified structure.

Parameters
addrThe generic address
Exceptions
std::invalid_argumentif the address is not a UNIX-domain address (i.e. family is not AF_UNIX)

◆ unix_address() [4/6]

sockpp::unix_address::unix_address ( const sock_address & addr)
inline

Constructs the address by copying the specified structure.

Parameters
addrThe other address

◆ unix_address() [5/6]

sockpp::unix_address::unix_address ( const sockaddr_un & addr)
inline

Constructs the address by copying the specified structure.

Parameters
addrThe other address
Exceptions
std::invalid_argumentif the address is not properly initialized as a UNIX-domain address (i.e. family is not AF_UNIX)

◆ unix_address() [6/6]

sockpp::unix_address::unix_address ( const unix_address & addr)
inline

Constructs the address by copying the specified address.

Parameters
addrThe other address

Member Function Documentation

◆ is_set()

bool sockpp::unix_address::is_set ( ) const
inline

Checks if the address is set to some value. This doesn't attempt to determine if the address is valid, simply that it's not all zero.

Returns
true if the address has been set, false otherwise.

◆ path()

std::string sockpp::unix_address::path ( ) const
inline

Gets the path to which this address refers.

Returns
The path to which this address refers.

◆ size()

socklen_t sockpp::unix_address::size ( ) const
inlineoverridevirtual

Gets the size of the address structure. Note: In this implementation, this should return sizeof(this) but more convenient in some places, and the implementation might change in the future, so it might be more compatible with future revisions to use this call.

Returns
The size of the address structure.

Implements sockpp::sock_address.

◆ sockaddr_ptr() [1/2]

const sockaddr * sockpp::unix_address::sockaddr_ptr ( ) const
inlineoverridevirtual

Gets a pointer to this object cast to a const sockaddr.

Returns
A pointer to this object cast to a const sockaddr.

Implements sockpp::sock_address.

◆ sockaddr_ptr() [2/2]

sockaddr * sockpp::unix_address::sockaddr_ptr ( )
inlineoverridevirtual

Gets a pointer to this object cast to a sockaddr.

Returns
A pointer to this object cast to a sockaddr.

Implements sockpp::sock_address.

◆ sockaddr_un_ptr() [1/2]

sockaddr_un * sockpp::unix_address::sockaddr_un_ptr ( )
inline

Gets a pointer to this object cast to a sockaddr_un.

Returns
sockaddr_un pointer to this object.

◆ sockaddr_un_ptr() [2/2]

const sockaddr_un * sockpp::unix_address::sockaddr_un_ptr ( ) const
inline

Gets a const pointer to this object cast to a sockaddr_un.

Returns
const sockaddr_un pointer to this object.

◆ to_string()

std::string sockpp::unix_address::to_string ( ) const
inline

Gets a printable string for the address.

Returns
A string representation of the address in the form "unix:<path>"

Member Data Documentation

◆ ADDRESS_FAMILY

sa_family_t sockpp::unix_address::ADDRESS_FAMILY = AF_UNIX
staticconstexpr

The address family for this type of address


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