shared_ptr<Data> Response::toData() { Name name; name.append(m_zone) .append(m_queryType) .append(m_rrLabel) .append(m_rrType); if (m_version.empty()) { name.appendVersion(); m_version = name.get(-1); } else { name.append(m_version); } shared_ptr<Data> data = make_shared<Data>(name); if (m_contentType != NDNS_BLOB && m_contentType != NDNS_KEY) { data->setContent(this->wireEncode()); } else { data->setContent(m_appContent); } data->setFreshnessPeriod(m_freshnessPeriod); data->setContentType(m_contentType); return data; }
Name NamespaceInfo::getSuffix(int filter) const { using namespace suffix_filter; Name suffix; if (filter) { if (filter&(Library^Stream)) suffix.append(Name(NameComponents::NameComponentApp)).appendVersion(apiVersion_); if (filter&(Stream^Thread)) { suffix.append((streamType_ == MediaStreamParams::MediaStreamType::MediaStreamTypeAudio ? NameComponents::NameComponentAudio : NameComponents::NameComponentVideo)).append(streamName_); if (threadName_ != "") suffix.appendTimestamp(streamTimestamp_); } if (filter&(Thread^Sample) && threadName_ != "") suffix.append(threadName_); if (isMeta_) { if ((filter&(Thread^Sample) && threadName_ != "") || filter&(Stream^Thread)) suffix.append(NameComponents::NameComponentMeta); } if (filter&(Thread^Sample) && threadName_ != "" && streamType_ == MediaStreamParams::MediaStreamType::MediaStreamTypeVideo && !isMeta_) suffix.append((class_ == SampleClass::Delta ? NameComponents::NameComponentDelta : NameComponents::NameComponentKey)); if (filter&(Sample^Segment)) { if (isMeta_) suffix.appendVersion(metaVersion_); else suffix.appendSequenceNumber(sampleNo_); } if (filter&(Segment) && hasSegNo_) { if (isParity_) suffix.append(NameComponents::NameComponentParity); suffix.appendSegment(segNo_); } } return suffix; }