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-net-device-face.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  * Authors: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
19  */
20 
21 #ifndef NDN_NET_DEVICE_FACE_H
22 #define NDN_NET_DEVICE_FACE_H
23 
24 #include "ndn-face.h"
25 #include "ns3/net-device.h"
26 
27 namespace ns3 {
28 namespace ndn {
29 
44 class NetDeviceFace : public Face
45 {
46 public:
47  static TypeId
48  GetTypeId ();
49 
57  NetDeviceFace (Ptr<Node> node, const Ptr<NetDevice> &netDevice);
58  virtual ~NetDeviceFace();
59 
61  // methods overloaded from NdnFace
62  virtual void
63  RegisterProtocolHandlers (const InterestHandler &interestHandler, const DataHandler &dataHandler);
64 
65  virtual void
67 
68 protected:
69  virtual bool
70  Send (Ptr<Packet> p);
71 
72 public:
76  virtual std::ostream&
77  Print (std::ostream &os) const;
79 
85  Ptr<NetDevice> GetNetDevice () const;
86 
87 private:
88  NetDeviceFace (const NetDeviceFace &);
89  NetDeviceFace& operator= (const NetDeviceFace &);
90 
92  void ReceiveFromNetDevice (Ptr<NetDevice> device,
93  Ptr<const Packet> p,
94  uint16_t protocol,
95  const Address &from,
96  const Address &to,
97  NetDevice::PacketType packetType);
98 
99 private:
100  Ptr<NetDevice> m_netDevice;
101 };
102 
103 } // namespace ndn
104 } // namespace ns3
105 
106 #endif //NDN_NET_DEVICE_FACE_H
virtual bool Send(Ptr< Packet > p)
Send packet down to the stack (towards app or network)
virtual std::ostream & Print(std::ostream &os) const
Print out name of the NdnFace to the stream.
virtual void RegisterProtocolHandlers(const InterestHandler &interestHandler, const DataHandler &dataHandler)
Register callback to call when new packet arrives on the face.
Virtual class defining NDN face.
Definition: ndn-face.h:58
Implementation of layer-2 (Ethernet) Ndn face.
Callback< void, Ptr< Face >, Ptr< Interest > > InterestHandler
NDN protocol handlers.
Definition: ndn-face.h:71
NetDeviceFace(Ptr< Node > node, const Ptr< NetDevice > &netDevice)
Constructor.
virtual void UnRegisterProtocolHandlers()
Un-Register callback to call when new packet arrives on the face.
Ptr< NetDevice > GetNetDevice() const
Get NetDevice associated with the face.