22 #ifndef NDN_GENERALIZED_CONTENT_HPP
23 #define NDN_GENERALIZED_CONTENT_HPP
25 #include <ndn-cpp/face.hpp>
26 #include <ndn-cpp/util/segment-fetcher.hpp>
27 #include <ndn-cpp/util/memory-content-cache.hpp>
28 #include "content-meta-info.hpp"
42 DATA_HAS_NO_SEGMENT = 2,
43 SEGMENT_VERIFICATION_FAILED = 3,
45 META_INFO_DECODING_FAILED = 4
48 typedef ndn::func_lib::function<void
49 (
const ndn::ptr_lib::shared_ptr<ContentMetaInfo>& metaInfo,
52 typedef ndn::func_lib::function<void
53 (ErrorCode errorCode,
const std::string& message)> OnError;
81 const ndn::Blob& content,
size_t contentSegmentSize);
116 const OnComplete& onComplete,
const OnError& onError,
126 const OnComplete& onComplete,
const OnError& onError,
128 : face_(face), prefix_(prefix), validatorKeyChain_(validatorKeyChain),
129 onComplete_(onComplete), onError_(onError),
130 interestLifetimeMilliseconds_(interestLifetimeMilliseconds)
139 (
const ndn::ptr_lib::shared_ptr<const ndn::Interest>& originalInterest,
140 const ndn::ptr_lib::shared_ptr<ndn::Data>& data);
143 onMetaInfoTimeout(
const ndn::ptr_lib::shared_ptr<const ndn::Interest>& interest);
146 onContentReceived(
const ndn::Blob& content);
149 onSegmentFetcherError
150 (ndn::SegmentFetcher::ErrorCode errorCode,
const std::string& message);
155 OnComplete onComplete_;
158 ndn::ptr_lib::shared_ptr<ContentMetaInfo> metaInfo_;
double Milliseconds
A time interval represented as the number of milliseconds.
Definition: common.hpp:114
A MemoryContentCache holds a set of Data packets and answers an Interest to return the correct Data p...
Definition: memory-content-cache.hpp:38
The Face class provides the main methods for NDN communication.
Definition: face.hpp:86
KeyChain is the main class of the security library.
Definition: key-chain.hpp:53
ContentMetaInfo represents the information in the _meta packet of a Generalized Content.
Definition: content-meta-info.hpp:33
A Name holds an array of Name::Component and represents an NDN name.
Definition: name.hpp:40
A Blob holds a pointer to an immutable byte array implemented as const std::vector<uint8_t>.
Definition: blob.hpp:42
static void fetch(ndn::Face &face, const ndn::Name &prefix, ndn::KeyChain *validatorKeyChain, const OnComplete &onComplete, const OnError &onError, ndn::Milliseconds interestLifetimeMilliseconds=4000.0)
Initiate meta info and segmented content fetching.
Definition: generalized-content.cpp:83
static void publish(ndn::MemoryContentCache &contentCache, const ndn::Name &prefix, ndn::Milliseconds freshnessPeriod, ndn::KeyChain *signingKeyChain, const ndn::Name &signingCertificateName, const ContentMetaInfo &metaInfo, const ndn::Blob &content, size_t contentSegmentSize)
Use the contentCache to publish a Data packet named [prefix]/_meta whose content is the encoded metaI...
Definition: generalized-content.cpp:35
GeneralizedContent has the static publish and fetch methods which fetches meta info and segmented con...
Definition: generalized-content.hpp:37