blob: 5ae65938da7274ae56d0f8db288fbb9d9aa00ee0 [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
58 *
59 * @note To send Interest from application, use `AppFace::onReceiveInterest(interest)`
60 */
61 virtual void
62 sendInterest(const Interest& interest);
Alexander Afanasyev5bee19e2013-07-10 14:33:57 -070063
Alexander Afanasyev82d5ffe2014-12-30 23:55:38 -080064 /**
65 * @brief Send Data towards application
66 *
67 * @note To send Data from application, use `AppFace::onReceiveData(data)`
68 */
69 virtual void
70 sendData(const Data& data);
71
72 virtual void
73 close();
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -080074
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -070075private:
Alexander Afanasyev82d5ffe2014-12-30 23:55:38 -080076 Ptr<Node> m_node;
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070077 Ptr<App> m_app;
Alexander Afanasyev98256102011-08-14 01:00:02 -070078};
79
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070080} // namespace ndn
Alexander Afanasyev98256102011-08-14 01:00:02 -070081} // namespace ns3
82
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070083#endif // NDN_APP_FACE_H