Eric Newberry | a98bf93 | 2015-09-21 00:58:47 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
Eric Newberry | 41aba10 | 2017-11-01 16:42:13 -0700 | [diff] [blame] | 2 | /* |
Davide Pesavento | 264af77 | 2021-02-09 21:48:24 -0500 | [diff] [blame^] | 3 | * Copyright (c) 2014-2021, Regents of the University of California, |
Eric Newberry | a98bf93 | 2015-09-21 00:58:47 -0700 | [diff] [blame] | 4 | * Arizona Board of Regents, |
| 5 | * Colorado State University, |
| 6 | * University Pierre & Marie Curie, Sorbonne University, |
| 7 | * Washington University in St. Louis, |
| 8 | * Beijing Institute of Technology, |
| 9 | * The University of Memphis. |
| 10 | * |
| 11 | * This file is part of NFD (Named Data Networking Forwarding Daemon). |
| 12 | * See AUTHORS.md for complete list of NFD authors and contributors. |
| 13 | * |
| 14 | * NFD is free software: you can redistribute it and/or modify it under the terms |
| 15 | * of the GNU General Public License as published by the Free Software Foundation, |
| 16 | * either version 3 of the License, or (at your option) any later version. |
| 17 | * |
| 18 | * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
| 19 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 20 | * PURPOSE. See the GNU General Public License for more details. |
| 21 | * |
| 22 | * You should have received a copy of the GNU General Public License along with |
| 23 | * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. |
| 24 | */ |
| 25 | |
| 26 | #ifndef NFD_DAEMON_FACE_GENERIC_LINK_SERVICE_HPP |
| 27 | #define NFD_DAEMON_FACE_GENERIC_LINK_SERVICE_HPP |
| 28 | |
Eric Newberry | a98bf93 | 2015-09-21 00:58:47 -0700 | [diff] [blame] | 29 | #include "link-service.hpp" |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 30 | #include "lp-fragmenter.hpp" |
| 31 | #include "lp-reassembler.hpp" |
Eric Newberry | 185ab29 | 2017-03-28 06:45:39 +0000 | [diff] [blame] | 32 | #include "lp-reliability.hpp" |
Eric Newberry | a98bf93 | 2015-09-21 00:58:47 -0700 | [diff] [blame] | 33 | |
| 34 | namespace nfd { |
| 35 | namespace face { |
| 36 | |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 37 | /** \brief counters provided by GenericLinkService |
| 38 | * \note The type name 'GenericLinkServiceCounters' is implementation detail. |
| 39 | * Use 'GenericLinkService::Counters' in public API. |
| 40 | */ |
| 41 | class GenericLinkServiceCounters : public virtual LinkService::Counters |
| 42 | { |
| 43 | public: |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 44 | /** \brief count of failed fragmentations |
| 45 | */ |
| 46 | PacketCounter nFragmentationErrors; |
| 47 | |
| 48 | /** \brief count of outgoing LpPackets dropped due to exceeding MTU limit |
| 49 | * |
| 50 | * If this counter is non-zero, the operator should enable fragmentation. |
| 51 | */ |
| 52 | PacketCounter nOutOverMtu; |
| 53 | |
| 54 | /** \brief count of invalid LpPackets dropped before reassembly |
| 55 | */ |
| 56 | PacketCounter nInLpInvalid; |
| 57 | |
| 58 | /** \brief count of network-layer packets currently being reassembled |
| 59 | */ |
| 60 | SizeCounter<LpReassembler> nReassembling; |
| 61 | |
| 62 | /** \brief count of dropped partial network-layer packets due to reassembly timeout |
| 63 | */ |
| 64 | PacketCounter nReassemblyTimeouts; |
| 65 | |
| 66 | /** \brief count of invalid reassembled network-layer packets dropped |
| 67 | */ |
| 68 | PacketCounter nInNetInvalid; |
Eric Newberry | 185ab29 | 2017-03-28 06:45:39 +0000 | [diff] [blame] | 69 | |
| 70 | /** \brief count of network-layer packets that did not require retransmission of a fragment |
| 71 | */ |
| 72 | PacketCounter nAcknowledged; |
| 73 | |
| 74 | /** \brief count of network-layer packets that had at least one fragment retransmitted, but were |
| 75 | * eventually received in full |
| 76 | */ |
| 77 | PacketCounter nRetransmitted; |
| 78 | |
| 79 | /** \brief count of network-layer packets dropped because a fragment reached the maximum number |
| 80 | * of retransmissions |
| 81 | */ |
| 82 | PacketCounter nRetxExhausted; |
Eric Newberry | b49313d | 2017-12-24 20:22:27 -0700 | [diff] [blame] | 83 | |
Eric Newberry | 32f7eac | 2020-02-07 14:40:17 -0800 | [diff] [blame] | 84 | /** \brief count of LpPackets dropped due to duplicate Sequence numbers |
| 85 | */ |
| 86 | PacketCounter nDuplicateSequence; |
| 87 | |
Eric Newberry | b49313d | 2017-12-24 20:22:27 -0700 | [diff] [blame] | 88 | /** \brief count of outgoing LpPackets that were marked with congestion marks |
| 89 | */ |
| 90 | PacketCounter nCongestionMarked; |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 91 | }; |
| 92 | |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 93 | /** \brief GenericLinkService is a LinkService that implements the NDNLPv2 protocol |
Eric Newberry | 185ab29 | 2017-03-28 06:45:39 +0000 | [diff] [blame] | 94 | * \sa https://redmine.named-data.net/projects/nfd/wiki/NDNLPv2 |
Eric Newberry | a98bf93 | 2015-09-21 00:58:47 -0700 | [diff] [blame] | 95 | */ |
Davide Pesavento | 264af77 | 2021-02-09 21:48:24 -0500 | [diff] [blame^] | 96 | class GenericLinkService NFD_FINAL_UNLESS_WITH_TESTS : public LinkService |
| 97 | , protected virtual GenericLinkServiceCounters |
Eric Newberry | a98bf93 | 2015-09-21 00:58:47 -0700 | [diff] [blame] | 98 | { |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 99 | public: |
| 100 | /** \brief Options that control the behavior of GenericLinkService |
| 101 | */ |
| 102 | class Options |
| 103 | { |
| 104 | public: |
Davide Pesavento | e4b2238 | 2018-06-10 14:37:24 -0400 | [diff] [blame] | 105 | Options() noexcept |
| 106 | { |
| 107 | } |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 108 | |
| 109 | public: |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 110 | /** \brief enables encoding of IncomingFaceId, and decoding of NextHopFaceId and CachePolicy |
| 111 | */ |
Davide Pesavento | e4b2238 | 2018-06-10 14:37:24 -0400 | [diff] [blame] | 112 | bool allowLocalFields = false; |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 113 | |
| 114 | /** \brief enables fragmentation |
| 115 | */ |
Davide Pesavento | e4b2238 | 2018-06-10 14:37:24 -0400 | [diff] [blame] | 116 | bool allowFragmentation = false; |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 117 | |
| 118 | /** \brief options for fragmentation |
| 119 | */ |
| 120 | LpFragmenter::Options fragmenterOptions; |
| 121 | |
| 122 | /** \brief enables reassembly |
| 123 | */ |
Davide Pesavento | e4b2238 | 2018-06-10 14:37:24 -0400 | [diff] [blame] | 124 | bool allowReassembly = false; |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 125 | |
| 126 | /** \brief options for reassembly |
| 127 | */ |
| 128 | LpReassembler::Options reassemblerOptions; |
Eric Newberry | 185ab29 | 2017-03-28 06:45:39 +0000 | [diff] [blame] | 129 | |
| 130 | /** \brief options for reliability |
| 131 | */ |
| 132 | LpReliability::Options reliabilityOptions; |
Eric Newberry | b49313d | 2017-12-24 20:22:27 -0700 | [diff] [blame] | 133 | |
| 134 | /** \brief enables send queue congestion detection and marking |
| 135 | */ |
Davide Pesavento | e4b2238 | 2018-06-10 14:37:24 -0400 | [diff] [blame] | 136 | bool allowCongestionMarking = false; |
Eric Newberry | b49313d | 2017-12-24 20:22:27 -0700 | [diff] [blame] | 137 | |
| 138 | /** \brief starting value for congestion marking interval |
Davide Pesavento | e4b2238 | 2018-06-10 14:37:24 -0400 | [diff] [blame] | 139 | * |
Klaus Schneider | 380668b | 2019-10-02 01:21:13 -0700 | [diff] [blame] | 140 | * Packets are marked if the queue size stays above THRESHOLD for at least one INTERVAL. |
| 141 | * |
Davide Pesavento | e4b2238 | 2018-06-10 14:37:24 -0400 | [diff] [blame] | 142 | * The default value (100 ms) is taken from RFC 8289 (CoDel). |
Eric Newberry | b49313d | 2017-12-24 20:22:27 -0700 | [diff] [blame] | 143 | */ |
Davide Pesavento | e4b2238 | 2018-06-10 14:37:24 -0400 | [diff] [blame] | 144 | time::nanoseconds baseCongestionMarkingInterval = 100_ms; |
Eric Newberry | b49313d | 2017-12-24 20:22:27 -0700 | [diff] [blame] | 145 | |
| 146 | /** \brief default congestion threshold in bytes |
Davide Pesavento | e4b2238 | 2018-06-10 14:37:24 -0400 | [diff] [blame] | 147 | * |
Klaus Schneider | 380668b | 2019-10-02 01:21:13 -0700 | [diff] [blame] | 148 | * Packets are marked if the queue size stays above THRESHOLD for at least one INTERVAL. |
| 149 | * |
Davide Pesavento | e4b2238 | 2018-06-10 14:37:24 -0400 | [diff] [blame] | 150 | * The default value (64 KiB) works well for a queue capacity of 200 KiB. |
Eric Newberry | b49313d | 2017-12-24 20:22:27 -0700 | [diff] [blame] | 151 | */ |
Davide Pesavento | e4b2238 | 2018-06-10 14:37:24 -0400 | [diff] [blame] | 152 | size_t defaultCongestionThreshold = 65536; |
Teng Liang | fdcbb4d | 2018-01-27 16:01:35 -0700 | [diff] [blame] | 153 | |
| 154 | /** \brief enables self-learning forwarding support |
| 155 | */ |
Teng Liang | 39465c2 | 2018-11-12 19:43:04 -0700 | [diff] [blame] | 156 | bool allowSelfLearning = true; |
Eric Newberry | cb6551e | 2020-03-02 14:12:16 -0800 | [diff] [blame] | 157 | |
| 158 | /** \brief overrides MTU provided by Transport |
| 159 | * |
| 160 | * This MTU value will be used instead of the MTU provided by the transport if it is less than |
| 161 | * the transport MTU. However, it will not be utilized when the transport MTU is unlimited. |
| 162 | * |
| 163 | * Acceptable values for the override MTU are values >= MIN_MTU, which can be validated before |
| 164 | * being set with canOverrideMtuTo(). |
| 165 | */ |
| 166 | ssize_t overrideMtu = std::numeric_limits<ssize_t>::max(); |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 167 | }; |
| 168 | |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 169 | /** \brief counters provided by GenericLinkService |
| 170 | */ |
Junxiao Shi | fab9e0d | 2017-02-02 06:04:59 +0000 | [diff] [blame] | 171 | using Counters = GenericLinkServiceCounters; |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 172 | |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 173 | explicit |
Davide Pesavento | e4b2238 | 2018-06-10 14:37:24 -0400 | [diff] [blame] | 174 | GenericLinkService(const Options& options = {}); |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 175 | |
| 176 | /** \brief get Options used by GenericLinkService |
| 177 | */ |
| 178 | const Options& |
| 179 | getOptions() const; |
| 180 | |
| 181 | /** \brief sets Options used by GenericLinkService |
| 182 | */ |
| 183 | void |
| 184 | setOptions(const Options& options); |
| 185 | |
Junxiao Shi | fab9e0d | 2017-02-02 06:04:59 +0000 | [diff] [blame] | 186 | const Counters& |
Davide Pesavento | 264af77 | 2021-02-09 21:48:24 -0500 | [diff] [blame^] | 187 | getCounters() const NFD_OVERRIDE_WITH_TESTS_ELSE_FINAL; |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 188 | |
Eric Newberry | cb6551e | 2020-03-02 14:12:16 -0800 | [diff] [blame] | 189 | ssize_t |
Davide Pesavento | 264af77 | 2021-02-09 21:48:24 -0500 | [diff] [blame^] | 190 | getEffectiveMtu() const NFD_OVERRIDE_WITH_TESTS_ELSE_FINAL; |
Eric Newberry | cb6551e | 2020-03-02 14:12:16 -0800 | [diff] [blame] | 191 | |
| 192 | /** \brief Whether MTU can be overridden to the specified value |
| 193 | * |
| 194 | * If the transport MTU is unlimited, then this will always return false. |
| 195 | */ |
| 196 | bool |
| 197 | canOverrideMtuTo(ssize_t mtu) const; |
| 198 | |
Davide Pesavento | 264af77 | 2021-02-09 21:48:24 -0500 | [diff] [blame^] | 199 | NFD_PROTECTED_WITH_TESTS_ELSE_PRIVATE: // send path |
Eric Newberry | 185ab29 | 2017-03-28 06:45:39 +0000 | [diff] [blame] | 200 | /** \brief request an IDLE packet to transmit pending service fields |
| 201 | */ |
| 202 | void |
Teng Liang | f3bc3ae | 2020-06-08 10:19:25 -0700 | [diff] [blame] | 203 | requestIdlePacket(); |
Eric Newberry | 185ab29 | 2017-03-28 06:45:39 +0000 | [diff] [blame] | 204 | |
Teng Liang | f3bc3ae | 2020-06-08 10:19:25 -0700 | [diff] [blame] | 205 | /** \brief send an LpPacket |
Eric Newberry | 185ab29 | 2017-03-28 06:45:39 +0000 | [diff] [blame] | 206 | */ |
| 207 | void |
Teng Liang | f3bc3ae | 2020-06-08 10:19:25 -0700 | [diff] [blame] | 208 | sendLpPacket(lp::Packet&& pkt); |
Eric Newberry | 185ab29 | 2017-03-28 06:45:39 +0000 | [diff] [blame] | 209 | |
Eric Newberry | a98bf93 | 2015-09-21 00:58:47 -0700 | [diff] [blame] | 210 | void |
Davide Pesavento | 264af77 | 2021-02-09 21:48:24 -0500 | [diff] [blame^] | 211 | doSendInterest(const Interest& interest) NFD_OVERRIDE_WITH_TESTS_ELSE_FINAL; |
Eric Newberry | a98bf93 | 2015-09-21 00:58:47 -0700 | [diff] [blame] | 212 | |
Eric Newberry | a98bf93 | 2015-09-21 00:58:47 -0700 | [diff] [blame] | 213 | void |
Davide Pesavento | 264af77 | 2021-02-09 21:48:24 -0500 | [diff] [blame^] | 214 | doSendData(const Data& data) NFD_OVERRIDE_WITH_TESTS_ELSE_FINAL; |
Eric Newberry | a98bf93 | 2015-09-21 00:58:47 -0700 | [diff] [blame] | 215 | |
Eric Newberry | a98bf93 | 2015-09-21 00:58:47 -0700 | [diff] [blame] | 216 | void |
Davide Pesavento | 264af77 | 2021-02-09 21:48:24 -0500 | [diff] [blame^] | 217 | doSendNack(const ndn::lp::Nack& nack) NFD_OVERRIDE_WITH_TESTS_ELSE_FINAL; |
Eric Newberry | a98bf93 | 2015-09-21 00:58:47 -0700 | [diff] [blame] | 218 | |
Eric Newberry | 32f7eac | 2020-02-07 14:40:17 -0800 | [diff] [blame] | 219 | /** \brief assign consecutive sequence numbers to LpPackets |
| 220 | */ |
| 221 | void |
| 222 | assignSequences(std::vector<lp::Packet>& pkts); |
| 223 | |
Eric Newberry | 185ab29 | 2017-03-28 06:45:39 +0000 | [diff] [blame] | 224 | private: // send path |
Eric Newberry | ee400b5 | 2016-11-24 14:12:48 +0000 | [diff] [blame] | 225 | /** \brief encode link protocol fields from tags onto an outgoing LpPacket |
| 226 | * \param netPkt network-layer packet to extract tags from |
| 227 | * \param lpPacket LpPacket to add link protocol fields to |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 228 | */ |
Eric Newberry | ee400b5 | 2016-11-24 14:12:48 +0000 | [diff] [blame] | 229 | void |
Eric Newberry | 41aba10 | 2017-11-01 16:42:13 -0700 | [diff] [blame] | 230 | encodeLpFields(const ndn::PacketBase& netPkt, lp::Packet& lpPacket); |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 231 | |
Junxiao Shi | 0de23a2 | 2015-12-03 20:07:02 +0000 | [diff] [blame] | 232 | /** \brief send a complete network layer packet |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 233 | * \param pkt LpPacket containing a complete network layer packet |
Eric Newberry | 41aba10 | 2017-11-01 16:42:13 -0700 | [diff] [blame] | 234 | * \param isInterest whether the network layer packet is an Interest |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 235 | */ |
| 236 | void |
Teng Liang | f3bc3ae | 2020-06-08 10:19:25 -0700 | [diff] [blame] | 237 | sendNetPacket(lp::Packet&& pkt, bool isInterest); |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 238 | |
Eric Newberry | b49313d | 2017-12-24 20:22:27 -0700 | [diff] [blame] | 239 | /** \brief if the send queue is found to be congested, add a congestion mark to the packet |
| 240 | * according to CoDel |
| 241 | * \sa https://tools.ietf.org/html/rfc8289 |
| 242 | */ |
| 243 | void |
| 244 | checkCongestionLevel(lp::Packet& pkt); |
| 245 | |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 246 | private: // receive path |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 247 | void |
Davide Pesavento | 264af77 | 2021-02-09 21:48:24 -0500 | [diff] [blame^] | 248 | doReceivePacket(const Block& packet, const EndpointId& endpoint) NFD_OVERRIDE_WITH_TESTS_ELSE_FINAL; |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 249 | |
| 250 | /** \brief decode incoming network-layer packet |
| 251 | * \param netPkt reassembled network-layer packet |
| 252 | * \param firstPkt LpPacket of first fragment |
ashiqopu | 075bb7d | 2019-03-10 01:38:21 +0000 | [diff] [blame] | 253 | * \param endpointId endpoint of peer who sent the packet |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 254 | * |
| 255 | * If decoding is successful, a receive signal is emitted; |
| 256 | * otherwise, a warning is logged. |
| 257 | */ |
| 258 | void |
ashiqopu | 075bb7d | 2019-03-10 01:38:21 +0000 | [diff] [blame] | 259 | decodeNetPacket(const Block& netPkt, const lp::Packet& firstPkt, const EndpointId& endpointId); |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 260 | |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 261 | /** \brief decode incoming Interest |
| 262 | * \param netPkt reassembled network-layer packet; TLV-TYPE must be Interest |
| 263 | * \param firstPkt LpPacket of first fragment; must not have Nack field |
ashiqopu | 075bb7d | 2019-03-10 01:38:21 +0000 | [diff] [blame] | 264 | * \param endpointId endpoint of peer who sent the Interest |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 265 | * |
| 266 | * If decoding is successful, receiveInterest signal is emitted; |
| 267 | * otherwise, a warning is logged. |
| 268 | * |
| 269 | * \throw tlv::Error parse error in an LpHeader field |
| 270 | */ |
| 271 | void |
ashiqopu | 075bb7d | 2019-03-10 01:38:21 +0000 | [diff] [blame] | 272 | decodeInterest(const Block& netPkt, const lp::Packet& firstPkt, const EndpointId& endpointId); |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 273 | |
| 274 | /** \brief decode incoming Interest |
| 275 | * \param netPkt reassembled network-layer packet; TLV-TYPE must be Data |
| 276 | * \param firstPkt LpPacket of first fragment |
ashiqopu | 075bb7d | 2019-03-10 01:38:21 +0000 | [diff] [blame] | 277 | * \param endpointId endpoint of peer who sent the Data |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 278 | * |
| 279 | * If decoding is successful, receiveData signal is emitted; |
| 280 | * otherwise, a warning is logged. |
| 281 | * |
| 282 | * \throw tlv::Error parse error in an LpHeader field |
| 283 | */ |
| 284 | void |
ashiqopu | 075bb7d | 2019-03-10 01:38:21 +0000 | [diff] [blame] | 285 | decodeData(const Block& netPkt, const lp::Packet& firstPkt, const EndpointId& endpointId); |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 286 | |
| 287 | /** \brief decode incoming Interest |
| 288 | * \param netPkt reassembled network-layer packet; TLV-TYPE must be Interest |
| 289 | * \param firstPkt LpPacket of first fragment; must have Nack field |
ashiqopu | 075bb7d | 2019-03-10 01:38:21 +0000 | [diff] [blame] | 290 | * \param endpointId endpoint of peer who sent the Nack |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 291 | * |
| 292 | * If decoding is successful, receiveNack signal is emitted; |
| 293 | * otherwise, a warning is logged. |
| 294 | * |
| 295 | * \throw tlv::Error parse error in an LpHeader field |
| 296 | */ |
| 297 | void |
ashiqopu | 075bb7d | 2019-03-10 01:38:21 +0000 | [diff] [blame] | 298 | decodeNack(const Block& netPkt, const lp::Packet& firstPkt, const EndpointId& endpointId); |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 299 | |
Davide Pesavento | 264af77 | 2021-02-09 21:48:24 -0500 | [diff] [blame^] | 300 | NFD_PROTECTED_WITH_TESTS_ELSE_PRIVATE: |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 301 | Options m_options; |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 302 | LpFragmenter m_fragmenter; |
| 303 | LpReassembler m_reassembler; |
Eric Newberry | 185ab29 | 2017-03-28 06:45:39 +0000 | [diff] [blame] | 304 | LpReliability m_reliability; |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 305 | lp::Sequence m_lastSeqNo; |
Eric Newberry | 185ab29 | 2017-03-28 06:45:39 +0000 | [diff] [blame] | 306 | |
Davide Pesavento | 264af77 | 2021-02-09 21:48:24 -0500 | [diff] [blame^] | 307 | NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE: |
Eric Newberry | b49313d | 2017-12-24 20:22:27 -0700 | [diff] [blame] | 308 | /// Time to mark next packet due to send queue congestion |
| 309 | time::steady_clock::TimePoint m_nextMarkTime; |
Eric Newberry | b49313d | 2017-12-24 20:22:27 -0700 | [diff] [blame] | 310 | /// number of marked packets in the current incident of congestion |
| 311 | size_t m_nMarkedSinceInMarkingState; |
| 312 | |
Eric Newberry | 185ab29 | 2017-03-28 06:45:39 +0000 | [diff] [blame] | 313 | friend class LpReliability; |
Eric Newberry | a98bf93 | 2015-09-21 00:58:47 -0700 | [diff] [blame] | 314 | }; |
| 315 | |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 316 | inline const GenericLinkService::Options& |
| 317 | GenericLinkService::getOptions() const |
| 318 | { |
| 319 | return m_options; |
| 320 | } |
| 321 | |
Eric Newberry | 4c3e6b8 | 2015-11-10 16:48:42 -0700 | [diff] [blame] | 322 | inline const GenericLinkService::Counters& |
| 323 | GenericLinkService::getCounters() const |
| 324 | { |
| 325 | return *this; |
| 326 | } |
| 327 | |
Eric Newberry | a98bf93 | 2015-09-21 00:58:47 -0700 | [diff] [blame] | 328 | } // namespace face |
| 329 | } // namespace nfd |
| 330 | |
Eric Newberry | 86d3187 | 2015-09-23 16:24:59 -0700 | [diff] [blame] | 331 | #endif // NFD_DAEMON_FACE_GENERIC_LINK_SERVICE_HPP |