![]() |
Kea
2.3.5-git
|
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... | |
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.
The lease type code.
Enumerator | |
---|---|
ADDRESS | |
PREFIX | |
ADDRESS_AND_PREFIX |
Definition at line 54 of file command_options.h.
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.
lease_type | A lease type code. |
Definition at line 48 of file command_options.cc.
void isc::perfdhcp::CommandOptions::LeaseType::fromCommandLine | ( | const std::string & | cmd_line_arg | ) |
Sets the lease type from the command line argument.
cmd_line_arg | An argument specified in the command line as -e<lease-type>:
|
isc::InvalidParameter | if the specified argument is invalid. |
Definition at line 68 of file command_options.cc.
References ADDRESS, ADDRESS_AND_PREFIX, isc_throw, and PREFIX.
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.
lease_type | A lease type. |
Definition at line 58 of file command_options.cc.
References ADDRESS_AND_PREFIX, and is().
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.
lease_type | A lease type code to be checked. |
Definition at line 53 of file command_options.cc.
Referenced by includes().
void isc::perfdhcp::CommandOptions::LeaseType::set | ( | const Type | lease_type | ) |
Sets the lease type code.
lease_type | A lease type code. |
Definition at line 63 of file command_options.cc.
std::string isc::perfdhcp::CommandOptions::LeaseType::toText | ( | ) | const |
Return textual representation of the lease type.
Definition at line 86 of file command_options.cc.
References ADDRESS, ADDRESS_AND_PREFIX, isc_throw, and PREFIX.
Referenced by isc::perfdhcp::CommandOptions::printCommandLine().