Alexander Afanasyev | c74a602 | 2011-08-15 20:01:35 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
Alexander Afanasyev | 9825610 | 2011-08-14 01:00:02 -0700 | [diff] [blame] | 2 | /* |
Ilya Moiseenko | 25f7d4d | 2011-09-29 18:41:06 -0700 | [diff] [blame] | 3 | * Copyright (c) 2011 University of California, Los Angeles |
Alexander Afanasyev | 9825610 | 2011-08-14 01:00:02 -0700 | [diff] [blame] | 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 |
Alexander Afanasyev | cf133f0 | 2011-09-06 12:13:48 -0700 | [diff] [blame] | 17 | * |
Ilya Moiseenko | 25f7d4d | 2011-09-29 18:41:06 -0700 | [diff] [blame] | 18 | * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu> |
| 19 | * Ilya Moiseenko <iliamo@cs.ucla.edu> |
Alexander Afanasyev | 9825610 | 2011-08-14 01:00:02 -0700 | [diff] [blame] | 20 | */ |
Alexander Afanasyev | c74a602 | 2011-08-15 20:01:35 -0700 | [diff] [blame] | 21 | #ifndef CCNX_FORWARDING_STRATEGY_H |
| 22 | #define CCNX_FORWARDING_STRATEGY_H |
Alexander Afanasyev | 9825610 | 2011-08-14 01:00:02 -0700 | [diff] [blame] | 23 | |
| 24 | #include "ns3/packet.h" |
| 25 | #include "ns3/callback.h" |
| 26 | #include "ns3/object.h" |
Alexander Afanasyev | f377b33 | 2011-12-16 15:32:12 -0800 | [diff] [blame] | 27 | #include "ns3/traced-callback.h" |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 28 | |
Alexander Afanasyev | 9825610 | 2011-08-14 01:00:02 -0700 | [diff] [blame] | 29 | namespace ns3 { |
| 30 | |
Alexander Afanasyev | 9825610 | 2011-08-14 01:00:02 -0700 | [diff] [blame] | 31 | class CcnxFace; |
Alexander Afanasyev | cf133f0 | 2011-09-06 12:13:48 -0700 | [diff] [blame] | 32 | class CcnxInterestHeader; |
Alexander Afanasyev | f377b33 | 2011-12-16 15:32:12 -0800 | [diff] [blame] | 33 | class CcnxPit; |
| 34 | class CcnxPitEntry; |
Alexander Afanasyev | e9c9d72 | 2012-01-19 16:59:30 -0800 | [diff] [blame] | 35 | class CcnxFibFaceMetric; |
Alexander Afanasyev | 9825610 | 2011-08-14 01:00:02 -0700 | [diff] [blame] | 36 | |
| 37 | /** |
Alexander Afanasyev | cf133f0 | 2011-09-06 12:13:48 -0700 | [diff] [blame] | 38 | * \ingroup ccnx |
Alexander Afanasyev | a5bbe0e | 2011-11-22 17:28:39 -0800 | [diff] [blame] | 39 | * \brief Abstract base class for CCNx forwarding strategies |
Alexander Afanasyev | 9825610 | 2011-08-14 01:00:02 -0700 | [diff] [blame] | 40 | */ |
Alexander Afanasyev | c74a602 | 2011-08-15 20:01:35 -0700 | [diff] [blame] | 41 | class CcnxForwardingStrategy : public Object |
Alexander Afanasyev | 9825610 | 2011-08-14 01:00:02 -0700 | [diff] [blame] | 42 | { |
| 43 | public: |
Alexander Afanasyev | a5bbe0e | 2011-11-22 17:28:39 -0800 | [diff] [blame] | 44 | static TypeId GetTypeId (void); |
| 45 | |
| 46 | /** |
| 47 | * @brief Default constructor |
| 48 | */ |
| 49 | CcnxForwardingStrategy (); |
| 50 | virtual ~CcnxForwardingStrategy (); |
| 51 | |
| 52 | /** |
Ilya Moiseenko | 332add0 | 2011-12-24 17:21:25 -0800 | [diff] [blame] | 53 | * @brief Base method to propagate the interest according to the forwarding strategy |
Alexander Afanasyev | a5bbe0e | 2011-11-22 17:28:39 -0800 | [diff] [blame] | 54 | * |
| 55 | * @param pitEntry Reference to PIT entry (reference to corresponding FIB entry inside) |
| 56 | * @param incomingFace Incoming face |
| 57 | * @param header CcnxInterestHeader |
| 58 | * @param packet Original Interest packet |
| 59 | * @param sendCallback Send callback |
| 60 | * |
| 61 | * @return true if interest was successfully propagated, false if all options have failed |
| 62 | */ |
Alexander Afanasyev | 4fa5e84 | 2011-11-21 13:38:39 -0800 | [diff] [blame] | 63 | virtual bool |
Alexander Afanasyev | a5bbe0e | 2011-11-22 17:28:39 -0800 | [diff] [blame] | 64 | PropagateInterest (const CcnxPitEntry &pitEntry, |
Alexander Afanasyev | 4fa5e84 | 2011-11-21 13:38:39 -0800 | [diff] [blame] | 65 | const Ptr<CcnxFace> &incomingFace, |
| 66 | Ptr<CcnxInterestHeader> &header, |
Alexander Afanasyev | 0a61c34 | 2011-12-06 12:48:55 -0800 | [diff] [blame] | 67 | const Ptr<const Packet> &packet) = 0; |
Ilya Moiseenko | 25f7d4d | 2011-09-29 18:41:06 -0700 | [diff] [blame] | 68 | |
Alexander Afanasyev | a5bbe0e | 2011-11-22 17:28:39 -0800 | [diff] [blame] | 69 | /** |
| 70 | * @brief Set link to PIT for the forwarding strategy |
| 71 | * |
| 72 | * @param pit pointer to PIT |
| 73 | */ |
| 74 | void |
| 75 | SetPit (Ptr<CcnxPit> pit); |
Alexander Afanasyev | f377b33 | 2011-12-16 15:32:12 -0800 | [diff] [blame] | 76 | |
Alexander Afanasyev | 0a61c34 | 2011-12-06 12:48:55 -0800 | [diff] [blame] | 77 | protected: |
| 78 | /** |
Ilya Moiseenko | 332add0 | 2011-12-24 17:21:25 -0800 | [diff] [blame] | 79 | * @brief Propagate interest via a green interface. Fail, if no green interfaces available |
Alexander Afanasyev | 0a61c34 | 2011-12-06 12:48:55 -0800 | [diff] [blame] | 80 | * |
| 81 | * @param pitEntry Reference to PIT entry (reference to corresponding FIB entry inside) |
| 82 | * @param incomingFace Incoming face |
| 83 | * @param header CcnxInterestHeader |
| 84 | * @param packet Original Interest packet |
| 85 | * @param sendCallback Send callback |
| 86 | * @return true if interest was successfully propagated, false if all options have failed |
| 87 | * |
| 88 | * \see PropagateInterest |
| 89 | */ |
| 90 | bool |
| 91 | PropagateInterestViaGreen (const CcnxPitEntry &pitEntry, |
| 92 | const Ptr<CcnxFace> &incomingFace, |
| 93 | Ptr<CcnxInterestHeader> &header, |
| 94 | const Ptr<const Packet> &packet); |
Alexander Afanasyev | f377b33 | 2011-12-16 15:32:12 -0800 | [diff] [blame] | 95 | |
| 96 | TracedCallback<Ptr<const CcnxInterestHeader>, Ptr<const CcnxFace> > m_transmittedInterestsTrace; |
Alexander Afanasyev | 0a61c34 | 2011-12-06 12:48:55 -0800 | [diff] [blame] | 97 | |
Alexander Afanasyev | a5bbe0e | 2011-11-22 17:28:39 -0800 | [diff] [blame] | 98 | protected: |
Ilya Moiseenko | ea27f4e | 2011-10-28 13:19:07 -0700 | [diff] [blame] | 99 | Ptr<CcnxPit> m_pit; |
Alexander Afanasyev | 9825610 | 2011-08-14 01:00:02 -0700 | [diff] [blame] | 100 | }; |
| 101 | |
| 102 | } //namespace ns3 |
| 103 | |
Alexander Afanasyev | c74a602 | 2011-08-15 20:01:35 -0700 | [diff] [blame] | 104 | #endif /* CCNX_FORWARDING_STRATEGY_H */ |