22 #ifndef NDN_CXX_UTIL_SEGMENT_FETCHER_HPP 23 #define NDN_CXX_UTIL_SEGMENT_FETCHER_HPP 148 static shared_ptr<SegmentFetcher>
163 class PendingSegment;
168 shouldStop(
const weak_ptr<SegmentFetcher>& weakSelf);
171 fetchFirstSegment(
const Interest& baseInterest,
bool isRetransmission);
174 fetchSegmentsInWindow(
const Interest& origInterest);
177 sendInterest(uint64_t segNum,
const Interest& interest,
bool isRetransmission);
180 afterSegmentReceivedCb(
const Interest& origInterest,
const Data& data,
181 const weak_ptr<SegmentFetcher>& weakSelf);
184 afterValidationSuccess(
const Data& data,
const Interest& origInterest,
185 std::map<uint64_t, PendingSegment>::iterator pendingSegmentIt,
186 const weak_ptr<SegmentFetcher>& weakSelf);
189 afterValidationFailure(
const Data& data,
190 const security::ValidationError& error,
191 const weak_ptr<SegmentFetcher>& weakSelf);
195 const weak_ptr<SegmentFetcher>& weakSelf);
198 afterTimeoutCb(
const Interest& origInterest,
199 const weak_ptr<SegmentFetcher>& weakSelf);
202 afterNackOrTimeout(
const Interest& origInterest);
214 signalError(uint32_t code,
const std::string& msg);
217 updateRetransmittedSegment(uint64_t segmentNum,
222 cancelExcessInFlightSegments();
225 checkAllSegmentsReceived();
277 enum class SegmentState {
293 static constexpr
double MIN_SSTHRESH = 2.0;
295 shared_ptr<SegmentFetcher> m_this;
304 std::queue<uint64_t> m_retxQueue;
305 Name m_versionedDataName;
306 uint64_t m_nextSegmentNum = 0;
309 int64_t m_nSegmentsInFlight = 0;
310 int64_t m_nSegments = 0;
311 uint64_t m_highInterest = 0;
312 uint64_t m_highData = 0;
313 uint64_t m_recPoint = 0;
314 int64_t m_nReceived = 0;
315 int64_t m_nBytesReceived = 0;
316 uint64_t m_nextSegmentInOrder = 0;
318 std::map<uint64_t, Buffer> m_segmentBuffer;
319 std::map<uint64_t, PendingSegment> m_pendingSegments;
320 std::set<uint64_t> m_receivedSegments;
326 #endif // NDN_CXX_UTIL_SEGMENT_FETCHER_HPP bool inOrder
true for 'in order' mode, false for 'block' mode
Copyright (c) 2011-2015 Regents of the University of California.
time::milliseconds interestLifetime
lifetime of sent Interests - independent of Interest timeout
static shared_ptr< SegmentFetcher > start(Face &face, const Interest &baseInterest, security::Validator &validator, const Options &options=Options())
Initiates segment fetching.
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.
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...
One of the retrieved Data packets lacked a segment number in the last Name component (excl...
#define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE
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
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
Signal< SegmentFetcher, ConstBufferPtr > onInOrderData
Emitted after each data segment in segment order has been validated.
boost::chrono::milliseconds milliseconds