blob: 10b4dda9495783f37fc2a7bb5717562545fe608c [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
33/**
34 * \brief Helper class to decode ccnb formatted Ndn message
35 */
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070036class DecodingHelper
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070037{
38public:
39 /**
Alexander Afanasyeveae83ee2013-03-15 15:01:10 -070040 * \brief Deserialize Buffer::Iterator to NdnInterest
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070041 * @param start Buffer containing serialized Ndn message
Alexander Afanasyeveae83ee2013-03-15 15:01:10 -070042 * @param interest Pointer to the NdnInterest to hold deserialized value
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070043 * @return Number of bytes used for deserialization
44 */
45 static size_t
Alexander Afanasyeveae83ee2013-03-15 15:01:10 -070046 Deserialize (Buffer::Iterator start, Interest &interest);
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070047
48 /**
Alexander Afanasyeveae83ee2013-03-15 15:01:10 -070049 * \brief Deserialize Buffer::Iterator to NdnContentObject
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070050 * @param start Buffer containing serialized Ndn message
Alexander Afanasyeveae83ee2013-03-15 15:01:10 -070051 * @param contentObject Pointer to the NdnContentObject to hold deserialized value
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070052 * @return Number of bytes used for deserialization
53 */
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070054 // static size_t
Alexander Afanasyeveae83ee2013-03-15 15:01:10 -070055 // Deserialize (Buffer::Iterator start, ContentObject &contentObject);
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070056};
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070057
58} // namespace ndn
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070059} // namespace ns3
60
61#endif // _NDN_DECODING_HELPER_H_