blob: 99f64041b2e9afaac2e4821645f8024515c11e6c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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
|