7 #ifndef COMMAND_OPTIONS_H
8 #define COMMAND_OPTIONS_H
12 #include <boost/noncopyable.hpp>
72 bool is(
const Type lease_type)
const;
94 void set(
const Type lease_type);
109 std::string
toText()
const;
139 bool parse(
int argc,
char**
const argv,
bool print_cmd_line =
false);
204 std::vector<std::string>
getBase()
const {
return base_; }
408 std::string
getRandRelayAddr() {
return relay_addr_list_[rand() % relay_addr_list_.size()]; }
420 if (
getDiags().find(diag) != std::string::npos) {
449 bool initialize(
int argc,
char** argv,
bool print_cmd_line);
467 inline void check(
bool condition,
const std::string& errmsg)
const;
473 int positiveInteger(
const std::string& errmsg)
const;
479 int nonNegativeInteger(
const std::string& errmsg)
const;
485 std::string nonEmptyString(
const std::string& errmsg)
const;
490 void initLeaseType();
498 void initClientsNum();
505 void initIsInterface();
522 void decodeBase(
const std::string& base);
533 void decodeMacBase(
const std::string& base);
544 void decodeDuid(
const std::string& base);
552 void generateDuidTemplate();
558 uint8_t convertHexString(
const std::string& hex_text)
const;
566 bool decodeMacString(
const std::string& line);
569 void loadRelayAddr();
575 bool validateIP(
const std::string& line);
585 LeaseType lease_type_;
591 unsigned int renew_rate_;
594 unsigned int release_rate_;
603 std::string clean_report_separator_;
606 uint32_t clients_num_;
610 std::vector<uint8_t> mac_template_;
614 std::vector<uint8_t> duid_template_;
621 std::vector<std::string> base_;
627 std::vector<int> num_request_;
634 int wait_for_elapsed_time_;
638 int increased_elapsed_time_;
642 uint8_t drop_time_set_;
647 std::vector<double> drop_time_;
653 std::vector<int> max_drop_;
658 std::vector<double> max_pdrop_;
661 std::string localname_;
696 std::vector<std::string> template_file_;
703 std::string mac_list_file_;
706 std::vector<std::vector<uint8_t> > mac_list_;
709 std::string relay_addr_list_file_;
712 std::vector<std::string> relay_addr_list_;
721 std::vector<int> xid_offset_;
726 std::vector<int> rnd_offset_;
743 std::string wrapped_;
746 std::string server_name_;
749 uint8_t v6_relay_encapsulation_level_;
755 bool single_thread_mode_;
764 #endif // COMMAND_OPTIONS_H
bool isInterface() const
Checks if interface name was used.
int getElapsedTimeOffset() const
Returns template offset for elapsed time.
std::vector< std::string > getBase() const
Returns base values.
bool isUseFirst() const
Check if server-ID to be taken from first package.
bool parse(int argc, char **const argv, bool print_cmd_line=false)
Parse command line.
LeaseType getLeaseType() const
\ brief Returns the type of lease being requested.
int getPreload() const
Returns number of preload exchanges.
void printCommandLine() const
Print command line arguments.
int getRemotePort() const
Returns remote port number.
const MacAddrsVector & getMacsFromFile() const
Returns reference to a vector of MAC addresses read from a file.
uint32_t getClientsNum() const
Returns number of simulated clients.
Scenario getScenario() const
Returns selected scenario.
std::vector< std::vector< uint8_t > > MacAddrsVector
A vector holding MAC addresses.
void set(const Type lease_type)
Sets the lease type code.
int getIncreaseElapsedTime() const
Returns increased elapsed time.
bool getAddrUnique() const
Returns address uniqueness value.
bool checkMultiSubnet()
Check if multi subnet mode is enabled.
CommandOptions()
Default Constructor.
int getRequestedIpOffset() const
Returns template offset for requested IP.
int getPeriod() const
Returns test period.
int getReportDelay() const
Returns delay between two performance reports.
const isc::dhcp::OptionCollection & getExtraOpts() const
Returns extra options to be inserted.
std::vector< std::string > getTemplateFiles() const
Returns template file names.
std::vector< std::string > getRelayAddrList() const
Returns list of relay addresses.
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 a...
std::vector< double > getDropTime() const
Returns drop time.
std::vector< double > getMaxDropPercentage() const
Returns maximal percentage of drops.
bool isRapidCommit() const
Check if rapid commit option used.
bool isSingleThreaded() const
Check if single-threaded mode is enabled.
bool isUseRelayedV6() const
Check if generated DHCPv6 messages should appear as relayed.
std::string getRandRelayAddr()
Returns random relay address.
std::string getDiags() const
Returns diagnostic selectors.
int getExitWaitTime() const
Returns the time in microseconds to delay the program by.
uint8_t getIpVersion() const
Returns IP version.
std::multimap< unsigned int, OptionPtr > OptionCollection
A collection of DHCP (v4 or v6) options.
uint32_t getSeed() const
Returns random seed.
std::string getRelayAddrListFile() const
Returns file location with set of relay addresses.
std::vector< int > getMaxDrop() const
Returns maximum drops number.
std::vector< int > getTransactionIdOffset() const
brief Returns template offsets for xid.
std::string getMacListFile() const
Returns location of the file containing list of MAC addresses.
void version() const
Print program version.
Defines the logger used by the top-level component of kea-dhcp-ddns.
int getCleanReport() const
Returns clean report mode.
A class encapsulating the type of lease being requested from the server.
bool isBroadcast() const
Checks if broadcast address is to be used.
void reset()
Reset to defaults.
std::string getServerName() const
Returns server name.
bool isSeeded() const
Checks if seed provided.
int getRate() const
Returns exchange rate.
ExchangeMode getExchangeMode() const
Returns packet exchange mode.
int getRenewRate() const
Returns a rate at which DHCPv6 Renew messages are sent.
std::string getLocalName() const
Returns local address or interface name.
void usage() const
Print usage.
std::vector< uint8_t > getDuidTemplate() const
Returns DUID template.
bool testDiags(const char diag)
Find if diagnostic flag has been set.
int getReleaseRate() const
Returns a rate at which DHCPv6 Release messages are sent.
std::string getCleanReportSeparator() const
Returns clean report separator.
std::string toText() const
Return textual representation of the lease type.
std::vector< uint8_t > getMacTemplate() const
Returns MAC address template.
ExchangeMode
2-way (cmd line param -i) or 4-way exchanges
std::string getWrapped() const
Returns wrapped command.
int getWaitForElapsedTime() const
Returns time to wait for elapsed time increase.
bool is(const Type lease_type) const
Checks if lease type has the specified code.
std::vector< int > getNumRequests() const
Returns maximum number of exchanges.
int getServerIdOffset() const
Returns template offset for server-ID.
int getLocalPort() const
Returns local port number.
std::vector< int > getRandomOffset() const
Returns template offsets for rnd.