Kea: perf_pkt6.h Source File

| Kea 3.0.3-git

perf_pkt6.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_PKT6_H
8#define PERF_PKT6_H
9
10#include <perfdhcp/localized_option.h>
11#include <perfdhcp/pkt_transform.h>
12
13#include <dhcp/pkt6.h>
14
15#include <time.h>
16#include <boost/shared_ptr.hpp>
17
18namespace isc {
19namespace perfdhcp {
20
40
41 class PerfPkt6 : public dhcp::Pkt6 {
42public:
43
45 typedef boost::shared_ptr<LocalizedOption> LocalizedOptionPtr;
46
63 PerfPkt6(const uint8_t* buf,
64 size_t len,
65 size_t transid_offset = 1,
66 uint32_t transid = 0);
67
71 size_t getTransidOffset() const { return transid_offset_; };
72
84 bool rawPack();
85
97 bool rawUnpack();
98
106 void writeAt(size_t dest_pos,
107 std::vector<uint8_t>::iterator first,
108 std::vector<uint8_t>::iterator last);
109
117 template<typename T>
118 void writeValueAt(size_t dest_pos, T val) {
119 PktTransform::writeValueAt<T>(data_, dest_pos, val);
120 }
121
122private:
123 size_t transid_offset_;
124
125};
126
127 typedef boost::shared_ptr<PerfPkt6> PerfPkt6Ptr;
128
129} // namespace perfdhcp
130} // namespace isc
131
132#endif // PERF_PKT6_H
isc::dhcp::Pkt6
Represents a DHCPv6 packet.
Definition pkt6.h:44
isc::dhcp::Pkt6::len
virtual size_t len()
Returns length of the packet.
Definition pkt6.cc:63
isc::dhcp::Pkt::data_
OptionBuffer data_
Unparsed data (in received packets).
Definition pkt.h:414
isc::perfdhcp::PerfPkt6::writeValueAt
void writeValueAt(size_t dest_pos, T val)
Replace contents of buffer with value.
Definition perf_pkt6.h:118
isc::perfdhcp::PerfPkt6::rawUnpack
bool rawUnpack()
Handles limited binary packet parsing for packets with custom offsets of options and transaction id.
Definition perf_pkt6.cc:45
isc::perfdhcp::PerfPkt6::LocalizedOptionPtr
boost::shared_ptr< LocalizedOption > LocalizedOptionPtr
Localized option pointer type.
Definition perf_pkt6.h:45
isc::perfdhcp::PerfPkt6::rawPack
bool rawPack()
Prepares on-wire format from raw buffer.
Definition perf_pkt6.cc:35
isc::perfdhcp::PerfPkt6::PerfPkt6
PerfPkt6(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_pkt6.cc:25
isc::perfdhcp::PerfPkt6::getTransidOffset
size_t getTransidOffset() const
Returns transaction id offset in packet buffer.
Definition perf_pkt6.h:71
isc::perfdhcp::PerfPkt6::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_pkt6.cc:59
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::PerfPkt6Ptr
boost::shared_ptr< PerfPkt6 > PerfPkt6Ptr
Definition perf_pkt6.h:127
isc
Defines the logger used by the top-level component of kea-lfc.
Definition agent_parser.cc:148
pkt6.h
pkt_transform.h