void
  publish()
  {
    ndn::EncodingBuffer buffer;
    generate(buffer);

    const uint8_t* rawBuffer = buffer.buf();
    const uint8_t* segmentBegin = rawBuffer;
    const uint8_t* end = rawBuffer + buffer.size();

    Name segmentPrefix(m_prefix);
    segmentPrefix.appendVersion();

    uint64_t segmentNo = 0;
    do {
      const uint8_t* segmentEnd = segmentBegin + getMaxSegmentSize();
      if (segmentEnd > end) {
        segmentEnd = end;
      }

      Name segmentName(segmentPrefix);
      segmentName.appendSegment(segmentNo);

      shared_ptr<Data> data = make_shared<Data>(segmentName);
      data->setContent(segmentBegin, segmentEnd - segmentBegin);

      segmentBegin = segmentEnd;
      if (segmentBegin >= end) {
        data->setFinalBlockId(segmentName[-1]);
      }

      publishSegment(data);
      ++segmentNo;
    } while (segmentBegin < end);
  }
Exemple #2
0
char *wb_nrep::normSegment( int idx, char *res)
{
  return segmentName( norm_name, idx, res);
}
Exemple #3
0
char *wb_nrep::segment( int idx, char *res)
{
  return segmentName( oname, idx, res);
}