#include <sockets.h>
Public Member Functions | |
AddressList () | |
~AddressList () | |
void | clear () |
void | resolve (const char *hostname, const char *service, int flags, int family=PF_INET) |
const addrinfo * | get_first () const |
Private Attributes | |
addrinfo * | _paddr_info |
Definition at line 146 of file sockets.h.
AddressList::AddressList | ( | ) | [inline] |
Definition at line 148 of file sockets.h.
: _paddr_info(NULL) { }
AddressList::~AddressList | ( | ) | [inline] |
void AddressList::clear | ( | ) | [inline] |
Definition at line 158 of file sockets.h.
References _paddr_info.
Referenced by HttpServer::unregister_url(), and ~AddressList().
{ if (_paddr_info) { freeaddrinfo(_paddr_info); _paddr_info = NULL; } }
const addrinfo* AddressList::get_first | ( | ) | const [inline] |
Definition at line 183 of file sockets.h.
References _paddr_info.
Referenced by Socket::bind(), and Socket::connect().
{ assert(_paddr_info!=NULL); return _paddr_info; }
void AddressList::resolve | ( | const char * | hostname, |
const char * | service, | ||
int | flags, | ||
int | family = PF_INET |
||
) | [inline] |
Definition at line 166 of file sockets.h.
References _paddr_info.
Referenced by HttpServer::register_url().
{ addrinfo hints = {flags, family, SOCK_STREAM}; int ret = getaddrinfo(hostname, service, &hints, &_paddr_info); if (ret != 0) { #ifdef _WIN32 throw WE(ret); #else throw Exception(gai_strerror(ret)); #endif } // const sockaddr_in& sa = *(sockaddr_in*) _paddr_info->ai_addr; }
addrinfo* AddressList::_paddr_info [private] |
Definition at line 190 of file sockets.h.
Referenced by clear(), get_first(), and resolve().