NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: 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 "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 DECL_OVERRIDE;
131 
132 private: // send path
135  void
136  doSendInterest(const Interest& interest) DECL_OVERRIDE;
137 
140  void
141  doSendData(const Data& data) DECL_OVERRIDE;
142 
145  void
146  doSendNack(const ndn::lp::Nack& nack) DECL_OVERRIDE;
147 
151  static void
152  encodeLocalFields(const ndn::TagHost& netPkt, lp::Packet& lpPacket);
153 
157  void
158  sendNetPacket(lp::Packet&& pkt);
159 
162  void
163  assignSequence(lp::Packet& pkt);
164 
167  void
168  assignSequences(std::vector<lp::Packet>& pkts);
169 
170 private: // receive path
173  void
174  doReceivePacket(Transport::Packet&& packet) DECL_OVERRIDE;
175 
183  void
184  decodeNetPacket(const Block& netPkt, const lp::Packet& firstPkt);
185 
195  void
196  decodeInterest(const Block& netPkt, const lp::Packet& firstPkt);
197 
207  void
208  decodeData(const Block& netPkt, const lp::Packet& firstPkt);
209 
219  void
220  decodeNack(const Block& netPkt, const lp::Packet& firstPkt);
221 
222 private:
223  Options m_options;
224  LpFragmenter m_fragmenter;
225  LpReassembler m_reassembler;
226  lp::Sequence m_lastSeqNo;
227 };
228 
229 inline const GenericLinkService::Options&
230 GenericLinkService::getOptions() const
231 {
232  return m_options;
233 }
234 
235 inline void
237 {
238  m_options = options;
239 }
240 
241 inline const GenericLinkService::Counters&
243 {
244  return *this;
245 }
246 
247 } // namespace face
248 } // namespace nfd
249 
250 #endif // NFD_DAEMON_FACE_GENERIC_LINK_SERVICE_HPP
LpFragmenter::Options fragmenterOptions
options for fragmentation
Copyright (c) 2011-2015 Regents of the University of California.
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
PacketCounter nReassemblyTimeouts
count of dropped partial network-layer packets due to reassembly timeout
virtual const Counters & getCounters() const 1
STL namespace.
Class representing a wire element of NDN-TLV packet format.
Definition: block.hpp:43
represents an Interest packet
Definition: interest.hpp:45
represents a counter of number of packets
Definition: counter.hpp:77
Options that control the behavior of LpFragmenter.
#define DECL_OVERRIDE
expands to &#39;override&#39; if compiler supports &#39;override&#39; specifier, otherwise expands to nothing ...
Definition: common.hpp:50
GenericLinkServiceCounters(const LpReassembler &reassembler)
uint64_t Sequence
represents a sequence number
Definition: sequence.hpp:35
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
LpReassembler::Options reassemblerOptions
options for reassembly
represents a Data packet
Definition: data.hpp:39
the lower part of a Face
Definition: transport.hpp:104
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