blob: eeef73e4843e8587ddb218a7df9b1687a59d6307 [file] [log] [blame]
Alexander Afanasyevc74a6022011-08-15 20:01:35 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
Alexander Afanasyev98256102011-08-14 01:00:02 -07002/*
Ilya Moiseenko956d0542012-01-02 15:26:40 -08003 * Copyright (c) 2011 University of California, Los Angeles
Alexander Afanasyev98256102011-08-14 01:00:02 -07004 *
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 *
Ilya Moiseenko1cf6b0a2011-08-29 13:02:34 -070018 * Authors: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
19 Ilya Moiseenko <iliamo@cs.ucla.edu>
Alexander Afanasyev98256102011-08-14 01:00:02 -070020 */
Ilya Moiseenko1cf6b0a2011-08-29 13:02:34 -070021
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070022#ifndef NDN_APP_FACE_H
23#define NDN_APP_FACE_H
Alexander Afanasyev98256102011-08-14 01:00:02 -070024
Spyridon Mastorakis53e922f2014-10-17 17:29:26 -070025#include "ns3/ndnSIM/model/ndn-common.hpp"
Alexander Afanasyev82d5ffe2014-12-30 23:55:38 -080026#include "ns3/ndnSIM/NFD/daemon/face/local-face.hpp"
27#include "ns3/ndnSIM/model/ndn-face.hpp"
Alexander Afanasyev98256102011-08-14 01:00:02 -070028
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070029namespace ns3 {
Alexander Afanasyev98256102011-08-14 01:00:02 -070030
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -070031class Packet;
Alexander Afanasyev82d5ffe2014-12-30 23:55:38 -080032class Node;
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070033
34namespace ndn {
35
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070036class App;
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -070037
Alexander Afanasyev98256102011-08-14 01:00:02 -070038/**
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070039 * \ingroup ndn-face
40 * \brief Implementation of application Ndn face
Alexander Afanasyev98256102011-08-14 01:00:02 -070041 *
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070042 * This class defines basic functionality of Ndn face. Face is core
Alexander Afanasyev56f79ea2011-08-17 23:54:27 -070043 * component responsible for actual delivery of data packet to and
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070044 * from Ndn stack
Alexander Afanasyev98256102011-08-14 01:00:02 -070045 *
Alexander Afanasyev82d5ffe2014-12-30 23:55:38 -080046 * \see AppFace, NdnNetDeviceFace
Alexander Afanasyev98256102011-08-14 01:00:02 -070047 */
Alexander Afanasyev82d5ffe2014-12-30 23:55:38 -080048class AppFace : public nfd::LocalFace {
Alexander Afanasyev98256102011-08-14 01:00:02 -070049public:
Alexander Afanasyev56f79ea2011-08-17 23:54:27 -070050 /**
51 * \brief Default constructor
52 */
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080053 AppFace(Ptr<App> app);
Alexander Afanasyev82d5ffe2014-12-30 23:55:38 -080054
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070055 virtual ~AppFace();
Alexander Afanasyevbe55cf62014-12-20 17:51:09 -080056
Alexander Afanasyev82d5ffe2014-12-30 23:55:38 -080057public: // from nfd::Face
58 /**
59 * @brief Send Interest towards application
60 *
61 * @note To send Interest from application, use `AppFace::onReceiveInterest(interest)`
62 */
63 virtual void
64 sendInterest(const Interest& interest);
Alexander Afanasyev5bee19e2013-07-10 14:33:57 -070065
Alexander Afanasyev82d5ffe2014-12-30 23:55:38 -080066 /**
67 * @brief Send Data towards application
68 *
69 * @note To send Data from application, use `AppFace::onReceiveData(data)`
70 */
71 virtual void
72 sendData(const Data& data);
73
74 virtual void
75 close();
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -080076
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -070077private:
Alexander Afanasyev82d5ffe2014-12-30 23:55:38 -080078 Ptr<Node> m_node;
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070079 Ptr<App> m_app;
Alexander Afanasyev98256102011-08-14 01:00:02 -070080};
81
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070082} // namespace ndn
Alexander Afanasyev98256102011-08-14 01:00:02 -070083} // namespace ns3
84
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070085#endif // NDN_APP_FACE_H