util: remove ndn::optional, use std::optional directly
Change-Id: I503e8f250e80e0ff7708070effc2e84e3b38b3b7
This commit is contained in:
1 parent
a2fbc35f12
commit
f6b458930f
64 files changed
+292
-2166
No files matched your search
@@ -9,9 +9,6 @@ ndn-cxx relies on third-party software, licensed under the following licenses:
|
||||
- OpenSSL is licensed under the
|
||||
[Apache License 2.0](https://www.openssl.org/source/license.html)
|
||||
|
||||
- optional-lite by Martin Moene is licensed under the
|
||||
[Boost Software License 1.0](https://github.com/martinmoene/optional-lite/blob/master/LICENSE.txt)
|
||||
|
||||
- scope-lite by Martin Moene is licensed under the
|
||||
[Boost Software License 1.0](https://github.com/martinmoene/scope-lite/blob/master/LICENSE.txt)
|
||||
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -351,7 +351,7 @@ Data::setFreshnessPeriod(time::milliseconds freshnessPeriod)
|
||||
}
|
||||
|
||||
Data&
|
||||
Data::setFinalBlock(optional<name::Component> finalBlockId)
|
||||
Data::setFinalBlock(std::optional<name::Component> finalBlockId)
|
||||
{
|
||||
if (finalBlockId != m_metaInfo.getFinalBlock()) {
|
||||
m_metaInfo.setFinalBlock(std::move(finalBlockId));
|
||||
|
||||
+8
-5
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -299,14 +299,14 @@ public: // MetaInfo fields
|
||||
Data&
|
||||
setFreshnessPeriod(time::milliseconds freshnessPeriod);
|
||||
|
||||
const optional<name::Component>&
|
||||
const std::optional<name::Component>&
|
||||
getFinalBlock() const
|
||||
{
|
||||
return m_metaInfo.getFinalBlock();
|
||||
}
|
||||
|
||||
Data&
|
||||
setFinalBlock(optional<name::Component> finalBlockId);
|
||||
setFinalBlock(std::optional<name::Component> finalBlockId);
|
||||
|
||||
public: // SignatureInfo fields
|
||||
/**
|
||||
@@ -322,10 +322,13 @@ public: // SignatureInfo fields
|
||||
/**
|
||||
* @brief Get the `KeyLocator` element.
|
||||
*/
|
||||
optional<KeyLocator>
|
||||
std::optional<KeyLocator>
|
||||
getKeyLocator() const noexcept
|
||||
{
|
||||
return m_signatureInfo.hasKeyLocator() ? make_optional(m_signatureInfo.getKeyLocator()) : nullopt;
|
||||
if (m_signatureInfo.hasKeyLocator()) {
|
||||
return m_signatureInfo.getKeyLocator();
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
@@ -54,7 +54,6 @@
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <iosfwd>
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -22,7 +22,9 @@
|
||||
#ifndef NDN_CXX_ENCODING_NFD_CONSTANTS_HPP
|
||||
#define NDN_CXX_ENCODING_NFD_CONSTANTS_HPP
|
||||
|
||||
#include "ndn-cxx/detail/common.hpp"
|
||||
#include <cstdint>
|
||||
#include <iosfwd>
|
||||
#include <limits>
|
||||
|
||||
namespace ndn {
|
||||
namespace nfd {
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
#include <cstring>
|
||||
#include <iterator>
|
||||
#include <limits>
|
||||
#include <ostream>
|
||||
#include <vector>
|
||||
|
||||
@@ -168,7 +169,7 @@ isCriticalType(uint32_t type) noexcept
|
||||
* @brief Read VAR-NUMBER in NDN-TLV encoding.
|
||||
* @tparam Iterator an iterator or pointer that dereferences to uint8_t or compatible type
|
||||
*
|
||||
* @param [inout] begin Begin of the buffer, will be incremented to point to the first byte after
|
||||
* @param[in,out] begin Begin of the buffer, will be incremented to point to the first byte after
|
||||
* the read VAR-NUMBER
|
||||
* @param[in] end End of the buffer
|
||||
* @param[out] number Read VAR-NUMBER
|
||||
@@ -183,7 +184,7 @@ readVarNumber(Iterator& begin, Iterator end, uint64_t& number) noexcept;
|
||||
* @brief Read TLV-TYPE.
|
||||
* @tparam Iterator an iterator or pointer that dereferences to uint8_t or compatible type
|
||||
*
|
||||
* @param [inout] begin Begin of the buffer, will be incremented to point to the first byte after
|
||||
* @param[in,out] begin Begin of the buffer, will be incremented to point to the first byte after
|
||||
* the read TLV-TYPE
|
||||
* @param[in] end End of the buffer
|
||||
* @param[out] type Read TLV-TYPE
|
||||
@@ -200,7 +201,7 @@ readType(Iterator& begin, Iterator end, uint32_t& type) noexcept;
|
||||
* @brief Read VAR-NUMBER in NDN-TLV encoding.
|
||||
* @tparam Iterator an iterator or pointer that dereferences to uint8_t or compatible type
|
||||
*
|
||||
* @param [inout] begin Begin of the buffer, will be incremented to point to the first byte after
|
||||
* @param[in,out] begin Begin of the buffer, will be incremented to point to the first byte after
|
||||
* the read VAR-NUMBER
|
||||
* @param[in] end End of the buffer
|
||||
*
|
||||
@@ -214,7 +215,7 @@ readVarNumber(Iterator& begin, Iterator end);
|
||||
* @brief Read TLV-TYPE.
|
||||
* @tparam Iterator an iterator or pointer that dereferences to uint8_t or compatible type
|
||||
*
|
||||
* @param [inout] begin Begin of the buffer, will be incremented to point to the first byte after
|
||||
* @param[in,out] begin Begin of the buffer, will be incremented to point to the first byte after
|
||||
* the read TLV-TYPE
|
||||
* @param[in] end End of the buffer
|
||||
*
|
||||
@@ -244,7 +245,7 @@ writeVarNumber(std::ostream& os, uint64_t number);
|
||||
* @tparam Iterator an iterator or pointer that dereferences to uint8_t or compatible type
|
||||
*
|
||||
* @param[in] size size of the NonNegativeInteger
|
||||
* @param [inout] begin Begin of the buffer, will be incremented to point to the first byte after
|
||||
* @param[in,out] begin Begin of the buffer, will be incremented to point to the first byte after
|
||||
* the read NonNegativeInteger
|
||||
* @param[in] end End of the buffer
|
||||
*
|
||||
|
||||
+2
-3
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "ndn-cxx/encoding/tlv.hpp"
|
||||
#include "ndn-cxx/impl/face-impl.hpp"
|
||||
#include "ndn-cxx/net/face-uri.hpp"
|
||||
#include "ndn-cxx/security/signing-helpers.hpp"
|
||||
#include "ndn-cxx/util/config-file.hpp"
|
||||
#include "ndn-cxx/util/scope.hpp"
|
||||
#include "ndn-cxx/util/time.hpp"
|
||||
@@ -252,7 +251,7 @@ Face::registerPrefix(const Name& prefix,
|
||||
nfd::CommandOptions options;
|
||||
options.setSigningInfo(signingInfo);
|
||||
|
||||
auto id = m_impl->registerPrefix(prefix, onSuccess, onFailure, flags, options, nullopt, nullptr);
|
||||
auto id = m_impl->registerPrefix(prefix, onSuccess, onFailure, flags, options, std::nullopt, nullptr);
|
||||
return RegisteredPrefixHandle(m_impl, id);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -30,7 +30,9 @@
|
||||
// STL headers to precompile
|
||||
#include <atomic>
|
||||
#include <iterator>
|
||||
#include <limits>
|
||||
#include <list>
|
||||
#include <optional>
|
||||
#include <ostream>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
|
||||
@@ -154,17 +154,17 @@ public: // consumer
|
||||
/**
|
||||
* @return A Nack to be sent to the forwarder, or nullopt if no Nack should be sent.
|
||||
*/
|
||||
optional<lp::Nack>
|
||||
std::optional<lp::Nack>
|
||||
nackPendingInterests(const lp::Nack& nack)
|
||||
{
|
||||
optional<lp::Nack> outNack;
|
||||
std::optional<lp::Nack> outNack;
|
||||
m_pendingInterestTable.removeIf([&] (PendingInterest& entry) {
|
||||
if (!nack.getInterest().matchesInterest(*entry.getInterest())) {
|
||||
return false;
|
||||
}
|
||||
NDN_LOG_DEBUG(" nacking " << *entry.getInterest() << " from " << entry.getOrigin());
|
||||
|
||||
optional<lp::Nack> outNack1 = entry.recordNack(nack);
|
||||
auto outNack1 = entry.recordNack(nack);
|
||||
if (!outNack1) {
|
||||
return false;
|
||||
}
|
||||
@@ -234,7 +234,7 @@ public: // producer
|
||||
putNack(const lp::Nack& nack)
|
||||
{
|
||||
NDN_LOG_DEBUG("<N " << nack.getInterest() << '~' << nack.getHeader().getReason());
|
||||
optional<lp::Nack> outNack = nackPendingInterests(nack);
|
||||
auto outNack = nackPendingInterests(nack);
|
||||
if (!outNack) {
|
||||
return;
|
||||
}
|
||||
@@ -255,8 +255,10 @@ public: // prefix registration
|
||||
registerPrefix(const Name& prefix,
|
||||
const RegisterPrefixSuccessCallback& onSuccess,
|
||||
const RegisterPrefixFailureCallback& onFailure,
|
||||
uint64_t flags, const nfd::CommandOptions& options,
|
||||
const optional<InterestFilter>& filter, const InterestCallback& onInterest)
|
||||
uint64_t flags,
|
||||
const nfd::CommandOptions& options,
|
||||
const std::optional<InterestFilter>& filter,
|
||||
const InterestCallback& onInterest)
|
||||
{
|
||||
NDN_LOG_INFO("registering prefix: " << prefix);
|
||||
auto id = m_registeredPrefixTable.allocateId();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -114,7 +114,7 @@ public:
|
||||
* @return Least severe Nack if all destinations where the Interest was forwarded have Nacked;
|
||||
* otherwise, @c nullopt.
|
||||
*/
|
||||
optional<lp::Nack>
|
||||
std::optional<lp::Nack>
|
||||
recordNack(const lp::Nack& nack)
|
||||
{
|
||||
--m_nNotNacked;
|
||||
@@ -124,7 +124,7 @@ public:
|
||||
m_leastSevereNack = nack;
|
||||
}
|
||||
|
||||
return m_nNotNacked > 0 ? nullopt : m_leastSevereNack;
|
||||
return m_nNotNacked > 0 ? std::nullopt : m_leastSevereNack;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -180,7 +180,7 @@ private:
|
||||
TimeoutCallback m_timeoutCallback;
|
||||
scheduler::ScopedEventId m_timeoutEvent;
|
||||
int m_nNotNacked = 0; ///< number of Interest destinations that have not Nacked
|
||||
optional<lp::Nack> m_leastSevereNack;
|
||||
std::optional<lp::Nack> m_leastSevereNack;
|
||||
};
|
||||
|
||||
} // namespace ndn
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "ndn-cxx/ims/in-memory-storage-entry.hpp"
|
||||
|
||||
#include <iterator>
|
||||
#include <limits>
|
||||
#include <stack>
|
||||
|
||||
#include <boost/multi_index_container.hpp>
|
||||
|
||||
@@ -411,7 +411,7 @@ Interest::getNonce() const
|
||||
}
|
||||
|
||||
Interest&
|
||||
Interest::setNonce(optional<Interest::Nonce> nonce)
|
||||
Interest::setNonce(std::optional<Interest::Nonce> nonce)
|
||||
{
|
||||
if (nonce != m_nonce) {
|
||||
m_nonce = nonce;
|
||||
@@ -448,7 +448,7 @@ Interest::setInterestLifetime(time::milliseconds lifetime)
|
||||
}
|
||||
|
||||
Interest&
|
||||
Interest::setHopLimit(optional<uint8_t> hopLimit)
|
||||
Interest::setHopLimit(std::optional<uint8_t> hopLimit)
|
||||
{
|
||||
if (hopLimit != m_hopLimit) {
|
||||
m_hopLimit = hopLimit;
|
||||
@@ -527,14 +527,14 @@ Interest::isSigned() const noexcept
|
||||
m_name[-1].type() == tlv::ParametersSha256DigestComponent;
|
||||
}
|
||||
|
||||
optional<SignatureInfo>
|
||||
std::optional<SignatureInfo>
|
||||
Interest::getSignatureInfo() const
|
||||
{
|
||||
auto blockIt = findFirstParameter(tlv::InterestSignatureInfo);
|
||||
if (blockIt != m_parameters.end()) {
|
||||
return make_optional<SignatureInfo>(*blockIt, SignatureInfo::Type::Interest);
|
||||
return std::make_optional<SignatureInfo>(*blockIt, SignatureInfo::Type::Interest);
|
||||
}
|
||||
return nullopt;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
Interest&
|
||||
|
||||
@@ -256,7 +256,7 @@ public: // element access
|
||||
* Use `setNonce(nullopt)` to remove any nonce from the Interest.
|
||||
*/
|
||||
Interest&
|
||||
setNonce(optional<Nonce> nonce);
|
||||
setNonce(std::optional<Nonce> nonce);
|
||||
|
||||
/**
|
||||
* @brief Change nonce value.
|
||||
@@ -286,7 +286,7 @@ public: // element access
|
||||
/**
|
||||
* @brief Get the %Interest's hop limit.
|
||||
*/
|
||||
optional<uint8_t>
|
||||
std::optional<uint8_t>
|
||||
getHopLimit() const noexcept
|
||||
{
|
||||
return m_hopLimit;
|
||||
@@ -298,7 +298,7 @@ public: // element access
|
||||
* Use `setHopLimit(nullopt)` to remove any hop limit from the Interest.
|
||||
*/
|
||||
Interest&
|
||||
setHopLimit(optional<uint8_t> hopLimit);
|
||||
setHopLimit(std::optional<uint8_t> hopLimit);
|
||||
|
||||
/**
|
||||
* @brief Return whether this Interest has any `ApplicationParameters` element.
|
||||
@@ -388,7 +388,7 @@ public: // element access
|
||||
* @brief Get the `InterestSignatureInfo` element.
|
||||
* @retval nullopt The element is not present.
|
||||
*/
|
||||
optional<SignatureInfo>
|
||||
std::optional<SignatureInfo>
|
||||
getSignatureInfo() const;
|
||||
|
||||
/**
|
||||
@@ -494,9 +494,9 @@ private:
|
||||
|
||||
Name m_name;
|
||||
std::vector<Name> m_forwardingHint;
|
||||
mutable optional<Nonce> m_nonce;
|
||||
mutable std::optional<Nonce> m_nonce;
|
||||
time::milliseconds m_interestLifetime = DEFAULT_INTEREST_LIFETIME;
|
||||
optional<uint8_t> m_hopLimit;
|
||||
std::optional<uint8_t> m_hopLimit;
|
||||
bool m_canBePrefix = false;
|
||||
bool m_mustBeFresh = false;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -35,7 +35,7 @@ PrefixAnnouncementHeader::PrefixAnnouncementHeader(const Block& block)
|
||||
PrefixAnnouncementHeader::PrefixAnnouncementHeader(PrefixAnnouncement prefixAnn)
|
||||
: m_prefixAnn(std::move(prefixAnn))
|
||||
{
|
||||
if (m_prefixAnn->getData() == nullopt) {
|
||||
if (!m_prefixAnn->getData()) {
|
||||
NDN_THROW(Error("PrefixAnnouncement does not contain Data"));
|
||||
}
|
||||
}
|
||||
@@ -44,7 +44,7 @@ template<encoding::Tag TAG>
|
||||
size_t
|
||||
PrefixAnnouncementHeader::wireEncode(EncodingImpl<TAG>& encoder) const
|
||||
{
|
||||
if (m_prefixAnn == nullopt) {
|
||||
if (!m_prefixAnn) {
|
||||
NDN_THROW(Error("PrefixAnnouncementHeader does not contain a PrefixAnnouncement"));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -61,14 +61,14 @@ public:
|
||||
void
|
||||
wireDecode(const Block& wire);
|
||||
|
||||
const optional<PrefixAnnouncement>&
|
||||
const std::optional<PrefixAnnouncement>&
|
||||
getPrefixAnn() const
|
||||
{
|
||||
return m_prefixAnn;
|
||||
}
|
||||
|
||||
private:
|
||||
optional<PrefixAnnouncement> m_prefixAnn;
|
||||
std::optional<PrefixAnnouncement> m_prefixAnn;
|
||||
};
|
||||
|
||||
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(PrefixAnnouncementHeader);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -63,7 +63,7 @@ MetaInfo::setFreshnessPeriod(time::milliseconds freshnessPeriod)
|
||||
}
|
||||
|
||||
MetaInfo&
|
||||
MetaInfo::setFinalBlock(optional<name::Component> finalBlockId)
|
||||
MetaInfo::setFinalBlock(std::optional<name::Component> finalBlockId)
|
||||
{
|
||||
m_wire.reset();
|
||||
m_finalBlockId = std::move(finalBlockId);
|
||||
@@ -215,7 +215,7 @@ MetaInfo::wireDecode(const Block& wire)
|
||||
++val;
|
||||
}
|
||||
else {
|
||||
m_finalBlockId = nullopt;
|
||||
m_finalBlockId = std::nullopt;
|
||||
}
|
||||
|
||||
// AppMetaInfo (if any)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -25,10 +25,10 @@
|
||||
#include "ndn-cxx/name-component.hpp"
|
||||
#include "ndn-cxx/encoding/block.hpp"
|
||||
#include "ndn-cxx/encoding/encoding-buffer.hpp"
|
||||
#include "ndn-cxx/util/optional.hpp"
|
||||
#include "ndn-cxx/util/time.hpp"
|
||||
|
||||
#include <list>
|
||||
#include <optional>
|
||||
|
||||
namespace ndn {
|
||||
|
||||
@@ -118,18 +118,20 @@ public: // getter/setter
|
||||
MetaInfo&
|
||||
setFreshnessPeriod(time::milliseconds freshnessPeriod);
|
||||
|
||||
/** @brief Return the value of `FinalBlockId`.
|
||||
/**
|
||||
* @brief Return the value of `FinalBlockId`.
|
||||
*/
|
||||
const optional<name::Component>&
|
||||
const std::optional<name::Component>&
|
||||
getFinalBlock() const
|
||||
{
|
||||
return m_finalBlockId;
|
||||
}
|
||||
|
||||
/** @brief Set `FinalBlockId`.
|
||||
/**
|
||||
* @brief Set `FinalBlockId`.
|
||||
*/
|
||||
MetaInfo&
|
||||
setFinalBlock(optional<name::Component> finalBlockId);
|
||||
setFinalBlock(std::optional<name::Component> finalBlockId);
|
||||
|
||||
public: // app-defined MetaInfo items
|
||||
/**
|
||||
@@ -195,7 +197,7 @@ public: // app-defined MetaInfo items
|
||||
private:
|
||||
uint32_t m_type;
|
||||
time::milliseconds m_freshnessPeriod;
|
||||
optional<name::Component> m_finalBlockId;
|
||||
std::optional<name::Component> m_finalBlockId;
|
||||
std::list<Block> m_appMetaInfo;
|
||||
|
||||
mutable Block m_wire;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -53,7 +53,7 @@ Data
|
||||
MetadataObject::makeData(Name discoveryInterestName,
|
||||
KeyChain& keyChain,
|
||||
const ndn::security::SigningInfo& si,
|
||||
optional<uint64_t> version,
|
||||
std::optional<uint64_t> version,
|
||||
time::milliseconds freshnessPeriod) const
|
||||
{
|
||||
if (discoveryInterestName.empty() || discoveryInterestName[-1] != getKeywordComponent()) {
|
||||
|
||||
@@ -83,7 +83,7 @@ public:
|
||||
makeData(Name discoveryInterestName,
|
||||
KeyChain& keyChain,
|
||||
const ndn::security::SigningInfo& si = security::SigningInfo(),
|
||||
optional<uint64_t> version = nullopt,
|
||||
std::optional<uint64_t> version = std::nullopt,
|
||||
time::milliseconds freshnessPeriod = 10_ms) const;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -119,7 +119,7 @@ FaceQueryFilter::wireDecode(const Block& block)
|
||||
++val;
|
||||
}
|
||||
else {
|
||||
m_faceId = nullopt;
|
||||
m_faceId = std::nullopt;
|
||||
}
|
||||
|
||||
if (val != m_wire.elements_end() && val->type() == tlv::nfd::UriScheme) {
|
||||
@@ -151,7 +151,7 @@ FaceQueryFilter::wireDecode(const Block& block)
|
||||
++val;
|
||||
}
|
||||
else {
|
||||
m_faceScope = nullopt;
|
||||
m_faceScope = std::nullopt;
|
||||
}
|
||||
|
||||
if (val != m_wire.elements_end() && val->type() == tlv::nfd::FacePersistency) {
|
||||
@@ -159,7 +159,7 @@ FaceQueryFilter::wireDecode(const Block& block)
|
||||
++val;
|
||||
}
|
||||
else {
|
||||
m_facePersistency = nullopt;
|
||||
m_facePersistency = std::nullopt;
|
||||
}
|
||||
|
||||
if (val != m_wire.elements_end() && val->type() == tlv::nfd::LinkType) {
|
||||
@@ -167,7 +167,7 @@ FaceQueryFilter::wireDecode(const Block& block)
|
||||
++val;
|
||||
}
|
||||
else {
|
||||
m_linkType = nullopt;
|
||||
m_linkType = std::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ FaceQueryFilter&
|
||||
FaceQueryFilter::unsetFaceId()
|
||||
{
|
||||
m_wire.reset();
|
||||
m_faceId = nullopt;
|
||||
m_faceId = std::nullopt;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -253,7 +253,7 @@ FaceQueryFilter&
|
||||
FaceQueryFilter::unsetFaceScope()
|
||||
{
|
||||
m_wire.reset();
|
||||
m_faceScope = nullopt;
|
||||
m_faceScope = std::nullopt;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -269,7 +269,7 @@ FaceQueryFilter&
|
||||
FaceQueryFilter::unsetFacePersistency()
|
||||
{
|
||||
m_wire.reset();
|
||||
m_facePersistency = nullopt;
|
||||
m_facePersistency = std::nullopt;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -285,7 +285,7 @@ FaceQueryFilter&
|
||||
FaceQueryFilter::unsetLinkType()
|
||||
{
|
||||
m_wire.reset();
|
||||
m_linkType = nullopt;
|
||||
m_linkType = std::nullopt;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -24,7 +24,8 @@
|
||||
|
||||
#include "ndn-cxx/encoding/block.hpp"
|
||||
#include "ndn-cxx/encoding/nfd-constants.hpp"
|
||||
#include "ndn-cxx/util/optional.hpp"
|
||||
|
||||
#include <optional>
|
||||
|
||||
namespace ndn {
|
||||
namespace nfd {
|
||||
@@ -204,13 +205,13 @@ public: // getters & setters
|
||||
unsetLinkType();
|
||||
|
||||
private:
|
||||
optional<uint64_t> m_faceId;
|
||||
std::optional<uint64_t> m_faceId;
|
||||
std::string m_uriScheme;
|
||||
std::string m_remoteUri;
|
||||
std::string m_localUri;
|
||||
optional<FaceScope> m_faceScope;
|
||||
optional<FacePersistency> m_facePersistency;
|
||||
optional<LinkType> m_linkType;
|
||||
std::optional<FaceScope> m_faceScope;
|
||||
std::optional<FacePersistency> m_facePersistency;
|
||||
std::optional<LinkType> m_linkType;
|
||||
|
||||
mutable Block m_wire;
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -148,7 +148,7 @@ FaceStatus::wireDecode(const Block& block)
|
||||
++val;
|
||||
}
|
||||
else {
|
||||
m_expirationPeriod = nullopt;
|
||||
m_expirationPeriod = std::nullopt;
|
||||
}
|
||||
|
||||
if (val != m_wire.elements_end() && val->type() == tlv::nfd::FaceScope) {
|
||||
@@ -180,7 +180,7 @@ FaceStatus::wireDecode(const Block& block)
|
||||
++val;
|
||||
}
|
||||
else {
|
||||
m_baseCongestionMarkingInterval = nullopt;
|
||||
m_baseCongestionMarkingInterval = std::nullopt;
|
||||
}
|
||||
|
||||
if (val != m_wire.elements_end() && val->type() == tlv::nfd::DefaultCongestionThreshold) {
|
||||
@@ -188,7 +188,7 @@ FaceStatus::wireDecode(const Block& block)
|
||||
++val;
|
||||
}
|
||||
else {
|
||||
m_defaultCongestionThreshold = nullopt;
|
||||
m_defaultCongestionThreshold = std::nullopt;
|
||||
}
|
||||
|
||||
if (val != m_wire.elements_end() && val->type() == tlv::nfd::Mtu) {
|
||||
@@ -196,7 +196,7 @@ FaceStatus::wireDecode(const Block& block)
|
||||
++val;
|
||||
}
|
||||
else {
|
||||
m_mtu = nullopt;
|
||||
m_mtu = std::nullopt;
|
||||
}
|
||||
|
||||
if (val != m_wire.elements_end() && val->type() == tlv::nfd::NInInterests) {
|
||||
@@ -284,7 +284,7 @@ FaceStatus&
|
||||
FaceStatus::unsetExpirationPeriod()
|
||||
{
|
||||
m_wire.reset();
|
||||
m_expirationPeriod = nullopt;
|
||||
m_expirationPeriod = std::nullopt;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -300,7 +300,7 @@ FaceStatus&
|
||||
FaceStatus::unsetBaseCongestionMarkingInterval()
|
||||
{
|
||||
m_wire.reset();
|
||||
m_baseCongestionMarkingInterval = nullopt;
|
||||
m_baseCongestionMarkingInterval = std::nullopt;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -316,7 +316,7 @@ FaceStatus&
|
||||
FaceStatus::unsetDefaultCongestionThreshold()
|
||||
{
|
||||
m_wire.reset();
|
||||
m_defaultCongestionThreshold = nullopt;
|
||||
m_defaultCongestionThreshold = std::nullopt;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -332,7 +332,7 @@ FaceStatus&
|
||||
FaceStatus::unsetMtu()
|
||||
{
|
||||
m_wire.reset();
|
||||
m_mtu = nullopt;
|
||||
m_mtu = std::nullopt;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -23,9 +23,10 @@
|
||||
#define NDN_CXX_MGMT_NFD_FACE_STATUS_HPP
|
||||
|
||||
#include "ndn-cxx/mgmt/nfd/face-traits.hpp"
|
||||
#include "ndn-cxx/util/optional.hpp"
|
||||
#include "ndn-cxx/util/time.hpp"
|
||||
|
||||
#include <optional>
|
||||
|
||||
namespace ndn {
|
||||
namespace nfd {
|
||||
|
||||
@@ -220,10 +221,10 @@ public: // getters & setters
|
||||
setNOutBytes(uint64_t nOutBytes);
|
||||
|
||||
private:
|
||||
optional<time::milliseconds> m_expirationPeriod;
|
||||
optional<time::nanoseconds> m_baseCongestionMarkingInterval;
|
||||
optional<uint64_t> m_defaultCongestionThreshold;
|
||||
optional<uint64_t> m_mtu;
|
||||
std::optional<time::milliseconds> m_expirationPeriod;
|
||||
std::optional<time::nanoseconds> m_baseCongestionMarkingInterval;
|
||||
std::optional<uint64_t> m_defaultCongestionThreshold;
|
||||
std::optional<uint64_t> m_mtu;
|
||||
uint64_t m_nInInterests;
|
||||
uint64_t m_nInData;
|
||||
uint64_t m_nInNacks;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -94,7 +94,7 @@ Route::setExpirationPeriod(time::milliseconds expirationPeriod)
|
||||
Route&
|
||||
Route::unsetExpirationPeriod()
|
||||
{
|
||||
m_expirationPeriod = nullopt;
|
||||
m_expirationPeriod = std::nullopt;
|
||||
m_wire.reset();
|
||||
return *this;
|
||||
}
|
||||
@@ -185,7 +185,7 @@ Route::wireDecode(const Block& block)
|
||||
++val;
|
||||
}
|
||||
else {
|
||||
m_expirationPeriod = nullopt;
|
||||
m_expirationPeriod = std::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -122,7 +122,7 @@ private:
|
||||
RouteOrigin m_origin;
|
||||
uint64_t m_cost;
|
||||
uint64_t m_flags;
|
||||
optional<time::milliseconds> m_expirationPeriod;
|
||||
std::optional<time::milliseconds> m_expirationPeriod;
|
||||
|
||||
mutable Block m_wire;
|
||||
};
|
||||
|
||||
+3
-3
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -227,13 +227,13 @@ Name::set(ssize_t i, Component&& component)
|
||||
}
|
||||
|
||||
Name&
|
||||
Name::appendVersion(const optional<uint64_t>& version)
|
||||
Name::appendVersion(const std::optional<uint64_t>& version)
|
||||
{
|
||||
return append(Component::fromVersion(version.value_or(time::toUnixTimestamp(time::system_clock::now()).count())));
|
||||
}
|
||||
|
||||
Name&
|
||||
Name::appendTimestamp(const optional<time::system_clock::time_point>& timestamp)
|
||||
Name::appendTimestamp(const std::optional<time::system_clock::time_point>& timestamp)
|
||||
{
|
||||
return append(Component::fromTimestamp(timestamp.value_or(time::system_clock::now())));
|
||||
}
|
||||
|
||||
+3
-3
@@ -23,9 +23,9 @@
|
||||
#define NDN_CXX_NAME_HPP
|
||||
|
||||
#include "ndn-cxx/name-component.hpp"
|
||||
#include "ndn-cxx/util/optional.hpp"
|
||||
|
||||
#include <iterator>
|
||||
#include <optional>
|
||||
|
||||
namespace ndn {
|
||||
|
||||
@@ -447,7 +447,7 @@ public: // modifiers
|
||||
* https://named-data.net/publications/techreports/ndn-tr-22-3-ndn-memo-naming-conventions/
|
||||
*/
|
||||
Name&
|
||||
appendVersion(const optional<uint64_t>& version = nullopt);
|
||||
appendVersion(const std::optional<uint64_t>& version = std::nullopt);
|
||||
|
||||
/**
|
||||
* @brief Append a timestamp component.
|
||||
@@ -457,7 +457,7 @@ public: // modifiers
|
||||
* https://named-data.net/publications/techreports/ndn-tr-22-3-ndn-memo-naming-conventions/
|
||||
*/
|
||||
Name&
|
||||
appendTimestamp(const optional<time::system_clock::time_point>& timestamp = nullopt);
|
||||
appendTimestamp(const std::optional<time::system_clock::time_point>& timestamp = std::nullopt);
|
||||
|
||||
/**
|
||||
* @brief Append a sequence number component.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2018 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
#include "ndn-cxx/net/impl/link-type-helper.hpp"
|
||||
#include "ndn-cxx/detail/config.hpp"
|
||||
|
||||
#ifndef NDN_CXX_HAVE_OSX_FRAMEWORKS
|
||||
#error "This file should not be compiled ..."
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2021 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -24,6 +24,8 @@
|
||||
|
||||
#include "ndn-cxx/encoding/nfd-constants.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace ndn {
|
||||
namespace net {
|
||||
namespace detail {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2021 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -26,7 +26,6 @@
|
||||
|
||||
#include "ndn-cxx/detail/common.hpp"
|
||||
#include "ndn-cxx/net/ethernet.hpp"
|
||||
#include "ndn-cxx/util/optional.hpp"
|
||||
|
||||
#ifndef NDN_CXX_HAVE_NETLINK
|
||||
#error "This file should not be included ..."
|
||||
@@ -38,6 +37,7 @@
|
||||
|
||||
#include <cstring>
|
||||
#include <map>
|
||||
#include <optional>
|
||||
|
||||
#include <boost/asio/ip/address.hpp>
|
||||
|
||||
@@ -227,12 +227,12 @@ public:
|
||||
}
|
||||
|
||||
template<typename U>
|
||||
optional<U>
|
||||
std::optional<U>
|
||||
getAttributeByType(uint16_t attrType) const
|
||||
{
|
||||
auto it = m_attrs.find(attrType);
|
||||
if (it == m_attrs.end())
|
||||
return nullopt;
|
||||
return std::nullopt;
|
||||
|
||||
return convertAttrValue(getAttributeValue(it->second),
|
||||
getAttributeValueLength(it->second),
|
||||
@@ -261,48 +261,48 @@ private:
|
||||
}
|
||||
|
||||
template<typename Integral>
|
||||
static std::enable_if_t<std::is_integral<Integral>::value, optional<Integral>>
|
||||
static std::enable_if_t<std::is_integral<Integral>::value, std::optional<Integral>>
|
||||
convertAttrValue(const uint8_t* val, size_t len, AttrValueTypeTag<Integral>)
|
||||
{
|
||||
if (len < sizeof(Integral))
|
||||
return nullopt;
|
||||
return std::nullopt;
|
||||
|
||||
Integral i;
|
||||
std::memcpy(&i, val, sizeof(Integral));
|
||||
return i;
|
||||
}
|
||||
|
||||
static optional<std::string>
|
||||
static std::optional<std::string>
|
||||
convertAttrValue(const uint8_t* val, size_t len, AttrValueTypeTag<std::string>)
|
||||
{
|
||||
auto str = reinterpret_cast<const char*>(val);
|
||||
if (::strnlen(str, len) >= len)
|
||||
return nullopt;
|
||||
return std::nullopt;
|
||||
|
||||
return std::string(str);
|
||||
return std::make_optional<std::string>(str);
|
||||
}
|
||||
|
||||
static optional<ethernet::Address>
|
||||
static std::optional<ethernet::Address>
|
||||
convertAttrValue(const uint8_t* val, size_t len, AttrValueTypeTag<ethernet::Address>)
|
||||
{
|
||||
if (len < ethernet::ADDR_LEN)
|
||||
return nullopt;
|
||||
return std::nullopt;
|
||||
|
||||
return ethernet::Address(val);
|
||||
return std::make_optional<ethernet::Address>(val);
|
||||
}
|
||||
|
||||
template<typename IpAddress>
|
||||
static std::enable_if_t<std::is_same<IpAddress, boost::asio::ip::address_v4>::value ||
|
||||
std::is_same<IpAddress, boost::asio::ip::address_v6>::value,
|
||||
optional<IpAddress>>
|
||||
std::optional<IpAddress>>
|
||||
convertAttrValue(const uint8_t* val, size_t len, AttrValueTypeTag<IpAddress>)
|
||||
{
|
||||
typename IpAddress::bytes_type bytes;
|
||||
if (len < bytes.size())
|
||||
return nullopt;
|
||||
return std::nullopt;
|
||||
|
||||
std::copy_n(val, bytes.size(), bytes.begin());
|
||||
return IpAddress(bytes);
|
||||
return std::make_optional<IpAddress>(bytes);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -68,7 +68,7 @@ PrefixAnnouncement::PrefixAnnouncement(Data data)
|
||||
|
||||
const Data&
|
||||
PrefixAnnouncement::toData(KeyChain& keyChain, const ndn::security::SigningInfo& si,
|
||||
optional<uint64_t> version) const
|
||||
std::optional<uint64_t> version) const
|
||||
{
|
||||
if (!m_data) {
|
||||
Name dataName = m_announcedName;
|
||||
@@ -112,7 +112,7 @@ PrefixAnnouncement::setExpiration(time::milliseconds expiration)
|
||||
}
|
||||
|
||||
PrefixAnnouncement&
|
||||
PrefixAnnouncement::setValidityPeriod(optional<security::ValidityPeriod> validity)
|
||||
PrefixAnnouncement::setValidityPeriod(std::optional<security::ValidityPeriod> validity)
|
||||
{
|
||||
m_data.reset();
|
||||
m_validity = std::move(validity);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2021 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -58,7 +58,7 @@ public:
|
||||
|
||||
/** \brief Get the Data representing the prefix announcement, if available.
|
||||
*/
|
||||
const optional<Data>&
|
||||
const std::optional<Data>&
|
||||
getData() const
|
||||
{
|
||||
return m_data;
|
||||
@@ -74,7 +74,7 @@ public:
|
||||
const Data&
|
||||
toData(KeyChain& keyChain,
|
||||
const ndn::security::SigningInfo& si = security::SigningInfo(),
|
||||
optional<uint64_t> version = nullopt) const;
|
||||
std::optional<uint64_t> version = std::nullopt) const;
|
||||
|
||||
/** \brief Return announced name.
|
||||
*/
|
||||
@@ -107,7 +107,7 @@ public:
|
||||
|
||||
/** \brief Return absolute validity period.
|
||||
*/
|
||||
optional<security::ValidityPeriod>
|
||||
std::optional<security::ValidityPeriod>
|
||||
getValidityPeriod() const
|
||||
{
|
||||
return m_validity;
|
||||
@@ -117,7 +117,7 @@ public:
|
||||
* \post getData() == nullopt
|
||||
*/
|
||||
PrefixAnnouncement&
|
||||
setValidityPeriod(optional<security::ValidityPeriod> validity);
|
||||
setValidityPeriod(std::optional<security::ValidityPeriod> validity);
|
||||
|
||||
public: // static methods
|
||||
/**
|
||||
@@ -127,10 +127,10 @@ public: // static methods
|
||||
getKeywordComponent();
|
||||
|
||||
private:
|
||||
mutable optional<Data> m_data;
|
||||
mutable std::optional<Data> m_data;
|
||||
Name m_announcedName;
|
||||
time::milliseconds m_expiration = 0_ms;
|
||||
optional<security::ValidityPeriod> m_validity;
|
||||
std::optional<security::ValidityPeriod> m_validity;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
#include "ndn-cxx/security/impl/openssl-helper.hpp"
|
||||
|
||||
#include <limits>
|
||||
|
||||
namespace ndn {
|
||||
namespace security {
|
||||
namespace detail {
|
||||
|
||||
@@ -733,7 +733,7 @@ KeyChain::prepareSignatureInfoWithIdentity(const SigningInfo& params, const pib:
|
||||
|
||||
std::tuple<Name, SignatureInfo>
|
||||
KeyChain::prepareSignatureInfoWithKey(const SigningInfo& params, const pib::Key& key,
|
||||
const optional<Name>& certName)
|
||||
const std::optional<Name>& certName)
|
||||
{
|
||||
auto sigInfo = params.getSignatureInfo();
|
||||
sigInfo.setSignatureType(getSignatureType(key.getKeyType(), params.getDigestAlgorithm()));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -50,7 +50,7 @@ struct MakeCertificateOptions
|
||||
*
|
||||
* Default is deriving from current timestamp using the logic of Name::appendVersion() .
|
||||
*/
|
||||
optional<uint64_t> version;
|
||||
std::optional<uint64_t> version;
|
||||
|
||||
/**
|
||||
* @brief Certificate packet FreshnessPeriod.
|
||||
@@ -70,7 +70,7 @@ struct MakeCertificateOptions
|
||||
*
|
||||
* Default is a ValidityPeriod from now until 365 days later.
|
||||
*/
|
||||
optional<ValidityPeriod> validity;
|
||||
std::optional<ValidityPeriod> validity;
|
||||
};
|
||||
|
||||
inline namespace v2 {
|
||||
@@ -498,7 +498,7 @@ private: // signing
|
||||
|
||||
static std::tuple<Name, SignatureInfo>
|
||||
prepareSignatureInfoWithKey(const SigningInfo& params, const pib::Key& key,
|
||||
const optional<Name>& certName = nullopt);
|
||||
const std::optional<Name>& certName = std::nullopt);
|
||||
|
||||
/**
|
||||
* @brief Generate and return a raw signature for the byte ranges in @p bufs using
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -71,7 +71,7 @@ KeyImpl::removeCertificate(const Name& certName)
|
||||
|
||||
if (m_defaultCert && m_defaultCert->getName() == certName) {
|
||||
NDN_LOG_DEBUG("Removing default certificate " << certName);
|
||||
m_defaultCert = nullopt;
|
||||
m_defaultCert = std::nullopt;
|
||||
}
|
||||
m_certificates.remove(certName);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -131,7 +131,7 @@ private:
|
||||
const shared_ptr<PibImpl> m_pib;
|
||||
|
||||
CertificateContainer m_certificates;
|
||||
mutable optional<Certificate> m_defaultCert;
|
||||
mutable std::optional<Certificate> m_defaultCert;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -127,7 +127,7 @@ private:
|
||||
std::string m_tpmLocator;
|
||||
|
||||
std::set<Name> m_identities;
|
||||
optional<Name> m_defaultIdentity;
|
||||
std::optional<Name> m_defaultIdentity;
|
||||
|
||||
/// identity name => default key name
|
||||
std::map<Name, Name> m_defaultKeys;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -142,9 +142,9 @@ ValidationPolicySignedInterest::checkIncomingInterest(const shared_ptr<Validatio
|
||||
|
||||
void
|
||||
ValidationPolicySignedInterest::insertRecord(const Name& keyName,
|
||||
optional<time::system_clock::TimePoint> timestamp,
|
||||
optional<uint64_t> seqNum,
|
||||
optional<SigNonce> nonce)
|
||||
std::optional<time::system_clock::TimePoint> timestamp,
|
||||
std::optional<uint64_t> seqNum,
|
||||
std::optional<SigNonce> nonce)
|
||||
{
|
||||
// If key record exists, update last refreshed time. Otherwise, create new record.
|
||||
Container::nth_index<0>::type::iterator it;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -158,9 +158,9 @@ private:
|
||||
|
||||
void
|
||||
insertRecord(const Name& keyName,
|
||||
optional<time::system_clock::TimePoint> timestamp,
|
||||
optional<uint64_t> seqNum,
|
||||
optional<SigNonce> nonce);
|
||||
std::optional<time::system_clock::TimePoint> timestamp,
|
||||
std::optional<uint64_t> seqNum,
|
||||
std::optional<SigNonce> nonce);
|
||||
|
||||
private:
|
||||
Options m_options;
|
||||
@@ -181,8 +181,8 @@ private:
|
||||
struct LastInterestRecord
|
||||
{
|
||||
LastInterestRecord(const Name& keyName,
|
||||
optional<time::system_clock::TimePoint> timestamp,
|
||||
optional<uint64_t> seqNum)
|
||||
std::optional<time::system_clock::TimePoint> timestamp,
|
||||
std::optional<uint64_t> seqNum)
|
||||
: keyName(keyName)
|
||||
, timestamp(timestamp)
|
||||
, seqNum(seqNum)
|
||||
@@ -191,8 +191,8 @@ private:
|
||||
}
|
||||
|
||||
Name keyName;
|
||||
optional<time::system_clock::TimePoint> timestamp;
|
||||
optional<uint64_t> seqNum;
|
||||
std::optional<time::system_clock::TimePoint> timestamp;
|
||||
std::optional<uint64_t> seqNum;
|
||||
NonceContainer observedNonces;
|
||||
time::steady_clock::TimePoint lastRefreshed;
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -92,7 +92,7 @@ DataValidationState::~DataValidationState()
|
||||
}
|
||||
|
||||
void
|
||||
DataValidationState::verifyOriginalPacket(const optional<Certificate>& trustedCert)
|
||||
DataValidationState::verifyOriginalPacket(const std::optional<Certificate>& trustedCert)
|
||||
{
|
||||
if (verifySignature(m_data, trustedCert)) {
|
||||
NDN_LOG_TRACE_DEPTH("OK signature for data `" << m_data.getName() << "`");
|
||||
@@ -145,7 +145,7 @@ InterestValidationState::~InterestValidationState()
|
||||
}
|
||||
|
||||
void
|
||||
InterestValidationState::verifyOriginalPacket(const optional<Certificate>& trustedCert)
|
||||
InterestValidationState::verifyOriginalPacket(const std::optional<Certificate>& trustedCert)
|
||||
{
|
||||
if (verifySignature(m_interest, trustedCert)) {
|
||||
NDN_LOG_TRACE_DEPTH("OK signature for interest `" << m_interest.getName() << "`");
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -106,12 +106,12 @@ private: // Interface intended to be used only by Validator class
|
||||
/**
|
||||
* @brief Verify signature of the original packet
|
||||
*
|
||||
* @param trustCert The certificate that signs the original packet, nullopt if certificate is
|
||||
* not needed for verification (e.g., sha256 digest or attribute based
|
||||
* @param trustedCert The certificate that signs the original packet, nullopt if certificate
|
||||
* is not needed for verification (e.g., sha256 digest or attribute based
|
||||
* signature)
|
||||
*/
|
||||
virtual void
|
||||
verifyOriginalPacket(const optional<Certificate>& trustedCert) = 0;
|
||||
verifyOriginalPacket(const std::optional<Certificate>& trustedCert) = 0;
|
||||
|
||||
/**
|
||||
* @brief Call success callback of the original packet without signature validation
|
||||
@@ -191,7 +191,7 @@ public:
|
||||
|
||||
private:
|
||||
void
|
||||
verifyOriginalPacket(const optional<Certificate>& trustedCert) final;
|
||||
verifyOriginalPacket(const std::optional<Certificate>& trustedCert) final;
|
||||
|
||||
void
|
||||
bypassValidation() final;
|
||||
@@ -243,7 +243,7 @@ public:
|
||||
|
||||
private:
|
||||
void
|
||||
verifyOriginalPacket(const optional<Certificate>& trustedCert) final;
|
||||
verifyOriginalPacket(const std::optional<Certificate>& trustedCert) final;
|
||||
|
||||
void
|
||||
bypassValidation() final;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -129,7 +129,7 @@ Validator::requestCertificate(const shared_ptr<CertificateRequest>& certRequest,
|
||||
}
|
||||
|
||||
if (certRequest->interest.getName() == SigningInfo::getDigestSha256Identity()) {
|
||||
state->verifyOriginalPacket(nullopt);
|
||||
state->verifyOriginalPacket(std::nullopt);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -216,7 +216,7 @@ verifySignature(const Interest& interest, const pib::Key& key)
|
||||
}
|
||||
|
||||
bool
|
||||
verifySignature(const Data& data, const optional<Certificate>& cert)
|
||||
verifySignature(const Data& data, const std::optional<Certificate>& cert)
|
||||
{
|
||||
auto parsed = parse(data);
|
||||
if (cert) {
|
||||
@@ -232,7 +232,7 @@ verifySignature(const Data& data, const optional<Certificate>& cert)
|
||||
}
|
||||
|
||||
bool
|
||||
verifySignature(const Interest& interest, const optional<Certificate>& cert)
|
||||
verifySignature(const Interest& interest, const std::optional<Certificate>& cert)
|
||||
{
|
||||
auto parsed = parse(interest);
|
||||
if (cert) {
|
||||
|
||||
@@ -108,7 +108,7 @@ verifySignature(const Interest& interest, const pib::Key& key);
|
||||
* If @p cert is nullopt, @p data assumed to be self-verifiable (with digest or attributes)
|
||||
*/
|
||||
[[nodiscard]] bool
|
||||
verifySignature(const Data& data, const optional<Certificate>& cert);
|
||||
verifySignature(const Data& data, const std::optional<Certificate>& cert);
|
||||
|
||||
/**
|
||||
* @brief Verify @p interest using @p cert.
|
||||
@@ -117,7 +117,7 @@ verifySignature(const Data& data, const optional<Certificate>& cert);
|
||||
* If @p cert is nullptr, @p interest assumed to be self-verifiable (with digest or attributes)
|
||||
*/
|
||||
[[nodiscard]] bool
|
||||
verifySignature(const Interest& interest, const optional<Certificate>& cert);
|
||||
verifySignature(const Interest& interest, const std::optional<Certificate>& cert);
|
||||
|
||||
/**
|
||||
* @brief Verify @p data using @p tpm and @p keyName with the @p digestAlgorithm.
|
||||
|
||||
+16
-16
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -37,7 +37,7 @@ static_assert(std::is_base_of<tlv::Error, SignatureInfo::Error>::value,
|
||||
|
||||
SignatureInfo::SignatureInfo() = default;
|
||||
|
||||
SignatureInfo::SignatureInfo(tlv::SignatureTypeValue type, optional<KeyLocator> keyLocator)
|
||||
SignatureInfo::SignatureInfo(tlv::SignatureTypeValue type, std::optional<KeyLocator> keyLocator)
|
||||
: m_type(type)
|
||||
, m_keyLocator(std::move(keyLocator))
|
||||
{
|
||||
@@ -117,7 +117,7 @@ void
|
||||
SignatureInfo::wireDecode(const Block& wire, SignatureInfo::Type type)
|
||||
{
|
||||
m_type = -1;
|
||||
m_keyLocator = nullopt;
|
||||
m_keyLocator = std::nullopt;
|
||||
m_otherTlvs.clear();
|
||||
|
||||
m_wire = wire;
|
||||
@@ -196,7 +196,7 @@ SignatureInfo::getKeyLocator() const
|
||||
}
|
||||
|
||||
SignatureInfo&
|
||||
SignatureInfo::setKeyLocator(optional<KeyLocator> keyLocator)
|
||||
SignatureInfo::setKeyLocator(std::optional<KeyLocator> keyLocator)
|
||||
{
|
||||
if (keyLocator != m_keyLocator) {
|
||||
m_keyLocator = std::move(keyLocator);
|
||||
@@ -216,7 +216,7 @@ SignatureInfo::getValidityPeriod() const
|
||||
}
|
||||
|
||||
SignatureInfo&
|
||||
SignatureInfo::setValidityPeriod(optional<security::ValidityPeriod> validityPeriod)
|
||||
SignatureInfo::setValidityPeriod(std::optional<security::ValidityPeriod> validityPeriod)
|
||||
{
|
||||
if (!validityPeriod) {
|
||||
removeCustomTlv(tlv::ValidityPeriod);
|
||||
@@ -227,18 +227,18 @@ SignatureInfo::setValidityPeriod(optional<security::ValidityPeriod> validityPeri
|
||||
return *this;
|
||||
}
|
||||
|
||||
optional<std::vector<uint8_t>>
|
||||
std::optional<std::vector<uint8_t>>
|
||||
SignatureInfo::getNonce() const
|
||||
{
|
||||
auto it = findOtherTlv(tlv::SignatureNonce);
|
||||
if (it == m_otherTlvs.end()) {
|
||||
return nullopt;
|
||||
return std::nullopt;
|
||||
}
|
||||
return std::vector<uint8_t>(it->value_begin(), it->value_end());
|
||||
}
|
||||
|
||||
SignatureInfo&
|
||||
SignatureInfo::setNonce(optional<span<const uint8_t>> nonce)
|
||||
SignatureInfo::setNonce(std::optional<span<const uint8_t>> nonce)
|
||||
{
|
||||
if (!nonce) {
|
||||
removeCustomTlv(tlv::SignatureNonce);
|
||||
@@ -249,18 +249,18 @@ SignatureInfo::setNonce(optional<span<const uint8_t>> nonce)
|
||||
return *this;
|
||||
}
|
||||
|
||||
optional<time::system_clock::time_point>
|
||||
std::optional<time::system_clock::time_point>
|
||||
SignatureInfo::getTime() const
|
||||
{
|
||||
auto it = findOtherTlv(tlv::SignatureTime);
|
||||
if (it == m_otherTlvs.end()) {
|
||||
return nullopt;
|
||||
return std::nullopt;
|
||||
}
|
||||
return time::fromUnixTimestamp(time::milliseconds(readNonNegativeInteger(*it)));
|
||||
}
|
||||
|
||||
SignatureInfo&
|
||||
SignatureInfo::setTime(optional<time::system_clock::time_point> time)
|
||||
SignatureInfo::setTime(std::optional<time::system_clock::time_point> time)
|
||||
{
|
||||
if (!time) {
|
||||
removeCustomTlv(tlv::SignatureTime);
|
||||
@@ -272,18 +272,18 @@ SignatureInfo::setTime(optional<time::system_clock::time_point> time)
|
||||
return *this;
|
||||
}
|
||||
|
||||
optional<uint64_t>
|
||||
std::optional<uint64_t>
|
||||
SignatureInfo::getSeqNum() const
|
||||
{
|
||||
auto it = findOtherTlv(tlv::SignatureSeqNum);
|
||||
if (it == m_otherTlvs.end()) {
|
||||
return nullopt;
|
||||
return std::nullopt;
|
||||
}
|
||||
return readNonNegativeInteger(*it);
|
||||
}
|
||||
|
||||
SignatureInfo&
|
||||
SignatureInfo::setSeqNum(optional<uint64_t> seqNum)
|
||||
SignatureInfo::setSeqNum(std::optional<uint64_t> seqNum)
|
||||
{
|
||||
if (!seqNum) {
|
||||
removeCustomTlv(tlv::SignatureSeqNum);
|
||||
@@ -294,12 +294,12 @@ SignatureInfo::setSeqNum(optional<uint64_t> seqNum)
|
||||
return *this;
|
||||
}
|
||||
|
||||
optional<Block>
|
||||
std::optional<Block>
|
||||
SignatureInfo::getCustomTlv(uint32_t type) const
|
||||
{
|
||||
auto it = findOtherTlv(type);
|
||||
if (it == m_otherTlvs.end()) {
|
||||
return nullopt;
|
||||
return std::nullopt;
|
||||
}
|
||||
return *it;
|
||||
}
|
||||
|
||||
+12
-12
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
/** @brief Create with the specified type and KeyLocator
|
||||
*/
|
||||
explicit
|
||||
SignatureInfo(tlv::SignatureTypeValue type, optional<KeyLocator> keyLocator = nullopt);
|
||||
SignatureInfo(tlv::SignatureTypeValue type, std::optional<KeyLocator> keyLocator = std::nullopt);
|
||||
|
||||
/** @brief Create from wire encoding
|
||||
* @param wire Wire to decode from
|
||||
@@ -143,7 +143,7 @@ public: // field access
|
||||
* @return A reference to this SignatureInfo, to allow chaining.
|
||||
*/
|
||||
SignatureInfo&
|
||||
setKeyLocator(optional<KeyLocator> keyLocator);
|
||||
setKeyLocator(std::optional<KeyLocator> keyLocator);
|
||||
|
||||
/** @brief Get the `ValidityPeriod` element.
|
||||
* @throw Error This SignatureInfo does not contain a ValidityPeriod
|
||||
@@ -158,12 +158,12 @@ public: // field access
|
||||
* @return A reference to this SignatureInfo, to allow chaining.
|
||||
*/
|
||||
SignatureInfo&
|
||||
setValidityPeriod(optional<security::ValidityPeriod> validityPeriod);
|
||||
setValidityPeriod(std::optional<security::ValidityPeriod> validityPeriod);
|
||||
|
||||
/** @brief Get SignatureNonce
|
||||
* @retval nullopt SignatureNonce is not set
|
||||
*/
|
||||
optional<std::vector<uint8_t>>
|
||||
std::optional<std::vector<uint8_t>>
|
||||
getNonce() const;
|
||||
|
||||
/** @brief Append or replace SignatureNonce
|
||||
@@ -173,12 +173,12 @@ public: // field access
|
||||
* @return A reference to this SignatureInfo, to allow chaining.
|
||||
*/
|
||||
SignatureInfo&
|
||||
setNonce(optional<span<const uint8_t>> nonce);
|
||||
setNonce(std::optional<span<const uint8_t>> nonce);
|
||||
|
||||
/** @brief Get SignatureTime
|
||||
* @retval nullopt SignatureTime is not set
|
||||
*/
|
||||
optional<time::system_clock::time_point>
|
||||
std::optional<time::system_clock::time_point>
|
||||
getTime() const;
|
||||
|
||||
/** @brief Append or replace SignatureTime
|
||||
@@ -188,12 +188,12 @@ public: // field access
|
||||
* @return A reference to this SignatureInfo, to allow chaining.
|
||||
*/
|
||||
SignatureInfo&
|
||||
setTime(optional<time::system_clock::time_point> time = time::system_clock::now());
|
||||
setTime(std::optional<time::system_clock::time_point> time = time::system_clock::now());
|
||||
|
||||
/** @brief Get SignatureSeqNum
|
||||
* @retval nullopt SignatureSeqNum is not set
|
||||
*/
|
||||
optional<uint64_t>
|
||||
std::optional<uint64_t>
|
||||
getSeqNum() const;
|
||||
|
||||
/** @brief Append or replace SignatureSeqNum
|
||||
@@ -203,13 +203,13 @@ public: // field access
|
||||
* @return A reference to this SignatureInfo, to allow chaining.
|
||||
*/
|
||||
SignatureInfo&
|
||||
setSeqNum(optional<uint64_t> seqNum);
|
||||
setSeqNum(std::optional<uint64_t> seqNum);
|
||||
|
||||
/** @brief Get first custom TLV element with the specified TLV-TYPE
|
||||
* @param type TLV-TYPE of element to get
|
||||
* @retval nullopt No custom TLV elements with the specified TLV-TYPE exist
|
||||
*/
|
||||
optional<Block>
|
||||
std::optional<Block>
|
||||
getCustomTlv(uint32_t type) const;
|
||||
|
||||
/** @brief Append an arbitrary TLV element to this SignatureInfo
|
||||
@@ -231,7 +231,7 @@ private:
|
||||
|
||||
private:
|
||||
int32_t m_type = -1;
|
||||
optional<KeyLocator> m_keyLocator;
|
||||
std::optional<KeyLocator> m_keyLocator;
|
||||
std::vector<Block> m_otherTlvs;
|
||||
|
||||
mutable Block m_wire;
|
||||
|
||||
+1
-2
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
#include "ndn-cxx/encoding/block.hpp"
|
||||
#include "ndn-cxx/util/concepts.hpp"
|
||||
#include "ndn-cxx/util/optional.hpp"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
* ndn-cxx library is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
* Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received copies of the GNU General Public License and GNU Lesser
|
||||
* General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
|
||||
* <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* See AUTHORS.md for complete list of ndn-cxx authors and contributors.
|
||||
*/
|
||||
|
||||
#ifndef NDN_CXX_UTIL_OPTIONAL_HPP
|
||||
#define NDN_CXX_UTIL_OPTIONAL_HPP
|
||||
|
||||
#define optional_CONFIG_SELECT_OPTIONAL optional_OPTIONAL_NONSTD
|
||||
#define optional_CONFIG_NO_EXTENSIONS 1
|
||||
#include "ndn-cxx/detail/nonstd/optional-lite.hpp"
|
||||
|
||||
namespace ndn {
|
||||
|
||||
using ::nonstd::optional;
|
||||
using ::nonstd::bad_optional_access;
|
||||
using ::nonstd::nullopt;
|
||||
using ::nonstd::nullopt_t;
|
||||
using ::nonstd::make_optional;
|
||||
|
||||
using ::nonstd::in_place;
|
||||
using ::nonstd::in_place_t;
|
||||
|
||||
} // namespace ndn
|
||||
|
||||
#endif // NDN_CXX_UTIL_OPTIONAL_HPP
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -27,6 +27,8 @@
|
||||
#include <boost/asio/wait_traits.hpp>
|
||||
#include <boost/chrono.hpp>
|
||||
|
||||
#include <limits>
|
||||
|
||||
namespace ndn {
|
||||
namespace time {
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2020 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -25,8 +25,8 @@ namespace ndn {
|
||||
namespace tests {
|
||||
|
||||
shared_ptr<Interest>
|
||||
makeInterest(const Name& name, bool canBePrefix, optional<time::milliseconds> lifetime,
|
||||
optional<Interest::Nonce> nonce)
|
||||
makeInterest(const Name& name, bool canBePrefix, std::optional<time::milliseconds> lifetime,
|
||||
std::optional<Interest::Nonce> nonce)
|
||||
{
|
||||
auto interest = std::make_shared<Interest>(name);
|
||||
interest->setCanBePrefix(canBePrefix);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2020 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -35,8 +35,8 @@ namespace tests {
|
||||
*/
|
||||
shared_ptr<Interest>
|
||||
makeInterest(const Name& name, bool canBePrefix = false,
|
||||
optional<time::milliseconds> lifetime = nullopt,
|
||||
optional<Interest::Nonce> nonce = nullopt);
|
||||
std::optional<time::milliseconds> lifetime = std::nullopt,
|
||||
std::optional<Interest::Nonce> nonce = std::nullopt);
|
||||
|
||||
/**
|
||||
* \brief Create a Data with a null (i.e., empty) signature
|
||||
@@ -70,7 +70,7 @@ makeNack(Interest interest, lp::NackReason reason);
|
||||
|
||||
/**
|
||||
* \brief Replace a name component in a packet
|
||||
* \param[inout] pkt the packet
|
||||
* \param[in,out] pkt the packet
|
||||
* \param index the index of the name component to replace
|
||||
* \param args arguments to name::Component constructor
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -427,14 +427,14 @@ BOOST_AUTO_TEST_CASE(PutNack)
|
||||
|
||||
BOOST_CHECK_EQUAL(face.sentNacks.size(), 0);
|
||||
|
||||
face.put(makeNack(*makeInterest("/unsolicited", false, nullopt, 18645250),
|
||||
face.put(makeNack(*makeInterest("/unsolicited", false, std::nullopt, 18645250),
|
||||
lp::NackReason::NO_ROUTE));
|
||||
advanceClocks(10_ms);
|
||||
BOOST_CHECK_EQUAL(face.sentNacks.size(), 0); // unsolicited Nack would not be sent
|
||||
|
||||
auto interest1 = makeInterest("/Hello/World", false, nullopt, 14247162);
|
||||
auto interest1 = makeInterest("/Hello/World", false, std::nullopt, 14247162);
|
||||
face.receive(*interest1);
|
||||
auto interest2 = makeInterest("/another/prefix", false, nullopt, 92203002);
|
||||
auto interest2 = makeInterest("/another/prefix", false, std::nullopt, 92203002);
|
||||
face.receive(*interest2);
|
||||
advanceClocks(10_ms);
|
||||
|
||||
@@ -465,7 +465,7 @@ BOOST_AUTO_TEST_CASE(PutMultipleNack)
|
||||
face.setInterestFilter("/", bind([&] { hasInterest2 = true; }));
|
||||
advanceClocks(10_ms);
|
||||
|
||||
auto interest = makeInterest("/A", false, nullopt, 14333271);
|
||||
auto interest = makeInterest("/A", false, std::nullopt, 14333271);
|
||||
face.receive(*interest);
|
||||
advanceClocks(10_ms);
|
||||
BOOST_CHECK(hasInterest1);
|
||||
@@ -496,7 +496,7 @@ BOOST_AUTO_TEST_CASE(PutMultipleNackLoopback)
|
||||
face.setInterestFilter(InterestFilter("/").allowLoopback(false),
|
||||
bind([] { BOOST_ERROR("Unexpected Interest on second InterestFilter"); }));
|
||||
|
||||
auto interest = makeInterest("/A", false, nullopt, 28395852);
|
||||
auto interest = makeInterest("/A", false, std::nullopt, 28395852);
|
||||
face.expressInterest(*interest,
|
||||
bind([] { BOOST_FAIL("Unexpected data"); }),
|
||||
[&] (const Interest&, const lp::Nack& nack) {
|
||||
|
||||
+16
-16
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -57,11 +57,11 @@ BOOST_AUTO_TEST_CASE(DefaultConstructor)
|
||||
BOOST_CHECK_EQUAL(i.getForwardingHint().empty(), true);
|
||||
BOOST_CHECK_EQUAL(i.hasNonce(), false);
|
||||
BOOST_CHECK_EQUAL(i.getInterestLifetime(), DEFAULT_INTEREST_LIFETIME);
|
||||
BOOST_CHECK(i.getHopLimit() == nullopt);
|
||||
BOOST_CHECK(i.getHopLimit() == std::nullopt);
|
||||
BOOST_CHECK_EQUAL(i.hasApplicationParameters(), false);
|
||||
BOOST_CHECK_EQUAL(i.getApplicationParameters().isValid(), false);
|
||||
BOOST_CHECK_EQUAL(i.isParametersDigestValid(), true);
|
||||
BOOST_CHECK(i.getSignatureInfo() == nullopt);
|
||||
BOOST_CHECK(i.getSignatureInfo() == std::nullopt);
|
||||
BOOST_CHECK_EQUAL(i.getSignatureValue().isValid(), false);
|
||||
BOOST_CHECK_EQUAL(i.isSigned(), false);
|
||||
}
|
||||
@@ -96,10 +96,10 @@ BOOST_AUTO_TEST_CASE(Basic)
|
||||
BOOST_CHECK_EQUAL(i2.hasNonce(), true);
|
||||
BOOST_CHECK_EQUAL(i2.getNonce(), 0x01020304);
|
||||
BOOST_CHECK_EQUAL(i2.getInterestLifetime(), DEFAULT_INTEREST_LIFETIME);
|
||||
BOOST_CHECK(i2.getHopLimit() == nullopt);
|
||||
BOOST_CHECK(i2.getHopLimit() == std::nullopt);
|
||||
BOOST_CHECK_EQUAL(i2.hasApplicationParameters(), false);
|
||||
BOOST_CHECK_EQUAL(i2.getApplicationParameters().isValid(), false);
|
||||
BOOST_CHECK(i2.getSignatureInfo() == nullopt);
|
||||
BOOST_CHECK(i2.getSignatureInfo() == std::nullopt);
|
||||
BOOST_CHECK_EQUAL(i2.getSignatureValue().isValid(), false);
|
||||
BOOST_CHECK_EQUAL(i2.isSigned(), false);
|
||||
}
|
||||
@@ -140,10 +140,10 @@ BOOST_AUTO_TEST_CASE(WithParameters)
|
||||
BOOST_CHECK_EQUAL(i2.hasNonce(), true);
|
||||
BOOST_CHECK_EQUAL(i2.getNonce(), 0x1);
|
||||
BOOST_CHECK_EQUAL(i2.getInterestLifetime(), DEFAULT_INTEREST_LIFETIME);
|
||||
BOOST_CHECK(i2.getHopLimit() == nullopt);
|
||||
BOOST_CHECK(i2.getHopLimit() == std::nullopt);
|
||||
BOOST_CHECK_EQUAL(i2.hasApplicationParameters(), true);
|
||||
BOOST_CHECK_EQUAL(i2.getApplicationParameters(), "2404C0C1C2C3"_block);
|
||||
BOOST_CHECK(i2.getSignatureInfo() == nullopt);
|
||||
BOOST_CHECK(i2.getSignatureInfo() == std::nullopt);
|
||||
BOOST_CHECK_EQUAL(i2.getSignatureValue().isValid(), false);
|
||||
BOOST_CHECK_EQUAL(i2.isSigned(), false);
|
||||
}
|
||||
@@ -402,7 +402,7 @@ BOOST_AUTO_TEST_CASE(NameOnly)
|
||||
BOOST_CHECK_EQUAL(i.getForwardingHint().empty(), true);
|
||||
BOOST_CHECK_EQUAL(i.hasNonce(), false);
|
||||
BOOST_CHECK_EQUAL(i.getInterestLifetime(), DEFAULT_INTEREST_LIFETIME);
|
||||
BOOST_CHECK(i.getHopLimit() == nullopt);
|
||||
BOOST_CHECK(i.getHopLimit() == std::nullopt);
|
||||
BOOST_CHECK_EQUAL(i.hasApplicationParameters(), false);
|
||||
BOOST_CHECK_EQUAL(i.getApplicationParameters().isValid(), false);
|
||||
|
||||
@@ -422,7 +422,7 @@ BOOST_AUTO_TEST_CASE(NameCanBePrefix)
|
||||
BOOST_CHECK_EQUAL(i.getForwardingHint().empty(), true);
|
||||
BOOST_CHECK_EQUAL(i.hasNonce(), false);
|
||||
BOOST_CHECK_EQUAL(i.getInterestLifetime(), DEFAULT_INTEREST_LIFETIME);
|
||||
BOOST_CHECK(i.getHopLimit() == nullopt);
|
||||
BOOST_CHECK(i.getHopLimit() == std::nullopt);
|
||||
BOOST_CHECK_EQUAL(i.hasApplicationParameters(), false);
|
||||
BOOST_CHECK_EQUAL(i.getApplicationParameters().isValid(), false);
|
||||
}
|
||||
@@ -789,7 +789,7 @@ BOOST_AUTO_TEST_CASE(SetNonce)
|
||||
BOOST_CHECK_EQUAL(i2.getNonce(), 2);
|
||||
BOOST_CHECK_EQUAL(i1.getNonce(), 1); // should not affect i1's Nonce (Bug #4168)
|
||||
|
||||
i2.setNonce(nullopt);
|
||||
i2.setNonce(std::nullopt);
|
||||
BOOST_CHECK(!i2.hasNonce());
|
||||
}
|
||||
|
||||
@@ -852,11 +852,11 @@ BOOST_AUTO_TEST_CASE(SetInterestLifetime)
|
||||
BOOST_AUTO_TEST_CASE(SetHopLimit)
|
||||
{
|
||||
Interest i;
|
||||
BOOST_CHECK(i.getHopLimit() == nullopt);
|
||||
BOOST_CHECK(i.getHopLimit() == std::nullopt);
|
||||
i.setHopLimit(42);
|
||||
BOOST_CHECK(i.getHopLimit() == 42);
|
||||
i.setHopLimit(nullopt);
|
||||
BOOST_CHECK(i.getHopLimit() == nullopt);
|
||||
i.setHopLimit(std::nullopt);
|
||||
BOOST_CHECK(i.getHopLimit() == std::nullopt);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(SetApplicationParameters)
|
||||
@@ -901,7 +901,7 @@ BOOST_AUTO_TEST_CASE(SetSignature)
|
||||
return e.what() == "InterestSignatureInfo must be present to set InterestSignatureValue"s;
|
||||
});
|
||||
|
||||
BOOST_CHECK(i.getSignatureInfo() == nullopt);
|
||||
BOOST_CHECK(i.getSignatureInfo() == std::nullopt);
|
||||
BOOST_CHECK_EQUAL(i.getSignatureValue().isValid(), false);
|
||||
BOOST_CHECK_EQUAL(i.isSigned(), false);
|
||||
|
||||
@@ -1010,7 +1010,7 @@ BOOST_AUTO_TEST_CASE(ParametersSha256DigestComponent)
|
||||
BOOST_CHECK(i.getSignatureInfo() == si);
|
||||
|
||||
i.unsetApplicationParameters(); // removes ParametersSha256DigestComponent and InterestSignatureInfo
|
||||
BOOST_CHECK(i.getSignatureInfo() == nullopt);
|
||||
BOOST_CHECK(i.getSignatureInfo() == std::nullopt);
|
||||
BOOST_CHECK_EQUAL(i.getSignatureValue().isValid(), false);
|
||||
BOOST_CHECK_EQUAL(i.getName(), "/A/B/C");
|
||||
|
||||
@@ -1157,7 +1157,7 @@ BOOST_AUTO_TEST_CASE(ToUri)
|
||||
|
||||
i.setCanBePrefix(false);
|
||||
i.setMustBeFresh(false);
|
||||
i.setHopLimit(nullopt);
|
||||
i.setHopLimit(std::nullopt);
|
||||
i.setApplicationParameters("2402CAFE"_block);
|
||||
BOOST_CHECK_EQUAL(i.toUri(),
|
||||
"/foo/params-sha256=8621f5e8321f04104640c8d02877d7c5142cad6e203c5effda1783b1a0e476d6"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -20,7 +20,6 @@
|
||||
*/
|
||||
|
||||
#include "ndn-cxx/meta-info.hpp"
|
||||
#include "ndn-cxx/data.hpp"
|
||||
|
||||
#include "tests/boost-test.hpp"
|
||||
|
||||
@@ -35,7 +34,7 @@ BOOST_AUTO_TEST_CASE(EncodeDecode)
|
||||
MetaInfo a("1406 type=180100 freshness=190100"_block);
|
||||
BOOST_CHECK_EQUAL(a.getType(), tlv::ContentType_Blob);
|
||||
BOOST_CHECK_EQUAL(a.getFreshnessPeriod(), 0_ms);
|
||||
BOOST_CHECK(a.getFinalBlock() == nullopt);
|
||||
BOOST_CHECK(a.getFinalBlock() == std::nullopt);
|
||||
|
||||
MetaInfo b;
|
||||
BOOST_CHECK_NE(a.wireEncode(), b.wireEncode());
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
}
|
||||
|
||||
void
|
||||
checkFindByInterest(const Name& name, bool canBePrefix, optional<Certificate> expected) const
|
||||
checkFindByInterest(const Name& name, bool canBePrefix, std::optional<Certificate> expected) const
|
||||
{
|
||||
Interest interest(name);
|
||||
interest.setCanBePrefix(canBePrefix);
|
||||
@@ -95,10 +95,10 @@ BOOST_AUTO_TEST_CASE(FindByInterest)
|
||||
checkFindByInterest(cert.getIdentity(), true, cert);
|
||||
checkFindByInterest(cert.getKeyName(), true, cert);
|
||||
checkFindByInterest(cert.getName(), false, cert);
|
||||
checkFindByInterest(Name(cert.getName()).appendVersion(), true, nullopt);
|
||||
checkFindByInterest(Name(cert.getName()).appendVersion(), true, std::nullopt);
|
||||
|
||||
advanceClocks(12_s);
|
||||
checkFindByInterest(cert.getIdentity(), true, nullopt);
|
||||
checkFindByInterest(cert.getIdentity(), true, std::nullopt);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END() // TestCertificateCache
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -366,7 +366,7 @@ Signature Information:
|
||||
sigInfo.removeCustomTlv(tlv::AdditionalDescription);
|
||||
sigInfo.addCustomTlv(makeStringBlock(tlv::ValidityPeriod, "malformed"));
|
||||
sigInfo.setSignatureType(tlv::DigestSha256);
|
||||
sigInfo.setKeyLocator(nullopt);
|
||||
sigInfo.setKeyLocator(std::nullopt);
|
||||
Certificate cert6(cert3);
|
||||
cert6.setSignatureInfo(sigInfo);
|
||||
BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(cert6), expected6);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -427,7 +427,7 @@ struct AsymmetricSigningBase : protected KeyChainFixture, protected PacketType
|
||||
|
||||
const uint32_t expectedSigType = SignatureTypeTlvValue;
|
||||
const bool shouldHaveKeyLocator = true;
|
||||
const optional<KeyLocator> expectedKeyLocator = cert.getName();
|
||||
const std::optional<KeyLocator> expectedKeyLocator = cert.getName();
|
||||
|
||||
bool
|
||||
verify(const SigningInfo&) const
|
||||
@@ -504,7 +504,7 @@ struct HmacSigning : protected KeyChainFixture, protected PacketType
|
||||
|
||||
const uint32_t expectedSigType = SignatureTypeTlvValue;
|
||||
const bool shouldHaveKeyLocator = true;
|
||||
const optional<KeyLocator> expectedKeyLocator = nullopt; // don't check KeyLocator value
|
||||
const std::optional<KeyLocator> expectedKeyLocator = std::nullopt; // don't check KeyLocator value
|
||||
|
||||
bool
|
||||
verify(const SigningInfo& si) const
|
||||
@@ -524,12 +524,12 @@ struct Sha256Signing : protected KeyChainFixture, protected PacketType
|
||||
|
||||
const uint32_t expectedSigType = tlv::DigestSha256;
|
||||
const bool shouldHaveKeyLocator = false;
|
||||
const optional<KeyLocator> expectedKeyLocator = nullopt;
|
||||
const std::optional<KeyLocator> expectedKeyLocator = std::nullopt;
|
||||
|
||||
bool
|
||||
verify(const SigningInfo&) const
|
||||
{
|
||||
return verifySignature(this->packet, nullopt);
|
||||
return verifySignature(this->packet, std::nullopt);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -591,7 +591,8 @@ public:
|
||||
}
|
||||
|
||||
void
|
||||
checkKeyLocatorName(const Certificate& cert, const optional<Name>& klName = nullopt) const
|
||||
checkKeyLocatorName(const Certificate& cert,
|
||||
const std::optional<Name>& klName = std::nullopt) const
|
||||
{
|
||||
auto kl = cert.getKeyLocator();
|
||||
if (!kl.has_value()) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -20,7 +20,6 @@
|
||||
*/
|
||||
|
||||
#include "ndn-cxx/security/trust-anchor-container.hpp"
|
||||
#include "ndn-cxx/util/io.hpp"
|
||||
|
||||
#include "tests/boost-test.hpp"
|
||||
#include "tests/key-chain-fixture.hpp"
|
||||
@@ -61,7 +60,7 @@ public:
|
||||
}
|
||||
|
||||
void
|
||||
checkFindByInterest(const Name& name, bool canBePrefix, optional<Certificate> expected) const
|
||||
checkFindByInterest(const Name& name, bool canBePrefix, std::optional<Certificate> expected) const
|
||||
{
|
||||
Interest interest(name);
|
||||
interest.setCanBePrefix(canBePrefix);
|
||||
@@ -172,7 +171,7 @@ BOOST_AUTO_TEST_CASE(FindByInterest)
|
||||
checkFindByInterest(identity1.getName().getPrefix(-1), true, cert1);
|
||||
checkFindByInterest(cert1.getKeyName(), true, cert1);
|
||||
checkFindByInterest(cert1.getName(), false, cert1);
|
||||
checkFindByInterest(Name(identity1.getName()).appendVersion(), true, nullopt);
|
||||
checkFindByInterest(Name(identity1.getName()).appendVersion(), true, std::nullopt);
|
||||
|
||||
auto makeIdentity1Cert = [=] (const std::string& issuerId) {
|
||||
auto key = identity1.getDefaultKey();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -64,16 +64,16 @@ class ValidationPolicyCommandInterestFixture
|
||||
{
|
||||
protected:
|
||||
Interest
|
||||
makeCommandInterest(const Identity& identity, SignedInterestFormat format = SignedInterestFormat::V02)
|
||||
makeCommandInterest(const Identity& id, SignedInterestFormat format = SignedInterestFormat::V02)
|
||||
{
|
||||
Name name = identity.getName();
|
||||
Name name = id.getName();
|
||||
name.append("CMD");
|
||||
switch (format) {
|
||||
case SignedInterestFormat::V02:
|
||||
return m_signer.makeCommandInterest(name, signingByIdentity(identity));
|
||||
return m_signer.makeCommandInterest(name, signingByIdentity(id));
|
||||
case SignedInterestFormat::V03: {
|
||||
Interest interest(name);
|
||||
m_signer.makeSignedInterest(interest, signingByIdentity(identity));
|
||||
m_signer.makeSignedInterest(interest, signingByIdentity(id));
|
||||
return interest;
|
||||
}
|
||||
}
|
||||
@@ -198,7 +198,7 @@ BOOST_AUTO_TEST_CASE(BadTimestampV03)
|
||||
{
|
||||
auto i1 = makeCommandInterest(identity, SignedInterestFormat::V03);
|
||||
auto si = i1.getSignatureInfo().value();
|
||||
si.setTime(nullopt);
|
||||
si.setTime(std::nullopt);
|
||||
i1.setSignatureInfo(si);
|
||||
VALIDATE_FAILURE(i1, "Should fail (timestamp is missing)");
|
||||
BOOST_TEST(lastError.getCode() == ValidationError::POLICY_ERROR);
|
||||
@@ -218,7 +218,7 @@ BOOST_AUTO_TEST_CASE(MissingKeyLocatorV03)
|
||||
{
|
||||
auto i1 = makeCommandInterest(identity, SignedInterestFormat::V03);
|
||||
auto si = i1.getSignatureInfo().value();
|
||||
si.setKeyLocator(nullopt);
|
||||
si.setKeyLocator(std::nullopt);
|
||||
i1.setSignatureInfo(si);
|
||||
VALIDATE_FAILURE(i1, "Should fail (missing KeyLocator)");
|
||||
BOOST_TEST(lastError.getCode() == ValidationError::INVALID_KEY_LOCATOR);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -158,7 +158,7 @@ public:
|
||||
|
||||
private:
|
||||
void
|
||||
verifyOriginalPacket(const optional<Certificate>&) override
|
||||
verifyOriginalPacket(const std::optional<Certificate>&) override
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -632,21 +632,21 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(VerifyDigest, Dataset, DigestDatasets)
|
||||
Interest interestOldFormat(dataset.goodInterestOldFormat);
|
||||
Interest badSigInterestOldFormat(dataset.badSigInterestOldFormat);
|
||||
|
||||
BOOST_CHECK(verifySignature(data, nullopt));
|
||||
BOOST_CHECK(verifySignature(interest, nullopt));
|
||||
BOOST_CHECK(verifySignature(interestOldFormat, nullopt));
|
||||
BOOST_CHECK(verifySignature(data, std::nullopt));
|
||||
BOOST_CHECK(verifySignature(interest, std::nullopt));
|
||||
BOOST_CHECK(verifySignature(interestOldFormat, std::nullopt));
|
||||
|
||||
BOOST_CHECK(!verifySignature(badSigData, nullopt));
|
||||
BOOST_CHECK(!verifySignature(badSigInterest, nullopt));
|
||||
BOOST_CHECK(!verifySignature(badSigInterestOldFormat, nullopt));
|
||||
BOOST_CHECK(!verifySignature(badSigData, std::nullopt));
|
||||
BOOST_CHECK(!verifySignature(badSigInterest, std::nullopt));
|
||||
BOOST_CHECK(!verifySignature(badSigInterestOldFormat, std::nullopt));
|
||||
|
||||
Data unsignedData("/some/data");
|
||||
Interest unsignedInterest1("/some/interest/with/several/name/components");
|
||||
Interest unsignedInterest2("/interest-with-one-name-component");
|
||||
|
||||
BOOST_CHECK(!verifySignature(unsignedData, nullopt));
|
||||
BOOST_CHECK(!verifySignature(unsignedInterest1, nullopt));
|
||||
BOOST_CHECK(!verifySignature(unsignedInterest2, nullopt));
|
||||
BOOST_CHECK(!verifySignature(unsignedData, std::nullopt));
|
||||
BOOST_CHECK(!verifySignature(unsignedInterest1, std::nullopt));
|
||||
BOOST_CHECK(!verifySignature(unsignedInterest2, std::nullopt));
|
||||
}
|
||||
|
||||
const uint8_t sha256DataUnrecognizedElements[] = {
|
||||
@@ -673,8 +673,8 @@ BOOST_AUTO_TEST_CASE(VerifyWithUnrecognizedElements) // Bug #4583
|
||||
Data data(Block{sha256DataUnrecognizedElements});
|
||||
Interest interest(Block{sha256InterestUnrecognizedElements});
|
||||
|
||||
BOOST_CHECK(verifySignature(data, nullopt));
|
||||
BOOST_CHECK(verifySignature(interest, nullopt));
|
||||
BOOST_CHECK(verifySignature(data, std::nullopt));
|
||||
BOOST_CHECK(verifySignature(interest, std::nullopt));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END() // TestVerificationHelpers
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2022 Regents of the University of California.
|
||||
* Copyright (c) 2013-2023 Regents of the University of California.
|
||||
*
|
||||
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
|
||||
*
|
||||
@@ -100,7 +100,7 @@ BOOST_AUTO_TEST_CASE(KeyLocatorField)
|
||||
|
||||
info.wireEncode();
|
||||
BOOST_CHECK_EQUAL(info.hasWire(), true);
|
||||
info.setKeyLocator(nullopt);
|
||||
info.setKeyLocator(std::nullopt);
|
||||
BOOST_CHECK_EQUAL(info.hasKeyLocator(), false);
|
||||
BOOST_CHECK_THROW(info.getKeyLocator(), SignatureInfo::Error);
|
||||
BOOST_CHECK_EQUAL(info.hasWire(), false);
|
||||
@@ -127,7 +127,7 @@ BOOST_AUTO_TEST_CASE(SignatureNonce)
|
||||
|
||||
info.wireEncode();
|
||||
BOOST_CHECK_EQUAL(info.hasWire(), true);
|
||||
info.setNonce(nullopt);
|
||||
info.setNonce(std::nullopt);
|
||||
BOOST_CHECK_EQUAL(info.hasWire(), false);
|
||||
BOOST_CHECK(!info.getNonce());
|
||||
}
|
||||
@@ -152,7 +152,7 @@ BOOST_AUTO_TEST_CASE(SignatureTime)
|
||||
|
||||
info.wireEncode();
|
||||
BOOST_CHECK_EQUAL(info.hasWire(), true);
|
||||
info.setTime(nullopt);
|
||||
info.setTime(std::nullopt);
|
||||
BOOST_CHECK_EQUAL(info.hasWire(), false);
|
||||
BOOST_CHECK(!info.getTime());
|
||||
}
|
||||
@@ -176,7 +176,7 @@ BOOST_AUTO_TEST_CASE(SignatureSeqNum)
|
||||
|
||||
info.wireEncode();
|
||||
BOOST_CHECK_EQUAL(info.hasWire(), true);
|
||||
info.setSeqNum(nullopt);
|
||||
info.setSeqNum(std::nullopt);
|
||||
BOOST_CHECK_EQUAL(info.hasWire(), false);
|
||||
BOOST_CHECK(!info.getSeqNum());
|
||||
}
|
||||
@@ -452,7 +452,7 @@ BOOST_AUTO_TEST_CASE(ValidityPeriod)
|
||||
|
||||
info2.wireEncode();
|
||||
BOOST_CHECK_EQUAL(info2.hasWire(), true);
|
||||
info2.setValidityPeriod(nullopt);
|
||||
info2.setValidityPeriod(std::nullopt);
|
||||
BOOST_CHECK_THROW(info2.getValidityPeriod(), SignatureInfo::Error);
|
||||
BOOST_CHECK_EQUAL(info2.hasWire(), false);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user