link.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2013-2023 Regents of the University of California.
4  *
5  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
6  *
7  * ndn-cxx library is free software: you can redistribute it and/or modify it under the
8  * terms of the GNU Lesser General Public License as published by the Free Software
9  * Foundation, either version 3 of the License, or (at your option) any later version.
10  *
11  * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
12  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13  * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
14  *
15  * You should have received copies of the GNU General Public License and GNU Lesser
16  * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
17  * <http://www.gnu.org/licenses/>.
18  *
19  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
20  */
21 
22 #ifndef NDN_CXX_LINK_HPP
23 #define NDN_CXX_LINK_HPP
24 
25 #include "ndn-cxx/data.hpp"
26 
27 #include <initializer_list>
28 
29 namespace ndn {
30 
35 class Link : public Data
36 {
37 public:
38  class Error : public Data::Error
39  {
40  public:
41  using Data::Error::Error;
42  };
43 
51  Link();
52 
61  explicit
62  Link(const Block& wire);
63 
73  explicit
74  Link(const Name& name, std::initializer_list<Name> delegations = {});
75 
79  void
80  wireDecode(const Block& wire);
81 
84  span<const Name>
86  {
87  return m_delegations;
88  }
89 
93  void
94  setDelegationList(std::vector<Name> delegations);
95 
100  bool
101  addDelegation(const Name& name);
102 
107  bool
108  removeDelegation(const Name& name);
109 
110 private:
111  void
112  encodeContent();
113 
114 private:
115  std::vector<Name> m_delegations;
116 };
117 
118 } // namespace ndn
119 
120 #endif // NDN_CXX_LINK_HPP
Represents a TLV element of the NDN packet format.
Definition: block.hpp:45
Represents a Data packet.
Definition: data.hpp:39
Represents an absolute name.
Definition: name.hpp:45
Error(const char *expectedType, uint32_t actualType)
Definition: tlv.cpp:28
Definition: data.cpp:25