diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7d406db..cd42be9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -49,7 +49,7 @@ jobs: uses: actions/checkout@v2 with: repository: FDio/vpp - ref: v21.06 + ref: v21.10.1 path: vpp - name: install libmemif run: | diff --git a/LICENSE b/LICENSE index f3fa22b..2c53c9c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ ISC License -Copyright (c) 2020-2021, Junxiao Shi +Copyright (c) 2020-2022, Junxiao Shi Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above diff --git a/library.properties b/library.properties index d792ce9..89c1bde 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=NDNph -version=0.0.20211208 +version=0.0.20220104 author=Junxiao Shi maintainer=Junxiao Shi sentence=Named Data Networking packet headers. diff --git a/src/ndnph/packet/an.hpp b/src/ndnph/packet/an.hpp index 243ca89..135b14d 100644 --- a/src/ndnph/packet/an.hpp +++ b/src/ndnph/packet/an.hpp @@ -32,8 +32,6 @@ enum CanBePrefix = 0x21, MustBeFresh = 0x12, ForwardingHint = 0x1E, - Delegation = 0x1F, - Preference = 0x1E, Nonce = 0x0A, InterestLifetime = 0x0C, HopLimit = 0x22, diff --git a/src/ndnph/packet/interest.hpp b/src/ndnph/packet/interest.hpp index 952849b..da10b88 100644 --- a/src/ndnph/packet/interest.hpp +++ b/src/ndnph/packet/interest.hpp @@ -17,21 +17,13 @@ encodeFwHint(Encoder& encoder, const Name& fwHint) if (!fwHint) { return false; } - return encoder.prependTlv(TT::ForwardingHint, [&fwHint](Encoder& encoder) { - return encoder.prependTlv( - TT::Delegation, [](Encoder& encoder) { encoder.prependTlv(TT::Preference, tlv::NNI(0)); }, - fwHint); - }); + return encoder.prependTlv(TT::ForwardingHint, fwHint); } inline bool decodeFwHint(const Decoder::Tlv& d, Name* target) { - return EvDecoder::decode(d, { TT::ForwardingHint }, - EvDecoder::def([target](const Decoder::Tlv& d) { - return EvDecoder::decode(d, {}, EvDecoder::defIgnore(), - EvDecoder::def(target)); - })); + return EvDecoder::decode(d, { TT::ForwardingHint }, EvDecoder::def(target)); } /** @brief Fields in parameterized/signed Interest. */ diff --git a/src/ndnph/packet/name.hpp b/src/ndnph/packet/name.hpp index 4e33bf0..5d0a18d 100644 --- a/src/ndnph/packet/name.hpp +++ b/src/ndnph/packet/name.hpp @@ -214,52 +214,6 @@ class Name : public Printable return Name(encoder.begin(), encoder.size(), m_nComps + nComps); } - /** - * @brief Append a sequence of components. - * @return new Name that copies TLV-VALUE of this name and all components. - * @retval Name() any Component is invalid or allocation error. - * - * If you need to append multiple components, it's recommended to append them all at once, - * so that memory allocation and copying occur only once. - */ - [[deprecated("append(region, comp, comp, ...)")]] Name append( - Region& region, std::initializer_list comps) const - { - size_t nComps = m_nComps, length = m_length; - for (const auto& comp : comps) { - if (!comp) { - return Name(); - } - ++nComps; - length += comp.size(); - } - - uint8_t* value = region.alloc(length); - if (value == nullptr) { - return Name(); - } - - uint8_t* pos = value; - pos = std::copy_n(m_value, m_length, pos); - for (const auto& comp : comps) { - pos = std::copy_n(comp.tlv(), comp.size(), pos); - } - return Name(value, length, nComps); - } - - /** - * @brief Append a component from naming convention. - * @tparam Convention the naming convention. - * @return new Name that copies TLV-VALUE of this name and the new component. - * @retval Name() any Component is invalid or allocation error. - */ - template - [[deprecated("append(region, Convention(), arg)")]] Name append(Region& region, - const Arg& arg) const - { - return append(region, Convention(), arg); - } - /** * @brief Clone TLV-VALUE into given region. * @return new Name that does not reference memory of this Name, diff --git a/tests/unit/packet/convention.t.cpp b/tests/unit/packet/convention.t.cpp index 68b11d2..50e88b4 100644 --- a/tests/unit/packet/convention.t.cpp +++ b/tests/unit/packet/convention.t.cpp @@ -55,13 +55,6 @@ TEST(Convention, Segment) uint64_t segment = name[-1].as(); EXPECT_EQ(segment, 700); - -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" - name = name.append(region, 701); -#pragma GCC diagnostic pop - EXPECT_EQ(test::toString(name[-1]), "50=%02%BD"); - EXPECT_TRUE(name[-1].is()); } } // namespace diff --git a/tests/unit/packet/interest.t.cpp b/tests/unit/packet/interest.t.cpp index 63f8b6c..49743d2 100644 --- a/tests/unit/packet/interest.t.cpp +++ b/tests/unit/packet/interest.t.cpp @@ -59,18 +59,17 @@ TEST(Interest, EncodeFull) ASSERT_FALSE(!interest); std::vector wire({ - 0x64, 0x2D, // LpPacket - 0x62, 0x04, 0xB0, 0xB1, 0xB2, 0xB3, // PitToken - 0x50, 0x25, // LpPayload - 0x05, 0x23, // Interest - 0x07, 0x03, 0x08, 0x01, 0x41, // Name - 0x21, 0x00, // CanBePrefix - 0x12, 0x00, // MustBeFresh - 0x1E, 0x0B, 0x1F, 0x09, 0x1E, 0x01, 0x00, // ForwardingHint - 0x07, 0x04, 0x08, 0x02, 0x66, 0x68, // ForwardingHint - 0x0A, 0x04, 0xA0, 0xA1, 0xA2, 0xA3, // Nonce - 0x0C, 0x02, 0x20, 0x06, // InterestLifetime - 0x22, 0x01, 0x05, // HopLimit + 0x64, 0x28, // LpPacket + 0x62, 0x04, 0xB0, 0xB1, 0xB2, 0xB3, // PitToken + 0x50, 0x20, // LpPayload + 0x05, 0x1E, // Interest + 0x07, 0x03, 0x08, 0x01, 0x41, // Name + 0x21, 0x00, // CanBePrefix + 0x12, 0x00, // MustBeFresh + 0x1E, 0x06, 0x07, 0x04, 0x08, 0x02, 0x66, 0x68, // ForwardingHint + 0x0A, 0x04, 0xA0, 0xA1, 0xA2, 0xA3, // Nonce + 0x0C, 0x02, 0x20, 0x06, // InterestLifetime + 0x22, 0x01, 0x05, // HopLimit }); interest.setName(Name::parse(region, "/A")); interest.setCanBePrefix(true); diff --git a/tests/unit/packet/name.t.cpp b/tests/unit/packet/name.t.cpp index 69990ce..f7ef9ec 100644 --- a/tests/unit/packet/name.t.cpp +++ b/tests/unit/packet/name.t.cpp @@ -173,13 +173,6 @@ TEST(Name, Append) EXPECT_THAT(std::vector(name2.value(), name2.value() + name2.length()), g::ElementsAreArray(wire)); -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" - name2 = name.append(region, { comp1, comp2, comp1, comp3 }); -#pragma GCC diagnostic pop - EXPECT_THAT(std::vector(name2.value(), name2.value() + name2.length()), - g::ElementsAreArray(wire)); - name2 = name.append(region, comp1, Component(), comp2); // invalid component EXPECT_FALSE(!!name2); }