28 #ifndef NDN_UTIL_SEGMENT_FETCHER_HPP 29 #define NDN_UTIL_SEGMENT_FETCHER_HPP 163 static shared_ptr<SegmentFetcher>
178 class PendingSegment;
183 shouldStop(
const weak_ptr<SegmentFetcher>& weakSelf);
186 fetchFirstSegment(
const Interest& baseInterest,
bool isRetransmission);
189 fetchSegmentsInWindow(
const Interest& origInterest);
192 sendInterest(uint64_t segNum,
const Interest& interest,
bool isRetransmission);
195 afterSegmentReceivedCb(
const Interest& origInterest,
const Data& data,
196 const weak_ptr<SegmentFetcher>& weakSelf);
199 afterValidationSuccess(
const Data& data,
const Interest& origInterest,
200 std::map<uint64_t, PendingSegment>::iterator pendingSegmentIt,
201 const weak_ptr<SegmentFetcher>& weakSelf);
204 afterValidationFailure(
const Data& data,
206 const weak_ptr<SegmentFetcher>& weakSelf);
210 const weak_ptr<SegmentFetcher>& weakSelf);
213 afterTimeoutCb(
const Interest& origInterest,
214 const weak_ptr<SegmentFetcher>& weakSelf);
217 afterNackOrTimeout(
const Interest& origInterest);
229 signalError(uint32_t code,
const std::string& msg);
232 updateRetransmittedSegment(uint64_t segmentNum,
237 cancelExcessInFlightSegments();
240 checkAllSegmentsReceived();
256 Signal<SegmentFetcher, uint32_t, std::string>
onError;
279 enum class SegmentState {
295 static constexpr
double MIN_SSTHRESH = 2.0;
297 shared_ptr<SegmentFetcher> m_this;
301 Scheduler m_scheduler;
304 time::milliseconds m_timeout;
307 std::queue<uint64_t> m_retxQueue;
308 Name m_versionedDataName;
309 uint64_t m_nextSegmentNum;
312 int64_t m_nSegmentsInFlight;
314 uint64_t m_highInterest;
318 int64_t m_nBytesReceived;
320 std::map<uint64_t, Buffer> m_receivedSegments;
321 std::map<uint64_t, PendingSegment> m_pendingSegments;
327 #endif // NDN_UTIL_SEGMENT_FETCHER_HPP
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
Emits upon successful retrieval of the complete data.
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.
void stop()
Stops fetching.
represents a Network Nack
double aiStep
additive increase step (in segments)
bool disableCwa
disable Conservative Window Adaptation
One of the retrieved segments failed user-provided validation.
ErrorCode
Error codes passed to onError.
A handle of 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
Emits whenever an Interest for a data segment is nacked.
Provide a communication channel with local or remote NDN forwarder.
Signal< SegmentFetcher, Data > afterSegmentValidated
Emits 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
A scoped handle of scheduled event.
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
Emits whenever a data segment received.
Signal< SegmentFetcher > afterSegmentTimedOut
Emits 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
Emits when the retrieval could not be completed due to an error.
A handle of scheduled event.
Represents a Data packet.
A received FinalBlockId did not contain a segment component.
bool useConstantCwnd
if true, window size is kept at initCwnd
Cancels an operation automatically upon destruction.
Interface for validating data and interest packets.