Alexander Afanasyev | 016a5d8 | 2013-07-15 10:41:29 -0700 | [diff] [blame] | 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 | |
| 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 | */ |
| 39 | class UdpFace : public Face |
| 40 | { |
| 41 | public: |
| 42 | static TypeId |
| 43 | GetTypeId (); |
Alexander Afanasyev | 016a5d8 | 2013-07-15 10:41:29 -0700 | [diff] [blame] | 44 | |
| 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 Afanasyev | 016a5d8 | 2013-07-15 10:41:29 -0700 | [diff] [blame] | 53 | Ipv4Address |
| 54 | GetAddress () const; |
| 55 | |
Alexander Afanasyev | 016a5d8 | 2013-07-15 10:41:29 -0700 | [diff] [blame] | 56 | virtual bool |
Alexander Afanasyev | d573af2 | 2013-07-27 12:57:08 -0700 | [diff] [blame^] | 57 | ReceiveFromUdp (Ptr<const Packet> p); |
Alexander Afanasyev | 016a5d8 | 2013-07-15 10:41:29 -0700 | [diff] [blame] | 58 | |
Alexander Afanasyev | d573af2 | 2013-07-27 12:57:08 -0700 | [diff] [blame^] | 59 | //////////////////////////////////////////////////////////////////// |
| 60 | // methods overloaded from ndn::Face |
Alexander Afanasyev | 016a5d8 | 2013-07-15 10:41:29 -0700 | [diff] [blame] | 61 | virtual std::ostream& |
| 62 | Print (std::ostream &os) const; |
Alexander Afanasyev | d573af2 | 2013-07-27 12:57:08 -0700 | [diff] [blame^] | 63 | |
| 64 | protected: |
| 65 | // also from ndn::Face |
| 66 | virtual bool |
| 67 | Send (Ptr<Packet> p); |
Alexander Afanasyev | 016a5d8 | 2013-07-15 10:41:29 -0700 | [diff] [blame] | 68 | |
| 69 | private: |
| 70 | UdpFace (const UdpFace &); ///< \brief Disabled copy constructor |
| 71 | UdpFace& operator= (const UdpFace &); ///< \brief Disabled copy operator |
| 72 | |
Alexander Afanasyev | 016a5d8 | 2013-07-15 10:41:29 -0700 | [diff] [blame] | 73 | private: |
| 74 | Ptr<Socket> m_socket; |
| 75 | Ipv4Address m_address; |
Alexander Afanasyev | 016a5d8 | 2013-07-15 10:41:29 -0700 | [diff] [blame] | 76 | }; |
| 77 | |
| 78 | } // namespace ndn |
| 79 | } // namespace ns3 |
| 80 | |
| 81 | #endif // NDN_UDP_FACE_H |