DORA_SARR
};
- /// \brief Reset to defaults
+ /// \brief Reset to defaults.
///
/// Reset data members to default values. This is specifically
/// useful when unit tests are performed using different
/// \brief Returns address uniqueness value.
///
- /// \return address uniqueness specified value
+ /// \return address uniqueness specified value.
bool getAddrUnique() const { return addr_unique_; }
/// \brief Returns maximum number of exchanges.
/// \return test period before it is aborted.
int getPeriod() const { return period_; }
- /// \brief Returns drop time
+ /// \brief Returns drop time.
///
/// The method returns maximum time elapsed from
/// sending the packet before it is assumed dropped.
/// @brief Returns extra options to be inserted.
///
- /// @return container with options
+ /// @return container with options.
const isc::dhcp::OptionCollection& getExtraOpts() const { return extra_opts_; }
/// \brief Check if single-threaded mode is enabled.
bool decodeMacString(const std::string& line);
/// IP protocol version to be used, expected values are:
- /// 4 for IPv4 and 6 for IPv6, default value 0 means "not set"
+ /// 4 for IPv4 and 6 for IPv6, default value 0 means "not set".
uint8_t ipversion_;
- /// Packet exchange mode (e.g. DORA/SARR)
+ /// Packet exchange mode (e.g. DORA/SARR).
ExchangeMode exchange_mode_;
/// Lease Type to be obtained: address only, IPv6 prefix only.
LeaseType lease_type_;
- /// Rate in exchange per second
+ /// Rate in exchange per second.
unsigned int rate_;
/// A rate at which DHCPv6 Renew messages are sent.
/// A rate at which DHCPv6 Release messages are sent.
unsigned int release_rate_;
- /// Delay between generation of two consecutive performance reports
+ /// Delay between generation of two consecutive performance reports.
int report_delay_;
/// Number of simulated clients (aka randomization range).
std::vector<uint8_t> mac_template_;
/// DUID template used to generate unique DUIDs for
- /// simulated clients
+ /// simulated clients.
std::vector<uint8_t> duid_template_;
- /// Check address uniqueness
+ /// Check address uniqueness.
bool addr_unique_;
/// Collection of base values specified with -b<value>
- /// options. Supported "bases" are mac=<mac> and duid=<duid>
+ /// options. Supported "bases" are mac=<mac> and duid=<duid>.
std::vector<std::string> base_;
- /// Number of microseconds by which you should delay the exit
+ /// Number of microseconds by which you should delay the exit.
int exit_wait_time_;
/// Number of 2 or 4-way exchanges to perform.
std::vector<int> num_request_;
- /// Test period in seconds
+ /// Test period in seconds.
int period_;
/// Indicates number of -d<value> parameters specified by user.
/// Time to elapse before request is lost. The first value of
/// two-element vector refers to DO/SA exchanges,
- /// second value refers to RA/RR. Default values are { 1, 1 }
+ /// second value refers to RA/RR. Default values are { 1, 1 }.
std::vector<double> drop_time_;
/// Maximum number of drops request before aborting test.
std::string localname_;
/// Indicates that specified value with -l<value> is
- /// rather interface (not address)
+ /// rather interface (not address).
bool is_interface_;
/// Number of preload packets. Preload packets are used to
/// measurements.
int preload_;
- /// Local port number (host endian)
+ /// Local port number (host endian).
int local_port_;
- /// Remote port number (host endian)
+ /// Remote port number (host endian).
int remote_port_;
/// Randomization seed.
/// Offset of transaction id in template files. First vector
/// element points to offset for DISCOVER/SOLICIT messages,
/// second element points to transaction id offset for
- /// REQUEST messages
+ /// REQUEST messages.
std::vector<int> xid_offset_;
/// Random value offset in templates. Random value offset
/// Offset of server id option in template packet.
int sid_offset_;
- /// Offset of requested ip data in template packet
+ /// Offset of requested ip data in template packet.
int rip_offset_;
/// String representing diagnostic selectors specified
CustomCounter() { };
uint64_t counter_; ///< Counter's value.
- std::string name_; ///< Counter's name.
+ std::string name_; ///< Counter's name.
};
typedef typename boost::shared_ptr<CustomCounter> CustomCounterPtr;
static_cast<double>(unordered_lookups_));
}
- /// \brief Return number of unordered sent packets lookups
+ /// \brief Return number of unordered sent packets lookups.
///
/// Method returns number of unordered sent packet lookups.
/// Unordered lookup is used when received packet was sent
/// \return number of unordered lookups.
uint64_t getUnorderedLookups() const { return(unordered_lookups_); }
- /// \brief Return number of ordered sent packets lookups
+ /// \brief Return number of ordered sent packets lookups.
///
/// Method returns number of ordered sent packet lookups.
/// Ordered lookup is used when packets are received in the
/// \return number of ordered lookups.
uint64_t getOrderedLookups() const { return(ordered_lookups_); }
- /// \brief Return total number of sent packets
+ /// \brief Return total number of sent packets.
///
/// Method returns total number of sent packets.
///
/// \return number of sent packets.
uint64_t getSentPacketsNum() const { return(sent_packets_num_); }
- /// \brief Return total number of received packets
+ /// \brief Return total number of received packets.
///
/// Method returns total number of received packets.
///
/// Method increases total number of rejected leases by one.
void updateRejLeases() { ++rejected_leases_num_; }
- /// \brief Increase number of non unique leases.
+ /// \brief Increase number of non unique addresses.
///
/// Method increases total number of non unique addresses by one.
void updateNonUniqueAddr() { ++non_unique_addr_num_; }
/// Map containing all specified exchange types.
typedef typename std::map<ExchangeType, ExchangeStatsPtr> ExchangesMap;
-/// Iterator pointing to \ref ExchangesMap
+/// Iterator pointing to \ref ExchangesMap.
typedef typename ExchangesMap::const_iterator ExchangesMapIterator;
return(xchg_stats->getAvgUnorderedLookupSetSize());
}
- /// \brief Return number of unordered sent packets lookups
+ /// \brief Return number of unordered sent packets lookups.
///
/// Method returns number of unordered sent packet lookups.
/// Unordered lookup is used when received packet was sent
return(xchg_stats->getUnorderedLookups());
}
- /// \brief Return number of ordered sent packets lookups
+ /// \brief Return number of ordered sent packets lookups.
///
/// Method returns number of ordered sent packet lookups.
/// Ordered lookup is used when packets are received in the
return(xchg_stats->getOrderedLookups());
}
- /// \brief Return total number of sent packets
+ /// \brief Return total number of sent packets.
///
/// Method returns total number of sent packets for specified
/// exchange type.
return(xchg_stats->getSentPacketsNum());
}
- /// \brief Return total number of received packets
+ /// \brief Return total number of received packets.
///
/// Method returns total number of received packets for specified
/// exchange type.
return(xchg_stats->getCollectedNum());
}
- /// \brief Return total number of rejected leases
+ /// \brief Return total number of rejected leases.
///
/// Method returns total number of rejected leases for specified
/// exchange type.
return(xchg_stats->getRejLeasesNum());
}
- /// \brief Increase total number of rejected leases
+ /// \brief Increase total number of rejected leases.
///
/// Method increases total number of rejected leases by one
/// for specified exchange type
xchg_stats->updateRejLeases();
}
- /// \brief Increase total number of non unique addresses
+ /// \brief Increase total number of non unique addresses.
///
/// Method increases total number of non unique addresses or
- /// prefixes by one for specified exchange type
+ /// prefixes by one for specified exchange type.
void updateNonUniqueAddrNum(const ExchangeType xchg_type) {
ExchangeStatsPtr xchg_stats = getExchangeStats(xchg_type);
xchg_stats->updateNonUniqueAddr();
}
- /// \brief Return total number of non unique addresses
+ /// \brief Return total number of non unique addresses.
///
/// Method returns total number of non unique addresses and/or
- /// prefixes of specified exchange type.
+ /// prefixes for specified exchange type.
///
/// \param xchg_type exchange type.
/// \throw isc::BadValue if invalid exchange type specified.
private:
- /// \brief Return exchange stats object for given exchange type
+ /// \brief Return exchange stats object for given exchange type.
///
/// Method returns exchange stats object for given exchange type.
///
/// has been reached.
void cleanCachedPackets();
+ /// \brief Get interrupted flag.
bool interrupted() const { return interrupted_; }
+ /// \brief Get stats manager.
StatsMgr& getStatsMgr() { return stats_mgr_; };
+ /// \brief Start receiver.
void start() { receiver_.start(); }
+
+ /// \brief Stop receiver.
void stop() { receiver_.stop(); }
/// \brief Run wrapped command.
/// \param do_stop execute wrapped command with "stop" argument.
void runWrapped(bool do_stop = false) const;
+ /// \brief Get received server id flag.
bool serverIdReceived() const { return first_packet_serverid_.size() > 0; }
+
+ /// \brief Get received server id.
std::string getServerId() const { return vector2Hex(first_packet_serverid_); }
/// \brief Send number of packets to initiate new exchanges.
/// in packet templates and their contents.
void printTemplates() const;
+ /// \brief Get set of unique replied addresses.
std::set<std::string>& getAllUniqueAddrReply() {
return unique_reply_address_;
}
+ /// \brief Get set of unique advertised addresses.
std::set<std::string>& getAllUniqueAddrAdvert() {
return unique_address_;
}
/// \return true if the message include correct IA, false otherwise.
bool validateIA(const dhcp::Pkt6Ptr& pkt6);
- /// \brief Process received v6 address uniqueness
+ /// \brief Process received v6 address uniqueness.
///
- /// Generate list of addresses and check for uniqueness
+ /// Generate list of addresses and check for uniqueness.
///
/// \param pkt6 object representing received DHCPv6 packet
- /// \param ExhchangeType enum value
+ /// \param ExhchangeType enum value.
void address6Uniqueness(const dhcp::Pkt6Ptr& pkt6, ExchangeType xchg_type);
- /// \brief Process received v4 address uniqueness
+ /// \brief Process received v4 address uniqueness.
///
- /// Generate list of addresses and check for uniqueness
+ /// Generate list of addresses and check for uniqueness.
///
/// \param pkt4 object representing received DHCPv4 packet
- /// \param ExchangeType enum value
+ /// \param ExchangeType enum value.
void address4Uniqueness(const dhcp::Pkt4Ptr& pkt4, ExchangeType xchg_type);
- /// \brief add unique address to already assigned list
+ /// \brief add unique address to already assigned list.
///
/// Add address and/or prefix to unique set if it's not already there,
/// otherwise increment the number of non unique addresses.
///
/// \param std::set set of addresses that should be added to unique list
- /// \param ExchangeType enum value
+ /// \param ExchangeType enum value.
void addUniqeAddr(const std::set<std::string>& current, ExchangeType xchg_type) {
switch(xchg_type) {
case ExchangeType::SA: {
}
}
- /// \brief remove unique address from list
+ /// \brief remove unique address from list.
///
/// If address is released we should remove it from both
/// advertised (offered) and assigned sets.
///
- /// \param std::string holding value of unique address
+ /// \param std::string holding value of unique address.
void removeUniqueAddr(const std::set<std::string>& addr) {
for (auto addr_it = addr.begin(); addr_it != addr.end(); ++addr_it) {
/// \throw isc::Unexpected if unexpected error occurred.
void processReceivedPacket6(const dhcp::Pkt6Ptr& pkt6);
- /// \brief Register option factory functions for DHCPv4
+ /// \brief Register option factory functions for DHCPv4.
///
/// Method registers option factory functions for DHCPv4.
/// These functions are called to create instances of DHCPv4
/// Use \ref registerOptionFactories instead.
void registerOptionFactories4() const;
- /// \brief Register option factory functions for DHCPv6
+ /// \brief Register option factory functions for DHCPv6.
///
/// Method registers option factory functions for DHCPv6.
/// These functions are called to create instances of DHCPv6
/// and that would create dependency between test_control.h and
/// command_options.h.
///
- /// @param pkt4 options will be added here
+ /// @param pkt4 options will be added here.
void addExtraOpts(const dhcp::Pkt4Ptr& pkt4);
/// @brief Inserts extra options specified by user.
/// and that would create dependency between test_control.h and
/// command_options.h.
///
- /// @param pkt6 options will be added here
+ /// @param pkt6 options will be added here.
void addExtraOpts(const dhcp::Pkt6Ptr& pkt6);
/// \brief Copies IA_NA or IA_PD option from one packet to another.
/// Function handles child signal by waiting for
/// the process to complete.
///
- /// \param sig signal (ignored)
+ /// \param sig signal (ignored).
static void handleChild(int sig);
/// \brief Handle interrupt signal.
/// Function sets flag indicating that program has been
/// interrupted.
///
- /// \param sig signal (ignored)
+ /// \param sig signal (ignored).
static void handleInterrupt(int sig);
/// \brief Print main diagnostics data.
/// Method prints main diagnostics data.
void printDiagnostics() const;
- /// \brief Print template information
+ /// \brief Print template information.
///
/// \param packet_type packet type.
void printTemplate(const uint8_t packet_type) const;
/// spaces or hexadecimal digits.
void readPacketTemplate(const std::string& file_name);
- /// Keep addresses and prefixes from advertise msg for uniqueness checks
+ /// \brief Keep addresses and prefixes from advertise msg for uniqueness checks.
std::set<std::string> unique_address_;
- /// Keep addresses and prefixes from reply msg for uniqueness checks
+ /// \brief Keep addresses and prefixes from reply msg for uniqueness checks.
std::set<std::string> unique_reply_address_;
+ /// \brief Socket used for DHCP traffic.
BasePerfSocket &socket_;
+
+ /// \brief Receiver used to receive DHCP traffic.
Receiver receiver_;
- boost::posix_time::ptime last_report_; ///< Last intermediate report time.
+ /// \brief Last intermediate report time.
+ boost::posix_time::ptime last_report_;
+
+ /// \brief Statistics Manager.
+ StatsMgr stats_mgr_;
- StatsMgr stats_mgr_; ///< Statistics Manager.
+ /// \brief Storage for DHCPACK messages.
+ PacketStorage<dhcp::Pkt4> ack_storage_;
- PacketStorage<dhcp::Pkt4> ack_storage_; ///< A storage for DHCPACK messages.
- PacketStorage<dhcp::Pkt6> reply_storage_; ///< A storage for reply messages.
+ /// \brief Storage for reply messages.
+ PacketStorage<dhcp::Pkt6> reply_storage_;
- NumberGeneratorPtr transid_gen_; ///< Transaction id generator.
- NumberGeneratorPtr macaddr_gen_; ///< Numbers generator for MAC address.
+ /// \brief Transaction id generator.
+ NumberGeneratorPtr transid_gen_;
- /// Buffer holding server id received in first packet
+ /// \brief Numbers generator for MAC address.
+ NumberGeneratorPtr macaddr_gen_;
+
+ /// \brief Buffer holding server id received in first packet
dhcp::OptionBuffer first_packet_serverid_;
- /// Packet template buffers.
+ /// \brief Packet template buffers.
TemplateBufferCollection template_buffers_;
/// First packets send. They are used at the end of the test
/// to print packet templates when diagnostics flag T is specified.
+
+ /// \brief Template for v4.
std::map<uint8_t, dhcp::Pkt4Ptr> template_packets_v4_;
+
+ /// \brief Template for v6.
std::map<uint8_t, dhcp::Pkt6Ptr> template_packets_v6_;
- static bool interrupted_; ///< Is program interrupted.
+ /// \brief Program interrupted flag.
+ static bool interrupted_;
+ /// \brief Command options.
CommandOptions& options_;
};