NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
ndnlp-slicer.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26 #ifndef NFD_DAEMON_FACE_NDNLP_SLICER_HPP
27 #define NFD_DAEMON_FACE_NDNLP_SLICER_HPP
28 
29 #include "ndnlp-tlv.hpp"
31 
32 namespace nfd {
33 namespace ndnlp {
34 
35 typedef shared_ptr<std::vector<Block>> PacketArray;
36 
39 class Slicer : noncopyable
40 {
41 public:
46  explicit
47  Slicer(size_t mtu);
48 
49  virtual
50  ~Slicer();
51 
52  PacketArray
53  slice(const Block& block);
54 
55 private:
56  template<bool T>
57  size_t
58  encodeFragment(ndn::EncodingImpl<T>& blk,
59  uint64_t seq, uint16_t fragIndex, uint16_t fragCount,
60  const uint8_t* payload, size_t payloadSize);
61 
63  void
64  estimateOverhead();
65 
66 private:
67  SequenceGenerator m_seqgen;
68 
70  size_t m_mtu;
71 
73  size_t m_maxPayload;
74 };
75 
76 } // namespace ndnlp
77 } // namespace nfd
78 
79 #endif // NFD_DAEMON_FACE_NDNLP_SLICER_HPP
PacketArray slice(const Block &block)
provides fragmentation feature at sender
Class representing a wire element of NDN-TLV packet format.
Definition: block.hpp:43
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:38
shared_ptr< std::vector< Block > > PacketArray
Slicer(size_t mtu)