Class that represents a UNIX domain address.
More...
#include <unix_address.h>
|
static constexpr sa_family_t | ADDRESS_FAMILY = AF_UNIX |
| The address family for this type of address.
|
|
static constexpr size_t | MAX_PATH_NAME = 108 |
|
Class that represents a UNIX domain address.
This inherits from the UNIX form of a socket address, sockaddr_un.
◆ 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
-
◆ unix_address() [3/6]
sockpp::unix_address::unix_address |
( |
const sockaddr & |
addr | ) |
|
|
explicit |
Constructs the address by copying the specified structure.
- Parameters
-
- Exceptions
-
std::invalid_argument | if 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
-
◆ unix_address() [5/6]
sockpp::unix_address::unix_address |
( |
const sockaddr_un & |
addr | ) |
|
|
inline |
Constructs the address by copying the specified structure.
- Parameters
-
- Exceptions
-
std::invalid_argument | if 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
-
◆ 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]
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.
◆ sockaddr_un_ptr() [2/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.
◆ 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>"
The documentation for this class was generated from the following file: