NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: 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; -*- */
22 #ifndef NDN_MGMT_STATUS_DATASET_CONTEXT_HPP
23 #define NDN_MGMT_STATUS_DATASET_CONTEXT_HPP
24 
25 #include "../interest.hpp"
26 #include "../data.hpp"
27 #include "../util/time.hpp"
28 #include "../encoding/encoding-buffer.hpp"
29 #include "control-response.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
#define NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE
Definition: common.hpp:43
represents a dispatcher on server side of NFD Management protocol
Definition: dispatcher.hpp:129
Class representing a wire element of NDN-TLV packet format.
Definition: block.hpp:43
represents an Interest packet
Definition: interest.hpp:45
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE const Block time::milliseconds imsFresh
ndn::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
Name abstraction to represent an absolute name.
Definition: name.hpp:46
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