Kea 2.7.5
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.
 
void fromCommandLine (const std::string &cmd_line_arg)
 Sets the lease type from the command line argument.
 
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.
 
bool is (const Type lease_type) const
 Checks if lease type has the specified code.
 
void set (const Type lease_type)
 Sets the lease type code.
 
std::string toText () const
 Return textual representation of the lease type.
 

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 53 of file command_options.h.

Member Enumeration Documentation

◆ Type

The lease type code.

Enumerator
ADDRESS 
PREFIX 
ADDRESS_AND_PREFIX 

Definition at line 57 of file command_options.h.

Constructor & Destructor Documentation

◆ LeaseType() [1/2]

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

Definition at line 42 of file command_options.cc.

◆ LeaseType() [2/2]

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

Constructor from lease type code.

Parameters
lease_typeA lease type code.

Definition at line 46 of file command_options.cc.

Member Function Documentation

◆ fromCommandLine()

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 66 of file command_options.cc.

References isc_throw.

◆ includes()

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 56 of file command_options.cc.

Referenced by isc::perfdhcp::TestControl::copyIaOptions(), isc::perfdhcp::TestControl::sendSolicit6(), and isc::perfdhcp::TestControl::validateIA().

◆ is()

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 51 of file command_options.cc.

◆ set()

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

Sets the lease type code.

Parameters
lease_typeA lease type code.

Definition at line 61 of file command_options.cc.

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

◆ toText()

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 84 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: