Alexander Afanasyev | a89bc10 | 2013-07-16 10:17:31 -0700 | [diff] [blame] | 1 | /** -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /* |
| 3 | * Copyright (c) 2013, Regents of the University of California |
| 4 | * Alexander Afanasyev |
| 5 | * |
| 6 | * GNU 3.0 license, See the LICENSE file for more information |
| 7 | * |
| 8 | * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu> |
| 9 | */ |
| 10 | |
| 11 | #ifndef NDN_WIRE_NDNSIM_SYNTAX_H |
| 12 | #define NDN_WIRE_NDNSIM_SYNTAX_H |
| 13 | |
| 14 | #include "ns3/ptr.h" |
| 15 | #include "ns3/nstime.h" |
| 16 | #include "ns3/buffer.h" |
| 17 | |
| 18 | #include "ns3/ndn-common.h" |
| 19 | #include "ns3/ndn-name.h" |
| 20 | |
| 21 | NDN_NAMESPACE_BEGIN |
| 22 | |
| 23 | namespace wire { |
| 24 | |
| 25 | /** |
| 26 | * \brief Helper to encode ndnSIM wire elements |
| 27 | */ |
| 28 | class NdnSim |
| 29 | { |
| 30 | public: |
| 31 | /** |
| 32 | * @brief Append Name in ndnSIM encoding |
| 33 | * @param start Buffer to store serialized Interest |
| 34 | * @param name constant reference to Name object |
| 35 | * |
| 36 | * @returns written length |
| 37 | */ |
| 38 | static size_t |
| 39 | SerializeName (Buffer::Iterator &start, const Name &name); |
| 40 | |
| 41 | /** |
| 42 | * @brief Estimate size of Name in ndnSIM encoding |
| 43 | * @param name constant reference to Name object |
| 44 | * @returns estimated length |
| 45 | */ |
| 46 | static size_t |
| 47 | SerializedSizeName (const Name &name); |
| 48 | |
| 49 | /** |
| 50 | * @brief Deserialize Name from ndnSIM encodeing |
| 51 | * @param start Buffer that stores serialized Interest |
| 52 | * @param name Name object |
| 53 | */ |
| 54 | static Ptr<Name> |
| 55 | DeserializeName (Buffer::Iterator &start); |
| 56 | }; // NdnSim |
| 57 | |
| 58 | } // wire |
| 59 | |
| 60 | NDN_NAMESPACE_END |
| 61 | |
| 62 | #endif // NDN_WIRE_NDNSIM_SYNTAX_H |