blob: 2a60e64e3a95fab995b3a47209f85d0c76fc2086 [file] [log] [blame]
Eric Newberry38982622015-08-06 21:39:55 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
Eric Newberryc3a46792017-09-24 14:54:24 -07002/*
3 * Copyright (c) 2013-2017 Regents of the University of California.
Eric Newberry38982622015-08-06 21:39:55 -07004 *
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 "../common.hpp"
Eric Newberry38982622015-08-06 21:39:55 -070028#include "../interest.hpp"
Eric Newberryc3a46792017-09-24 14:54:24 -070029#include "../packet-base.hpp"
Eric Newberry38982622015-08-06 21:39:55 -070030
31#include "nack-header.hpp"
32
33namespace ndn {
34namespace lp {
35
Junxiao Shi4b469982015-12-03 18:20:19 +000036/** \brief represents a Network Nack
37 *
38 * This type binds a NackHeader and an Interest, and is intended for use in network layer.
Eric Newberry38982622015-08-06 21:39:55 -070039 */
Eric Newberryc3a46792017-09-24 14:54:24 -070040class Nack : public PacketBase
Eric Newberry38982622015-08-06 21:39:55 -070041{
42public:
Eric Newberryc3a46792017-09-24 14:54:24 -070043 Nack();
Eric Newberry38982622015-08-06 21:39:55 -070044
45 explicit
46 Nack(const Interest& interest);
47
48 explicit
49 Nack(Interest&& interest);
50
51public: // getter/setter
52 const Interest&
53 getInterest() const
54 {
55 return m_interest;
56 }
57
58 Interest&
59 getInterest()
60 {
61 return m_interest;
62 }
63
64 const NackHeader&
65 getHeader() const
66 {
67 return m_header;
68 }
69
70 NackHeader&
71 getHeader()
72 {
73 return m_header;
74 }
75
76 Nack&
77 setHeader(const NackHeader& header)
78 {
79 m_header = header;
80 return *this;
81 }
82
83 Nack&
84 setHeader(NackHeader&& header)
85 {
86 m_header = header;
87 return *this;
88 }
89
90public: // NackHeader proxy
91 NackReason
92 getReason() const
93 {
94 return m_header.getReason();
95 }
96
97 Nack&
98 setReason(NackReason reason)
99 {
100 m_header.setReason(reason);
101 return *this;
102 }
103
104private:
105 Interest m_interest;
106 NackHeader m_header;
107};
108
109} // namespace lp
110} // namespace ndn
111
Davide Pesavento18cf81b2015-09-12 23:36:43 +0200112#endif // NDN_CXX_LP_NACK_HPP