lp-fragmenter.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26 #ifndef NFD_DAEMON_FACE_LP_FRAGMENTER_HPP
27 #define NFD_DAEMON_FACE_LP_FRAGMENTER_HPP
28 
29 #include "face-log.hpp"
30 
31 #include <ndn-cxx/lp/packet.hpp>
32 
33 namespace nfd {
34 namespace face {
35 
36 class LinkService;
37 
42 {
43 public:
46  class Options
47  {
48  public:
49  Options();
50 
51  public:
54  size_t nMaxFragments;
55  };
56 
57  explicit
58  LpFragmenter(const Options& options = Options(), const LinkService* linkService = nullptr);
59 
62  void
63  setOptions(const Options& options);
64 
69  const LinkService*
70  getLinkService() const;
71 
78  std::tuple<bool, std::vector<lp::Packet>>
79  fragmentPacket(const lp::Packet& packet, size_t mtu);
80 
81 private:
82  Options m_options;
83  const LinkService* m_linkService;
84 };
85 
86 std::ostream&
87 operator<<(std::ostream& os, const FaceLogHelper<LpFragmenter>& flh);
88 
89 } // namespace face
90 } // namespace nfd
91 
92 #endif // NFD_DAEMON_FACE_LP_FRAGMENTER_HPP
size_t nMaxFragments
maximum number of fragments in a packet
void setOptions(const Options &options)
set options for fragmenter
LpFragmenter(const Options &options=Options(), const LinkService *linkService=nullptr)
const LinkService * getLinkService() const
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
Definition: algorithm.hpp:32
std::tuple< bool, std::vector< lp::Packet > > fragmentPacket(const lp::Packet &packet, size_t mtu)
fragments a network-layer packet into link-layer packets
fragments network-layer packets into NDNLPv2 link-layer packets
Options that control the behavior of LpFragmenter.