22 #ifndef NDN_UTIL_SEGMENT_FETCHER_HPP 23 #define NDN_UTIL_SEGMENT_FETCHER_HPP 161 static shared_ptr<SegmentFetcher>
176 class PendingSegment;
181 shouldStop(
const weak_ptr<SegmentFetcher>& weakSelf);
184 fetchFirstSegment(
const Interest& baseInterest,
bool isRetransmission);
187 fetchSegmentsInWindow(
const Interest& origInterest);
190 sendInterest(uint64_t segNum,
const Interest& interest,
bool isRetransmission);
193 afterSegmentReceivedCb(
const Interest& origInterest,
const Data& data,
194 const weak_ptr<SegmentFetcher>& weakSelf);
197 afterValidationSuccess(
const Data& data,
const Interest& origInterest,
198 std::map<uint64_t, PendingSegment>::iterator pendingSegmentIt,
199 const weak_ptr<SegmentFetcher>& weakSelf);
202 afterValidationFailure(
const Data& data,
204 const weak_ptr<SegmentFetcher>& weakSelf);
208 const weak_ptr<SegmentFetcher>& weakSelf);
211 afterTimeoutCb(
const Interest& origInterest,
212 const weak_ptr<SegmentFetcher>& weakSelf);
215 afterNackOrTimeout(
const Interest& origInterest);
227 signalError(uint32_t code,
const std::string& msg);
230 updateRetransmittedSegment(uint64_t segmentNum,
235 cancelExcessInFlightSegments();
238 checkAllSegmentsReceived();
290 enum class SegmentState {
306 static constexpr
double MIN_SSTHRESH = 2.0;
308 shared_ptr<SegmentFetcher> m_this;
317 std::queue<uint64_t> m_retxQueue;
318 Name m_versionedDataName;
319 uint64_t m_nextSegmentNum = 0;
322 int64_t m_nSegmentsInFlight = 0;
323 int64_t m_nSegments = 0;
324 uint64_t m_highInterest = 0;
325 uint64_t m_highData = 0;
326 uint64_t m_recPoint = 0;
327 int64_t m_nReceived = 0;
328 int64_t m_nBytesReceived = 0;
329 uint64_t m_nextSegmentInOrder = 0;
331 std::map<uint64_t, Buffer> m_segmentBuffer;
332 std::map<uint64_t, PendingSegment> m_pendingSegments;
333 std::set<uint64_t> m_receivedSegments;
339 #endif // NDN_UTIL_SEGMENT_FETCHER_HPP bool inOrder
true for 'in order' mode, false for 'block' mode
time::milliseconds interestLifetime
lifetime of sent Interests - independent of Interest timeout
An unrecoverable Nack was received during retrieval.
double mdCoef
multiplicative decrease coefficient
Signal< SegmentFetcher, ConstBufferPtr > onComplete
Emitted upon successful retrieval of the complete object (all segments).
time::milliseconds maxTimeout
maximum allowed time between successful receipt of segments
bool useConstantInterestTimeout
if true, Interest timeout is kept at maxTimeout
Utility class to fetch the latest version of a segmented object.
Represents an Interest packet.
provides a lightweight signal / event system
Signal< SegmentFetcher > onInOrderComplete
Emitted on successful retrieval of all segments in 'in order' mode.
void stop()
Stops fetching.
A handle for a scheduled event.
represents a Network Nack
double aiStep
additive increase step (in segments)
size_t flowControlWindow
maximum number of segments stored in the reorder buffer
bool disableCwa
disable Conservative Window Adaptation
One of the retrieved segments failed user-provided validation.
ErrorCode
Error codes passed to onError.
Handle for a pending Interest.
static shared_ptr< SegmentFetcher > start(Face &face, const Interest &baseInterest, security::v2::Validator &validator, const Options &options=Options())
Initiates segment fetching.
Signal< SegmentFetcher > afterSegmentNacked
Emitted whenever an Interest for a data segment is nacked.
Provide a communication channel with local or remote NDN forwarder.
Signal< SegmentFetcher, Data > afterSegmentValidated
Emitted whenever a received data segment has been successfully validated.
Retrieval timed out because the maximum timeout between the successful receipt of segments was exceed...
#define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE
One of the retrieved Data packets lacked a segment number in the last Name component (excl...
Represents an absolute name.
double initSsthresh
initial slow start threshold
Generic time-based scheduler.
double initCwnd
initial congestion window size
bool ignoreCongMarks
disable window decrease after congestion mark received
bool resetCwndToInit
reduce cwnd to initCwnd when loss event occurs
Signal< SegmentFetcher, Data > afterSegmentReceived
Emitted whenever a data segment received.
Signal< SegmentFetcher > afterSegmentTimedOut
Emitted whenever an Interest for a data segment times out.
RttEstimator::Options rttOptions
options for RTT estimator
Validation error code and optional detailed error message.
Signal< SegmentFetcher, uint32_t, std::string > onError
Emitted when the retrieval could not be completed due to an error.
Represents a Data packet.
A received FinalBlockId did not contain a segment component.
bool useConstantCwnd
if true, window size is kept at initCwnd
Interface for validating data and interest packets.
Signal< SegmentFetcher, ConstBufferPtr > onInOrderData
Emitted after each data segment in segment order has been validated.