NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
cache-policy.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
24 #ifndef NDN_CXX_LP_CACHE_POLICY_HPP
25 #define NDN_CXX_LP_CACHE_POLICY_HPP
26 
27 #include "../common.hpp"
28 #include "../tag.hpp"
29 #include "../encoding/encoding-buffer.hpp"
30 #include "../encoding/block-helpers.hpp"
31 
32 #include "tlv.hpp"
33 
34 namespace ndn {
35 namespace lp {
36 
40 enum class CachePolicyType {
41  NONE = 0,
42  NO_CACHE = 1
43 };
44 
45 std::ostream&
46 operator<<(std::ostream& os, CachePolicyType policy);
47 
52 {
53 public:
54  class Error : public ndn::tlv::Error
55  {
56  public:
57  explicit
58  Error(const std::string& what)
59  : ndn::tlv::Error(what)
60  {
61  }
62  };
63 
64  CachePolicy();
65 
66  explicit
67  CachePolicy(const Block& block);
68 
74  template<encoding::Tag TAG>
75  size_t
76  wireEncode(EncodingImpl<TAG>& encoder) const;
77 
81  const Block&
82  wireEncode() const;
83 
87  void
88  wireDecode(const Block& wire);
89 
90 public: // policy type
96  getPolicy() const;
97 
102  CachePolicy&
103  setPolicy(CachePolicyType policy);
104 
105 private:
106  CachePolicyType m_policy;
107  mutable Block m_wire;
108 };
109 
110 } // namespace lp
111 } // namespace ndn
112 
113 #endif // NDN_CXX_LP_CACHE_POLICY_HPP
represents a CachePolicy header field
Copyright (c) 2011-2015 Regents of the University of California.
Error(const std::string &what)
Class representing a wire element of NDN-TLV packet format.
Definition: block.hpp:43
CachePolicyType
indicates the cache policy applied to a Data packet
std::ostream & operator<<(std::ostream &os, CachePolicyType policy)
represents an error in TLV encoding or decoding
Definition: tlv.hpp:50