blob: f91b3f1a8a72431dc0936922a7ff28c9a3f42117 [file] [log] [blame]
Junxiao Shi4b469982015-12-03 18:20:19 +00001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (c) 2013-2015 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
22#ifndef NDN_CXX_LP_TAGS_HPP
23#define NDN_CXX_LP_TAGS_HPP
24
25#include "cache-policy.hpp"
26#include "../tag-host.hpp"
27
28namespace ndn {
29namespace lp {
30
31/** \class IncomingFaceIdTag
32 * \brief a packet tag for IncomingFaceId field
33 *
34 * This tag can be attached to Interest, Data, Nack.
35 */
36typedef SimpleTag<uint64_t, 10> IncomingFaceIdTag;
37
38/** \class NextHopFaceIdTag
39 * \brief a packet tag for NextHopFaceId field
40 *
41 * This tag can be attached to Interest.
42 */
43typedef SimpleTag<uint64_t, 11> NextHopFaceIdTag;
44
45/** \class CachePolicyTag
46 * \brief a packet tag for CachePolicy field
47 *
48 * This tag can be attached to Data.
49 */
50typedef SimpleTag<CachePolicy, 12> CachePolicyTag;
51
52
53#define NDN_LP_KEEP_LOCAL_CONTROL_HEADER
54
55#ifdef NDN_LP_KEEP_LOCAL_CONTROL_HEADER
56/** \brief expose NDNLPv2 tags as LocalControlHeader API
57 *
58 * This class has the same public API as ndn::nfd::LocalControlHeader,
59 * but internally accesses IncomingFaceIdTag, NextHopFaceIdTag, CachePolicyTag
60 * on the host packet.
61 *
62 * \deprecated use getTag and setTag with IncomingFaceIdTag, NextHopFaceIdTag, CachePolicyTag
63 */
64class LocalControlHeaderFacade
65{
66public:
67 DEPRECATED(
68 explicit
69 LocalControlHeaderFacade(TagHost& pkt));
70
71 bool
72 hasIncomingFaceId() const;
73
74 uint64_t
75 getIncomingFaceId() const;
76
77 void
78 setIncomingFaceId(uint64_t incomingFaceId);
79
80 bool
81 hasNextHopFaceId() const;
82
83 uint64_t
84 getNextHopFaceId() const;
85
86 void
87 setNextHopFaceId(uint64_t nextHopFaceId);
88
89 bool
90 hasCachingPolicy() const;
91
92 enum CachingPolicy : uint8_t {
93 INVALID_POLICY = 0,
94 NO_CACHE = 1
95 };
96
97 CachingPolicy
98 getCachingPolicy() const;
99
100 void
101 setCachingPolicy(CachingPolicy cachingPolicy);
102
103private:
104 TagHost& m_pkt;
105};
106#endif // NDN_LP_KEEP_LOCAL_CONTROL_HEADER
107
108} // namespace lp
109} // namespace ndn
110
111#endif // NDN_CXX_LP_TAGS_HPP