From f5f56e1a1c4d9e9496fcb9d81131066a964ccd23 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 13 Apr 2024 14:15:43 +0200 Subject: Adding upstream version 2.4.1. Signed-off-by: Daniel Baumann --- src/bin/perfdhcp/perf_pkt4.cc | 64 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 src/bin/perfdhcp/perf_pkt4.cc (limited to 'src/bin/perfdhcp/perf_pkt4.cc') diff --git a/src/bin/perfdhcp/perf_pkt4.cc b/src/bin/perfdhcp/perf_pkt4.cc new file mode 100644 index 0000000..742c8f3 --- /dev/null +++ b/src/bin/perfdhcp/perf_pkt4.cc @@ -0,0 +1,64 @@ +// Copyright (C) 2012-2022 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/. + +#include + +#include + +#include +#include + +using namespace std; +using namespace isc; +using namespace dhcp; + +namespace isc { +namespace perfdhcp { + +PerfPkt4::PerfPkt4(const uint8_t* buf, + size_t len, + size_t transid_offset, + uint32_t transid) : + Pkt4(buf, len), + transid_offset_(transid_offset) { + setTransid(transid); +} + +bool +PerfPkt4::rawPack() { + return (PktTransform::pack(dhcp::Option::V4, + data_, + options_, + getTransidOffset(), + getTransid(), + buffer_out_)); +} + +bool +PerfPkt4::rawUnpack() { + uint32_t transid = getTransid(); + bool res = PktTransform::unpack(dhcp::Option::V4, + data_, + options_, + getTransidOffset(), + transid); + if (res) { + setTransid(transid); + } + return (res); +} + +void +PerfPkt4::writeAt(size_t dest_pos, + std::vector::iterator first, + std::vector::iterator last) { + return (PktTransform::writeAt(data_, dest_pos, first, last)); +} + + + +} // namespace perfdhcp +} // namespace isc -- cgit v1.2.3