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 += prependStringBlock(encoder, tlv::nfd::LocalUri, m_localUri);
  totalLength += prependStringBlock(encoder, tlv::nfd::Uri, m_remoteUri);
  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;
}
size_t
AdditionalDescription::wireEncode(EncodingImpl<TAG>& encoder) const
{
    size_t totalLength = 0;

    for (auto it = m_info.rbegin(); it != m_info.rend(); it++) {
        size_t entryLength = 0;
        entryLength += prependStringBlock(encoder, tlv::DescriptionValue, it->second);
        entryLength += prependStringBlock(encoder, tlv::DescriptionKey, it->first);
        entryLength += encoder.prependVarNumber(entryLength);
        entryLength += encoder.prependVarNumber(tlv::DescriptionEntry);

        totalLength += entryLength;
    }

    totalLength += encoder.prependVarNumber(totalLength);
    totalLength += encoder.prependVarNumber(tlv::AdditionalDescription);
    return totalLength;
}
size_t
FaceQueryFilter::wireEncode(EncodingImpl<TAG>& encoder) const
{
  size_t totalLength = 0;

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

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

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

  if (hasLocalUri()) {
    totalLength += prependStringBlock(encoder, tlv::nfd::LocalUri, m_localUri);
  }

  if (hasRemoteUri()) {
    totalLength += prependStringBlock(encoder, tlv::nfd::Uri, m_remoteUri);
  }

  if (hasUriScheme()) {
    totalLength += prependStringBlock(encoder, tlv::nfd::UriScheme, m_uriScheme);
  }

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

  totalLength += encoder.prependVarNumber(totalLength);
  totalLength += encoder.prependVarNumber(tlv::nfd::FaceQueryFilter);
  return totalLength;
}