nidas v1.2.3
|
An AF_UNIX socket address. More...
#include <UnixSocketAddress.h>
Public Member Functions | |
UnixSocketAddress (const std::string &path) | |
Default constructor, path of "", empty string. | |
UnixSocketAddress (const struct sockaddr_un *sockaddr) | |
Constructor with pointer to sockaddr_un. | |
UnixSocketAddress (const UnixSocketAddress &) | |
Copy constructor. | |
UnixSocketAddress & | operator= (const UnixSocketAddress &x) |
Assignment operator. | |
UnixSocketAddress * | clone () const |
Virtual constructor. | |
int | getFamily () const |
Return the address family, AF_UNIX. | |
int | getPort () const |
AF_UNIX addresses don't have ports, return -1. | |
struct sockaddr * | getSockAddrPtr () |
Provide non-const pointer to struct sockaddr_un. | |
const struct sockaddr * | getConstSockAddrPtr () const |
Provide const pointer to struct sockaddr_un. | |
socklen_t | getSockAddrLen () const |
Return the length of the struct sockaddr_XX for this address family. | |
std::string | toString () const |
Java style toString: returns "unix:path". | |
std::string | toAddressString () const |
Java style toString: also returns "unix:path". | |
bool | operator< (const SocketAddress &x) const |
Comparator operator for addresses. | |
bool | operator== (const SocketAddress &x) const |
Equality operator for addresses. | |
Protected Attributes | |
std::string | _path |
struct sockaddr_un | _sockaddr |
An AF_UNIX socket address.
Do "man 7 unix" from linux for info on unix sockets.
UnixSocketAddress::UnixSocketAddress | ( | const std::string & | path | ) |
Default constructor, path of "", empty string.
Constructor, with path string.
References _path, _sockaddr, and getFamily().
Referenced by clone().
UnixSocketAddress::UnixSocketAddress | ( | const struct sockaddr_un * | sockaddr | ) |
Constructor with pointer to sockaddr_un.
References _path, _sockaddr, getFamily(), and len.
UnixSocketAddress::UnixSocketAddress | ( | const UnixSocketAddress & | x | ) |
Copy constructor.
|
virtual |
|
inlinevirtual |
Provide const pointer to struct sockaddr_un.
Implements nidas::util::SocketAddress.
References _sockaddr.
|
inlinevirtual |
Return the address family, AF_UNIX.
Implements nidas::util::SocketAddress.
Referenced by operator<(), operator==(), UnixSocketAddress(), and UnixSocketAddress().
|
inlinevirtual |
AF_UNIX addresses don't have ports, return -1.
Implements nidas::util::SocketAddress.
|
inlinevirtual |
Return the length of the struct sockaddr_XX for this address family.
Implements nidas::util::SocketAddress.
References _sockaddr.
|
inlinevirtual |
Provide non-const pointer to struct sockaddr_un.
This is needed for recvfrom methods. recvfrom updates the struct sockaddr_un, so we can't cache the other portions of the address.
Implements nidas::util::SocketAddress.
References _sockaddr.
bool UnixSocketAddress::operator< | ( | const SocketAddress & | x | ) | const |
Comparator operator for addresses.
Useful if this address is a key in an STL map.
References _path, and getFamily().
UnixSocketAddress & UnixSocketAddress::operator= | ( | const UnixSocketAddress & | x | ) |
bool UnixSocketAddress::operator== | ( | const SocketAddress & | x | ) | const |
Equality operator for addresses.
References _path, and getFamily().
|
virtual |
Java style toString: also returns "unix:path".
Implements nidas::util::SocketAddress.
References toString().
|
virtual |
Java style toString: returns "unix:path".
Implements nidas::util::SocketAddress.
References _path.
Referenced by toAddressString().
|
protected |
Referenced by operator<(), operator=(), operator==(), toString(), UnixSocketAddress(), and UnixSocketAddress().
|
protected |
Referenced by getConstSockAddrPtr(), getSockAddrLen(), getSockAddrPtr(), operator=(), UnixSocketAddress(), and UnixSocketAddress().