Kea  1.5.0
isc::perfdhcp::TestControl Class Reference

Test Control class. More...

#include <test_control.h>

+ Inheritance diagram for isc::perfdhcp::TestControl:

Classes

class  NumberGenerator
 Number generator class. More...
 
class  SequentialGenerator
 Sequential numbers generator class. More...
 
struct  TestControlSocket
 Socket wrapper structure. More...
 

Public Types

typedef StatsMgr ::ExchangeType ExchangeType
 Packet exchange type. More...
 
typedef boost::shared_ptr< NumberGeneratorNumberGeneratorPtr
 The default generator pointer. More...
 
typedef StatsMgr< dhcp::Pkt4StatsMgr4
 Statistics Manager for DHCPv4. More...
 
typedef boost::shared_ptr< StatsMgr4StatsMgr4Ptr
 Pointer to Statistics Manager for DHCPv4;. More...
 
typedef StatsMgr< dhcp::Pkt6StatsMgr6
 Statistics Manager for DHCPv6. More...
 
typedef boost::shared_ptr< StatsMgr6StatsMgr6Ptr
 Pointer to Statistics Manager for DHCPv6. More...
 
typedef std::vector< uint8_t > TemplateBuffer
 Packet template buffer. More...
 
typedef std::vector< TemplateBufferTemplateBufferCollection
 Packet template buffers list. More...
 

Public Member Functions

bool hasLateExitCommenced () const
 Check if the program is in that period where the program was bound to exit, but was delayed by lateExit(). More...
 
bool haveAllPacketsBeenReceived () const
 Checks if all expected packets were already received. More...
 
int run ()
 brief\ Run performance test. More...
 
void setMacAddrGenerator (const NumberGeneratorPtr &generator)
 Set new MAC address generator. More...
 
void setTransidGenerator (const NumberGeneratorPtr &generator)
 Set new transaction id generator. More...
 
bool waitToExit () const
 Delay the exit by a fixed given time to catch up to all exchanges that were already started. More...
 

Static Public Member Functions

static TestControlinstance ()
 TestControl is a singleton class. More...
 

Static Public Attributes

static const uint8_t HW_ETHER_LEN = 6
 Length of the Ethernet HW address (MAC) in bytes. More...
 

Protected Member Functions

 TestControl ()
 Default constructor. More...
 
void addExtraOpts (const dhcp::Pkt4Ptr &pkt4)
 Inserts extra options specified by user. More...
 
void addExtraOpts (const dhcp::Pkt6Ptr &pkt6)
 Inserts extra options specified by user. More...
 
std::string byte2Hex (const uint8_t b) const
 Convert binary value to hex string. More...
 
bool checkExitConditions () const
 Check if test exit conditions fulfilled. More...
 
void checkLateMessages (RateControl &rate_control)
 Increments counter of late sent messages if required. More...
 
void cleanCachedPackets ()
 Removes cached DHCPv6 Reply packets every second. More...
 
void copyIaOptions (const dhcp::Pkt6Ptr &pkt_from, dhcp::Pkt6Ptr &pkt_to)
 Copies IA_NA or IA_PD option from one packet to another. More...
 
dhcp::Pkt6Ptr createMessageFromReply (const uint16_t msg_type, const dhcp::Pkt6Ptr &reply)
 Creates DHCPv6 message from the Reply packet. More...
 
dhcp::Pkt4Ptr createRequestFromAck (const dhcp::Pkt4Ptr &ack)
 Creates DHCPREQUEST from a DHCPACK message. More...
 
dhcp::OptionPtr generateClientId (const dhcp::HWAddrPtr &hwaddr) const
 Generate DHCPv4 client identifier from HW address. More...
 
std::vector< uint8_t > generateDuid (uint8_t &randomized)
 Generate DUID. More...
 
std::vector< uint8_t > generateMacAddress (uint8_t &randomized)
 Generate MAC address. More...
 
uint32_t generateTransid ()
 generate transaction id. More...
 
uint32_t getCurrentTimeout () const
 Returns a timeout for packet reception. More...
 
template<class T >
uint32_t getElapsedTime (const T &pkt1, const T &pkt2)
 Calculate elapsed time between two packets. More...
 
int getElapsedTimeOffset () const
 Return elapsed time offset in a packet. More...
 
int getRandomOffset (const int arg_idx) const
 Return randomization offset in a packet. More...
 
uint64_t getRcvdPacketsNum (ExchangeType xchg_type) const
 Get number of received packets. More...
 
int getRequestedIpOffset () const
 Return requested ip offset in a packet. More...
 
uint64_t getSentPacketsNum (ExchangeType xchg_type) const
 Get number of sent packets. More...
 
int getServerIdOffset () const
 Return server id offset in a packet. More...
 
TemplateBuffer getTemplateBuffer (const size_t idx) const
 Return template buffer. More...
 
int getTransactionIdOffset (const int arg_idx) const
 Return transaction id offset in a packet. More...
 
void initializeStatsMgr ()
 Initializes Statistics Manager. More...
 
void initPacketTemplates ()
 Reads packet templates from files. More...
 
int openSocket () const
 Open socket to communicate with DHCP server. More...
 
void printDiagnostics () const
 Print main diagnostics data. More...
 
void printIntermediateStats ()
 Print intermediate statistics. More...
 
void printRate () const
 Print rate statistics. More...
 
void printStats () const
 Print performance statistics. More...
 
void printTemplate (const uint8_t packet_type) const
 Print template information. More...
 
void printTemplates () const
 Print templates information. More...
 
void processReceivedPacket4 (const TestControlSocket &socket, const dhcp::Pkt4Ptr &pkt4)
 Process received DHCPv4 packet. More...
 
void processReceivedPacket6 (const TestControlSocket &socket, const dhcp::Pkt6Ptr &pkt6)
 Process received DHCPv6 packet. More...
 
void readPacketTemplate (const std::string &file_name)
 Read DHCP message template from file. More...
 
uint64_t receivePackets (const TestControlSocket &socket)
 Receive DHCPv4 or DHCPv6 packets from the server. More...
 
void registerOptionFactories () const
 Register option factory functions for DHCPv4 or DHCPv6. More...
 
void registerOptionFactories4 () const
 Register option factory functions for DHCPv4. More...
 
void registerOptionFactories6 () const
 Register option factory functions for DHCPv6. More...
 
void reset ()
 Resets internal state of the object. More...
 
void runWrapped (bool do_stop=false) const
 Run wrapped command. More...
 
void saveFirstPacket (const dhcp::Pkt4Ptr &pkt)
 Save the first DHCPv4 sent packet of the specified type. More...
 
void saveFirstPacket (const dhcp::Pkt6Ptr &pkt)
 Save the first DHCPv6 sent packet of the specified type. More...
 
void sendDiscover4 (const TestControlSocket &socket, const bool preload=false)
 Send DHCPv4 DISCOVER message. More...
 
void sendDiscover4 (const TestControlSocket &socket, const std::vector< uint8_t > &template_buf, const bool preload=false)
 Send DHCPv4 DISCOVER message from template. More...
 
bool sendMessageFromReply (const uint16_t msg_type, const TestControlSocket &socket)
 Send DHCPv6 Renew or Release message using specified socket. More...
 
uint64_t sendMultipleMessages6 (const TestControlSocket &socket, const uint32_t msg_type, const uint64_t msg_num)
 Send number of DHCPv6 Renew or Release messages to the server. More...
 
uint64_t sendMultipleRequests (const TestControlSocket &socket, const uint64_t msg_num)
 Send number of DHCPREQUEST (renew) messages to a server. More...
 
void sendPackets (const TestControlSocket &socket, const uint64_t packets_num, const bool preload=false)
 Send number of packets to initiate new exchanges. More...
 
void sendRequest4 (const TestControlSocket &socket, const dhcp::Pkt4Ptr &discover_pkt4, const dhcp::Pkt4Ptr &offer_pkt4)
 Send DHCPv4 REQUEST message. More...
 
void sendRequest4 (const TestControlSocket &socket, const std::vector< uint8_t > &template_buf, const dhcp::Pkt4Ptr &discover_pkt4, const dhcp::Pkt4Ptr &offer_pkt4)
 Send DHCPv4 REQUEST message from template. More...
 
void sendRequest6 (const TestControlSocket &socket, const dhcp::Pkt6Ptr &advertise_pkt6)
 Send DHCPv6 REQUEST message. More...
 
void sendRequest6 (const TestControlSocket &socket, const std::vector< uint8_t > &template_buf, const dhcp::Pkt6Ptr &advertise_pkt6)
 Send DHCPv6 REQUEST message from template. More...
 
bool sendRequestFromAck (const TestControlSocket &socket)
 Send DHCPv4 renew (DHCPREQUEST) using specified socket. More...
 
void sendSolicit6 (const TestControlSocket &socket, const bool preload=false)
 Send DHCPv6 SOLICIT message. More...
 
void sendSolicit6 (const TestControlSocket &socket, const std::vector< uint8_t > &template_buf, const bool preload=false)
 Send DHCPv6 SOLICIT message from template. More...
 
void setDefaults4 (const TestControlSocket &socket, const dhcp::Pkt4Ptr &pkt)
 Set default DHCPv4 packet parameters. More...
 
void setDefaults6 (const TestControlSocket &socket, const dhcp::Pkt6Ptr &pkt)
 Set default DHCPv6 packet parameters. More...
 
bool testDiags (const char diag) const
 Find if diagnostic flag has been set. More...
 
std::string vector2Hex (const std::vector< uint8_t > &vec, const std::string &separator="") const
 Convert vector in hexadecimal string. More...
 

Static Protected Member Functions

static dhcp::OptionPtr factoryElapsedTime6 (dhcp::Option::Universe u, uint16_t type, const dhcp::OptionBuffer &buf)
 Factory function to create DHCPv6 ELAPSED_TIME option. More...
 
static dhcp::OptionPtr factoryGeneric (dhcp::Option::Universe u, uint16_t type, const dhcp::OptionBuffer &buf)
 Factory function to create generic option. More...
 
static dhcp::OptionPtr factoryIana6 (dhcp::Option::Universe u, uint16_t type, const dhcp::OptionBuffer &buf)
 Factory function to create IA_NA option. More...
 
static dhcp::OptionPtr factoryIapd6 (dhcp::Option::Universe u, uint16_t type, const dhcp::OptionBuffer &buf)
 Factory function to create IA_PD option. More...
 
static dhcp::OptionPtr factoryOptionRequestOption6 (dhcp::Option::Universe u, uint16_t type, const dhcp::OptionBuffer &buf)
 Factory function to create DHCPv6 ORO option. More...
 
static dhcp::OptionPtr factoryRapidCommit6 (dhcp::Option::Universe u, uint16_t type, const dhcp::OptionBuffer &buf)
 Factory function to create DHCPv6 RAPID_COMMIT option instance. More...
 
static dhcp::OptionPtr factoryRequestList4 (dhcp::Option::Universe u, uint16_t type, const dhcp::OptionBuffer &buf)
 Factory function to create DHCPv4 Request List option. More...
 
static void handleChild (int sig)
 Handle child signal. More...
 
static void handleInterrupt (int sig)
 Handle interrupt signal. More...
 

Protected Attributes

PacketStorage< dhcp::Pkt4ack_storage_
 A storage for DHCPACK messages. More...
 
RateControl basic_rate_control_
 A rate control class for Discover and Solicit messages. More...
 
dhcp::OptionBuffer first_packet_serverid_
 Buffer holding server id received in first packet. More...
 
boost::posix_time::ptime last_report_
 Last intermediate report time. More...
 
NumberGeneratorPtr macaddr_gen_
 Numbers generator for MAC address. More...
 
isc::util::random::UniformRandomIntegerGenerator number_generator_
 Generate uniformly distributed integers in range of [min, max]. More...
 
RateControl release_rate_control_
 A rate control class for Release messages. More...
 
RateControl renew_rate_control_
 A rate control class for Renew messages. More...
 
PacketStorage< dhcp::Pkt6reply_storage_
 A storage for reply messages. More...
 
StatsMgr4Ptr stats_mgr4_
 Statistics Manager 4. More...
 
StatsMgr6Ptr stats_mgr6_
 Statistics Manager 6. More...
 
TemplateBufferCollection template_buffers_
 Packet template buffers. More...
 
std::map< uint8_t, dhcp::Pkt4Ptrtemplate_packets_v4_
 First packets send. More...
 
std::map< uint8_t, dhcp::Pkt6Ptrtemplate_packets_v6_
 
NumberGeneratorPtr transid_gen_
 Transaction id generator. More...
 

Static Protected Attributes

static bool interrupted_ = false
 Is program interrupted. More...
 

Detailed Description

Test Control class.

This singleton class is used to run the performance test with with TestControl::run function. This function can be executed multiple times if desired because it resets TestControl's internal state every time it is executed. Prior to running TestControl::run, one must make sure to parse command line options by calling CommandOptions::parse. Failing to do this will result in an exception.

The following major stages of the test are performed by this class:

  • set default transaction id and MAC address generators - the generator is an object of TestControl::NumberGenerator type and it provides the custom randomization algorithms,
  • print command line arguments,
  • register option factory functions which are used to generate DHCP options being sent to a server,
  • create the socket for communication with a server,
  • read packet templates if user specified template files with '-T' command line option,
  • set the interrupt handler (invoked when ^C is pressed) which makes perfdhcp stop gracefully and print the test results before exiting,
  • executes an external command (if specified '-w' option), e.g. if user specified -w ./foo in the command line then program will execute "./foo start" at the beginning of the test and "./foo stop" when the test ends,
  • initialize the Statistics Manager,
  • executes the main loop:
    • calculate how many packets must be send to satisfy desired rate,
    • receive incoming packets from the server,
    • check the exit conditions - terminate the program if the exit criteria are fulfilled, e.g. reached maximum number of packet drops,
    • send the number of packets appropriate to satisfy the desired rate,
    • optionally print intermediate reports,
  • print statistics, e.g. achieved rate,
  • optionally print some diagnostics.

With the '-w' command line option user may specify the external application or script to be executed. This is executed twice, first when the test starts and second time when the test ends. This external script or application must accept 'start' and 'stop' arguments. The first time it is called, it is called with the argument 'start' and the second time with the argument 'stop'.

The application is executed by calling fork() to fork the current perfdhcp process and then call execlp() to replace the current process image with the new one.

Option factory functions are registered using dhcp::LibDHCP::OptionFactoryRegister. Registered factory functions provide a way to create options of the same type in the same way. When a new option instance is needed, the corresponding factory function is called to create it. This is done by calling dhcp::Option::factory with DHCP message type specified as one of parameters. Some of the parameters passed to factory function may be ignored (e.g. option buffer). Please note that naming convention for factory functions within this class is as follows:

  • factoryABC4 - factory function for DHCPv4 option,
  • factoryDEF6 - factory function for DHCPv6 option,
  • factoryGHI - factory function that can be used to create either DHCPv4 or DHCPv6 option.

Definition at line 121 of file test_control.h.

Member Typedef Documentation

◆ ExchangeType

Packet exchange type.

Definition at line 133 of file test_control.h.

◆ NumberGeneratorPtr

The default generator pointer.

Definition at line 212 of file test_control.h.

◆ StatsMgr4

Statistics Manager for DHCPv4.

Definition at line 125 of file test_control.h.

◆ StatsMgr4Ptr

Pointer to Statistics Manager for DHCPv4;.

Definition at line 127 of file test_control.h.

◆ StatsMgr6

Statistics Manager for DHCPv6.

Definition at line 129 of file test_control.h.

◆ StatsMgr6Ptr

Pointer to Statistics Manager for DHCPv6.

Definition at line 131 of file test_control.h.

◆ TemplateBuffer

typedef std::vector<uint8_t> isc::perfdhcp::TestControl::TemplateBuffer

Packet template buffer.

Definition at line 135 of file test_control.h.

◆ TemplateBufferCollection

Packet template buffers list.

Definition at line 137 of file test_control.h.

Constructor & Destructor Documentation

◆ TestControl()

isc::perfdhcp::TestControl::TestControl ( )
protected

Default constructor.

Default constructor is protected as the object can be created only via instance method.

Definition at line 141 of file test_control.cc.

References reset().

+ Here is the call graph for this function:

Member Function Documentation

◆ addExtraOpts() [1/2]

void isc::perfdhcp::TestControl::addExtraOpts ( const dhcp::Pkt4Ptr pkt4)
protected

Inserts extra options specified by user.

Note: addExtraOpts for v4 and v6 could easily be turned into a template. However, this would require putting code here that uses CommandOptions, and that would create dependency between test_control.h and command_options.h.

Parameters
pkt4options will be added here

Definition at line 2366 of file test_control.cc.

References isc::perfdhcp::CommandOptions::getExtraOpts(), and isc::perfdhcp::CommandOptions::instance().

Referenced by sendDiscover4(), sendMessageFromReply(), sendRequest4(), sendRequest6(), sendRequestFromAck(), and sendSolicit6().

+ Here is the call graph for this function:

◆ addExtraOpts() [2/2]

void isc::perfdhcp::TestControl::addExtraOpts ( const dhcp::Pkt6Ptr pkt6)
protected

Inserts extra options specified by user.

Note: addExtraOpts for v4 and v6 could easily be turned into a template. However, this would require putting code here that uses CommandOptions, and that would create dependency between test_control.h and command_options.h.

Parameters
pkt6options will be added here

Definition at line 2376 of file test_control.cc.

References isc::perfdhcp::CommandOptions::getExtraOpts(), and isc::perfdhcp::CommandOptions::instance().

+ Here is the call graph for this function:

◆ byte2Hex()

std::string isc::perfdhcp::TestControl::byte2Hex ( const uint8_t  b) const
protected

Convert binary value to hex string.

Todo:
Consider moving this function to src/lib/util.
Parameters
bbyte to convert.
Returns
hex string.

Definition at line 224 of file test_control.cc.

Referenced by vector2Hex().

◆ checkExitConditions()

bool isc::perfdhcp::TestControl::checkExitConditions ( ) const
protected

Check if test exit conditions fulfilled.

Method checks if the test exit conditions are fulfilled. Exit conditions are checked periodically from the main loop. Program should break the main loop when this method returns true. It is calling function responsibility to break main loop gracefully and cleanup after test execution.

Returns
true if any of the exit conditions is fulfilled.

Definition at line 233 of file test_control.cc.

References isc::perfdhcp::CommandOptions::getIpVersion(), isc::perfdhcp::CommandOptions::getMaxDrop(), isc::perfdhcp::CommandOptions::getMaxDropPercentage(), isc::perfdhcp::CommandOptions::getNumRequests(), isc::perfdhcp::CommandOptions::getPeriod(), getSentPacketsNum(), isc::perfdhcp::CommandOptions::instance(), interrupted_, stats_mgr4_, stats_mgr6_, testDiags(), waitToExit(), isc::perfdhcp::StatsMgr< T >::XCHG_DO, isc::perfdhcp::StatsMgr< T >::XCHG_RA, isc::perfdhcp::StatsMgr< T >::XCHG_RR, and isc::perfdhcp::StatsMgr< T >::XCHG_SA.

Referenced by run().

+ Here is the call graph for this function:

◆ checkLateMessages()

void isc::perfdhcp::TestControl::checkLateMessages ( RateControl rate_control)
protected

Increments counter of late sent messages if required.

This function checks if the message or set of messages of a given type, were sent later than their due time. If they were sent late, it is an indication that the perfdhcp doesn't catch up with the desired rate for sending messages.

Parameters
rate_controlAn object tracking due times for a particular type of messages.

Definition at line 147 of file test_control.cc.

References isc::perfdhcp::CommandOptions::getIpVersion(), isc::perfdhcp::CommandOptions::instance(), isc::perfdhcp::RateControl::isLateSent(), stats_mgr4_, stats_mgr6_, and testDiags().

Referenced by run().

+ Here is the call graph for this function:

◆ cleanCachedPackets()

void isc::perfdhcp::TestControl::cleanCachedPackets ( )
protected

Removes cached DHCPv6 Reply packets every second.

This function wipes cached Reply packets from the storage. The number of packets left in the storage after the call to this function should guarantee that the Renew packets can be sent at the given rate. Note that the Renew packets are generated for the existing leases, represented here as replies from the server.

Todo:
Instead of cleaning packets periodically we could just stop adding new packets when the certain threshold has been reached.

Definition at line 162 of file test_control.cc.

References isc::perfdhcp::CommandOptions::getRenewRate(), isc::perfdhcp::CommandOptions::instance(), and reply_storage_.

Referenced by run().

+ Here is the call graph for this function:

◆ copyIaOptions()

void isc::perfdhcp::TestControl::copyIaOptions ( const dhcp::Pkt6Ptr pkt_from,
dhcp::Pkt6Ptr pkt_to 
)
protected

Copies IA_NA or IA_PD option from one packet to another.

This function checks the lease-type specified in the command line with option -e<lease-type>. If 'address-only' value has been specified this function expects that IA_NA option is present in the packet encapsulated by pkt_from object. If 'prefix-only' value has been specified, this function expects that IA_PD option is present in the packet encapsulated by pkt_to object.

Parameters
[in]pkt_fromA packet from which options should be copied.
[out]pkt_toA packet to which options should be copied.
Exceptions
isc::perfdhcp::OptionNotFoundif a required option is not found in the packet from which options should be copied.
isc::BadValueif any of the specified pointers to packets is NULL.

Definition at line 194 of file test_control.cc.

References isc::perfdhcp::CommandOptions::LeaseType::ADDRESS, D6O_IA_NA, D6O_IA_PD, isc::perfdhcp::CommandOptions::instance(), isc_throw, and isc::perfdhcp::CommandOptions::LeaseType::PREFIX.

Referenced by createMessageFromReply(), and sendRequest6().

+ Here is the call graph for this function:

◆ createMessageFromReply()

Pkt6Ptr isc::perfdhcp::TestControl::createMessageFromReply ( const uint16_t  msg_type,
const dhcp::Pkt6Ptr reply 
)
protected

Creates DHCPv6 message from the Reply packet.

This function creates DHCPv6 Renew or Release message using the data from the Reply message by copying options from the Reply message.

Parameters
msg_typeA type of the message to be created.
replyAn instance of the Reply packet which contents should be used to create an instance of the new message.
Returns
created Release or Renew message
Exceptions
isc::BadValueif the msg_type is neither DHCPV6_RENEW nor DHCPV6_RELEASE or if the reply is NULL.
isc::Unexpectedif mandatory options are missing in the Reply message.

Definition at line 404 of file test_control.cc.

References copyIaOptions(), D6O_CLIENTID, D6O_SERVERID, DHCPV6_RELEASE, DHCPV6_RENEW, generateTransid(), and isc_throw.

Referenced by sendMessageFromReply().

+ Here is the call graph for this function:

◆ createRequestFromAck()

Pkt4Ptr isc::perfdhcp::TestControl::createRequestFromAck ( const dhcp::Pkt4Ptr ack)
protected

Creates DHCPREQUEST from a DHCPACK message.

Parameters
ackAn instance of the DHCPACK message to be used to create a new message.
Returns
Pointer to the created message.

Definition at line 388 of file test_control.cc.

References isc::dhcp::DHCPREQUEST, generateClientId(), generateTransid(), and isc_throw.

Referenced by sendRequestFromAck().

+ Here is the call graph for this function:

◆ factoryElapsedTime6()

OptionPtr isc::perfdhcp::TestControl::factoryElapsedTime6 ( dhcp::Option::Universe  u,
uint16_t  type,
const dhcp::OptionBuffer buf 
)
staticprotected

Factory function to create DHCPv6 ELAPSED_TIME option.

This factory function creates DHCPv6 ELAPSED_TIME option instance. If empty buffer is passed the option buffer will be initialized to length 2 and values will be initialized to zeros. Otherwise function will initialize option buffer with values in passed buffer.

Parameters
uuniverse (ignored)
typeoption-type (ignored).
bufoption-buffer containing option content (2 bytes) or empty buffer if option content has to be set to default (0) value.
Exceptions
ifelapsed time buffer size is neither 2 nor 0.
Returns
instance o the option.

Definition at line 444 of file test_control.cc.

References D6O_ELAPSED_TIME, and isc_throw.

Referenced by registerOptionFactories6().

◆ factoryGeneric()

OptionPtr isc::perfdhcp::TestControl::factoryGeneric ( dhcp::Option::Universe  u,
uint16_t  type,
const dhcp::OptionBuffer buf 
)
staticprotected

Factory function to create generic option.

This factory function creates option with specified universe, type and buf. It does not have any additional logic validating the buffer contents, size etc.

Parameters
uuniverse (V6 or V4).
typeoption-type (ignored).
bufoption-buffer.
Returns
instance o the option.

Definition at line 457 of file test_control.cc.

Referenced by registerOptionFactories4(), and registerOptionFactories6().

◆ factoryIana6()

OptionPtr isc::perfdhcp::TestControl::factoryIana6 ( dhcp::Option::Universe  u,
uint16_t  type,
const dhcp::OptionBuffer buf 
)
staticprotected

Factory function to create IA_NA option.

This factory function creates DHCPv6 IA_NA option instance.

Todo:
add support for IA Address options.
Parameters
uuniverse (ignored).
typeoption-type (ignored).
bufoption-buffer carrying IANA suboptions.
Returns
instance of IA_NA option.

Definition at line 464 of file test_control.cc.

References D6O_IA_NA.

Referenced by registerOptionFactories6().

◆ factoryIapd6()

OptionPtr isc::perfdhcp::TestControl::factoryIapd6 ( dhcp::Option::Universe  u,
uint16_t  type,
const dhcp::OptionBuffer buf 
)
staticprotected

Factory function to create IA_PD option.

this factory function creates DHCPv6 IA_PD option instance.

Parameters
uuniverse (ignored).
typeoption-type (ignored).
bufoption-buffer carrying sub-options.

Definition at line 480 of file test_control.cc.

References D6O_IA_PD.

Referenced by registerOptionFactories6().

◆ factoryOptionRequestOption6()

OptionPtr isc::perfdhcp::TestControl::factoryOptionRequestOption6 ( dhcp::Option::Universe  u,
uint16_t  type,
const dhcp::OptionBuffer buf 
)
staticprotected

Factory function to create DHCPv6 ORO option.

This factory function creates DHCPv6 Option Request Option instance. The created option will contain the following set of requested options:

  • D6O_NAME_SERVERS
  • D6O_DOMAIN_SEARCH
Parameters
uuniverse (ignored).
typeoption-type (ignored).
bufoption-buffer (ignored).
Returns
instance of ORO option.

Definition at line 502 of file test_control.cc.

References D6O_DOMAIN_SEARCH, D6O_NAME_SERVERS, and D6O_ORO.

Referenced by registerOptionFactories6().

◆ factoryRapidCommit6()

OptionPtr isc::perfdhcp::TestControl::factoryRapidCommit6 ( dhcp::Option::Universe  u,
uint16_t  type,
const dhcp::OptionBuffer buf 
)
staticprotected

Factory function to create DHCPv6 RAPID_COMMIT option instance.

This factory function creates DHCPv6 RAPID_COMMIT option instance. The buffer passed to this option must be empty because option does not have any payload.

Parameters
uuniverse (ignored).
typeoption-type (ignored).
bufoption-buffer (ignored).
Returns
instance of RAPID_COMMIT option..

Definition at line 496 of file test_control.cc.

References D6O_RAPID_COMMIT.

Referenced by registerOptionFactories6().

◆ factoryRequestList4()

OptionPtr isc::perfdhcp::TestControl::factoryRequestList4 ( dhcp::Option::Universe  u,
uint16_t  type,
const dhcp::OptionBuffer buf 
)
staticprotected

Factory function to create DHCPv4 Request List option.

This factory function creates DHCPv4 PARAMETER_REQUEST_LIST option instance with the following set of requested options:

  • DHO_SUBNET_MASK,
  • DHO_BROADCAST_ADDRESS,
  • DHO_TIME_OFFSET,
  • DHO_ROUTERS,
  • DHO_DOMAIN_NAME,
  • DHO_DOMAIN_NAME_SERVERS,
  • DHO_HOST_NAME.
Parameters
uuniverse (ignored).
typeoption-type (ignored).
bufoption-buffer (ignored).
Returns
instance o the generic option.

Definition at line 515 of file test_control.cc.

References isc::dhcp::DHO_BROADCAST_ADDRESS, isc::dhcp::DHO_DOMAIN_NAME, isc::dhcp::DHO_DOMAIN_NAME_SERVERS, isc::dhcp::DHO_HOST_NAME, isc::dhcp::DHO_ROUTERS, isc::dhcp::DHO_SUBNET_MASK, and isc::dhcp::DHO_TIME_OFFSET.

Referenced by registerOptionFactories4().

◆ generateClientId()

OptionPtr isc::perfdhcp::TestControl::generateClientId ( const dhcp::HWAddrPtr hwaddr) const
protected

Generate DHCPv4 client identifier from HW address.

This method generates DHCPv4 client identifier option from a HW address.

Parameters
hwaddrHW address.
Returns
Pointer to an instance of the generated option.

Definition at line 583 of file test_control.cc.

References isc::dhcp::DHO_DHCP_CLIENT_IDENTIFIER.

Referenced by createRequestFromAck(), sendDiscover4(), and sendRequest4().

◆ generateDuid()

std::vector< uint8_t > isc::perfdhcp::TestControl::generateDuid ( uint8_t &  randomized)
protected

Generate DUID.

Method generates unique DUID. The number of DUIDs it can generate depends on the number of simulated clients, which is specified from the command line. It uses CommandOptions object to retrieve number of clients. Since the last six octets of DUID are constructed from the MAC address, this function uses generateMacAddress internally to randomize the DUID.

Todo:
add support for other types of DUID.
Parameters
[out]randomizednumber of bytes randomized (initial value is ignored).
Exceptions
isc::BadValueif generateMacAddress throws.
Returns
vector representing DUID.

Definition at line 592 of file test_control.cc.

References isc::data::copy(), generateMacAddress(), isc::perfdhcp::CommandOptions::getClientsNum(), isc::perfdhcp::CommandOptions::getDuidTemplate(), isc::perfdhcp::CommandOptions::getMacsFromFile(), isc::perfdhcp::CommandOptions::instance(), and number_generator_.

Referenced by sendSolicit6().

+ Here is the call graph for this function:

◆ generateMacAddress()

std::vector< uint8_t > isc::perfdhcp::TestControl::generateMacAddress ( uint8_t &  randomized)
protected

Generate MAC address.

This method generates MAC address. The number of unique MAC addresses it can generate is determined by the number simulated DHCP clients specified from command line. It uses CommandOptions object to retrieve number of clients. Based on this the random value is generated and added to the MAC address template (default MAC address).

Parameters
[out]randomizednumber of bytes randomized (initial value is ignored).
Exceptions
isc::BadValueif MAC address template (default or specified from the command line) has invalid size (expected 6 octets).
Returns
generated MAC address.

Definition at line 535 of file test_control.cc.

References isc::perfdhcp::CommandOptions::getClientsNum(), isc::perfdhcp::CommandOptions::getMacsFromFile(), isc::perfdhcp::CommandOptions::getMacTemplate(), HW_ETHER_LEN, isc::perfdhcp::CommandOptions::instance(), isc_throw, macaddr_gen_, and number_generator_.

Referenced by generateDuid(), and sendDiscover4().

+ Here is the call graph for this function:

◆ generateTransid()

uint32_t isc::perfdhcp::TestControl::generateTransid ( )
inlineprotected

generate transaction id.

Generate transaction id value (32-bit for DHCPv4, 24-bit for DHCPv6).

Returns
generated transaction id.

Definition at line 508 of file test_control.h.

References transid_gen_.

Referenced by createMessageFromReply(), createRequestFromAck(), sendDiscover4(), sendRequest6(), and sendSolicit6().

◆ getCurrentTimeout()

uint32_t isc::perfdhcp::TestControl::getCurrentTimeout ( ) const
protected

Returns a timeout for packet reception.

The calculation is based on the value of the timestamp when the next set of packets is to be sent. If no packet is received until then, new packets are sent.

Returns
A current timeout in microseconds.

Definition at line 639 of file test_control.cc.

References basic_rate_control_, isc::perfdhcp::RateControl::getDue(), isc::perfdhcp::CommandOptions::getReleaseRate(), isc::perfdhcp::CommandOptions::getRenewRate(), isc::perfdhcp::CommandOptions::instance(), release_rate_control_, and renew_rate_control_.

Referenced by receivePackets().

+ Here is the call graph for this function:

◆ getElapsedTime()

template<class T >
uint32_t isc::perfdhcp::TestControl::getElapsedTime ( const T &  pkt1,
const T &  pkt2 
)
protected

Calculate elapsed time between two packets.

This function calculates the time elapsed between two packets. If the timestamp of the pkt2 is greater than timestamp of the pkt1, the positive value is returned. If the pkt2 timestamp is equal or less than pkt1 timestamp, 0 is returned.

Template Parameters
TPkt4Ptr or Pkt6Ptr class.
Parameters
pkt1first packet.
pkt2second packet.
Exceptions
InvalidOperationif packet timestamps are invalid.
Returns
elapsed time in milliseconds between pkt1 and pkt2.

Definition at line 680 of file test_control.cc.

References isc_throw.

◆ getElapsedTimeOffset()

int isc::perfdhcp::TestControl::getElapsedTimeOffset ( ) const
protected

Return elapsed time offset in a packet.

Returns
elapsed time offset in packet.

Definition at line 669 of file test_control.cc.

References isc::perfdhcp::CommandOptions::getElapsedTimeOffset(), isc::perfdhcp::CommandOptions::getIpVersion(), and isc::perfdhcp::CommandOptions::instance().

Referenced by printTemplate(), sendRequest4(), and sendRequest6().

+ Here is the call graph for this function:

◆ getRandomOffset()

int isc::perfdhcp::TestControl::getRandomOffset ( const int  arg_idx) const
protected

Return randomization offset in a packet.

Returns
randomization offset in packet.

Definition at line 694 of file test_control.cc.

References isc::perfdhcp::CommandOptions::getIpVersion(), isc::perfdhcp::CommandOptions::getRandomOffset(), and isc::perfdhcp::CommandOptions::instance().

Referenced by printTemplate(), sendDiscover4(), sendRequest4(), sendRequest6(), and sendSolicit6().

+ Here is the call graph for this function:

◆ getRcvdPacketsNum()

uint64_t isc::perfdhcp::TestControl::getRcvdPacketsNum ( ExchangeType  xchg_type) const
protected

Get number of received packets.

Get the number of received packets from the Statistics Manager. Function may throw if Statistics Manager object is not initialized.

Note
The method parameter is non-const to suppress the cppcheck warning about the object being passed by value. However, passing an enum by reference doesn't make much sense. At the same time, removing the constness should be pretty safe for this function.
Parameters
xchg_typepacket exchange type.
Returns
number of received packets.

Definition at line 714 of file test_control.cc.

References isc::perfdhcp::CommandOptions::getIpVersion(), isc::perfdhcp::CommandOptions::instance(), stats_mgr4_, and stats_mgr6_.

+ Here is the call graph for this function:

◆ getRequestedIpOffset()

int isc::perfdhcp::TestControl::getRequestedIpOffset ( ) const
protected

Return requested ip offset in a packet.

Returns
randomization offset in a packet.

Definition at line 704 of file test_control.cc.

References isc::perfdhcp::CommandOptions::getIpVersion(), isc::perfdhcp::CommandOptions::getRequestedIpOffset(), and isc::perfdhcp::CommandOptions::instance().

Referenced by printTemplate(), sendRequest4(), and sendRequest6().

+ Here is the call graph for this function:

◆ getSentPacketsNum()

uint64_t isc::perfdhcp::TestControl::getSentPacketsNum ( ExchangeType  xchg_type) const
protected

Get number of sent packets.

Get the number of sent packets from the Statistics Manager. Function may throw if Statistics Manager object is not initialized.

Note
The method parameter is non-const to suppress the cppcheck warning about the object being passed by value. However, passing an enum by reference doesn't make much sense. At the same time, removing the constness should be pretty safe for this function.
Parameters
xchg_typepacket exchange type.
Returns
number of sent packets.

Definition at line 724 of file test_control.cc.

References isc::perfdhcp::CommandOptions::getIpVersion(), isc::perfdhcp::CommandOptions::instance(), stats_mgr4_, and stats_mgr6_.

Referenced by checkExitConditions().

+ Here is the call graph for this function:

◆ getServerIdOffset()

int isc::perfdhcp::TestControl::getServerIdOffset ( ) const
protected

Return server id offset in a packet.

Returns
server id offset in packet.

Definition at line 734 of file test_control.cc.

References isc::perfdhcp::CommandOptions::getIpVersion(), isc::perfdhcp::CommandOptions::getServerIdOffset(), and isc::perfdhcp::CommandOptions::instance().

Referenced by printTemplate(), sendRequest4(), and sendRequest6().

+ Here is the call graph for this function:

◆ getTemplateBuffer()

TestControl::TemplateBuffer isc::perfdhcp::TestControl::getTemplateBuffer ( const size_t  idx) const
protected

Return template buffer.

Method returns template buffer at specified index.

Parameters
idxindex of template buffer.
Exceptions
isc::OutOfRangeif buffer index out of bounds.
Returns
reference to template buffer.

Definition at line 744 of file test_control.cc.

References isc_throw, and template_buffers_.

◆ getTransactionIdOffset()

int isc::perfdhcp::TestControl::getTransactionIdOffset ( const int  arg_idx) const
protected

Return transaction id offset in a packet.

Parameters
arg_idxcommand line argument index to be used. If multiple -X parameters specified it points to the one to be used.
Returns
transaction id offset in packet.

Definition at line 752 of file test_control.cc.

References isc::perfdhcp::CommandOptions::getIpVersion(), isc::perfdhcp::CommandOptions::getTransactionIdOffset(), and isc::perfdhcp::CommandOptions::instance().

Referenced by printTemplate(), sendDiscover4(), sendRequest4(), sendRequest6(), and sendSolicit6().

+ Here is the call graph for this function:

◆ handleChild()

void isc::perfdhcp::TestControl::handleChild ( int  sig)
staticprotected

Handle child signal.

Function handles child signal by waiting for the process to complete.

Parameters
sigsignal (ignored)

Definition at line 762 of file test_control.cc.

Referenced by runWrapped().

◆ handleInterrupt()

void isc::perfdhcp::TestControl::handleInterrupt ( int  sig)
staticprotected

Handle interrupt signal.

Function sets flag indicating that program has been interrupted.

Parameters
sigsignal (ignored)

Definition at line 770 of file test_control.cc.

References interrupted_.

Referenced by run().

◆ hasLateExitCommenced()

bool isc::perfdhcp::TestControl::hasLateExitCommenced ( ) const

Check if the program is in that period where the program was bound to exit, but was delayed by lateExit().

Definition at line 48 of file test_control.cc.

References isc::perfdhcp::late_exit_target_time_.

Referenced by run().

◆ haveAllPacketsBeenReceived()

bool isc::perfdhcp::TestControl::haveAllPacketsBeenReceived ( ) const

Checks if all expected packets were already received.

Definition at line 76 of file test_control.cc.

References isc::perfdhcp::CommandOptions::getIpVersion(), and isc::perfdhcp::CommandOptions::getNumRequests().

+ Here is the call graph for this function:

◆ initializeStatsMgr()

◆ initPacketTemplates()

void isc::perfdhcp::TestControl::initPacketTemplates ( )
protected

Reads packet templates from files.

Method iterates through all specified template files, reads their content and stores it in class internal buffers. Template file names are specified from the command line with -T option.

Exceptions
isc::BadValueif any of the template files does not exist, contains characters other than hexadecimal digits or spaces.
OutOfRangeif any of the template files is empty or has odd number of hexadecimal digits.

Definition at line 775 of file test_control.cc.

References isc::perfdhcp::CommandOptions::getTemplateFiles(), isc::perfdhcp::CommandOptions::instance(), readPacketTemplate(), template_buffers_, template_packets_v4_, and template_packets_v6_.

Referenced by run().

+ Here is the call graph for this function:

◆ instance()

TestControl & isc::perfdhcp::TestControl::instance ( )
static

TestControl is a singleton class.

This method returns reference to its sole instance.

Returns
the only existing instance of test control

Definition at line 136 of file test_control.cc.

Referenced by main().

◆ openSocket()

int isc::perfdhcp::TestControl::openSocket ( ) const
protected

Open socket to communicate with DHCP server.

Method opens socket and binds it to local address. Function will use either interface name, local address or server address to create a socket, depending on what is available (specified from the command line). If socket can't be created for any reason, exception is thrown. If destination address is broadcast (for DHCPv4) or multicast (for DHCPv6) than broadcast or multicast option is set on the socket. Opened socket is registered and managed by IfaceMgr.

Exceptions
isc::BadValueif socket can't be created for given interface, local address or remote address.
isc::InvalidOperationif broadcast option can't be set for the v4 socket or if multicast option can't be set for the v6 socket.
isc::Unexpectedif internal unexpected error occurred.
Returns
socket descriptor.

Definition at line 839 of file test_control.cc.

References isc::asiolink::IOAddress::getFamily(), isc::perfdhcp::CommandOptions::getIpVersion(), isc::perfdhcp::CommandOptions::getLocalName(), isc::perfdhcp::CommandOptions::getLocalPort(), isc::perfdhcp::CommandOptions::getServerName(), isc::perfdhcp::CommandOptions::instance(), and isc_throw.

Referenced by run().

+ Here is the call graph for this function:

◆ printDiagnostics()

void isc::perfdhcp::TestControl::printDiagnostics ( ) const
protected

Print main diagnostics data.

Method prints main diagnostics data.

Definition at line 1003 of file test_control.cc.

References isc::perfdhcp::CommandOptions::getDuidTemplate(), isc::perfdhcp::CommandOptions::getMacTemplate(), isc::perfdhcp::CommandOptions::instance(), isc::perfdhcp::CommandOptions::printCommandLine(), testDiags(), and vector2Hex().

Referenced by run().

+ Here is the call graph for this function:

◆ printIntermediateStats()

void isc::perfdhcp::TestControl::printIntermediateStats ( )
protected

Print intermediate statistics.

Print brief statistics regarding number of sent packets, received packets and dropped packets so far.

Definition at line 1124 of file test_control.cc.

References isc::perfdhcp::CommandOptions::getIpVersion(), isc::perfdhcp::CommandOptions::getReportDelay(), isc::perfdhcp::CommandOptions::instance(), last_report_, stats_mgr4_, and stats_mgr6_.

Referenced by run().

+ Here is the call graph for this function:

◆ printRate()

◆ printStats()

void isc::perfdhcp::TestControl::printStats ( ) const
protected

Print performance statistics.

Method prints performance statistics.

Exceptions
isc::InvalidOperationif Statistics Manager was not initialized.

Definition at line 1140 of file test_control.cc.

References isc::perfdhcp::CommandOptions::getIpVersion(), isc::perfdhcp::CommandOptions::instance(), isc_throw, printRate(), stats_mgr4_, stats_mgr6_, and testDiags().

Referenced by run().

+ Here is the call graph for this function:

◆ printTemplate()

void isc::perfdhcp::TestControl::printTemplate ( const uint8_t  packet_type) const
protected

◆ printTemplates()

void isc::perfdhcp::TestControl::printTemplates ( ) const
protected

Print templates information.

Method prints information about data offsets in packet templates and their contents.

Definition at line 1075 of file test_control.cc.

References isc::dhcp::DHCPDISCOVER, isc::dhcp::DHCPREQUEST, DHCPV6_REQUEST, DHCPV6_SOLICIT, isc::perfdhcp::CommandOptions::getIpVersion(), isc::perfdhcp::CommandOptions::instance(), and printTemplate().

Referenced by run().

+ Here is the call graph for this function:

◆ processReceivedPacket4()

void isc::perfdhcp::TestControl::processReceivedPacket4 ( const TestControlSocket socket,
const dhcp::Pkt4Ptr pkt4 
)
protected

Process received DHCPv4 packet.

Method performs processing of the received DHCPv4 packet, updates statistics and responds to the server if required, e.g. when OFFER packet arrives, this function will initiate REQUEST message to the server.

Warning
this method does not check if provided socket is valid (specifically if v4 socket for received v4 packet).
Parameters
[in]socketsocket to be used.
[in]pkt4object representing DHCPv4 packet received.
Exceptions
isc::BadValueif unknown message type received.
isc::Unexpectedif unexpected error occurred.

Definition at line 1229 of file test_control.cc.

References ack_storage_, isc::dhcp::DHCPACK, isc::dhcp::DHCPOFFER, isc::perfdhcp::CommandOptions::DORA_SARR, isc::perfdhcp::CommandOptions::getExchangeMode(), isc::perfdhcp::CommandOptions::instance(), sendRequest4(), stats_mgr4_, template_buffers_, isc::perfdhcp::StatsMgr< T >::XCHG_DO, isc::perfdhcp::StatsMgr< T >::XCHG_RA, and isc::perfdhcp::StatsMgr< T >::XCHG_RNA.

Referenced by receivePackets().

+ Here is the call graph for this function:

◆ processReceivedPacket6()

void isc::perfdhcp::TestControl::processReceivedPacket6 ( const TestControlSocket socket,
const dhcp::Pkt6Ptr pkt6 
)
protected

Process received DHCPv6 packet.

Method performs processing of the received DHCPv6 packet, updates statistics and responds to the server if required, e.g. when ADVERTISE packet arrives, this function will initiate REQUEST message to the server.

Warning
this method does not check if provided socket is valid (specifically if v4 socket for received v4 packet).
Parameters
[in]socketsocket to be used.
[in]pkt6object representing DHCPv6 packet received.
Exceptions
isc::BadValueif unknown message type received.
isc::Unexpectedif unexpected error occurred.

Definition at line 1272 of file test_control.cc.

References DHCPV6_ADVERTISE, DHCPV6_REPLY, isc::perfdhcp::CommandOptions::DORA_SARR, isc::perfdhcp::CommandOptions::getExchangeMode(), isc::perfdhcp::CommandOptions::instance(), reply_storage_, sendRequest6(), stats_mgr6_, template_buffers_, isc::perfdhcp::StatsMgr< T >::XCHG_RL, isc::perfdhcp::StatsMgr< T >::XCHG_RN, isc::perfdhcp::StatsMgr< T >::XCHG_RR, and isc::perfdhcp::StatsMgr< T >::XCHG_SA.

Referenced by receivePackets().

+ Here is the call graph for this function:

◆ readPacketTemplate()

void isc::perfdhcp::TestControl::readPacketTemplate ( const std::string &  file_name)
protected

Read DHCP message template from file.

Method reads DHCP message template from file and converts it to binary format. Read data is appended to template_buffers_ vector.

Parameters
file_namename of the packet template file.
Exceptions
isc::OutOfRangeif file is empty or has odd number of hexadecimal digits.
isc::BadValueif file contains characters other than spaces or hexadecimal digits.

Definition at line 1181 of file test_control.cc.

References isc_throw, and template_buffers_.

Referenced by initPacketTemplates().

◆ receivePackets()

uint64_t isc::perfdhcp::TestControl::receivePackets ( const TestControlSocket socket)
protected

Receive DHCPv4 or DHCPv6 packets from the server.

Method receives DHCPv4 or DHCPv6 packets from the server. This function will call processReceivedPacket4 or processReceivedPacket6 depending if DHCPv4 or DHCPv6 packet has arrived.

Warning
this method does not check if provided socket is valid. Ensure that it is valid prior to calling it.
Parameters
socketsocket to be used.
Exceptions
isc::BadValueif unknown message type received.
isc::Unexpectedif unexpected error occurred.
Returns
number of received packets.
Todo:
: Add packet exception handling here. Right now any malformed packet will cause perfdhcp to abort.
Todo:
: Add packet exception handling here. Right now any malformed packet will cause perfdhcp to abort.

Definition at line 1328 of file test_control.cc.

References getCurrentTimeout(), isc::perfdhcp::CommandOptions::instance(), processReceivedPacket4(), processReceivedPacket6(), stats_mgr4_, stats_mgr6_, testDiags(), and isc::Exception::what().

Referenced by run(), and sendPackets().

+ Here is the call graph for this function:

◆ registerOptionFactories()

void isc::perfdhcp::TestControl::registerOptionFactories ( ) const
protected

Register option factory functions for DHCPv4 or DHCPv6.

Method registers option factory functions for DHCPv4 or DHCPv6, depending in which mode test is currently running.

Definition at line 1439 of file test_control.cc.

References isc::perfdhcp::CommandOptions::getIpVersion(), isc::perfdhcp::CommandOptions::instance(), isc_throw, registerOptionFactories4(), and registerOptionFactories6().

Referenced by run().

+ Here is the call graph for this function:

◆ registerOptionFactories4()

void isc::perfdhcp::TestControl::registerOptionFactories4 ( ) const
protected

Register option factory functions for DHCPv4.

Method registers option factory functions for DHCPv4. These functions are called to create instances of DHCPv4 options. Call dhcp::Option::factory to invoke factory function for particular option. Don't use this function directly. Use registerOptionFactories instead.

Definition at line 1380 of file test_control.cc.

References isc::dhcp::DHO_DHCP_MESSAGE_TYPE, isc::dhcp::DHO_DHCP_PARAMETER_REQUEST_LIST, isc::dhcp::DHO_DHCP_SERVER_IDENTIFIER, factoryGeneric(), and factoryRequestList4().

Referenced by registerOptionFactories().

+ Here is the call graph for this function:

◆ registerOptionFactories6()

void isc::perfdhcp::TestControl::registerOptionFactories6 ( ) const
protected

Register option factory functions for DHCPv6.

Method registers option factory functions for DHCPv6. These functions are called to create instances of DHCPv6 options. Call dhcp::Option::factory to invoke factory function for particular option. Don't use this function directly. Use registerOptionFactories instead.

Definition at line 1400 of file test_control.cc.

References D6O_CLIENTID, D6O_ELAPSED_TIME, D6O_IA_NA, D6O_IA_PD, D6O_ORO, D6O_RAPID_COMMIT, D6O_SERVERID, factoryElapsedTime6(), factoryGeneric(), factoryIana6(), factoryIapd6(), factoryOptionRequestOption6(), and factoryRapidCommit6().

Referenced by registerOptionFactories().

+ Here is the call graph for this function:

◆ reset()

◆ run()

int isc::perfdhcp::TestControl::run ( )

brief\ Run performance test.

Method runs whole performance test. Command line options must be parsed prior to running this function. Otherwise function will throw exception.

Exceptions
isc::InvalidOperationif command line options are not parsed.
isc::Unexpectedif internal Test Controller error occurred.
Returns
error_code, 3 if number of received packets is not equal to number of sent packets, 0 if everything is ok.

Definition at line 1475 of file test_control.cc.

References basic_rate_control_, checkExitConditions(), checkLateMessages(), cleanCachedPackets(), DHCPV6_RELEASE, DHCPV6_RENEW, first_packet_serverid_, isc::perfdhcp::CommandOptions::getClientsNum(), isc::perfdhcp::CommandOptions::getIpVersion(), isc::perfdhcp::RateControl::getOutboundMessageCount(), isc::perfdhcp::CommandOptions::getPreload(), isc::perfdhcp::CommandOptions::getReleaseRate(), isc::perfdhcp::CommandOptions::getRenewRate(), isc::perfdhcp::CommandOptions::getReportDelay(), isc::perfdhcp::CommandOptions::getSeed(), isc::perfdhcp::CommandOptions::getWrapped(), handleInterrupt(), hasLateExitCommenced(), initializeStatsMgr(), initPacketTemplates(), isc::perfdhcp::CommandOptions::instance(), isc_throw, isc::perfdhcp::CommandOptions::isSeeded(), openSocket(), printDiagnostics(), printIntermediateStats(), printStats(), printTemplates(), receivePackets(), registerOptionFactories(), release_rate_control_, renew_rate_control_, reset(), runWrapped(), sendMultipleMessages6(), sendMultipleRequests(), sendPackets(), setMacAddrGenerator(), setTransidGenerator(), stats_mgr4_, stats_mgr6_, testDiags(), isc::perfdhcp::TestControl::TestControlSocket::valid_, and vector2Hex().

Referenced by main().

+ Here is the call graph for this function:

◆ runWrapped()

void isc::perfdhcp::TestControl::runWrapped ( bool  do_stop = false) const
protected

Run wrapped command.

Parameters
do_stopexecute wrapped command with "stop" argument.

Definition at line 1644 of file test_control.cc.

References isc::perfdhcp::CommandOptions::getWrapped(), handleChild(), isc::perfdhcp::CommandOptions::instance(), and isc_throw.

Referenced by run().

+ Here is the call graph for this function:

◆ saveFirstPacket() [1/2]

void isc::perfdhcp::TestControl::saveFirstPacket ( const dhcp::Pkt4Ptr pkt)
inlineprotected

Save the first DHCPv4 sent packet of the specified type.

This method saves first packet of the specified being sent to the server if user requested diagnostics flag 'T'. In such case program has to print contents of selected packets being sent to the server. It collects first packets of each type and keeps them around until test finishes. Then they are printed to the user. If packet of specified type has been already stored this function performs no operation. This function does not perform sanity check if packet pointer is valid. Make sure it is before calling it.

Parameters
pktpacket to be stored.

Definition at line 1661 of file test_control.cc.

References template_packets_v4_, and testDiags().

Referenced by sendDiscover4(), sendRequest4(), sendRequest6(), and sendSolicit6().

+ Here is the call graph for this function:

◆ saveFirstPacket() [2/2]

void isc::perfdhcp::TestControl::saveFirstPacket ( const dhcp::Pkt6Ptr pkt)
inlineprotected

Save the first DHCPv6 sent packet of the specified type.

This method saves first packet of the specified being sent to the server if user requested diagnostics flag 'T'. In such case program has to print contents of selected packets being sent to the server. It collects first packets of each type and keeps them around until test finishes. Then they are printed to the user. If packet of specified type has been already stored this function performs no operation. This function does not perform sanity check if packet pointer is valid. Make sure it is before calling it.

Parameters
pktpacket to be stored.

Definition at line 1670 of file test_control.cc.

References template_packets_v6_, and testDiags().

+ Here is the call graph for this function:

◆ sendDiscover4() [1/2]

void isc::perfdhcp::TestControl::sendDiscover4 ( const TestControlSocket socket,
const bool  preload = false 
)
protected

Send DHCPv4 DISCOVER message.

Method creates and sends DHCPv4 DISCOVER message to the server with the following options:

  • MESSAGE_TYPE set to DHCPDISCOVER
  • PARAMETER_REQUEST_LIST with the same list of requested options as described in factoryRequestList4. The transaction id and MAC address are randomly generated for the message. Range of unique MAC addresses generated depends on the number of clients specified from the command line. Copy of sent packet is stored in the stats_mgr4_ object to update statistics.
Parameters
socketsocket to be used to send the message.
preloadpreload mode, packets not included in statistics.
Exceptions
isc::Unexpectedif failed to create new packet instance.
isc::BadValueif MAC address has invalid length.
isc::dhcp::SocketWriteErrorif failed to send the packet.

Definition at line 1679 of file test_control.cc.

References addExtraOpts(), basic_rate_control_, isc::dhcp::DHCPDISCOVER, isc::dhcp::DHO_DHCP_MESSAGE_TYPE, isc::dhcp::DHO_DHCP_PARAMETER_REQUEST_LIST, generateClientId(), generateMacAddress(), generateTransid(), isc::dhcp::HTYPE_ETHER, isc_throw, saveFirstPacket(), setDefaults4(), stats_mgr4_, isc::perfdhcp::RateControl::updateSendTime(), and isc::perfdhcp::StatsMgr< T >::XCHG_DO.

Referenced by sendPackets().

+ Here is the call graph for this function:

◆ sendDiscover4() [2/2]

void isc::perfdhcp::TestControl::sendDiscover4 ( const TestControlSocket socket,
const std::vector< uint8_t > &  template_buf,
const bool  preload = false 
)
protected

Send DHCPv4 DISCOVER message from template.

Method sends DHCPv4 DISCOVER message from template. The template data is expected to be in binary format. Provided buffer is copied and parts of it are replaced with actual data (e.g. MAC address, transaction id etc.). Copy of sent packet is stored in the stats_mgr4_ object to update statistics.

Parameters
socketsocket to be used to send the message.
template_bufbuffer holding template packet.
preloadpreload mode, packets not included in statistics.
Exceptions
isc::OutOfRangeif randomization offset is out of bounds.
isc::dhcp::SocketWriteErrorif failed to send the packet.

Definition at line 1729 of file test_control.cc.

References basic_rate_control_, generateMacAddress(), generateTransid(), getRandomOffset(), getTransactionIdOffset(), HW_ETHER_LEN, isc_throw, saveFirstPacket(), setDefaults4(), stats_mgr4_, isc::perfdhcp::RateControl::updateSendTime(), and isc::perfdhcp::StatsMgr< T >::XCHG_DO.

+ Here is the call graph for this function:

◆ sendMessageFromReply()

bool isc::perfdhcp::TestControl::sendMessageFromReply ( const uint16_t  msg_type,
const TestControlSocket socket 
)
protected

Send DHCPv6 Renew or Release message using specified socket.

This method will select an existing lease from the Reply packet cache If there is no lease that can be renewed or released this method will return false.

Parameters
msg_typeA type of the message to be sent (DHCPV6_RENEW or DHCPV6_RELEASE).
socketAn object encapsulating socket to be used to send a packet.
Returns
true if the message has been sent, false otherwise.

Definition at line 1811 of file test_control.cc.

References addExtraOpts(), createMessageFromReply(), DHCPV6_RELEASE, DHCPV6_RENEW, isc_throw, release_rate_control_, renew_rate_control_, reply_storage_, setDefaults6(), stats_mgr6_, isc::perfdhcp::RateControl::updateSendTime(), isc::perfdhcp::StatsMgr< T >::XCHG_RL, and isc::perfdhcp::StatsMgr< T >::XCHG_RN.

Referenced by sendMultipleMessages6().

+ Here is the call graph for this function:

◆ sendMultipleMessages6()

uint64_t isc::perfdhcp::TestControl::sendMultipleMessages6 ( const TestControlSocket socket,
const uint32_t  msg_type,
const uint64_t  msg_num 
)
protected

Send number of DHCPv6 Renew or Release messages to the server.

Parameters
socketAn object representing socket to be used to send packets.
msg_typeA type of the messages to be sent (DHCPV6_RENEW or DHCPV6_RELEASE).
msg_numA number of messages to be sent.
Returns
A number of messages actually sent.

Definition at line 991 of file test_control.cc.

References sendMessageFromReply().

Referenced by run().

+ Here is the call graph for this function:

◆ sendMultipleRequests()

uint64_t isc::perfdhcp::TestControl::sendMultipleRequests ( const TestControlSocket socket,
const uint64_t  msg_num 
)
protected

Send number of DHCPREQUEST (renew) messages to a server.

Parameters
socketAn object representing socket to be used to send packets.
msg_numA number of messages to be sent.
Returns
A number of messages actually sent.

Definition at line 980 of file test_control.cc.

References sendRequestFromAck().

Referenced by run().

+ Here is the call graph for this function:

◆ sendPackets()

void isc::perfdhcp::TestControl::sendPackets ( const TestControlSocket socket,
const uint64_t  packets_num,
const bool  preload = false 
)
protected

Send number of packets to initiate new exchanges.

Method initiates the new DHCP exchanges by sending number of DISCOVER (DHCPv4) or SOLICIT (DHCPv6) packets. If preload mode was requested sent packets will not be counted in the statistics. The responses from the server will be received and counted as orphans because corresponding sent packets are not included in StatsMgr for match. When preload mode is disabled and diagnostics flag 'i' is specified then function will be trying to receive late packets before new packets are sent to the server. Statistics of late received packets is updated accordingly.

Todo:
do not count responses in preload mode as orphans.
Parameters
socketsocket to be used to send packets.
packets_numnumber of packets to be sent.
preloadpreload mode, packets not included in statistics.
Exceptions
isc::Unexpectedif thrown by packet sending method.
isc::InvalidOperationif thrown by packet sending method.
isc::OutOfRangeif thrown by packet sending method.

Definition at line 939 of file test_control.cc.

References isc::perfdhcp::CommandOptions::getIpVersion(), isc::perfdhcp::CommandOptions::instance(), receivePackets(), sendDiscover4(), sendSolicit6(), stats_mgr4_, stats_mgr6_, template_buffers_, and testDiags().

Referenced by run().

+ Here is the call graph for this function:

◆ sendRequest4() [1/2]

void isc::perfdhcp::TestControl::sendRequest4 ( const TestControlSocket socket,
const dhcp::Pkt4Ptr discover_pkt4,
const dhcp::Pkt4Ptr offer_pkt4 
)
protected

Send DHCPv4 REQUEST message.

Method creates and sends DHCPv4 REQUEST message to the server. Copy of sent packet is stored in the stats_mgr4_ object to update statistics.

Parameters
socketsocket to be used to send message.
discover_pkt4DISCOVER packet sent.
offer_pkt4OFFER packet object.
Exceptions
isc::Unexpectedif unexpected error occurred.
isc::InvalidOperationif Statistics Manager has not been initialized.
isc::dhcp::SocketWriteErrorif failed to send the packet.

Set client address.

Definition at line 1848 of file test_control.cc.

References addExtraOpts(), isc::dhcp::DHCPREQUEST, isc::dhcp::DHO_DHCP_PARAMETER_REQUEST_LIST, isc::dhcp::DHO_DHCP_REQUESTED_ADDRESS, isc::dhcp::DHO_DHCP_SERVER_IDENTIFIER, first_packet_serverid_, generateClientId(), isc::perfdhcp::CommandOptions::instance(), isc_throw, isc::asiolink::IOAddress::isV4(), saveFirstPacket(), setDefaults4(), stats_mgr4_, isc::asiolink::IOAddress::toUint32(), isc::perfdhcp::StatsMgr< T >::XCHG_DO, and isc::perfdhcp::StatsMgr< T >::XCHG_RA.

Referenced by processReceivedPacket4().

+ Here is the call graph for this function:

◆ sendRequest4() [2/2]

void isc::perfdhcp::TestControl::sendRequest4 ( const TestControlSocket socket,
const std::vector< uint8_t > &  template_buf,
const dhcp::Pkt4Ptr discover_pkt4,
const dhcp::Pkt4Ptr offer_pkt4 
)
protected

Send DHCPv4 REQUEST message from template.

Method sends DHCPv4 REQUEST message from template. Copy of sent packet is stored in the stats_mgr4_ object to update statistics.

Parameters
socketsocket to be used to send message.
template_bufbuffer holding template packet.
discover_pkt4DISCOVER packet sent.
offer_pkt4OFFER packet received.
Exceptions
isc::dhcp::SocketWriteErrorif failed to send the packet.

Set client address.

Definition at line 1914 of file test_control.cc.

References addExtraOpts(), isc::dhcp::DHO_DHCP_REQUESTED_ADDRESS, isc::dhcp::DHO_DHCP_SERVER_IDENTIFIER, first_packet_serverid_, getElapsedTimeOffset(), getRandomOffset(), getRequestedIpOffset(), getServerIdOffset(), getTransactionIdOffset(), HW_ETHER_LEN, isc::perfdhcp::CommandOptions::instance(), isc_throw, isc::asiolink::IOAddress::isV4(), saveFirstPacket(), setDefaults4(), stats_mgr4_, isc::asiolink::IOAddress::toUint32(), isc::perfdhcp::StatsMgr< T >::XCHG_DO, and isc::perfdhcp::StatsMgr< T >::XCHG_RA.

+ Here is the call graph for this function:

◆ sendRequest6() [1/2]

void isc::perfdhcp::TestControl::sendRequest6 ( const TestControlSocket socket,
const dhcp::Pkt6Ptr advertise_pkt6 
)
protected

Send DHCPv6 REQUEST message.

Method creates and sends DHCPv6 REQUEST message to the server with the following options:

  • D6O_ELAPSED_TIME
  • D6O_CLIENTID
  • D6O_SERVERID Copy of sent packet is stored in the stats_mgr6_ object to update statistics.
Parameters
socketsocket to be used to send message.
advertise_pkt6ADVERTISE packet object.
Exceptions
isc::Unexpectedif unexpected error occurred.
isc::InvalidOperationif Statistics Manager has not been initialized.
isc::dhcp::SocketWriteErrorif failed to send the packet.

Definition at line 2028 of file test_control.cc.

References addExtraOpts(), copyIaOptions(), D6O_CLIENTID, D6O_ELAPSED_TIME, D6O_SERVERID, DHCPV6_REQUEST, first_packet_serverid_, generateTransid(), isc::perfdhcp::CommandOptions::instance(), isc_throw, saveFirstPacket(), setDefaults6(), stats_mgr6_, isc::perfdhcp::StatsMgr< T >::XCHG_RR, and isc::perfdhcp::StatsMgr< T >::XCHG_SA.

Referenced by processReceivedPacket6().

+ Here is the call graph for this function:

◆ sendRequest6() [2/2]

void isc::perfdhcp::TestControl::sendRequest6 ( const TestControlSocket socket,
const std::vector< uint8_t > &  template_buf,
const dhcp::Pkt6Ptr advertise_pkt6 
)
protected

Send DHCPv6 REQUEST message from template.

Method sends DHCPv6 REQUEST message from template. Copy of sent packet is stored in the stats_mgr6_ object to update statistics.

Parameters
socketsocket to be used to send message.
template_bufpacket template buffer.
advertise_pkt6ADVERTISE packet object.
Exceptions
isc::dhcp::SocketWriteErrorif failed to send the packet.

Definition at line 2085 of file test_control.cc.

References addExtraOpts(), D6O_CLIENTID, D6O_ELAPSED_TIME, D6O_IA_NA, D6O_SERVERID, DHCPV6_REQUEST, first_packet_serverid_, generateTransid(), getElapsedTimeOffset(), getRandomOffset(), getRequestedIpOffset(), getServerIdOffset(), getTransactionIdOffset(), isc::perfdhcp::CommandOptions::instance(), isc_throw, setDefaults6(), stats_mgr6_, template_packets_v6_, testDiags(), isc::perfdhcp::StatsMgr< T >::XCHG_RR, and isc::perfdhcp::StatsMgr< T >::XCHG_SA.

+ Here is the call graph for this function:

◆ sendRequestFromAck()

bool isc::perfdhcp::TestControl::sendRequestFromAck ( const TestControlSocket socket)
protected

Send DHCPv4 renew (DHCPREQUEST) using specified socket.

Parameters
socketAn object encapsulating socket to be used to send a packet.
Returns
true if the message has been sent, false otherwise.

Definition at line 1781 of file test_control.cc.

References ack_storage_, addExtraOpts(), createRequestFromAck(), isc_throw, renew_rate_control_, setDefaults4(), stats_mgr4_, isc::perfdhcp::RateControl::updateSendTime(), and isc::perfdhcp::StatsMgr< T >::XCHG_RNA.

Referenced by sendMultipleRequests().

+ Here is the call graph for this function:

◆ sendSolicit6() [1/2]

void isc::perfdhcp::TestControl::sendSolicit6 ( const TestControlSocket socket,
const bool  preload = false 
)
protected

Send DHCPv6 SOLICIT message.

Method creates and sends DHCPv6 SOLICIT message to the server with the following options:

  • D6O_ELAPSED_TIME,
  • D6O_RAPID_COMMIT if rapid commit is requested in command line,
  • D6O_CLIENTID,
  • D6O_ORO (Option Request Option),
  • D6O_IA_NA. Copy of sent packet is stored in the stats_mgr6_ object to update statistics.
Parameters
socketsocket to be used to send the message.
preloadmode, packets not included in statistics.
Exceptions
isc::Unexpectedif failed to create new packet instance.
isc::dhcp::SocketWriteErrorif failed to send the packet.

Definition at line 2204 of file test_control.cc.

References addExtraOpts(), isc::perfdhcp::CommandOptions::LeaseType::ADDRESS, basic_rate_control_, D6O_CLIENTID, D6O_ELAPSED_TIME, D6O_IA_NA, D6O_IA_PD, D6O_ORO, D6O_RAPID_COMMIT, DHCPV6_SOLICIT, generateDuid(), generateTransid(), isc::perfdhcp::CommandOptions::instance(), isc_throw, isc::perfdhcp::CommandOptions::LeaseType::PREFIX, saveFirstPacket(), setDefaults6(), stats_mgr6_, isc::perfdhcp::RateControl::updateSendTime(), and isc::perfdhcp::StatsMgr< T >::XCHG_SA.

Referenced by sendPackets().

+ Here is the call graph for this function:

◆ sendSolicit6() [2/2]

void isc::perfdhcp::TestControl::sendSolicit6 ( const TestControlSocket socket,
const std::vector< uint8_t > &  template_buf,
const bool  preload = false 
)
protected

Send DHCPv6 SOLICIT message from template.

Method sends DHCPv6 SOLICIT message from template. Copy of sent packet is stored in the stats_mgr6_ object to update statistics.

Parameters
socketsocket to be used to send the message.
template_bufpacket template buffer.
preloadmode, packets not included in statistics.
Exceptions
isc::dhcp::SocketWriteErrorif failed to send the packet.

in template.

Definition at line 2256 of file test_control.cc.

References addExtraOpts(), basic_rate_control_, generateDuid(), generateTransid(), getRandomOffset(), getTransactionIdOffset(), isc_throw, saveFirstPacket(), setDefaults6(), stats_mgr6_, isc::perfdhcp::RateControl::updateSendTime(), and isc::perfdhcp::StatsMgr< T >::XCHG_SA.

+ Here is the call graph for this function:

◆ setDefaults4()

void isc::perfdhcp::TestControl::setDefaults4 ( const TestControlSocket socket,
const dhcp::Pkt4Ptr pkt 
)
protected

Set default DHCPv4 packet parameters.

This method sets default parameters on the DHCPv4 packet:

  • interface name,
  • local port = 68 (DHCP client port),
  • remote port = 67 (DHCP server port),
  • server's address,
  • GIADDR = local address where socket is bound to,
  • hops = 1 (pretending that we are a relay)
Parameters
socketsocket used to send the packet.
pktreference to packet to be configured.

Definition at line 2306 of file test_control.cc.

References isc::perfdhcp::TestControl::TestControlSocket::ifindex_, isc::perfdhcp::CommandOptions::instance(), and isc_throw.

Referenced by sendDiscover4(), sendRequest4(), and sendRequestFromAck().

+ Here is the call graph for this function:

◆ setDefaults6()

void isc::perfdhcp::TestControl::setDefaults6 ( const TestControlSocket socket,
const dhcp::Pkt6Ptr pkt 
)
protected

Set default DHCPv6 packet parameters.

This method sets default parameters on the DHCPv6 packet:

  • interface name,
  • interface index,
  • local port,
  • remote port,
  • local address,
  • remote address (server).
Parameters
socketsocket used to send the packet.
pktreference to packet to be configured.

Definition at line 2332 of file test_control.cc.

References isc::perfdhcp::TestControl::TestControlSocket::ifindex_, isc::perfdhcp::CommandOptions::instance(), and isc_throw.

Referenced by sendMessageFromReply(), sendRequest6(), and sendSolicit6().

+ Here is the call graph for this function:

◆ setMacAddrGenerator()

void isc::perfdhcp::TestControl::setMacAddrGenerator ( const NumberGeneratorPtr generator)
inline

Set new MAC address generator.

Set numbers generator that will be used to generate various MAC addresses to simulate number of clients.

Parameters
generatorobject to be used.

Definition at line 281 of file test_control.h.

References macaddr_gen_.

Referenced by reset(), and run().

◆ setTransidGenerator()

void isc::perfdhcp::TestControl::setTransidGenerator ( const NumberGeneratorPtr generator)
inline

Set new transaction id generator.

Parameters
generatorgenerator object to be used.

Definition at line 270 of file test_control.h.

References transid_gen_.

Referenced by reset(), and run().

◆ testDiags()

bool isc::perfdhcp::TestControl::testDiags ( const char  diag) const
protected

Find if diagnostic flag has been set.

Parameters
diagdiagnostic flag (a,e,i,s,r,t,T).
Returns
true if diagnostics flag has been set.

Definition at line 2386 of file test_control.cc.

References isc::perfdhcp::CommandOptions::instance().

Referenced by checkExitConditions(), checkLateMessages(), initializeStatsMgr(), printDiagnostics(), printStats(), receivePackets(), run(), saveFirstPacket(), sendPackets(), and sendRequest6().

+ Here is the call graph for this function:

◆ vector2Hex()

std::string isc::perfdhcp::TestControl::vector2Hex ( const std::vector< uint8_t > &  vec,
const std::string &  separator = "" 
) const
protected

Convert vector in hexadecimal string.

Todo:
Consider moving this function to src/lib/util.
Parameters
vecvector to be converted.
separatorseparator.

Definition at line 1165 of file test_control.cc.

References byte2Hex().

Referenced by printDiagnostics(), printTemplate(), and run().

+ Here is the call graph for this function:

◆ waitToExit()

bool isc::perfdhcp::TestControl::waitToExit ( ) const

Delay the exit by a fixed given time to catch up to all exchanges that were already started.

Returns
true if need to wait, false = ok to exit now

Definition at line 53 of file test_control.cc.

References isc::perfdhcp::CommandOptions::getExitWaitTime().

Referenced by checkExitConditions().

+ Here is the call graph for this function:

Member Data Documentation

◆ ack_storage_

PacketStorage<dhcp::Pkt4> isc::perfdhcp::TestControl::ack_storage_
protected

A storage for DHCPACK messages.

Definition at line 1151 of file test_control.h.

Referenced by processReceivedPacket4(), and sendRequestFromAck().

◆ basic_rate_control_

RateControl isc::perfdhcp::TestControl::basic_rate_control_
protected

A rate control class for Discover and Solicit messages.

Definition at line 1140 of file test_control.h.

Referenced by getCurrentTimeout(), reset(), run(), sendDiscover4(), and sendSolicit6().

◆ first_packet_serverid_

dhcp::OptionBuffer isc::perfdhcp::TestControl::first_packet_serverid_
protected

Buffer holding server id received in first packet.

Definition at line 1158 of file test_control.h.

Referenced by reset(), run(), sendRequest4(), and sendRequest6().

◆ HW_ETHER_LEN

const uint8_t isc::perfdhcp::TestControl::HW_ETHER_LEN = 6
static

Length of the Ethernet HW address (MAC) in bytes.

Todo:
Make this variable length as there are cases when HW address is longer than this (e.g. 20 bytes).

Definition at line 247 of file test_control.h.

Referenced by generateMacAddress(), sendDiscover4(), and sendRequest4().

◆ interrupted_

bool isc::perfdhcp::TestControl::interrupted_ = false
staticprotected

Is program interrupted.

Definition at line 1168 of file test_control.h.

Referenced by checkExitConditions(), handleInterrupt(), and reset().

◆ last_report_

boost::posix_time::ptime isc::perfdhcp::TestControl::last_report_
protected

Last intermediate report time.

Definition at line 1146 of file test_control.h.

Referenced by printIntermediateStats(), and reset().

◆ macaddr_gen_

NumberGeneratorPtr isc::perfdhcp::TestControl::macaddr_gen_
protected

Numbers generator for MAC address.

Definition at line 1155 of file test_control.h.

Referenced by generateMacAddress(), and setMacAddrGenerator().

◆ number_generator_

isc::util::random::UniformRandomIntegerGenerator isc::perfdhcp::TestControl::number_generator_
protected

Generate uniformly distributed integers in range of [min, max].

Definition at line 298 of file test_control.h.

Referenced by generateDuid(), and generateMacAddress().

◆ release_rate_control_

RateControl isc::perfdhcp::TestControl::release_rate_control_
protected

A rate control class for Release messages.

Definition at line 1144 of file test_control.h.

Referenced by getCurrentTimeout(), reset(), run(), and sendMessageFromReply().

◆ renew_rate_control_

RateControl isc::perfdhcp::TestControl::renew_rate_control_
protected

A rate control class for Renew messages.

Definition at line 1142 of file test_control.h.

Referenced by getCurrentTimeout(), reset(), run(), sendMessageFromReply(), and sendRequestFromAck().

◆ reply_storage_

PacketStorage<dhcp::Pkt6> isc::perfdhcp::TestControl::reply_storage_
protected

A storage for reply messages.

Definition at line 1152 of file test_control.h.

Referenced by cleanCachedPackets(), processReceivedPacket6(), and sendMessageFromReply().

◆ stats_mgr4_

◆ stats_mgr6_

◆ template_buffers_

TemplateBufferCollection isc::perfdhcp::TestControl::template_buffers_
protected

◆ template_packets_v4_

std::map<uint8_t, dhcp::Pkt4Ptr> isc::perfdhcp::TestControl::template_packets_v4_
protected

First packets send.

They are used at the end of the test to print packet templates when diagnostics flag T is specified.

Definition at line 1165 of file test_control.h.

Referenced by initPacketTemplates(), printTemplate(), and saveFirstPacket().

◆ template_packets_v6_

std::map<uint8_t, dhcp::Pkt6Ptr> isc::perfdhcp::TestControl::template_packets_v6_
protected

Definition at line 1166 of file test_control.h.

Referenced by initPacketTemplates(), printTemplate(), saveFirstPacket(), and sendRequest6().

◆ transid_gen_

NumberGeneratorPtr isc::perfdhcp::TestControl::transid_gen_
protected

Transaction id generator.

Definition at line 1154 of file test_control.h.

Referenced by generateTransid(), reset(), and setTransidGenerator().


The documentation for this class was generated from the following files: