NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: 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 "../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 CachePolicyType {
40  NONE = 0,
41  NO_CACHE = 1
42 };
43 
44 std::ostream&
45 operator<<(std::ostream& os, CachePolicyType policy);
46 
51 {
52 public:
53  class Error : public ndn::tlv::Error
54  {
55  public:
56  explicit
57  Error(const std::string& what)
58  : ndn::tlv::Error(what)
59  {
60  }
61  };
62 
63  CachePolicy();
64 
65  explicit
66  CachePolicy(const Block& block);
67 
73  template<encoding::Tag TAG>
74  size_t
75  wireEncode(EncodingImpl<TAG>& encoder) const;
76 
80  const Block&
81  wireEncode() const;
82 
86  void
87  wireDecode(const Block& wire);
88 
89 public: // policy type
95  getPolicy() const;
96 
101  CachePolicy&
102  setPolicy(CachePolicyType policy);
103 
104 private:
105  CachePolicyType m_policy;
106  mutable Block m_wire;
107 };
108 
109 } // namespace lp
110 } // namespace ndn
111 
112 #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