blob: 074f5abb5413d95e70c7de5c10dcb401537f7392 [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 {
26
27namespace ndnSIM {
28
29/**
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070030 * \ingroup ndn
31 * \brief Abstract base class for Ndn forwarding strategies
Alexander Afanasyev996b4872012-07-17 17:07:56 -070032 */
33class Nacks :
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070034 public NdnForwardingStrategy
Alexander Afanasyev996b4872012-07-17 17:07:56 -070035{
36public:
37 static TypeId
38 GetTypeId (void);
39
40 /**
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070041 * \brief Actual processing of incoming Ndn interests. Note, interests do not have payload
Alexander Afanasyev996b4872012-07-17 17:07:56 -070042 *
43 * Processing Interest packets
44 * @param face incoming face
45 * @param header deserialized Interest header
46 * @param packet original packet
47 */
48 virtual void
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070049 OnInterest (const Ptr<NdnFace> &face,
50 Ptr<NdnInterestHeader> &header,
Alexander Afanasyev996b4872012-07-17 17:07:56 -070051 const Ptr<const Packet> &p);
52
53protected:
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070054 // using NdnForwardingStrategy::PropagateInterest; // some strange c++ cheating
Alexander Afanasyev996b4872012-07-17 17:07:56 -070055
56 virtual void
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070057 DidReceiveDuplicateInterest (const Ptr<NdnFace> &face,
58 Ptr<NdnInterestHeader> &header,
Alexander Afanasyev996b4872012-07-17 17:07:56 -070059 const Ptr<const Packet> &packet,
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070060 Ptr<NdnPitEntry> pitEntry);
Alexander Afanasyev996b4872012-07-17 17:07:56 -070061
62 virtual void
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070063 DidExhaustForwardingOptions (const Ptr<NdnFace> &incomingFace,
64 Ptr<NdnInterestHeader> header,
Alexander Afanasyev996b4872012-07-17 17:07:56 -070065 const Ptr<const Packet> &packet,
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070066 Ptr<NdnPitEntry> pitEntry);
Alexander Afanasyev996b4872012-07-17 17:07:56 -070067
68 virtual void
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070069 OnNack (const Ptr<NdnFace> &face,
70 Ptr<NdnInterestHeader> &header,
Alexander Afanasyev996b4872012-07-17 17:07:56 -070071 const Ptr<const Packet> &p);
72
Alexander Afanasyev786936a2012-07-17 19:48:15 -070073 virtual void
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070074 DidReceiveValidNack (const Ptr<NdnFace> &incomingFace,
Alexander Afanasyev786936a2012-07-17 19:48:15 -070075 uint32_t nackCode,
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070076 Ptr<NdnPitEntry> pitEntry);
Alexander Afanasyev996b4872012-07-17 17:07:56 -070077
78protected:
79 bool m_nacksEnabled;
80
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070081 TracedCallback<Ptr<const NdnInterestHeader>,
82 Ptr<const NdnFace> > m_outNacks; ///< @brief trace of outgoing NACKs
Alexander Afanasyev996b4872012-07-17 17:07:56 -070083
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070084 TracedCallback<Ptr<const NdnInterestHeader>,
85 Ptr<const NdnFace> > m_inNacks; ///< @brief trace of incoming NACKs
Alexander Afanasyev996b4872012-07-17 17:07:56 -070086
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070087 TracedCallback<Ptr<const NdnInterestHeader>,
88 Ptr<const NdnFace> > m_dropNacks; ///< @brief trace of dropped NACKs
Alexander Afanasyev996b4872012-07-17 17:07:56 -070089
90private:
Alexander Afanasyev4aac5572012-08-09 10:49:55 -070091 typedef NdnForwardingStrategy super;
Alexander Afanasyev996b4872012-07-17 17:07:56 -070092};
93
94} // namespace ndnSIM
95} // namespace ns3
96
97#endif // NDNSIM_NACKS