blob: aff0909129fe884aa651c630bc560bf4336743a9 [file] [log] [blame]
Alexander Afanasyevc74a6022011-08-15 20:01:35 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
Alexander Afanasyev98256102011-08-14 01:00:02 -07002/*
Ilya Moiseenko25f7d4d2011-09-29 18:41:06 -07003 * Copyright (c) 2011 University of California, Los Angeles
Alexander Afanasyev98256102011-08-14 01:00:02 -07004 *
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 Afanasyevcf133f02011-09-06 12:13:48 -070017 *
Ilya Moiseenko25f7d4d2011-09-29 18:41:06 -070018 * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
19 * Ilya Moiseenko <iliamo@cs.ucla.edu>
Alexander Afanasyev98256102011-08-14 01:00:02 -070020 */
Alexander Afanasyevc74a6022011-08-15 20:01:35 -070021#ifndef CCNX_FORWARDING_STRATEGY_H
22#define CCNX_FORWARDING_STRATEGY_H
Alexander Afanasyev98256102011-08-14 01:00:02 -070023
24#include "ns3/packet.h"
25#include "ns3/callback.h"
26#include "ns3/object.h"
Alexander Afanasyev98256102011-08-14 01:00:02 -070027
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070028#include "ccnx.h"
Alexander Afanasyevcf133f02011-09-06 12:13:48 -070029#include "ccnx-fib.h"
Ilya Moiseenkoea27f4e2011-10-28 13:19:07 -070030#include "ccnx-pit.h"
31#include "ccnx-pit-entry.h"
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070032
Alexander Afanasyev98256102011-08-14 01:00:02 -070033namespace ns3 {
34
Alexander Afanasyev98256102011-08-14 01:00:02 -070035class CcnxFace;
Alexander Afanasyevcf133f02011-09-06 12:13:48 -070036class CcnxInterestHeader;
Alexander Afanasyev98256102011-08-14 01:00:02 -070037
38/**
Alexander Afanasyevcf133f02011-09-06 12:13:48 -070039 * \ingroup ccnx
Alexander Afanasyeva5bbe0e2011-11-22 17:28:39 -080040 * \brief Abstract base class for CCNx forwarding strategies
Alexander Afanasyev98256102011-08-14 01:00:02 -070041 */
Alexander Afanasyevc74a6022011-08-15 20:01:35 -070042class CcnxForwardingStrategy : public Object
Alexander Afanasyev98256102011-08-14 01:00:02 -070043{
44public:
Alexander Afanasyeva5bbe0e2011-11-22 17:28:39 -080045 static TypeId GetTypeId (void);
46
47 /**
48 * @brief Default constructor
49 */
50 CcnxForwardingStrategy ();
51 virtual ~CcnxForwardingStrategy ();
52
53 /**
Alexander Afanasyev0a61c342011-12-06 12:48:55 -080054 * @brief Base method to propagate the insterest according to the forwarding strategy
Alexander Afanasyeva5bbe0e2011-11-22 17:28:39 -080055 *
56 * @param pitEntry Reference to PIT entry (reference to corresponding FIB entry inside)
57 * @param incomingFace Incoming face
58 * @param header CcnxInterestHeader
59 * @param packet Original Interest packet
60 * @param sendCallback Send callback
61 *
62 * @return true if interest was successfully propagated, false if all options have failed
63 */
Alexander Afanasyev4fa5e842011-11-21 13:38:39 -080064 virtual bool
Alexander Afanasyeva5bbe0e2011-11-22 17:28:39 -080065 PropagateInterest (const CcnxPitEntry &pitEntry,
Alexander Afanasyev4fa5e842011-11-21 13:38:39 -080066 const Ptr<CcnxFace> &incomingFace,
67 Ptr<CcnxInterestHeader> &header,
Alexander Afanasyev0a61c342011-12-06 12:48:55 -080068 const Ptr<const Packet> &packet) = 0;
Ilya Moiseenko25f7d4d2011-09-29 18:41:06 -070069
Alexander Afanasyeva5bbe0e2011-11-22 17:28:39 -080070 /**
71 * @brief Set link to PIT for the forwarding strategy
72 *
73 * @param pit pointer to PIT
74 */
75 void
76 SetPit (Ptr<CcnxPit> pit);
77
Alexander Afanasyev0a61c342011-12-06 12:48:55 -080078protected:
79 /**
80 * @brief Propage interest vie a green interface. Fail, if no green interfaces available
81 *
82 * @param pitEntry Reference to PIT entry (reference to corresponding FIB entry inside)
83 * @param incomingFace Incoming face
84 * @param header CcnxInterestHeader
85 * @param packet Original Interest packet
86 * @param sendCallback Send callback
87 * @return true if interest was successfully propagated, false if all options have failed
88 *
89 * \see PropagateInterest
90 */
91 bool
92 PropagateInterestViaGreen (const CcnxPitEntry &pitEntry,
93 const Ptr<CcnxFace> &incomingFace,
94 Ptr<CcnxInterestHeader> &header,
95 const Ptr<const Packet> &packet);
96
Alexander Afanasyeva5bbe0e2011-11-22 17:28:39 -080097protected:
Ilya Moiseenkoea27f4e2011-10-28 13:19:07 -070098 Ptr<CcnxPit> m_pit;
Alexander Afanasyev98256102011-08-14 01:00:02 -070099};
100
101} //namespace ns3
102
Alexander Afanasyevc74a6022011-08-15 20:01:35 -0700103#endif /* CCNX_FORWARDING_STRATEGY_H */