void EdgeStrategy::toNack( ndn::Data& data, const ndn::Interest& interest ) { // ensure that denied data doesn't leave the network data.setContent( ndn::Block() ); data.wireEncode(); // do whatever a normal router would do RouterStrategy::toNack( data, interest ); }
void EdgeStrategy::toPreserve( ndn::Data& data, const ndn::Interest& interest ) { if( data.getContentType() == ndn::tlv::ContentType_Nack ) { data.setContent( ndn::Block() ); data.wireEncode(); } }
void onData(const ndn::Interest& interest, ndn::Data& data) { m_isDataReceived = true; if (m_isPayloadOnlySet) { const ndn::Block& block = data.getContent(); std::cout.write(reinterpret_cast<const char*>(block.value()), block.value_size()); } else { const ndn::Block& block = data.wireEncode(); std::cout.write(reinterpret_cast<const char*>(block.wire()), block.size()); } }