blob: ec97c9977988f3bd11712826324adcc7d16125b7 [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
Spyridon Mastorakis53e922f2014-10-17 17:29:26 -070024#include "ns3/ndnSIM/model/ndn-common.hpp"
25
Alexander Afanasyev0c395372014-12-20 15:54:02 -080026#include "ns3/ndn-face.hpp"
Alexander Afanasyev016a5d82013-07-15 10:41:29 -070027#include "ns3/socket.h"
28#include "ns3/ptr.h"
29
30#include <map>
31
32namespace ns3 {
33namespace ndn {
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080034
Alexander Afanasyev016a5d82013-07-15 10:41:29 -070035/**
36 * \ingroup ndn-face
37 * \brief Implementation of UDP/IP NDN face
38 *
39 * \see ndn::AppFace, ndn::NetDeviceFace, ndn::Ipv4Face, ndn::TcpFace
40 */
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080041class UdpFace : public Face {
Alexander Afanasyev016a5d82013-07-15 10:41:29 -070042public:
43 static TypeId
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080044 GetTypeId();
45
Alexander Afanasyev016a5d82013-07-15 10:41:29 -070046 /**
47 * \brief Constructor
48 *
49 * @param node Node associated with the face
50 */
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080051 UdpFace(Ptr<Node> node, Ptr<Socket> socket, Ipv4Address address);
Alexander Afanasyev016a5d82013-07-15 10:41:29 -070052 virtual ~UdpFace();
53
Alexander Afanasyev016a5d82013-07-15 10:41:29 -070054 Ipv4Address
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080055 GetAddress() const;
Alexander Afanasyev016a5d82013-07-15 10:41:29 -070056
Alexander Afanasyev016a5d82013-07-15 10:41:29 -070057 virtual bool
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080058 ReceiveFromUdp(Ptr<const Packet> p);
Alexander Afanasyev016a5d82013-07-15 10:41:29 -070059
Alexander Afanasyevd573af22013-07-27 12:57:08 -070060 ////////////////////////////////////////////////////////////////////
61 // methods overloaded from ndn::Face
Alexander Afanasyev016a5d82013-07-15 10:41:29 -070062 virtual std::ostream&
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080063 Print(std::ostream& os) const;
Alexander Afanasyevd573af22013-07-27 12:57:08 -070064
65protected:
66 // also from ndn::Face
67 virtual bool
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080068 Send(Ptr<Packet> p);
Alexander Afanasyev016a5d82013-07-15 10:41:29 -070069
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080070private:
71 UdpFace(const UdpFace&); ///< \brief Disabled copy constructor
72 UdpFace&
73 operator=(const UdpFace&); ///< \brief Disabled copy operator
Alexander Afanasyev016a5d82013-07-15 10:41:29 -070074
Alexander Afanasyev016a5d82013-07-15 10:41:29 -070075private:
76 Ptr<Socket> m_socket;
77 Ipv4Address m_address;
Alexander Afanasyev016a5d82013-07-15 10:41:29 -070078};
79
80} // namespace ndn
81} // namespace ns3
82
83#endif // NDN_UDP_FACE_H