#include <sockaddr.h>
Public Member Functions | |
virtual | ~SocketAddress () |
struct sockaddr * | get_addr () const |
Return the current sockaddr being used. | |
socklen_t | length () const |
int | family () const |
virtual std::string | get_id () const =0 |
Protected Member Functions | |
SocketAddress () | |
SocketAddress (const struct sockaddr *) | |
void | set_addr (const struct sockaddr *) |
Initialization of the socket parameters. | |
Protected Attributes | |
struct sockaddr_storage | addr |
Storage of the address. | |
socklen_t | sock_addrlen |
The SocketAddress classes are immutable, and provide useful functionality related to socket addresses, such as setting them up given user-friendly address specifications as well as printing them nicely for human consumption.
Definition at line 69 of file sockaddr.h.
SocketAddress::SocketAddress | ( | ) | [protected] |
SocketAddress::SocketAddress | ( | const struct sockaddr * | initaddr | ) | [protected] |
Definition at line 60 of file sockaddr.cc.
References addr, and set_addr().
SocketAddress::~SocketAddress | ( | ) | [virtual] |
Definition at line 66 of file sockaddr.cc.
const sockaddr * SocketAddress::get_addr | ( | ) | const [read] |
Return the current sockaddr being used.
Do not try to free the returned address! It was not dynamically allocated. Also, don't modify it! XXX - should we return a copy instead?
Definition at line 98 of file sockaddr.cc.
References addr.
Referenced by UDSSocketAddress::get_id(), socket_sender(), and UDSSocketAddress::unlink().
socklen_t SocketAddress::length | ( | ) | const |
int SocketAddress::family | ( | ) | const |
Definition at line 112 of file sockaddr.cc.
References addr.
Referenced by IPSocketAddress::get_id(), and IPSocketAddress::port().
virtual std::string SocketAddress::get_id | ( | ) | const [pure virtual] |
Implemented in IPSocketAddress, and UDSSocketAddress.
void SocketAddress::set_addr | ( | const struct sockaddr * | val | ) | [protected] |
Initialization of the socket parameters.
Used by the constructors.
Definition at line 75 of file sockaddr.cc.
References addr, and sock_addrlen.
Referenced by IPSocketAddress::IPSocketAddress(), UDSSocketAddress::set_addr(), and SocketAddress().
struct sockaddr_storage SocketAddress::addr [read, protected] |
Storage of the address.
Definition at line 94 of file sockaddr.h.
Referenced by family(), get_addr(), IPSocketAddress::get_id(), IPSocketAddress::port(), set_addr(), and SocketAddress().
socklen_t SocketAddress::sock_addrlen [protected] |
A cache of the length of the address structure. This is kept here largely for systems that don't store it in the various sockaddr structures themselves.
Definition at line 99 of file sockaddr.h.
Referenced by IPSocketAddress::get_id(), length(), set_addr(), and UDSSocketAddress::UDSSocketAddress().