Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 1 | /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /* |
| 3 | * Copyright (c) 2011 University of California, Los Angeles |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License version 2 as |
| 7 | * published by the Free Software Foundation; |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 17 | * |
| 18 | * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu> |
| 19 | */ |
| 20 | |
| 21 | #ifndef _NDN_DECODING_HELPER_H_ |
| 22 | #define _NDN_DECODING_HELPER_H_ |
| 23 | |
| 24 | #include <cstring> |
| 25 | #include "ns3/buffer.h" |
| 26 | |
| 27 | namespace ns3 { |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 28 | namespace ndn { |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 29 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 30 | class InterestHeader; |
| 31 | class ContentObjectHeader; |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 32 | |
| 33 | /** |
| 34 | * \brief Helper class to decode ccnb formatted Ndn message |
| 35 | */ |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 36 | class DecodingHelper |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 37 | { |
| 38 | public: |
| 39 | /** |
| 40 | * \brief Deserialize Buffer::Iterator to NdnInterestHeader |
| 41 | * @param start Buffer containing serialized Ndn message |
| 42 | * @param interest Pointer to the NdnInterestHeader to hold deserialized value |
| 43 | * @return Number of bytes used for deserialization |
| 44 | */ |
| 45 | static size_t |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 46 | Deserialize (Buffer::Iterator start, InterestHeader &interest); |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 47 | |
| 48 | /** |
| 49 | * \brief Deserialize Buffer::Iterator to NdnContentObjectHeader |
| 50 | * @param start Buffer containing serialized Ndn message |
| 51 | * @param contentObject Pointer to the NdnContentObjectHeader to hold deserialized value |
| 52 | * @return Number of bytes used for deserialization |
| 53 | */ |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 54 | // static size_t |
| 55 | // Deserialize (Buffer::Iterator start, ContentObjectHeader &contentObject); |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 56 | }; |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 57 | |
| 58 | } // namespace ndn |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 59 | } // namespace ns3 |
| 60 | |
| 61 | #endif // _NDN_DECODING_HELPER_H_ |