Ilya Moiseenko | 25f7d4d | 2011-09-29 18:41:06 -0700 | [diff] [blame] | 1 | /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -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 | 45b92d4 | 2011-08-14 23:11:38 -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 |
| 17 | * |
Ilya Moiseenko | 25f7d4d | 2011-09-29 18:41:06 -0700 | [diff] [blame] | 18 | * Author: Ilya Moiseenko <iliamo@cs.ucla.edu> |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 19 | */ |
Ilya Moiseenko | 25f7d4d | 2011-09-29 18:41:06 -0700 | [diff] [blame] | 20 | |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 21 | #ifndef CCNX_FORWARDING_HELPER_H |
| 22 | #define CCNX_FORWARDING_HELPER_H |
| 23 | |
| 24 | #include "ns3/ptr.h" |
| 25 | #include "ns3/nstime.h" |
| 26 | #include "ns3/output-stream-wrapper.h" |
Ilya Moiseenko | 25f7d4d | 2011-09-29 18:41:06 -0700 | [diff] [blame] | 27 | #include "ns3/ccnx.h" |
| 28 | #include "ns3/ccnx-flooding-strategy.h" |
Ilya Moiseenko | 9181afd | 2011-10-28 13:06:14 -0700 | [diff] [blame] | 29 | #include "ns3/ccnx-pit.h" |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 30 | |
| 31 | namespace ns3 { |
| 32 | |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 33 | class Node; |
| 34 | |
| 35 | /** |
Alexander Afanasyev | 0ab833e | 2011-08-18 15:49:13 -0700 | [diff] [blame] | 36 | * \ingroup ccnx-helpers |
| 37 | * |
Alexander Afanasyev | c74a602 | 2011-08-15 20:01:35 -0700 | [diff] [blame] | 38 | * \brief a factory to create ns3::CcnxForwardingStrategy objects |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 39 | * |
Alexander Afanasyev | 0ab833e | 2011-08-18 15:49:13 -0700 | [diff] [blame] | 40 | * \todo Document this class |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 41 | */ |
| 42 | class CcnxForwardingHelper |
| 43 | { |
| 44 | public: |
Ilya Moiseenko | 25f7d4d | 2011-09-29 18:41:06 -0700 | [diff] [blame] | 45 | |
| 46 | /* |
| 47 | * \brief Default constructor, which sets NDN_FLOODING forwarding strategy |
| 48 | */ |
| 49 | CcnxForwardingHelper(); |
| 50 | |
| 51 | /* |
| 52 | * \brief This constructor sets a specified forwarding strategy |
| 53 | */ |
| 54 | CcnxForwardingHelper(Ccnx::ForwardingStrategy strategy); |
| 55 | |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 56 | /* |
| 57 | * Destroy an instance of an CcnxForwardingHelper |
| 58 | */ |
Ilya Moiseenko | 25f7d4d | 2011-09-29 18:41:06 -0700 | [diff] [blame] | 59 | ~CcnxForwardingHelper (); |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 60 | |
Ilya Moiseenko | 25f7d4d | 2011-09-29 18:41:06 -0700 | [diff] [blame] | 61 | /* |
Ilya Moiseenko | 9181afd | 2011-10-28 13:06:14 -0700 | [diff] [blame] | 62 | * \brief creates a specified ForwardingStrategy object and binds it to Pit |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 63 | */ |
Ilya Moiseenko | 9181afd | 2011-10-28 13:06:14 -0700 | [diff] [blame] | 64 | void SetForwarding(Ptr<Ccnx> ccnx, Ptr<CcnxPit> pit) const; |
Ilya Moiseenko | 25f7d4d | 2011-09-29 18:41:06 -0700 | [diff] [blame] | 65 | |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 66 | /** |
| 67 | * \brief prints the forwarding tables of all nodes at a particular time. |
| 68 | * \param printTime the time at which the forwarding table is supposed to be printed. |
| 69 | * \param stream The output stream object to use |
| 70 | * |
| 71 | * This method calls the PrintForwardingTable() method of the |
Alexander Afanasyev | c74a602 | 2011-08-15 20:01:35 -0700 | [diff] [blame] | 72 | * CcnxForwardingStrategy stored in the Ccnx object, for all nodes at the |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 73 | * specified time; the output format is forwarding protocol-specific. |
| 74 | */ |
| 75 | void PrintForwardingTableAllAt (Time printTime, Ptr<OutputStreamWrapper> stream) const; |
| 76 | |
| 77 | /** |
| 78 | * \brief prints the forwarding tables of all nodes at regular intervals specified by user. |
| 79 | * \param printInterval the time interval for which the forwarding table is supposed to be printed. |
| 80 | * \param stream The output stream object to use |
| 81 | * |
| 82 | * This method calls the PrintForwardingTable() method of the |
Alexander Afanasyev | c74a602 | 2011-08-15 20:01:35 -0700 | [diff] [blame] | 83 | * CcnxForwardingStrategy stored in the Ccnx object, for all nodes at the |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 84 | * specified time interval; the output format is forwarding protocol-specific. |
| 85 | */ |
| 86 | void PrintForwardingTableAllEvery (Time printInterval, Ptr<OutputStreamWrapper> stream) const; |
| 87 | |
| 88 | /** |
| 89 | * \brief prints the forwarding tables of a node at a particular time. |
| 90 | * \param printTime the time at which the forwarding table is supposed to be printed. |
| 91 | * \param node The node ptr for which we need the forwarding table to be printed |
| 92 | * \param stream The output stream object to use |
| 93 | * |
| 94 | * This method calls the PrintForwardingTable() method of the |
Alexander Afanasyev | c74a602 | 2011-08-15 20:01:35 -0700 | [diff] [blame] | 95 | * CcnxForwardingStrategy stored in the Ccnx object, for the selected node |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 96 | * at the specified time; the output format is forwarding protocol-specific. |
| 97 | */ |
| 98 | void PrintForwardingTableAt (Time printTime, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const; |
| 99 | |
| 100 | /** |
| 101 | * \brief prints the forwarding tables of a node at regular intervals specified by user. |
| 102 | * \param printInterval the time interval for which the forwarding table is supposed to be printed. |
| 103 | * \param node The node ptr for which we need the forwarding table to be printed |
| 104 | * \param stream The output stream object to use |
| 105 | * |
| 106 | * This method calls the PrintForwardingTable() method of the |
Alexander Afanasyev | c74a602 | 2011-08-15 20:01:35 -0700 | [diff] [blame] | 107 | * CcnxForwardingStrategy stored in the Ccnx object, for the selected node |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 108 | * at the specified interval; the output format is forwarding protocol-specific. |
| 109 | */ |
| 110 | void PrintForwardingTableEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const; |
| 111 | |
| 112 | private: |
Ilya Moiseenko | 25f7d4d | 2011-09-29 18:41:06 -0700 | [diff] [blame] | 113 | Ccnx::ForwardingStrategy m_strategy; |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 114 | void Print (Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const; |
| 115 | void PrintEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const; |
| 116 | }; |
| 117 | |
| 118 | } // namespace ns3 |
| 119 | |
| 120 | |
| 121 | #endif /* CCNX_FORWARDING_HELPER_H */ |