| Kea 3.0.2-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.
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

enum isc::perfdhcp::CommandOptions::LeaseType::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.

References ADDRESS.

## ◆ LeaseType() [2/2]

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

Constructor from lease type code.

Parameters

  lease_type | A 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_arg | An argument specified in the command line as -e<lease-type>: address-only prefix-only

Exceptions

  isc::InvalidParameter | if the specified argument is invalid.

Definition at line 66 of file command_options.cc.

References ADDRESS, ADDRESS_AND_PREFIX, isc_throw, and PREFIX.

## ◆ 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_type | A 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.

References ADDRESS_AND_PREFIX, and is().

Here is the call graph for this function:

## ◆ is()

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

Checks if lease type has the specified code.

Parameters

  lease_type | A 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.

Referenced by includes().

## ◆ set()

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

Sets the lease type code.

Parameters

  lease_type | A lease type code.

Definition at line 61 of file command_options.cc.

## ◆ 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 ADDRESS, ADDRESS_AND_PREFIX, isc_throw, and PREFIX.

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

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

- command_options.h
- command_options.cc