NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
status-dataset-context.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2013-2018 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 
22 #ifndef NDN_MGMT_STATUS_DATASET_CONTEXT_HPP
23 #define NDN_MGMT_STATUS_DATASET_CONTEXT_HPP
24 
25 #include "ndn-cxx/data.hpp"
26 #include "ndn-cxx/interest.hpp"
29 #include "ndn-cxx/util/time.hpp"
30 
31 namespace ndn {
32 namespace mgmt {
33 
36 class StatusDatasetContext : noncopyable
37 {
38 public:
41  const Name&
42  getPrefix() const;
43 
55  setPrefix(const Name& prefix);
56 
59  const time::milliseconds&
60  getExpiry() const;
61 
69  setExpiry(const time::milliseconds& expiry);
70 
74  void
75  append(const Block& block);
76 
80  void
81  end();
82 
91  void
92  reject(const ControlResponse& resp = ControlResponse().setCode(400));
93 
95  typedef std::function<void(const Name& dataName, const Block& content, time::milliseconds imsFresh,
96  bool isFinalBlock)> DataSender;
97  typedef std::function<void(const ControlResponse& resp)> NackSender;
98 
99  StatusDatasetContext(const Interest& interest,
100  const DataSender& dataSender,
101  const NackSender& nackSender);
102 
103 private:
104  friend class Dispatcher;
105 
106  const Interest& m_interest;
107  DataSender m_dataSender;
108  NackSender m_nackSender;
109  Name m_prefix;
110  time::milliseconds m_expiry;
111 
113  shared_ptr<EncodingBuffer> m_buffer;
114  uint64_t m_segmentNo;
115 
116  enum class State {
117  INITIAL,
118  RESPONDED,
119  FINALIZED
120  };
121  State m_state;
122 };
123 
124 } // namespace mgmt
125 } // namespace ndn
126 
127 #endif // NDN_MGMT_STATUS_DATASET_CONTEXT_HPP
std::function< void(const ControlResponse &resp)> NackSender
void reject(const ControlResponse &resp=ControlResponse().setCode(400))
declare the non-existence of a response
Copyright (c) 2011-2015 Regents of the University of California.
StatusDatasetContext & setExpiry(const time::milliseconds &expiry)
set expiration duration
represents a dispatcher on server side of NFD Management protocol
Definition: dispatcher.hpp:130
Represents a TLV element of NDN packet format.
Definition: block.hpp:42
Represents an Interest packet.
Definition: interest.hpp:44
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE const Block time::milliseconds imsFresh
mgmt::ControlResponse ControlResponse
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE const Block & content
void end()
end the response successfully after appending zero or more blocks
const time::milliseconds & getExpiry() const
#define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE
Definition: common.hpp:43
Represents an absolute name.
Definition: name.hpp:43
StatusDatasetContext(const Interest &interest, const DataSender &dataSender, const NackSender &nackSender)
StatusDatasetContext & setPrefix(const Name &prefix)
change prefix of Data packets
void append(const Block &block)
append a Block to the response
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE const Block time::milliseconds bool isFinalBlock DataSender
ControlCommand response.
provides a context for generating response to a StatusDataset request