NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
nfd::face::LpReliability Class Reference

provides for reliable sending and receiving of link-layer packets More...

#include <lp-reliability.hpp>

Inheritance diagram for nfd::face::LpReliability:
Collaboration diagram for nfd::face::LpReliability:

Classes

class  NetPkt
 contains a network-layer packet with unacknowledged fragments More...
 
struct  Options
 

Public Types

using UnackedFrags = std::map< lp::Sequence, UnackedFrag >
 

Public Member Functions

 LpReliability (const Options &options, GenericLinkService *linkService)
 
void setOptions (const Options &options)
 set options for reliability More...
 
const GenericLinkServicegetLinkService () const
 
void handleOutgoing (std::vector< lp::Packet > &frags, lp::Packet &&pkt, bool isInterest)
 observe outgoing fragment(s) of a network packet and store for potential retransmission More...
 
bool processIncomingPacket (const lp::Packet &pkt)
 extract and parse all Acks and add Ack for contained Fragment (if any) to AckQueue More...
 
void piggyback (lp::Packet &pkt, ssize_t mtu)
 called by GenericLinkService to attach Acks onto an outgoing LpPacket More...
 
void startIdleAckTimer ()
 start the idle Ack timer More...
 
std::vector< lp::SequencefindLostLpPackets (UnackedFrags::iterator ackIt)
 find and mark as lost fragments where a configurable number of Acks (m_options.seqNumLossThreshold) have been received for greater TxSequence numbers More...
 
std::vector< lp::SequenceonLpPacketLost (lp::Sequence txSeq, bool isTimeout)
 resend (or give up on) a lost fragment More...
 
void onLpPacketAcknowledged (UnackedFrags::iterator fragIt)
 remove the fragment with the given sequence number from the map of unacknowledged fragments, as well as its associated network packet (if any) More...
 
void deleteUnackedFrag (UnackedFrags::iterator fragIt)
 delete a fragment from UnackedFrags and advance acknowledge window if necessary More...
 

Public Attributes

signal::Signal< LpReliability, InterestonDroppedInterest
 signals on Interest dropped by reliability system for exceeding allowed number of retx More...
 
NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE __pad0__: class UnackedFrag
 
NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE __pad1__: lp::Sequence assignTxSequence(lp::Packet& frag)
 
NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE __pad2__: class UnackedFrag { public: explicit UnackedFrag(lp::Packet pkt)
 
lp::Packet pkt
 
scheduler::ScopedEventId rtoTimer
 
time::steady_clock::TimePoint sendTime
 
size_t retxCount
 
size_t nGreaterSeqAcks
 number of Acks received for sequences greater than this fragment More...
 
shared_ptr< NetPktnetPkt
 
NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE __pad3__: Options m_options
 
GenericLinkServicem_linkService
 
UnackedFrags m_unackedFrags
 
UnackedFrags::iterator m_firstUnackedFrag
 An iterator that points to the first unacknowledged fragment in the current window. More...
 
std::queue< lp::Sequencem_ackQueue
 
std::map< lp::Sequence, time::steady_clock::TimePointm_recentRecvSeqs
 
std::queue< lp::Sequencem_recentRecvSeqsQueue
 
lp::Sequence m_lastTxSeqNo
 
scheduler::ScopedEventId m_idleAckTimer
 
ndn::util::RttEstimator m_rttEst
 

Static Public Attributes

static constexpr size_t RESERVED_HEADER_SPACE
 TxSequence TLV-TYPE (3 octets) + TLV-LENGTH (1 octet) + lp::Sequence (8 octets) More...
 

Detailed Description

provides for reliable sending and receiving of link-layer packets

See also
https://redmine.named-data.net/projects/nfd/wiki/NDNLPv2

Definition at line 45 of file lp-reliability.hpp.

Member Typedef Documentation

◆ UnackedFrags

using nfd::face::LpReliability::UnackedFrags = std::map<lp::Sequence, UnackedFrag>

Definition at line 111 of file lp-reliability.hpp.

Constructor & Destructor Documentation

◆ LpReliability()

nfd::face::LpReliability::LpReliability ( const Options options,
GenericLinkService linkService 
)

Definition at line 36 of file lp-reliability.cpp.

References m_linkService.

Member Function Documentation

◆ setOptions()

void nfd::face::LpReliability::setOptions ( const Options options)

◆ getLinkService()

const GenericLinkService * nfd::face::LpReliability::getLinkService ( ) const
Returns
GenericLinkService that owns this instance

This is only used for logging, and may be nullptr.

Definition at line 59 of file lp-reliability.cpp.

References m_linkService.

◆ handleOutgoing()

void nfd::face::LpReliability::handleOutgoing ( std::vector< lp::Packet > &  frags,
lp::Packet &&  pkt,
bool  isInterest 
)

observe outgoing fragment(s) of a network packet and store for potential retransmission

Parameters
fragsfragments of network packet
pktencapsulated network packet
isInterestwhether the network packet is an Interest

Definition at line 65 of file lp-reliability.cpp.

References ndn::util::RttEstimator::getEstimatedRto(), nfd::getScheduler(), m_firstUnackedFrag, m_rttEst, m_unackedFrags, nonstd::optional_lite::std11::move(), netPkt, NFD_LOG_FACE_TRACE, ndn::time::steady_clock::now(), onLpPacketLost(), pkt, and sendTime.

◆ processIncomingPacket()

bool nfd::face::LpReliability::processIncomingPacket ( const lp::Packet pkt)

◆ piggyback()

void nfd::face::LpReliability::piggyback ( lp::Packet pkt,
ssize_t  mtu 
)

◆ startIdleAckTimer()

void nfd::face::LpReliability::startIdleAckTimer ( )

start the idle Ack timer

This timer requests an IDLE packet to acknowledge pending fragments not already piggybacked. It is called regularly on a period configured in Options::idleAckTimerPeriod. This allows Acks to be returned to the sender, even if the link goes idle.

Definition at line 236 of file lp-reliability.cpp.

References nfd::getScheduler(), and m_idleAckTimer.

Referenced by processIncomingPacket().

◆ findLostLpPackets()

std::vector< lp::Sequence > nfd::face::LpReliability::findLostLpPackets ( UnackedFrags::iterator  ackIt)

find and mark as lost fragments where a configurable number of Acks (m_options.seqNumLossThreshold) have been received for greater TxSequence numbers

Parameters
ackItiterator pointing to acknowledged fragment
Returns
vector containing TxSequences of fragments marked lost by this mechanism

Definition at line 251 of file lp-reliability.cpp.

References m_firstUnackedFrag, m_unackedFrags, and NFD_LOG_FACE_TRACE.

Referenced by processIncomingPacket().

◆ onLpPacketLost()

std::vector< lp::Sequence > nfd::face::LpReliability::onLpPacketLost ( lp::Sequence  txSeq,
bool  isTimeout 
)

resend (or give up on) a lost fragment

Returns
vector of the TxSequences of fragments removed due to a network packet being removed

Definition at line 278 of file lp-reliability.cpp.

References deleteUnackedFrag(), ndn::util::RttEstimator::getEstimatedRto(), nfd::getScheduler(), ndn::tlv::Interest, m_firstUnackedFrag, m_linkService, m_rttEst, m_unackedFrags, netPkt, NFD_LOG_FACE_DEBUG, NFD_LOG_FACE_TRACE, and onDroppedInterest.

Referenced by handleOutgoing(), and processIncomingPacket().

◆ onLpPacketAcknowledged()

void nfd::face::LpReliability::onLpPacketAcknowledged ( UnackedFrags::iterator  fragIt)

remove the fragment with the given sequence number from the map of unacknowledged fragments, as well as its associated network packet (if any)

Parameters
fragItiterator to acknowledged fragment

If the given TxSequence marks the beginning of the send window, the window will be incremented. If the associated network packet has been fully transmitted, it will be removed.

Definition at line 364 of file lp-reliability.cpp.

References deleteUnackedFrag(), m_linkService, and netPkt.

Referenced by processIncomingPacket().

◆ deleteUnackedFrag()

void nfd::face::LpReliability::deleteUnackedFrag ( UnackedFrags::iterator  fragIt)

delete a fragment from UnackedFrags and advance acknowledge window if necessary

Parameters
fragItiterator to an UnackedFrag, must be dereferencable
Postcondition
fragIt is not in m_unackedFrags
if was equal to m_firstUnackedFrag, m_firstUnackedFrag is set to the UnackedFrag after fragIt with consideration of TxSequence number wraparound, or set to m_unackedFrags.end() if m_unackedFrags is empty

Definition at line 388 of file lp-reliability.cpp.

References m_firstUnackedFrag, m_unackedFrags, nonstd::optional_lite::std11::move(), nGreaterSeqAcks, ndn::time::steady_clock::now(), pkt, retxCount, and sendTime.

Referenced by onLpPacketAcknowledged(), and onLpPacketLost().

Member Data Documentation

◆ onDroppedInterest

signal::Signal<LpReliability, Interest> nfd::face::LpReliability::onDroppedInterest

signals on Interest dropped by reliability system for exceeding allowed number of retx

Definition at line 72 of file lp-reliability.hpp.

Referenced by onLpPacketLost().

◆ __pad0__

NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE nfd::face::LpReliability::__pad0__

Definition at line 109 of file lp-reliability.hpp.

◆ __pad1__

NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE nfd::face::LpReliability::__pad1__

Definition at line 120 of file lp-reliability.hpp.

◆ __pad2__

NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE nfd::face::LpReliability::__pad2__

Definition at line 172 of file lp-reliability.hpp.

◆ pkt

lp::Packet nfd::face::LpReliability::pkt

Definition at line 175 of file lp-reliability.hpp.

Referenced by deleteUnackedFrag(), and handleOutgoing().

◆ rtoTimer

scheduler::ScopedEventId nfd::face::LpReliability::rtoTimer

Definition at line 176 of file lp-reliability.hpp.

◆ sendTime

time::steady_clock::TimePoint nfd::face::LpReliability::sendTime

Definition at line 177 of file lp-reliability.hpp.

Referenced by deleteUnackedFrag(), and handleOutgoing().

◆ retxCount

size_t nfd::face::LpReliability::retxCount

Definition at line 178 of file lp-reliability.hpp.

Referenced by deleteUnackedFrag().

◆ nGreaterSeqAcks

size_t nfd::face::LpReliability::nGreaterSeqAcks

number of Acks received for sequences greater than this fragment

Definition at line 179 of file lp-reliability.hpp.

Referenced by deleteUnackedFrag().

◆ netPkt

shared_ptr<NetPkt> nfd::face::LpReliability::netPkt

Definition at line 180 of file lp-reliability.hpp.

Referenced by handleOutgoing(), onLpPacketAcknowledged(), and onLpPacketLost().

◆ RESERVED_HEADER_SPACE

constexpr size_t nfd::face::LpReliability::RESERVED_HEADER_SPACE
static
Initial value:

TxSequence TLV-TYPE (3 octets) + TLV-LENGTH (1 octet) + lp::Sequence (8 octets)

Definition at line 199 of file lp-reliability.hpp.

◆ __pad3__

NFD_PUBLIC_WITH_TESTS_ELSE_PRIVATE nfd::face::LpReliability::__pad3__

Definition at line 204 of file lp-reliability.hpp.

◆ m_linkService

GenericLinkService* nfd::face::LpReliability::m_linkService

◆ m_unackedFrags

UnackedFrags nfd::face::LpReliability::m_unackedFrags

◆ m_firstUnackedFrag

UnackedFrags::iterator nfd::face::LpReliability::m_firstUnackedFrag

An iterator that points to the first unacknowledged fragment in the current window.

The window can wrap around so that the beginning of the window is at a TxSequence greater than other fragments in the window. When the window is moved past the last item in the iterator, the first fragment in the map will become the start of the window.

Definition at line 212 of file lp-reliability.hpp.

Referenced by deleteUnackedFrag(), findLostLpPackets(), handleOutgoing(), onLpPacketLost(), and piggyback().

◆ m_ackQueue

std::queue<lp::Sequence> nfd::face::LpReliability::m_ackQueue

Definition at line 213 of file lp-reliability.hpp.

Referenced by piggyback(), and processIncomingPacket().

◆ m_recentRecvSeqs

std::map<lp::Sequence, time::steady_clock::TimePoint> nfd::face::LpReliability::m_recentRecvSeqs

Definition at line 214 of file lp-reliability.hpp.

Referenced by processIncomingPacket().

◆ m_recentRecvSeqsQueue

std::queue<lp::Sequence> nfd::face::LpReliability::m_recentRecvSeqsQueue

Definition at line 215 of file lp-reliability.hpp.

Referenced by processIncomingPacket().

◆ m_lastTxSeqNo

lp::Sequence nfd::face::LpReliability::m_lastTxSeqNo

Definition at line 216 of file lp-reliability.hpp.

Referenced by piggyback().

◆ m_idleAckTimer

scheduler::ScopedEventId nfd::face::LpReliability::m_idleAckTimer

Definition at line 217 of file lp-reliability.hpp.

Referenced by setOptions(), and startIdleAckTimer().

◆ m_rttEst

ndn::util::RttEstimator nfd::face::LpReliability::m_rttEst

Definition at line 218 of file lp-reliability.hpp.

Referenced by handleOutgoing(), onLpPacketLost(), and processIncomingPacket().


The documentation for this class was generated from the following files: