31 BOOST_CONCEPT_ASSERT((StatusDatasetItem<CsInfo>));
46 template<encoding::Tag TAG>
50 size_t totalLength = 0;
58 totalLength += encoder.prependVarNumber(totalLength);
77 m_wire = buffer.block();
85 BOOST_THROW_EXCEPTION(
Error(
"expecting CsInfo block, got " +
to_string(block.
type())));
89 auto val = m_wire.elements_begin();
96 BOOST_THROW_EXCEPTION(
Error(
"missing required Capacity field"));
104 BOOST_THROW_EXCEPTION(
Error(
"missing required Flags field"));
112 BOOST_THROW_EXCEPTION(
Error(
"missing required NCsEntries field"));
120 BOOST_THROW_EXCEPTION(
Error(
"missing required NHits field"));
128 BOOST_THROW_EXCEPTION(
Error(
"missing required NMisses field"));
136 m_capacity = capacity;
160 m_nEntries = nEntries;
191 << (csi.
getEnableAdmit() ?
"admit enabled, " :
"admit disabled, ")
192 << (csi.
getEnableServe() ?
"serve enabled, " :
"serve disabled, ")
CsInfo & setNHits(uint64_t nHits)
Copyright (c) 2013-2017 Regents of the University of California.
size_t prependNonNegativeIntegerBlock(EncodingImpl< TAG > &encoder, uint32_t type, uint64_t value)
Prepend a TLV element containing a non-negative integer.
uint64_t getCapacity() const
get CS capacity (in number of packets)
Represents a TLV element of NDN packet format.
CsInfo & setNEntries(uint64_t nEntries)
CsInfo & setEnableAdmit(bool enableAdmit)
uint64_t getNMisses() const
get number of CS lookup misses since NFD starts
uint64_t readNonNegativeInteger(const Block &block)
Read a non-negative integer from a TLV element.
bool getEnableAdmit() const
get CS_ENABLE_ADMIT flag
bool getEnableServe() const
get CS_ENABLE_SERVE flag
void wireDecode(const Block &wire)
CsInfo & setEnableServe(bool enableServe)
size_t wireEncode(EncodingImpl< TAG > &encoder) const
bool operator==(const ChannelStatus &a, const ChannelStatus &b)
enables the CS to satisfy Interests using cached Data
enables the CS to admit new Data
#define NDN_CXX_DEFINE_WIRE_ENCODE_INSTANTIATIONS(ClassName)
std::ostream & operator<<(std::ostream &os, FaceScope faceScope)
void reset()
Reset wire buffer of the element.
represents the CS Information dataset
uint64_t getNHits() const
get number of CS lookup hits since NFD starts
void parse() const
Parse TLV-VALUE into sub elements.
uint32_t type() const
Get TLV-TYPE.
CsInfo & setCapacity(uint64_t capacity)
bool hasWire() const
Check if the Block has fully encoded wire.
std::string to_string(const V &v)
CsInfo & setNMisses(uint64_t nMisses)
const Block & wireEncode() const
EncodingImpl< EncoderTag > EncodingBuffer
EncodingImpl< EstimatorTag > EncodingEstimator
uint64_t getNEntries() const
get number of stored CS entries