blob: 3a90f11bde8f8818e61376cb9735559561277d81 [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
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070025#include "ndn-face.h"
Ilya Moiseenko1a8be032012-01-18 12:51:09 -080026#include "ns3/traced-callback.h"
Alexander Afanasyev98256102011-08-14 01:00:02 -070027
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070028namespace ns3 {
Alexander Afanasyev98256102011-08-14 01:00:02 -070029
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -070030class Packet;
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070031
32namespace ndn {
33
Alexander Afanasyeveae83ee2013-03-15 15:01:10 -070034class Interest;
35class ContentObject;
Alexander Afanasyev73f06f62013-03-15 15:41:38 -070036
37typedef Interest InterestHeader;
38typedef ContentObject ContentObjectHeader;
39
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070040class App;
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -070041
Alexander Afanasyev98256102011-08-14 01:00:02 -070042/**
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070043 * \ingroup ndn-face
44 * \brief Implementation of application Ndn face
Alexander Afanasyev98256102011-08-14 01:00:02 -070045 *
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070046 * This class defines basic functionality of Ndn face. Face is core
Alexander Afanasyev56f79ea2011-08-17 23:54:27 -070047 * component responsible for actual delivery of data packet to and
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070048 * from Ndn stack
Alexander Afanasyev98256102011-08-14 01:00:02 -070049 *
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070050 * \see AppFace, NdnNetDeviceFace, NdnIpv4Face, NdnUdpFace
Alexander Afanasyev98256102011-08-14 01:00:02 -070051 */
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070052class AppFace : public Face
Alexander Afanasyev98256102011-08-14 01:00:02 -070053{
54public:
Alexander Afanasyevcbe92ae2011-12-16 13:06:18 -080055 static TypeId
56 GetTypeId ();
57
Alexander Afanasyev56f79ea2011-08-17 23:54:27 -070058 /**
59 * \brief Default constructor
60 */
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070061 AppFace (Ptr<App> app);
62 virtual ~AppFace();
Alexander Afanasyev98256102011-08-14 01:00:02 -070063
Alexander Afanasyev56f79ea2011-08-17 23:54:27 -070064 ////////////////////////////////////////////////////////////////////
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070065 // methods overloaded from Face
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -070066 virtual void
67 RegisterProtocolHandler (ProtocolHandler handler);
Alexander Afanasyev98256102011-08-14 01:00:02 -070068
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -080069protected:
Alexander Afanasyev1c0248b2012-07-24 15:59:50 -070070 virtual bool
Alexander Afanasyev09c7deb2011-11-23 14:50:10 -080071 SendImpl (Ptr<Packet> p);
72
73public:
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -070074 virtual std::ostream&
75 Print (std::ostream &os) const;
Alexander Afanasyev56f79ea2011-08-17 23:54:27 -070076 ////////////////////////////////////////////////////////////////////
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -070077
Alexander Afanasyev98256102011-08-14 01:00:02 -070078private:
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070079 AppFace ();
80 AppFace (const AppFace &); ///< \brief Disabled copy constructor
81 AppFace& operator= (const AppFace &); ///< \brief Disabled copy operator
Alexander Afanasyevc5a23e22011-09-07 00:37:36 -070082
83private:
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070084 Ptr<App> m_app;
Alexander Afanasyev98256102011-08-14 01:00:02 -070085};
86
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070087} // namespace ndn
Alexander Afanasyev98256102011-08-14 01:00:02 -070088} // namespace ns3
89
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070090#endif // NDN_APP_FACE_H