22 #ifndef NDN_UTIL_SEGMENT_FETCHER_HPP 23 #define NDN_UTIL_SEGMENT_FETCHER_HPP 26 #include "../common.hpp" 27 #include "../face.hpp" 28 #include "../security/v2/validator.hpp" 110 typedef function<void (uint32_t code, const std::string& msg)>
ErrorCallback;
144 const CompleteCallback& completeCallback,
145 const ErrorCallback& errorCallback);
166 shared_ptr<security::v2::Validator> validator,
167 const CompleteCallback& completeCallback,
168 const ErrorCallback& errorCallback);
172 shared_ptr<security::v2::Validator> validator,
173 const CompleteCallback& completeCallback,
174 const ErrorCallback& errorCallback);
177 fetchFirstSegment(
const Interest& baseInterest, shared_ptr<SegmentFetcher>
self);
180 fetchNextSegment(
const Interest& origInterest,
const Name& dataName, uint64_t segmentNo,
181 shared_ptr<SegmentFetcher>
self);
184 afterSegmentReceived(
const Interest& origInterest,
185 const Data& data,
bool isSegmentZeroExpected,
186 shared_ptr<SegmentFetcher>
self);
188 afterValidationSuccess(
const Data& data,
189 bool isSegmentZeroExpected,
191 shared_ptr<SegmentFetcher>
self);
198 uint32_t reExpressCount, shared_ptr<SegmentFetcher>
self);
201 reExpressInterest(
Interest interest, uint32_t reExpressCount,
202 shared_ptr<SegmentFetcher>
self);
206 Scheduler m_scheduler;
207 shared_ptr<security::v2::Validator> m_validator;
208 CompleteCallback m_completeCallback;
209 ErrorCallback m_errorCallback;
211 shared_ptr<OBufferStream> m_buffer;
217 #endif // NDN_UTIL_SEGMENT_FETCHER_HPP Copyright (c) 2011-2015 Regents of the University of California.
function< void(uint32_t code, const std::string &msg)> ErrorCallback
Utility class to fetch latest version of the segmented data.
represents an Interest packet
represents a Network Nack
ErrorCode
Error codes that can be passed to ErrorCallback.
static void fetch(Face &face, const Interest &baseInterest, security::v2::Validator &validator, const CompleteCallback &completeCallback, const ErrorCallback &errorCallback)
Initiate segment fetching.
Provide a communication channel with local or remote NDN forwarder.
Represents an absolute name.
Validation error code and optional detailed error message.
static const uint32_t MAX_INTEREST_REEXPRESS
Maximum number of times an interest will be reexpressed incase of NackCallback.
Represents a Data packet.
Interface for validating data and interest packets.
function< void(const ConstBufferPtr &data)> CompleteCallback