22 #ifndef NDN_MANAGEMENT_NFD_LOCAL_CONTROL_HEADER_HPP 23 #define NDN_MANAGEMENT_NFD_LOCAL_CONTROL_HEADER_HPP 25 #include "../encoding/encoding-buffer.hpp" 26 #include "../encoding/tlv-nfd.hpp" 27 #include "../encoding/block-helpers.hpp" 40 class Error :
public std::runtime_error
45 :
std::runtime_error(what)
113 inline static const Block&
144 return m_incomingFaceId;
150 m_incomingFaceId = incomingFaceId;
164 return m_nextHopFaceId;
170 m_nextHopFaceId = nextHopFaceId;
178 return m_cachingPolicy != CachingPolicy::INVALID_POLICY;
184 return m_cachingPolicy;
190 m_cachingPolicy = cachingPolicy;
194 template<encoding::Tag TAG>
199 uint64_t m_incomingFaceId;
200 uint64_t m_nextHopFaceId;
208 template<encoding::Tag TAG>
211 uint8_t encodeMask)
const 217 size_t totalLength = payloadSize;
233 size_t cachingPolicyLength = 0;
234 cachingPolicyLength += block.prependVarNumber(0);
236 cachingPolicyLength += block.prependVarNumber(cachingPolicyLength);
239 totalLength += cachingPolicyLength;
242 totalLength += block.prependVarNumber(totalLength);
252 if (
empty(encodeMask))
253 BOOST_THROW_EXCEPTION(
Error(
"Requested wire for LocalControlHeader, but none of the fields are " 257 size_t length =
wireEncode(estimator, payload.wireEncode().size(), encodeMask);
260 wireEncode(buffer, payload.wireEncode().size(), encodeMask);
262 return buffer.block(
false);
277 m_cachingPolicy = CachingPolicy::INVALID_POLICY;
286 if (needIncomingFaceId)
290 if (needNextHopFaceId)
294 if (needCachingPolicy) {
298 m_cachingPolicy = CachingPolicy::NO_CACHE;
301 BOOST_THROW_EXCEPTION(
Error(
"CachingPolicy: Missing required NoCache field"));
332 #endif // NDN_MANAGEMENT_NFD_LOCAL_CONTROL_HEADER_HPP
element_const_iterator elements_begin() const
Copyright (c) 2011-2015 Regents of the University of California.
size_t prependNonNegativeIntegerBlock(EncodingImpl< TAG > &encoder, uint32_t type, uint64_t value)
Helper to prepend TLV block type type containing non-negative integer value.
EncodingImpl< EstimatorTag > EncodingEstimator
element_const_iterator elements_end() const
void parse() const
Parse wire buffer into subblocks.
Class representing a wire element of NDN-TLV packet format.
uint64_t readNonNegativeInteger(const Block &block)
Helper to read a non-negative integer from a block.
EncodingImpl< EncoderTag > EncodingBuffer
Copyright (c) 2011-2015 Regents of the University of California.
element_container::const_iterator element_const_iterator
size_t elements_size() const
const element_container & elements() const
Get all subelements.
static const uint64_t INVALID_FACE_ID