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/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<Validator> validator,
167 const CompleteCallback& completeCallback,
168 const ErrorCallback& errorCallback);
172 shared_ptr<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 shared_ptr<const Data> data,
189 bool isSegmentZeroExpected,
191 shared_ptr<SegmentFetcher>
self);
194 afterValidationFailure(
const shared_ptr<const Data> data);
198 uint32_t reExpressCount, shared_ptr<SegmentFetcher>
self);
201 reExpressInterest(
Interest interest, uint32_t reExpressCount,
202 shared_ptr<SegmentFetcher>
self);
207 shared_ptr<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.
Abstraction to communicate with local or remote NDN forwarder.
Name abstraction to represent an absolute name.
static void fetch(Face &face, const Interest &baseInterest, Validator &validator, const CompleteCallback &completeCallback, const ErrorCallback &errorCallback)
Initiate segment fetching.
static const uint32_t MAX_INTEREST_REEXPRESS
Maximum number of times an interest will be reexpressed incase of NackCallback.
Validator is one of the main classes of the security library.
function< void(const ConstBufferPtr &data)> CompleteCallback