コード例 #1
0
ファイル: exclude.cpp プロジェクト: WeiqiJust/NDN-total
bool
Exclude::operator==(const Exclude& other) const
{
  if (empty() && other.empty())
    return true;
  if (empty() || other.empty())
    return false;

  return wireEncode() == other.wireEncode();
}
コード例 #2
0
void
SelectorHelper::applySelectors(Interest& interest, Context* context)
{
  int minSuffix = -1;
  context->getContextOption(MIN_SUFFIX_COMP_S, minSuffix);
  
  if (minSuffix >= 0)
  {
    interest.setMinSuffixComponents(minSuffix);
  }
  
  int maxSuffix = -1;
  context->getContextOption(MAX_SUFFIX_COMP_S, maxSuffix);
  
  if (maxSuffix >= 0)
  {
    interest.setMaxSuffixComponents(maxSuffix);
  }
  
  Exclude exclusion;
  context->getContextOption(EXCLUDE_S, exclusion);
  
  if (!exclusion.empty())
  {
    interest.setExclude(exclusion);
  }
  
  bool mustBeFresh = false;
  context->getContextOption(MUST_BE_FRESH_S, mustBeFresh);
  
  if (mustBeFresh)
  {
    interest.setMustBeFresh(mustBeFresh);
  }
  
  int child = -10;
  context->getContextOption(RIGHTMOST_CHILD_S, child);
  
  if (child != -10)
  {
    interest.setChildSelector(child);
  }
  
  KeyLocator keyLocator;
  context->getContextOption(KEYLOCATOR_S, keyLocator);
  
  if (!keyLocator.empty())
  {
    interest.setPublisherPublicKeyLocator(keyLocator);
  }
}