Kea 2.7.5
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
12
13#include <dhcp/pkt6.h>
14
15#include <time.h>
16#include <boost/shared_ptr.hpp>
17
18namespace isc {
19namespace perfdhcp {
20
40
41class 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
127typedef boost::shared_ptr<PerfPkt6> PerfPkt6Ptr;
128
129} // namespace perfdhcp
130} // namespace isc
131
132#endif // PERF_PKT6_H
Represents a DHCPv6 packet.
Definition pkt6.h:44
virtual size_t len()
Returns length of the packet.
Definition pkt6.cc:63
OptionBuffer data_
Unparsed data (in received packets).
Definition pkt.h:414
PerfPkt6 (DHCPv6 packet)
Definition perf_pkt6.h:41
void writeValueAt(size_t dest_pos, T val)
Replace contents of buffer with value.
Definition perf_pkt6.h:118
bool rawUnpack()
Handles limited binary packet parsing for packets with custom offsets of options and transaction id.
Definition perf_pkt6.cc:45
boost::shared_ptr< LocalizedOption > LocalizedOptionPtr
Localized option pointer type.
Definition perf_pkt6.h:45
bool rawPack()
Prepares on-wire format from raw buffer.
Definition perf_pkt6.cc:35
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
size_t getTransidOffset() const
Returns transaction id offset in packet buffer.
Definition perf_pkt6.h:71
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
boost::shared_ptr< PerfPkt6 > PerfPkt6Ptr
Definition perf_pkt6.h:127
Defines the logger used by the top-level component of kea-lfc.