blob: 2f56dfc4d6b8706005900b6efbeaf575b5691c55 [file] [log] [blame]
Alexander Afanasyevc169a812014-05-20 20:37:29 -04001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
Jeff Thompson5cae5e52013-07-10 19:41:20 -07002/**
Alexander Afanasyev74633892015-02-08 18:08:46 -08003 * Copyright (c) 2013-2015 Regents of the University of California.
Alexander Afanasyevdfa52c42014-04-24 21:10:11 -07004 *
5 * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
Alexander Afanasyevdfa52c42014-04-24 21:10:11 -07006 *
Alexander Afanasyevc169a812014-05-20 20:37:29 -04007 * 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.
Jeff Thompson5cae5e52013-07-10 19:41:20 -070020 */
21
Jeff Thompson56ec9e22013-08-02 11:34:07 -070022#ifndef NDN_DATA_HPP
Jeff Thompsona0d18c92013-08-06 13:55:32 -070023#define NDN_DATA_HPP
Jeff Thompson5cae5e52013-07-10 19:41:20 -070024
Jeff Thompson46bd45f2013-08-08 16:46:41 -070025#include "common.hpp"
Jeff Thompson53412192013-08-06 13:35:50 -070026#include "name.hpp"
Alexander Afanasyevfadc97d2014-01-03 13:22:10 -080027#include "encoding/block.hpp"
Jeff Thompson25b4e612013-10-10 16:03:24 -070028
Alexander Afanasyev2ba8f662014-01-05 22:53:18 -080029#include "signature.hpp"
30#include "meta-info.hpp"
31#include "key-locator.hpp"
Alexander Afanasyev6d48bc12014-02-18 00:10:51 -080032#include "management/nfd-local-control-header.hpp"
Alexander Afanasyeva3887ae2014-12-29 16:11:57 -080033#include "tag-host.hpp"
Jeff Thompson5cae5e52013-07-10 19:41:20 -070034
35namespace ndn {
Alexander Afanasyevaa0e7da2014-03-17 14:37:33 -070036
Junxiao Shic2b8d242014-11-04 08:35:29 -070037/** @brief represents a Data packet
38 */
Alexander Afanasyeva3887ae2014-12-29 16:11:57 -080039class Data : public TagHost, public enable_shared_from_this<Data>
Alexander Afanasyev0222fba2014-02-09 23:16:02 -080040{
Jeff Thompson5cae5e52013-07-10 19:41:20 -070041public:
Junxiao Shic2b8d242014-11-04 08:35:29 -070042 class Error : public tlv::Error
Alexander Afanasyevff2d08f2014-04-07 18:28:25 -070043 {
44 public:
45 explicit
46 Error(const std::string& what)
Junxiao Shic2b8d242014-11-04 08:35:29 -070047 : tlv::Error(what)
Alexander Afanasyevff2d08f2014-04-07 18:28:25 -070048 {
49 }
50 };
Alexander Afanasyevaa0e7da2014-03-17 14:37:33 -070051
Jeff Thompson20af0732013-09-12 17:01:45 -070052 /**
Alexander Afanasyev2ba8f662014-01-05 22:53:18 -080053 * @brief Create an empty Data object
Alexander Afanasyev770827c2014-05-13 17:42:55 -070054 *
55 * Note that in certain contexts that use Data::shared_from_this(), Data must be
56 * created using `make_shared`:
57 *
58 * shared_ptr<Data> data = make_shared<Data>();
59 *
60 * Otherwise, Data::shared_from_this() will throw an exception.
Jeff Thompson20af0732013-09-12 17:01:45 -070061 */
Alexander Afanasyev2ba8f662014-01-05 22:53:18 -080062 Data();
Alexander Afanasyevaa0e7da2014-03-17 14:37:33 -070063
Jeff Thompson20af0732013-09-12 17:01:45 -070064 /**
Alexander Afanasyev2ba8f662014-01-05 22:53:18 -080065 * @brief Create a new Data object with the given name
Alexander Afanasyev770827c2014-05-13 17:42:55 -070066 *
67 * @param name A reference to the name
68 *
69 * Note that in certain contexts that use Data::shared_from_this(), Data must be
70 * created using `make_shared`:
71 *
72 * shared_ptr<Data> data = make_shared<Data>(name);
73 *
74 * Otherwise, Data::shared_from_this() will throw an exception.
Jeff Thompson20af0732013-09-12 17:01:45 -070075 */
Alexander Afanasyev2ba8f662014-01-05 22:53:18 -080076 Data(const Name& name);
Alexander Afanasyev6d48bc12014-02-18 00:10:51 -080077
78 /**
79 * @brief Create a new Data object from wire encoding
Alexander Afanasyev770827c2014-05-13 17:42:55 -070080 *
81 * Note that in certain contexts that use Data::shared_from_this(), Data must be
82 * created using `make_shared`:
83 *
84 * shared_ptr<Data> data = make_shared<Data>(wire);
85 *
86 * Otherwise, Data::shared_from_this() will throw an exception.
Alexander Afanasyev6d48bc12014-02-18 00:10:51 -080087 */
88 explicit
Alexander Afanasyev197e5652014-06-13 16:56:31 -070089 Data(const Block& wire);
Alexander Afanasyevaa0e7da2014-03-17 14:37:33 -070090
Jeff Thompson25bfdca2013-10-16 17:05:41 -070091 /**
Alexander Afanasyev809805d2014-02-17 17:20:33 -080092 * @brief Fast encoding or block size estimation
Alexander Afanasyev197e5652014-06-13 16:56:31 -070093 *
94 * @param block EncodingEstimator or EncodingBuffer instance
95 * @param wantUnsignedPortionOnly Request only unsigned portion to be encoded in block.
96 * If true, only Name, MetaInfo, Content, and SignatureInfo
97 * blocks will be encoded into the block. Note that there
98 * will be no outer TLV header of the Data packet.
Jeff Thompsonb7aefa002013-09-16 18:22:00 -070099 */
Alexander Afanasyev74633892015-02-08 18:08:46 -0800100 template<encoding::Tag TAG>
Alexander Afanasyevff2d08f2014-04-07 18:28:25 -0700101 size_t
Alexander Afanasyev74633892015-02-08 18:08:46 -0800102 wireEncode(EncodingImpl<TAG>& block, bool wantUnsignedPortionOnly = false) const;
Alexander Afanasyevaa0e7da2014-03-17 14:37:33 -0700103
Alexander Afanasyev2ba8f662014-01-05 22:53:18 -0800104 /**
Alexander Afanasyev809805d2014-02-17 17:20:33 -0800105 * @brief Encode to a wire format
Alexander Afanasyev2ba8f662014-01-05 22:53:18 -0800106 */
Alexander Afanasyevff2d08f2014-04-07 18:28:25 -0700107 const Block&
Alexander Afanasyev809805d2014-02-17 17:20:33 -0800108 wireEncode() const;
109
110 /**
Alexander Afanasyev197e5652014-06-13 16:56:31 -0700111 * @brief Finalize Data packet encoding with the specified SignatureValue
112 *
113 * @param encoder EncodingBuffer instance, containing Name, MetaInfo, Content, and
114 * SignatureInfo (without outer TLV header of the Data packet).
115 * @param signatureValue SignatureValue block to be added to Data packet to finalize
116 * the wire encoding
117 *
118 * This method is intended to be used in concert with Data::wireEncode(EncodingBuffer&, true)
119 * method to optimize Data packet wire format creation:
120 *
121 * Data data;
122 * ...
123 * EncodingBuffer encoder;
124 * data.wireEncode(encoder, true);
125 * ...
126 * Block signatureValue = <sign_over_unsigned_portion>(encoder.buf(), encoder.size());
127 * data.wireEncode(encoder, signatureValue)
128 */
129 const Block&
130 wireEncode(EncodingBuffer& encoder, const Block& signatureValue) const;
131
132 /**
Alexander Afanasyev809805d2014-02-17 17:20:33 -0800133 * @brief Decode from the wire format
134 */
Alexander Afanasyevff2d08f2014-04-07 18:28:25 -0700135 void
136 wireDecode(const Block& wire);
Alexander Afanasyevfadc97d2014-01-03 13:22:10 -0800137
Alexander Afanasyev6d48bc12014-02-18 00:10:51 -0800138 /**
Alexander Afanasyev770827c2014-05-13 17:42:55 -0700139 * @brief Check if Data is already has wire encoding
Alexander Afanasyev6d48bc12014-02-18 00:10:51 -0800140 */
Alexander Afanasyevff2d08f2014-04-07 18:28:25 -0700141 bool
Alexander Afanasyev6d48bc12014-02-18 00:10:51 -0800142 hasWire() const;
Alexander Afanasyevaa0e7da2014-03-17 14:37:33 -0700143
144 ////////////////////////////////////////////////////////////////////
145
Alexander Afanasyev770827c2014-05-13 17:42:55 -0700146 /**
147 * @brief Get name of the Data packet
148 */
Alexander Afanasyevff2d08f2014-04-07 18:28:25 -0700149 const Name&
Alexander Afanasyev2ba8f662014-01-05 22:53:18 -0800150 getName() const;
Alexander Afanasyevaa0e7da2014-03-17 14:37:33 -0700151
Jeff Thompson5cae5e52013-07-10 19:41:20 -0700152 /**
Alexander Afanasyev770827c2014-05-13 17:42:55 -0700153 * @brief Set name to a copy of the given Name
Alexander Afanasyev2ba8f662014-01-05 22:53:18 -0800154 *
Alexander Afanasyev770827c2014-05-13 17:42:55 -0700155 * @return This Data so that you can chain calls to update values
Jeff Thompson0cd8c4a2013-09-13 17:46:40 -0700156 */
Alexander Afanasyev770827c2014-05-13 17:42:55 -0700157 Data&
Alexander Afanasyev2ba8f662014-01-05 22:53:18 -0800158 setName(const Name& name);
159
Alexander Afanasyev809805d2014-02-17 17:20:33 -0800160 //
Alexander Afanasyevaa0e7da2014-03-17 14:37:33 -0700161
Alexander Afanasyev770827c2014-05-13 17:42:55 -0700162 /**
Alexander Afanasyev3b703102014-06-13 17:01:14 -0700163 * @brief Get full name of Data packet, including the implicit digest
164 *
165 * @throws Error if Data packet doesn't have a full name yet (wire encoding has not been
166 * yet created)
167 */
168 const Name&
169 getFullName() const;
170
171 /**
Alexander Afanasyev770827c2014-05-13 17:42:55 -0700172 * @brief Get MetaInfo block from Data packet
173 */
Alexander Afanasyevff2d08f2014-04-07 18:28:25 -0700174 const MetaInfo&
Alexander Afanasyev2ba8f662014-01-05 22:53:18 -0800175 getMetaInfo() const;
Alexander Afanasyevaa0e7da2014-03-17 14:37:33 -0700176
Jeff Thompson0cd8c4a2013-09-13 17:46:40 -0700177 /**
Alexander Afanasyev770827c2014-05-13 17:42:55 -0700178 * @brief Set metaInfo to a copy of the given MetaInfo
179 *
Jeff Thompson6d591972013-10-17 11:16:32 -0700180 * @return This Data so that you can chain calls to update values.
Jeff Thompson0cd8c4a2013-09-13 17:46:40 -0700181 */
Alexander Afanasyev770827c2014-05-13 17:42:55 -0700182 Data&
Alexander Afanasyev2ba8f662014-01-05 22:53:18 -0800183 setMetaInfo(const MetaInfo& metaInfo);
Jeff Thompson46bd45f2013-08-08 16:46:41 -0700184
Alexander Afanasyev809805d2014-02-17 17:20:33 -0800185 //
Alexander Afanasyevaa0e7da2014-03-17 14:37:33 -0700186
Alexander Afanasyev809805d2014-02-17 17:20:33 -0800187 ///////////////////////////////////////////////////////////////
188 ///////////////////////////////////////////////////////////////
Alexander Afanasyev2ba8f662014-01-05 22:53:18 -0800189 ///////////////////////////////////////////////////////////////
190 // MetaInfo proxy methods
Alexander Afanasyev809805d2014-02-17 17:20:33 -0800191
Alexander Afanasyevff2d08f2014-04-07 18:28:25 -0700192 uint32_t
Alexander Afanasyev2ba8f662014-01-05 22:53:18 -0800193 getContentType() const;
Alexander Afanasyevaa0e7da2014-03-17 14:37:33 -0700194
Alexander Afanasyev770827c2014-05-13 17:42:55 -0700195 Data&
Alexander Afanasyev2ba8f662014-01-05 22:53:18 -0800196 setContentType(uint32_t type);
Alexander Afanasyev809805d2014-02-17 17:20:33 -0800197
198 //
Alexander Afanasyevaa0e7da2014-03-17 14:37:33 -0700199
Alexander Afanasyevff2d08f2014-04-07 18:28:25 -0700200 const time::milliseconds&
Alexander Afanasyev2ba8f662014-01-05 22:53:18 -0800201 getFreshnessPeriod() const;
Alexander Afanasyevaa0e7da2014-03-17 14:37:33 -0700202
Alexander Afanasyev770827c2014-05-13 17:42:55 -0700203 Data&
Alexander Afanasyevaa0e7da2014-03-17 14:37:33 -0700204 setFreshnessPeriod(const time::milliseconds& freshnessPeriod);
Alexander Afanasyev95b0e342014-02-12 21:34:44 -0800205
Alexander Afanasyev809805d2014-02-17 17:20:33 -0800206 //
207
Alexander Afanasyevff2d08f2014-04-07 18:28:25 -0700208 const name::Component&
Alexander Afanasyev95b0e342014-02-12 21:34:44 -0800209 getFinalBlockId() const;
210
Alexander Afanasyev770827c2014-05-13 17:42:55 -0700211 Data&
Alexander Afanasyev95b0e342014-02-12 21:34:44 -0800212 setFinalBlockId(const name::Component& finalBlockId);
Alexander Afanasyev809805d2014-02-17 17:20:33 -0800213
214 //
215 ///////////////////////////////////////////////////////////////
216 ///////////////////////////////////////////////////////////////
217 ///////////////////////////////////////////////////////////////
Alexander Afanasyevaa0e7da2014-03-17 14:37:33 -0700218
Alexander Afanasyev2ba8f662014-01-05 22:53:18 -0800219 /**
220 * @brief Get content Block
221 *
222 * To access content value, one can use value()/value_size() or
223 * value_begin()/value_end() methods of the Block class
224 */
Alexander Afanasyevff2d08f2014-04-07 18:28:25 -0700225 const Block&
Alexander Afanasyev2ba8f662014-01-05 22:53:18 -0800226 getContent() const;
Alexander Afanasyevfadc97d2014-01-03 13:22:10 -0800227
Jeff Thompson0899c0f2013-09-12 12:15:31 -0700228 /**
Alexander Afanasyev770827c2014-05-13 17:42:55 -0700229 * @brief Set the content from the buffer (buffer will be copied)
230 *
231 * @param buffer Pointer to first byte of the buffer
232 * @param bufferSize Size of the buffer
233 *
Jeff Thompson6d591972013-10-17 11:16:32 -0700234 * @return This Data so that you can chain calls to update values.
Jeff Thompson0899c0f2013-09-12 12:15:31 -0700235 */
Alexander Afanasyev770827c2014-05-13 17:42:55 -0700236 Data&
237 setContent(const uint8_t* buffer, size_t bufferSize);
Alexander Afanasyevfadc97d2014-01-03 13:22:10 -0800238
Alexander Afanasyev770827c2014-05-13 17:42:55 -0700239 /**
240 * @brief Set the content from the block
241 *
242 * Depending on type of the supplied block, there are two cases:
243 *
Steve DiBenedetto54ce6682014-07-22 13:22:57 -0600244 * - if block.type() == tlv::Content, then block will be used directly as Data packet's
Alexander Afanasyev770827c2014-05-13 17:42:55 -0700245 * content (no extra copying)
246 *
Steve DiBenedetto54ce6682014-07-22 13:22:57 -0600247 * - if block.type() != tlv::Content, then this method will create a new Block with type
248 * tlv::Content and put block as a nested element in the content Block.
Alexander Afanasyev770827c2014-05-13 17:42:55 -0700249 *
250 * @param block The Block containing the content to assign
251 *
252 * @return This Data so that you can chain calls to update values.
253 */
254 Data&
255 setContent(const Block& block);
Alexander Afanasyev2ba8f662014-01-05 22:53:18 -0800256
Alexander Afanasyev770827c2014-05-13 17:42:55 -0700257 /**
258 * @brief Set the content from the pointer to immutable buffer
259 *
Steve DiBenedetto54ce6682014-07-22 13:22:57 -0600260 * This method will create a Block with tlv::Content and set contentValue as a payload
Alexander Afanasyev770827c2014-05-13 17:42:55 -0700261 * for this block. Note that this method is very different from setContent(const
262 * Block&), since it does not require that payload should be a valid TLV element.
263 *
264 * @param contentValue The pointer to immutable buffer containing the content to assign
265 *
266 * @return This Data so that you can chain calls to update values.
267 */
268 Data&
Alexander Afanasyevff2d08f2014-04-07 18:28:25 -0700269 setContent(const ConstBufferPtr& contentValue);
Alexander Afanasyev809805d2014-02-17 17:20:33 -0800270
271 //
Alexander Afanasyevaa0e7da2014-03-17 14:37:33 -0700272
Alexander Afanasyevff2d08f2014-04-07 18:28:25 -0700273 const Signature&
Alexander Afanasyev2ba8f662014-01-05 22:53:18 -0800274 getSignature() const;
Alexander Afanasyevaa0e7da2014-03-17 14:37:33 -0700275
Alexander Afanasyev2ba8f662014-01-05 22:53:18 -0800276 /**
277 * @brief Set the signature to a copy of the given signature.
278 * @param signature The signature object which is cloned.
Alexander Afanasyev2ba8f662014-01-05 22:53:18 -0800279 */
Alexander Afanasyev770827c2014-05-13 17:42:55 -0700280 Data&
Alexander Afanasyev2ba8f662014-01-05 22:53:18 -0800281 setSignature(const Signature& signature);
Alexander Afanasyevaa0e7da2014-03-17 14:37:33 -0700282
Alexander Afanasyev770827c2014-05-13 17:42:55 -0700283 Data&
Alexander Afanasyevff2d08f2014-04-07 18:28:25 -0700284 setSignatureValue(const Block& value);
Yingdi Yua4e57672014-02-06 11:16:17 -0800285
Alexander Afanasyev809805d2014-02-17 17:20:33 -0800286 ///////////////////////////////////////////////////////////////
Alexander Afanasyev6d48bc12014-02-18 00:10:51 -0800287
288 nfd::LocalControlHeader&
289 getLocalControlHeader();
290
291 const nfd::LocalControlHeader&
292 getLocalControlHeader() const;
Alexander Afanasyevaa0e7da2014-03-17 14:37:33 -0700293
Alexander Afanasyevff2d08f2014-04-07 18:28:25 -0700294 uint64_t
Yingdi Yua4e57672014-02-06 11:16:17 -0800295 getIncomingFaceId() const;
296
Alexander Afanasyev770827c2014-05-13 17:42:55 -0700297 Data&
Yingdi Yua4e57672014-02-06 11:16:17 -0800298 setIncomingFaceId(uint64_t incomingFaceId);
Alexander Afanasyevaa0e7da2014-03-17 14:37:33 -0700299
Alexander Afanasyevff2d08f2014-04-07 18:28:25 -0700300public: // EqualityComparable concept
301 bool
302 operator==(const Data& other) const;
303
304 bool
305 operator!=(const Data& other) const;
306
Jeff Thompson5cae5e52013-07-10 19:41:20 -0700307private:
Jeff Thompsonb7aefa002013-09-16 18:22:00 -0700308 /**
Alexander Afanasyev2ba8f662014-01-05 22:53:18 -0800309 * @brief Clear the wire encoding.
Jeff Thompsonb7aefa002013-09-16 18:22:00 -0700310 */
Alexander Afanasyevff2d08f2014-04-07 18:28:25 -0700311 void
Jeff Thompson0050abe2013-09-17 12:50:25 -0700312 onChanged();
Alexander Afanasyevfadc97d2014-01-03 13:22:10 -0800313
314private:
Alexander Afanasyev809805d2014-02-17 17:20:33 -0800315 Name m_name;
316 MetaInfo m_metaInfo;
317 mutable Block m_content;
318 Signature m_signature;
Alexander Afanasyevfadc97d2014-01-03 13:22:10 -0800319
Alexander Afanasyev809805d2014-02-17 17:20:33 -0800320 mutable Block m_wire;
Alexander Afanasyev3b703102014-06-13 17:01:14 -0700321 mutable Name m_fullName;
Yingdi Yua4e57672014-02-06 11:16:17 -0800322
Alexander Afanasyev6d48bc12014-02-18 00:10:51 -0800323 nfd::LocalControlHeader m_localControlHeader;
324 friend class nfd::LocalControlHeader;
Jeff Thompson5cae5e52013-07-10 19:41:20 -0700325};
Alexander Afanasyevfadc97d2014-01-03 13:22:10 -0800326
Alexander Afanasyeva0c5f832014-06-19 13:27:56 -0700327std::ostream&
328operator<<(std::ostream& os, const Data& data);
Alexander Afanasyev809805d2014-02-17 17:20:33 -0800329
Alexander Afanasyev6d48bc12014-02-18 00:10:51 -0800330inline bool
331Data::hasWire() const
332{
333 return m_wire.hasWire();
334}
335
Alexander Afanasyevaa0e7da2014-03-17 14:37:33 -0700336inline const Name&
Alexander Afanasyev2ba8f662014-01-05 22:53:18 -0800337Data::getName() const
338{
Alexander Afanasyev809805d2014-02-17 17:20:33 -0800339 return m_name;
Alexander Afanasyev2ba8f662014-01-05 22:53:18 -0800340}
Alexander Afanasyevaa0e7da2014-03-17 14:37:33 -0700341
Alexander Afanasyevaa0e7da2014-03-17 14:37:33 -0700342inline const MetaInfo&
Alexander Afanasyev2ba8f662014-01-05 22:53:18 -0800343Data::getMetaInfo() const
344{
Alexander Afanasyev809805d2014-02-17 17:20:33 -0800345 return m_metaInfo;
Alexander Afanasyev2ba8f662014-01-05 22:53:18 -0800346}
Alexander Afanasyevaa0e7da2014-03-17 14:37:33 -0700347
Alexander Afanasyevaa0e7da2014-03-17 14:37:33 -0700348inline uint32_t
Alexander Afanasyev2ba8f662014-01-05 22:53:18 -0800349Data::getContentType() const
350{
Alexander Afanasyev809805d2014-02-17 17:20:33 -0800351 return m_metaInfo.getType();
Alexander Afanasyev2ba8f662014-01-05 22:53:18 -0800352}
Alexander Afanasyevaa0e7da2014-03-17 14:37:33 -0700353
Alexander Afanasyevaa0e7da2014-03-17 14:37:33 -0700354inline const time::milliseconds&
Alexander Afanasyev2ba8f662014-01-05 22:53:18 -0800355Data::getFreshnessPeriod() const
356{
Alexander Afanasyev809805d2014-02-17 17:20:33 -0800357 return m_metaInfo.getFreshnessPeriod();
Alexander Afanasyev2ba8f662014-01-05 22:53:18 -0800358}
Alexander Afanasyevaa0e7da2014-03-17 14:37:33 -0700359
Alexander Afanasyev95b0e342014-02-12 21:34:44 -0800360inline const name::Component&
361Data::getFinalBlockId() const
362{
Alexander Afanasyev809805d2014-02-17 17:20:33 -0800363 return m_metaInfo.getFinalBlockId();
Alexander Afanasyev95b0e342014-02-12 21:34:44 -0800364}
365
Alexander Afanasyev2ba8f662014-01-05 22:53:18 -0800366inline const Signature&
367Data::getSignature() const
368{
Alexander Afanasyev809805d2014-02-17 17:20:33 -0800369 return m_signature;
Alexander Afanasyev2ba8f662014-01-05 22:53:18 -0800370}
Alexander Afanasyevaa0e7da2014-03-17 14:37:33 -0700371
Alexander Afanasyev6d48bc12014-02-18 00:10:51 -0800372inline nfd::LocalControlHeader&
373Data::getLocalControlHeader()
374{
375 return m_localControlHeader;
376}
377
378inline const nfd::LocalControlHeader&
379Data::getLocalControlHeader() const
380{
381 return m_localControlHeader;
382}
383
Yingdi Yua4e57672014-02-06 11:16:17 -0800384inline uint64_t
385Data::getIncomingFaceId() const
386{
Alexander Afanasyev6d48bc12014-02-18 00:10:51 -0800387 return getLocalControlHeader().getIncomingFaceId();
Yingdi Yua4e57672014-02-06 11:16:17 -0800388}
389
Alexander Afanasyev4ff3c912014-01-03 15:25:02 -0800390
Alexander Afanasyevfadc97d2014-01-03 13:22:10 -0800391} // namespace ndn
392
Jeff Thompson5cae5e52013-07-10 19:41:20 -0700393#endif