blob: a5f1e1a3310a4ba76ed17a89a7cd1d9ec43f6329 [file] [log] [blame]
Alexander Afanasyevc169a812014-05-20 20:37:29 -04001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
Junxiao Shidb7464d2017-07-13 03:11:17 +00002/*
3 * Copyright (c) 2013-2017 Regents of the University of California.
Alexander Afanasyev13bb51a2014-01-02 19:13:26 -08004 *
Alexander Afanasyevdfa52c42014-04-24 21:10:11 -07005 * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
Alexander Afanasyev13bb51a2014-01-02 19:13:26 -08006 *
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.
Alexander Afanasyevdfa52c42014-04-24 21:10:11 -070020 *
21 * @author Alexander Afanasyev <http://lasr.cs.ucla.edu/afanasyev/index.html>
Alexander Afanasyev13bb51a2014-01-02 19:13:26 -080022 */
23
Alexander Afanasyev258ec2b2014-05-14 16:15:37 -070024#ifndef NDN_ENCODING_BLOCK_HPP
25#define NDN_ENCODING_BLOCK_HPP
Alexander Afanasyev13bb51a2014-01-02 19:13:26 -080026
Alexander Afanasyev19508852014-01-29 01:01:51 -080027#include "../common.hpp"
Alexander Afanasyev13bb51a2014-01-02 19:13:26 -080028
Alexander Afanasyev13bb51a2014-01-02 19:13:26 -080029#include "buffer.hpp"
30#include "tlv.hpp"
Alexander Afanasyev74633892015-02-08 18:08:46 -080031#include "encoding-buffer-fwd.hpp"
Alexander Afanasyev13bb51a2014-01-02 19:13:26 -080032
Alexander Afanasyev6a05b4b2014-07-18 17:23:00 -070033namespace boost {
34namespace asio {
35class const_buffer;
36} // namespace asio
37} // namespace boost
38
Alexander Afanasyev13bb51a2014-01-02 19:13:26 -080039namespace ndn {
40
Junxiao Shi81a6c5d2014-11-30 00:14:42 -070041/** @brief Class representing a wire element of NDN-TLV packet format
Alexander Afanasyev13bb51a2014-01-02 19:13:26 -080042 */
43class Block
44{
45public:
Junxiao Shidb7464d2017-07-13 03:11:17 +000046 using element_container = std::vector<Block>;
47 using element_iterator = element_container::iterator;
48 using element_const_iterator = element_container::const_iterator;
Alexander Afanasyev13bb51a2014-01-02 19:13:26 -080049
Steve DiBenedetto54ce6682014-07-22 13:22:57 -060050 class Error : public tlv::Error
Alexander Afanasyev937aa782014-03-21 13:17:57 -070051 {
Alexander Afanasyeva465e972014-03-22 17:21:49 -070052 public:
53 explicit
54 Error(const std::string& what)
Steve DiBenedetto54ce6682014-07-22 13:22:57 -060055 : tlv::Error(what)
Alexander Afanasyeva465e972014-03-22 17:21:49 -070056 {
57 }
Alexander Afanasyev937aa782014-03-21 13:17:57 -070058 };
59
Junxiao Shi81a6c5d2014-11-30 00:14:42 -070060public: // constructor, creation, assignment
61 /** @brief Create an empty Block
Alexander Afanasyev13bb51a2014-01-02 19:13:26 -080062 */
63 Block();
64
Junxiao Shidb7464d2017-07-13 03:11:17 +000065 /** @brief Parse Block from an EncodingBuffer
66 * @param buffer an EncodingBuffer containing one TLV element
67 * @throw tlv::Error Type-Length parsing fails, or TLV-LENGTH does not match size of TLV-VALUE
Alexander Afanasyev15151312014-02-16 00:53:51 -080068 */
69 explicit
70 Block(const EncodingBuffer& buffer);
Alexander Afanasyev937aa782014-03-21 13:17:57 -070071
Junxiao Shidb7464d2017-07-13 03:11:17 +000072 /** @brief Parse Block from a wire Buffer
73 * @param buffer a Buffer containing one TLV element
74 * @note This constructor takes shared ownership of @p buffer.
75 * @throw tlv::Error Type-Length parsing fails, or TLV-LENGTH does not match size of TLV-VALUE
Alexander Afanasyev13bb51a2014-01-02 19:13:26 -080076 */
Alexander Afanasyev197e5652014-06-13 16:56:31 -070077 explicit
Alexander Afanasyev937aa782014-03-21 13:17:57 -070078 Block(const ConstBufferPtr& buffer);
Alexander Afanasyev13bb51a2014-01-02 19:13:26 -080079
Junxiao Shidb7464d2017-07-13 03:11:17 +000080 /** @brief Parse Block within boundaries of a wire Buffer
81 * @param buffer a Buffer containing an TLV element at [@p begin,@p end)
82 * @param begin begin position of the TLV element within @p buffer
83 * @param end end position of the TLV element within @p buffer
84 * @param verifyLength if true, check TLV-LENGTH equals size of TLV-VALUE
85 * @throw std::invalid_argument @p buffer is empty, or [@p begin,@p end) range are not within @p buffer
86 * @throw tlv::Error Type-Length parsing fails, or TLV-LENGTH does not match size of TLV-VALUE
87 * @note This overload automatically detects TLV-TYPE and position of TLV-VALUE.
Alexander Afanasyev187bc482014-02-06 15:04:04 -080088 */
Junxiao Shidb7464d2017-07-13 03:11:17 +000089 Block(ConstBufferPtr buffer, Buffer::const_iterator begin, Buffer::const_iterator end,
Alexander Afanasyev5964fb72014-02-18 12:42:45 -080090 bool verifyLength = true);
Alexander Afanasyev937aa782014-03-21 13:17:57 -070091
Junxiao Shidb7464d2017-07-13 03:11:17 +000092 /** @brief Parse Block within boundaries of an existing Block, reusing underlying wire Buffer
93 * @param block a Block whose buffer contains an TLV element at [@p begin,@p end)
94 * @param begin begin position of the TLV element within @p block
95 * @param end end position of the TLV element within @p block
96 * @param verifyLength if true, check TLV-LENGTH equals size of TLV-VALUE
97 * @throw std::invalid_argument [@p begin,@p end) range are not within @p block
98 * @throw tlv::Error Type-Length parsing fails, or TLV-LENGTH does not match size of TLV-VALUE
Alexander Afanasyev4448d292015-08-09 20:11:37 -070099 */
Junxiao Shidb7464d2017-07-13 03:11:17 +0000100 Block(const Block& block, Buffer::const_iterator begin, Buffer::const_iterator end,
Alexander Afanasyev4448d292015-08-09 20:11:37 -0700101 bool verifyLength = true);
102
Junxiao Shidb7464d2017-07-13 03:11:17 +0000103 /** @brief Create a Block from a wire Buffer without parsing
104 * @param buffer a Buffer containing an TLV element at [@p begin,@p end)
105 * @param type TLV-TYPE
106 * @param begin begin position of the TLV element within @p buffer
107 * @param end end position of the TLV element within @p buffer
108 * @param valueBegin begin position of TLV-VALUE within @p buffer
109 * @param valueEnd end position of TLV-VALUE within @p buffer
Alexander Afanasyev13bb51a2014-01-02 19:13:26 -0800110 */
Junxiao Shidb7464d2017-07-13 03:11:17 +0000111 Block(ConstBufferPtr buffer, uint32_t type,
112 Buffer::const_iterator begin, Buffer::const_iterator end,
113 Buffer::const_iterator valueBegin, Buffer::const_iterator valueEnd);
Alexander Afanasyev13bb51a2014-01-02 19:13:26 -0800114
Junxiao Shidb7464d2017-07-13 03:11:17 +0000115 /** @brief Parse Block from a raw buffer
116 * @param buf pointer to the first octet of an TLV element
117 * @param bufSize size of the raw buffer; may be more than size of the TLV element
118 * @throw tlv::Error Type-Length parsing fails, or size of TLV-VALUE exceeds @p bufSize
119 * @note This overload copies the TLV element into an internal wire buffer.
Junxiao Shi81a6c5d2014-11-30 00:14:42 -0700120 */
Junxiao Shidb7464d2017-07-13 03:11:17 +0000121 Block(const uint8_t* buf, size_t bufSize);
Yingdi Yu27158392014-01-20 13:04:20 -0800122
Junxiao Shidb7464d2017-07-13 03:11:17 +0000123 /** @brief Parse Block from a raw buffer
124 * @deprecated use Block(const uint8_t*, size_t)
Alexander Afanasyev13bb51a2014-01-02 19:13:26 -0800125 */
Junxiao Shidb7464d2017-07-13 03:11:17 +0000126 Block(const void* buf, size_t bufSize);
Alexander Afanasyev13bb51a2014-01-02 19:13:26 -0800127
Junxiao Shidb7464d2017-07-13 03:11:17 +0000128 /** @brief Create an empty Block with specified TLV-TYPE
129 * @param type TLV-TYPE
Alexander Afanasyev13bb51a2014-01-02 19:13:26 -0800130 */
Alexander Afanasyevf42ce132014-01-07 13:32:30 -0800131 explicit
Alexander Afanasyev13bb51a2014-01-02 19:13:26 -0800132 Block(uint32_t type);
133
Junxiao Shidb7464d2017-07-13 03:11:17 +0000134 /** @brief Create a Block with specified TLV-TYPE and TLV-VALUE
135 * @param type TLV-TYPE
136 * @param value a Buffer containing the TLV-VALUE
Alexander Afanasyev13bb51a2014-01-02 19:13:26 -0800137 */
Junxiao Shidb7464d2017-07-13 03:11:17 +0000138 Block(uint32_t type, ConstBufferPtr value);
Alexander Afanasyev13bb51a2014-01-02 19:13:26 -0800139
Junxiao Shidb7464d2017-07-13 03:11:17 +0000140 /** @brief Create a Block with specified TLV-TYPE and TLV-VALUE
141 * @param type TLV-TYPE
142 * @param value a Block to be nested as TLV-VALUE
Alexander Afanasyev13bb51a2014-01-02 19:13:26 -0800143 */
Alexander Afanasyev937aa782014-03-21 13:17:57 -0700144 Block(uint32_t type, const Block& value);
145
Junxiao Shidb7464d2017-07-13 03:11:17 +0000146 /** @brief Parse Block from an input stream
Alexander Afanasyev258ec2b2014-05-14 16:15:37 -0700147 */
Alexander Afanasyev9c578182014-05-14 17:28:28 -0700148 static Block
Alexander Afanasyev258ec2b2014-05-14 16:15:37 -0700149 fromStream(std::istream& is);
150
Junxiao Shidb7464d2017-07-13 03:11:17 +0000151 /** @brief Try to parse Block from a wire buffer
152 * @param buffer a Buffer containing an TLV element at offset @p offset
153 * @param offset begin position of the TLV element within @p buffer
154 * @note This function does not throw exceptions upon decoding failure.
155 * @return true and the Block if parsing succeeds; otherwise false
Alexander Afanasyev937aa782014-03-21 13:17:57 -0700156 */
Junxiao Shi02a4bf32015-02-21 21:07:46 -0700157 static std::tuple<bool, Block>
158 fromBuffer(ConstBufferPtr buffer, size_t offset);
Alexander Afanasyev937aa782014-03-21 13:17:57 -0700159
Junxiao Shidb7464d2017-07-13 03:11:17 +0000160 /** @brief Try to parse Block from a raw buffer
161 * @param buf pointer to the first octet of an TLV element
162 * @param bufSize size of the raw buffer; may be more than size of the TLV element
163 * @note This function does not throw exceptions upon decoding failure.
164 * @note This overload copies the TLV element into an internal wire buffer.
165 * @return true and the Block if parsing succeeds; otherwise false
Junxiao Shi02a4bf32015-02-21 21:07:46 -0700166 */
167 static std::tuple<bool, Block>
Junxiao Shidb7464d2017-07-13 03:11:17 +0000168 fromBuffer(const uint8_t* buf, size_t bufSize);
Junxiao Shi02a4bf32015-02-21 21:07:46 -0700169
Junxiao Shi81a6c5d2014-11-30 00:14:42 -0700170public: // wire format
171 /** @brief Check if the Block is empty
Junxiao Shidb7464d2017-07-13 03:11:17 +0000172 *
173 * A Block is "empty" only if it is default-constructed. A Block with zero-length TLV-VALUE is
174 * not considered empty.
Alexander Afanasyev196b9aa2014-01-31 17:19:16 -0800175 */
Alexander Afanasyeva465e972014-03-22 17:21:49 -0700176 bool
Junxiao Shidb7464d2017-07-13 03:11:17 +0000177 empty() const
178 {
179 return m_type == std::numeric_limits<uint32_t>::max();
180 }
Alexander Afanasyev937aa782014-03-21 13:17:57 -0700181
Junxiao Shi81a6c5d2014-11-30 00:14:42 -0700182 /** @brief Check if the Block has fully encoded wire
Junxiao Shidb7464d2017-07-13 03:11:17 +0000183 *
184 * A Block has fully encoded wire if the underlying buffer exists and contains full
185 * Type-Length-Value instead of just TLV-VALUE field.
Alexander Afanasyev13bb51a2014-01-02 19:13:26 -0800186 */
Alexander Afanasyeva465e972014-03-22 17:21:49 -0700187 bool
Alexander Afanasyev13bb51a2014-01-02 19:13:26 -0800188 hasWire() const;
189
Junxiao Shi81a6c5d2014-11-30 00:14:42 -0700190 /** @brief Reset wire buffer of the element
Junxiao Shidb7464d2017-07-13 03:11:17 +0000191 * @post empty() == true
Alexander Afanasyev13bb51a2014-01-02 19:13:26 -0800192 */
Alexander Afanasyeva465e972014-03-22 17:21:49 -0700193 void
Alexander Afanasyev13bb51a2014-01-02 19:13:26 -0800194 reset();
195
Junxiao Shidb7464d2017-07-13 03:11:17 +0000196 /** @brief Reset wire buffer but keep TLV-TYPE and sub elements (if any)
197 * @post hasWire() == false
198 * @post hasValue() == false
Alexander Afanasyev29e5c3d2014-02-11 00:01:10 -0800199 */
Alexander Afanasyeva465e972014-03-22 17:21:49 -0700200 void
Alexander Afanasyev29e5c3d2014-02-11 00:01:10 -0800201 resetWire();
Alexander Afanasyev13bb51a2014-01-02 19:13:26 -0800202
Junxiao Shidb7464d2017-07-13 03:11:17 +0000203 /** @brief Get begin iterator of encoded wire
204 * @pre hasWire() == true
205 */
Junxiao Shi81a6c5d2014-11-30 00:14:42 -0700206 Buffer::const_iterator
207 begin() const;
208
Junxiao Shidb7464d2017-07-13 03:11:17 +0000209 /** @brief Get end iterator of encoded wire
210 * @pre hasWire() == true
211 */
Junxiao Shi81a6c5d2014-11-30 00:14:42 -0700212 Buffer::const_iterator
213 end() const;
214
Junxiao Shidb7464d2017-07-13 03:11:17 +0000215 /** @brief Get pointer to encoded wire
216 * @pre hasWire() == true
217 */
Junxiao Shi81a6c5d2014-11-30 00:14:42 -0700218 const uint8_t*
219 wire() const;
220
Junxiao Shidb7464d2017-07-13 03:11:17 +0000221 /** @brief Get size of encoded wire, including Type-Length-Value
222 * @pre empty() == false
223 */
Junxiao Shi81a6c5d2014-11-30 00:14:42 -0700224 size_t
225 size() const;
226
Junxiao Shidb7464d2017-07-13 03:11:17 +0000227 /** @brief Get underlying buffer
228 */
229 shared_ptr<const Buffer>
230 getBuffer() const
231 {
232 return m_buffer;
233 }
Junxiao Shi81a6c5d2014-11-30 00:14:42 -0700234
Junxiao Shidb7464d2017-07-13 03:11:17 +0000235public: // type and value
236 /** @brief Get TLV-TYPE
237 */
238 uint32_t
239 type() const
240 {
241 return m_type;
242 }
243
244 /** @brief Get begin iterator of TLV-VALUE
245 *
246 * This property reflects whether the underlying buffer contains TLV-VALUE. If this is false,
247 * TLV-VALUE has zero-length. If this is true, TLV-VALUE may be zero-length.
Junxiao Shi81a6c5d2014-11-30 00:14:42 -0700248 */
249 bool
Junxiao Shidb7464d2017-07-13 03:11:17 +0000250 hasValue() const
251 {
252 return m_buffer != nullptr;
253 }
Junxiao Shi81a6c5d2014-11-30 00:14:42 -0700254
Junxiao Shidb7464d2017-07-13 03:11:17 +0000255 /** @brief Get begin iterator of TLV-VALUE
256 * @pre hasValue() == true
257 */
Junxiao Shi81a6c5d2014-11-30 00:14:42 -0700258 Buffer::const_iterator
Junxiao Shidb7464d2017-07-13 03:11:17 +0000259 value_begin() const
260 {
261 return m_valueBegin;
262 }
Junxiao Shi81a6c5d2014-11-30 00:14:42 -0700263
Junxiao Shidb7464d2017-07-13 03:11:17 +0000264 /** @brief Get end iterator of TLV-VALUE
265 * @pre hasValue() == true
266 */
Junxiao Shi81a6c5d2014-11-30 00:14:42 -0700267 Buffer::const_iterator
Junxiao Shidb7464d2017-07-13 03:11:17 +0000268 value_end() const
269 {
270 return m_valueEnd;
271 }
Junxiao Shi81a6c5d2014-11-30 00:14:42 -0700272
Junxiao Shidb7464d2017-07-13 03:11:17 +0000273 /** @brief Get pointer to TLV-VALUE
274 */
Junxiao Shi81a6c5d2014-11-30 00:14:42 -0700275 const uint8_t*
276 value() const;
277
Junxiao Shidb7464d2017-07-13 03:11:17 +0000278 /** @brief Get size of TLV-VALUE aka TLV-LENGTH
279 */
Junxiao Shi81a6c5d2014-11-30 00:14:42 -0700280 size_t
281 value_size() const;
282
Yingdi Yu4270f202014-01-28 14:19:16 -0800283 Block
284 blockFromValue() const;
285
Junxiao Shidb7464d2017-07-13 03:11:17 +0000286public: // sub elements
287 /** @brief Parse TLV-VALUE into sub elements
288 * @post elements() reflects sub elements found in TLV-VALUE
289 * @throw tlv::Error TLV-VALUE is not a sequence of TLV elements
290 * @note This method does not perform recursive parsing.
291 * @note This method has no effect if elements() is already populated.
292 * @note This method is not really const, but it does not modify any data.
Alexander Afanasyev74633892015-02-08 18:08:46 -0800293 */
Junxiao Shidb7464d2017-07-13 03:11:17 +0000294 void
295 parse() const;
Alexander Afanasyev74633892015-02-08 18:08:46 -0800296
Junxiao Shidb7464d2017-07-13 03:11:17 +0000297 /** @brief Encode sub elements into TLV-VALUE
298 * @post TLV-VALUE contains sub elements from elements()
299 */
300 void
301 encode();
Junxiao Shiaf8eeea2014-03-31 20:10:56 -0700302
Junxiao Shidb7464d2017-07-13 03:11:17 +0000303 /** @brief Get the first sub element of specified TLV-TYPE
304 * @pre parse() has been executed
305 * @throw Error sub element of @p type does not exist
306 */
307 const Block&
308 get(uint32_t type) const;
Junxiao Shiaf8eeea2014-03-31 20:10:56 -0700309
Junxiao Shidb7464d2017-07-13 03:11:17 +0000310 /** @brief Find the first sub element of specified TLV-TYPE
311 * @pre parse() has been executed
312 * @return iterator in elements() to the found sub element, otherwise elements_end()
313 */
314 element_const_iterator
315 find(uint32_t type) const;
316
317 /** @brief Remove all sub elements of specified TLV-TYPE
318 * @pre parse() has been executed
319 * @post find(type) == elements_end()
320 */
321 void
322 remove(uint32_t type);
323
324 /** @brief Erase a sub element
325 */
326 element_iterator
327 erase(element_const_iterator position);
328
329 /** @brief Erase a range of sub elements
330 */
331 element_iterator
332 erase(element_const_iterator first, element_const_iterator last);
333
334 /** @brief Append a sub element
335 */
336 void
337 push_back(const Block& element);
338
339 /** @brief Insert a sub element
340 * @param pos position of new sub element
341 * @param element new sub element
342 * @return iterator in elements() to the new sub element
343 */
344 element_iterator
345 insert(element_const_iterator pos, const Block& element);
346
347 /** @brief Get container of sub elements
348 * @pre parse() has been executed
349 */
350 const element_container&
351 elements() const
352 {
353 return m_elements;
354 }
355
356 /** @brief Equivalent to elements().begin()
357 */
358 element_const_iterator
359 elements_begin() const
360 {
361 return m_elements.begin();
362 }
363
364 /** @brief Equivalent to elements().end()
365 */
366 element_const_iterator
367 elements_end() const
368 {
369 return m_elements.end();
370 }
371
372 /** @brief Equivalent to elements().size()
373 */
374 size_t
375 elements_size() const
376 {
377 return m_elements.size();
378 }
379
380public: // misc
381 /** @brief Implicit conversion to const_buffer
382 */
Alexander Afanasyev6a05b4b2014-07-18 17:23:00 -0700383 operator boost::asio::const_buffer() const;
384
Alexander Afanasyev13bb51a2014-01-02 19:13:26 -0800385protected:
Junxiao Shidb7464d2017-07-13 03:11:17 +0000386 /** @brief underlying buffer storing TLV-VALUE and possibly TLV-TYPE and TLV-LENGTH fields
387 *
388 * If m_buffer is nullptr, this is an empty Block with TLV-TYPE given in m_type.
389 * Otherwise,
390 * - [m_valueBegin, m_valueEnd) point to TLV-VALUE within m_buffer.
391 * - If m_begin != m_end, [m_begin,m_end) point to Type-Length-Value of this Block within m_buffer.
392 * Otherwise, m_buffer does not contain TLV-TYPE and TLV-LENGTH fields.
393 */
Alexander Afanasyev74633892015-02-08 18:08:46 -0800394 shared_ptr<const Buffer> m_buffer;
Junxiao Shidb7464d2017-07-13 03:11:17 +0000395 Buffer::const_iterator m_begin; ///< @sa m_buffer
396 Buffer::const_iterator m_end; ///< @sa m_buffer
Alexander Afanasyev13bb51a2014-01-02 19:13:26 -0800397
Junxiao Shidb7464d2017-07-13 03:11:17 +0000398 Buffer::const_iterator m_valueBegin; ///< @sa m_buffer
399 Buffer::const_iterator m_valueEnd; ///< @sa m_buffer
Alexander Afanasyev937aa782014-03-21 13:17:57 -0700400
Junxiao Shidb7464d2017-07-13 03:11:17 +0000401 uint32_t m_type; ///< TLV-TYPE
402
403 /** @brief total size including Type-Length-Value
404 *
405 * This field is valid only if empty() is false.
406 */
Alexander Afanasyev13bb51a2014-01-02 19:13:26 -0800407 uint32_t m_size;
Alexander Afanasyev937aa782014-03-21 13:17:57 -0700408
Junxiao Shidb7464d2017-07-13 03:11:17 +0000409 /** @brief sub elements
410 *
411 * This field is valid only if parse() has been executed.
412 */
413 mutable element_container m_elements;
Alexander Afanasyev13bb51a2014-01-02 19:13:26 -0800414};
415
Junxiao Shidb7464d2017-07-13 03:11:17 +0000416/** @brief Compare whether two Blocks have same TLV-TYPE, TLV-LENGTH, and TLV-VALUE
417 */
418bool
419operator==(const Block& lhs, const Block& rhs);
Alexander Afanasyev13bb51a2014-01-02 19:13:26 -0800420
Junxiao Shidb7464d2017-07-13 03:11:17 +0000421inline bool
422operator!=(const Block& lhs, const Block& rhs)
Alexander Afanasyev74633892015-02-08 18:08:46 -0800423{
Junxiao Shidb7464d2017-07-13 03:11:17 +0000424 return !(lhs == rhs);
Alexander Afanasyev29e5c3d2014-02-11 00:01:10 -0800425}
426
Junxiao Shi81a6c5d2014-11-30 00:14:42 -0700427} // namespace ndn
Alexander Afanasyev13bb51a2014-01-02 19:13:26 -0800428
Alexander Afanasyev258ec2b2014-05-14 16:15:37 -0700429#endif // NDN_ENCODING_BLOCK_HPP