NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
nack-header.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
24 #ifndef NDN_CXX_LP_NACK_HEADER_HPP
25 #define NDN_CXX_LP_NACK_HEADER_HPP
26 
27 #include "../common.hpp"
28 #include "../encoding/encoding-buffer.hpp"
29 #include "../encoding/block-helpers.hpp"
30 
31 #include "tlv.hpp"
32 
33 namespace ndn {
34 namespace lp {
35 
39 enum class NackReason {
40  NONE = 0,
41  CONGESTION = 50,
42  DUPLICATE = 100,
43  NO_ROUTE = 150
44 };
45 
46 std::ostream&
47 operator<<(std::ostream& os, NackReason reason);
48 
53 {
54 public:
55  NackHeader();
56 
57  explicit
58  NackHeader(const Block& block);
59 
60  template<encoding::Tag TAG>
61  size_t
62  wireEncode(EncodingImpl<TAG>& encoder) const;
63 
64  const Block&
65  wireEncode() const;
66 
67  void
68  wireDecode(const Block& wire);
69 
70 public: // reason
76  getReason() const;
77 
82  NackHeader&
83  setReason(NackReason reason);
84 
85 private:
86  NackReason m_reason;
87  mutable Block m_wire;
88 };
89 
90 } // namespace lp
91 } // namespace ndn
92 
93 #endif // NDN_CXX_LP_NACK_HEADER_HPP
Copyright (c) 2011-2015 Regents of the University of California.
Class representing a wire element of NDN-TLV packet format.
Definition: block.hpp:43
NackReason
indicates the reason type of a network NACK
Definition: nack-header.hpp:39
std::ostream & operator<<(std::ostream &os, CachePolicyType policy)
represents a Network NACK header
Definition: nack-header.hpp:52