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-2022 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 {
32 namespace lp {
33 
39 class Nack : public PacketBase
40 {
41 public:
42  Nack();
43 
44  explicit
45  Nack(const Interest& interest);
46 
47  explicit
48  Nack(Interest&& interest);
49 
50 public: // getter/setter
51  const Interest&
52  getInterest() const
53  {
54  return m_interest;
55  }
56 
57  Interest&
59  {
60  return m_interest;
61  }
62 
63  const NackHeader&
64  getHeader() const
65  {
66  return m_header;
67  }
68 
69  NackHeader&
71  {
72  return m_header;
73  }
74 
75  Nack&
76  setHeader(const NackHeader& header)
77  {
78  m_header = header;
79  return *this;
80  }
81 
82  Nack&
84  {
85  m_header = header;
86  return *this;
87  }
88 
89 public: // NackHeader proxy
91  getReason() const
92  {
93  return m_header.getReason();
94  }
95 
96  Nack&
98  {
99  m_header.setReason(reason);
100  return *this;
101  }
102 
103 private:
104  Interest m_interest;
105  NackHeader m_header;
106 };
107 
108 } // namespace lp
109 } // namespace ndn
110 
111 #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:59
NackHeader & setReason(NackReason reason)
Set reason code.
NackReason getReason() const
Get reason code.
Represents a Network Nack.
Definition: nack.hpp:40
const Interest & getInterest() const
Definition: nack.hpp:52
Nack & setHeader(const NackHeader &header)
Definition: nack.hpp:76
Nack & setReason(NackReason reason)
Definition: nack.hpp:97
Nack & setHeader(NackHeader &&header)
Definition: nack.hpp:83
NackReason getReason() const
Definition: nack.hpp:91
Interest & getInterest()
Definition: nack.hpp:58
NackHeader & getHeader()
Definition: nack.hpp:70
const NackHeader & getHeader() const
Definition: nack.hpp:64
NackReason
Indicates the reason type of a Network Nack.
Definition: nack-header.hpp:37
Definition: data.cpp:25