Scale Stack 0.3 Developer Documentation

scalestack::network::ip::address_service Class Reference

#include <address_service.h>

Inheritance diagram for scalestack::network::ip::address_service:
scalestack::network::ip::tcp::connection_address_service scalestack::network::ip::tcp::listener_address_service scalestack::network::ip::udp::socket_address_service

Public Member Functions

 address_service (kernel::module &module)
virtual ~address_service ()
void parse_addresses (const std::string &addresses, bool default_value_is_host, const std::string &default_value, const struct addrinfo &address_options)
void lookup_addresses (const std::string &host, const std::string &port, const struct addrinfo &address_options)
virtual bool add_addresses (const struct addrinfo *addresses)=0

Protected Attributes

kernel::module_module

Private Member Functions

 address_service (const address_service &)
address_serviceoperator= (const address_service &)

Private Attributes

struct addrinfo * _addresses

Detailed Description

This class parses IP address lists for other protocol modules like TCP and UDP.

Definition at line 51 of file address_service.h.


Constructor & Destructor Documentation

scalestack::network::ip::address_service::address_service ( kernel::module module  ) 

Definition at line 46 of file address_service.cc.

scalestack::network::ip::address_service::~address_service (  )  [virtual]

Definition at line 52 of file address_service.cc.

scalestack::network::ip::address_service::address_service ( const address_service  )  [private]

Don't allow copying of objects.


Member Function Documentation

void scalestack::network::ip::address_service::parse_addresses ( const std::string &  addresses,
bool  default_value_is_host,
const std::string &  default_value,
const struct addrinfo &  address_options 
)

Parse a string containing a list of addresses. For each pair found, lookup_addresses() is called. The list will be a simple comma separated [HOST][:PORT]... pair. For example, the string:

10.0.0.1:12345,:12346

Would parse as two different addresses, one with a specific IP address and one without (no hostname means INADDR_ANY and is usually the default for listening sockets that should bind to all interfaces).

Parameters:
[in] addresses List of addresses to parse.
[in] default_value_is_host Whether the default value is a host or port.
[in] default_value The default host or port, depending on what default_value_is_host is set to.
[in] address_options Options to use when looking up the addresses.

Definition at line 58 of file address_service.cc.

void scalestack::network::ip::address_service::lookup_addresses ( const std::string &  host,
const std::string &  port,
const struct addrinfo &  address_options 
)

Lookup a host:port pair and call add_addresses() with the result.

Parameters:
[in] host Host to use in lookup.
[in] port Port to use in lookup.
[in] address_options Options to use when looking up the addresses.

Definition at line 89 of file address_service.cc.

virtual bool scalestack::network::ip::address_service::add_addresses ( const struct addrinfo *  addresses  )  [pure virtual]

Method that gets called from lookup_addresses() with the list of addresses in the form of addrinfo structs (as getaddrinfo() returns).

Parameters:
[in] addresses List of addresses found.
Returns:
Whether the list of addresses should be freed or not. If this is true, the list is freed when this method returns. If this is false, the application is responsible for freeing the list with freeaddrinfo().

Implemented in scalestack::network::ip::tcp::connection_address_service, scalestack::network::ip::tcp::listener_address_service, and scalestack::network::ip::udp::socket_address_service.

address_service& scalestack::network::ip::address_service::operator= ( const address_service  )  [private]

Don't allow assignment of objects.


Field Documentation

Definition at line 105 of file address_service.h.

Definition at line 121 of file address_service.h.


The documentation for this class was generated from the following files:
Generated on Thu Feb 17 13:10:22 2011 by  doxygen 1.6.3