blob: ba04e3cff6a001b9bed6ecd3f0893c3507a81040 [file] [log] [blame]
Junxiao Shi9b0d3e92014-02-15 12:27:12 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (C) 2014 Named Data Networking Project
4 * See COPYING for copyright and distribution information.
5 */
6
7#ifndef NFD_FACE_NDNLP_SLICER_HPP
8#define NFD_FACE_NDNLP_SLICER_HPP
9
10#include "ndnlp-tlv.hpp"
11#include "ndnlp-sequence-generator.hpp"
12
13namespace nfd {
14namespace ndnlp {
15
16typedef shared_ptr<std::vector<Block> > PacketArray;
17
18/** \brief provides fragmentation feature at sender
19 */
20class Slicer : noncopyable
21{
22public:
23 explicit
24 Slicer(size_t mtu);
25
26 virtual
27 ~Slicer();
28
29 PacketArray
30 slice(const Block& block);
31
32private:
33 /// estimate the size of NDNLP header and maximum payload size per packet
34 void
35 estimateOverhead();
36
37private:
38 SequenceGenerator m_seqgen;
39
40 /// maximum packet size
41 size_t m_mtu;
42
43 /// maximum payload size
44 size_t m_maxPayload;
45};
46
47} // namespace ndnlp
48} // namespace nfd
49
50#endif // NFD_FACE_NDNLP_SLICER_HPP