Alexander Afanasyev | 60a7b62 | 2014-12-20 17:04:07 -0800 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
| 3 | * Copyright (c) 2011-2015 Regents of the University of California. |
Alexander Afanasyev | 9825610 | 2011-08-14 01:00:02 -0700 | [diff] [blame] | 4 | * |
Alexander Afanasyev | 60a7b62 | 2014-12-20 17:04:07 -0800 | [diff] [blame] | 5 | * This file is part of ndnSIM. See AUTHORS for complete list of ndnSIM authors and |
| 6 | * contributors. |
Alexander Afanasyev | 9825610 | 2011-08-14 01:00:02 -0700 | [diff] [blame] | 7 | * |
Alexander Afanasyev | 60a7b62 | 2014-12-20 17:04:07 -0800 | [diff] [blame] | 8 | * ndnSIM is free software: you can redistribute it and/or modify it under the terms |
| 9 | * of the GNU General Public License as published by the Free Software Foundation, |
| 10 | * either version 3 of the License, or (at your option) any later version. |
Alexander Afanasyev | 9825610 | 2011-08-14 01:00:02 -0700 | [diff] [blame] | 11 | * |
Alexander Afanasyev | 60a7b62 | 2014-12-20 17:04:07 -0800 | [diff] [blame] | 12 | * ndnSIM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
| 13 | * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
| 14 | * PURPOSE. See the GNU General Public License for more details. |
Alexander Afanasyev | 9825610 | 2011-08-14 01:00:02 -0700 | [diff] [blame] | 15 | * |
Alexander Afanasyev | 60a7b62 | 2014-12-20 17:04:07 -0800 | [diff] [blame] | 16 | * You should have received a copy of the GNU General Public License along with |
| 17 | * ndnSIM, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>. |
| 18 | **/ |
Ilya Moiseenko | 1cf6b0a | 2011-08-29 13:02:34 -0700 | [diff] [blame] | 19 | |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 20 | #ifndef NDN_APP_FACE_H |
| 21 | #define NDN_APP_FACE_H |
Alexander Afanasyev | 9825610 | 2011-08-14 01:00:02 -0700 | [diff] [blame] | 22 | |
Spyridon Mastorakis | 53e922f | 2014-10-17 17:29:26 -0700 | [diff] [blame] | 23 | #include "ns3/ndnSIM/model/ndn-common.hpp" |
Alexander Afanasyev | 82d5ffe | 2014-12-30 23:55:38 -0800 | [diff] [blame] | 24 | #include "ns3/ndnSIM/NFD/daemon/face/local-face.hpp" |
| 25 | #include "ns3/ndnSIM/model/ndn-face.hpp" |
Alexander Afanasyev | 9825610 | 2011-08-14 01:00:02 -0700 | [diff] [blame] | 26 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 27 | namespace ns3 { |
Alexander Afanasyev | 9825610 | 2011-08-14 01:00:02 -0700 | [diff] [blame] | 28 | |
Alexander Afanasyev | c5a23e2 | 2011-09-07 00:37:36 -0700 | [diff] [blame] | 29 | class Packet; |
Alexander Afanasyev | 82d5ffe | 2014-12-30 23:55:38 -0800 | [diff] [blame] | 30 | class Node; |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 31 | |
| 32 | namespace ndn { |
| 33 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 34 | class App; |
Alexander Afanasyev | c5a23e2 | 2011-09-07 00:37:36 -0700 | [diff] [blame] | 35 | |
Alexander Afanasyev | 9825610 | 2011-08-14 01:00:02 -0700 | [diff] [blame] | 36 | /** |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 37 | * \ingroup ndn-face |
| 38 | * \brief Implementation of application Ndn face |
Alexander Afanasyev | 9825610 | 2011-08-14 01:00:02 -0700 | [diff] [blame] | 39 | * |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 40 | * This class defines basic functionality of Ndn face. Face is core |
Alexander Afanasyev | 56f79ea | 2011-08-17 23:54:27 -0700 | [diff] [blame] | 41 | * component responsible for actual delivery of data packet to and |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 42 | * from Ndn stack |
Alexander Afanasyev | 9825610 | 2011-08-14 01:00:02 -0700 | [diff] [blame] | 43 | * |
Alexander Afanasyev | 82d5ffe | 2014-12-30 23:55:38 -0800 | [diff] [blame] | 44 | * \see AppFace, NdnNetDeviceFace |
Alexander Afanasyev | 9825610 | 2011-08-14 01:00:02 -0700 | [diff] [blame] | 45 | */ |
Alexander Afanasyev | 82d5ffe | 2014-12-30 23:55:38 -0800 | [diff] [blame] | 46 | class AppFace : public nfd::LocalFace { |
Alexander Afanasyev | 9825610 | 2011-08-14 01:00:02 -0700 | [diff] [blame] | 47 | public: |
Alexander Afanasyev | 56f79ea | 2011-08-17 23:54:27 -0700 | [diff] [blame] | 48 | /** |
| 49 | * \brief Default constructor |
| 50 | */ |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 51 | AppFace(Ptr<App> app); |
Alexander Afanasyev | 82d5ffe | 2014-12-30 23:55:38 -0800 | [diff] [blame] | 52 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 53 | virtual ~AppFace(); |
Alexander Afanasyev | be55cf6 | 2014-12-20 17:51:09 -0800 | [diff] [blame] | 54 | |
Alexander Afanasyev | 82d5ffe | 2014-12-30 23:55:38 -0800 | [diff] [blame] | 55 | public: // from nfd::Face |
| 56 | /** |
| 57 | * @brief Send Interest towards application |
Alexander Afanasyev | 82d5ffe | 2014-12-30 23:55:38 -0800 | [diff] [blame] | 58 | */ |
| 59 | virtual void |
| 60 | sendInterest(const Interest& interest); |
Alexander Afanasyev | 5bee19e | 2013-07-10 14:33:57 -0700 | [diff] [blame] | 61 | |
Alexander Afanasyev | 82d5ffe | 2014-12-30 23:55:38 -0800 | [diff] [blame] | 62 | /** |
| 63 | * @brief Send Data towards application |
Alexander Afanasyev | 82d5ffe | 2014-12-30 23:55:38 -0800 | [diff] [blame] | 64 | */ |
| 65 | virtual void |
| 66 | sendData(const Data& data); |
| 67 | |
Alexander Afanasyev | c3c7f04 | 2015-08-21 11:38:00 -0700 | [diff] [blame] | 68 | /** |
| 69 | * @brief Send Interest towards NFD |
| 70 | */ |
| 71 | void |
| 72 | onReceiveInterest(const Interest& interest); |
| 73 | |
| 74 | /** |
| 75 | * @brief Send Data towards NFD |
| 76 | */ |
| 77 | void |
| 78 | onReceiveData(const Data& data); |
| 79 | |
Alexander Afanasyev | 82d5ffe | 2014-12-30 23:55:38 -0800 | [diff] [blame] | 80 | virtual void |
| 81 | close(); |
Alexander Afanasyev | 09c7deb | 2011-11-23 14:50:10 -0800 | [diff] [blame] | 82 | |
Alexander Afanasyev | c5a23e2 | 2011-09-07 00:37:36 -0700 | [diff] [blame] | 83 | private: |
Alexander Afanasyev | 82d5ffe | 2014-12-30 23:55:38 -0800 | [diff] [blame] | 84 | Ptr<Node> m_node; |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 85 | Ptr<App> m_app; |
Alexander Afanasyev | 9825610 | 2011-08-14 01:00:02 -0700 | [diff] [blame] | 86 | }; |
| 87 | |
Alexander Afanasyev | 2b4c947 | 2012-08-09 15:00:38 -0700 | [diff] [blame] | 88 | } // namespace ndn |
Alexander Afanasyev | 9825610 | 2011-08-14 01:00:02 -0700 | [diff] [blame] | 89 | } // namespace ns3 |
| 90 | |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 91 | #endif // NDN_APP_FACE_H |