blob: 81e478c930e3df447b40ed53083f70e531c1b991 [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
23#include "ns3/ccnx-forwarding-strategy.h"
24
25namespace ns3 {
26
27namespace ndnSIM {
28
29/**
30 * \ingroup ccnx
31 * \brief Abstract base class for CCNx forwarding strategies
32 */
33class Nacks :
34 public CcnxForwardingStrategy
35{
36public:
37 static TypeId
38 GetTypeId (void);
39
40 /**
41 * \brief Actual processing of incoming CCNx interests. Note, interests do not have payload
42 *
43 * Processing Interest packets
44 * @param face incoming face
45 * @param header deserialized Interest header
46 * @param packet original packet
47 */
48 virtual void
49 OnInterest (const Ptr<CcnxFace> &face,
50 Ptr<CcnxInterestHeader> &header,
51 const Ptr<const Packet> &p);
52
53protected:
54 // using CcnxForwardingStrategy::PropagateInterest; // some strange c++ cheating
55
56 virtual void
57 DidReceiveDuplicateInterest (const Ptr<CcnxFace> &face,
58 Ptr<CcnxInterestHeader> &header,
59 const Ptr<const Packet> &packet,
60 Ptr<CcnxPitEntry> pitEntry);
61
62 virtual void
63 DidExhaustForwardingOptions (const Ptr<CcnxFace> &incomingFace,
64 Ptr<CcnxInterestHeader> header,
65 const Ptr<const Packet> &packet,
66 Ptr<CcnxPitEntry> pitEntry);
67
68 virtual void
69 OnNack (const Ptr<CcnxFace> &face,
70 Ptr<CcnxInterestHeader> &header,
71 const Ptr<const Packet> &p);
72
Alexander Afanasyev786936a2012-07-17 19:48:15 -070073 virtual void
74 DidReceiveValidNack (const Ptr<CcnxFace> &incomingFace,
75 uint32_t nackCode,
76 Ptr<CcnxPitEntry> pitEntry);
Alexander Afanasyev996b4872012-07-17 17:07:56 -070077
78protected:
79 bool m_nacksEnabled;
80
81 TracedCallback<Ptr<const CcnxInterestHeader>,
82 Ptr<const CcnxFace> > m_outNacks; ///< @brief trace of outgoing NACKs
83
84 TracedCallback<Ptr<const CcnxInterestHeader>,
85 Ptr<const CcnxFace> > m_inNacks; ///< @brief trace of incoming NACKs
86
87 TracedCallback<Ptr<const CcnxInterestHeader>,
88 Ptr<const CcnxFace> > m_dropNacks; ///< @brief trace of dropped NACKs
89
90private:
91 typedef CcnxForwardingStrategy super;
92};
93
94} // namespace ndnSIM
95} // namespace ns3
96
97#endif // NDNSIM_NACKS