Move BOOST_CONCEPT_ASSERT to unit tests where possible
Change-Id: I0c6ae494eb7be4ab2ff422ba6d866ead9e75f4eb
This commit is contained in:
1 parent
3fdb02f62e
commit
152ef44da9
85 files changed
+472
-484
No files matched your search
+13
-12
@@ -37,33 +37,34 @@ public:
|
||||
run()
|
||||
{
|
||||
m_face.setInterestFilter("/example/testApp/randomData",
|
||||
std::bind(&Producer::onInterest, this, _1, _2),
|
||||
std::bind(&Producer::onInterest, this, _2),
|
||||
nullptr, // RegisterPrefixSuccessCallback is optional
|
||||
std::bind(&Producer::onRegisterFailed, this, _1, _2));
|
||||
|
||||
auto cert = m_keyChain.getPib().getDefaultIdentity().getDefaultKey().getDefaultCertificate();
|
||||
m_certServeHandle = m_face.setInterestFilter(security::extractIdentityFromCertName(cert.getName()),
|
||||
[this, cert] (auto&&...) {
|
||||
m_face.put(cert);
|
||||
},
|
||||
std::bind(&Producer::onRegisterFailed, this, _1, _2));
|
||||
[this, cert] (auto&&...) {
|
||||
m_face.put(cert);
|
||||
},
|
||||
std::bind(&Producer::onRegisterFailed, this, _1, _2));
|
||||
m_face.processEvents();
|
||||
}
|
||||
|
||||
private:
|
||||
void
|
||||
onInterest(const InterestFilter&, const Interest& interest)
|
||||
onInterest(const Interest& interest)
|
||||
{
|
||||
std::cout << ">> I: " << interest << std::endl;
|
||||
|
||||
constexpr std::string_view content{"Hello, world!"};
|
||||
|
||||
// Create Data packet
|
||||
auto data = std::make_shared<Data>(interest.getName());
|
||||
auto data = std::make_shared<Data>();
|
||||
data->setName(interest.getName());
|
||||
data->setFreshnessPeriod(10_s);
|
||||
data->setContent(make_span(reinterpret_cast<const uint8_t*>(content.data()), content.size()));
|
||||
|
||||
// in order for the consumer application to be able to validate the packet, you need to setup
|
||||
constexpr std::string_view content{"Hello, world!"};
|
||||
data->setContent({reinterpret_cast<const uint8_t*>(content.data()), content.size()});
|
||||
|
||||
// In order for the consumer application to be able to validate the packet, you need to setup
|
||||
// the following keys:
|
||||
// 1. Generate example trust anchor
|
||||
//
|
||||
@@ -91,7 +92,7 @@ private:
|
||||
onRegisterFailed(const Name& prefix, const std::string& reason)
|
||||
{
|
||||
std::cerr << "ERROR: Failed to register prefix '" << prefix
|
||||
<< "' with the local forwarder (" << reason << ")" << std::endl;
|
||||
<< "' with the local forwarder (" << reason << ")\n";
|
||||
m_face.shutdown();
|
||||
}
|
||||
|
||||
|
||||
@@ -24,13 +24,6 @@
|
||||
|
||||
namespace ndn {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Data>));
|
||||
BOOST_CONCEPT_ASSERT((WireEncodable<Data>));
|
||||
BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<Data>));
|
||||
BOOST_CONCEPT_ASSERT((WireDecodable<Data>));
|
||||
static_assert(std::is_convertible_v<Data::Error*, tlv::Error*>,
|
||||
"Data::Error must inherit from tlv::Error");
|
||||
|
||||
Data::Data(const Name& name)
|
||||
: m_name(name)
|
||||
{
|
||||
|
||||
@@ -111,7 +111,6 @@ NDN_CXX_SPECIALIZE_BOOST_IS_PLACEHOLDER_FOR_STD_PLACEHOLDER(9)
|
||||
/// \endcond
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/concept_check.hpp>
|
||||
#include <boost/core/noncopyable.hpp>
|
||||
|
||||
namespace ndn {
|
||||
|
||||
@@ -257,7 +257,7 @@ makeBinaryBlock(uint32_t type, Iterator first, Iterator last)
|
||||
* @param length length of value buffer
|
||||
* @deprecated Use makeStringBlock()
|
||||
*/
|
||||
[[deprecated("use makeStringBlock")]]
|
||||
[[deprecated("use makeStringBlock()")]]
|
||||
inline Block
|
||||
makeBinaryBlock(uint32_t type, const char* value, size_t length)
|
||||
{
|
||||
|
||||
@@ -37,8 +37,6 @@
|
||||
|
||||
namespace ndn {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Block>));
|
||||
|
||||
constexpr size_t MAX_SIZE_OF_BLOCK_FROM_STREAM = MAX_NDN_PACKET_SIZE;
|
||||
|
||||
// ---- constructor, creation, assignment ----
|
||||
|
||||
@@ -246,6 +246,7 @@ public: // wire format
|
||||
/**
|
||||
* @deprecated Use data()
|
||||
*/
|
||||
[[deprecated("use data()")]]
|
||||
const uint8_t*
|
||||
wire() const
|
||||
{
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
#include <boost/asio/basic_socket.hpp>
|
||||
#include <boost/bind/bind.hpp>
|
||||
#include <boost/chrono.hpp>
|
||||
#include <boost/concept_check.hpp>
|
||||
#include <boost/endian/conversion.hpp>
|
||||
#include <boost/iostreams/stream.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
@@ -35,14 +35,6 @@
|
||||
|
||||
namespace ndn {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((WireEncodable<Interest>));
|
||||
BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<Interest>));
|
||||
BOOST_CONCEPT_ASSERT((WireDecodable<Interest>));
|
||||
static_assert(std::is_convertible_v<Interest::Error*, tlv::Error*>,
|
||||
"Interest::Error must inherit from tlv::Error");
|
||||
|
||||
bool Interest::s_autoCheckParametersDigest = true;
|
||||
|
||||
Interest::Interest(const Name& name, time::milliseconds lifetime)
|
||||
{
|
||||
setName(name);
|
||||
|
||||
@@ -490,8 +490,6 @@ private:
|
||||
findFirstParameter(uint32_t type) const;
|
||||
|
||||
private:
|
||||
static bool s_autoCheckParametersDigest;
|
||||
|
||||
Name m_name;
|
||||
std::vector<Name> m_forwardingHint;
|
||||
mutable std::optional<Nonce> m_nonce;
|
||||
@@ -509,6 +507,8 @@ private:
|
||||
std::vector<Block> m_parameters;
|
||||
|
||||
mutable Block m_wire;
|
||||
|
||||
static inline bool s_autoCheckParametersDigest = true;
|
||||
};
|
||||
|
||||
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(Interest);
|
||||
|
||||
@@ -27,13 +27,6 @@
|
||||
|
||||
namespace ndn {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<KeyLocator>));
|
||||
BOOST_CONCEPT_ASSERT((WireEncodable<KeyLocator>));
|
||||
BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<KeyLocator>));
|
||||
BOOST_CONCEPT_ASSERT((WireDecodable<KeyLocator>));
|
||||
static_assert(std::is_convertible_v<KeyLocator::Error*, tlv::Error*>,
|
||||
"KeyLocator::Error must inherit from tlv::Error");
|
||||
|
||||
constexpr size_t MAX_KEY_DIGEST_OCTETS_TO_SHOW = 8;
|
||||
|
||||
KeyLocator::KeyLocator() = default;
|
||||
|
||||
@@ -25,13 +25,6 @@
|
||||
|
||||
namespace ndn {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Link>));
|
||||
BOOST_CONCEPT_ASSERT((WireEncodable<Link>));
|
||||
BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<Link>));
|
||||
BOOST_CONCEPT_ASSERT((WireDecodable<Link>));
|
||||
static_assert(std::is_convertible_v<Link::Error*, Data::Error*>,
|
||||
"Link::Error should inherit from Data::Error");
|
||||
|
||||
Link::Link() = default;
|
||||
|
||||
Link::Link(const Block& wire)
|
||||
|
||||
@@ -22,11 +22,8 @@
|
||||
#ifndef NDN_CXX_LP_FIELD_DECL_HPP
|
||||
#define NDN_CXX_LP_FIELD_DECL_HPP
|
||||
|
||||
#include "ndn-cxx/lp/empty-value.hpp"
|
||||
#include "ndn-cxx/lp/field.hpp"
|
||||
#include "ndn-cxx/lp/sequence.hpp"
|
||||
#include "ndn-cxx/lp/tlv.hpp"
|
||||
#include "ndn-cxx/encoding/block-helpers.hpp"
|
||||
#include "ndn-cxx/lp/empty-value.hpp"
|
||||
#include "ndn-cxx/util/concepts.hpp"
|
||||
|
||||
#include <boost/concept/requires.hpp>
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
#ifndef NDN_CXX_LP_FIELD_HPP
|
||||
#define NDN_CXX_LP_FIELD_HPP
|
||||
|
||||
#include "ndn-cxx/detail/common.hpp"
|
||||
#include "ndn-cxx/encoding/encoding-buffer.hpp"
|
||||
#include "ndn-cxx/util/concepts.hpp"
|
||||
|
||||
#include <boost/concept/usage.hpp>
|
||||
|
||||
namespace ndn {
|
||||
namespace lp {
|
||||
@@ -65,6 +65,7 @@ struct Field
|
||||
static_assert(std::is_same_v<typename X::IsRepeatable::value_type, bool>, "");
|
||||
static_assert(std::is_default_constructible_v<typename X::ValueType>, "");
|
||||
static_assert(std::is_copy_constructible_v<typename X::ValueType>, "");
|
||||
|
||||
BOOST_CONCEPT_USAGE(Field)
|
||||
{
|
||||
Block wire;
|
||||
|
||||
+31
-40
@@ -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).
|
||||
*
|
||||
@@ -22,21 +22,33 @@
|
||||
#ifndef NDN_CXX_LP_FIELDS_HPP
|
||||
#define NDN_CXX_LP_FIELDS_HPP
|
||||
|
||||
#include "ndn-cxx/lp/field-decl.hpp"
|
||||
|
||||
#include "ndn-cxx/lp/cache-policy.hpp"
|
||||
#include "ndn-cxx/lp/empty-value.hpp"
|
||||
#include "ndn-cxx/lp/field.hpp"
|
||||
#include "ndn-cxx/lp/field-decl.hpp"
|
||||
#include "ndn-cxx/lp/nack-header.hpp"
|
||||
#include "ndn-cxx/lp/prefix-announcement-header.hpp"
|
||||
#include "ndn-cxx/lp/sequence.hpp"
|
||||
#include "ndn-cxx/lp/tlv.hpp"
|
||||
|
||||
#include <boost/mpl/set.hpp>
|
||||
|
||||
namespace ndn {
|
||||
namespace lp {
|
||||
|
||||
/**
|
||||
* \brief Declare the Fragment field.
|
||||
*
|
||||
* The fragment (i.e., payload) is the range of bytes between two provided iterators.
|
||||
* During encoding, these bytes are copied from the Buffer into the LpPacket.
|
||||
*/
|
||||
typedef FieldDecl<field_location_tags::Fragment,
|
||||
std::pair<Buffer::const_iterator, Buffer::const_iterator>,
|
||||
tlv::Fragment> FragmentField;
|
||||
|
||||
typedef FieldDecl<field_location_tags::Header,
|
||||
Sequence,
|
||||
tlv::Sequence> SequenceField;
|
||||
BOOST_CONCEPT_ASSERT((Field<SequenceField>));
|
||||
|
||||
typedef FieldDecl<field_location_tags::Header,
|
||||
uint64_t,
|
||||
@@ -44,7 +56,6 @@ typedef FieldDecl<field_location_tags::Header,
|
||||
false,
|
||||
NonNegativeIntegerTag,
|
||||
NonNegativeIntegerTag> FragIndexField;
|
||||
BOOST_CONCEPT_ASSERT((Field<FragIndexField>));
|
||||
|
||||
typedef FieldDecl<field_location_tags::Header,
|
||||
uint64_t,
|
||||
@@ -52,30 +63,14 @@ typedef FieldDecl<field_location_tags::Header,
|
||||
false,
|
||||
NonNegativeIntegerTag,
|
||||
NonNegativeIntegerTag> FragCountField;
|
||||
BOOST_CONCEPT_ASSERT((Field<FragCountField>));
|
||||
|
||||
typedef FieldDecl<field_location_tags::Header,
|
||||
std::pair<Buffer::const_iterator, Buffer::const_iterator>,
|
||||
tlv::PitToken> PitTokenField;
|
||||
BOOST_CONCEPT_ASSERT((Field<PitTokenField>));
|
||||
|
||||
typedef FieldDecl<field_location_tags::Header,
|
||||
NackHeader,
|
||||
tlv::Nack> NackField;
|
||||
BOOST_CONCEPT_ASSERT((Field<NackField>));
|
||||
|
||||
typedef FieldDecl<field_location_tags::Header,
|
||||
uint64_t,
|
||||
tlv::NextHopFaceId,
|
||||
false,
|
||||
NonNegativeIntegerTag,
|
||||
NonNegativeIntegerTag> NextHopFaceIdField;
|
||||
BOOST_CONCEPT_ASSERT((Field<NextHopFaceIdField>));
|
||||
|
||||
typedef FieldDecl<field_location_tags::Header,
|
||||
CachePolicy,
|
||||
tlv::CachePolicy> CachePolicyField;
|
||||
BOOST_CONCEPT_ASSERT((Field<CachePolicyField>));
|
||||
|
||||
typedef FieldDecl<field_location_tags::Header,
|
||||
uint64_t,
|
||||
@@ -83,7 +78,17 @@ typedef FieldDecl<field_location_tags::Header,
|
||||
false,
|
||||
NonNegativeIntegerTag,
|
||||
NonNegativeIntegerTag> IncomingFaceIdField;
|
||||
BOOST_CONCEPT_ASSERT((Field<IncomingFaceIdField>));
|
||||
|
||||
typedef FieldDecl<field_location_tags::Header,
|
||||
uint64_t,
|
||||
tlv::NextHopFaceId,
|
||||
false,
|
||||
NonNegativeIntegerTag,
|
||||
NonNegativeIntegerTag> NextHopFaceIdField;
|
||||
|
||||
typedef FieldDecl<field_location_tags::Header,
|
||||
CachePolicy,
|
||||
tlv::CachePolicy> CachePolicyField;
|
||||
|
||||
typedef FieldDecl<field_location_tags::Header,
|
||||
uint64_t,
|
||||
@@ -91,42 +96,28 @@ typedef FieldDecl<field_location_tags::Header,
|
||||
false,
|
||||
NonNegativeIntegerTag,
|
||||
NonNegativeIntegerTag> CongestionMarkField;
|
||||
BOOST_CONCEPT_ASSERT((Field<CongestionMarkField>));
|
||||
|
||||
typedef FieldDecl<field_location_tags::Header,
|
||||
Sequence,
|
||||
tlv::Ack,
|
||||
true> AckField;
|
||||
BOOST_CONCEPT_ASSERT((Field<AckField>));
|
||||
|
||||
typedef FieldDecl<field_location_tags::Header,
|
||||
Sequence,
|
||||
tlv::TxSequence> TxSequenceField;
|
||||
BOOST_CONCEPT_ASSERT((Field<TxSequenceField>));
|
||||
|
||||
typedef FieldDecl<field_location_tags::Header,
|
||||
EmptyValue,
|
||||
tlv::NonDiscovery> NonDiscoveryField;
|
||||
BOOST_CONCEPT_ASSERT((Field<NonDiscoveryField>));
|
||||
|
||||
typedef FieldDecl<field_location_tags::Header,
|
||||
PrefixAnnouncementHeader,
|
||||
tlv::PrefixAnnouncement> PrefixAnnouncementField;
|
||||
BOOST_CONCEPT_ASSERT((Field<PrefixAnnouncementField>));
|
||||
|
||||
/** \brief Declare the Fragment field.
|
||||
*
|
||||
* The fragment (i.e. payload) is the bytes between two provided iterators. During encoding,
|
||||
* these bytes are copied from the Buffer into the LpPacket.
|
||||
/**
|
||||
* \brief Set of all field declarations.
|
||||
*/
|
||||
typedef FieldDecl<field_location_tags::Fragment,
|
||||
std::pair<Buffer::const_iterator, Buffer::const_iterator>,
|
||||
tlv::Fragment> FragmentField;
|
||||
BOOST_CONCEPT_ASSERT((Field<FragmentField>));
|
||||
|
||||
/** \brief Set of all field declarations.
|
||||
*/
|
||||
typedef boost::mpl::set<
|
||||
using FieldSet = boost::mpl::set<
|
||||
FragmentField,
|
||||
SequenceField,
|
||||
FragIndexField,
|
||||
@@ -141,7 +132,7 @@ typedef boost::mpl::set<
|
||||
TxSequenceField,
|
||||
NonDiscoveryField,
|
||||
PrefixAnnouncementField
|
||||
> FieldSet;
|
||||
>;
|
||||
|
||||
} // namespace lp
|
||||
} // 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).
|
||||
*
|
||||
@@ -20,7 +20,6 @@
|
||||
*/
|
||||
|
||||
#include "ndn-cxx/lp/packet.hpp"
|
||||
#include "ndn-cxx/lp/fields.hpp"
|
||||
|
||||
#include <boost/bind/bind.hpp>
|
||||
#include <boost/mpl/for_each.hpp>
|
||||
|
||||
+1
-11
@@ -27,17 +27,7 @@
|
||||
|
||||
namespace ndn {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((WireEncodable<MetaInfo>));
|
||||
BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<MetaInfo>));
|
||||
BOOST_CONCEPT_ASSERT((WireDecodable<MetaInfo>));
|
||||
static_assert(std::is_convertible_v<MetaInfo::Error*, tlv::Error*>,
|
||||
"MetaInfo::Error must inherit from tlv::Error");
|
||||
|
||||
MetaInfo::MetaInfo()
|
||||
: m_type(tlv::ContentType_Blob)
|
||||
, m_freshnessPeriod(DEFAULT_FRESHNESS_PERIOD)
|
||||
{
|
||||
}
|
||||
MetaInfo::MetaInfo() = default;
|
||||
|
||||
MetaInfo::MetaInfo(const Block& block)
|
||||
{
|
||||
|
||||
@@ -195,8 +195,8 @@ public: // app-defined MetaInfo items
|
||||
findAppMetaInfo(uint32_t tlvType) const;
|
||||
|
||||
private:
|
||||
uint32_t m_type;
|
||||
time::milliseconds m_freshnessPeriod;
|
||||
uint32_t m_type = tlv::ContentType_Blob;
|
||||
time::milliseconds m_freshnessPeriod = DEFAULT_FRESHNESS_PERIOD;
|
||||
std::optional<name::Component> m_finalBlockId;
|
||||
std::list<Block> m_appMetaInfo;
|
||||
|
||||
|
||||
@@ -26,12 +26,6 @@
|
||||
namespace ndn {
|
||||
namespace mgmt {
|
||||
|
||||
// BOOST_CONCEPT_ASSERT((boost::EqualityComparable<ControlResponse>));
|
||||
BOOST_CONCEPT_ASSERT((WireEncodable<ControlResponse>));
|
||||
BOOST_CONCEPT_ASSERT((WireDecodable<ControlResponse>));
|
||||
static_assert(std::is_convertible_v<ControlResponse::Error*, tlv::Error*>,
|
||||
"ControlResponse::Error must inherit from tlv::Error");
|
||||
|
||||
ControlResponse::ControlResponse() = default;
|
||||
|
||||
ControlResponse::ControlResponse(uint32_t code, const std::string& text)
|
||||
|
||||
+17
-13
@@ -202,7 +202,7 @@ Dispatcher::processAuthorizedControlCommandInterest(const std::string& requester
|
||||
{
|
||||
if (validateParams(*parameters)) {
|
||||
handler(prefix, interest, *parameters,
|
||||
[=] (const auto& resp) { this->sendControlResponse(resp, interest); });
|
||||
[=] (const auto& resp) { sendControlResponse(resp, interest); });
|
||||
}
|
||||
else {
|
||||
sendControlResponse(ControlResponse(400, "failed in validating parameters"), interest);
|
||||
@@ -223,8 +223,8 @@ Dispatcher::sendControlResponse(const ControlResponse& resp, const Interest& int
|
||||
|
||||
void
|
||||
Dispatcher::addStatusDataset(const PartialName& relPrefix,
|
||||
Authorization authorize,
|
||||
StatusDatasetHandler handle)
|
||||
Authorization auth,
|
||||
StatusDatasetHandler handler)
|
||||
{
|
||||
if (!m_topLevelPrefixes.empty()) {
|
||||
NDN_THROW(std::domain_error("one or more top-level prefix has been added"));
|
||||
@@ -234,18 +234,22 @@ Dispatcher::addStatusDataset(const PartialName& relPrefix,
|
||||
NDN_THROW(std::out_of_range("status dataset name overlaps"));
|
||||
}
|
||||
|
||||
AuthorizationAcceptedCallback accepted =
|
||||
std::bind(&Dispatcher::processAuthorizedStatusDatasetInterest, this, _2, _3, std::move(handle));
|
||||
AuthorizationRejectedCallback rejected = [this] (auto&&... args) {
|
||||
afterAuthorizationRejected(std::forward<decltype(args)>(args)...);
|
||||
};
|
||||
|
||||
AuthorizationAcceptedCallback accept =
|
||||
[this, handler = std::move(handler)] (auto&&, const auto& prefix, const auto& interest, auto&&) {
|
||||
processAuthorizedStatusDatasetInterest(prefix, interest, handler);
|
||||
};
|
||||
AuthorizationRejectedCallback reject =
|
||||
[this] (auto&&... args) {
|
||||
afterAuthorizationRejected(std::forward<decltype(args)>(args)...);
|
||||
};
|
||||
// follow the general path if storage is a miss
|
||||
InterestHandler missContinuation = std::bind(&Dispatcher::processStatusDatasetInterest, this, _1, _2,
|
||||
std::move(authorize), std::move(accepted), std::move(rejected));
|
||||
InterestHandler missContinuation =
|
||||
[this, auth = std::move(auth), accept = std::move(accept), reject = std::move(reject)] (auto&&... args) {
|
||||
processStatusDatasetInterest(std::forward<decltype(args)>(args)..., auth, accept, reject);
|
||||
};
|
||||
|
||||
m_handlers[relPrefix] = [this, miss = std::move(missContinuation)] (auto&&... args) {
|
||||
this->queryStorage(std::forward<decltype(args)>(args)..., miss);
|
||||
queryStorage(std::forward<decltype(args)>(args)..., miss);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -315,7 +319,7 @@ Dispatcher::addNotificationStream(const PartialName& relPrefix)
|
||||
// register a handler for the subscriber of this notification stream
|
||||
// keep silent if Interest does not match a stored notification
|
||||
m_handlers[relPrefix] = [this] (auto&&... args) {
|
||||
this->queryStorage(std::forward<decltype(args)>(args)..., nullptr);
|
||||
queryStorage(std::forward<decltype(args)>(args)..., nullptr);
|
||||
};
|
||||
m_streams[relPrefix] = 0;
|
||||
|
||||
|
||||
@@ -22,13 +22,10 @@
|
||||
#include "ndn-cxx/mgmt/nfd/channel-status.hpp"
|
||||
#include "ndn-cxx/encoding/block-helpers.hpp"
|
||||
#include "ndn-cxx/encoding/tlv-nfd.hpp"
|
||||
#include "ndn-cxx/util/concepts.hpp"
|
||||
|
||||
namespace ndn {
|
||||
namespace nfd {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((StatusDatasetItem<ChannelStatus>));
|
||||
|
||||
ChannelStatus::ChannelStatus() = default;
|
||||
|
||||
ChannelStatus::ChannelStatus(const Block& payload)
|
||||
|
||||
@@ -22,18 +22,11 @@
|
||||
#include "ndn-cxx/mgmt/nfd/control-parameters.hpp"
|
||||
#include "ndn-cxx/encoding/block-helpers.hpp"
|
||||
#include "ndn-cxx/encoding/tlv-nfd.hpp"
|
||||
#include "ndn-cxx/util/concepts.hpp"
|
||||
#include "ndn-cxx/util/string-helper.hpp"
|
||||
|
||||
namespace ndn {
|
||||
namespace nfd {
|
||||
|
||||
//BOOST_CONCEPT_ASSERT((boost::EqualityComparable<ControlParameters>));
|
||||
BOOST_CONCEPT_ASSERT((WireEncodable<ControlParameters>));
|
||||
BOOST_CONCEPT_ASSERT((WireDecodable<ControlParameters>));
|
||||
static_assert(std::is_convertible_v<ControlParameters::Error*, tlv::Error*>,
|
||||
"ControlParameters::Error must inherit from tlv::Error");
|
||||
|
||||
ControlParameters::ControlParameters()
|
||||
: m_hasFields(CONTROL_PARAMETER_UBOUND)
|
||||
{
|
||||
|
||||
@@ -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).
|
||||
*
|
||||
@@ -23,20 +23,11 @@
|
||||
#include "ndn-cxx/encoding/block-helpers.hpp"
|
||||
#include "ndn-cxx/encoding/encoding-buffer.hpp"
|
||||
#include "ndn-cxx/encoding/tlv-nfd.hpp"
|
||||
#include "ndn-cxx/util/concepts.hpp"
|
||||
|
||||
namespace ndn {
|
||||
namespace nfd {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((StatusDatasetItem<CsInfo>));
|
||||
|
||||
CsInfo::CsInfo()
|
||||
: m_capacity(0)
|
||||
, m_nEntries(0)
|
||||
, m_nHits(0)
|
||||
, m_nMisses(0)
|
||||
{
|
||||
}
|
||||
CsInfo::CsInfo() = default;
|
||||
|
||||
CsInfo::CsInfo(const Block& block)
|
||||
{
|
||||
|
||||
@@ -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,11 +127,11 @@ public:
|
||||
private:
|
||||
using FlagsBitSet = std::bitset<2>;
|
||||
|
||||
uint64_t m_capacity;
|
||||
uint64_t m_capacity = 0;
|
||||
FlagsBitSet m_flags;
|
||||
uint64_t m_nEntries;
|
||||
uint64_t m_nHits;
|
||||
uint64_t m_nMisses;
|
||||
uint64_t m_nEntries = 0;
|
||||
uint64_t m_nHits = 0;
|
||||
uint64_t m_nMisses = 0;
|
||||
|
||||
mutable Block m_wire;
|
||||
};
|
||||
|
||||
@@ -23,14 +23,11 @@
|
||||
#include "ndn-cxx/encoding/block-helpers.hpp"
|
||||
#include "ndn-cxx/encoding/encoding-buffer.hpp"
|
||||
#include "ndn-cxx/encoding/tlv-nfd.hpp"
|
||||
#include "ndn-cxx/util/concepts.hpp"
|
||||
#include "ndn-cxx/util/string-helper.hpp"
|
||||
|
||||
namespace ndn {
|
||||
namespace nfd {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((NotificationStreamItem<FaceEventNotification>));
|
||||
|
||||
FaceEventNotification::FaceEventNotification() = default;
|
||||
|
||||
FaceEventNotification::FaceEventNotification(const Block& block)
|
||||
|
||||
@@ -22,17 +22,10 @@
|
||||
#include "ndn-cxx/mgmt/nfd/face-query-filter.hpp"
|
||||
#include "ndn-cxx/encoding/block-helpers.hpp"
|
||||
#include "ndn-cxx/encoding/tlv-nfd.hpp"
|
||||
#include "ndn-cxx/util/concepts.hpp"
|
||||
|
||||
namespace ndn {
|
||||
namespace nfd {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<FaceQueryFilter>));
|
||||
BOOST_CONCEPT_ASSERT((WireEncodable<FaceQueryFilter>));
|
||||
BOOST_CONCEPT_ASSERT((WireDecodable<FaceQueryFilter>));
|
||||
static_assert(std::is_convertible_v<FaceQueryFilter::Error*, tlv::Error*>,
|
||||
"FaceQueryFilter::Error must inherit from tlv::Error");
|
||||
|
||||
FaceQueryFilter::FaceQueryFilter() = default;
|
||||
|
||||
FaceQueryFilter::FaceQueryFilter(const Block& block)
|
||||
|
||||
@@ -23,25 +23,12 @@
|
||||
#include "ndn-cxx/encoding/block-helpers.hpp"
|
||||
#include "ndn-cxx/encoding/encoding-buffer.hpp"
|
||||
#include "ndn-cxx/encoding/tlv-nfd.hpp"
|
||||
#include "ndn-cxx/util/concepts.hpp"
|
||||
#include "ndn-cxx/util/string-helper.hpp"
|
||||
|
||||
namespace ndn {
|
||||
namespace nfd {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((StatusDatasetItem<FaceStatus>));
|
||||
|
||||
FaceStatus::FaceStatus()
|
||||
: m_nInInterests(0)
|
||||
, m_nInData(0)
|
||||
, m_nInNacks(0)
|
||||
, m_nOutInterests(0)
|
||||
, m_nOutData(0)
|
||||
, m_nOutNacks(0)
|
||||
, m_nInBytes(0)
|
||||
, m_nOutBytes(0)
|
||||
{
|
||||
}
|
||||
FaceStatus::FaceStatus() = default;
|
||||
|
||||
FaceStatus::FaceStatus(const Block& block)
|
||||
{
|
||||
|
||||
@@ -225,14 +225,14 @@ private:
|
||||
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;
|
||||
uint64_t m_nOutInterests;
|
||||
uint64_t m_nOutData;
|
||||
uint64_t m_nOutNacks;
|
||||
uint64_t m_nInBytes;
|
||||
uint64_t m_nOutBytes;
|
||||
uint64_t m_nInInterests = 0;
|
||||
uint64_t m_nInData = 0;
|
||||
uint64_t m_nInNacks = 0;
|
||||
uint64_t m_nOutInterests = 0;
|
||||
uint64_t m_nOutData = 0;
|
||||
uint64_t m_nOutNacks = 0;
|
||||
uint64_t m_nInBytes = 0;
|
||||
uint64_t m_nOutBytes = 0;
|
||||
};
|
||||
|
||||
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(FaceStatus);
|
||||
|
||||
@@ -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).
|
||||
*
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "ndn-cxx/encoding/block-helpers.hpp"
|
||||
#include "ndn-cxx/encoding/encoding-buffer.hpp"
|
||||
#include "ndn-cxx/encoding/tlv-nfd.hpp"
|
||||
#include "ndn-cxx/util/concepts.hpp"
|
||||
#include "ndn-cxx/util/ostream-joiner.hpp"
|
||||
|
||||
#include <boost/range/adaptor/reversed.hpp>
|
||||
@@ -31,14 +30,7 @@
|
||||
namespace ndn {
|
||||
namespace nfd {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((StatusDatasetItem<NextHopRecord>));
|
||||
BOOST_CONCEPT_ASSERT((StatusDatasetItem<FibEntry>));
|
||||
|
||||
NextHopRecord::NextHopRecord()
|
||||
: m_faceId(INVALID_FACE_ID)
|
||||
, m_cost(0)
|
||||
{
|
||||
}
|
||||
NextHopRecord::NextHopRecord() = default;
|
||||
|
||||
NextHopRecord::NextHopRecord(const Block& block)
|
||||
{
|
||||
|
||||
@@ -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).
|
||||
*
|
||||
@@ -22,8 +22,8 @@
|
||||
#ifndef NDN_CXX_MGMT_NFD_FIB_ENTRY_HPP
|
||||
#define NDN_CXX_MGMT_NFD_FIB_ENTRY_HPP
|
||||
|
||||
#include "ndn-cxx/encoding/nfd-constants.hpp"
|
||||
#include "ndn-cxx/name.hpp"
|
||||
#include "ndn-cxx/encoding/block.hpp"
|
||||
|
||||
namespace ndn {
|
||||
namespace nfd {
|
||||
@@ -74,8 +74,8 @@ public:
|
||||
wireDecode(const Block& block);
|
||||
|
||||
private:
|
||||
uint64_t m_faceId;
|
||||
uint64_t m_cost;
|
||||
uint64_t m_faceId = INVALID_FACE_ID;
|
||||
uint64_t m_cost = 0;
|
||||
|
||||
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).
|
||||
*
|
||||
@@ -23,29 +23,11 @@
|
||||
#include "ndn-cxx/encoding/block-helpers.hpp"
|
||||
#include "ndn-cxx/encoding/encoding-buffer.hpp"
|
||||
#include "ndn-cxx/encoding/tlv-nfd.hpp"
|
||||
#include "ndn-cxx/util/concepts.hpp"
|
||||
|
||||
namespace ndn {
|
||||
namespace nfd {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((StatusDatasetItem<ForwarderStatus>));
|
||||
|
||||
ForwarderStatus::ForwarderStatus()
|
||||
: m_nNameTreeEntries(0)
|
||||
, m_nFibEntries(0)
|
||||
, m_nPitEntries(0)
|
||||
, m_nMeasurementsEntries(0)
|
||||
, m_nCsEntries(0)
|
||||
, m_nInInterests(0)
|
||||
, m_nInData(0)
|
||||
, m_nInNacks(0)
|
||||
, m_nOutInterests(0)
|
||||
, m_nOutData(0)
|
||||
, m_nOutNacks(0)
|
||||
, m_nSatisfiedInterests(0)
|
||||
, m_nUnsatisfiedInterests(0)
|
||||
{
|
||||
}
|
||||
ForwarderStatus::ForwarderStatus() = default;
|
||||
|
||||
ForwarderStatus::ForwarderStatus(const Block& payload)
|
||||
{
|
||||
|
||||
@@ -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).
|
||||
*
|
||||
@@ -79,23 +79,23 @@ public: // getters & setters
|
||||
ForwarderStatus&
|
||||
setNfdVersion(const std::string& nfdVersion);
|
||||
|
||||
const time::system_clock::TimePoint&
|
||||
const time::system_clock::time_point&
|
||||
getStartTimestamp() const
|
||||
{
|
||||
return m_startTimestamp;
|
||||
}
|
||||
|
||||
ForwarderStatus&
|
||||
setStartTimestamp(const time::system_clock::TimePoint& startTimestamp);
|
||||
setStartTimestamp(const time::system_clock::time_point& startTimestamp);
|
||||
|
||||
const time::system_clock::TimePoint&
|
||||
const time::system_clock::time_point&
|
||||
getCurrentTimestamp() const
|
||||
{
|
||||
return m_currentTimestamp;
|
||||
}
|
||||
|
||||
ForwarderStatus&
|
||||
setCurrentTimestamp(const time::system_clock::TimePoint& currentTimestamp);
|
||||
setCurrentTimestamp(const time::system_clock::time_point& currentTimestamp);
|
||||
|
||||
uint64_t
|
||||
getNNameTreeEntries() const
|
||||
@@ -216,21 +216,21 @@ public: // getters & setters
|
||||
|
||||
private:
|
||||
std::string m_nfdVersion;
|
||||
time::system_clock::TimePoint m_startTimestamp;
|
||||
time::system_clock::TimePoint m_currentTimestamp;
|
||||
uint64_t m_nNameTreeEntries;
|
||||
uint64_t m_nFibEntries;
|
||||
uint64_t m_nPitEntries;
|
||||
uint64_t m_nMeasurementsEntries;
|
||||
uint64_t m_nCsEntries;
|
||||
uint64_t m_nInInterests;
|
||||
uint64_t m_nInData;
|
||||
uint64_t m_nInNacks;
|
||||
uint64_t m_nOutInterests;
|
||||
uint64_t m_nOutData;
|
||||
uint64_t m_nOutNacks;
|
||||
uint64_t m_nSatisfiedInterests;
|
||||
uint64_t m_nUnsatisfiedInterests;
|
||||
time::system_clock::time_point m_startTimestamp;
|
||||
time::system_clock::time_point m_currentTimestamp;
|
||||
uint64_t m_nNameTreeEntries = 0;
|
||||
uint64_t m_nFibEntries = 0;
|
||||
uint64_t m_nPitEntries = 0;
|
||||
uint64_t m_nMeasurementsEntries = 0;
|
||||
uint64_t m_nCsEntries = 0;
|
||||
uint64_t m_nInInterests = 0;
|
||||
uint64_t m_nInData = 0;
|
||||
uint64_t m_nInNacks = 0;
|
||||
uint64_t m_nOutInterests = 0;
|
||||
uint64_t m_nOutData = 0;
|
||||
uint64_t m_nOutNacks = 0;
|
||||
uint64_t m_nSatisfiedInterests = 0;
|
||||
uint64_t m_nUnsatisfiedInterests = 0;
|
||||
|
||||
mutable Block m_wire;
|
||||
};
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "ndn-cxx/encoding/block-helpers.hpp"
|
||||
#include "ndn-cxx/encoding/encoding-buffer.hpp"
|
||||
#include "ndn-cxx/encoding/tlv-nfd.hpp"
|
||||
#include "ndn-cxx/util/concepts.hpp"
|
||||
#include "ndn-cxx/util/ostream-joiner.hpp"
|
||||
#include "ndn-cxx/util/string-helper.hpp"
|
||||
|
||||
@@ -32,16 +31,7 @@
|
||||
namespace ndn {
|
||||
namespace nfd {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((StatusDatasetItem<Route>));
|
||||
BOOST_CONCEPT_ASSERT((StatusDatasetItem<RibEntry>));
|
||||
|
||||
Route::Route()
|
||||
: m_faceId(INVALID_FACE_ID)
|
||||
, m_origin(ROUTE_ORIGIN_APP)
|
||||
, m_cost(0)
|
||||
, m_flags(ROUTE_FLAG_CHILD_INHERIT)
|
||||
{
|
||||
}
|
||||
Route::Route() = default;
|
||||
|
||||
Route::Route(const Block& block)
|
||||
{
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
#ifndef NDN_CXX_MGMT_NFD_RIB_ENTRY_HPP
|
||||
#define NDN_CXX_MGMT_NFD_RIB_ENTRY_HPP
|
||||
|
||||
#include "ndn-cxx/name.hpp"
|
||||
#include "ndn-cxx/encoding/block.hpp"
|
||||
#include "ndn-cxx/encoding/nfd-constants.hpp"
|
||||
#include "ndn-cxx/mgmt/nfd/route-flags-traits.hpp"
|
||||
#include "ndn-cxx/name.hpp"
|
||||
#include "ndn-cxx/util/time.hpp"
|
||||
|
||||
namespace ndn {
|
||||
@@ -118,10 +118,10 @@ public:
|
||||
wireDecode(const Block& block);
|
||||
|
||||
private:
|
||||
uint64_t m_faceId;
|
||||
RouteOrigin m_origin;
|
||||
uint64_t m_cost;
|
||||
uint64_t m_flags;
|
||||
uint64_t m_faceId = INVALID_FACE_ID;
|
||||
RouteOrigin m_origin = ROUTE_ORIGIN_APP;
|
||||
uint64_t m_cost = 0;
|
||||
uint64_t m_flags = ROUTE_FLAG_CHILD_INHERIT;
|
||||
std::optional<time::milliseconds> m_expirationPeriod;
|
||||
|
||||
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).
|
||||
*
|
||||
@@ -23,13 +23,10 @@
|
||||
#include "ndn-cxx/encoding/block-helpers.hpp"
|
||||
#include "ndn-cxx/encoding/encoding-buffer.hpp"
|
||||
#include "ndn-cxx/encoding/tlv-nfd.hpp"
|
||||
#include "ndn-cxx/util/concepts.hpp"
|
||||
|
||||
namespace ndn {
|
||||
namespace nfd {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((StatusDatasetItem<StrategyChoice>));
|
||||
|
||||
StrategyChoice::StrategyChoice() = default;
|
||||
|
||||
StrategyChoice::StrategyChoice(const Block& payload)
|
||||
|
||||
@@ -35,13 +35,6 @@
|
||||
namespace ndn {
|
||||
namespace name {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Component>));
|
||||
BOOST_CONCEPT_ASSERT((WireEncodable<Component>));
|
||||
BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<Component>));
|
||||
BOOST_CONCEPT_ASSERT((WireDecodable<Component>));
|
||||
static_assert(std::is_convertible_v<Component::Error*, tlv::Error*>,
|
||||
"name::Component::Error must inherit from tlv::Error");
|
||||
|
||||
static Convention g_conventionEncoding = Convention::TYPED;
|
||||
static Convention g_conventionDecoding = Convention::EITHER;
|
||||
|
||||
|
||||
+1
-17
@@ -31,28 +31,12 @@
|
||||
#include <sstream>
|
||||
#include <boost/functional/hash.hpp>
|
||||
#include <boost/range/adaptor/reversed.hpp>
|
||||
#include <boost/range/concepts.hpp>
|
||||
|
||||
namespace ndn {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Name>));
|
||||
BOOST_CONCEPT_ASSERT((WireEncodable<Name>));
|
||||
BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<Name>));
|
||||
BOOST_CONCEPT_ASSERT((WireDecodable<Name>));
|
||||
BOOST_CONCEPT_ASSERT((boost::RandomAccessIterator<Name::iterator>));
|
||||
BOOST_CONCEPT_ASSERT((boost::RandomAccessIterator<Name::const_iterator>));
|
||||
BOOST_CONCEPT_ASSERT((boost::RandomAccessIterator<Name::reverse_iterator>));
|
||||
BOOST_CONCEPT_ASSERT((boost::RandomAccessIterator<Name::const_reverse_iterator>));
|
||||
BOOST_CONCEPT_ASSERT((boost::RandomAccessRangeConcept<Name>));
|
||||
static_assert(std::is_convertible_v<Name::Error*, tlv::Error*>,
|
||||
"Name::Error must inherit from tlv::Error");
|
||||
|
||||
// ---- constructors, encoding, decoding ----
|
||||
|
||||
Name::Name()
|
||||
: m_wire(tlv::Name)
|
||||
{
|
||||
}
|
||||
Name::Name() = default;
|
||||
|
||||
Name::Name(const Block& wire)
|
||||
: m_wire(wire)
|
||||
|
||||
+1
-1
@@ -701,7 +701,7 @@ public:
|
||||
static constexpr size_t npos = std::numeric_limits<size_t>::max();
|
||||
|
||||
private:
|
||||
mutable Block m_wire;
|
||||
mutable Block m_wire{tlv::Name};
|
||||
};
|
||||
|
||||
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(Name);
|
||||
|
||||
@@ -41,8 +41,6 @@
|
||||
|
||||
namespace ndn {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<FaceUri>));
|
||||
|
||||
FaceUri::FaceUri() = default;
|
||||
|
||||
FaceUri::FaceUri(const std::string& uri)
|
||||
|
||||
@@ -21,20 +21,12 @@
|
||||
|
||||
#include "ndn-cxx/security/additional-description.hpp"
|
||||
#include "ndn-cxx/encoding/block-helpers.hpp"
|
||||
#include "ndn-cxx/util/concepts.hpp"
|
||||
#include "ndn-cxx/util/ostream-joiner.hpp"
|
||||
|
||||
namespace ndn {
|
||||
namespace security {
|
||||
inline namespace v2 {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<AdditionalDescription>));
|
||||
BOOST_CONCEPT_ASSERT((WireEncodable<AdditionalDescription>));
|
||||
BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<AdditionalDescription>));
|
||||
BOOST_CONCEPT_ASSERT((WireDecodable<AdditionalDescription>));
|
||||
static_assert(std::is_convertible_v<AdditionalDescription::Error*, tlv::Error*>,
|
||||
"AdditionalDescription::Error must inherit from tlv::Error");
|
||||
|
||||
constexpr size_t KEY_OFFSET = 0;
|
||||
constexpr size_t VALUE_OFFSET = 1;
|
||||
|
||||
|
||||
@@ -31,11 +31,6 @@ namespace ndn {
|
||||
namespace security {
|
||||
inline namespace v2 {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((WireEncodable<Certificate>));
|
||||
BOOST_CONCEPT_ASSERT((WireDecodable<Certificate>));
|
||||
static_assert(std::is_convertible_v<Certificate::Error*, Data::Error*>,
|
||||
"Certificate::Error must inherit from Data::Error");
|
||||
|
||||
Certificate::Certificate()
|
||||
{
|
||||
setContentType(tlv::ContentType_Key);
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
#include "ndn-cxx/security/pib/certificate-container.hpp"
|
||||
#include "ndn-cxx/security/pib/pib-impl.hpp"
|
||||
#include "ndn-cxx/util/concepts.hpp"
|
||||
#include "ndn-cxx/util/logger.hpp"
|
||||
|
||||
namespace ndn {
|
||||
@@ -30,8 +29,6 @@ namespace pib {
|
||||
|
||||
NDN_LOG_INIT(ndn.security.CertificateContainer);
|
||||
|
||||
NDN_CXX_ASSERT_FORWARD_ITERATOR(CertificateContainer::const_iterator);
|
||||
|
||||
CertificateContainer::const_iterator::const_iterator(NameSet::const_iterator it,
|
||||
const CertificateContainer& container) noexcept
|
||||
: m_it(it)
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "ndn-cxx/security/pib/identity-container.hpp"
|
||||
#include "ndn-cxx/security/pib/impl/identity-impl.hpp"
|
||||
#include "ndn-cxx/security/pib/pib-impl.hpp"
|
||||
#include "ndn-cxx/util/concepts.hpp"
|
||||
#include "ndn-cxx/util/logger.hpp"
|
||||
|
||||
namespace ndn {
|
||||
@@ -31,8 +30,6 @@ namespace pib {
|
||||
|
||||
NDN_LOG_INIT(ndn.security.IdentityContainer);
|
||||
|
||||
NDN_CXX_ASSERT_FORWARD_ITERATOR(IdentityContainer::const_iterator);
|
||||
|
||||
IdentityContainer::const_iterator::const_iterator(NameSet::const_iterator it,
|
||||
const IdentityContainer& container) noexcept
|
||||
: m_it(it)
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "ndn-cxx/security/pib/key-container.hpp"
|
||||
#include "ndn-cxx/security/pib/impl/key-impl.hpp"
|
||||
#include "ndn-cxx/security/pib/pib-impl.hpp"
|
||||
#include "ndn-cxx/util/concepts.hpp"
|
||||
#include "ndn-cxx/util/logger.hpp"
|
||||
|
||||
namespace ndn {
|
||||
@@ -31,8 +30,6 @@ namespace pib {
|
||||
|
||||
NDN_LOG_INIT(ndn.security.KeyContainer);
|
||||
|
||||
NDN_CXX_ASSERT_FORWARD_ITERATOR(KeyContainer::const_iterator);
|
||||
|
||||
KeyContainer::const_iterator::const_iterator(NameSet::const_iterator it,
|
||||
const KeyContainer& container) noexcept
|
||||
: m_it(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).
|
||||
*
|
||||
@@ -24,14 +24,10 @@
|
||||
#include "ndn-cxx/security/safe-bag.hpp"
|
||||
#include "ndn-cxx/encoding/encoding-buffer.hpp"
|
||||
#include "ndn-cxx/encoding/tlv-security.hpp"
|
||||
#include "ndn-cxx/util/concepts.hpp"
|
||||
|
||||
namespace ndn {
|
||||
namespace security {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((WireEncodable<SafeBag>));
|
||||
BOOST_CONCEPT_ASSERT((WireDecodable<SafeBag>));
|
||||
|
||||
SafeBag::SafeBag() = default;
|
||||
|
||||
SafeBag::SafeBag(const Block& wire)
|
||||
|
||||
@@ -21,24 +21,16 @@
|
||||
|
||||
#include "ndn-cxx/security/validity-period.hpp"
|
||||
#include "ndn-cxx/encoding/block-helpers.hpp"
|
||||
#include "ndn-cxx/util/concepts.hpp"
|
||||
|
||||
namespace ndn {
|
||||
namespace security {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<ValidityPeriod>));
|
||||
BOOST_CONCEPT_ASSERT((WireEncodable<ValidityPeriod>));
|
||||
BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<ValidityPeriod>));
|
||||
BOOST_CONCEPT_ASSERT((WireDecodable<ValidityPeriod>));
|
||||
static_assert(std::is_convertible_v<ValidityPeriod::Error*, tlv::Error*>,
|
||||
"ValidityPeriod::Error must inherit from tlv::Error");
|
||||
using boost::chrono::time_point_cast;
|
||||
|
||||
constexpr size_t ISO_DATETIME_SIZE = 15;
|
||||
constexpr size_t NOT_BEFORE_OFFSET = 0;
|
||||
constexpr size_t NOT_AFTER_OFFSET = 1;
|
||||
|
||||
using boost::chrono::time_point_cast;
|
||||
|
||||
ValidityPeriod
|
||||
ValidityPeriod::makeRelative(time::seconds validFrom, time::seconds validUntil,
|
||||
const time::system_clock::TimePoint& now)
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
#include "ndn-cxx/signature-info.hpp"
|
||||
#include "ndn-cxx/encoding/block-helpers.hpp"
|
||||
#include "ndn-cxx/util/concepts.hpp"
|
||||
#include "ndn-cxx/util/string-helper.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
@@ -29,13 +28,6 @@
|
||||
|
||||
namespace ndn {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<SignatureInfo>));
|
||||
BOOST_CONCEPT_ASSERT((WireEncodable<SignatureInfo>));
|
||||
BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<SignatureInfo>));
|
||||
BOOST_CONCEPT_ASSERT((WireDecodable<SignatureInfo>));
|
||||
static_assert(std::is_convertible_v<SignatureInfo::Error*, tlv::Error*>,
|
||||
"SignatureInfo::Error must inherit from tlv::Error");
|
||||
|
||||
SignatureInfo::SignatureInfo() = default;
|
||||
|
||||
SignatureInfo::SignatureInfo(tlv::SignatureTypeValue type, std::optional<KeyLocator> keyLocator)
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include "ndn-cxx/encoding/block.hpp"
|
||||
#include "ndn-cxx/encoding/encoding-buffer.hpp"
|
||||
|
||||
#include <boost/concept_check.hpp>
|
||||
#include <boost/concept/usage.hpp>
|
||||
#include <boost/type_traits/has_equal_to.hpp>
|
||||
#include <boost/type_traits/has_not_equal_to.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).
|
||||
*
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "ndn-cxx/impl/lp-field-tag.hpp"
|
||||
#include "ndn-cxx/lp/packet.hpp"
|
||||
#include "ndn-cxx/lp/tags.hpp"
|
||||
#include "ndn-cxx/mgmt/nfd/controller.hpp"
|
||||
#include "ndn-cxx/mgmt/nfd/control-parameters.hpp"
|
||||
#include "ndn-cxx/mgmt/nfd/control-response.hpp"
|
||||
#include "ndn-cxx/transport/transport.hpp"
|
||||
|
||||
|
||||
@@ -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).
|
||||
*
|
||||
@@ -25,8 +25,6 @@ namespace ndn {
|
||||
namespace util {
|
||||
namespace signal {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Connection>));
|
||||
|
||||
Connection::Connection(weak_ptr<DisconnectFunction> disconnect) noexcept
|
||||
: m_disconnect(std::move(disconnect))
|
||||
{
|
||||
|
||||
@@ -37,6 +37,13 @@
|
||||
namespace ndn {
|
||||
namespace tests {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Data>));
|
||||
BOOST_CONCEPT_ASSERT((WireEncodable<Data>));
|
||||
BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<Data>));
|
||||
BOOST_CONCEPT_ASSERT((WireDecodable<Data>));
|
||||
static_assert(std::is_convertible_v<Data::Error*, tlv::Error*>,
|
||||
"Data::Error must inherit from tlv::Error");
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(TestData)
|
||||
|
||||
const uint8_t CONTENT1[] = {0x53, 0x55, 0x43, 0x43, 0x45, 0x53, 0x53, 0x21};
|
||||
|
||||
@@ -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).
|
||||
*
|
||||
@@ -34,6 +34,8 @@
|
||||
namespace ndn {
|
||||
namespace tests {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Block>));
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(Encoding)
|
||||
BOOST_AUTO_TEST_SUITE(TestBlock)
|
||||
|
||||
|
||||
+74
-75
@@ -35,7 +35,6 @@ namespace ndn {
|
||||
namespace tests {
|
||||
|
||||
using ndn::util::DummyClientFace;
|
||||
using std::bind;
|
||||
|
||||
struct WantPrefixRegReply;
|
||||
struct NoPrefixRegReply;
|
||||
@@ -100,8 +99,8 @@ BOOST_AUTO_TEST_CASE(ReplyData)
|
||||
BOOST_CHECK_EQUAL(i.getName(), "/Hello/World");
|
||||
++nData;
|
||||
},
|
||||
bind([] { BOOST_FAIL("Unexpected Nack"); }),
|
||||
bind([] { BOOST_FAIL("Unexpected timeout"); }));
|
||||
std::bind([] { BOOST_FAIL("Unexpected Nack"); }),
|
||||
std::bind([] { BOOST_FAIL("Unexpected timeout"); }));
|
||||
|
||||
advanceClocks(40_ms);
|
||||
|
||||
@@ -116,9 +115,9 @@ BOOST_AUTO_TEST_CASE(ReplyData)
|
||||
|
||||
size_t nTimeouts = 0;
|
||||
face.expressInterest(*makeInterest("/Hello/World/a/2", false, 50_ms),
|
||||
bind([]{}),
|
||||
bind([]{}),
|
||||
bind([&nTimeouts] { ++nTimeouts; }));
|
||||
std::bind([]{}),
|
||||
std::bind([]{}),
|
||||
std::bind([&nTimeouts] { ++nTimeouts; }));
|
||||
advanceClocks(200_ms, 5);
|
||||
BOOST_CHECK_EQUAL(nTimeouts, 1);
|
||||
}
|
||||
@@ -129,13 +128,13 @@ BOOST_AUTO_TEST_CASE(MultipleData)
|
||||
|
||||
face.expressInterest(*makeInterest("/Hello/World", true, 50_ms),
|
||||
[&] (const auto&, const auto&) { ++nData; },
|
||||
bind([] { BOOST_FAIL("Unexpected Nack"); }),
|
||||
bind([] { BOOST_FAIL("Unexpected timeout"); }));
|
||||
std::bind([] { BOOST_FAIL("Unexpected Nack"); }),
|
||||
std::bind([] { BOOST_FAIL("Unexpected timeout"); }));
|
||||
|
||||
face.expressInterest(*makeInterest("/Hello/World/a", true, 50_ms),
|
||||
[&] (const auto&, const auto&) { ++nData; },
|
||||
bind([] { BOOST_FAIL("Unexpected Nack"); }),
|
||||
bind([] { BOOST_FAIL("Unexpected timeout"); }));
|
||||
std::bind([] { BOOST_FAIL("Unexpected Nack"); }),
|
||||
std::bind([] { BOOST_FAIL("Unexpected timeout"); }));
|
||||
|
||||
advanceClocks(40_ms);
|
||||
|
||||
@@ -152,8 +151,8 @@ BOOST_AUTO_TEST_CASE(EmptyDataCallback)
|
||||
{
|
||||
face.expressInterest(*makeInterest("/Hello/World", true),
|
||||
nullptr,
|
||||
bind([] { BOOST_FAIL("Unexpected Nack"); }),
|
||||
bind([] { BOOST_FAIL("Unexpected timeout"); }));
|
||||
std::bind([] { BOOST_FAIL("Unexpected Nack"); }),
|
||||
std::bind([] { BOOST_FAIL("Unexpected timeout"); }));
|
||||
advanceClocks(1_ms);
|
||||
|
||||
BOOST_CHECK_NO_THROW(do {
|
||||
@@ -166,8 +165,8 @@ BOOST_AUTO_TEST_CASE(Timeout)
|
||||
{
|
||||
size_t nTimeouts = 0;
|
||||
face.expressInterest(*makeInterest("/Hello/World", false, 50_ms),
|
||||
bind([] { BOOST_FAIL("Unexpected Data"); }),
|
||||
bind([] { BOOST_FAIL("Unexpected Nack"); }),
|
||||
std::bind([] { BOOST_FAIL("Unexpected Data"); }),
|
||||
std::bind([] { BOOST_FAIL("Unexpected Nack"); }),
|
||||
[&nTimeouts] (const Interest& i) {
|
||||
BOOST_CHECK_EQUAL(i.getName(), "/Hello/World");
|
||||
++nTimeouts;
|
||||
@@ -184,8 +183,8 @@ BOOST_AUTO_TEST_CASE(Timeout)
|
||||
BOOST_AUTO_TEST_CASE(EmptyTimeoutCallback)
|
||||
{
|
||||
face.expressInterest(*makeInterest("/Hello/World", false, 50_ms),
|
||||
bind([] { BOOST_FAIL("Unexpected Data"); }),
|
||||
bind([] { BOOST_FAIL("Unexpected Nack"); }),
|
||||
std::bind([] { BOOST_FAIL("Unexpected Data"); }),
|
||||
std::bind([] { BOOST_FAIL("Unexpected Nack"); }),
|
||||
nullptr);
|
||||
advanceClocks(40_ms);
|
||||
|
||||
@@ -201,14 +200,14 @@ BOOST_AUTO_TEST_CASE(ReplyNack)
|
||||
auto interest = makeInterest("/Hello/World", false, 50_ms);
|
||||
|
||||
face.expressInterest(*interest,
|
||||
bind([] { BOOST_FAIL("Unexpected Data"); }),
|
||||
std::bind([] { BOOST_FAIL("Unexpected Data"); }),
|
||||
[&] (const Interest& i, const lp::Nack& n) {
|
||||
BOOST_CHECK(i.getName().isPrefixOf(n.getInterest().getName()));
|
||||
BOOST_CHECK_EQUAL(i.getName(), "/Hello/World");
|
||||
BOOST_CHECK_EQUAL(n.getReason(), lp::NackReason::DUPLICATE);
|
||||
++nNacks;
|
||||
},
|
||||
bind([] { BOOST_FAIL("Unexpected timeout"); }));
|
||||
std::bind([] { BOOST_FAIL("Unexpected timeout"); }));
|
||||
|
||||
advanceClocks(40_ms);
|
||||
|
||||
@@ -226,15 +225,15 @@ BOOST_AUTO_TEST_CASE(MultipleNacks)
|
||||
|
||||
auto interest = makeInterest("/Hello/World", false, 50_ms, 1);
|
||||
face.expressInterest(*interest,
|
||||
bind([] { BOOST_FAIL("Unexpected Data"); }),
|
||||
std::bind([] { BOOST_FAIL("Unexpected Data"); }),
|
||||
[&] (const auto&, const auto&) { ++nNacks; },
|
||||
bind([] { BOOST_FAIL("Unexpected timeout"); }));
|
||||
std::bind([] { BOOST_FAIL("Unexpected timeout"); }));
|
||||
|
||||
interest->setNonce(2);
|
||||
face.expressInterest(*interest,
|
||||
bind([] { BOOST_FAIL("Unexpected Data"); }),
|
||||
std::bind([] { BOOST_FAIL("Unexpected Data"); }),
|
||||
[&] (const auto&, const auto&) { ++nNacks; },
|
||||
bind([] { BOOST_FAIL("Unexpected timeout"); }));
|
||||
std::bind([] { BOOST_FAIL("Unexpected timeout"); }));
|
||||
|
||||
advanceClocks(40_ms);
|
||||
|
||||
@@ -249,9 +248,9 @@ BOOST_AUTO_TEST_CASE(MultipleNacks)
|
||||
BOOST_AUTO_TEST_CASE(EmptyNackCallback)
|
||||
{
|
||||
face.expressInterest(*makeInterest("/Hello/World"),
|
||||
bind([] { BOOST_FAIL("Unexpected Data"); }),
|
||||
std::bind([] { BOOST_FAIL("Unexpected Data"); }),
|
||||
nullptr,
|
||||
bind([] { BOOST_FAIL("Unexpected timeout"); }));
|
||||
std::bind([] { BOOST_FAIL("Unexpected timeout"); }));
|
||||
advanceClocks(1_ms);
|
||||
|
||||
BOOST_CHECK_NO_THROW(do {
|
||||
@@ -294,9 +293,9 @@ BOOST_AUTO_TEST_CASE(DestroyWithPendingInterest)
|
||||
BOOST_AUTO_TEST_CASE(Handle)
|
||||
{
|
||||
auto hdl = face.expressInterest(*makeInterest("/Hello/World", true, 50_ms),
|
||||
bind([] { BOOST_FAIL("Unexpected data"); }),
|
||||
bind([] { BOOST_FAIL("Unexpected nack"); }),
|
||||
bind([] { BOOST_FAIL("Unexpected timeout"); }));
|
||||
std::bind([] { BOOST_FAIL("Unexpected data"); }),
|
||||
std::bind([] { BOOST_FAIL("Unexpected nack"); }),
|
||||
std::bind([] { BOOST_FAIL("Unexpected timeout"); }));
|
||||
advanceClocks(1_ms);
|
||||
hdl.cancel();
|
||||
advanceClocks(1_ms);
|
||||
@@ -306,9 +305,9 @@ BOOST_AUTO_TEST_CASE(Handle)
|
||||
// cancel after destructing face
|
||||
auto face2 = make_unique<DummyClientFace>(m_io, m_keyChain);
|
||||
auto hdl2 = face2->expressInterest(*makeInterest("/Hello/World", true, 50_ms),
|
||||
bind([] { BOOST_FAIL("Unexpected data"); }),
|
||||
bind([] { BOOST_FAIL("Unexpected nack"); }),
|
||||
bind([] { BOOST_FAIL("Unexpected timeout"); }));
|
||||
std::bind([] { BOOST_FAIL("Unexpected data"); }),
|
||||
std::bind([] { BOOST_FAIL("Unexpected nack"); }),
|
||||
std::bind([] { BOOST_FAIL("Unexpected timeout"); }));
|
||||
advanceClocks(1_ms);
|
||||
face2.reset();
|
||||
advanceClocks(1_ms);
|
||||
@@ -324,14 +323,14 @@ BOOST_AUTO_TEST_SUITE_END() // ExpressInterest
|
||||
BOOST_AUTO_TEST_CASE(RemoveAllPendingInterests)
|
||||
{
|
||||
face.expressInterest(*makeInterest("/Hello/World/0", false, 50_ms),
|
||||
bind([] { BOOST_FAIL("Unexpected data"); }),
|
||||
bind([] { BOOST_FAIL("Unexpected nack"); }),
|
||||
bind([] { BOOST_FAIL("Unexpected timeout"); }));
|
||||
std::bind([] { BOOST_FAIL("Unexpected data"); }),
|
||||
std::bind([] { BOOST_FAIL("Unexpected nack"); }),
|
||||
std::bind([] { BOOST_FAIL("Unexpected timeout"); }));
|
||||
|
||||
face.expressInterest(*makeInterest("/Hello/World/1", false, 50_ms),
|
||||
bind([] { BOOST_FAIL("Unexpected data"); }),
|
||||
bind([] { BOOST_FAIL("Unexpected nack"); }),
|
||||
bind([] { BOOST_FAIL("Unexpected timeout"); }));
|
||||
std::bind([] { BOOST_FAIL("Unexpected data"); }),
|
||||
std::bind([] { BOOST_FAIL("Unexpected nack"); }),
|
||||
std::bind([] { BOOST_FAIL("Unexpected timeout"); }));
|
||||
|
||||
advanceClocks(10_ms);
|
||||
|
||||
@@ -380,12 +379,12 @@ BOOST_AUTO_TEST_CASE(PutDataLoopback)
|
||||
});
|
||||
// second InterestFilter disallows loopback and should not receive Interest
|
||||
face.setInterestFilter(InterestFilter("/").allowLoopback(false),
|
||||
bind([] { BOOST_ERROR("Unexpected Interest on second InterestFilter"); }));
|
||||
std::bind([] { BOOST_ERROR("Unexpected Interest on second InterestFilter"); }));
|
||||
|
||||
face.expressInterest(*makeInterest("/A", true),
|
||||
bind([&] { hasData = true; }),
|
||||
bind([] { BOOST_FAIL("Unexpected nack"); }),
|
||||
bind([] { BOOST_FAIL("Unexpected timeout"); }));
|
||||
std::bind([&] { hasData = true; }),
|
||||
std::bind([] { BOOST_FAIL("Unexpected nack"); }),
|
||||
std::bind([] { BOOST_FAIL("Unexpected timeout"); }));
|
||||
advanceClocks(1_ms);
|
||||
BOOST_CHECK_EQUAL(hasInterest1, true); // Interest looped back
|
||||
BOOST_CHECK_EQUAL(face.sentInterests.size(), 1); // Interest sent to forwarder
|
||||
@@ -401,12 +400,12 @@ BOOST_AUTO_TEST_CASE(PutMultipleData)
|
||||
{
|
||||
bool hasInterest1 = false;
|
||||
// register two Interest destinations
|
||||
face.setInterestFilter("/", bind([&] {
|
||||
face.setInterestFilter("/", std::bind([&] {
|
||||
hasInterest1 = true;
|
||||
// sending Data right away from the first destination, don't care whether Interest goes to second destination
|
||||
face.put(*makeData("/A/B"));
|
||||
}));
|
||||
face.setInterestFilter("/", bind([]{}));
|
||||
face.setInterestFilter("/", std::bind([]{}));
|
||||
advanceClocks(10_ms);
|
||||
|
||||
face.receive(*makeInterest("/A", true));
|
||||
@@ -421,7 +420,7 @@ BOOST_AUTO_TEST_CASE(PutMultipleData)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(PutNack)
|
||||
{
|
||||
face.setInterestFilter("/", bind([]{})); // register one Interest destination so that face can accept Nacks
|
||||
face.setInterestFilter("/", std::bind([]{})); // register one Interest destination so that face can accept Nacks
|
||||
advanceClocks(10_ms);
|
||||
|
||||
BOOST_CHECK_EQUAL(face.sentNacks.size(), 0);
|
||||
@@ -461,7 +460,7 @@ BOOST_AUTO_TEST_CASE(PutMultipleNack)
|
||||
// sending Nack right away from the first destination, Interest should still go to second destination
|
||||
face.put(makeNack(interest, lp::NackReason::CONGESTION));
|
||||
});
|
||||
face.setInterestFilter("/", bind([&] { hasInterest2 = true; }));
|
||||
face.setInterestFilter("/", std::bind([&] { hasInterest2 = true; }));
|
||||
advanceClocks(10_ms);
|
||||
|
||||
auto interest = makeInterest("/A", false, std::nullopt, 14333271);
|
||||
@@ -493,16 +492,16 @@ BOOST_AUTO_TEST_CASE(PutMultipleNackLoopback)
|
||||
});
|
||||
// second InterestFilter disallows loopback and should not receive Interest
|
||||
face.setInterestFilter(InterestFilter("/").allowLoopback(false),
|
||||
bind([] { BOOST_ERROR("Unexpected Interest on second InterestFilter"); }));
|
||||
std::bind([] { BOOST_ERROR("Unexpected Interest on second InterestFilter"); }));
|
||||
|
||||
auto interest = makeInterest("/A", false, std::nullopt, 28395852);
|
||||
face.expressInterest(*interest,
|
||||
bind([] { BOOST_FAIL("Unexpected data"); }),
|
||||
std::bind([] { BOOST_FAIL("Unexpected data"); }),
|
||||
[&] (const Interest&, const lp::Nack& nack) {
|
||||
hasNack = true;
|
||||
BOOST_CHECK_EQUAL(nack.getReason(), lp::NackReason::CONGESTION);
|
||||
},
|
||||
bind([] { BOOST_FAIL("Unexpected timeout"); }));
|
||||
std::bind([] { BOOST_FAIL("Unexpected timeout"); }));
|
||||
advanceClocks(1_ms);
|
||||
BOOST_CHECK_EQUAL(hasInterest1, true); // Interest looped back
|
||||
BOOST_CHECK_EQUAL(face.sentInterests.size(), 1); // Interest sent to forwarder
|
||||
@@ -557,7 +556,7 @@ BOOST_AUTO_TEST_CASE(Handle)
|
||||
// cancel after destructing face
|
||||
auto face2 = make_unique<DummyClientFace>(m_io, m_keyChain);
|
||||
hdl = face2->registerPrefix("/Hello/World/2", nullptr,
|
||||
bind([] { BOOST_FAIL("Unexpected registerPrefix failure"); }));
|
||||
std::bind([] { BOOST_FAIL("Unexpected registerPrefix failure"); }));
|
||||
advanceClocks(1_ms);
|
||||
face2.reset();
|
||||
advanceClocks(1_ms);
|
||||
@@ -567,7 +566,7 @@ BOOST_AUTO_TEST_CASE(Handle)
|
||||
// unregister after destructing face
|
||||
auto face3 = make_unique<DummyClientFace>(m_io, m_keyChain);
|
||||
hdl = face3->registerPrefix("/Hello/World/3", nullptr,
|
||||
bind([] { BOOST_FAIL("Unexpected registerPrefix failure"); }));
|
||||
std::bind([] { BOOST_FAIL("Unexpected registerPrefix failure"); }));
|
||||
advanceClocks(1_ms);
|
||||
face3.reset();
|
||||
advanceClocks(1_ms);
|
||||
@@ -583,9 +582,9 @@ BOOST_AUTO_TEST_CASE(SetAndCancel)
|
||||
size_t nInterests = 0;
|
||||
size_t nRegs = 0;
|
||||
auto hdl = face.setInterestFilter("/Hello/World",
|
||||
bind([&nInterests] { ++nInterests; }),
|
||||
bind([&nRegs] { ++nRegs; }),
|
||||
bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
|
||||
std::bind([&nInterests] { ++nInterests; }),
|
||||
std::bind([&nRegs] { ++nRegs; }),
|
||||
std::bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
|
||||
advanceClocks(25_ms, 4);
|
||||
BOOST_CHECK_EQUAL(nRegs, 1);
|
||||
BOOST_CHECK_EQUAL(nInterests, 0);
|
||||
@@ -627,8 +626,8 @@ BOOST_AUTO_TEST_CASE(WithoutSuccessCallback)
|
||||
{
|
||||
size_t nInterests = 0;
|
||||
auto hdl = face.setInterestFilter("/Hello/World",
|
||||
bind([&nInterests] { ++nInterests; }),
|
||||
bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
|
||||
std::bind([&nInterests] { ++nInterests; }),
|
||||
std::bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
|
||||
advanceClocks(25_ms, 4);
|
||||
BOOST_CHECK_EQUAL(nInterests, 0);
|
||||
|
||||
@@ -658,9 +657,9 @@ BOOST_FIXTURE_TEST_CASE(Failure, FaceFixture<NoPrefixRegReply>)
|
||||
// don't enable registration reply
|
||||
size_t nRegFailed = 0;
|
||||
face.setInterestFilter("/Hello/World",
|
||||
bind([] { BOOST_FAIL("Unexpected Interest"); }),
|
||||
bind([] { BOOST_FAIL("Unexpected success of setInterestFilter"); }),
|
||||
bind([&nRegFailed] { ++nRegFailed; }));
|
||||
std::bind([] { BOOST_FAIL("Unexpected Interest"); }),
|
||||
std::bind([] { BOOST_FAIL("Unexpected success of setInterestFilter"); }),
|
||||
std::bind([&nRegFailed] { ++nRegFailed; }));
|
||||
|
||||
advanceClocks(25_ms, 4);
|
||||
BOOST_CHECK_EQUAL(nRegFailed, 0);
|
||||
@@ -674,8 +673,8 @@ BOOST_FIXTURE_TEST_CASE(FailureWithoutSuccessCallback, FaceFixture<NoPrefixRegRe
|
||||
// don't enable registration reply
|
||||
size_t nRegFailed = 0;
|
||||
face.setInterestFilter("/Hello/World",
|
||||
bind([] { BOOST_FAIL("Unexpected Interest"); }),
|
||||
bind([&nRegFailed] { ++nRegFailed; }));
|
||||
std::bind([] { BOOST_FAIL("Unexpected Interest"); }),
|
||||
std::bind([&nRegFailed] { ++nRegFailed; }));
|
||||
|
||||
advanceClocks(25_ms, 4);
|
||||
BOOST_CHECK_EQUAL(nRegFailed, 0);
|
||||
@@ -688,21 +687,21 @@ BOOST_AUTO_TEST_CASE(SimilarFilters)
|
||||
{
|
||||
size_t nInInterests1 = 0;
|
||||
face.setInterestFilter("/Hello/World",
|
||||
bind([&nInInterests1] { ++nInInterests1; }),
|
||||
std::bind([&nInInterests1] { ++nInInterests1; }),
|
||||
nullptr,
|
||||
bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
|
||||
std::bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
|
||||
|
||||
size_t nInInterests2 = 0;
|
||||
face.setInterestFilter("/Hello",
|
||||
bind([&nInInterests2] { ++nInInterests2; }),
|
||||
std::bind([&nInInterests2] { ++nInInterests2; }),
|
||||
nullptr,
|
||||
bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
|
||||
std::bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
|
||||
|
||||
size_t nInInterests3 = 0;
|
||||
face.setInterestFilter("/Los/Angeles/Lakers",
|
||||
bind([&nInInterests3] { ++nInInterests3; }),
|
||||
std::bind([&nInInterests3] { ++nInInterests3; }),
|
||||
nullptr,
|
||||
bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
|
||||
std::bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
|
||||
|
||||
advanceClocks(25_ms, 4);
|
||||
|
||||
@@ -718,9 +717,9 @@ BOOST_AUTO_TEST_CASE(RegexFilter)
|
||||
{
|
||||
size_t nInInterests = 0;
|
||||
face.setInterestFilter(InterestFilter("/Hello/World", "<><b><c>?"),
|
||||
bind([&nInInterests] { ++nInInterests; }),
|
||||
std::bind([&nInInterests] { ++nInInterests; }),
|
||||
nullptr,
|
||||
bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
|
||||
std::bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
|
||||
|
||||
advanceClocks(25_ms, 4);
|
||||
|
||||
@@ -744,7 +743,7 @@ BOOST_AUTO_TEST_CASE(RegexFilterError)
|
||||
BOOST_FAIL("InterestFilter::Error should have been triggered");
|
||||
},
|
||||
nullptr,
|
||||
bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
|
||||
std::bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
|
||||
|
||||
advanceClocks(25_ms, 4);
|
||||
|
||||
@@ -755,12 +754,12 @@ BOOST_AUTO_TEST_CASE(RegexFilterAndRegisterPrefix)
|
||||
{
|
||||
size_t nInInterests = 0;
|
||||
face.setInterestFilter(InterestFilter("/Hello/World", "<><b><c>?"),
|
||||
bind([&nInInterests] { ++nInInterests; }));
|
||||
std::bind([&nInInterests] { ++nInInterests; }));
|
||||
|
||||
size_t nRegSuccesses = 0;
|
||||
face.registerPrefix("/Hello/World",
|
||||
bind([&nRegSuccesses] { ++nRegSuccesses; }),
|
||||
bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
|
||||
std::bind([&nRegSuccesses] { ++nRegSuccesses; }),
|
||||
std::bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
|
||||
|
||||
advanceClocks(25_ms, 4);
|
||||
BOOST_CHECK_EQUAL(nRegSuccesses, 1);
|
||||
@@ -784,7 +783,7 @@ BOOST_FIXTURE_TEST_CASE(WithoutRegisterPrefix, FaceFixture<NoPrefixRegReply>) //
|
||||
// Regular Face won't accept incoming packets until something is sent.
|
||||
|
||||
int hit = 0;
|
||||
face.setInterestFilter(Name("/"), bind([&hit] { ++hit; }));
|
||||
face.setInterestFilter(Name("/"), std::bind([&hit] { ++hit; }));
|
||||
face.processEvents(time::milliseconds(-1));
|
||||
|
||||
face.receive(*makeInterest("/A"));
|
||||
@@ -796,7 +795,7 @@ BOOST_FIXTURE_TEST_CASE(WithoutRegisterPrefix, FaceFixture<NoPrefixRegReply>) //
|
||||
BOOST_AUTO_TEST_CASE(Handle)
|
||||
{
|
||||
int hit = 0;
|
||||
InterestFilterHandle hdl = face.setInterestFilter(Name("/"), bind([&hit] { ++hit; }));
|
||||
InterestFilterHandle hdl = face.setInterestFilter(Name("/"), std::bind([&hit] { ++hit; }));
|
||||
face.processEvents(-1_ms);
|
||||
|
||||
face.receive(*makeInterest("/A"));
|
||||
@@ -828,8 +827,8 @@ BOOST_AUTO_TEST_CASE(ProcessEvents)
|
||||
|
||||
size_t nRegSuccesses = 0;
|
||||
face.registerPrefix("/Hello/World",
|
||||
bind([&nRegSuccesses] { ++nRegSuccesses; }),
|
||||
bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
|
||||
std::bind([&nRegSuccesses] { ++nRegSuccesses; }),
|
||||
std::bind([] { BOOST_FAIL("Unexpected setInterestFilter failure"); }));
|
||||
|
||||
// io_service::poll() without reset
|
||||
face.getIoService().poll();
|
||||
|
||||
@@ -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).
|
||||
*
|
||||
@@ -450,7 +450,7 @@ protected:
|
||||
const time::milliseconds& freshWindow = InMemoryStorage::INFINITE_WINDOW)
|
||||
{
|
||||
auto data = makeData(name);
|
||||
data->setContent(make_span(reinterpret_cast<const uint8_t*>(&id), sizeof(id)));
|
||||
data->setContent({reinterpret_cast<const uint8_t*>(&id), sizeof(id)});
|
||||
|
||||
if (modifyData != nullptr) {
|
||||
modifyData(*data);
|
||||
|
||||
@@ -27,6 +27,12 @@
|
||||
namespace ndn {
|
||||
namespace tests {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((WireEncodable<Interest>));
|
||||
BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<Interest>));
|
||||
BOOST_CONCEPT_ASSERT((WireDecodable<Interest>));
|
||||
static_assert(std::is_convertible_v<Interest::Error*, tlv::Error*>,
|
||||
"Interest::Error must inherit from tlv::Error");
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(TestInterest)
|
||||
|
||||
class DisableAutoCheckParametersDigest
|
||||
|
||||
@@ -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,11 +23,19 @@
|
||||
#include "ndn-cxx/encoding/block-helpers.hpp"
|
||||
|
||||
#include "tests/boost-test.hpp"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
namespace ndn {
|
||||
namespace tests {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<KeyLocator>));
|
||||
BOOST_CONCEPT_ASSERT((WireEncodable<KeyLocator>));
|
||||
BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<KeyLocator>));
|
||||
BOOST_CONCEPT_ASSERT((WireDecodable<KeyLocator>));
|
||||
static_assert(std::is_convertible_v<KeyLocator::Error*, tlv::Error*>,
|
||||
"KeyLocator::Error must inherit from tlv::Error");
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(TestKeyLocator)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(TypeNone)
|
||||
|
||||
@@ -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).
|
||||
*
|
||||
@@ -26,6 +26,13 @@
|
||||
namespace ndn {
|
||||
namespace tests {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Link>));
|
||||
BOOST_CONCEPT_ASSERT((WireEncodable<Link>));
|
||||
BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<Link>));
|
||||
BOOST_CONCEPT_ASSERT((WireDecodable<Link>));
|
||||
static_assert(std::is_convertible_v<Link::Error*, Data::Error*>,
|
||||
"Link::Error should inherit from Data::Error");
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(TestLink)
|
||||
|
||||
const uint8_t GOOD_LINK[] = {
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2013-2023 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.
|
||||
*/
|
||||
|
||||
#include "ndn-cxx/lp/fields.hpp"
|
||||
|
||||
namespace ndn {
|
||||
namespace lp {
|
||||
namespace tests {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((Field<FragmentField>));
|
||||
BOOST_CONCEPT_ASSERT((Field<SequenceField>));
|
||||
BOOST_CONCEPT_ASSERT((Field<FragIndexField>));
|
||||
BOOST_CONCEPT_ASSERT((Field<FragCountField>));
|
||||
BOOST_CONCEPT_ASSERT((Field<PitTokenField>));
|
||||
BOOST_CONCEPT_ASSERT((Field<NackField>));
|
||||
BOOST_CONCEPT_ASSERT((Field<IncomingFaceIdField>));
|
||||
BOOST_CONCEPT_ASSERT((Field<NextHopFaceIdField>));
|
||||
BOOST_CONCEPT_ASSERT((Field<CachePolicyField>));
|
||||
BOOST_CONCEPT_ASSERT((Field<CongestionMarkField>));
|
||||
BOOST_CONCEPT_ASSERT((Field<AckField>));
|
||||
BOOST_CONCEPT_ASSERT((Field<TxSequenceField>));
|
||||
BOOST_CONCEPT_ASSERT((Field<NonDiscoveryField>));
|
||||
BOOST_CONCEPT_ASSERT((Field<PrefixAnnouncementField>));
|
||||
|
||||
} // namespace tests
|
||||
} // namespace lp
|
||||
} // namespace ndn
|
||||
@@ -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).
|
||||
*
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "ndn-cxx/lp/packet.hpp"
|
||||
|
||||
#include "tests/boost-test.hpp"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
namespace ndn {
|
||||
|
||||
@@ -26,6 +26,12 @@
|
||||
namespace ndn {
|
||||
namespace tests {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((WireEncodable<MetaInfo>));
|
||||
BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<MetaInfo>));
|
||||
BOOST_CONCEPT_ASSERT((WireDecodable<MetaInfo>));
|
||||
static_assert(std::is_convertible_v<MetaInfo::Error*, tlv::Error*>,
|
||||
"MetaInfo::Error must inherit from tlv::Error");
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(TestMetaInfo)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(EncodeDecode)
|
||||
|
||||
@@ -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,6 +20,7 @@
|
||||
*/
|
||||
|
||||
#include "ndn-cxx/mgmt/control-response.hpp"
|
||||
#include "ndn-cxx/util/concepts.hpp"
|
||||
|
||||
#include "tests/boost-test.hpp"
|
||||
|
||||
@@ -27,6 +28,11 @@ namespace ndn {
|
||||
namespace mgmt {
|
||||
namespace tests {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((WireEncodable<ControlResponse>));
|
||||
BOOST_CONCEPT_ASSERT((WireDecodable<ControlResponse>));
|
||||
static_assert(std::is_convertible_v<ControlResponse::Error*, tlv::Error*>,
|
||||
"ControlResponse::Error must inherit from tlv::Error");
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(Mgmt)
|
||||
BOOST_AUTO_TEST_SUITE(TestControlResponse)
|
||||
|
||||
|
||||
@@ -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).
|
||||
*
|
||||
@@ -31,7 +31,6 @@ namespace mgmt {
|
||||
namespace tests {
|
||||
|
||||
using namespace ndn::tests;
|
||||
using std::bind;
|
||||
|
||||
class DispatcherFixture : public IoKeyChainFixture
|
||||
{
|
||||
@@ -98,25 +97,25 @@ BOOST_AUTO_TEST_CASE(Basic)
|
||||
{
|
||||
BOOST_CHECK_NO_THROW(dispatcher
|
||||
.addControlCommand<VoidParameters>("test/1", makeAcceptAllAuthorization(),
|
||||
bind([] { return true; }),
|
||||
bind([]{})));
|
||||
std::bind([] { return true; }),
|
||||
std::bind([]{})));
|
||||
BOOST_CHECK_NO_THROW(dispatcher
|
||||
.addControlCommand<VoidParameters>("test/2", makeAcceptAllAuthorization(),
|
||||
bind([] { return true; }),
|
||||
bind([]{})));
|
||||
std::bind([] { return true; }),
|
||||
std::bind([]{})));
|
||||
|
||||
BOOST_CHECK_THROW(dispatcher
|
||||
.addControlCommand<VoidParameters>("test", makeAcceptAllAuthorization(),
|
||||
bind([] { return true; }),
|
||||
bind([]{})),
|
||||
std::bind([] { return true; }),
|
||||
std::bind([]{})),
|
||||
std::out_of_range);
|
||||
|
||||
BOOST_CHECK_NO_THROW(dispatcher.addStatusDataset("status/1",
|
||||
makeAcceptAllAuthorization(), bind([]{})));
|
||||
makeAcceptAllAuthorization(), std::bind([]{})));
|
||||
BOOST_CHECK_NO_THROW(dispatcher.addStatusDataset("status/2",
|
||||
makeAcceptAllAuthorization(), bind([]{})));
|
||||
makeAcceptAllAuthorization(), std::bind([]{})));
|
||||
BOOST_CHECK_THROW(dispatcher.addStatusDataset("status",
|
||||
makeAcceptAllAuthorization(), bind([]{})),
|
||||
makeAcceptAllAuthorization(), std::bind([]{})),
|
||||
std::out_of_range);
|
||||
|
||||
BOOST_CHECK_NO_THROW(dispatcher.addNotificationStream("stream/1"));
|
||||
@@ -130,12 +129,12 @@ BOOST_AUTO_TEST_CASE(Basic)
|
||||
|
||||
BOOST_CHECK_THROW(dispatcher
|
||||
.addControlCommand<VoidParameters>("test/3", makeAcceptAllAuthorization(),
|
||||
bind([] { return true; }),
|
||||
bind([]{})),
|
||||
std::bind([] { return true; }),
|
||||
std::bind([]{})),
|
||||
std::domain_error);
|
||||
|
||||
BOOST_CHECK_THROW(dispatcher.addStatusDataset("status/3",
|
||||
makeAcceptAllAuthorization(), bind([]{})),
|
||||
makeAcceptAllAuthorization(), std::bind([]{})),
|
||||
std::domain_error);
|
||||
|
||||
BOOST_CHECK_THROW(dispatcher.addNotificationStream("stream/3"), std::domain_error);
|
||||
@@ -146,13 +145,13 @@ BOOST_AUTO_TEST_CASE(AddRemoveTopPrefix)
|
||||
std::map<std::string, size_t> nCallbackCalled;
|
||||
dispatcher
|
||||
.addControlCommand<VoidParameters>("test/1", makeAcceptAllAuthorization(),
|
||||
bind([] { return true; }),
|
||||
bind([&nCallbackCalled] { ++nCallbackCalled["test/1"]; }));
|
||||
std::bind([] { return true; }),
|
||||
std::bind([&nCallbackCalled] { ++nCallbackCalled["test/1"]; }));
|
||||
|
||||
dispatcher
|
||||
.addControlCommand<VoidParameters>("test/2", makeAcceptAllAuthorization(),
|
||||
bind([] { return true; }),
|
||||
bind([&nCallbackCalled] { ++nCallbackCalled["test/2"]; }));
|
||||
std::bind([] { return true; }),
|
||||
std::bind([&nCallbackCalled] { ++nCallbackCalled["test/2"]; }));
|
||||
|
||||
face.receive(*makeInterest("/root/1/test/1/%80%00"));
|
||||
advanceClocks(1_ms);
|
||||
@@ -207,8 +206,8 @@ BOOST_AUTO_TEST_CASE(ControlCommand)
|
||||
dispatcher
|
||||
.addControlCommand<VoidParameters>("test",
|
||||
makeTestAuthorization(),
|
||||
bind([] { return true; }),
|
||||
bind([&nCallbackCalled] { ++nCallbackCalled; }));
|
||||
std::bind([] { return true; }),
|
||||
std::bind([&nCallbackCalled] { ++nCallbackCalled; }));
|
||||
|
||||
dispatcher.addTopPrefix("/root");
|
||||
advanceClocks(1_ms);
|
||||
@@ -281,7 +280,7 @@ BOOST_AUTO_TEST_CASE(ControlCommandAsyncAuthorization) // Bug 4059
|
||||
|
||||
size_t nCallbackCalled = 0;
|
||||
dispatcher.addControlCommand<StatefulParameters>("test", authorization, validateParameters,
|
||||
bind([&nCallbackCalled] { ++nCallbackCalled; }));
|
||||
std::bind([&nCallbackCalled] { ++nCallbackCalled; }));
|
||||
|
||||
dispatcher.addTopPrefix("/root");
|
||||
advanceClocks(1_ms);
|
||||
|
||||
@@ -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,6 +20,7 @@
|
||||
*/
|
||||
|
||||
#include "ndn-cxx/mgmt/nfd/channel-status.hpp"
|
||||
#include "ndn-cxx/util/concepts.hpp"
|
||||
|
||||
#include "tests/boost-test.hpp"
|
||||
|
||||
@@ -29,6 +30,8 @@ namespace ndn {
|
||||
namespace nfd {
|
||||
namespace tests {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((StatusDatasetItem<ChannelStatus>));
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(Mgmt)
|
||||
BOOST_AUTO_TEST_SUITE(Nfd)
|
||||
BOOST_AUTO_TEST_SUITE(TestChannelStatus)
|
||||
|
||||
@@ -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/mgmt/nfd/control-parameters.hpp"
|
||||
#include "ndn-cxx/util/concepts.hpp"
|
||||
|
||||
#include "tests/boost-test.hpp"
|
||||
|
||||
@@ -27,6 +28,11 @@ namespace ndn {
|
||||
namespace nfd {
|
||||
namespace tests {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((WireEncodable<ControlParameters>));
|
||||
BOOST_CONCEPT_ASSERT((WireDecodable<ControlParameters>));
|
||||
static_assert(std::is_convertible_v<ControlParameters::Error*, tlv::Error*>,
|
||||
"ControlParameters::Error must inherit from tlv::Error");
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(Mgmt)
|
||||
BOOST_AUTO_TEST_SUITE(Nfd)
|
||||
BOOST_AUTO_TEST_SUITE(TestControlParameters)
|
||||
|
||||
@@ -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).
|
||||
*
|
||||
@@ -20,14 +20,18 @@
|
||||
*/
|
||||
|
||||
#include "ndn-cxx/mgmt/nfd/cs-info.hpp"
|
||||
#include "ndn-cxx/util/concepts.hpp"
|
||||
|
||||
#include "tests/boost-test.hpp"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
namespace ndn {
|
||||
namespace nfd {
|
||||
namespace tests {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((StatusDatasetItem<CsInfo>));
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(Mgmt)
|
||||
BOOST_AUTO_TEST_SUITE(Nfd)
|
||||
BOOST_AUTO_TEST_SUITE(TestCsInfo)
|
||||
|
||||
@@ -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,6 +20,7 @@
|
||||
*/
|
||||
|
||||
#include "ndn-cxx/mgmt/nfd/face-event-notification.hpp"
|
||||
#include "ndn-cxx/util/concepts.hpp"
|
||||
|
||||
#include "tests/boost-test.hpp"
|
||||
|
||||
@@ -29,6 +30,8 @@ namespace ndn {
|
||||
namespace nfd {
|
||||
namespace tests {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((NotificationStreamItem<FaceEventNotification>));
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(Mgmt)
|
||||
BOOST_AUTO_TEST_SUITE(Nfd)
|
||||
BOOST_AUTO_TEST_SUITE(TestFaceEventNotification)
|
||||
|
||||
@@ -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,6 +20,7 @@
|
||||
*/
|
||||
|
||||
#include "ndn-cxx/mgmt/nfd/face-query-filter.hpp"
|
||||
#include "ndn-cxx/util/concepts.hpp"
|
||||
|
||||
#include "tests/boost-test.hpp"
|
||||
|
||||
@@ -29,6 +30,12 @@ namespace ndn {
|
||||
namespace nfd {
|
||||
namespace tests {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<FaceQueryFilter>));
|
||||
BOOST_CONCEPT_ASSERT((WireEncodable<FaceQueryFilter>));
|
||||
BOOST_CONCEPT_ASSERT((WireDecodable<FaceQueryFilter>));
|
||||
static_assert(std::is_convertible_v<FaceQueryFilter::Error*, tlv::Error*>,
|
||||
"FaceQueryFilter::Error must inherit from tlv::Error");
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(Mgmt)
|
||||
BOOST_AUTO_TEST_SUITE(Nfd)
|
||||
BOOST_AUTO_TEST_SUITE(TestFaceQueryFilter)
|
||||
|
||||
@@ -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,6 +20,7 @@
|
||||
*/
|
||||
|
||||
#include "ndn-cxx/mgmt/nfd/face-status.hpp"
|
||||
#include "ndn-cxx/util/concepts.hpp"
|
||||
|
||||
#include "tests/boost-test.hpp"
|
||||
|
||||
@@ -29,6 +30,8 @@ namespace ndn {
|
||||
namespace nfd {
|
||||
namespace tests {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((StatusDatasetItem<FaceStatus>));
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(Mgmt)
|
||||
BOOST_AUTO_TEST_SUITE(Nfd)
|
||||
BOOST_AUTO_TEST_SUITE(TestFaceStatus)
|
||||
|
||||
@@ -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).
|
||||
*
|
||||
@@ -20,14 +20,19 @@
|
||||
*/
|
||||
|
||||
#include "ndn-cxx/mgmt/nfd/fib-entry.hpp"
|
||||
#include "ndn-cxx/util/concepts.hpp"
|
||||
|
||||
#include "tests/boost-test.hpp"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
namespace ndn {
|
||||
namespace nfd {
|
||||
namespace tests {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((StatusDatasetItem<NextHopRecord>));
|
||||
BOOST_CONCEPT_ASSERT((StatusDatasetItem<FibEntry>));
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(Mgmt)
|
||||
BOOST_AUTO_TEST_SUITE(Nfd)
|
||||
BOOST_AUTO_TEST_SUITE(TestFibEntry)
|
||||
|
||||
@@ -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,6 +20,7 @@
|
||||
*/
|
||||
|
||||
#include "ndn-cxx/mgmt/nfd/forwarder-status.hpp"
|
||||
#include "ndn-cxx/util/concepts.hpp"
|
||||
|
||||
#include "tests/boost-test.hpp"
|
||||
|
||||
@@ -29,6 +30,8 @@ namespace ndn {
|
||||
namespace nfd {
|
||||
namespace tests {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((StatusDatasetItem<ForwarderStatus>));
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(Mgmt)
|
||||
BOOST_AUTO_TEST_SUITE(Nfd)
|
||||
BOOST_AUTO_TEST_SUITE(TestForwarderStatus)
|
||||
|
||||
@@ -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,14 +20,19 @@
|
||||
*/
|
||||
|
||||
#include "ndn-cxx/mgmt/nfd/rib-entry.hpp"
|
||||
#include "ndn-cxx/util/concepts.hpp"
|
||||
|
||||
#include "tests/boost-test.hpp"
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
namespace ndn {
|
||||
namespace nfd {
|
||||
namespace tests {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((StatusDatasetItem<Route>));
|
||||
BOOST_CONCEPT_ASSERT((StatusDatasetItem<RibEntry>));
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(Mgmt)
|
||||
BOOST_AUTO_TEST_SUITE(Nfd)
|
||||
BOOST_AUTO_TEST_SUITE(TestRibEntry)
|
||||
|
||||
@@ -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,6 +20,7 @@
|
||||
*/
|
||||
|
||||
#include "ndn-cxx/mgmt/nfd/strategy-choice.hpp"
|
||||
#include "ndn-cxx/util/concepts.hpp"
|
||||
|
||||
#include "tests/boost-test.hpp"
|
||||
|
||||
@@ -29,6 +30,8 @@ namespace ndn {
|
||||
namespace nfd {
|
||||
namespace tests {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((StatusDatasetItem<StrategyChoice>));
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(Mgmt)
|
||||
BOOST_AUTO_TEST_SUITE(Nfd)
|
||||
BOOST_AUTO_TEST_SUITE(TestStrategyChoice)
|
||||
|
||||
@@ -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).
|
||||
*
|
||||
@@ -34,6 +34,13 @@ namespace ndn {
|
||||
namespace name {
|
||||
namespace tests {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Component>));
|
||||
BOOST_CONCEPT_ASSERT((WireEncodable<Component>));
|
||||
BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<Component>));
|
||||
BOOST_CONCEPT_ASSERT((WireDecodable<Component>));
|
||||
static_assert(std::is_convertible_v<Component::Error*, tlv::Error*>,
|
||||
"name::Component::Error must inherit from tlv::Error");
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(TestNameComponent)
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(Decode)
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "tests/boost-test.hpp"
|
||||
|
||||
#include <unordered_map>
|
||||
#include <boost/range/concepts.hpp>
|
||||
|
||||
namespace ndn {
|
||||
namespace tests {
|
||||
@@ -31,6 +32,18 @@ namespace tests {
|
||||
using Component = name::Component;
|
||||
using UriFormat = name::UriFormat;
|
||||
|
||||
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Name>));
|
||||
BOOST_CONCEPT_ASSERT((WireEncodable<Name>));
|
||||
BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<Name>));
|
||||
BOOST_CONCEPT_ASSERT((WireDecodable<Name>));
|
||||
BOOST_CONCEPT_ASSERT((boost::RandomAccessIterator<Name::iterator>));
|
||||
BOOST_CONCEPT_ASSERT((boost::RandomAccessIterator<Name::const_iterator>));
|
||||
BOOST_CONCEPT_ASSERT((boost::RandomAccessIterator<Name::reverse_iterator>));
|
||||
BOOST_CONCEPT_ASSERT((boost::RandomAccessIterator<Name::const_reverse_iterator>));
|
||||
BOOST_CONCEPT_ASSERT((boost::RandomAccessRangeConcept<Name>));
|
||||
static_assert(std::is_convertible_v<Name::Error*, tlv::Error*>,
|
||||
"Name::Error must inherit from tlv::Error");
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(TestName)
|
||||
|
||||
// ---- encoding, decoding, and URI ----
|
||||
|
||||
@@ -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,
|
||||
* Arizona Board of Regents,
|
||||
* Colorado State University,
|
||||
* University Pierre & Marie Curie, Sorbonne University,
|
||||
@@ -32,9 +32,13 @@
|
||||
#include "tests/boost-test.hpp"
|
||||
#include "tests/unit/net/network-configuration-detector.hpp"
|
||||
|
||||
#include <boost/concept_check.hpp>
|
||||
|
||||
namespace ndn {
|
||||
namespace tests {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<FaceUri>));
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(Net)
|
||||
BOOST_AUTO_TEST_SUITE(TestFaceUri)
|
||||
|
||||
|
||||
@@ -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,6 +20,7 @@
|
||||
*/
|
||||
|
||||
#include "ndn-cxx/security/additional-description.hpp"
|
||||
#include "ndn-cxx/util/concepts.hpp"
|
||||
|
||||
#include "tests/boost-test.hpp"
|
||||
|
||||
@@ -27,6 +28,13 @@ namespace ndn {
|
||||
namespace security {
|
||||
namespace tests {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<AdditionalDescription>));
|
||||
BOOST_CONCEPT_ASSERT((WireEncodable<AdditionalDescription>));
|
||||
BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<AdditionalDescription>));
|
||||
BOOST_CONCEPT_ASSERT((WireDecodable<AdditionalDescription>));
|
||||
static_assert(std::is_convertible_v<AdditionalDescription::Error*, tlv::Error*>,
|
||||
"AdditionalDescription::Error must inherit from tlv::Error");
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(Security)
|
||||
BOOST_AUTO_TEST_SUITE(TestAdditionalDescription)
|
||||
|
||||
|
||||
@@ -37,6 +37,11 @@ namespace tests {
|
||||
|
||||
using namespace ndn::tests;
|
||||
|
||||
BOOST_CONCEPT_ASSERT((WireEncodable<Certificate>));
|
||||
BOOST_CONCEPT_ASSERT((WireDecodable<Certificate>));
|
||||
static_assert(std::is_convertible_v<Certificate::Error*, Data::Error*>,
|
||||
"Certificate::Error must inherit from Data::Error");
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(Security)
|
||||
BOOST_FIXTURE_TEST_SUITE(TestCertificate, ClockFixture)
|
||||
|
||||
|
||||
@@ -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,7 @@
|
||||
|
||||
#include "ndn-cxx/security/pib/certificate-container.hpp"
|
||||
#include "ndn-cxx/security/pib/impl/pib-memory.hpp"
|
||||
#include "ndn-cxx/util/concepts.hpp"
|
||||
|
||||
#include "tests/boost-test.hpp"
|
||||
#include "tests/unit/security/pib/pib-data-fixture.hpp"
|
||||
@@ -30,6 +31,8 @@ namespace security {
|
||||
namespace pib {
|
||||
namespace tests {
|
||||
|
||||
NDN_CXX_ASSERT_FORWARD_ITERATOR(CertificateContainer::const_iterator);
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(Security)
|
||||
BOOST_AUTO_TEST_SUITE(Pib)
|
||||
BOOST_FIXTURE_TEST_SUITE(TestCertificateContainer, PibDataFixture)
|
||||
|
||||
@@ -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,7 @@
|
||||
|
||||
#include "ndn-cxx/security/pib/identity-container.hpp"
|
||||
#include "ndn-cxx/security/pib/impl/pib-memory.hpp"
|
||||
#include "ndn-cxx/util/concepts.hpp"
|
||||
|
||||
#include "tests/boost-test.hpp"
|
||||
#include "tests/unit/security/pib/pib-data-fixture.hpp"
|
||||
@@ -30,6 +31,8 @@ namespace security {
|
||||
namespace pib {
|
||||
namespace tests {
|
||||
|
||||
NDN_CXX_ASSERT_FORWARD_ITERATOR(IdentityContainer::const_iterator);
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(Security)
|
||||
BOOST_AUTO_TEST_SUITE(Pib)
|
||||
BOOST_FIXTURE_TEST_SUITE(TestIdentityContainer, PibDataFixture)
|
||||
|
||||
@@ -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,7 @@
|
||||
|
||||
#include "ndn-cxx/security/pib/key-container.hpp"
|
||||
#include "ndn-cxx/security/pib/impl/pib-memory.hpp"
|
||||
#include "ndn-cxx/util/concepts.hpp"
|
||||
|
||||
#include "tests/boost-test.hpp"
|
||||
#include "tests/unit/security/pib/pib-data-fixture.hpp"
|
||||
@@ -30,6 +31,8 @@ namespace security {
|
||||
namespace pib {
|
||||
namespace tests {
|
||||
|
||||
NDN_CXX_ASSERT_FORWARD_ITERATOR(KeyContainer::const_iterator);
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(Security)
|
||||
BOOST_AUTO_TEST_SUITE(Pib)
|
||||
BOOST_FIXTURE_TEST_SUITE(TestKeyContainer, PibDataFixture)
|
||||
|
||||
@@ -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).
|
||||
*
|
||||
@@ -29,6 +29,9 @@ namespace ndn {
|
||||
namespace security {
|
||||
namespace tests {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((WireEncodable<SafeBag>));
|
||||
BOOST_CONCEPT_ASSERT((WireDecodable<SafeBag>));
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(Security)
|
||||
BOOST_AUTO_TEST_SUITE(TestSafeBag)
|
||||
|
||||
|
||||
@@ -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).
|
||||
*
|
||||
@@ -28,8 +28,6 @@ namespace ndn {
|
||||
namespace security {
|
||||
namespace tests {
|
||||
|
||||
using std::bind;
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(Security)
|
||||
BOOST_FIXTURE_TEST_SUITE(TestValidatorNull, ndn::tests::KeyChainFixture)
|
||||
|
||||
@@ -41,8 +39,8 @@ BOOST_AUTO_TEST_CASE(ValidateData)
|
||||
|
||||
ValidatorNull validator;
|
||||
validator.validate(data,
|
||||
bind([] { BOOST_CHECK_MESSAGE(true, "Validation should succeed"); }),
|
||||
bind([] { BOOST_CHECK_MESSAGE(false, "Validation should not have failed"); }));
|
||||
std::bind([] { BOOST_CHECK_MESSAGE(true, "Validation should succeed"); }),
|
||||
std::bind([] { BOOST_CHECK_MESSAGE(false, "Validation should not have failed"); }));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(ValidateInterest)
|
||||
@@ -53,8 +51,8 @@ BOOST_AUTO_TEST_CASE(ValidateInterest)
|
||||
|
||||
ValidatorNull validator;
|
||||
validator.validate(interest,
|
||||
bind([] { BOOST_CHECK_MESSAGE(true, "Validation should succeed"); }),
|
||||
bind([] { BOOST_CHECK_MESSAGE(false, "Validation should not have failed"); }));
|
||||
std::bind([] { BOOST_CHECK_MESSAGE(true, "Validation should succeed"); }),
|
||||
std::bind([] { BOOST_CHECK_MESSAGE(false, "Validation should not have failed"); }));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END() // TestValidatorNull
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
#include "ndn-cxx/security/validity-period.hpp"
|
||||
#include "ndn-cxx/util/concepts.hpp"
|
||||
|
||||
#include "tests/boost-test.hpp"
|
||||
#include "tests/unit/clock-fixture.hpp"
|
||||
@@ -32,6 +33,13 @@ namespace tests {
|
||||
|
||||
using namespace ndn::tests;
|
||||
|
||||
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<ValidityPeriod>));
|
||||
BOOST_CONCEPT_ASSERT((WireEncodable<ValidityPeriod>));
|
||||
BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<ValidityPeriod>));
|
||||
BOOST_CONCEPT_ASSERT((WireDecodable<ValidityPeriod>));
|
||||
static_assert(std::is_convertible_v<ValidityPeriod::Error*, tlv::Error*>,
|
||||
"ValidityPeriod::Error must inherit from tlv::Error");
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(Security)
|
||||
BOOST_AUTO_TEST_SUITE(TestValidityPeriod)
|
||||
|
||||
|
||||
@@ -28,6 +28,13 @@
|
||||
namespace ndn {
|
||||
namespace tests {
|
||||
|
||||
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<SignatureInfo>));
|
||||
BOOST_CONCEPT_ASSERT((WireEncodable<SignatureInfo>));
|
||||
BOOST_CONCEPT_ASSERT((WireEncodableWithEncodingBuffer<SignatureInfo>));
|
||||
BOOST_CONCEPT_ASSERT((WireDecodable<SignatureInfo>));
|
||||
static_assert(std::is_convertible_v<SignatureInfo::Error*, tlv::Error*>,
|
||||
"SignatureInfo::Error must inherit from tlv::Error");
|
||||
|
||||
BOOST_AUTO_TEST_SUITE(TestSignatureInfo)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(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).
|
||||
*
|
||||
@@ -36,7 +36,6 @@ namespace util {
|
||||
namespace tests {
|
||||
|
||||
using namespace ndn::tests;
|
||||
using std::bind;
|
||||
|
||||
class SegmentFetcherFixture : public IoKeyChainFixture
|
||||
{
|
||||
@@ -93,10 +92,10 @@ public:
|
||||
void
|
||||
connectSignals(const shared_ptr<SegmentFetcher>& fetcher)
|
||||
{
|
||||
fetcher->onInOrderData.connect(bind(&SegmentFetcherFixture::onInOrderData, this, _1));
|
||||
fetcher->onInOrderComplete.connect(bind(&SegmentFetcherFixture::onInOrderComplete, this));
|
||||
fetcher->onComplete.connect(bind(&SegmentFetcherFixture::onComplete, this, _1));
|
||||
fetcher->onError.connect(bind(&SegmentFetcherFixture::onError, this, _1));
|
||||
fetcher->onInOrderData.connect(std::bind(&SegmentFetcherFixture::onInOrderData, this, _1));
|
||||
fetcher->onInOrderComplete.connect(std::bind(&SegmentFetcherFixture::onInOrderComplete, this));
|
||||
fetcher->onComplete.connect(std::bind(&SegmentFetcherFixture::onComplete, this, _1));
|
||||
fetcher->onError.connect(std::bind(&SegmentFetcherFixture::onError, this, _1));
|
||||
|
||||
fetcher->afterSegmentReceived.connect([this] (const auto&) { ++this->nAfterSegmentReceived; });
|
||||
fetcher->afterSegmentValidated.connect([this] (const auto &) { ++this->nAfterSegmentValidated; });
|
||||
@@ -190,7 +189,7 @@ BOOST_AUTO_TEST_CASE(ExceedMaxTimeout)
|
||||
shared_ptr<SegmentFetcher> fetcher = SegmentFetcher::start(face, Interest("/hello/world"),
|
||||
acceptValidator, options);
|
||||
connectSignals(fetcher);
|
||||
fetcher->afterSegmentTimedOut.connect(bind([&nAfterSegmentTimedOut] { ++nAfterSegmentTimedOut; }));
|
||||
fetcher->afterSegmentTimedOut.connect([&nAfterSegmentTimedOut] { ++nAfterSegmentTimedOut; });
|
||||
|
||||
advanceClocks(1_ms);
|
||||
BOOST_REQUIRE_EQUAL(face.sentInterests.size(), 1);
|
||||
@@ -310,7 +309,7 @@ BOOST_AUTO_TEST_CASE(BasicMultipleSegments)
|
||||
|
||||
shared_ptr<SegmentFetcher> fetcher = SegmentFetcher::start(face, Interest("/hello/world"),
|
||||
acceptValidator);
|
||||
face.onSendInterest.connect(bind(&SegmentFetcherFixture::onInterest, this, _1));
|
||||
face.onSendInterest.connect(std::bind(&SegmentFetcherFixture::onInterest, this, _1));
|
||||
connectSignals(fetcher);
|
||||
|
||||
face.processEvents(1_s);
|
||||
@@ -333,7 +332,7 @@ BOOST_AUTO_TEST_CASE(BasicInOrder)
|
||||
sendNackInsteadOfDropping = false;
|
||||
|
||||
auto fetcher = SegmentFetcher::start(face, Interest("/hello/world"), acceptValidator, options);
|
||||
face.onSendInterest.connect(bind(&SegmentFetcherFixture::onInterest, this, _1));
|
||||
face.onSendInterest.connect(std::bind(&SegmentFetcherFixture::onInterest, this, _1));
|
||||
connectSignals(fetcher);
|
||||
|
||||
face.processEvents(1_s);
|
||||
@@ -358,7 +357,7 @@ BOOST_AUTO_TEST_CASE(FirstSegmentNotZero)
|
||||
|
||||
shared_ptr<SegmentFetcher> fetcher = SegmentFetcher::start(face, Interest("/hello/world"),
|
||||
acceptValidator);
|
||||
face.onSendInterest.connect(bind(&SegmentFetcherFixture::onInterest, this, _1));
|
||||
face.onSendInterest.connect(std::bind(&SegmentFetcherFixture::onInterest, this, _1));
|
||||
connectSignals(fetcher);
|
||||
|
||||
face.processEvents(1_s);
|
||||
@@ -382,7 +381,7 @@ BOOST_AUTO_TEST_CASE(FirstSegmentNotZeroInOrder)
|
||||
defaultSegmentToSend = 47;
|
||||
|
||||
auto fetcher = SegmentFetcher::start(face, Interest("/hello/world"), acceptValidator, options);
|
||||
face.onSendInterest.connect(bind(&SegmentFetcherFixture::onInterest, this, _1));
|
||||
face.onSendInterest.connect(std::bind(&SegmentFetcherFixture::onInterest, this, _1));
|
||||
connectSignals(fetcher);
|
||||
|
||||
face.processEvents(1_s);
|
||||
@@ -627,7 +626,7 @@ BOOST_AUTO_TEST_CASE(DuplicateNack)
|
||||
|
||||
shared_ptr<SegmentFetcher> fetcher = SegmentFetcher::start(face, Interest("/hello/world"),
|
||||
acceptValidator);
|
||||
face.onSendInterest.connect(bind(&SegmentFetcherFixture::onInterest, this, _1));
|
||||
face.onSendInterest.connect(std::bind(&SegmentFetcherFixture::onInterest, this, _1));
|
||||
connectSignals(fetcher);
|
||||
|
||||
face.processEvents(1_s);
|
||||
@@ -652,7 +651,7 @@ BOOST_AUTO_TEST_CASE(CongestionNack)
|
||||
|
||||
shared_ptr<SegmentFetcher> fetcher = SegmentFetcher::start(face, Interest("/hello/world"),
|
||||
acceptValidator);
|
||||
face.onSendInterest.connect(bind(&SegmentFetcherFixture::onInterest, this, _1));
|
||||
face.onSendInterest.connect(std::bind(&SegmentFetcherFixture::onInterest, this, _1));
|
||||
connectSignals(fetcher);
|
||||
|
||||
face.processEvents(1_s);
|
||||
@@ -672,7 +671,7 @@ BOOST_AUTO_TEST_CASE(OtherNackReason)
|
||||
segmentsToDropOrNack.push(0);
|
||||
sendNackInsteadOfDropping = true;
|
||||
nackReason = lp::NackReason::NO_ROUTE;
|
||||
face.onSendInterest.connect(bind(&SegmentFetcherFixture::onInterest, this, _1));
|
||||
face.onSendInterest.connect(std::bind(&SegmentFetcherFixture::onInterest, this, _1));
|
||||
|
||||
shared_ptr<SegmentFetcher> fetcher = SegmentFetcher::start(face, Interest("/hello/world"),
|
||||
acceptValidator);
|
||||
|
||||
@@ -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).
|
||||
*
|
||||
@@ -23,6 +23,8 @@
|
||||
|
||||
#include "tests/boost-test.hpp"
|
||||
|
||||
#include <boost/concept_check.hpp>
|
||||
|
||||
namespace ndn {
|
||||
namespace util {
|
||||
namespace signal {
|
||||
@@ -117,19 +119,16 @@ BOOST_AUTO_TEST_CASE(TwoArguments)
|
||||
class RefObject
|
||||
{
|
||||
public:
|
||||
RefObject()
|
||||
{
|
||||
}
|
||||
RefObject() = default;
|
||||
|
||||
RefObject(const RefObject& other)
|
||||
RefObject(const RefObject&)
|
||||
{
|
||||
++s_copyCount;
|
||||
}
|
||||
|
||||
public:
|
||||
static int s_copyCount;
|
||||
static inline int s_copyCount = 0;
|
||||
};
|
||||
int RefObject::s_copyCount = 0;
|
||||
|
||||
// Signal passes arguments by reference,
|
||||
// but it also allows a handler that accept arguments by value
|
||||
@@ -446,6 +445,8 @@ BOOST_AUTO_TEST_CASE(ThrowInHandler)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(ConnectionEquality)
|
||||
{
|
||||
BOOST_CONCEPT_ASSERT((boost::EqualityComparable<Connection>));
|
||||
|
||||
SignalOwner0 so;
|
||||
|
||||
Connection conn1, conn2;
|
||||
|
||||
Reference in new issue
Block a user