NS-3 based Named Data Networking (NDN) simulator
ndnSIM: NDN, CCN, CCNx, content centric networks
API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
ndnsim.h
1 
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_H
12 #define NDN_WIRE_NDNSIM_H
13 
14 #include "ns3/ndn-common.h"
15 #include "ns3/ndn-interest.h"
16 #include "ns3/ndn-data.h"
17 
18 NDN_NAMESPACE_BEGIN
19 
23 namespace wire {
24 
28 namespace ndnSIM {
29 
74 class Interest : public Header
75 {
76 public:
77  Interest ();
78  Interest (Ptr<ndn::Interest> interest);
79 
80  Ptr<ndn::Interest>
81  GetInterest ();
82 
83  static Ptr<Packet>
84  ToWire (Ptr<const ndn::Interest> interest);
85 
86  static Ptr<ndn::Interest>
87  FromWire (Ptr<Packet> packet);
88 
89  // from Header
90  static TypeId GetTypeId (void);
91  virtual TypeId GetInstanceTypeId (void) const;
92  virtual void Print (std::ostream &os) const;
93  virtual uint32_t GetSerializedSize (void) const;
94  virtual void Serialize (Buffer::Iterator start) const;
95  virtual uint32_t Deserialize (Buffer::Iterator start);
96 
97 private:
98  Ptr<ndn::Interest> m_interest;
99 };
100 
135 class Data : public Header
136 {
137 public:
138  Data ();
139  Data (Ptr<ndn::Data> data);
140 
141  Ptr<ndn::Data>
142  GetData ();
143 
144  static Ptr<Packet>
145  ToWire (Ptr<const ndn::Data> data);
146 
147  static Ptr<ndn::Data>
148  FromWire (Ptr<Packet> packet);
149 
150  // from Header
151  static TypeId GetTypeId (void);
152  virtual TypeId GetInstanceTypeId (void) const;
153  virtual void Print (std::ostream &os) const;
154  virtual uint32_t GetSerializedSize (void) const;
155  virtual void Serialize (Buffer::Iterator start) const;
156  virtual uint32_t Deserialize (Buffer::Iterator start);
157 
158 private:
159  Ptr<ndn::Data> m_data;
160 };
161 
162 } // ndnSIM
163 } // wire
164 
165 NDN_NAMESPACE_END
166 
167 #endif // NDN_WIRE_NDNSIM_H
Routines to serialize/deserialize Interest packet in ndnSIM format.
Definition: ndnsim.h:74
Routines to serialize/deserialize Data packet in ndnSIM format.
Definition: ndnsim.h:135