Kea 2.7.5
avalanche_scen.h
Go to the documentation of this file.
1// Copyright (C) 2012-2024 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#include <unordered_map>
15
16namespace isc {
17namespace perfdhcp {
18
19// This class fixes an issue in older compilers
20// that cannot handle enum class as key in std::unordered_map.
21// See: https://stackoverflow.com/questions/18837857/cant-use-enum-class-as-unordered-map-key
23{
24 template <typename T>
25 std::size_t operator()(T t) const
26 {
27 return static_cast<std::size_t>(t);
28 }
29};
30
38public:
44 AbstractScen(options, socket),
45 socket_(socket),
46 total_resent_(0) {};
47
53 int run() override;
54
55protected:
56
57 // A reference to socket;
59
61 std::unordered_map<ExchangeType, std::unordered_map<uint32_t, int>, EnumClassHash> retransmissions_;
63 std::unordered_map<ExchangeType, std::unordered_map<uint32_t, boost::posix_time::ptime>, EnumClassHash> start_times_;
64
67
75 int resendPackets(ExchangeType xchg_type);
76
77};
78
79}
80}
81
82#endif // AVALANCHE_SCEN_H
Abstract Scenario class.
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