Kea: perf_pkt4.h Source File

| Kea 3.2.0-git

perf_pkt4.h
Go to the documentation of this file.
1// Copyright (C) 2012-2019 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 PERF_PKT4_H
8#define PERF_PKT4_H
9
10#include <perfdhcp/localized_option.h>
11#include <perfdhcp/pkt_transform.h>
12
13#include <dhcp/pkt4.h>
14
15#include <boost/shared_ptr.hpp>
16#include <time.h>
17
18
19namespace isc {
20namespace perfdhcp {
21
41
42 class PerfPkt4 : public dhcp::Pkt4 {
43public:
44
46 typedef boost::shared_ptr<LocalizedOption> LocalizedOptionPtr;
47
64 PerfPkt4(const uint8_t* buf,
65 size_t len,
66 size_t transid_offset = 1,
67 uint32_t transid = 0);
68
72 size_t getTransidOffset() const { return transid_offset_; };
73
85 bool rawPack();
86
98 bool rawUnpack();
99
107 void writeAt(size_t dest_pos,
108 std::vector<uint8_t>::iterator first,
109 std::vector<uint8_t>::iterator last);
110
118 template<typename T>
119 void writeValueAt(size_t dest_pos, T val) {
120 PktTransform::writeValueAt<T>(data_, dest_pos, val);
121 }
122
123private:
124 size_t transid_offset_;
125
126};
127
128 typedef boost::shared_ptr<PerfPkt4> PerfPkt4Ptr;
129
130} // namespace perfdhcp
131} // namespace isc
132
133#endif // PERF_PKT4_H
isc::dhcp::Pkt4
Represents DHCPv4 packet.
Definition pkt4.h:37
isc::dhcp::Pkt4::len
size_t len()
Returns the size of the required buffer to build the packet.
Definition pkt4.cc:61
isc::dhcp::Pkt::data_
OptionBuffer data_
Unparsed data (in received packets).
Definition pkt.h:415
isc::perfdhcp::PerfPkt4::rawUnpack
bool rawUnpack()
Handles limited binary packet parsing for packets with custom offsets of options and transaction ID.
Definition perf_pkt4.cc:41
isc::perfdhcp::PerfPkt4::LocalizedOptionPtr
boost::shared_ptr< LocalizedOption > LocalizedOptionPtr
Localized option pointer type.
Definition perf_pkt4.h:46
isc::perfdhcp::PerfPkt4::rawPack
bool rawPack()
Prepares on-wire format from raw buffer.
Definition perf_pkt4.cc:31
isc::perfdhcp::PerfPkt4::writeAt
void writeAt(size_t dest_pos, std::vector< uint8_t >::iterator first, std::vector< uint8_t >::iterator last)
Replace contents of buffer with data.
Definition perf_pkt4.cc:55
isc::perfdhcp::PerfPkt4::PerfPkt4
PerfPkt4(const uint8_t *buf, size_t len, size_t transid_offset=1, uint32_t transid=0)
Constructor, used to create messages from packet template files.
Definition perf_pkt4.cc:21
isc::perfdhcp::PerfPkt4::writeValueAt
void writeValueAt(size_t dest_pos, T val)
Replace contents of buffer with value.
Definition perf_pkt4.h:119
isc::perfdhcp::PerfPkt4::getTransidOffset
size_t getTransidOffset() const
Returns transaction id offset in packet buffer.
Definition perf_pkt4.h:72
isc::perfdhcp::PktTransform::writeValueAt
static void writeValueAt(dhcp::OptionBuffer &in_buffer, size_t dest_pos, T val)
Replace contents of one vector with uint16 value.
Definition pkt_transform.h:107
localized_option.h
isc::perfdhcp
Definition abstract_scen.h:15
isc::perfdhcp::PerfPkt4Ptr
boost::shared_ptr< PerfPkt4 > PerfPkt4Ptr
Definition perf_pkt4.h:128
isc
Defines the logger used by the top-level component of kea-lfc.
Definition check_exists_add.cc:18
pkt4.h
pkt_transform.h