conf::ConfHostname Class Reference

Class implementing an hostname directive type. More...

#include <directives.h>

Inheritance diagram for conf::ConfHostname:

conf::ConfValue< struct in_addr > conf::ConfDir List of all members.

Public Member Functions

 ConfHostname (std::string const &name, bool reloadable)
 Constructor setting the directive name.
 ConfHostname (std::string const &name, struct in_addr const &defval, bool reloadable)
 Constructor setting the directive name and default value.
 operator struct in_addr const & () const
 Conversion operator.
virtual char const * label (size_t index) const
 Implements ConfDir::label().

Protected Member Functions

virtual bool assign (Conf &conf, unsigned short count, std::string const params[])
 Sets the value.

Detailed Description

This class is used to store IP addresses in a in_addr class.

It takes a hostname (example: localhost) or a string IP address (example: 127.0.0.1) and resolves/converts it to an integer IP address stored in the s_addr field of struct in_addr. If the parameter is not a valid hostname/IP address, then an error is generated.

A conversion operator to struct in_addr is also provided for easier value access.


Member Function Documentation

virtual bool conf::ConfHostname::assign ( Conf conf,
unsigned short  count,
std::string const  params[] 
) [protected, virtual]

Transforms the string array passed by the parser into the directive's value. This function must ensure that the value is valid through a call to check() before setting it (you don't need to set m_value_set to true, this will be handled by set() when the function returns successfully).

Parameters:
[in] conf The Conf object that called set().
[in] count Number of parameters in params.
[in] params Parameters passed to the directive (NULL if count is 0).
Returns:
true if the function is successful, false otherwise (conf.error() should have be called with an appropriate error message in that case).

Implements conf::ConfValue< struct in_addr >.


The documentation for this class was generated from the following file:
Generated on Wed Aug 15 00:37:22 2007 for Epona API by  doxygen 1.5.2