blob: 7063e1a9e79bbbf71f12ad179984f2cae2372909 (
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
// Copyright (C) 2014-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 PKT_CAPTURES_H
#define PKT_CAPTURES_H
#include <dhcp/pkt4.h>
#include <dhcp/pkt6.h>
namespace isc {
namespace dhcp {
namespace test {
class PktCaptures {
public:
/// @brief returns captured DISCOVER that went through a relay
///
/// See method code for a detailed explanation. This is a discover from
/// docsis3.0 device (Cable Modem)
///
/// @return relayed DISCOVER
static isc::dhcp::Pkt4Ptr captureRelayedDiscover();
/// @brief returns captured DISCOVER that went through a relay
///
/// See method code for a detailed explanation. This is a discover from
/// eRouter1.0 device (CPE device integrated with cable modem)
///
/// @return relayed DISCOVER
static isc::dhcp::Pkt4Ptr captureRelayedDiscover2();
/// @brief returns captured DISCOVER that went through a relay
///
/// See method code for a detailed explanation. This is a discover from
/// a buggy relay device with a bad suboption.
///
/// @return relayed DISCOVER
static isc::dhcp::Pkt4Ptr captureBadRelayedDiscover();
/// @brief returns captured DISCOVER that contains a valid VIVSO option
///
/// See method code for a detailed explanation.
///
/// @return relayed DISCOVER
static isc::dhcp::Pkt4Ptr discoverWithValidVIVSO();
/// @brief returns captured DISCOVER that contains a truncated VIVSO option
///
/// See method code for a detailed explanation.
///
/// @return relayed DISCOVER
static isc::dhcp::Pkt4Ptr discoverWithTruncatedVIVSO();
/// @brief returns captured DISCOVER from Genexis hardware.
///
/// This device in uncommon, because it doesn't send VIVSO in Discover, but
/// expects one in Offer.
/// @return DISCOVER.
static isc::dhcp::Pkt4Ptr discoverGenexis();
// see pkt_captures6.cc for descriptions
// The descriptions are too large and too closely related to the
// code, so it is kept in .cc rather than traditionally in .h
static isc::dhcp::Pkt6Ptr captureSimpleSolicit();
static isc::dhcp::Pkt6Ptr captureRelayedSolicit();
static isc::dhcp::Pkt6Ptr captureDocsisRelayedSolicit();
static isc::dhcp::Pkt6Ptr captureeRouterRelayedSolicit();
static isc::dhcp::Pkt6Ptr captureCableLabsShortVendorClass();
static isc::dhcp::Pkt6Ptr captureRelayed2xRSOO();
static isc::dhcp::Pkt6Ptr captureSolicitWithVIVSO();
static isc::dhcp::Pkt6Ptr captureSolicitWithTruncatedVIVSO();
protected:
/// @brief Auxiliary method that sets Pkt6 fields
///
/// Used to reconstruct captured packets. Sets UDP ports, interface names,
/// and other fields to some believable values.
/// @param pkt packet that will have its fields set
static void captureSetDefaultFields(const isc::dhcp::Pkt6Ptr& pkt);
/// @brief generates a DHCPv4 packet based on provided hex string
///
/// @return created packet
static isc::dhcp::Pkt4Ptr packetFromCapture(const std::string& hex_string);
/// @brief sets default fields in a captured packet
///
/// Sets UDP ports, addresses and interface.
///
/// @param pkt packet to have default fields set
static void captureSetDefaultFields(const isc::dhcp::Pkt4Ptr& pkt);
};
}; // end of namespace isc::dhcp::test
}; // end of namespace isc::dhcp
}; // end of namespace isc
#endif
|