Kea  1.9.9-git
perf_pkt6.cc
Go to the documentation of this file.
1 // Copyright (C) 2011-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 #include <config.h>
8 
9 #include <perfdhcp/perf_pkt6.h>
10 #include <perfdhcp/pkt_transform.h>
11 
12 #include <exceptions/exceptions.h>
13 #include <dhcp/libdhcp++.h>
14 #include <dhcp/dhcp6.h>
15 
16 #include <iostream>
17 
18 using namespace std;
19 using namespace isc;
20 using namespace dhcp;
21 
22 namespace isc {
23 namespace perfdhcp {
24 
25 PerfPkt6::PerfPkt6(const uint8_t* buf,
26  size_t len,
27  size_t transid_offset,
28  uint32_t transid) :
29  Pkt6(buf, len, Pkt6::UDP),
30  transid_offset_(transid_offset) {
31  setTransid(transid);
32 }
33 
34 bool
37  data_,
38  options_,
40  getTransid(),
41  buffer_out_));
42 }
43 
44 bool
46  uint32_t transid = getTransid();
48  data_,
49  options_,
51  transid);
52  if (res) {
53  setTransid(transid);
54  }
55  return (res);
56 }
57 
58 void
59 PerfPkt6::writeAt(size_t dest_pos,
60  std::vector<uint8_t>::iterator first,
61  std::vector<uint8_t>::iterator last) {
62  return (PktTransform::writeAt(data_, dest_pos, first, last));
63 }
64 
65 
66 } // namespace perfdhcp
67 } // namespace isc
size_t getTransidOffset() const
Returns transaction id offset in packet buffer.
Definition: perf_pkt6.h:71
OptionBuffer data_
Unparsed data (in received packets).
Definition: pkt.h:312
static void writeAt(dhcp::OptionBuffer &in_buffer, size_t dest_pos, std::vector< uint8_t >::iterator first, std::vector< uint8_t >::iterator last)
Replace contents of buffer with vector.
bool rawPack()
Prepares on-wire format from raw buffer.
Definition: perf_pkt6.cc:35
void setTransid(uint32_t transid)
Sets transaction-id value.
Definition: pkt.h:261
Represents a DHCPv6 packet.
Definition: pkt6.h:44
STL namespace.
static bool pack(const dhcp::Option::Universe universe, const dhcp::OptionBuffer &in_buffer, const dhcp::OptionCollection &options, const size_t transid_offset, const uint32_t transid, util::OutputBuffer &out_buffer)
Prepares on-wire format from raw buffer.
static bool unpack(const dhcp::Option::Universe universe, const dhcp::OptionBuffer &in_buffer, const dhcp::OptionCollection &options, const size_t transid_offset, uint32_t &transid)
Handles selective binary packet parsing.
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:59
bool rawUnpack()
Handles limited binary packet parsing for packets with custom offsets of options and transaction id...
Definition: perf_pkt6.cc:45
uint32_t getTransid() const
Returns value of transaction-id field.
Definition: pkt.h:266
isc::util::OutputBuffer buffer_out_
Output buffer (used during message transmission)
Definition: pkt.h:764
isc::dhcp::OptionCollection options_
Collection of options present in this message.
Definition: pkt.h:614