blob: 19a9ecbf76b04c20097c76cfa8803b4d25f3ec22 [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 Afanasyev4aac5572012-08-09 10:49:55 -070030 * \ingroup ndn
Alexander Afanasyev31cb4692012-08-17 13:08:20 -070031 * \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 Afanasyeveae83ee2013-03-15 15:01:10 -070046 Ptr<const Interest> header,
Alexander Afanasyev31cb4692012-08-17 13:08:20 -070047 Ptr<const Packet> origPacket);
Alexander Afanasyev996b4872012-07-17 17:07:56 -070048
49protected:
Alexander Afanasyev31cb4692012-08-17 13:08:20 -070050 // from super
Alexander Afanasyev996b4872012-07-17 17:07:56 -070051 virtual void
Alexander Afanasyev31cb4692012-08-17 13:08:20 -070052 DidReceiveDuplicateInterest (Ptr<Face> inFace,
Alexander Afanasyeveae83ee2013-03-15 15:01:10 -070053 Ptr<const Interest> header,
Alexander Afanasyev31cb4692012-08-17 13:08:20 -070054 Ptr<const Packet> packet,
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070055 Ptr<pit::Entry> pitEntry);
Alexander Afanasyev31cb4692012-08-17 13:08:20 -070056
57 // from super
Alexander Afanasyev996b4872012-07-17 17:07:56 -070058 virtual void
Alexander Afanasyev31cb4692012-08-17 13:08:20 -070059 DidExhaustForwardingOptions (Ptr<Face> inFace,
Alexander Afanasyeveae83ee2013-03-15 15:01:10 -070060 Ptr<const Interest> header,
Alexander Afanasyev31cb4692012-08-17 13:08:20 -070061 Ptr<const Packet> packet,
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070062 Ptr<pit::Entry> pitEntry);
Alexander Afanasyev996b4872012-07-17 17:07:56 -070063
64 virtual void
Alexander Afanasyev31cb4692012-08-17 13:08:20 -070065 OnNack (Ptr<Face> inFace,
Alexander Afanasyeveae83ee2013-03-15 15:01:10 -070066 Ptr<const Interest> header,
Alexander Afanasyev31cb4692012-08-17 13:08:20 -070067 Ptr<const Packet> origPacket);
Alexander Afanasyev996b4872012-07-17 17:07:56 -070068
Alexander Afanasyev786936a2012-07-17 19:48:15 -070069 virtual void
Alexander Afanasyev31cb4692012-08-17 13:08:20 -070070 DidReceiveValidNack (Ptr<Face> inFace,
Alexander Afanasyev786936a2012-07-17 19:48:15 -070071 uint32_t nackCode,
Alexander Afanasyeveae83ee2013-03-15 15:01:10 -070072 Ptr<const Interest> header,
Alexander Afanasyev0484e772012-10-29 11:02:08 -070073 Ptr<const Packet> origPacket,
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070074 Ptr<pit::Entry> pitEntry);
Alexander Afanasyev996b4872012-07-17 17:07:56 -070075
76protected:
77 bool m_nacksEnabled;
78
Alexander Afanasyeveae83ee2013-03-15 15:01:10 -070079 TracedCallback<Ptr<const Interest>,
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070080 Ptr<const Face> > m_outNacks; ///< @brief trace of outgoing NACKs
Alexander Afanasyev996b4872012-07-17 17:07:56 -070081
Alexander Afanasyeveae83ee2013-03-15 15:01:10 -070082 TracedCallback<Ptr<const Interest>,
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070083 Ptr<const Face> > m_inNacks; ///< @brief trace of incoming NACKs
Alexander Afanasyev996b4872012-07-17 17:07:56 -070084
Alexander Afanasyeveae83ee2013-03-15 15:01:10 -070085 TracedCallback<Ptr<const Interest>,
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070086 Ptr<const Face> > m_dropNacks; ///< @brief trace of dropped NACKs
Alexander Afanasyev996b4872012-07-17 17:07:56 -070087};
88
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070089} // namespace fw
90} // namespace ndn
Alexander Afanasyev996b4872012-07-17 17:07:56 -070091} // namespace ns3
92
93#endif // NDNSIM_NACKS