blob: ab3de90a7333a4b8ba43c8f7d947ae02b3461d4f [file] [log] [blame]
Alexander Afanasyev60a7b622014-12-20 17:04:07 -08001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (c) 2011-2015 Regents of the University of California.
Alexander Afanasyev98256102011-08-14 01:00:02 -07004 *
Alexander Afanasyev60a7b622014-12-20 17:04:07 -08005 * This file is part of ndnSIM. See AUTHORS for complete list of ndnSIM authors and
6 * contributors.
Alexander Afanasyev98256102011-08-14 01:00:02 -07007 *
Alexander Afanasyev60a7b622014-12-20 17:04:07 -08008 * 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 Afanasyev98256102011-08-14 01:00:02 -070011 *
Alexander Afanasyev60a7b622014-12-20 17:04:07 -080012 * 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 Afanasyev98256102011-08-14 01:00:02 -070015 *
Alexander Afanasyev60a7b622014-12-20 17:04:07 -080016 * 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 Moiseenko1cf6b0a2011-08-29 13:02:34 -070019
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070020#ifndef NDN_APP_FACE_H
21#define NDN_APP_FACE_H
Alexander Afanasyev98256102011-08-14 01:00:02 -070022
Spyridon Mastorakis53e922f2014-10-17 17:29:26 -070023#include "ns3/ndnSIM/model/ndn-common.hpp"
Alexander Afanasyev82d5ffe2014-12-30 23:55:38 -080024#include "ns3/ndnSIM/NFD/daemon/face/local-face.hpp"
25#include "ns3/ndnSIM/model/ndn-face.hpp"
Alexander Afanasyev98256102011-08-14 01:00:02 -070026
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070027namespace ns3 {
Alexander Afanasyev98256102011-08-14 01:00:02 -070028
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -070029class Packet;
Alexander Afanasyev82d5ffe2014-12-30 23:55:38 -080030class Node;
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070031
32namespace ndn {
33
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070034class App;
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -070035
Alexander Afanasyev98256102011-08-14 01:00:02 -070036/**
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070037 * \ingroup ndn-face
38 * \brief Implementation of application Ndn face
Alexander Afanasyev98256102011-08-14 01:00:02 -070039 *
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070040 * This class defines basic functionality of Ndn face. Face is core
Alexander Afanasyev56f79ea2011-08-17 23:54:27 -070041 * component responsible for actual delivery of data packet to and
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070042 * from Ndn stack
Alexander Afanasyev98256102011-08-14 01:00:02 -070043 *
Alexander Afanasyev82d5ffe2014-12-30 23:55:38 -080044 * \see AppFace, NdnNetDeviceFace
Alexander Afanasyev98256102011-08-14 01:00:02 -070045 */
Alexander Afanasyev82d5ffe2014-12-30 23:55:38 -080046class AppFace : public nfd::LocalFace {
Alexander Afanasyev98256102011-08-14 01:00:02 -070047public:
Alexander Afanasyev56f79ea2011-08-17 23:54:27 -070048 /**
49 * \brief Default constructor
50 */
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080051 AppFace(Ptr<App> app);
Alexander Afanasyev82d5ffe2014-12-30 23:55:38 -080052
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070053 virtual ~AppFace();
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080054
Alexander Afanasyev82d5ffe2014-12-30 23:55:38 -080055public: // from nfd::Face
56 /**
57 * @brief Send Interest towards application
Alexander Afanasyev82d5ffe2014-12-30 23:55:38 -080058 */
59 virtual void
60 sendInterest(const Interest& interest);
Alexander Afanasyev5bee19e2013-07-10 14:33:57 -070061
Alexander Afanasyev82d5ffe2014-12-30 23:55:38 -080062 /**
63 * @brief Send Data towards application
Alexander Afanasyev82d5ffe2014-12-30 23:55:38 -080064 */
65 virtual void
66 sendData(const Data& data);
67
Alexander Afanasyevc3c7f042015-08-21 11:38:00 -070068 /**
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 Afanasyev82d5ffe2014-12-30 23:55:38 -080080 virtual void
81 close();
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -080082
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -070083private:
Alexander Afanasyev82d5ffe2014-12-30 23:55:38 -080084 Ptr<Node> m_node;
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070085 Ptr<App> m_app;
Alexander Afanasyev98256102011-08-14 01:00:02 -070086};
87
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070088} // namespace ndn
Alexander Afanasyev98256102011-08-14 01:00:02 -070089} // namespace ns3
90
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070091#endif // NDN_APP_FACE_H