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
ccnb.h
1 
2 /*
3  * Copyright (c) 2013, Regents of the University of California
4  * Alexander Afanasyev
5  *
6  * BSD license, See the doc/LICENSE file for more information
7  *
8  * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
9  */
10 
11 #ifndef NDN_WIRE_CCNB_H
12 #define NDN_WIRE_CCNB_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 
20 namespace wire {
21 
25 namespace ccnb {
26 
32 class Interest : public Header
33 {
34 public:
35  Interest ();
36  Interest (Ptr<ndn::Interest> interest);
37 
38  Ptr<ndn::Interest>
39  GetInterest ();
40 
41  static Ptr<Packet>
42  ToWire (Ptr<const ndn::Interest> interest);
43 
44  static Ptr<ndn::Interest>
45  FromWire (Ptr<Packet> packet);
46 
48  // from Header
49  static TypeId GetTypeId (void);
50  virtual TypeId GetInstanceTypeId (void) const;
51  virtual void Print (std::ostream &os) const;
52  virtual uint32_t GetSerializedSize (void) const;
53  virtual void Serialize (Buffer::Iterator start) const;
54  virtual uint32_t Deserialize (Buffer::Iterator start);
55 
56 private:
57  Ptr<ndn::Interest> m_interest;
58 };
59 
60 
66 class Data : public Header
67 {
68 public:
69  Data ();
70  Data (Ptr<ndn::Data> data);
71 
72  Ptr<ndn::Data>
73  GetData ();
74 
75  static Ptr<Packet>
76  ToWire (Ptr<const ndn::Data> data);
77 
78  static Ptr<ndn::Data>
79  FromWire (Ptr<Packet> packet);
80 
81  // from Header
82  static TypeId GetTypeId (void);
83  virtual TypeId GetInstanceTypeId (void) const;
84  virtual void Print (std::ostream &os) const;
85  virtual uint32_t GetSerializedSize (void) const;
86  virtual void Serialize (Buffer::Iterator start) const;
87  virtual uint32_t Deserialize (Buffer::Iterator start);
88 
89 private:
90  Ptr<ndn::Data> m_data;
91 };
92 
93 } // ccnb
94 } // wire
95 
96 NDN_NAMESPACE_END
97 
98 #endif // NDN_WIRE_CCNB_H
Routines to serialize/deserialize NDN Data packet in ccnb format.
Definition: ccnb.h:66
Routines to serialize/deserialize NDN interest in ccnb format.
Definition: ccnb.h:32