NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: 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; -*- */
2 /*
3  * Copyright (c) 2013-2018 Regents of the University of California.
4  *
5  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
6  *
7  * ndn-cxx library is free software: you can redistribute it and/or modify it under the
8  * terms of the GNU Lesser General Public License as published by the Free Software
9  * Foundation, either version 3 of the License, or (at your option) any later version.
10  *
11  * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
12  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
13  * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
14  *
15  * You should have received copies of the GNU General Public License and GNU Lesser
16  * General Public License along with ndn-cxx, e.g., in COPYING.md file. If not, see
17  * <http://www.gnu.org/licenses/>.
18  *
19  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
20  *
21  * @author Eric Newberry <enewberry@email.arizona.edu>
22  */
23 
24 #ifndef NDN_CXX_LP_CACHE_POLICY_HPP
25 #define NDN_CXX_LP_CACHE_POLICY_HPP
26 
28 #include "ndn-cxx/lp/tlv.hpp"
29 
30 namespace ndn {
31 namespace lp {
32 
36 enum class CachePolicyType {
37  NONE = 0,
38  NO_CACHE = 1
39 };
40 
41 std::ostream&
42 operator<<(std::ostream& os, CachePolicyType policy);
43 
48 {
49 public:
50  class Error : public ndn::tlv::Error
51  {
52  public:
54  };
55 
56  CachePolicy();
57 
58  explicit
59  CachePolicy(const Block& block);
60 
66  template<encoding::Tag TAG>
67  size_t
68  wireEncode(EncodingImpl<TAG>& encoder) const;
69 
73  const Block&
74  wireEncode() const;
75 
79  void
80  wireDecode(const Block& wire);
81 
82 public: // policy type
88  getPolicy() const;
89 
95  setPolicy(CachePolicyType policy);
96 
97 private:
98  CachePolicyType m_policy;
99  mutable Block m_wire;
100 };
101 
103 
104 } // namespace lp
105 } // namespace ndn
106 
107 #endif // NDN_CXX_LP_CACHE_POLICY_HPP
ndn::lp::CachePolicyType
CachePolicyType
indicates the cache policy applied to a Data packet
Definition: cache-policy.hpp:36
ndn::lp::CachePolicyType::NO_CACHE
@ NO_CACHE
ndn::lp::CachePolicy::getPolicy
CachePolicyType getPolicy() const
Definition: cache-policy.cpp:117
ndn::lp::CachePolicy::CachePolicy
CachePolicy()
Definition: cache-policy.cpp:41
ndn::lp::NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS
NDN_CXX_DECLARE_WIRE_ENCODE_INSTANTIATIONS(CachePolicy)
ndn::lp::CachePolicy::Error
Definition: cache-policy.hpp:51
ndn::lp::CachePolicy::setPolicy
CachePolicy & setPolicy(CachePolicyType policy)
set policy type code
Definition: cache-policy.cpp:128
ndn::lp::CachePolicy
represents a CachePolicy header field
Definition: cache-policy.hpp:48
ndn::lp::operator<<
std::ostream & operator<<(std::ostream &os, CachePolicyType policy)
Definition: cache-policy.cpp:31
tlv.hpp
ndn::lp::CachePolicyType::NONE
@ NONE
ndn::lp::CachePolicy::wireDecode
void wireDecode(const Block &wire)
get CachePolicyType from wire format
Definition: cache-policy.cpp:91
ndn::lp::CachePolicy::wireEncode
const Block & wireEncode() const
encode CachePolicy into wire format
Definition: cache-policy.cpp:69
ndn::encoding::EncodingImpl
Definition: encoding-buffer-fwd.hpp:36
ndn::Block
Represents a TLV element of NDN packet format.
Definition: block.hpp:43
ndn::lp
Definition: cache-policy.cpp:28
ndn::tlv::Error
represents an error in TLV encoding or decoding
Definition: tlv.hpp:53
ndn::tlv::Error::Error
Error(const char *expectedType, uint32_t actualType)
Definition: tlv.cpp:27
encoding-buffer.hpp
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition: ndn-strategy-choice-helper.hpp:34