lp-packet.hpp
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
23 #ifndef NDN_LP_PACKET_HPP
24 #define NDN_LP_PACKET_HPP
25 
26 #include <vector>
27 #include <ndn-cpp/lite/lp/lp-packet-lite.hpp>
28 #include <ndn-cpp/lp-packet-header-field.hpp>
29 #include <ndn-cpp/util/blob.hpp>
30 
31 namespace ndn {
32 
39 class LpPacket {
40 public:
45  const Blob&
46  getFragmentWireEncoding() const { return fragmentWireEncoding_; }
47 
52  size_t
53  countHeaderFields() const { return headerFields_.size(); }
54 
61  ptr_lib::shared_ptr<LpPacketHeaderField>&
62  getHeaderField(int index) { return headerFields_[index]; }
63 
67  void
69  {
70  headerFields_.clear();
71  fragmentWireEncoding_ = Blob();
72  }
73 
78  void
79  set(const LpPacketLite& lpPacketLite);
80 
81 private:
82  std::vector<ptr_lib::shared_ptr<LpPacketHeaderField> > headerFields_;
83  Blob fragmentWireEncoding_;
84 };
85 
86 }
87 
88 #endif
size_t countHeaderFields() const
Get the number of header fields.
Definition: lp-packet.hpp:53
Copyright (C) 2013-2016 Regents of the University of California.
Definition: common.hpp:35
Definition: lp-packet-lite.hpp:83
const Blob & getFragmentWireEncoding() const
Get the fragment wire encoding.
Definition: lp-packet.hpp:46
An LpPacket represents an NDNLPv2 packet including header fields an an optional fragment.
Definition: lp-packet.hpp:39
A Blob holds a pointer to an immutable byte array implemented as const std::vector.
Definition: blob.hpp:42
void clear()
Remove all header fields and set the fragment to an isNull Blob.
Definition: lp-packet.hpp:68
void set(const LpPacketLite &lpPacketLite)
Clear this LpPacket, and set the values by copying from lpPacketLite.
Definition: lp-packet.cpp:34
ptr_lib::shared_ptr< LpPacketHeaderField > & getHeaderField(int index)
Get the header field at the given index.
Definition: lp-packet.hpp:62