Kea  1.5.0
perf_pkt6.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2015,2017 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 <time.h>
11 #include <boost/shared_ptr.hpp>
12 #include <dhcp/pkt6.h>
13 
14 #include "localized_option.h"
15 #include "pkt_transform.h"
16 
17 namespace isc {
18 namespace perfdhcp {
19 
39 
40 class PerfPkt6 : public dhcp::Pkt6 {
41 public:
42 
44  typedef boost::shared_ptr<LocalizedOption> LocalizedOptionPtr;
45 
62  PerfPkt6(const uint8_t* buf,
63  size_t len,
64  size_t transid_offset = 1,
65  uint32_t transid = 0);
66 
70  size_t getTransidOffset() const { return transid_offset_; };
71 
83  bool rawPack();
84 
96  bool rawUnpack();
97 
105  void writeAt(size_t dest_pos,
106  std::vector<uint8_t>::iterator first,
107  std::vector<uint8_t>::iterator last);
108 
116  template<typename T>
117  void writeValueAt(size_t dest_pos, T val) {
118  PktTransform::writeValueAt<T>(data_, dest_pos, val);
119  }
120 
121 private:
122  size_t transid_offset_;
123 
124 };
125 
126 typedef boost::shared_ptr<PerfPkt6> PerfPkt6Ptr;
127 
128 } // namespace perfdhcp
129 } // namespace isc
130 
131 #endif // PERF_PKT6_H
PerfPkt6 (DHCPv6 packet)
Definition: perf_pkt6.h:40
boost::shared_ptr< PerfPkt6 > PerfPkt6Ptr
Definition: perf_pkt6.h:126
OptionBuffer data_
Unparsed data (in received packets).
Definition: pkt.h:312
size_t getTransidOffset() const
Returns transaction id offset in packet buffer.
Definition: perf_pkt6.h:70
bool rawPack()
Prepares on-wire format from raw buffer.
Definition: perf_pkt6.cc:34
Represents a DHCPv6 packet.
Definition: pkt6.h:44
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:24
virtual size_t len()
Returns length of the packet.
Definition: pkt6.cc:63
Defines the logger used by the top-level component of kea-dhcp-ddns.
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:58
bool rawUnpack()
Handles limited binary packet parsing for packets with custom offsets of options and transaction id.
Definition: perf_pkt6.cc:44
boost::shared_ptr< LocalizedOption > LocalizedOptionPtr
Localized option pointer type.
Definition: perf_pkt6.h:44
void writeValueAt(size_t dest_pos, T val)
Replace contents of buffer with value.
Definition: perf_pkt6.h:117