Kea 2.7.5
|
Command Options. More...
#include <command_options.h>
Classes | |
class | LeaseType |
A class encapsulating the type of lease being requested from the server. More... | |
Public Types | |
enum | ExchangeMode { DO_SA , DORA_SARR } |
2-way (cmd line param -i) or 4-way exchanges More... | |
typedef std::vector< std::vector< uint8_t > > | MacAddrsVector |
A vector holding MAC addresses. | |
Public Member Functions | |
CommandOptions () | |
Default Constructor. | |
bool | checkMultiSubnet () |
Check if multi subnet mode is enabled. | |
void | extendedVersion () const |
Print extended program version. | |
bool | getAddrUnique () const |
Returns address uniqueness value. | |
std::vector< std::string > | getBase () const |
Returns base values. | |
int | getCleanReport () const |
Returns clean report mode. | |
std::string | getCleanReportSeparator () const |
Returns clean report separator. | |
uint32_t | getClientsNum () const |
Returns number of simulated clients. | |
std::string | getDiags () const |
Returns diagnostic selectors. | |
std::vector< double > | getDropTime () const |
Returns drop time. | |
std::vector< uint8_t > | getDuidTemplate () const |
Returns DUID template. | |
int | getElapsedTimeOffset () const |
Returns template offset for elapsed time. | |
ExchangeMode | getExchangeMode () const |
Returns packet exchange mode. | |
int | getExitWaitTime () const |
Returns the time in microseconds to delay the program by. | |
const isc::dhcp::OptionCollection & | getExtraOpts () const |
Returns extra options to be inserted. | |
int | getIncreaseElapsedTime () const |
Returns increased elapsed time. | |
uint8_t | getIpVersion () const |
Returns IP version. | |
LeaseType | getLeaseType () const |
\ brief Returns the type of lease being requested. | |
std::string | getLocalName () const |
Returns local address or interface name. | |
int | getLocalPort () const |
Returns local port number. | |
std::string | getMacListFile () const |
Returns location of the file containing list of MAC addresses. | |
const MacAddrsVector & | getMacsFromFile () const |
Returns reference to a vector of MAC addresses read from a file. | |
std::vector< uint8_t > | getMacTemplate () const |
Returns MAC address template. | |
std::vector< int > | getMaxDrop () const |
Returns maximum drops number. | |
std::vector< double > | getMaxDropPercentage () const |
Returns maximal percentage of drops. | |
std::vector< int > | getNumRequests () const |
Returns maximum number of exchanges. | |
int | getPeriod () const |
Returns test period. | |
int | getPreload () const |
Returns number of preload exchanges. | |
std::vector< int > | getRandomOffset () const |
Returns template offsets for rnd. | |
std::string | getRandRelayAddr () |
Returns random relay address. | |
int | getRate () const |
Returns exchange rate. | |
std::vector< std::string > | getRelayAddrList () const |
Returns list of relay addresses. | |
std::string | getRelayAddrListFile () const |
Returns file location with set of relay addresses. | |
const isc::dhcp::OptionCollection & | getRelayOpts (uint8_t encapsulation_level=1) const |
Returns relay options to be inserted at given level of encapsulation. | |
int | getReleaseRate () const |
Returns a rate at which DHCPv6 Release messages are sent. | |
int | getRemotePort () const |
Returns remote port number. | |
int | getRenewRate () const |
Returns a rate at which DHCPv6 Renew messages are sent. | |
int | getReportDelay () const |
Returns delay between two performance reports. | |
int | getRequestedIpOffset () const |
Returns template offset for requested IP. | |
Scenario | getScenario () const |
Returns selected scenario. | |
uint32_t | getSeed () const |
Returns random seed. | |
int | getServerIdOffset () const |
Returns template offset for server-ID. | |
std::string | getServerName () const |
Returns server name. | |
std::vector< std::string > | getTemplateFiles () const |
Returns template file names. | |
std::vector< int > | getTransactionIdOffset () const |
brief Returns template offsets for xid. | |
int | getWaitForElapsedTime () const |
Returns time to wait for elapsed time increase. | |
std::string | getWrapped () const |
Returns wrapped command. | |
bool | isBroadcast () const |
Checks if broadcast address is to be used. | |
bool | isInterface () const |
Checks if interface name was used. | |
bool | isRapidCommit () const |
Check if rapid commit option used. | |
bool | isSeeded () const |
Checks if seed provided. | |
bool | isSingleThreaded () const |
Check if single-threaded mode is enabled. | |
bool | isUseFirst () const |
Check if server-ID to be taken from first package. | |
bool | isUseRelayedV6 () const |
Check if generated DHCPv6 messages should appear as relayed. | |
bool | parse (int argc, char **const argv, bool print_cmd_line=false) |
Parse command line. | |
void | printCommandLine () const |
Print command line arguments. | |
void | reset () |
Reset to defaults. | |
bool | testDiags (const char diag) |
Find if diagnostic flag has been set. | |
void | version () const |
Print program version. | |
Static Public Member Functions | |
static void | usage () |
Print usage. | |
Static Public Attributes | |
static const uint8_t | RELAY_OPTIONS_MAX_ENCAPSULATION = 1 |
Maximum allowed level of encapsulation of added relay options. | |
Command Options.
This class is responsible for parsing the command-line and storing the specified options.
Definition at line 30 of file command_options.h.
typedef std::vector<std::vector<uint8_t> > isc::perfdhcp::CommandOptions::MacAddrsVector |
A vector holding MAC addresses.
Definition at line 42 of file command_options.h.
2-way (cmd line param -i) or 4-way exchanges
Enumerator | |
---|---|
DO_SA | |
DORA_SARR |
Definition at line 120 of file command_options.h.
|
inline |
Default Constructor.
Private constructor as this is a singleton class. Use CommandOptions::instance() to get instance of it.
Definition at line 37 of file command_options.h.
References reset().
|
inline |
Check if multi subnet mode is enabled.
Definition at line 426 of file command_options.h.
Referenced by isc::perfdhcp::TestControl::setDefaults4(), and isc::perfdhcp::TestControl::setDefaults6().
void isc::perfdhcp::CommandOptions::extendedVersion | ( | ) | const |
Print extended program version.
Definition at line 1269 of file command_options.cc.
|
inline |
Returns address uniqueness value.
Definition at line 212 of file command_options.h.
Referenced by isc::perfdhcp::TestControl::address4Uniqueness(), and isc::perfdhcp::TestControl::address6Uniqueness().
|
inline |
Returns base values.
Definition at line 207 of file command_options.h.
|
inline |
Returns clean report mode.
Definition at line 182 of file command_options.h.
Referenced by isc::perfdhcp::TestControl::printIntermediateStats().
|
inline |
Returns clean report separator.
Definition at line 187 of file command_options.h.
Referenced by isc::perfdhcp::TestControl::printIntermediateStats().
|
inline |
Returns number of simulated clients.
Definition at line 192 of file command_options.h.
Referenced by isc::perfdhcp::TestControl::TestControl(), isc::perfdhcp::TestControl::generateDuid(), isc::perfdhcp::TestControl::generateMacAddress(), and isc::perfdhcp::AvalancheScen::run().
|
inline |
Returns diagnostic selectors.
Definition at line 371 of file command_options.h.
Referenced by main(), and testDiags().
|
inline |
Returns drop time.
The method returns maximum time elapsed from sending the packet before it is assumed dropped.
Definition at line 242 of file command_options.h.
|
inline |
Returns DUID template.
Definition at line 202 of file command_options.h.
Referenced by isc::perfdhcp::TestControl::generateDuid(), and isc::perfdhcp::TestControl::printDiagnostics().
|
inline |
Returns template offset for elapsed time.
Definition at line 356 of file command_options.h.
Referenced by isc::perfdhcp::TestControl::getElapsedTimeOffset().
|
inline |
Returns packet exchange mode.
Definition at line 152 of file command_options.h.
Referenced by isc::perfdhcp::TestControl::printRate(), isc::perfdhcp::TestControl::processReceivedPacket4(), isc::perfdhcp::TestControl::processReceivedPacket6(), and isc::perfdhcp::AvalancheScen::run().
|
inline |
Returns the time in microseconds to delay the program by.
Definition at line 291 of file command_options.h.
Referenced by isc::perfdhcp::TestControl::waitToExit().
|
inline |
Returns extra options to be inserted.
Definition at line 381 of file command_options.h.
Referenced by isc::perfdhcp::TestControl::addExtraOpts(), and isc::perfdhcp::TestControl::addExtraOpts().
|
inline |
Returns increased elapsed time.
Definition at line 234 of file command_options.h.
Referenced by isc::perfdhcp::TestControl::sendDiscover4(), and isc::perfdhcp::TestControl::sendSolicit6().
|
inline |
Returns IP version.
Definition at line 147 of file command_options.h.
Referenced by isc::perfdhcp::AbstractScen::AbstractScen(), isc::perfdhcp::TestControl::TestControl(), isc::perfdhcp::TestControl::consumeReceivedPackets(), isc::perfdhcp::TestControl::getElapsedTimeOffset(), isc::perfdhcp::TestControl::getRandomOffset(), isc::perfdhcp::TestControl::getRequestedIpOffset(), isc::perfdhcp::TestControl::getServerIdOffset(), isc::perfdhcp::TestControl::getTransactionIdOffset(), isc::perfdhcp::TestControl::haveAllPacketsBeenReceived(), isc::perfdhcp::TestControl::printRate(), isc::perfdhcp::TestControl::printTemplate(), isc::perfdhcp::TestControl::printTemplates(), isc::perfdhcp::TestControl::registerOptionFactories(), isc::perfdhcp::AvalancheScen::resendPackets(), isc::perfdhcp::BasicScen::run(), and isc::perfdhcp::TestControl::sendPackets().
|
inline |
\ brief Returns the type of lease being requested.
Definition at line 157 of file command_options.h.
Referenced by isc::perfdhcp::TestControl::copyIaOptions(), printCommandLine(), isc::perfdhcp::TestControl::sendSolicit6(), and isc::perfdhcp::TestControl::validateIA().
|
inline |
Returns local address or interface name.
Definition at line 263 of file command_options.h.
|
inline |
Returns local port number.
Definition at line 281 of file command_options.h.
Referenced by printCommandLine().
|
inline |
Returns location of the file containing list of MAC addresses.
MAC addresses read from the file are used by the perfdhcp in message exchanges with the DHCP server.
Definition at line 334 of file command_options.h.
|
inline |
Returns reference to a vector of MAC addresses read from a file.
Every MAC address is represented as a vector.
Definition at line 341 of file command_options.h.
Referenced by isc::perfdhcp::TestControl::generateDuid(), and isc::perfdhcp::TestControl::generateMacAddress().
|
inline |
Returns MAC address template.
Definition at line 197 of file command_options.h.
Referenced by isc::perfdhcp::TestControl::generateMacAddress(), and isc::perfdhcp::TestControl::printDiagnostics().
|
inline |
Returns maximum drops number.
Returns maximum number of packet drops before aborting a test.
Definition at line 250 of file command_options.h.
Referenced by isc::perfdhcp::BasicScen::checkExitConditions().
|
inline |
Returns maximal percentage of drops.
Returns maximal percentage of packet drops before aborting a test.
Definition at line 258 of file command_options.h.
Referenced by isc::perfdhcp::BasicScen::checkExitConditions().
|
inline |
Returns maximum number of exchanges.
Definition at line 217 of file command_options.h.
Referenced by isc::perfdhcp::BasicScen::checkExitConditions(), and isc::perfdhcp::TestControl::haveAllPacketsBeenReceived().
|
inline |
Returns test period.
Definition at line 222 of file command_options.h.
Referenced by isc::perfdhcp::BasicScen::checkExitConditions().
|
inline |
Returns number of preload exchanges.
Definition at line 276 of file command_options.h.
Referenced by isc::perfdhcp::BasicScen::run().
|
inline |
Returns template offsets for rnd.
Definition at line 351 of file command_options.h.
Referenced by isc::perfdhcp::TestControl::getRandomOffset().
|
inline |
Returns random relay address.
Definition at line 421 of file command_options.h.
Referenced by isc::perfdhcp::TestControl::setDefaults4(), and isc::perfdhcp::TestControl::setDefaults6().
|
inline |
Returns exchange rate.
Definition at line 162 of file command_options.h.
Referenced by isc::perfdhcp::BasicScen::BasicScen(), isc::perfdhcp::TestControl::printRate(), and isc::perfdhcp::BasicScen::run().
|
inline |
Returns list of relay addresses.
Definition at line 416 of file command_options.h.
|
inline |
Returns file location with set of relay addresses.
Definition at line 411 of file command_options.h.
const isc::dhcp::OptionCollection & isc::perfdhcp::CommandOptions::getRelayOpts | ( | uint8_t | encapsulation_level = 1 | ) | const |
Returns relay options to be inserted at given level of encapsulation.
encapsulation_level | level of encapsulation, by default 1 |
isc::OutOfRange | When trying to access relay options at encapsulation level that doesn't exist. |
Definition at line 911 of file command_options.cc.
References isc_throw, and RELAY_OPTIONS_MAX_ENCAPSULATION.
Referenced by isc::perfdhcp::TestControl::setDefaults6().
|
inline |
Returns a rate at which DHCPv6 Release messages are sent.
Definition at line 172 of file command_options.h.
Referenced by isc::perfdhcp::BasicScen::BasicScen(), printCommandLine(), and isc::perfdhcp::BasicScen::run().
|
inline |
Returns remote port number.
Definition at line 286 of file command_options.h.
Referenced by printCommandLine(), isc::perfdhcp::TestControl::setDefaults4(), and isc::perfdhcp::TestControl::setDefaults6().
|
inline |
Returns a rate at which DHCPv6 Renew messages are sent.
Definition at line 167 of file command_options.h.
Referenced by isc::perfdhcp::BasicScen::BasicScen(), isc::perfdhcp::TestControl::cleanCachedPackets(), printCommandLine(), and isc::perfdhcp::BasicScen::run().
|
inline |
Returns delay between two performance reports.
Definition at line 177 of file command_options.h.
Referenced by isc::perfdhcp::TestControl::printIntermediateStats(), and isc::perfdhcp::BasicScen::run().
|
inline |
Returns template offset for requested IP.
Definition at line 366 of file command_options.h.
Referenced by isc::perfdhcp::TestControl::getRequestedIpOffset().
|
inline |
|
inline |
Returns random seed.
Definition at line 301 of file command_options.h.
Referenced by isc::perfdhcp::TestControl::TestControl().
|
inline |
Returns template offset for server-ID.
Definition at line 361 of file command_options.h.
Referenced by isc::perfdhcp::TestControl::getServerIdOffset().
|
inline |
Returns server name.
Definition at line 406 of file command_options.h.
Referenced by isc::perfdhcp::TestControl::setDefaults4(), and isc::perfdhcp::TestControl::setDefaults6().
|
inline |
Returns template file names.
Definition at line 326 of file command_options.h.
Referenced by isc::perfdhcp::TestControl::initPacketTemplates().
|
inline |
brief Returns template offsets for xid.
Definition at line 346 of file command_options.h.
Referenced by isc::perfdhcp::TestControl::getTransactionIdOffset().
|
inline |
Returns time to wait for elapsed time increase.
Definition at line 228 of file command_options.h.
Referenced by isc::perfdhcp::TestControl::sendDiscover4(), and isc::perfdhcp::TestControl::sendSolicit6().
|
inline |
Returns wrapped command.
Definition at line 376 of file command_options.h.
Referenced by isc::perfdhcp::BasicScen::run(), and isc::perfdhcp::TestControl::runWrapped().
|
inline |
Checks if broadcast address is to be used.
Definition at line 306 of file command_options.h.
|
inline |
Checks if interface name was used.
The method checks if interface name was used rather than address.
Definition at line 271 of file command_options.h.
|
inline |
Check if rapid commit option used.
Definition at line 311 of file command_options.h.
Referenced by isc::perfdhcp::TestControl::printRate(), and isc::perfdhcp::TestControl::sendSolicit6().
|
inline |
Checks if seed provided.
Definition at line 296 of file command_options.h.
Referenced by isc::perfdhcp::TestControl::TestControl().
|
inline |
Check if single-threaded mode is enabled.
Definition at line 396 of file command_options.h.
|
inline |
Check if server-ID to be taken from first package.
Definition at line 316 of file command_options.h.
Referenced by isc::perfdhcp::TestControl::createMessageFromAck(), isc::perfdhcp::TestControl::sendRequest4(), isc::perfdhcp::TestControl::sendRequest4(), isc::perfdhcp::TestControl::sendRequest6(), and isc::perfdhcp::TestControl::sendRequest6().
|
inline |
Check if generated DHCPv6 messages should appear as relayed.
Definition at line 321 of file command_options.h.
Referenced by isc::perfdhcp::TestControl::setDefaults6().
bool isc::perfdhcp::CommandOptions::parse | ( | int | argc, |
char **const | argv, | ||
bool | print_cmd_line = false ) |
Parse command line.
Parses the command line and stores the selected options in class data members.
argc | Argument count passed to main(). |
argv | Argument value array passed to main(). |
print_cmd_line | Print the command line being run to the console. |
isc::InvalidParameter | if parse fails. |
Definition at line 174 of file command_options.cc.
References reset().
void isc::perfdhcp::CommandOptions::printCommandLine | ( | ) | const |
Print command line arguments.
Definition at line 1149 of file command_options.cc.
References DO_SA, getLeaseType(), getLocalPort(), getReleaseRate(), getRemotePort(), getRenewRate(), and isc::perfdhcp::CommandOptions::LeaseType::toText().
Referenced by isc::perfdhcp::TestControl::printDiagnostics().
void isc::perfdhcp::CommandOptions::reset | ( | ) |
Reset to defaults.
Reset data members to default values. This is specifically useful when unit tests are performed using different command line options.
Definition at line 100 of file command_options.cc.
References isc::perfdhcp::CommandOptions::LeaseType::ADDRESS, isc::perfdhcp::BASIC, DORA_SARR, RELAY_OPTIONS_MAX_ENCAPSULATION, and isc::perfdhcp::CommandOptions::LeaseType::set().
Referenced by CommandOptions(), and parse().
|
inline |
Find if diagnostic flag has been set.
diag | diagnostic flag (a,e,i,s,r,t,T). |
Definition at line 432 of file command_options.h.
References getDiags().
Referenced by isc::perfdhcp::BasicScen::checkExitConditions(), isc::perfdhcp::TestControl::printDiagnostics(), isc::perfdhcp::TestControl::printStats(), isc::perfdhcp::AvalancheScen::run(), isc::perfdhcp::BasicScen::run(), isc::perfdhcp::TestControl::saveFirstPacket(), isc::perfdhcp::TestControl::saveFirstPacket(), and isc::perfdhcp::TestControl::sendRequest6().
|
static |
Print usage.
Prints perfdhcp usage.
Definition at line 1258 of file command_options.cc.
Referenced by main().
void isc::perfdhcp::CommandOptions::version | ( | ) | const |
Print program version.
Definition at line 1264 of file command_options.cc.
|
static |
Maximum allowed level of encapsulation of added relay options.
Definition at line 45 of file command_options.h.
Referenced by getRelayOpts(), and reset().