Beispiel #1
0
void
HelloProtocol::processInterestTimedOut(const ndn::Interest& interest)
{
  /* interest name: /<neighbor>/NLSR/INFO/<router> */
  const ndn::Name interestName(interest.getName());
  _LOG_DEBUG("Interest timed out for Name: " << interestName);
  if (interestName.get(-2).toUri() != INFO_COMPONENT) {
    return;
  }
  ndn::Name neighbor = interestName.getPrefix(-3);
  _LOG_DEBUG("Neighbor: " << neighbor);
  m_nlsr.getAdjacencyList().incrementTimedOutInterestCount(neighbor);

  Adjacent::Status status = m_nlsr.getAdjacencyList().getStatusOfNeighbor(neighbor);

  uint32_t infoIntTimedOutCount =
    m_nlsr.getAdjacencyList().getTimedOutInterestCount(neighbor);
  _LOG_DEBUG("Status: " << status);
  _LOG_DEBUG("Info Interest Timed out: " << infoIntTimedOutCount);
  if ((infoIntTimedOutCount < m_nlsr.getConfParameter().getInterestRetryNumber())) {
    /* interest name: /<neighbor>/NLSR/INFO/<router> */
    ndn::Name interestName(neighbor);
    interestName.append(NLSR_COMPONENT);
    interestName.append(INFO_COMPONENT);
    interestName.append(m_nlsr.getConfParameter().getRouterPrefix().wireEncode());
    expressInterest(interestName,
                    m_nlsr.getConfParameter().getInterestResendTime());
  }
  else if ((status == Adjacent::STATUS_ACTIVE) &&
           (infoIntTimedOutCount == m_nlsr.getConfParameter().getInterestRetryNumber())) {
    m_nlsr.getAdjacencyList().setStatusOfNeighbor(neighbor, Adjacent::STATUS_INACTIVE);

    m_nlsr.getLsdb().scheduleAdjLsaBuild();
  }
}
void NdnRtcNamespace::getSegmentationNumbers(const ndn::Name &prefix,
                                             PacketNumber &packetNumber,
                                             SegmentNumber &segmentNumber)
{
    int p = -1;
    packetNumber = -1;
    segmentNumber = -1;
    
    if (isDeltaFramesPrefix(prefix))
    {
        p = findComponent(prefix, NameComponentStreamFramesDelta);
    }
    else if (isKeyFramePrefix(prefix))
    {
        p = findComponent(prefix, NameComponentStreamFramesKey);
    }
    
    if (p > 0)
    {
        if (p+1 < prefix.size())
        {
            Name::Component packetNoComp = prefix.get(p+1);
            packetNumber = NdnRtcUtils::frameNumber(packetNoComp);
        }
        
        if (p+3 < prefix.size())
        {
            Name::Component segmentNoComp = prefix.get(p+3);
            segmentNumber = NdnRtcUtils::segmentNumber(segmentNoComp);
        }
    }
}
int NdnRtcNamespace::trimSegmentNumber(const ndn::Name &prefix,
                                        Name &trimmedPrefix)
{
    trimmedPrefix = prefix;
    
    if (getSegmentNumber(prefix) == -1)
        return -1;
    
    int p = -1;
    
    if (isDeltaFramesPrefix(prefix))
    {
        p = findComponent(prefix, NameComponentStreamFramesDelta);
    }
    else if (isKeyFramePrefix(prefix))
    {
        p = findComponent(prefix, NameComponentStreamFramesKey);
    }
    
    if (p > 0 &&
        p+3 < prefix.size())
    {
        p += 3;
        trimmedPrefix = prefix.getSubName(0, p);
    }
    
    return p;
}
Beispiel #4
0
void VideoStreamImpl::publishManifest(ndn::Name dataName, PublishedDataPtrVector &segments)
{
    Manifest m(segments);
    dataName.append(NameComponents::NameComponentManifest).appendVersion(0);
    PublishedDataPtrVector ss = metadataPublisher_->publish(dataName, m);

    LogDebugC << (busyPublishing_ == 1 ? "⤷" : "↓")
              << " published manifest ☆ (" << dataName.getSubName(-5, 5) << ")x"
              << ss.size() << std::endl;
}
void
NdnRtcNamespace::appendStringComponent(ndn::Name &prefix,
                                       const std::string &stringComponent)
{
    prefix.append((const unsigned char*)stringComponent.c_str(),
                   stringComponent.size());
}
int NdnRtcNamespace::trimDataTypeComponent(const ndn::Name &prefix,
                                           Name &trimmedPrefix)
{
    trimmedPrefix = prefix;
    
    if (getPacketNumber(prefix) == -1)
        return -1;
    
    int p = -1;
    
    if (isParitySegmentPrefix(prefix))
    {
        p = findComponent(prefix, NameComponentFrameSegmentParity);
    }
    else
    {
        p = findComponent(prefix, NameComponentFrameSegmentData);
    }
    
    if (p > 0)
    {
        trimmedPrefix = prefix.getSubName(0, p);
    }
    
    return p;
}
Beispiel #7
0
//******************************************************************************
bool extractMeta(const ndn::Name& name, NamespaceInfo& info)
{
    // example: name == %FD%05/%00%00
    if (name.size() >= 1 && name[0].isVersion())
    {
        info.metaVersion_ = name[0].toVersion();
        if (name.size() >= 2)
        {
            info.segNo_ = name[1].toSegment();
            info.hasSegNo_ = true;
        }
        else
            info.hasSegNo_ = false;
        return true;
    }

    return false;
}
Beispiel #8
0
void
HelloProtocol::processInterest(const ndn::Name& name,
                               const ndn::Interest& interest)
{
  /* interest name: /<neighbor>/NLSR/INFO/<router> */
  const ndn::Name interestName = interest.getName();
  _LOG_DEBUG("Interest Received for Name: " << interestName);
  if (interestName.get(-2).toUri() != INFO_COMPONENT) {
    return;
  }
  ndn::Name neighbor;
  neighbor.wireDecode(interestName.get(-1).blockFromValue());
  _LOG_DEBUG("Neighbor: " << neighbor);
  if (m_nlsr.getAdjacencyList().isNeighbor(neighbor)) {
    ndn::shared_ptr<ndn::Data> data = ndn::make_shared<ndn::Data>();
    data->setName(ndn::Name(interest.getName()).appendVersion());
    data->setFreshnessPeriod(ndn::time::seconds(10)); // 10 sec
    data->setContent(reinterpret_cast<const uint8_t*>(INFO_COMPONENT.c_str()),
                    INFO_COMPONENT.size());
    m_nlsr.getKeyChain().sign(*data, m_nlsr.getDefaultCertName());
    _LOG_DEBUG("Sending out data for name: " << interest.getName());
    m_nlsr.getNlsrFace().put(*data);
    Adjacent *adjacent = m_nlsr.getAdjacencyList().findAdjacent(neighbor);
    // If this neighbor was previously inactive, send our own hello interest, too
    if (adjacent->getStatus() == Adjacent::STATUS_INACTIVE) {
      // We can only do that if the neighbor currently has a face.
      if(adjacent->getFaceId() != 0){
        /* interest name: /<neighbor>/NLSR/INFO/<router> */
        ndn::Name interestName(neighbor);
        interestName.append(NLSR_COMPONENT);
        interestName.append(INFO_COMPONENT);
        interestName.append(m_nlsr.getConfParameter().getRouterPrefix().wireEncode());
        expressInterest(interestName,
                        m_nlsr.getConfParameter().getInterestResendTime());
      }
      // If the originator of the Interest currently lacks a Face, we
      // need to give it one.
      else {
        registerPrefixes(adjacent->getName(), adjacent->getConnectingFaceUri(),
                         adjacent->getLinkCost(), ndn::time::milliseconds::max());
      }
    }
  }
}
Beispiel #9
0
int MediaThread::lookupPrefixInPit(const ndn::Name &prefix,
                                   SegmentData::SegmentMetaInfo &metaInfo)
{
    lock_guard<mutex> scopedLock(pitMutex_);
    
    std::map<Name, PitEntry>::iterator pitHit = pit_.find(prefix);
    
    // check for rightmost prefixes
    if (pitHit == pit_.end())
    {
        ndn::Name testPrefix(prefix);
        
        NdnRtcNamespace::trimPacketNumber(prefix, testPrefix);
        pitHit = pit_.find(testPrefix);
    }
    
    if (pitHit != pit_.end())
    {
        int64_t currentTime = NdnRtcUtils::millisecondTimestamp();
        
        shared_ptr<const Interest> pendingInterest = pitHit->second.interest_;
        
        metaInfo.interestNonce_ =
        NdnRtcUtils::blobToNonce(pendingInterest->getNonce());
        metaInfo.interestArrivalMs_ = pitHit->second.arrivalTimestamp_;
        metaInfo.generationDelayMs_ = (uint32_t)(currentTime - pitHit->second.arrivalTimestamp_);
        
        pit_.erase(pitHit);
        
        LogTraceC
        << "pit hit [" << prefix.toUri() << "] -> ["
        << pendingInterest->getName().toUri() << " (size "
        << pit_.size()  << ")]" << std::endl;
        
        return 1;
    }
    else
    {
        LogTraceC << "no pit entry " << prefix.toUri() << std::endl;
    }
    
    return 0;
}
Beispiel #10
0
bool NdnRtcNamespace::isDeltaFramesPrefix(const ndn::Name &prefix)
{
    std::string prefixString = prefix.toUri();
    
    int n1 = prefixString.find(NameComponentUserStreams);
    int n2 = prefixString.find(NameComponentStreamFrames);
    int n3 = prefixString.find(NameComponentStreamFramesDelta);
  
    return !(n1 == n2 == n3) &&
            n1 >= 0 && n1 < n2 && n2 < n3;
}
Beispiel #11
0
int NdnRtcNamespace::findComponent(const ndn::Name &prefix,
                                     const std::string &componentString)
{
    int pos = -1;
    int nComponents = prefix.size();
    Name::Component searchComponent((const uint8_t*)componentString.c_str(),
                                    componentString.size());
    
    for (int i = nComponents; i--; i >= 0)
    {
        Name::Component c = prefix.get(i);
        
        if (c == searchComponent)
        {
            pos = i;
            break;
        }
    }
    
    return pos;
}
Beispiel #12
0
unsigned int 
Buffer::getSlotsNum(const ndn::Name& prefix, int stateMask) const
{
    boost::lock_guard<boost::recursive_mutex> scopedLock(mutex_);
    unsigned int nSlots = 0;

    for (auto it:activeSlots_)
        if (prefix.match(it.first) && it.second->getState()&stateMask)
            nSlots++;

    return nSlots;
}
Beispiel #13
0
void
SyncLogicHandler::processUpdateFromSync(const ndn::Name& updateName,
                                        uint64_t seqNo,  Nlsr& pnlsr)
{
  string chkString("LSA");
  int32_t lasPosition = util::getNameComponentPosition(updateName, chkString);
  if (lasPosition >= 0) {
    ndn::Name routerName = updateName.getSubName(lasPosition + 1);
    processRoutingUpdateFromSync(routerName, seqNo, pnlsr);
    return;
  }
}
Beispiel #14
0
/**
 * @brief search a name component in ndn::Name and return the position of the component
 * @param name         where to search the searchString
 * @param searchString the string to search in name
 * @return -1 if searchString not found else return the position
 * starting from 0
 */
inline static int32_t
getNameComponentPosition(const ndn::Name& name, const std::string& searchString)
{
  ndn::name::Component component(searchString);
  size_t nameSize = name.size();
  for (uint32_t i = 0; i < nameSize; i++) {
    if (component == name[i]) {
      return (int32_t)i;
    }
  }
  return -1;
}
Beispiel #15
0
bool
NameComponents::extractInfo(const ndn::Name& name, NamespaceInfo& info)
{
    bool goodName = false;
    static Name ndnrtcSubName(NameComponents::NameComponentApp);
    Name subName;
    int i;

    for (i = name.size()-2; i > 0 && !goodName; --i)
    {
        subName = name.getSubName(i);
        goodName = ndnrtcSubName.match(subName);
    }

    if (goodName)
    {
        info.basePrefix_ = name.getSubName(0, i+1);

        if ((goodName = subName[1].isVersion()))
        {
            info.apiVersion_ = subName[1].toVersion();

            if (subName.size() > 2 &&
                (goodName = (subName[2] == Name::Component(NameComponents::NameComponentAudio) ||
                            subName[2] == Name::Component(NameComponents::NameComponentVideo)))  )
            {
                info.streamType_ = (subName[2] == Name::Component(NameComponents::NameComponentAudio) ? 
                                MediaStreamParams::MediaStreamType::MediaStreamTypeAudio : 
                                MediaStreamParams::MediaStreamType::MediaStreamTypeVideo );

                if (info.streamType_ == MediaStreamParams::MediaStreamType::MediaStreamTypeAudio)
                    return extractAudioStreamInfo(subName.getSubName(3), info);
                else
                    return extractVideoStreamInfo(subName.getSubName(3), info);
            }
        }
    }

    return false;
}
Beispiel #16
0
void
HelloProtocol::processInterestTimedOut(const ndn::Interest& interest)
{
  /* interest name: /<neighbor>/NLSR/INFO/<router> */
  const ndn::Name interestName(interest.getName());
  _LOG_DEBUG("Interest timed out for Name: " << interestName);
  if (interestName.get(-2).toUri() != INFO_COMPONENT) {
    return;
  }
  ndn::Name neighbor = interestName.getPrefix(-3);
  _LOG_DEBUG("Neighbor: " << neighbor);
  m_nlsr.getAdjacencyList().incrementTimedOutInterestCount(neighbor);
  int status = m_nlsr.getAdjacencyList().getStatusOfNeighbor(neighbor);
  uint32_t infoIntTimedOutCount =
    m_nlsr.getAdjacencyList().getTimedOutInterestCount(neighbor);
  _LOG_DEBUG("Status: " << status);
  _LOG_DEBUG("Info Interest Timed out: " << infoIntTimedOutCount);
  if ((infoIntTimedOutCount < m_nlsr.getConfParameter().getInterestRetryNumber())) {
    /* interest name: /<neighbor>/NLSR/INFO/<router> */
    ndn::Name interestName(neighbor);
    interestName.append(NLSR_COMPONENT);
    interestName.append(INFO_COMPONENT);
    interestName.append(m_nlsr.getConfParameter().getRouterPrefix().wireEncode());
    expressInterest(interestName,
                    m_nlsr.getConfParameter().getInterestResendTime());
  }
  else if ((status == 1) &&
           (infoIntTimedOutCount == m_nlsr.getConfParameter().getInterestRetryNumber())) {
    m_nlsr.getAdjacencyList().setStatusOfNeighbor(neighbor, 0);
    m_nlsr.incrementAdjBuildCount();
    if (m_nlsr.getIsBuildAdjLsaSheduled() == false) {
      _LOG_DEBUG("Scheduling scheduledAdjLsaBuild");
      m_nlsr.setIsBuildAdjLsaSheduled(true);
      // event here
      m_nlsr.getScheduler().scheduleEvent(ndn::time::seconds(5),
                                          ndn::bind(&Lsdb::scheduledAdjLsaBuild,
                                                    &m_nlsr.getLsdb()));
    }
  }
}
Beispiel #17
0
void
HelloProtocol::processInterest(const ndn::Name& name,
                               const ndn::Interest& interest)
{
  /* interest name: /<neighbor>/NLSR/INFO/<router> */
  const ndn::Name interestName = interest.getName();
  _LOG_DEBUG("Interest Received for Name: " << interestName);
  if (interestName.get(-2).toUri() != INFO_COMPONENT) {
    return;
  }
  ndn::Name neighbor;
  neighbor.wireDecode(interestName.get(-1).blockFromValue());
  _LOG_DEBUG("Neighbor: " << neighbor);
  if (m_nlsr.getAdjacencyList().isNeighbor(neighbor)) {
    ndn::shared_ptr<ndn::Data> data = ndn::make_shared<ndn::Data>();
    data->setName(ndn::Name(interest.getName()).appendVersion());
    data->setFreshnessPeriod(ndn::time::seconds(10)); // 10 sec
    data->setContent(reinterpret_cast<const uint8_t*>(INFO_COMPONENT.c_str()),
                    INFO_COMPONENT.size());
    m_nlsr.getKeyChain().sign(*data, m_nlsr.getDefaultCertName());
    _LOG_DEBUG("Sending out data for name: " << interest.getName());
    m_nlsr.getNlsrFace().put(*data);
    Adjacent *adjacent = m_nlsr.getAdjacencyList().findAdjacent(neighbor);
    if (adjacent->getStatus() == 0) {
      if(adjacent->getFaceId() != 0){
        /* interest name: /<neighbor>/NLSR/INFO/<router> */
        ndn::Name interestName(neighbor);
        interestName.append(NLSR_COMPONENT);
        interestName.append(INFO_COMPONENT);
        interestName.append(m_nlsr.getConfParameter().getRouterPrefix().wireEncode());
        expressInterest(interestName,
                        m_nlsr.getConfParameter().getInterestResendTime());
      }
      else {
        registerPrefixes(adjacent->getName(), adjacent->getConnectingFaceUri(),
                         adjacent->getLinkCost(), ndn::time::milliseconds::max());
      }
    }
  }
}
Beispiel #18
0
bool NdnRtcNamespace::trimmedLookupPrefix(const ndn::Name &prefix,
                                          ndn::Name &trimmedPrefix)
{
    trimmedPrefix = prefix;
    
    bool res = false;
    std::string prefixString = prefix.toUri();
    int n1 = prefixString.find(NameComponentUserStreams);
    int n2 = prefixString.find(NameComponentStreamFrames);
    int n3 = prefixString.find(NameComponentStreamFramesKey);
    int n4 = prefixString.find(NameComponentStreamFramesDelta);
    
    if (!(n1 == n2 == n3 == n4) &&
        n1 >= 0 && n1 < n2 &&
        (n2 < n3 || n2 < n4))
    {
        int p1 = prefixString.find(NameComponentFrameSegmentData);
        int p2 = prefixString.find(NameComponentFrameSegmentParity);
        
        if (!(p1 == p2))
        {
            int p = -1;
            
            if (p1 == std::string::npos)
                p = findComponent(prefix, NameComponentFrameSegmentParity);
            else
                p = findComponent(prefix, NameComponentFrameSegmentData);
            
            trimmedPrefix = prefix.getSubName(0, p);
        }
        
        res = true;
    }
    
    return res;
}
Beispiel #19
0
SegmentNumber NdnRtcNamespace::getSegmentNumber(const ndn::Name &prefix)
{
    PacketNumber segmentNo = -1;
    int p = -1;
    
    if (isDeltaFramesPrefix(prefix))
    {
        p = findComponent(prefix, NameComponentStreamFramesDelta);
    }
    else if (isKeyFramePrefix(prefix))
    {
        p = findComponent(prefix, NameComponentStreamFramesKey);
    }
    
    
    if (p > 0 &&
        p+3 < prefix.size())
    {
        Name::Component segmentNoComp = prefix.get(p+3);
        segmentNo = NdnRtcUtils::segmentNumber(segmentNoComp);
    }
    
    return segmentNo;
}
Beispiel #20
0
bool NdnRtcNamespace::hasComponent(const ndn::Name &prefix,
                                   const std::string &componentString,
                                   bool isClosed)
{
    string prefixStr = prefix.toUri();
    string searchStr(componentString);
    
    if (searchStr[0] != '/')
        searchStr.insert(0, "/");
    
    if (isClosed &&
        searchStr[searchStr.size()-1] != '/')
        searchStr.append("/");

    return prefixStr.find(searchStr) != std::string::npos;
}
    void
    runScripts(ndn::Name& interestName)
    {
        std::string result, tmpString;
        std::string prefix = "./";
        FILE* pipe;
        const char* cmd;
        char buf[BUF_SIZE];

        while (!m_scriptsList.empty())
        {
            tmpString = prefix + m_scriptsList.front() + ' ' + interestName.toUri();
            cmd = tmpString.c_str();

            if(DEBUG) std::cout << "running " << cmd << std::endl;

            pipe = popen(cmd, "r");
            if (!pipe)
                std::cerr << "Unable to run " << cmd << " - is the script in the nfdDataCollection directory?" << std::endl;

            result = "";
            while(!feof(pipe))
            {
                if(fgets(buf, BUF_SIZE, pipe) != NULL)
                    result += buf;
            }
            pclose(pipe);
            m_scriptsList.pop_front();

            if(DEBUG) std::cout <<  "Got data: " << result << std::endl;

            // generate data packet containing script data
            ScriptReply script_reply;
            script_reply.setData(result);
            ndn::shared_ptr<ndn::Data> data = ndn::make_shared<ndn::Data>(interestName);
            data->setContent(script_reply.wireEncode());
            data->setFreshnessPeriod(time::seconds(0));

            m_keyChain.sign(*data);
            m_face.put(*data);
        }
    }
    void
    onInterest(const ndn::Name& name, const ndn::Interest& interest)
    {
        ndn::Name interestName(interest.getName());

        if(DEBUG)
            std::cout << "received interest: " << interest.getName() << std::endl;

        //run scripts if requested by server
        ndn::Name cmpName(getFilter()+SCRIPT_SUFFIX);
        int num_components = cmpName.size();
        if(cmpName.isPrefixOf(interestName))
        {
            int numberOfComponents = interestName.size();
            for(int i = num_components; i < numberOfComponents; ++i)
            {
                m_scriptsList.push_front(interestName[i].toUri());
            }
            runScripts(interestName);
        }
        else
        {
            int numberOfComponents = interestName.size();
            if(!m_remoteLinks.empty())
            {
                std::cerr << "remote links list is not empty - check for a missing reports!!" << std::endl;
                m_remoteLinks.clear();
            }
            for(int i = name.size(); i < numberOfComponents; ++i)
            {
                m_remoteLinks.insert(interestName[i].toUri());
            }

            // ask for local status
            fetchFaceStatusInformation(interestName);
        }
    }
Beispiel #23
0
int NdnRtcNamespace::trimPacketNumber(const ndn::Name &prefix,
                                       Name &trimmedPrefix)
{
    trimmedPrefix = prefix;
    
    int p = -1;
    
    if (isDeltaFramesPrefix(prefix))
    {
        p = findComponent(prefix, NameComponentStreamFramesDelta);
    }
    else if (isKeyFramePrefix(prefix))
    {
        p = findComponent(prefix, NameComponentStreamFramesKey);
    }
    
    if (p > 0)
    {
        p += 1;
        trimmedPrefix = prefix.getSubName(0, p);
    }
    
    return p;
}
Beispiel #24
0
bool extractAudioStreamInfo(const ndn::Name& name, NamespaceInfo& info)
{
    if (name.size() == 1)
    {
        info.streamName_ = name[0].toEscapedString();
        return true;
    }

    if (name.size() == 2 && name[1].isTimestamp())
    {
        info.streamName_ = name[0].toEscapedString();
        info.streamTimestamp_ = name[1].toTimestamp();
        return true;
    }

    if (name.size() < 2)
        return false;

    int idx = 0;
    info.streamName_ = name[idx++].toEscapedString();
    info.isMeta_ = (name[idx++] == Name::Component(NameComponents::NameComponentMeta));
    
    if (info.isMeta_)
    {
        info.segmentClass_ = SegmentClass::Meta;
        if (name.size() < idx+1)
            return false;

        info.threadName_ = "";
        return extractMeta(name.getSubName(idx), info);;
    }
    else
    {
        info.class_ = SampleClass::Unknown;
        info.segmentClass_ = SegmentClass::Unknown;
        info.streamTimestamp_ = name[idx-1].toTimestamp();
        info.threadName_ = name[idx++].toEscapedString();

        if (name.size() == 3)
        {
            info.hasSeqNo_ = false;
            return true;
        }

        info.isMeta_ = (name[idx] == Name::Component(NameComponents::NameComponentMeta));

        if (info.isMeta_)
        { 
            info.segmentClass_ = SegmentClass::Meta;
            if (name.size() > idx+1 && extractMeta(name.getSubName(idx+1), info))
                return true;
            return false;
        }

        info.isDelta_ = true;
        info.class_ = SampleClass::Delta;

        try
        {
            if (name.size() > 3)
                info.sampleNo_ = (PacketNumber)name[idx++].toSequenceNumber();
            
            info.hasSeqNo_ = true;
            if (name.size() > idx)
            {
                if (name[idx] == Name::Component(NameComponents::NameComponentManifest))
                    info.segmentClass_ = SegmentClass::Manifest;
                else
                {
                    info.hasSegNo_ = true;
                    info.segmentClass_ = SegmentClass::Data;
                    info.segNo_ = name[idx].toSegment();
                }
                return true;
            }
            else
            {
                info.hasSegNo_ = false;
                return true;
            }
        }
        catch (std::runtime_error& e)
        {
            return false;
        }
    }

    return false;
}
Beispiel #25
0
bool extractVideoStreamInfo(const ndn::Name& name, NamespaceInfo& info)
{
    if (name.size() == 1)
    {
        info.streamName_ = name[0].toEscapedString();
        return true;
    }

    if (name.size() == 2 && name[1].isTimestamp())
    {
        info.streamName_ = name[0].toEscapedString();
        info.streamTimestamp_ = name[1].toTimestamp();
        return true;
    }

    if (name.size() < 3)
        return false;

    int idx = 0;
    info.streamName_ = name[idx++].toEscapedString();
    info.isMeta_ = (name[idx++] == Name::Component(NameComponents::NameComponentMeta));

    if (info.isMeta_)
    {   // example: name == camera/_meta/%FD%05/%00%00
        info.segmentClass_ = SegmentClass::Meta;
        info.threadName_ = "";
        return extractMeta(name.getSubName(idx), info);
    }
    else
    {   // example: name == camera/%FC%00%00%01c_%27%DE%D6/hi/d/%FE%07/%00%00

        info.class_ = SampleClass::Unknown;
        info.segmentClass_ = SegmentClass::Unknown;
        info.streamTimestamp_ = name[idx-1].toTimestamp();
        info.threadName_ = name[idx++].toEscapedString();
        
        if (name.size() <= idx)
            return true;

        info.isMeta_ = (name[idx++] == Name::Component(NameComponents::NameComponentMeta));

        if (info.isMeta_)
        {   // example: camera/%FC%00%00%01c_%27%DE%D6/hi/_meta/%FD%05/%00%00
            info.segmentClass_ = SegmentClass::Meta;
            if(name.size() > idx-1 && extractMeta(name.getSubName(idx), info))
                return true;
            return false;
        }

        if (name[idx-1] == Name::Component(NameComponents::NameComponentDelta) || 
            name[idx-1] == Name::Component(NameComponents::NameComponentKey))
        {
            info.isDelta_ = (name[idx-1] == Name::Component(NameComponents::NameComponentDelta));
            info.class_ = (info.isDelta_ ? SampleClass::Delta : SampleClass::Key);

            try{
                if (name.size() > idx)
                    info.sampleNo_ = (PacketNumber)name[idx++].toSequenceNumber();
                else
                {
                    info.hasSeqNo_ = false;
                    return true;
                }
            
                info.hasSeqNo_ = true;
                if (name.size() > idx)
                {
                    info.isParity_ = (name[idx] == Name::Component(NameComponents::NameComponentParity));
                    info.hasSegNo_ = true;

                    if (info.isParity_ && name.size() > idx+1)
                    {
                        info.segmentClass_ = SegmentClass::Parity;
                        info.segNo_ = name[idx+1].toSegment();
                        return true;
                    }
                    else 
                    {
                        if (info.isParity_) 
                            return false;
                        else
                        {
                            if (name[idx] == Name::Component(NameComponents::NameComponentManifest))
                                info.segmentClass_ = SegmentClass::Manifest;
                            else
                            {
                                info.segmentClass_ = SegmentClass::Data;
                                info.segNo_ = name[idx].toSegment();
                            }
                        }
                        return true;
                    }
                }
                else
                {
                    info.segmentClass_ = SegmentClass::Unknown;
                    info.hasSegNo_ = false;
                    return true;
                }
            }
            catch (std::runtime_error& e)
            {
                return false;
            }
        }
    }

    return false;
}