generic-link-service.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26 #ifndef NFD_DAEMON_FACE_GENERIC_LINK_SERVICE_HPP
27 #define NFD_DAEMON_FACE_GENERIC_LINK_SERVICE_HPP
28 
29 #include "core/common.hpp"
30 #include "core/logger.hpp"
31 
32 #include "link-service.hpp"
33 #include "lp-fragmenter.hpp"
34 #include "lp-reassembler.hpp"
35 
36 namespace nfd {
37 namespace face {
38 
44 {
45 public:
46  explicit
47  GenericLinkServiceCounters(const LpReassembler& reassembler);
48 
52 
58 
62 
66 
70 
74 };
75 
80  , protected virtual GenericLinkServiceCounters
81 {
82 public:
85  class Options
86  {
87  public:
88  Options();
89 
90  public:
94 
98 
102 
106 
110  };
111 
115 
116  explicit
117  GenericLinkService(const Options& options = Options());
118 
121  const Options&
122  getOptions() const;
123 
126  void
127  setOptions(const Options& options);
128 
129  virtual const Counters&
130  getCounters() const override;
131 
132 private: // send path
135  void
136  doSendInterest(const Interest& interest) override;
137 
140  void
141  doSendData(const Data& data) override;
142 
145  void
146  doSendNack(const ndn::lp::Nack& nack) override;
147 
152  void
153  encodeLpFields(const ndn::TagHost& netPkt, lp::Packet& lpPacket);
154 
158  void
159  sendNetPacket(lp::Packet&& pkt);
160 
163  void
164  assignSequence(lp::Packet& pkt);
165 
168  void
169  assignSequences(std::vector<lp::Packet>& pkts);
170 
171 private: // receive path
174  void
175  doReceivePacket(Transport::Packet&& packet) override;
176 
184  void
185  decodeNetPacket(const Block& netPkt, const lp::Packet& firstPkt);
186 
196  void
197  decodeInterest(const Block& netPkt, const lp::Packet& firstPkt);
198 
208  void
209  decodeData(const Block& netPkt, const lp::Packet& firstPkt);
210 
220  void
221  decodeNack(const Block& netPkt, const lp::Packet& firstPkt);
222 
223 private:
224  Options m_options;
225  LpFragmenter m_fragmenter;
226  LpReassembler m_reassembler;
227  lp::Sequence m_lastSeqNo;
228 };
229 
230 inline const GenericLinkService::Options&
232 {
233  return m_options;
234 }
235 
236 inline void
238 {
239  m_options = options;
240 }
241 
242 inline const GenericLinkService::Counters&
244 {
245  return *this;
246 }
247 
248 } // namespace face
249 } // namespace nfd
250 
251 #endif // NFD_DAEMON_FACE_GENERIC_LINK_SERVICE_HPP
provides a counter that observes the size of a table
Definition: counter.hpp:112
stores a packet along with the remote endpoint
Definition: transport.hpp:113
represents a counter of number of packets
Definition: counter.hpp:77
Options that control the behavior of LpReassembler.
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
fragments network-layer packets into NDNLPv2 link-layer packets
reassembles fragmented network-layer packets
Options that control the behavior of LpFragmenter.