示例#1
0
void
FaceIdFetcher::onCanonizeSuccess(const FaceUri& canonicalUri)
{
  ndn::Name queryName("/localhost/nfd/faces/query");
  ndn::nfd::FaceQueryFilter queryFilter;
  queryFilter.setRemoteUri(canonicalUri.toString());
  queryName.append(queryFilter.wireEncode());

  ndn::Interest interestPacket(queryName);
  interestPacket.setMustBeFresh(true);
  interestPacket.setInterestLifetime(time::milliseconds(4000));
  auto interest = std::make_shared<ndn::Interest>(interestPacket);

  ndn::util::SegmentFetcher::fetch(
    m_face, *interest, m_validator,
    bind(&FaceIdFetcher::onQuerySuccess, this, _1, canonicalUri),
    bind(&FaceIdFetcher::onQueryFailure, this, _1, canonicalUri));
}
示例#2
0
 ndn::Interest
 createInterestPacket()
 {
   ndn::Name interestName(m_prefixName);
   ndn::Interest interestPacket(interestName);
   if (m_mustBeFresh)
     interestPacket.setMustBeFresh(true);
   if (m_isChildSelectorRightmost)
     interestPacket.setChildSelector(1);
   if (m_minSuffixComponents >= 0)
     interestPacket.setMinSuffixComponents(m_minSuffixComponents);
   if (m_maxSuffixComponents >= 0)
     interestPacket.setMaxSuffixComponents(m_maxSuffixComponents);
   if (m_interestLifetime < ndn::time::milliseconds::zero())
     interestPacket.setInterestLifetime(getDefaultInterestLifetime());
   else
     interestPacket.setInterestLifetime(m_interestLifetime);
   return interestPacket;
 }