Kea  1.9.9-git
avalanche_scen.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2019,2021 Internet Systems Consortium, Inc. ("ISC")
2 //
3 // This Source Code Form is subject to the terms of the Mozilla Public
4 // License, v. 2.0. If a copy of the MPL was not distributed with this
5 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 
7 #ifndef AVALANCHE_SCEN_H
8 #define AVALANCHE_SCEN_H
9 
10 #include <config.h>
11 
12 #include <perfdhcp/abstract_scen.h>
13 
14 
15 namespace isc {
16 namespace perfdhcp {
17 
18 // This class fixes an issue in older compilers
19 // that cannot handle enum class as key in std::unordered_map.
20 // See: https://stackoverflow.com/questions/18837857/cant-use-enum-class-as-unordered-map-key
22 {
23  template <typename T>
24  std::size_t operator()(T t) const
25  {
26  return static_cast<std::size_t>(t);
27  }
28 };
29 
36 class AvalancheScen : public AbstractScen {
37 public:
43  AbstractScen(options, socket),
44  socket_(socket),
45  total_resent_(0) {};
46 
52  int run() override;
53 
54 protected:
55 
56  // A reference to socket;
58 
60  std::unordered_map<ExchangeType, std::unordered_map<uint32_t, int>, EnumClassHash> retransmissions_;
62  std::unordered_map<ExchangeType, std::unordered_map<uint32_t, boost::posix_time::ptime>, EnumClassHash> start_times_;
63 
66 
74  int resendPackets(ExchangeType xchg_type);
75 
76 };
77 
78 }
79 }
80 
81 #endif // AVALANCHE_SCEN_H
ExchangeType
DHCP packet exchange types.
std::size_t operator()(T t) const
std::unordered_map< ExchangeType, std::unordered_map< uint32_t, int >, EnumClassHash > retransmissions_
A map xchg type -> (a map of trans id -> retransmissions count.
int total_resent_
Total number of resent packets.
int resendPackets(ExchangeType xchg_type)
\brief Resend packets.
int run() override
brief\ Run performance test.
Defines the logger used by the top-level component of kea-dhcp-ddns.
std::unordered_map< ExchangeType, std::unordered_map< uint32_t, boost::posix_time::ptime >, EnumClassHash > start_times_
A map xchg type -> (a map of trans id -> time of sending first packet.
Avalanche Scenario class.
Abstract Scenario class.
Definition: abstract_scen.h:21
Socket wrapper structure.
Definition: perf_socket.h:26
AvalancheScen(CommandOptions &options, BasePerfSocket &socket)
Default and the only constructor of AvalancheScen.