diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 12:15:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-13 12:15:43 +0000 |
commit | f5f56e1a1c4d9e9496fcb9d81131066a964ccd23 (patch) | |
tree | 49e44c6f87febed37efb953ab5485aa49f6481a7 /src/bin/perfdhcp/abstract_scen.h | |
parent | Initial commit. (diff) | |
download | isc-kea-f5f56e1a1c4d9e9496fcb9d81131066a964ccd23.tar.xz isc-kea-f5f56e1a1c4d9e9496fcb9d81131066a964ccd23.zip |
Adding upstream version 2.4.1.upstream/2.4.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/bin/perfdhcp/abstract_scen.h')
-rw-r--r-- | src/bin/perfdhcp/abstract_scen.h | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/src/bin/perfdhcp/abstract_scen.h b/src/bin/perfdhcp/abstract_scen.h new file mode 100644 index 0000000..99f6404 --- /dev/null +++ b/src/bin/perfdhcp/abstract_scen.h @@ -0,0 +1,64 @@ +// Copyright (C) 2019,2021 Internet Systems Consortium, Inc. ("ISC") +// +// 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 +// file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef ABSTRACT_SCEN_H +#define ABSTRACT_SCEN_H + + +#include <perfdhcp/test_control.h> + + +namespace isc { +namespace perfdhcp { + + +/// \brief Abstract Scenario class. +/// +/// This class must be inherited by scenario classes. +class AbstractScen : public boost::noncopyable { +public: + /// \brief Default and the only constructor of AbstractScen. + /// + /// \param options reference to command options, + /// \param socket reference to a socket. + AbstractScen(CommandOptions& options, BasePerfSocket &socket) : + options_(options), + tc_(options, socket) + { + if (options_.getIpVersion() == 4) { + stage1_xchg_ = ExchangeType::DO; + stage2_xchg_ = ExchangeType::RA; + } else { + stage1_xchg_ = ExchangeType::SA; + stage2_xchg_ = ExchangeType::RR; + } + }; + + /// \brief Run performance test. + /// + /// Method runs whole performance test. + /// + /// \return execution status. + virtual int run() = 0; + + /// \brief Trivial virtual destructor. + virtual ~AbstractScen() {}; + +protected: + CommandOptions& options_; ///< Reference to commandline options. + TestControl tc_; ///< Object for controlling sending and receiving packets. + + // Helper fields to avoid checking IP version each time an exchange type + // is needed. + ExchangeType stage1_xchg_; + ExchangeType stage2_xchg_; +}; + + +} +} + +#endif // ABSTRACT_SCEN_H |