当前位置: 首页>>代码示例>>C++>>正文


C++ EncodingImpl::prependByteArrayBlock方法代码示例

本文整理汇总了C++中EncodingImpl::prependByteArrayBlock方法的典型用法代码示例。如果您正苦于以下问题:C++ EncodingImpl::prependByteArrayBlock方法的具体用法?C++ EncodingImpl::prependByteArrayBlock怎么用?C++ EncodingImpl::prependByteArrayBlock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EncodingImpl的用法示例。


在下文中一共展示了EncodingImpl::prependByteArrayBlock方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: wireEncode

 size_t
 wireEncode(EncodingImpl<T>& encoder) const
 {
   size_t totalLength = 0;
   
   totalLength += prependNonNegativeIntegerBlock(encoder,
                                                 ndn::statusCollector::tlv::RX,
                                                 m_rx);
   
   totalLength += prependNonNegativeIntegerBlock(encoder,
                                                 ndn::statusCollector::tlv::TX,
                                                 m_tx);
   
   totalLength += prependNonNegativeIntegerBlock(encoder,
                                                 ndn::statusCollector::tlv::FaceId,
                                                 m_faceId);
   
   totalLength += encoder.prependByteArrayBlock(ndn::statusCollector::tlv::LinkIp,
                                        reinterpret_cast<const uint8_t*>(m_linkIp.c_str()), m_linkIp.size());
   
   totalLength += encoder.prependByteArrayBlock(ndn::statusCollector::tlv::CurrentTime,
                                        reinterpret_cast<const uint8_t*>(m_timestamp.c_str()), m_timestamp.size());
   
   
   totalLength += encoder.prependVarNumber(totalLength);
   totalLength += encoder.prependVarNumber(statusCollector::tlv::FaceStatus);
   return totalLength;
 }
开发者ID:WU-ARL,项目名称:ndnTestbedDataCollector,代码行数:28,代码来源:ndnTestbedDataCollector.hpp

示例2: prependNonNegativeIntegerBlock

size_t
FaceEventNotification::wireEncode(EncodingImpl<TAG>& encoder) const
{
  size_t totalLength = 0;

  totalLength += prependNonNegativeIntegerBlock(encoder,
                 tlv::nfd::Flags, m_flags);
  totalLength += prependNonNegativeIntegerBlock(encoder,
                 tlv::nfd::LinkType, m_linkType);
  totalLength += prependNonNegativeIntegerBlock(encoder,
                 tlv::nfd::FacePersistency, m_facePersistency);
  totalLength += prependNonNegativeIntegerBlock(encoder,
                 tlv::nfd::FaceScope, m_faceScope);
  totalLength += encoder.prependByteArrayBlock(tlv::nfd::LocalUri,
                 reinterpret_cast<const uint8_t*>(m_localUri.c_str()), m_localUri.size());
  totalLength += encoder.prependByteArrayBlock(tlv::nfd::Uri,
                 reinterpret_cast<const uint8_t*>(m_remoteUri.c_str()), m_remoteUri.size());
  totalLength += prependNonNegativeIntegerBlock(encoder,
                 tlv::nfd::FaceId, m_faceId);
  totalLength += prependNonNegativeIntegerBlock(encoder,
                 tlv::nfd::FaceEventKind, m_kind);

  totalLength += encoder.prependVarNumber(totalLength);
  totalLength += encoder.prependVarNumber(tlv::nfd::FaceEventNotification);
  return totalLength;
}
开发者ID:named-data-ndnSIM,项目名称:ndn-cxx,代码行数:26,代码来源:face-event-notification.cpp

示例3: prependNonNegativeIntegerBlock

size_t
Interest::encode03(EncodingImpl<TAG>& encoder) const
{
  size_t totalLength = 0;

  // Encode as NDN Packet Format v0.3
  // Interest ::= INTEREST-TYPE TLV-LENGTH
  //                Name
  //                CanBePrefix?
  //                MustBeFresh?
  //                ForwardingHint?
  //                Nonce?
  //                InterestLifetime?
  //                HopLimit?
  //                ApplicationParameters?

  // (reverse encoding)

  // ApplicationParameters
  if (hasApplicationParameters()) {
    totalLength += encoder.prependBlock(getApplicationParameters());
  }

  // HopLimit: not yet supported

  // InterestLifetime
  if (getInterestLifetime() != DEFAULT_INTEREST_LIFETIME) {
    totalLength += prependNonNegativeIntegerBlock(encoder, tlv::InterestLifetime,
                                                  static_cast<uint64_t>(getInterestLifetime().count()));
  }

  // Nonce
  uint32_t nonce = getNonce(); // if nonce was unset, getNonce generates a random nonce
  totalLength += encoder.prependByteArrayBlock(tlv::Nonce, reinterpret_cast<uint8_t*>(&nonce), sizeof(nonce));

  // ForwardingHint
  if (!getForwardingHint().empty()) {
    totalLength += getForwardingHint().wireEncode(encoder);
  }

  // MustBeFresh
  if (getMustBeFresh()) {
    totalLength += prependEmptyBlock(encoder, tlv::MustBeFresh);
  }

  // CanBePrefix
  if (getCanBePrefix()) {
    totalLength += prependEmptyBlock(encoder, tlv::CanBePrefix);
  }

  // Name
  totalLength += getName().wireEncode(encoder);

  totalLength += encoder.prependVarNumber(totalLength);
  totalLength += encoder.prependVarNumber(tlv::Interest);
  return totalLength;
}
开发者ID:named-data,项目名称:ndn-cxx,代码行数:57,代码来源:interest.cpp

示例4: prependNonNegativeIntegerBlock

size_t
FaceStatus::wireEncode(EncodingImpl<TAG>& encoder) const
{
  size_t totalLength = 0;

  totalLength += prependNonNegativeIntegerBlock(encoder,
                 tlv::nfd::Flags, m_flags);
  totalLength += prependNonNegativeIntegerBlock(encoder,
                 tlv::nfd::NOutBytes, m_nOutBytes);
  totalLength += prependNonNegativeIntegerBlock(encoder,
                 tlv::nfd::NInBytes, m_nInBytes);
  totalLength += prependNonNegativeIntegerBlock(encoder,
                 tlv::nfd::NOutNacks, m_nOutNacks);
  totalLength += prependNonNegativeIntegerBlock(encoder,
                 tlv::nfd::NOutDatas, m_nOutDatas);
  totalLength += prependNonNegativeIntegerBlock(encoder,
                 tlv::nfd::NOutInterests, m_nOutInterests);
  totalLength += prependNonNegativeIntegerBlock(encoder,
                 tlv::nfd::NInNacks, m_nInNacks);
  totalLength += prependNonNegativeIntegerBlock(encoder,
                 tlv::nfd::NInDatas, m_nInDatas);
  totalLength += prependNonNegativeIntegerBlock(encoder,
                 tlv::nfd::NInInterests, m_nInInterests);
  totalLength += prependNonNegativeIntegerBlock(encoder,
                 tlv::nfd::LinkType, m_linkType);
  totalLength += prependNonNegativeIntegerBlock(encoder,
                 tlv::nfd::FacePersistency, m_facePersistency);
  totalLength += prependNonNegativeIntegerBlock(encoder,
                 tlv::nfd::FaceScope, m_faceScope);
  if (m_hasExpirationPeriod) {
    totalLength += prependNonNegativeIntegerBlock(encoder,
                   tlv::nfd::ExpirationPeriod, m_expirationPeriod.count());
  }
  totalLength += encoder.prependByteArrayBlock(tlv::nfd::LocalUri,
                 reinterpret_cast<const uint8_t*>(m_localUri.c_str()), m_localUri.size());
  totalLength += encoder.prependByteArrayBlock(tlv::nfd::Uri,
                 reinterpret_cast<const uint8_t*>(m_remoteUri.c_str()), m_remoteUri.size());
  totalLength += prependNonNegativeIntegerBlock(encoder,
                 tlv::nfd::FaceId, m_faceId);

  totalLength += encoder.prependVarNumber(totalLength);
  totalLength += encoder.prependVarNumber(tlv::nfd::FaceStatus);
  return totalLength;
}
开发者ID:named-data-ndnSIM,项目名称:ndn-cxx,代码行数:44,代码来源:face-status.cpp

示例5: prependNonNegativeIntegerBlock

size_t
FaceQueryFilter::wireEncode(EncodingImpl<TAG>& encoder) const
{
  size_t totalLength = 0;

  if (m_hasLinkType) {
    totalLength += prependNonNegativeIntegerBlock(encoder,
                   tlv::nfd::LinkType, m_linkType);
  }

  if (m_hasFacePersistency) {
    totalLength += prependNonNegativeIntegerBlock(encoder,
                   tlv::nfd::FacePersistency, m_facePersistency);
  }

  if (m_hasFaceScope) {
    totalLength += prependNonNegativeIntegerBlock(encoder,
                   tlv::nfd::FaceScope, m_faceScope);
  }

  if (m_hasLocalUri) {
    totalLength += encoder.prependByteArrayBlock(tlv::nfd::LocalUri,
                   reinterpret_cast<const uint8_t*>(m_localUri.c_str()), m_localUri.size());
  }

  if (m_hasRemoteUri) {
    totalLength += encoder.prependByteArrayBlock(tlv::nfd::Uri,
                   reinterpret_cast<const uint8_t*>(m_remoteUri.c_str()), m_remoteUri.size());
  }

  if (m_hasUriScheme) {
    totalLength += encoder.prependByteArrayBlock(tlv::nfd::UriScheme,
                   reinterpret_cast<const uint8_t*>(m_uriScheme.c_str()), m_uriScheme.size());
  }

  if (m_hasFaceId) {
    totalLength += prependNonNegativeIntegerBlock(encoder,
                   tlv::nfd::FaceId, m_faceId);
  }

  totalLength += encoder.prependVarNumber(totalLength);
  totalLength += encoder.prependVarNumber(tlv::nfd::FaceQueryFilter);
  return totalLength;
}
开发者ID:named-data-ndnSIM,项目名称:ndn-cxx,代码行数:44,代码来源:face-query-filter.cpp

示例6: getForwardingHint

size_t
Interest::encode02(EncodingImpl<TAG>& encoder) const
{
  size_t totalLength = 0;

  // Encode as NDN Packet Format v0.2
  // Interest ::= INTEREST-TYPE TLV-LENGTH
  //                Name
  //                Selectors?
  //                Nonce
  //                InterestLifetime?
  //                ForwardingHint?

  // (reverse encoding)

  // ForwardingHint
  if (getForwardingHint().size() > 0) {
    totalLength += getForwardingHint().wireEncode(encoder);
  }

  // InterestLifetime
  if (getInterestLifetime() != DEFAULT_INTEREST_LIFETIME) {
    totalLength += prependNonNegativeIntegerBlock(encoder, tlv::InterestLifetime,
                                                  static_cast<uint64_t>(getInterestLifetime().count()));
  }

  // Nonce
  uint32_t nonce = getNonce(); // if nonce was unset, getNonce generates a random nonce
  totalLength += encoder.prependByteArrayBlock(tlv::Nonce, reinterpret_cast<uint8_t*>(&nonce), sizeof(nonce));

  // Selectors
  if (hasSelectors()) {
    totalLength += getSelectors().wireEncode(encoder);
  }

  // Name
  totalLength += getName().wireEncode(encoder);

  totalLength += encoder.prependVarNumber(totalLength);
  totalLength += encoder.prependVarNumber(tlv::Interest);
  return totalLength;
}
开发者ID:named-data,项目名称:ndn-cxx,代码行数:42,代码来源:interest.cpp

示例7:

inline size_t
prependByteArrayBlock(EncodingImpl<TAG>& encoder,
                      uint32_t type, const uint8_t* array, size_t arraySize)
{
  return encoder.prependByteArrayBlock(type, array, arraySize);
}
开发者ID:AaronTien,项目名称:ndn-cxx,代码行数:6,代码来源:block-helpers.hpp


注:本文中的EncodingImpl::prependByteArrayBlock方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。