blob: f4b6a97e5dc8e74bd6c8a7ee761654c50438df82 [file] [log] [blame]
Alexander Afanasyev016a5d82013-07-15 10:41:29 -07001/* -*- 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
30namespace ns3 {
31namespace ndn {
32
33/**
34 * \ingroup ndn-face
35 * \brief Implementation of UDP/IP NDN face
36 *
37 * \see ndn::AppFace, ndn::NetDeviceFace, ndn::Ipv4Face, ndn::TcpFace
38 */
39class UdpFace : public Face
40{
41public:
42 static TypeId
43 GetTypeId ();
Alexander Afanasyev016a5d82013-07-15 10:41:29 -070044
45 /**
46 * \brief Constructor
47 *
48 * @param node Node associated with the face
49 */
50 UdpFace (Ptr<Node> node, Ptr<Socket> socket, Ipv4Address address);
51 virtual ~UdpFace();
52
Alexander Afanasyev016a5d82013-07-15 10:41:29 -070053 Ipv4Address
54 GetAddress () const;
55
Alexander Afanasyev016a5d82013-07-15 10:41:29 -070056 virtual bool
Alexander Afanasyevd573af22013-07-27 12:57:08 -070057 ReceiveFromUdp (Ptr<const Packet> p);
Alexander Afanasyev016a5d82013-07-15 10:41:29 -070058
Alexander Afanasyevd573af22013-07-27 12:57:08 -070059 ////////////////////////////////////////////////////////////////////
60 // methods overloaded from ndn::Face
Alexander Afanasyev016a5d82013-07-15 10:41:29 -070061 virtual std::ostream&
62 Print (std::ostream &os) const;
Alexander Afanasyevd573af22013-07-27 12:57:08 -070063
64protected:
65 // also from ndn::Face
66 virtual bool
67 Send (Ptr<Packet> p);
Alexander Afanasyev016a5d82013-07-15 10:41:29 -070068
69private:
70 UdpFace (const UdpFace &); ///< \brief Disabled copy constructor
71 UdpFace& operator= (const UdpFace &); ///< \brief Disabled copy operator
72
Alexander Afanasyev016a5d82013-07-15 10:41:29 -070073private:
74 Ptr<Socket> m_socket;
75 Ipv4Address m_address;
Alexander Afanasyev016a5d82013-07-15 10:41:29 -070076};
77
78} // namespace ndn
79} // namespace ns3
80
81#endif // NDN_UDP_FACE_H