blob: f247f2501ba850cf0dc8436c431b326c447d54f1 [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;
38
Alexander Afanasyev996b4872012-07-17 17:07:56 -070039public:
40 static TypeId
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070041 GetTypeId ();
Alexander Afanasyev996b4872012-07-17 17:07:56 -070042
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,
46 Ptr<const InterestHeader> header,
47 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,
53 Ptr<const InterestHeader> header,
54 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,
60 Ptr<const InterestHeader> header,
61 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,
66 Ptr<const InterestHeader> header,
67 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 Afanasyev2b4c9472012-08-09 15:00:38 -070072 Ptr<pit::Entry> pitEntry);
Alexander Afanasyev996b4872012-07-17 17:07:56 -070073
74protected:
75 bool m_nacksEnabled;
76
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070077 TracedCallback<Ptr<const InterestHeader>,
78 Ptr<const Face> > m_outNacks; ///< @brief trace of outgoing NACKs
Alexander Afanasyev996b4872012-07-17 17:07:56 -070079
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070080 TracedCallback<Ptr<const InterestHeader>,
81 Ptr<const Face> > m_inNacks; ///< @brief trace of incoming NACKs
Alexander Afanasyev996b4872012-07-17 17:07:56 -070082
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070083 TracedCallback<Ptr<const InterestHeader>,
84 Ptr<const Face> > m_dropNacks; ///< @brief trace of dropped NACKs
Alexander Afanasyev996b4872012-07-17 17:07:56 -070085};
86
Alexander Afanasyev2b4c9472012-08-09 15:00:38 -070087} // namespace fw
88} // namespace ndn
Alexander Afanasyev996b4872012-07-17 17:07:56 -070089} // namespace ns3
90
91#endif // NDNSIM_NACKS