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-udp-face.h
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2 /*
3  * Copyright (c) 2013 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_UDP_FACE_H
22 #define NDN_UDP_FACE_H
23 
24 #include "ns3/ndn-face.h"
25 #include "ns3/socket.h"
26 #include "ns3/ptr.h"
27 
28 #include <map>
29 
30 namespace ns3 {
31 namespace ndn {
32 
39 class UdpFace : public Face
40 {
41 public:
42  static TypeId
43  GetTypeId ();
44 
50  UdpFace (Ptr<Node> node, Ptr<Socket> socket, Ipv4Address address);
51  virtual ~UdpFace();
52 
53  Ipv4Address
54  GetAddress () const;
55 
56  virtual bool
57  ReceiveFromUdp (Ptr<const Packet> p);
58 
60  // methods overloaded from ndn::Face
61  virtual std::ostream&
62  Print (std::ostream &os) const;
63 
64 protected:
65  // also from ndn::Face
66  virtual bool
67  Send (Ptr<Packet> p);
68 
69 private:
70  UdpFace (const UdpFace &);
71  UdpFace& operator= (const UdpFace &);
72 
73 private:
74  Ptr<Socket> m_socket;
75  Ipv4Address m_address;
76 };
77 
78 } // namespace ndn
79 } // namespace ns3
80 
81 #endif // NDN_UDP_FACE_H
Virtual class defining NDN face.
Definition: ndn-face.h:58
Implementation of UDP/IP NDN face.
Definition: ndn-udp-face.h:39
UdpFace(Ptr< Node > node, Ptr< Socket > socket, Ipv4Address address)
Constructor.
Definition: ndn-udp-face.cc:56
virtual std::ostream & Print(std::ostream &os) const
Print information about the face into the stream.
virtual bool Send(Ptr< Packet > p)
Send packet down to the stack (towards app or network)
Definition: ndn-udp-face.cc:81