Kea  1.5.0
perf_pkt6.cc
Go to the documentation of this file.
1 // Copyright (C) 2011-2015 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 <iostream>
10 #include <exceptions/exceptions.h>
11 #include <dhcp/libdhcp++.h>
12 #include <dhcp/dhcp6.h>
13 
14 #include "perf_pkt6.h"
15 #include "pkt_transform.h"
16 
17 using namespace std;
18 using namespace isc;
19 using namespace dhcp;
20 
21 namespace isc {
22 namespace perfdhcp {
23 
24 PerfPkt6::PerfPkt6(const uint8_t* buf,
25  size_t len,
26  size_t transid_offset,
27  uint32_t transid) :
28  Pkt6(buf, len, Pkt6::UDP),
29  transid_offset_(transid_offset) {
30  setTransid(transid);
31 }
32 
33 bool
36  data_,
37  options_,
39  getTransid(),
40  buffer_out_));
41 }
42 
43 bool
45  uint32_t transid = getTransid();
47  data_,
48  options_,
50  transid);
51  if (res) {
52  setTransid(transid);
53  }
54  return (res);
55 }
56 
57 void
58 PerfPkt6::writeAt(size_t dest_pos,
59  std::vector<uint8_t>::iterator first,
60  std::vector<uint8_t>::iterator last) {
61  return (PktTransform::writeAt(data_, dest_pos, first, last));
62 }
63 
64 
65 } // namespace perfdhcp
66 } // namespace isc
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.
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
void setTransid(uint32_t transid)
Sets transaction-id value.
Definition: pkt.h:261
Represents a DHCPv6 packet.
Definition: pkt6.h:44
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:58
bool rawUnpack()
Handles limited binary packet parsing for packets with custom offsets of options and transaction id.
Definition: perf_pkt6.cc:44
isc::util::OutputBuffer buffer_out_
Output buffer (used during message transmission)
Definition: pkt.h:756
uint32_t getTransid() const
Returns value of transaction-id field.
Definition: pkt.h:266
isc::dhcp::OptionCollection options_
Collection of options present in this message.
Definition: pkt.h:606