NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
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
LpFragmenter::Options fragmenterOptions
options for fragmentation
GenericLinkService is a LinkService that implements the NDNLPv2 protocol.
the upper part of a Face
bool allowLocalFields
enables encoding of IncomingFaceId, and decoding of NextHopFaceId and CachePolicy ...
GenericLinkServiceCounters Counters
counters provided by GenericLinkService
Base class to store tag information (e.g., inside Interest and Data packets)
Definition: tag-host.hpp:34
stores a packet along with the remote endpoint
Definition: transport.hpp:113
PacketCounter nReassemblyTimeouts
count of dropped partial network-layer packets due to reassembly timeout
virtual const Counters & getCounters() const override
Class representing a wire element of NDN-TLV packet format.
Definition: block.hpp:43
represents an Interest packet
Definition: interest.hpp:42
represents a counter of number of packets
Definition: counter.hpp:77
Options that control the behavior of LpFragmenter.
GenericLinkServiceCounters(const LpReassembler &reassembler)
uint64_t Sequence
represents a sequence number
Definition: sequence.hpp:35
represents a Network Nack
Definition: nack.hpp:40
PacketCounter nOutOverMtu
count of outgoing LpPackets dropped due to exceeding MTU limit
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-common.hpp:40
counters provided by LinkService
reassembles fragmented network-layer packets
SizeCounter< LpReassembler > nReassembling
count of network-layer packets currently being reassembled
Options that control the behavior of LpReassembler.
void setOptions(const Options &options)
sets Options used by GenericLinkService
provides a counter that observes the size of a table
Definition: counter.hpp:112
counters provided by GenericLinkService
Options that control the behavior of GenericLinkService.
PacketCounter nInNetInvalid
count of invalid reassembled network-layer packets dropped
const Options & getOptions() const
get Options used by GenericLinkService
LpReassembler::Options reassemblerOptions
options for reassembly
represents a Data packet
Definition: data.hpp:37
fragments network-layer packets into NDNLPv2 link-layer packets
PacketCounter nInLpInvalid
count of invalid LpPackets dropped before reassembly
PacketCounter nFragmentationErrors
count of failed fragmentations
bool allowFragmentation
enables fragmentation