Kea  1.9.9-git
isc::perfdhcp::CommandOptions::LeaseType Class Reference

A class encapsulating the type of lease being requested from the server. More...

#include <command_options.h>

Public Types

enum  Type { ADDRESS, PREFIX, ADDRESS_AND_PREFIX }
 The lease type code. More...
 

Public Member Functions

 LeaseType ()
 
 LeaseType (const Type lease_type)
 Constructor from lease type code. More...
 
void fromCommandLine (const std::string &cmd_line_arg)
 Sets the lease type from the command line argument. More...
 
bool includes (const Type lease_type) const
 Checks if lease type implies request for the address, prefix (or both) as specified by the function argument. More...
 
bool is (const Type lease_type) const
 Checks if lease type has the specified code. More...
 
void set (const Type lease_type)
 Sets the lease type code. More...
 
std::string toText () const
 Return textual representation of the lease type. More...
 

Detailed Description

A class encapsulating the type of lease being requested from the server.

This class comprises convenience functions to convert the lease type to the textual format and to match the appropriate lease type with the value of the -e<lease-type> parameter specified from the command line.

Definition at line 50 of file command_options.h.

Member Enumeration Documentation

The lease type code.

Enumerator
ADDRESS 
PREFIX 
ADDRESS_AND_PREFIX 

Definition at line 54 of file command_options.h.

Constructor & Destructor Documentation

isc::perfdhcp::CommandOptions::LeaseType::LeaseType ( )

Definition at line 44 of file command_options.cc.

isc::perfdhcp::CommandOptions::LeaseType::LeaseType ( const Type  lease_type)

Constructor from lease type code.

Parameters
lease_typeA lease type code.

Definition at line 48 of file command_options.cc.

Member Function Documentation

void isc::perfdhcp::CommandOptions::LeaseType::fromCommandLine ( const std::string &  cmd_line_arg)

Sets the lease type from the command line argument.

Parameters
cmd_line_argAn argument specified in the command line as -e<lease-type>:
  • address-only
  • prefix-only
Exceptions
isc::InvalidParameterif the specified argument is invalid.

Definition at line 68 of file command_options.cc.

References isc_throw.

bool isc::perfdhcp::CommandOptions::LeaseType::includes ( const Type  lease_type) const

Checks if lease type implies request for the address, prefix (or both) as specified by the function argument.

This is a convenience function to check that, for the lease type specified from the command line, the address or prefix (IA_NA or IA_PD) option should be sent to the server. For example, if user specified '-e address-and-prefix' in the command line this function will return true for both ADDRESS and PREFIX, because both address and prefix is requested from the server.

Parameters
lease_typeA lease type.
Returns
true if the lease type implies creation of the address, prefix or both as specified by the argument.

Definition at line 58 of file command_options.cc.

Referenced by isc::perfdhcp::TestControl::sendSolicit6().

bool isc::perfdhcp::CommandOptions::LeaseType::is ( const Type  lease_type) const

Checks if lease type has the specified code.

Parameters
lease_typeA lease type code to be checked.
Returns
true if lease type is matched with the specified code.

Definition at line 53 of file command_options.cc.

void isc::perfdhcp::CommandOptions::LeaseType::set ( const Type  lease_type)

Sets the lease type code.

Parameters
lease_typeA lease type code.

Definition at line 63 of file command_options.cc.

Referenced by isc::perfdhcp::CommandOptions::reset().

std::string isc::perfdhcp::CommandOptions::LeaseType::toText ( ) const

Return textual representation of the lease type.

Returns
A textual representation of the lease type.

Definition at line 86 of file command_options.cc.

References isc_throw.

Referenced by isc::perfdhcp::CommandOptions::printCommandLine().


The documentation for this class was generated from the following files: