metadata-object.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2013-2020 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  * @author Chavoosh Ghasemi <chghasemi@cs.arizona.edu>
22  */
23 
24 #ifndef NDN_METADATA_OBJECT_HPP
25 #define NDN_METADATA_OBJECT_HPP
26 
27 #include "ndn-cxx/data.hpp"
28 #include "ndn-cxx/interest.hpp"
30 
31 namespace ndn {
32 
48 {
49 public:
50  class Error : public tlv::Error
51  {
52  public:
53  using tlv::Error::Error;
54  };
55 
60 
65  explicit
66  MetadataObject(const Data& data);
67 
82  makeData(Name discoveryInterestName,
83  KeyChain& keyChain,
85  optional<uint64_t> version = nullopt,
86  time::milliseconds freshnessPeriod = 10_ms) const;
87 
91  const Name&
93  {
94  return m_versionedName;
95  }
96 
105  setVersionedName(const Name& name);
106 
107 public: // static methods
111  static bool
112  isValidName(const Name& name);
113 
121 
122 private:
123  Name m_versionedName;
124 };
125 
126 } // namespace ndn
127 
128 #endif // NDN_METADATA_OBJECT_HPP
Definition: data.cpp:26
The interface of signing key management.
Definition: key-chain.hpp:45
static bool isValidName(const Name &name)
Check whether name can be a valid metadata name.
MetadataObject()
Create an empty metadata object.
Represents an Interest packet.
Definition: interest.hpp:50
Signing parameters passed to KeyChain.
MetadataObject & setVersionedName(const Name &name)
Set the versioned name.
Data makeData(Name discoveryInterestName, KeyChain &keyChain, const ndn::security::SigningInfo &si=security::SigningInfo(), optional< uint64_t > version=nullopt, time::milliseconds freshnessPeriod=10_ms) const
Create a Data packet representing this metadata object.
#define NDN_CXX_NODISCARD
Definition: backports.hpp:68
Represents an absolute name.
Definition: name.hpp:44
static Interest makeDiscoveryInterest(Name name)
Generate a discovery interest packet based on name.
const Name & getVersionedName() const
Return the versioned name (i.e., the name inside the content)
Represents a Data packet.
Definition: data.hpp:39
Error(const char *expectedType, uint32_t actualType)
Definition: tlv.cpp:27
represents an error in TLV encoding or decoding
Definition: tlv.hpp:51
Class for RDR-style metadata encoding/decoding.