blob: 8a33be3c4eafce359698b04b3cdc2968061bf6e8 [file] [log] [blame]
Alexander Afanasyev4aac5572012-08-09 10:49:55 -07001/* -*- 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
27namespace ns3 {
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070028namespace ndn {
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070029
Alexander Afanasyeveae83ee2013-03-15 15:01:10 -070030class Interest;
31class ContentObject;
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070032
Alexander Afanasyev73f06f62013-03-15 15:41:38 -070033typedef Interest InterestHeader;
34typedef ContentObject ContentObjectHeader;
35
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070036/**
37 * \brief Helper class to decode ccnb formatted Ndn message
38 */
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070039class DecodingHelper
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070040{
41public:
42 /**
Alexander Afanasyeveae83ee2013-03-15 15:01:10 -070043 * \brief Deserialize Buffer::Iterator to NdnInterest
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070044 * @param start Buffer containing serialized Ndn message
Alexander Afanasyeveae83ee2013-03-15 15:01:10 -070045 * @param interest Pointer to the NdnInterest to hold deserialized value
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070046 * @return Number of bytes used for deserialization
47 */
48 static size_t
Alexander Afanasyeveae83ee2013-03-15 15:01:10 -070049 Deserialize (Buffer::Iterator start, Interest &interest);
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070050
51 /**
Alexander Afanasyeveae83ee2013-03-15 15:01:10 -070052 * \brief Deserialize Buffer::Iterator to NdnContentObject
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070053 * @param start Buffer containing serialized Ndn message
Alexander Afanasyeveae83ee2013-03-15 15:01:10 -070054 * @param contentObject Pointer to the NdnContentObject to hold deserialized value
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070055 * @return Number of bytes used for deserialization
56 */
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070057 // static size_t
Alexander Afanasyeveae83ee2013-03-15 15:01:10 -070058 // Deserialize (Buffer::Iterator start, ContentObject &contentObject);
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070059};
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070060
61} // namespace ndn
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070062} // namespace ns3
63
64#endif // _NDN_DECODING_HELPER_H_