blob: 4ddfb3eaafc7f39b7f256bff37d491f7bd889281 [file] [log] [blame]
Alexander Afanasyeva89bc102013-07-16 10:17:31 -07001/** -*- 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"
Alexander Afanasyevabb493a2013-07-19 15:31:33 -070019#include "ns3/ndnSIM/ndn.cxx/name.h"
20#include "ns3/ndnSIM/ndn.cxx/exclude.h"
Alexander Afanasyeva89bc102013-07-16 10:17:31 -070021
22NDN_NAMESPACE_BEGIN
23
24namespace wire {
25
26/**
27 * \brief Helper to encode ndnSIM wire elements
28 */
29class NdnSim
30{
31public:
32 /**
33 * @brief Append Name in ndnSIM encoding
34 * @param start Buffer to store serialized Interest
35 * @param name constant reference to Name object
36 *
37 * @returns written length
38 */
39 static size_t
40 SerializeName (Buffer::Iterator &start, const Name &name);
41
42 /**
43 * @brief Estimate size of Name in ndnSIM encoding
44 * @param name constant reference to Name object
45 * @returns estimated length
46 */
47 static size_t
48 SerializedSizeName (const Name &name);
49
50 /**
51 * @brief Deserialize Name from ndnSIM encodeing
52 * @param start Buffer that stores serialized Interest
53 * @param name Name object
54 */
55 static Ptr<Name>
56 DeserializeName (Buffer::Iterator &start);
Alexander Afanasyevabb493a2013-07-19 15:31:33 -070057
58
59 enum Selectors {
60 SelectorExclude = 0x01
61 };
62
63 enum ExcludeTypes {
64 ExcludeNameType = 0x01,
65 ExcludeAnyType = 0x02
66 };
67
68 /**
69 * @brief Append Exclude in ndnSIM encoding
70 * @param start Buffer to store serialized Interest
71 * @param exclude constant reference to Exclude object
72 *
73 * @returns written length
74 */
75 static size_t
76 SerializeExclude (Buffer::Iterator &start, const Exclude &exclude);
77
78 /**
79 * @brief Estimate size of Exclude in ndnSIM encoding
80 * @param exclude constant reference to Exclude object
81 * @returns estimated length
82 */
83 static size_t
84 SerializedSizeExclude (const Exclude &exclude);
85
86 /**
87 * @brief Deserialize Exclude from ndnSIM encodeing
88 * @param start Buffer that stores serialized Interest
89 * @param exclude Exclude object
90 */
91 static Ptr<Exclude>
92 DeserializeExclude (Buffer::Iterator &start);
Alexander Afanasyeva89bc102013-07-16 10:17:31 -070093}; // NdnSim
94
95} // wire
96
97NDN_NAMESPACE_END
98
99#endif // NDN_WIRE_NDNSIM_SYNTAX_H