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