blob: a50221c30b3b5737af1218d46d3f61d403f27ea4 [file] [log] [blame]
Eric Newberry38982622015-08-06 21:39:55 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (c) 2013-2015 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 "../common.hpp"
28#include "../tag-host.hpp"
29#include "../interest.hpp"
Eric Newberry83872fd2015-08-06 17:01:24 -070030#include "../management/nfd-local-control-header.hpp"
Eric Newberry38982622015-08-06 21:39:55 -070031
32#include "nack-header.hpp"
33
34namespace ndn {
35namespace lp {
36
37/**
38 * \brief represents a Network NACK
Davide Pesavento18cf81b2015-09-12 23:36:43 +020039 * \details This type binds a NackHeader and an Interest, and is intended for use in network layer.
Eric Newberry38982622015-08-06 21:39:55 -070040 */
41class Nack : public TagHost
42{
43public:
44 Nack() = default;
45
46 explicit
47 Nack(const Interest& interest);
48
49 explicit
50 Nack(Interest&& interest);
51
52public: // getter/setter
53 const Interest&
54 getInterest() const
55 {
56 return m_interest;
57 }
58
59 Interest&
60 getInterest()
61 {
62 return m_interest;
63 }
64
65 const NackHeader&
66 getHeader() const
67 {
68 return m_header;
69 }
70
71 NackHeader&
72 getHeader()
73 {
74 return m_header;
75 }
76
77 Nack&
78 setHeader(const NackHeader& header)
79 {
80 m_header = header;
81 return *this;
82 }
83
84 Nack&
85 setHeader(NackHeader&& header)
86 {
87 m_header = header;
88 return *this;
89 }
90
Eric Newberry83872fd2015-08-06 17:01:24 -070091 nfd::LocalControlHeader&
92 getLocalControlHeader()
93 {
94 return m_interest.getLocalControlHeader();
95 }
96
97 const nfd::LocalControlHeader&
98 getLocalControlHeader() const
99 {
100 return m_interest.getLocalControlHeader();
101 }
102
Eric Newberry38982622015-08-06 21:39:55 -0700103public: // NackHeader proxy
104 NackReason
105 getReason() const
106 {
107 return m_header.getReason();
108 }
109
110 Nack&
111 setReason(NackReason reason)
112 {
113 m_header.setReason(reason);
114 return *this;
115 }
116
117private:
118 Interest m_interest;
119 NackHeader m_header;
120};
121
122} // namespace lp
123} // namespace ndn
124
Davide Pesavento18cf81b2015-09-12 23:36:43 +0200125#endif // NDN_CXX_LP_NACK_HPP