Alexander Afanasyev | 996b487 | 2012-07-17 17:07:56 -0700 | [diff] [blame] | 1 | /* -*- 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 Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 23 | #include "ns3/ndn-forwarding-strategy.h" |
Alexander Afanasyev | 996b487 | 2012-07-17 17:07:56 -0700 | [diff] [blame] | 24 | |
| 25 | namespace ns3 { |
| 26 | |
| 27 | namespace ndnSIM { |
| 28 | |
| 29 | /** |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 30 | * \ingroup ndn |
| 31 | * \brief Abstract base class for Ndn forwarding strategies |
Alexander Afanasyev | 996b487 | 2012-07-17 17:07:56 -0700 | [diff] [blame] | 32 | */ |
| 33 | class Nacks : |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 34 | public NdnForwardingStrategy |
Alexander Afanasyev | 996b487 | 2012-07-17 17:07:56 -0700 | [diff] [blame] | 35 | { |
| 36 | public: |
| 37 | static TypeId |
| 38 | GetTypeId (void); |
| 39 | |
| 40 | /** |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 41 | * \brief Actual processing of incoming Ndn interests. Note, interests do not have payload |
Alexander Afanasyev | 996b487 | 2012-07-17 17:07:56 -0700 | [diff] [blame] | 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 |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 49 | OnInterest (const Ptr<NdnFace> &face, |
| 50 | Ptr<NdnInterestHeader> &header, |
Alexander Afanasyev | 996b487 | 2012-07-17 17:07:56 -0700 | [diff] [blame] | 51 | const Ptr<const Packet> &p); |
| 52 | |
| 53 | protected: |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 54 | // using NdnForwardingStrategy::PropagateInterest; // some strange c++ cheating |
Alexander Afanasyev | 996b487 | 2012-07-17 17:07:56 -0700 | [diff] [blame] | 55 | |
| 56 | virtual void |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 57 | DidReceiveDuplicateInterest (const Ptr<NdnFace> &face, |
| 58 | Ptr<NdnInterestHeader> &header, |
Alexander Afanasyev | 996b487 | 2012-07-17 17:07:56 -0700 | [diff] [blame] | 59 | const Ptr<const Packet> &packet, |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 60 | Ptr<NdnPitEntry> pitEntry); |
Alexander Afanasyev | 996b487 | 2012-07-17 17:07:56 -0700 | [diff] [blame] | 61 | |
| 62 | virtual void |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 63 | DidExhaustForwardingOptions (const Ptr<NdnFace> &incomingFace, |
| 64 | Ptr<NdnInterestHeader> header, |
Alexander Afanasyev | 996b487 | 2012-07-17 17:07:56 -0700 | [diff] [blame] | 65 | const Ptr<const Packet> &packet, |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 66 | Ptr<NdnPitEntry> pitEntry); |
Alexander Afanasyev | 996b487 | 2012-07-17 17:07:56 -0700 | [diff] [blame] | 67 | |
| 68 | virtual void |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 69 | OnNack (const Ptr<NdnFace> &face, |
| 70 | Ptr<NdnInterestHeader> &header, |
Alexander Afanasyev | 996b487 | 2012-07-17 17:07:56 -0700 | [diff] [blame] | 71 | const Ptr<const Packet> &p); |
| 72 | |
Alexander Afanasyev | 786936a | 2012-07-17 19:48:15 -0700 | [diff] [blame] | 73 | virtual void |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 74 | DidReceiveValidNack (const Ptr<NdnFace> &incomingFace, |
Alexander Afanasyev | 786936a | 2012-07-17 19:48:15 -0700 | [diff] [blame] | 75 | uint32_t nackCode, |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 76 | Ptr<NdnPitEntry> pitEntry); |
Alexander Afanasyev | 996b487 | 2012-07-17 17:07:56 -0700 | [diff] [blame] | 77 | |
| 78 | protected: |
| 79 | bool m_nacksEnabled; |
| 80 | |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 81 | TracedCallback<Ptr<const NdnInterestHeader>, |
| 82 | Ptr<const NdnFace> > m_outNacks; ///< @brief trace of outgoing NACKs |
Alexander Afanasyev | 996b487 | 2012-07-17 17:07:56 -0700 | [diff] [blame] | 83 | |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 84 | TracedCallback<Ptr<const NdnInterestHeader>, |
| 85 | Ptr<const NdnFace> > m_inNacks; ///< @brief trace of incoming NACKs |
Alexander Afanasyev | 996b487 | 2012-07-17 17:07:56 -0700 | [diff] [blame] | 86 | |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 87 | TracedCallback<Ptr<const NdnInterestHeader>, |
| 88 | Ptr<const NdnFace> > m_dropNacks; ///< @brief trace of dropped NACKs |
Alexander Afanasyev | 996b487 | 2012-07-17 17:07:56 -0700 | [diff] [blame] | 89 | |
| 90 | private: |
Alexander Afanasyev | 4aac557 | 2012-08-09 10:49:55 -0700 | [diff] [blame] | 91 | typedef NdnForwardingStrategy super; |
Alexander Afanasyev | 996b487 | 2012-07-17 17:07:56 -0700 | [diff] [blame] | 92 | }; |
| 93 | |
| 94 | } // namespace ndnSIM |
| 95 | } // namespace ns3 |
| 96 | |
| 97 | #endif // NDNSIM_NACKS |