2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-31 14:05:33 +00:00

[4254] Spelling + a few reindent and copyright updates

This commit is contained in:
Francis Dupont
2016-01-17 00:05:37 +01:00
parent 585bfc578f
commit 05a27c9799
6 changed files with 83 additions and 82 deletions

View File

@@ -1,4 +1,4 @@
// Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC") // Copyright (C) 2012-2016 Internet Systems Consortium, Inc. ("ISC")
// //
// This Source Code Form is subject to the terms of the Mozilla Public // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -173,7 +173,7 @@ public:
/// 1023 values maximum. Search operation on this index generally /// 1023 values maximum. Search operation on this index generally
/// returns the range of packets that have the same transaction id /// returns the range of packets that have the same transaction id
/// hash assigned but most often these ranges will be short so further /// hash assigned but most often these ranges will be short so further
/// search within a range to find a packet with pacrticular transaction /// search within a range to find a packet with particular transaction
/// id will not be intensive. /// id will not be intensive.
/// ///
/// Example 1: Add elements to the list /// Example 1: Add elements to the list
@@ -189,7 +189,7 @@ public:
/// packets_collection.template get<0>().push_back(pkt2); /// packets_collection.template get<0>().push_back(pkt2);
/// \endcode /// \endcode
/// ///
/// Example 2: Access elements through sequencial index /// Example 2: Access elements through sequential index
/// \code /// \code
/// PktList packets_collection(); /// PktList packets_collection();
/// ... # Add elements to the container /// ... # Add elements to the container
@@ -242,7 +242,7 @@ public:
> >
> PktList; > PktList;
/// Packet list iterator for sequencial access to elements. /// Packet list iterator for sequential access to elements.
typedef typename PktList::iterator PktListIterator; typedef typename PktList::iterator PktListIterator;
/// Packet list index to search packets using transaction id hash. /// Packet list index to search packets using transaction id hash.
typedef typename PktList::template nth_index<1>::type typedef typename PktList::template nth_index<1>::type
@@ -420,7 +420,7 @@ public:
// take a little more expensive approach to look packets using // take a little more expensive approach to look packets using
// alternative index (transaction id & 1023). // alternative index (transaction id & 1023).
PktListTransidHashIndex& idx = sent_packets_.template get<1>(); PktListTransidHashIndex& idx = sent_packets_.template get<1>();
// Packets are grouped using trasaction id masked with value // Packets are grouped using transaction id masked with value
// of 1023. For instance, packets with transaction id equal to // of 1023. For instance, packets with transaction id equal to
// 1, 1024 ... will belong to the same group (a.k.a. bucket). // 1, 1024 ... will belong to the same group (a.k.a. bucket).
// When using alternative index we don't find the packet but // When using alternative index we don't find the packet but
@@ -488,14 +488,14 @@ public:
return(sent_packet); return(sent_packet);
} }
/// \brief Return minumum delay between sent and received packet. /// \brief Return minimum delay between sent and received packet.
/// ///
/// Method returns minimum delay between sent and received packet. /// Method returns minimum delay between sent and received packet.
/// ///
/// \return minimum delay between packets. /// \return minimum delay between packets.
double getMinDelay() const { return(min_delay_); } double getMinDelay() const { return(min_delay_); }
/// \brief Return maxmimum delay between sent and received packet. /// \brief Return maximum delay between sent and received packet.
/// ///
/// Method returns maximum delay between sent and received packet. /// Method returns maximum delay between sent and received packet.
/// ///
@@ -536,13 +536,13 @@ public:
getAvgDelay() * getAvgDelay())); getAvgDelay() * getAvgDelay()));
} }
/// \brief Return number of orphant packets. /// \brief Return number of orphan packets.
/// ///
/// Method returns number of received packets that had no matching /// Method returns number of received packets that had no matching
/// sent packet. It is possible that such packet was late or not /// sent packet. It is possible that such packet was late or not
/// for us. /// for us.
/// ///
/// \return number of orphant received packets. /// \return number of orphan received packets.
uint64_t getOrphans() const { return(orphans_); } uint64_t getOrphans() const { return(orphans_); }
/// \brief Return number of garbage collected packets. /// \brief Return number of garbage collected packets.
@@ -632,7 +632,8 @@ public:
/// orphans for the 4-way exchanges, which is wrong. We will need to /// orphans for the 4-way exchanges, which is wrong. We will need to
/// move the orphans counting out of the Statistics Manager so as /// move the orphans counting out of the Statistics Manager so as
/// orphans counter is increased only if the particular message is /// orphans counter is increased only if the particular message is
/// not identified as a reponse to any of the messages sent by perfdhcp. /// not identified as a response to any of the messages sent by
/// perfdhcp.
void printMainStats() const { void printMainStats() const {
using namespace std; using namespace std;
cout << "sent packets: " << getSentPacketsNum() << endl cout << "sent packets: " << getSentPacketsNum() << endl
@@ -753,7 +754,7 @@ public:
// when test is completed. // when test is completed.
archived_packets_.push_back(*it); archived_packets_.push_back(*it);
} }
// get<0>() template returns sequencial index to // get<0>() template returns sequential index to
// container. // container.
return(sent_packets_.template get<0>().erase(it)); return(sent_packets_.template get<0>().erase(it));
} }
@@ -786,7 +787,7 @@ public:
/// to keep all packets archived throughout the test. /// to keep all packets archived throughout the test.
bool archive_enabled_; bool archive_enabled_;
/// Maxmimum time elapsed between sending and receiving packet /// Maximum time elapsed between sending and receiving packet
/// before packet is assumed dropped. /// before packet is assumed dropped.
double drop_time_; double drop_time_;
@@ -797,16 +798,16 @@ public:
double sum_delay_; ///< Sum of delays between sent double sum_delay_; ///< Sum of delays between sent
///< and received packets. ///< and received packets.
double sum_delay_squared_; ///< Squared sum of delays between double sum_delay_squared_; ///< Squared sum of delays between
///< sent and recived packets. ///< sent and received packets.
uint64_t orphans_; ///< Number of orphant received packets. uint64_t orphans_; ///< Number of orphan received packets.
uint64_t collected_; ///< Number of garbage collected packets. uint64_t collected_; ///< Number of garbage collected packets.
/// Sum of unordered lookup sets. Needed to calculate mean size of /// Sum of unordered lookup sets. Needed to calculate mean size of
/// lookup set. It is desired that number of unordered lookups is /// lookup set. It is desired that number of unordered lookups is
/// minimal for performance reasons. Tracking number of lookups and /// minimal for performance reasons. Tracking number of lookups and
/// mean size of the lookup set should give idea of packets serach /// mean size of the lookup set should give idea of packets search
/// complexity. /// complexity.
uint64_t unordered_lookup_size_sum_; uint64_t unordered_lookup_size_sum_;
@@ -824,7 +825,7 @@ public:
typedef boost::shared_ptr<ExchangeStats> ExchangeStatsPtr; typedef boost::shared_ptr<ExchangeStats> ExchangeStatsPtr;
/// Map containing all specified exchange types. /// Map containing all specified exchange types.
typedef typename std::map<ExchangeType, ExchangeStatsPtr> ExchangesMap; typedef typename std::map<ExchangeType, ExchangeStatsPtr> ExchangesMap;
/// Iterator poiting to \ref ExchangesMap /// Iterator pointing to \ref ExchangesMap
typedef typename ExchangesMap::const_iterator ExchangesMapIterator; typedef typename ExchangesMap::const_iterator ExchangesMapIterator;
/// Map containing custom counters. /// Map containing custom counters.
typedef typename std::map<std::string, CustomCounterPtr> CustomCountersMap; typedef typename std::map<std::string, CustomCounterPtr> CustomCountersMap;
@@ -877,7 +878,7 @@ public:
/// This method checks if the \ref ExchangeStats object of a particular type /// This method checks if the \ref ExchangeStats object of a particular type
/// exists (has been added using \ref addExchangeStats function). /// exists (has been added using \ref addExchangeStats function).
/// ///
/// \param xchg_type A type of the exchange being repersented by the /// \param xchg_type A type of the exchange being represented by the
/// \ref ExchangeStats object. /// \ref ExchangeStats object.
/// ///
/// \return true if the \ref ExchangeStats object has been added for a /// \return true if the \ref ExchangeStats object has been added for a
@@ -903,9 +904,9 @@ public:
CustomCounterPtr(new CustomCounter(long_name)); CustomCounterPtr(new CustomCounter(long_name));
} }
/// \brief Check if any packet drops occured. /// \brief Check if any packet drops occurred.
/// ///
// \return true, if packet drops occured. // \return true, if packet drops occurred.
bool droppedPackets() const { bool droppedPackets() const {
for (ExchangesMapIterator it = exchanges_.begin(); for (ExchangesMapIterator it = exchanges_.begin();
it != exchanges_.end(); it != exchanges_.end();
@@ -921,7 +922,7 @@ public:
/// ///
/// Method returns specified counter. /// Method returns specified counter.
/// ///
/// \param counter_key key poiting to the counter in the counters map. /// \param counter_key key pointing to the counter in the counters map.
/// The short counter name has to be used to access counter. /// The short counter name has to be used to access counter.
/// \return pointer to specified counter object. /// \return pointer to specified counter object.
CustomCounterPtr getCounter(const std::string& counter_key) { CustomCounterPtr getCounter(const std::string& counter_key) {
@@ -937,7 +938,7 @@ public:
/// ///
/// Increment counter value by one. /// Increment counter value by one.
/// ///
/// \param counter_key key poiting to the counter in the counters map. /// \param counter_key key pointing to the counter in the counters map.
/// \param value value to increment counter by. /// \param value value to increment counter by.
/// \return pointer to specified counter after incrementation. /// \return pointer to specified counter after incrementation.
const CustomCounter& incrementCounter(const std::string& counter_key, const CustomCounter& incrementCounter(const std::string& counter_key,
@@ -992,7 +993,7 @@ public:
return(sent_packet); return(sent_packet);
} }
/// \brief Return minumum delay between sent and received packet. /// \brief Return minimum delay between sent and received packet.
/// ///
/// Method returns minimum delay between sent and received packet /// Method returns minimum delay between sent and received packet
/// for specified exchange type. /// for specified exchange type.
@@ -1005,7 +1006,7 @@ public:
return(xchg_stats->getMinDelay()); return(xchg_stats->getMinDelay());
} }
/// \brief Return maxmimum delay between sent and received packet. /// \brief Return maximum delay between sent and received packet.
/// ///
/// Method returns maximum delay between sent and received packet /// Method returns maximum delay between sent and received packet
/// for specified exchange type. /// for specified exchange type.
@@ -1040,14 +1041,14 @@ public:
return(xchg_stats->getStdDevDelay()); return(xchg_stats->getStdDevDelay());
} }
/// \brief Return number of orphant packets. /// \brief Return number of orphan packets.
/// ///
/// Method returns number of orphant packets for specified /// Method returns number of orphan packets for specified
/// exchange type. /// exchange type.
/// ///
/// \param xchg_type exchange type. /// \param xchg_type exchange type.
/// \throw isc::BadValue if invalid exchange type specified. /// \throw isc::BadValue if invalid exchange type specified.
/// \return number of orphant packets so far. /// \return number of orphan packets so far.
uint64_t getOrphans(const ExchangeType xchg_type) const { uint64_t getOrphans(const ExchangeType xchg_type) const {
ExchangeStatsPtr xchg_stats = getExchangeStats(xchg_type); ExchangeStatsPtr xchg_stats = getExchangeStats(xchg_type);
return(xchg_stats->getOrphans()); return(xchg_stats->getOrphans());

View File

@@ -753,7 +753,7 @@ TestControl::openSocket() const {
// Local name is specified along with '-l' option. // Local name is specified along with '-l' option.
// It may point to interface name or local address. // It may point to interface name or local address.
if (!localname.empty()) { if (!localname.empty()) {
// CommandOptions should be already aware wether local name // CommandOptions should be already aware whether local name
// is interface name or address because it uses IfaceMgr to // is interface name or address because it uses IfaceMgr to
// scan interfaces and get's their names. // scan interfaces and get's their names.
if (options.isInterface()) { if (options.isInterface()) {
@@ -826,7 +826,7 @@ TestControl::sendPackets(const TestControlSocket& socket,
for (uint64_t i = packets_num; i > 0; --i) { for (uint64_t i = packets_num; i > 0; --i) {
if (options.getIpVersion() == 4) { if (options.getIpVersion() == 4) {
// No template packets means that no -T option was specified. // No template packets means that no -T option was specified.
// We have to build packets ourselfs. // We have to build packets ourselves.
if (template_buffers_.empty()) { if (template_buffers_.empty()) {
sendDiscover4(socket, preload); sendDiscover4(socket, preload);
} else { } else {
@@ -836,7 +836,7 @@ TestControl::sendPackets(const TestControlSocket& socket,
} }
} else { } else {
// No template packets means that no -T option was specified. // No template packets means that no -T option was specified.
// We have to build packets ourselfs. // We have to build packets ourselves.
if (template_buffers_.empty()) { if (template_buffers_.empty()) {
sendSolicit6(socket, preload); sendSolicit6(socket, preload);
} else { } else {
@@ -1111,14 +1111,14 @@ TestControl::processReceivedPacket4(const TestControlSocket& socket,
} }
} }
} else if (pkt4->getType() == DHCPACK) { } else if (pkt4->getType() == DHCPACK) {
// If received message is DHCPACK, we have to check if this is a response // If received message is DHCPACK, we have to check if this is
// to 4-way exchange. We'll match this packet with a DHCPREQUESTs sent // a response to 4-way exchange. We'll match this packet with
// as part of the 4-way exchages. // a DHCPREQUEST sent as part of the 4-way exchanges.
if (stats_mgr4_->passRcvdPacket(StatsMgr4::XCHG_RA, pkt4)) { if (stats_mgr4_->passRcvdPacket(StatsMgr4::XCHG_RA, pkt4)) {
// The DHCPACK belongs to DHCPREQUEST-DHCPACK exchange type. So, we // The DHCPACK belongs to DHCPREQUEST-DHCPACK exchange type.
// may need to keep this DHCPACK in the storage if renews. Note that, // So, we may need to keep this DHCPACK in the storage if renews.
// DHCPACK messages hold the information about leases assigned. // Note that, DHCPACK messages hold the information about
// We use this information to renew. // leases assigned. We use this information to renew.
if (stats_mgr4_->hasExchangeStats(StatsMgr4::XCHG_RNA)) { if (stats_mgr4_->hasExchangeStats(StatsMgr4::XCHG_RNA)) {
// Renew messages are sent, because StatsMgr has the // Renew messages are sent, because StatsMgr has the
// specific exchange type specified. Let's append the DHCPACK. // specific exchange type specified. Let's append the DHCPACK.
@@ -1429,7 +1429,7 @@ TestControl::run() {
renew_rate_control_.getOutboundMessageCount(); renew_rate_control_.getOutboundMessageCount();
checkLateMessages(renew_rate_control_); checkLateMessages(renew_rate_control_);
// Send multiple renews to satify the desired rate. // Send multiple renews to satisfy the desired rate.
if (options.getIpVersion() == 4) { if (options.getIpVersion() == 4) {
sendMultipleRequests(socket, renew_packets_due); sendMultipleRequests(socket, renew_packets_due);
} else { } else {
@@ -1454,7 +1454,7 @@ TestControl::run() {
} }
// If we are sending Renews to the server, the Reply packets are cached // If we are sending Renews to the server, the Reply packets are cached
// so as leases for which we send Renews can be idenitfied. The major // so as leases for which we send Renews can be identified. The major
// issue with this approach is that most of the time we are caching // issue with this approach is that most of the time we are caching
// more packets than we actually need. This function removes excessive // more packets than we actually need. This function removes excessive
// Reply messages to reduce the memory and CPU utilization. Note that // Reply messages to reduce the memory and CPU utilization. Note that
@@ -1493,7 +1493,7 @@ TestControl::run() {
} }
int ret_code = 0; int ret_code = 0;
// Check if any packet drops occured. // Check if any packet drops occurred.
if (options.getIpVersion() == 4) { if (options.getIpVersion() == 4) {
ret_code = stats_mgr4_->droppedPackets() ? 3 : 0; ret_code = stats_mgr4_->droppedPackets() ? 3 : 0;
} else if (options.getIpVersion() == 6) { } else if (options.getIpVersion() == 6) {
@@ -1544,7 +1544,7 @@ TestControl::sendDiscover4(const TestControlSocket& socket,
// Generate the MAC address to be passed in the packet. // Generate the MAC address to be passed in the packet.
uint8_t randomized = 0; uint8_t randomized = 0;
std::vector<uint8_t> mac_address = generateMacAddress(randomized); std::vector<uint8_t> mac_address = generateMacAddress(randomized);
// Generate trasnaction id to be set for the new exchange. // Generate transaction id to be set for the new exchange.
const uint32_t transid = generateTransid(); const uint32_t transid = generateTransid();
Pkt4Ptr pkt4(new Pkt4(DHCPDISCOVER, transid)); Pkt4Ptr pkt4(new Pkt4(DHCPDISCOVER, transid));
if (!pkt4) { if (!pkt4) {
@@ -1589,13 +1589,13 @@ TestControl::sendDiscover4(const TestControlSocket& socket,
const std::vector<uint8_t>& template_buf, const std::vector<uint8_t>& template_buf,
const bool preload /* = false */) { const bool preload /* = false */) {
basic_rate_control_.updateSendTime(); basic_rate_control_.updateSendTime();
// Get the first argument if mulitple the same arguments specified // Get the first argument if multiple the same arguments specified
// in the command line. First one refers to DISCOVER packets. // in the command line. First one refers to DISCOVER packets.
const uint8_t arg_idx = 0; const uint8_t arg_idx = 0;
// Generate the MAC address to be passed in the packet. // Generate the MAC address to be passed in the packet.
uint8_t randomized = 0; uint8_t randomized = 0;
std::vector<uint8_t> mac_address = generateMacAddress(randomized); std::vector<uint8_t> mac_address = generateMacAddress(randomized);
// Generate trasnaction id to be set for the new exchange. // Generate transaction id to be set for the new exchange.
const uint32_t transid = generateTransid(); const uint32_t transid = generateTransid();
// Get transaction id offset. // Get transaction id offset.
size_t transid_offset = getTransactionIdOffset(arg_idx); size_t transid_offset = getTransactionIdOffset(arg_idx);
@@ -1773,7 +1773,7 @@ TestControl::sendRequest4(const TestControlSocket& socket,
// We need to go back by HW_ETHER_LEN (MAC address length) // We need to go back by HW_ETHER_LEN (MAC address length)
// because this offset points to last octet of MAC address. // because this offset points to last octet of MAC address.
size_t rand_offset = getRandomOffset(arg_idx) - HW_ETHER_LEN + 1; size_t rand_offset = getRandomOffset(arg_idx) - HW_ETHER_LEN + 1;
// Create temporaru buffer from the template. // Create temporary buffer from the template.
std::vector<uint8_t> in_buf(template_buf.begin(), std::vector<uint8_t> in_buf(template_buf.begin(),
template_buf.end()); template_buf.end());
// Check if given randomization offset is not out of bounds. // Check if given randomization offset is not out of bounds.
@@ -2042,7 +2042,7 @@ TestControl::sendSolicit6(const TestControlSocket& socket,
// Generate DUID to be passed to the packet // Generate DUID to be passed to the packet
uint8_t randomized = 0; uint8_t randomized = 0;
std::vector<uint8_t> duid = generateDuid(randomized); std::vector<uint8_t> duid = generateDuid(randomized);
// Generate trasnaction id to be set for the new exchange. // Generate transaction id to be set for the new exchange.
const uint32_t transid = generateTransid(); const uint32_t transid = generateTransid();
Pkt6Ptr pkt6(new Pkt6(DHCPV6_SOLICIT, transid)); Pkt6Ptr pkt6(new Pkt6(DHCPV6_SOLICIT, transid));
if (!pkt6) { if (!pkt6) {
@@ -2091,7 +2091,7 @@ TestControl::sendSolicit6(const TestControlSocket& socket,
const int arg_idx = 0; const int arg_idx = 0;
// Get transaction id offset. // Get transaction id offset.
size_t transid_offset = getTransactionIdOffset(arg_idx); size_t transid_offset = getTransactionIdOffset(arg_idx);
// Generate trasnaction id to be set for the new exchange. // Generate transaction id to be set for the new exchange.
const uint32_t transid = generateTransid(); const uint32_t transid = generateTransid();
// Create packet. // Create packet.
PerfPkt6Ptr pkt6(new PerfPkt6(&template_buf[0], template_buf.size(), PerfPkt6Ptr pkt6(new PerfPkt6(&template_buf[0], template_buf.size(),
@@ -2101,7 +2101,7 @@ TestControl::sendSolicit6(const TestControlSocket& socket,
} }
size_t rand_offset = getRandomOffset(arg_idx); size_t rand_offset = getRandomOffset(arg_idx);
// randomized will pick number of bytes randomized so we can // randomized will pick number of bytes randomized so we can
// just use part of the generated duid and substitude a few bytes // just use part of the generated duid and substitute a few bytes
/// in template. /// in template.
uint8_t randomized = 0; uint8_t randomized = 0;
std::vector<uint8_t> duid = generateDuid(randomized); std::vector<uint8_t> duid = generateDuid(randomized);

View File

@@ -124,7 +124,7 @@ public:
typedef StatsMgr<dhcp::Pkt4> StatsMgr4; typedef StatsMgr<dhcp::Pkt4> StatsMgr4;
/// Pointer to Statistics Manager for DHCPv4; /// Pointer to Statistics Manager for DHCPv4;
typedef boost::shared_ptr<StatsMgr4> StatsMgr4Ptr; typedef boost::shared_ptr<StatsMgr4> StatsMgr4Ptr;
/// Statictics Manager for DHCPv6. /// Statistics Manager for DHCPv6.
typedef StatsMgr<dhcp::Pkt6> StatsMgr6; typedef StatsMgr<dhcp::Pkt6> StatsMgr6;
/// Pointer to Statistics Manager for DHCPv6. /// Pointer to Statistics Manager for DHCPv6.
typedef boost::shared_ptr<StatsMgr6> StatsMgr6Ptr; typedef boost::shared_ptr<StatsMgr6> StatsMgr6Ptr;
@@ -246,7 +246,7 @@ public:
/// throw exception. /// throw exception.
/// ///
/// \throw isc::InvalidOperation if command line options are not parsed. /// \throw isc::InvalidOperation if command line options are not parsed.
/// \throw isc::Unexpected if internal Test Controller error occured. /// \throw isc::Unexpected if internal Test Controller error occurred.
/// \return error_code, 3 if number of received packets is not equal /// \return error_code, 3 if number of received packets is not equal
/// to number of sent packets, 0 if everything is ok. /// to number of sent packets, 0 if everything is ok.
int run(); int run();
@@ -545,7 +545,7 @@ protected:
/// \throw isc::InvalidOperation if broadcast option can't be /// \throw isc::InvalidOperation if broadcast option can't be
/// set for the v4 socket or if multicast option can't be set /// set for the v4 socket or if multicast option can't be set
/// for the v6 socket. /// for the v6 socket.
/// \throw isc::Unexpected if interal unexpected error occured. /// \throw isc::Unexpected if internal unexpected error occurred.
/// \return socket descriptor. /// \return socket descriptor.
int openSocket() const; int openSocket() const;
@@ -580,7 +580,7 @@ protected:
/// \param [in] socket socket to be used. /// \param [in] socket socket to be used.
/// \param [in] pkt4 object representing DHCPv4 packet received. /// \param [in] pkt4 object representing DHCPv4 packet received.
/// \throw isc::BadValue if unknown message type received. /// \throw isc::BadValue if unknown message type received.
/// \throw isc::Unexpected if unexpected error occured. /// \throw isc::Unexpected if unexpected error occurred.
void processReceivedPacket4(const TestControlSocket& socket, void processReceivedPacket4(const TestControlSocket& socket,
const dhcp::Pkt4Ptr& pkt4); const dhcp::Pkt4Ptr& pkt4);
@@ -597,7 +597,7 @@ protected:
/// \param [in] socket socket to be used. /// \param [in] socket socket to be used.
/// \param [in] pkt6 object representing DHCPv6 packet received. /// \param [in] pkt6 object representing DHCPv6 packet received.
/// \throw isc::BadValue if unknown message type received. /// \throw isc::BadValue if unknown message type received.
/// \throw isc::Unexpected if unexpected error occured. /// \throw isc::Unexpected if unexpected error occurred.
void processReceivedPacket6(const TestControlSocket& socket, void processReceivedPacket6(const TestControlSocket& socket,
const dhcp::Pkt6Ptr& pkt6); const dhcp::Pkt6Ptr& pkt6);
@@ -613,7 +613,7 @@ protected:
/// ///
/// \param socket socket to be used. /// \param socket socket to be used.
/// \throw isc::BadValue if unknown message type received. /// \throw isc::BadValue if unknown message type received.
/// \throw isc::Unexpected if unexpected error occured. /// \throw isc::Unexpected if unexpected error occurred.
/// \return number of received packets. /// \return number of received packets.
uint64_t receivePackets(const TestControlSocket& socket); uint64_t receivePackets(const TestControlSocket& socket);
@@ -798,7 +798,7 @@ protected:
/// \param discover_pkt4 DISCOVER packet sent. /// \param discover_pkt4 DISCOVER packet sent.
/// \param offer_pkt4 OFFER packet object. /// \param offer_pkt4 OFFER packet object.
/// ///
/// \throw isc::Unexpected if unexpected error occured. /// \throw isc::Unexpected if unexpected error occurred.
/// \throw isc::InvalidOperation if Statistics Manager has not been /// \throw isc::InvalidOperation if Statistics Manager has not been
/// initialized. /// initialized.
/// \throw isc::dhcp::SocketWriteError if failed to send the packet. /// \throw isc::dhcp::SocketWriteError if failed to send the packet.
@@ -835,7 +835,7 @@ protected:
/// ///
/// \param socket socket to be used to send message. /// \param socket socket to be used to send message.
/// \param advertise_pkt6 ADVERTISE packet object. /// \param advertise_pkt6 ADVERTISE packet object.
/// \throw isc::Unexpected if unexpected error occured. /// \throw isc::Unexpected if unexpected error occurred.
/// \throw isc::InvalidOperation if Statistics Manager has not been /// \throw isc::InvalidOperation if Statistics Manager has not been
/// initialized. /// initialized.
/// ///
@@ -1006,7 +1006,7 @@ protected:
/// \brief Return transaction id offset in a packet. /// \brief Return transaction id offset in a packet.
/// ///
/// \param arg_idx command line argument index to be used. /// \param arg_idx command line argument index to be used.
/// If multiple -X parameters specifed it points to the /// If multiple -X parameters specified it points to the
/// one to be used. /// one to be used.
/// \return transaction id offset in packet. /// \return transaction id offset in packet.
int getTransactionIdOffset(const int arg_idx) const; int getTransactionIdOffset(const int arg_idx) const;
@@ -1125,7 +1125,7 @@ protected:
TemplateBufferCollection template_buffers_; TemplateBufferCollection template_buffers_;
/// First packets send. They are used at the end of the test /// First packets send. They are used at the end of the test
/// to print packet templates when diagnostics flag T is specifed. /// to print packet templates when diagnostics flag T is specified.
std::map<uint8_t, dhcp::Pkt4Ptr> template_packets_v4_; std::map<uint8_t, dhcp::Pkt4Ptr> template_packets_v4_;
std::map<uint8_t, dhcp::Pkt6Ptr> template_packets_v6_; std::map<uint8_t, dhcp::Pkt6Ptr> template_packets_v6_;

View File

@@ -383,7 +383,7 @@ TEST_F(CommandOptionsTest, ReleaseRate) {
// The release-rate of 0 is invalid. // The release-rate of 0 is invalid.
EXPECT_THROW(process("perfdhcp -6 -r 10 -F 0 -l ethx all"), EXPECT_THROW(process("perfdhcp -6 -r 10 -F 0 -l ethx all"),
isc::InvalidParameter); isc::InvalidParameter);
// The negative rlease-rate is invalid. // The negative release-rate is invalid.
EXPECT_THROW(process("perfdhcp -6 -r 10 -F -5 -l ethx all"), EXPECT_THROW(process("perfdhcp -6 -r 10 -F -5 -l ethx all"),
isc::InvalidParameter); isc::InvalidParameter);
// If -r<rate> is not specified the -F<release-rate> should not // If -r<rate> is not specified the -F<release-rate> should not
@@ -633,7 +633,7 @@ TEST_F(CommandOptionsTest, Seed) {
EXPECT_EQ(0, opt.getSeed()); EXPECT_EQ(0, opt.getSeed());
EXPECT_FALSE(opt.isSeeded()); EXPECT_FALSE(opt.isSeeded());
// Negtaive test cases // Negative test cases
// Seed must be non-negative integer // Seed must be non-negative integer
EXPECT_THROW(process("perfdhcp -6 -P 2 -s -5 -l ethx all"), EXPECT_THROW(process("perfdhcp -6 -P 2 -s -5 -l ethx all"),
isc::InvalidParameter); isc::InvalidParameter);
@@ -767,7 +767,7 @@ TEST_F(CommandOptionsTest, Interface) {
// at least one interface name on OS where test is run. // at least one interface name on OS where test is run.
// Interface Manager has ability to detect interfaces. // Interface Manager has ability to detect interfaces.
// Although we don't call initIsInterface explicitly // Although we don't call initIsInterface explicitly
// here it is called by CommandOptions object interally // here it is called by CommandOptions object internally
// so this function is covered by the test. // so this function is covered by the test.
dhcp::IfaceMgr& iface_mgr = dhcp::IfaceMgr::instance(); dhcp::IfaceMgr& iface_mgr = dhcp::IfaceMgr::instance();
const dhcp::IfaceMgr::IfaceCollection& ifaces = iface_mgr.getIfaces(); const dhcp::IfaceMgr::IfaceCollection& ifaces = iface_mgr.getIfaces();

View File

@@ -1,4 +1,4 @@
// Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC") // Copyright (C) 2012-2016 Internet Systems Consortium, Inc. ("ISC")
// //
// This Source Code Form is subject to the terms of the Mozilla Public // This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -50,7 +50,7 @@ public:
// Packet timestamp is normally updated by interface // Packet timestamp is normally updated by interface
// manager on packets reception or send. Unit tests // manager on packets reception or send. Unit tests
// do not use interface manager so we need to do it // do not use interface manager so we need to do it
// ourselfs. // ourselves.
pkt->updateTimestamp(); pkt->updateTimestamp();
return pkt; return pkt;
} }
@@ -68,7 +68,7 @@ public:
// Packet timestamp is normally updated by interface // Packet timestamp is normally updated by interface
// manager on packets reception or send. Unit tests // manager on packets reception or send. Unit tests
// do not use interface manager so we need to do it // do not use interface manager so we need to do it
// ourselfs. // ourselves.
pkt->updateTimestamp(); pkt->updateTimestamp();
return pkt; return pkt;
} }
@@ -238,7 +238,7 @@ TEST_F(StatsMgrTest, MultipleExchanges) {
passMultiplePackets6(stats_mgr, StatsMgr6::XCHG_RR, DHCPV6_REQUEST, passMultiplePackets6(stats_mgr, StatsMgr6::XCHG_RR, DHCPV6_REQUEST,
request_packets_num); request_packets_num);
// Check if all packets are successfuly passed to packet lists. // Check if all packets are successfully passed to packet lists.
EXPECT_EQ(solicit_packets_num, EXPECT_EQ(solicit_packets_num,
stats_mgr->getSentPacketsNum(StatsMgr6::XCHG_SA)); stats_mgr->getSentPacketsNum(StatsMgr6::XCHG_SA));
EXPECT_EQ(request_packets_num, EXPECT_EQ(request_packets_num,
@@ -378,7 +378,7 @@ TEST_F(StatsMgrTest, Delays) {
std::numeric_limits<double>::max()); std::numeric_limits<double>::max());
EXPECT_GT(stats_mgr->getMinDelay(StatsMgr4::XCHG_DO), 1); EXPECT_GT(stats_mgr->getMinDelay(StatsMgr4::XCHG_DO), 1);
// Max delay is supposed to the same value as mininimum // Max delay is supposed to the same value as minimum
// or maximum delay. // or maximum delay.
EXPECT_GT(stats_mgr->getMaxDelay(StatsMgr4::XCHG_DO), 1); EXPECT_GT(stats_mgr->getMaxDelay(StatsMgr4::XCHG_DO), 1);

View File

@@ -69,7 +69,7 @@ public:
uint32_t transid_; ///< Last generated transaction id. uint32_t transid_; ///< Last generated transaction id.
}; };
/// \brief Sets the due times for sedning Solicit, Renew and Release. /// \brief Sets the due times for sending Solicit, Renew and Release.
/// ///
/// There are three class members that hold the due time for sending DHCP /// There are three class members that hold the due time for sending DHCP
/// messages: /// messages:
@@ -268,7 +268,7 @@ public:
/// \param requested_options reference buffer with options. /// \param requested_options reference buffer with options.
/// \param buf test buffer with options that will be matched. /// \param buf test buffer with options that will be matched.
/// \return number of options from the buffer matched with options in /// \return number of options from the buffer matched with options in
/// the reference buffer or -1 if error occured. /// the reference buffer or -1 if error occurred.
int matchRequestedOptions6(const dhcp::OptionBuffer& requested_options, int matchRequestedOptions6(const dhcp::OptionBuffer& requested_options,
const dhcp::OptionBuffer& buf) const { const dhcp::OptionBuffer& buf) const {
// Sanity check. // Sanity check.
@@ -319,7 +319,7 @@ public:
return (cnt); return (cnt);
} }
/// \brief Test generation of mulitple DUIDs /// \brief Test generation of multiple DUIDs
/// ///
/// This method checks the generation of multiple DUIDs. Number /// This method checks the generation of multiple DUIDs. Number
/// of iterations depends on the number of simulated clients. /// of iterations depends on the number of simulated clients.
@@ -406,7 +406,7 @@ public:
// if randomization algorithm generates the same values but // if randomization algorithm generates the same values but
// this would be an error in randomization algorithm. // this would be an error in randomization algorithm.
total_dist += mismatch_dist; total_dist += mismatch_dist;
// Mismatch may have occured on the DUID octet position // Mismatch may have occurred on the DUID octet position
// up to calculated earlier unequal_pos. // up to calculated earlier unequal_pos.
ASSERT_LE(mismatch_dist, unequal_pos); ASSERT_LE(mismatch_dist, unequal_pos);
// unique will inform if tested DUID is unique. // unique will inform if tested DUID is unique.
@@ -436,7 +436,7 @@ public:
// Remember generated DUID. // Remember generated DUID.
duids.push_back(new_duid); duids.push_back(new_duid);
} }
// If we have more than one client at least one mismatch occured. // If we have more than one client at least one mismatch occurred.
if (clients_num < 2) { if (clients_num < 2) {
EXPECT_EQ(0, total_dist); EXPECT_EQ(0, total_dist);
} }
@@ -583,7 +583,7 @@ public:
int clients_num = CommandOptions::instance().getClientsNum(); int clients_num = CommandOptions::instance().getClientsNum();
// The old_mac will be holding the value of previously generated // The old_mac will be holding the value of previously generated
// MAC address. We will be comparing the newly generated one with it // MAC address. We will be comparing the newly generated one with it
// to see if it changes when mulitple clients are simulated or if it // to see if it changes when multiple clients are simulated or if it
// does not change when single client is simulated. // does not change when single client is simulated.
MacAddress old_mac(CommandOptions::instance().getMacTemplate()); MacAddress old_mac(CommandOptions::instance().getMacTemplate());
// Holds the position if the octet on which two MAC addresses can // Holds the position if the octet on which two MAC addresses can
@@ -617,7 +617,7 @@ public:
// the case if randomization algorithm generates the same // the case if randomization algorithm generates the same
// values but this would be an error in randomization algorithm. // values but this would be an error in randomization algorithm.
total_dist += mismatch_dist; total_dist += mismatch_dist;
// Mismatch may have occured on the MAC address'es octet position // Mismatch may have occurred on the MAC address'es octet position
// up to calculated earlier unequal_pos. // up to calculated earlier unequal_pos.
ASSERT_LE(mismatch_dist, unequal_pos); ASSERT_LE(mismatch_dist, unequal_pos);
// unique will inform if tested DUID is unique. // unique will inform if tested DUID is unique.
@@ -657,7 +657,7 @@ public:
/// ///
/// This function simulates acquiring 10 leases from the server. Returned /// This function simulates acquiring 10 leases from the server. Returned
/// DHCPACK messages are cached and used to send renew messages. /// DHCPACK messages are cached and used to send renew messages.
/// The maxmimal number of messages which can be sent is equal to the /// The maximal number of messages which can be sent is equal to the
/// number of leases acquired (10). This function also checks that an /// number of leases acquired (10). This function also checks that an
/// attempt to send more renew messages than the number of leases acquired /// attempt to send more renew messages than the number of leases acquired
/// will fail. /// will fail.
@@ -860,7 +860,7 @@ public:
/// ///
/// This function simulates acquiring 10 leases from the server. Returned /// This function simulates acquiring 10 leases from the server. Returned
/// Reply messages are cached and used to send Renew or Release messages. /// Reply messages are cached and used to send Renew or Release messages.
/// The maxmimal number of Renew or Release messages which can be sent is /// The maximal number of Renew or Release messages which can be sent is
/// equal to the number of leases acquired (10). This function also checks /// equal to the number of leases acquired (10). This function also checks
/// that an attempt to send more Renew or Release messages than the number /// that an attempt to send more Renew or Release messages than the number
/// of leases acquired will fail. /// of leases acquired will fail.
@@ -955,7 +955,7 @@ public:
/// \brief Parse command line string with CommandOptions. /// \brief Parse command line string with CommandOptions.
/// ///
/// \param cmdline command line string to be parsed. /// \param cmdline command line string to be parsed.
/// \throw isc::Unexpected if unexpected error occured. /// \throw isc::Unexpected if unexpected error occurred.
/// \throw isc::InvalidParameter if command line is invalid. /// \throw isc::InvalidParameter if command line is invalid.
void processCmdLine(const std::string& cmdline) const { void processCmdLine(const std::string& cmdline) const {
CommandOptionsHelper::process(cmdline); CommandOptionsHelper::process(cmdline);
@@ -1076,7 +1076,7 @@ TEST_F(TestControlTest, reset) {
} }
// This test verfies that the client id is generated from the HW address. // This test verifies that the client id is generated from the HW address.
TEST_F(TestControlTest, generateClientId) { TEST_F(TestControlTest, generateClientId) {
// Generate HW address. // Generate HW address.
std::vector<uint8_t> hwaddr; std::vector<uint8_t> hwaddr;
@@ -1440,7 +1440,7 @@ TEST_F(TestControlTest, Packet6ExchangeFromTemplate) {
// then test should be interrupted and actual number of iterations will // then test should be interrupted and actual number of iterations will
// be 6. // be 6.
const int received_num = 3; const int received_num = 3;
// Simulate the number of Solicit-Advertise-Request-Reply (SARR) echanges. // Simulate the number of Solicit-Advertise-Request-Reply (SARR) exchanges.
// The test function generates server's responses and passes it to the // The test function generates server's responses and passes it to the
// TestControl class methods for processing. The number of exchanges // TestControl class methods for processing. The number of exchanges
// actually performed is returned in 'iterations_performed' argument. If // actually performed is returned in 'iterations_performed' argument. If
@@ -1475,14 +1475,14 @@ TEST_F(TestControlTest, Packet6Exchange) {
// This simulates no packet drops. // This simulates no packet drops.
bool use_templates = false; bool use_templates = false;
// Simulate the number of Solicit-Advertise-Request-Reply (SARR) echanges. // Simulate the number of Solicit-Advertise-Request-Reply (SARR) exchanges.
// The test function generates server's responses and passes it to the // The test function generates server's responses and passes it to the
// TestControl class methods for processing. The number of exchanges // TestControl class methods for processing. The number of exchanges
// actually performed is returned in 'iterations_performed' argument. If // actually performed is returned in 'iterations_performed' argument. If
// processing is successful, the number of performed iterations should be // processing is successful, the number of performed iterations should be
// equal to the number of exchanges specified with the '-n' command line // equal to the number of exchanges specified with the '-n' command line
// parameter (10 in this case). All exchanged packets carry the IA_NA option // parameter (10 in this case). All exchanged packets carry the IA_NA option
// to simulate the IPv6 address acqusition and to verify that the IA_NA // to simulate the IPv6 address acquisition and to verify that the IA_NA
// options returned by the server are processed correctly. // options returned by the server are processed correctly.
testPkt6Exchange(iterations_num, iterations_num, use_templates, testPkt6Exchange(iterations_num, iterations_num, use_templates,
iterations_performed); iterations_performed);
@@ -1511,7 +1511,7 @@ TEST_F(TestControlTest, Packet6ExchangePrefixDelegation) {
// This simulates no packet drops. // This simulates no packet drops.
bool use_templates = false; bool use_templates = false;
// Simulate the number of Solicit-Advertise-Request-Reply (SARR) echanges. // Simulate the number of Solicit-Advertise-Request-Reply (SARR) exchanges.
// The test function generates server's responses and passes it to the // The test function generates server's responses and passes it to the
// TestControl class methods for processing. The number of exchanges // TestControl class methods for processing. The number of exchanges
// actually performed is returned in 'iterations_performed' argument. If // actually performed is returned in 'iterations_performed' argument. If
@@ -1546,7 +1546,7 @@ TEST_F(TestControlTest, Packet6ExchangeAddressAndPrefix) {
// Set number of received packets equal to number of iterations. // Set number of received packets equal to number of iterations.
// This simulates no packet drops. // This simulates no packet drops.
bool use_templates = false; bool use_templates = false;
// Simulate the number of Solicit-Advertise-Request-Reply (SARR) echanges. // Simulate the number of Solicit-Advertise-Request-Reply (SARR) exchanges.
// The test function generates server's responses and passes it to the // The test function generates server's responses and passes it to the
// TestControl class methods for processing. The number of exchanges // TestControl class methods for processing. The number of exchanges
// actually performed is returned in 'iterations_performed' argument. If // actually performed is returned in 'iterations_performed' argument. If
@@ -1689,8 +1689,8 @@ TEST_F(TestControlTest, getCurrentTimeout) {
// server's responses is valid. In this case, we are simulating that perfdhcp // server's responses is valid. In this case, we are simulating that perfdhcp
// sends Renew requests to the server, apart from the regular 4-way exchanges. // sends Renew requests to the server, apart from the regular 4-way exchanges.
// The timeout value depends on both the due time to send next Solicit and the // The timeout value depends on both the due time to send next Solicit and the
// due time to send Renew - the timeout should be ajusted to the due time that // due time to send Renew - the timeout should be adjusted to the due time
// occurs sooner. // that occurs sooner.
TEST_F(TestControlTest, getCurrentTimeoutRenew) { TEST_F(TestControlTest, getCurrentTimeoutRenew) {
// Set the Solicit rate to 10 and the Renew rate 5. // Set the Solicit rate to 10 and the Renew rate 5.
ASSERT_NO_THROW(processCmdLine("perfdhcp -6 -l lo -r 10 -f 5 ::1")); ASSERT_NO_THROW(processCmdLine("perfdhcp -6 -l lo -r 10 -f 5 ::1"));