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
ndn-l3-protocol.h
1 /* -*- 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_L3_PROTOCOL_H
22 #define NDN_L3_PROTOCOL_H
23 
24 #include <list>
25 #include <vector>
26 
27 #include "ns3/ptr.h"
28 #include "ns3/net-device.h"
29 #include "ns3/nstime.h"
30 
31 namespace ns3 {
32 
33 class Packet;
34 class NetDevice;
35 class Node;
36 class Header;
37 
38 namespace ndn {
39 
40 class Face;
41 class ForwardingStrategy;
42 
64 class L3Protocol :
65  public Object
66 {
67 public:
68  typedef std::vector<Ptr<Face> > FaceList;
69 
75  static TypeId GetTypeId ();
76 
77  static const uint16_t ETHERNET_FRAME_TYPE;
78  static const uint16_t IP_STACK_PORT;
79  // static const uint16_t IP_PROTOCOL_TYPE; ///< \brief IP protocol type of NDN
80 
84  L3Protocol();
85  virtual ~L3Protocol ();
86 
96  virtual uint32_t
97  AddFace (const Ptr<Face> &face);
98 
104  virtual uint32_t
105  GetNFaces () const;
106 
112  virtual Ptr<Face>
113  GetFace (uint32_t face) const;
114 
120  virtual Ptr<Face>
121  GetFaceById (uint32_t face) const;
122 
126  virtual void
127  RemoveFace (Ptr<Face> face);
128 
132  virtual Ptr<Face>
133  GetFaceByNetDevice (Ptr<NetDevice> netDevice) const;
134 
135 protected:
136  virtual void DoDispose (void);
137 
142  virtual void NotifyNewAggregate ();
143 
144 private:
145  L3Protocol(const L3Protocol &);
146  L3Protocol &operator = (const L3Protocol &);
147 
148 private:
149  uint32_t m_faceCounter;
150  FaceList m_faces;
151 
152  // These objects are aggregated, but for optimization, get them here
153  Ptr<Node> m_node;
154  Ptr<ForwardingStrategy> m_forwardingStrategy;
155 };
156 
157 } // namespace ndn
158 } // namespace ns3
159 
160 #endif /* NDN_L3_PROTOCOL_H */
virtual uint32_t AddFace(const Ptr< Face > &face)
Add face to Ndn stack.
virtual Ptr< Face > GetFace(uint32_t face) const
Get face by face index.
virtual uint32_t GetNFaces() const
Get current number of faces added to Ndn stack.
virtual void RemoveFace(Ptr< Face > face)
Remove face from ndn stack (remove callbacks)
static TypeId GetTypeId()
Interface ID.
Implementation network-layer of NDN stack.
static const uint16_t ETHERNET_FRAME_TYPE
Ethernet Frame Type of Ndn.
static const uint16_t IP_STACK_PORT
TCP/UDP port for NDN stack.
virtual Ptr< Face > GetFaceByNetDevice(Ptr< NetDevice > netDevice) const
Get face for NetDevice.
L3Protocol()
Default constructor.
virtual void NotifyNewAggregate()
This function will notify other components connected to the node that a new stack member is now conne...
virtual void DoDispose(void)
Do cleanup.
virtual Ptr< Face > GetFaceById(uint32_t face) const
Get face by face ID.