blob: f6ab9fa265232901c5d4fda832ac25823ea45ca7 [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 {
28
29class NdnInterestHeader;
30class NdnContentObjectHeader;
31
32/**
33 * \brief Helper class to decode ccnb formatted Ndn message
34 */
35class NdnDecodingHelper
36{
37public:
38 /**
39 * \brief Deserialize Buffer::Iterator to NdnInterestHeader
40 * @param start Buffer containing serialized Ndn message
41 * @param interest Pointer to the NdnInterestHeader to hold deserialized value
42 * @return Number of bytes used for deserialization
43 */
44 static size_t
45 Deserialize (Buffer::Iterator start, NdnInterestHeader &interest);
46
47 /**
48 * \brief Deserialize Buffer::Iterator to NdnContentObjectHeader
49 * @param start Buffer containing serialized Ndn message
50 * @param contentObject Pointer to the NdnContentObjectHeader to hold deserialized value
51 * @return Number of bytes used for deserialization
52 */
53 static size_t
54 Deserialize (Buffer::Iterator start, NdnContentObjectHeader &contentObject);
55};
56} // namespace ns3
57
58#endif // _NDN_DECODING_HELPER_H_