perf_pkt4.cc 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC")
  2. //
  3. // Permission to use, copy, modify, and/or distribute this software for any
  4. // purpose with or without fee is hereby granted, provided that the above
  5. // copyright notice and this permission notice appear in all copies.
  6. //
  7. // THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
  8. // REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  9. // AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
  10. // INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  11. // LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  12. // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  13. // PERFORMANCE OF THIS SOFTWARE.
  14. #include <dhcp/libdhcp++.h>
  15. #include <dhcp/dhcp6.h>
  16. #include "perf_pkt4.h"
  17. #include "pkt_transform.h"
  18. using namespace std;
  19. using namespace isc;
  20. using namespace dhcp;
  21. namespace isc {
  22. namespace perfdhcp {
  23. PerfPkt4::PerfPkt4(const uint8_t* buf,
  24. size_t len,
  25. size_t transid_offset,
  26. uint32_t transid) :
  27. Pkt4(buf, len),
  28. transid_offset_(transid_offset) {
  29. transid_ = transid;
  30. }
  31. bool
  32. PerfPkt4::rawPack() {
  33. return (PktTransform::pack(dhcp::Option::V4,
  34. data_,
  35. options_,
  36. transid_offset_,
  37. transid_,
  38. bufferOut_));
  39. }
  40. bool
  41. PerfPkt4::rawUnpack() {
  42. return (PktTransform::unpack(dhcp::Option::V4,
  43. data_,
  44. options_,
  45. transid_offset_,
  46. transid_));
  47. }
  48. } // namespace perfdhcp
  49. } // namespace isc