Kea 2.2.0
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
13
14
15namespace isc {
16namespace 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
37public:
43 AbstractScen(options, socket),
44 socket_(socket),
45 total_resent_(0) {};
46
52 int run() override;
53
54protected:
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
Abstract Scenario class.
Definition: abstract_scen.h:21
Avalanche Scenario class.
AvalancheScen(CommandOptions &options, BasePerfSocket &socket)
Default and the only constructor of AvalancheScen.
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 run() override
brief\ Run performance test.
int resendPackets(ExchangeType xchg_type)
\brief Resend packets.
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.
Socket wrapper structure.
Definition: perf_socket.h:26
ExchangeType
DHCP packet exchange types.
Defines the logger used by the top-level component of kea-lfc.
std::size_t operator()(T t) const