blob: f9f8bb12d08c6a13824d3d924f023bc794bdb597 [file] [log] [blame]
Alexander Afanasyev996b4872012-07-17 17:07:56 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2/*
3 * Copyright (c) 2011 University of California, Los Angeles
4 *
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 *
18 * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
19 */
20#ifndef NDNSIM_NACKS_H
21#define NDNSIM_NACKS_H
22
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070023#include "ns3/ndn-forwarding-strategy.h"
Alexander Afanasyev996b4872012-07-17 17:07:56 -070024
25namespace ns3 {
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070026namespace ndn {
27namespace fw {
Alexander Afanasyev996b4872012-07-17 17:07:56 -070028
29/**
Alexander Afanasyev79206512013-07-27 16:49:12 -070030 * @ingroup ndn-fw
31 * @brief Implementation of experimental NACK messages (enables with EnableNACKs option)
Alexander Afanasyev996b4872012-07-17 17:07:56 -070032 */
33class Nacks :
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070034 public ForwardingStrategy
Alexander Afanasyev996b4872012-07-17 17:07:56 -070035{
Alexander Afanasyev31cb4692012-08-17 13:08:20 -070036private:
37 typedef ForwardingStrategy super;
Alexander Afanasyev042b4a72012-11-09 17:47:48 -080038
Alexander Afanasyev996b4872012-07-17 17:07:56 -070039public:
40 static TypeId
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070041 GetTypeId ();
Alexander Afanasyev042b4a72012-11-09 17:47:48 -080042
Alexander Afanasyev31cb4692012-08-17 13:08:20 -070043 // from super
Alexander Afanasyev996b4872012-07-17 17:07:56 -070044 virtual void
Alexander Afanasyev31cb4692012-08-17 13:08:20 -070045 OnInterest (Ptr<Face> face,
Alexander Afanasyevb989b122013-07-10 17:15:46 -070046 Ptr<Interest> interest);
Alexander Afanasyev996b4872012-07-17 17:07:56 -070047
48protected:
Alexander Afanasyev31cb4692012-08-17 13:08:20 -070049 // from super
Alexander Afanasyev996b4872012-07-17 17:07:56 -070050 virtual void
Alexander Afanasyev31cb4692012-08-17 13:08:20 -070051 DidReceiveDuplicateInterest (Ptr<Face> inFace,
Alexander Afanasyevb989b122013-07-10 17:15:46 -070052 Ptr<const Interest> interest,
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070053 Ptr<pit::Entry> pitEntry);
Alexander Afanasyev31cb4692012-08-17 13:08:20 -070054
55 // from super
Alexander Afanasyev996b4872012-07-17 17:07:56 -070056 virtual void
Alexander Afanasyev31cb4692012-08-17 13:08:20 -070057 DidExhaustForwardingOptions (Ptr<Face> inFace,
Alexander Afanasyevb989b122013-07-10 17:15:46 -070058 Ptr<const Interest> interest,
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070059 Ptr<pit::Entry> pitEntry);
Alexander Afanasyev996b4872012-07-17 17:07:56 -070060
61 virtual void
Alexander Afanasyev31cb4692012-08-17 13:08:20 -070062 OnNack (Ptr<Face> inFace,
Alexander Afanasyevb989b122013-07-10 17:15:46 -070063 Ptr<Interest> nack);
Alexander Afanasyev996b4872012-07-17 17:07:56 -070064
Alexander Afanasyev786936a2012-07-17 19:48:15 -070065 virtual void
Alexander Afanasyev31cb4692012-08-17 13:08:20 -070066 DidReceiveValidNack (Ptr<Face> inFace,
Alexander Afanasyev786936a2012-07-17 19:48:15 -070067 uint32_t nackCode,
Alexander Afanasyevb989b122013-07-10 17:15:46 -070068 Ptr<const Interest> nack,
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070069 Ptr<pit::Entry> pitEntry);
Alexander Afanasyev996b4872012-07-17 17:07:56 -070070
71protected:
72 bool m_nacksEnabled;
73
Alexander Afanasyeveae83ee2013-03-15 15:01:10 -070074 TracedCallback<Ptr<const Interest>,
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070075 Ptr<const Face> > m_outNacks; ///< @brief trace of outgoing NACKs
Alexander Afanasyev996b4872012-07-17 17:07:56 -070076
Alexander Afanasyeveae83ee2013-03-15 15:01:10 -070077 TracedCallback<Ptr<const Interest>,
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070078 Ptr<const Face> > m_inNacks; ///< @brief trace of incoming NACKs
Alexander Afanasyev996b4872012-07-17 17:07:56 -070079
Alexander Afanasyeveae83ee2013-03-15 15:01:10 -070080 TracedCallback<Ptr<const Interest>,
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070081 Ptr<const Face> > m_dropNacks; ///< @brief trace of dropped NACKs
Alexander Afanasyev996b4872012-07-17 17:07:56 -070082};
83
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070084} // namespace fw
85} // namespace ndn
Alexander Afanasyev996b4872012-07-17 17:07:56 -070086} // namespace ns3
87
88#endif // NDNSIM_NACKS