Public Member Functions | Private Attributes

AddressList Struct Reference

#include <sockets.h>

Collaboration diagram for AddressList:
Collaboration graph
[legend]

List of all members.

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

Detailed Description

Definition at line 146 of file sockets.h.


Constructor & Destructor Documentation

AddressList::AddressList (  ) [inline]

Definition at line 148 of file sockets.h.

     :  _paddr_info(NULL)
    {
    }
AddressList::~AddressList (  ) [inline]

Definition at line 153 of file sockets.h.

References clear().

    {
        clear();
    }

Here is the call graph for this function:


Member Function Documentation

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;
        }
    }

Here is the caller graph for this function:

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;
    }

Here is the caller graph for this function:

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;
    }

Here is the caller graph for this function:


Member Data Documentation

addrinfo* AddressList::_paddr_info [private]

Definition at line 190 of file sockets.h.

Referenced by clear(), get_first(), and resolve().


The documentation for this struct was generated from the following file: