nack.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  * @author Eric Newberry <enewberry@email.arizona.edu>
22  */
23 
24 #ifndef NDN_CXX_LP_NACK_HPP
25 #define NDN_CXX_LP_NACK_HPP
26 
27 #include "ndn-cxx/interest.hpp"
30 
31 namespace ndn::lp {
32 
38 class Nack : public PacketBase
39 {
40 public:
41  Nack();
42 
43  explicit
44  Nack(const Interest& interest);
45 
46  explicit
47  Nack(Interest&& interest);
48 
49 public: // getter/setter
50  const Interest&
51  getInterest() const
52  {
53  return m_interest;
54  }
55 
56  Interest&
58  {
59  return m_interest;
60  }
61 
62  const NackHeader&
63  getHeader() const
64  {
65  return m_header;
66  }
67 
68  NackHeader&
70  {
71  return m_header;
72  }
73 
74  Nack&
75  setHeader(const NackHeader& header)
76  {
77  m_header = header;
78  return *this;
79  }
80 
81  Nack&
83  {
84  m_header = header;
85  return *this;
86  }
87 
88 public: // NackHeader proxy
90  getReason() const
91  {
92  return m_header.getReason();
93  }
94 
95  Nack&
97  {
98  m_header.setReason(reason);
99  return *this;
100  }
101 
102 private:
103  Interest m_interest;
104  NackHeader m_header;
105 };
106 
107 } // namespace ndn::lp
108 
109 #endif // NDN_CXX_LP_NACK_HPP
Represents an Interest packet.
Definition: interest.hpp:50
Base class to allow simple management of packet tags.
Definition: packet-base.hpp:32
Represents a Network Nack header.
Definition: nack-header.hpp:58
NackHeader & setReason(NackReason reason)
Set reason code.
NackReason getReason() const
Get reason code.
Represents a Network Nack.
Definition: nack.hpp:39
const Interest & getInterest() const
Definition: nack.hpp:51
Nack & setHeader(const NackHeader &header)
Definition: nack.hpp:75
Nack & setReason(NackReason reason)
Definition: nack.hpp:96
Nack & setHeader(NackHeader &&header)
Definition: nack.hpp:82
NackReason getReason() const
Definition: nack.hpp:90
Interest & getInterest()
Definition: nack.hpp:57
NackHeader & getHeader()
Definition: nack.hpp:69
const NackHeader & getHeader() const
Definition: nack.hpp:63
Contains classes and functions related to NDNLPv2.
NackReason
Indicates the reason type of a Network Nack.
Definition: nack-header.hpp:36