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; -*- */
26 #ifndef NDN_MGMT_STATUS_DATASET_CONTEXT_HPP
27 #define NDN_MGMT_STATUS_DATASET_CONTEXT_HPP
28 
29 #include "../interest.hpp"
30 #include "../data.hpp"
31 #include "../util/time.hpp"
32 #include "../encoding/encoding-buffer.hpp"
33 #include "control-response.hpp"
34 
35 namespace ndn {
36 namespace mgmt {
37 
39 {
40 public:
43  const Name&
44  getPrefix() const;
45 
57  setPrefix(const Name& prefix);
58 
61  const time::milliseconds&
62  getExpiry() const;
63 
71  setExpiry(const time::milliseconds& expiry);
72 
76  void
77  append(const Block& block);
78 
82  void
83  end();
84 
93  void
94  reject(const ControlResponse& resp = ControlResponse().setCode(400));
95 
97  typedef std::function<void(const Name& dataName, const Block& content,
98  const MetaInfo& metaInfo)> DataSender;
99 
100  StatusDatasetContext(const Interest& interest, const DataSender& dataSender);
101 
102 private:
103  friend class Dispatcher;
104 
105  const Interest& m_interest;
106  DataSender m_dataSender;
107  Name m_prefix;
108  time::milliseconds m_expiry;
109 
111  shared_ptr<EncodingBuffer> m_buffer;
112  uint64_t m_segmentNo;
113 
114  enum class State {
115  INITIAL,
116  RESPONDED,
117  FINALIZED
118  };
119  State m_state;
120 };
121 
122 } // namespace mgmt
123 } // namespace ndn
124 
125 #endif // NDN_MGMT_STATUS_DATASET_CONTEXT_HPP
StatusDatasetContext(const Interest &interest, const DataSender &dataSender)
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:132
Class representing a wire element of NDN-TLV packet format.
Definition: block.hpp:43
represents an Interest packet
Definition: interest.hpp:45
ndn::mgmt::ControlResponse ControlResponse
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE const Block const MetaInfo &metaInfo DataSender
NDN_CXX_PUBLIC_WITH_TESTS_ELSE_PRIVATE const Block & content
void end()
end the response successfully after appending zero or more blocks
An MetaInfo holds the meta info which is signed inside the data packet.
Definition: meta-info.hpp:56
Name abstraction to represent an absolute name.
Definition: name.hpp:46
StatusDatasetContext & setPrefix(const Name &prefix)
change prefix of Data packets
void append(const Block &block)
append a Block to the response
ControlCommand response.
const time::milliseconds & getExpiry() const