Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /* |
| 3 | * Copyright (c) 2008 INRIA |
| 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
| 19 | */ |
| 20 | #ifndef CCNX_FORWARDING_HELPER_H |
| 21 | #define CCNX_FORWARDING_HELPER_H |
| 22 | |
| 23 | #include "ns3/ptr.h" |
| 24 | #include "ns3/nstime.h" |
| 25 | #include "ns3/output-stream-wrapper.h" |
| 26 | |
| 27 | namespace ns3 { |
| 28 | |
Alexander Afanasyev | c74a602 | 2011-08-15 20:01:35 -0700 | [diff] [blame] | 29 | class CcnxForwardingStrategy; |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 30 | class Node; |
| 31 | |
| 32 | /** |
Alexander Afanasyev | 0ab833e | 2011-08-18 15:49:13 -0700 | [diff] [blame] | 33 | * \ingroup ccnx-helpers |
| 34 | * |
Alexander Afanasyev | c74a602 | 2011-08-15 20:01:35 -0700 | [diff] [blame] | 35 | * \brief a factory to create ns3::CcnxForwardingStrategy objects |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 36 | * |
Alexander Afanasyev | 0ab833e | 2011-08-18 15:49:13 -0700 | [diff] [blame] | 37 | * \todo Document this class |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 38 | */ |
| 39 | class CcnxForwardingHelper |
| 40 | { |
| 41 | public: |
| 42 | /* |
| 43 | * Destroy an instance of an CcnxForwardingHelper |
| 44 | */ |
| 45 | virtual ~CcnxForwardingHelper (); |
| 46 | |
| 47 | /** |
| 48 | * \brief virtual constructor |
| 49 | * \returns pointer to clone of this CcnxForwardingHelper |
| 50 | * |
| 51 | * This method is mainly for internal use by the other helpers; |
| 52 | * clients are expected to free the dynamic memory allocated by this method |
| 53 | */ |
Alexander Afanasyev | 0ab833e | 2011-08-18 15:49:13 -0700 | [diff] [blame] | 54 | virtual CcnxForwardingHelper* Copy () const = 0; |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 55 | |
| 56 | /** |
| 57 | * \param node the node within which the new forwarding protocol will run |
| 58 | * \returns a newly-created forwarding protocol |
| 59 | */ |
Alexander Afanasyev | c74a602 | 2011-08-15 20:01:35 -0700 | [diff] [blame] | 60 | virtual Ptr<CcnxForwardingStrategy> Create (Ptr<Node> node) const = 0; |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 61 | |
| 62 | /** |
| 63 | * \brief prints the forwarding tables of all nodes at a particular time. |
| 64 | * \param printTime the time at which the forwarding table is supposed to be printed. |
| 65 | * \param stream The output stream object to use |
| 66 | * |
| 67 | * This method calls the PrintForwardingTable() method of the |
Alexander Afanasyev | c74a602 | 2011-08-15 20:01:35 -0700 | [diff] [blame] | 68 | * CcnxForwardingStrategy stored in the Ccnx object, for all nodes at the |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 69 | * specified time; the output format is forwarding protocol-specific. |
| 70 | */ |
| 71 | void PrintForwardingTableAllAt (Time printTime, Ptr<OutputStreamWrapper> stream) const; |
| 72 | |
| 73 | /** |
| 74 | * \brief prints the forwarding tables of all nodes at regular intervals specified by user. |
| 75 | * \param printInterval the time interval for which the forwarding table is supposed to be printed. |
| 76 | * \param stream The output stream object to use |
| 77 | * |
| 78 | * This method calls the PrintForwardingTable() method of the |
Alexander Afanasyev | c74a602 | 2011-08-15 20:01:35 -0700 | [diff] [blame] | 79 | * CcnxForwardingStrategy stored in the Ccnx object, for all nodes at the |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 80 | * specified time interval; the output format is forwarding protocol-specific. |
| 81 | */ |
| 82 | void PrintForwardingTableAllEvery (Time printInterval, Ptr<OutputStreamWrapper> stream) const; |
| 83 | |
| 84 | /** |
| 85 | * \brief prints the forwarding tables of a node at a particular time. |
| 86 | * \param printTime the time at which the forwarding table is supposed to be printed. |
| 87 | * \param node The node ptr for which we need the forwarding table to be printed |
| 88 | * \param stream The output stream object to use |
| 89 | * |
| 90 | * This method calls the PrintForwardingTable() method of the |
Alexander Afanasyev | c74a602 | 2011-08-15 20:01:35 -0700 | [diff] [blame] | 91 | * CcnxForwardingStrategy stored in the Ccnx object, for the selected node |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 92 | * at the specified time; the output format is forwarding protocol-specific. |
| 93 | */ |
| 94 | void PrintForwardingTableAt (Time printTime, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const; |
| 95 | |
| 96 | /** |
| 97 | * \brief prints the forwarding tables of a node at regular intervals specified by user. |
| 98 | * \param printInterval the time interval for which the forwarding table is supposed to be printed. |
| 99 | * \param node The node ptr for which we need the forwarding table to be printed |
| 100 | * \param stream The output stream object to use |
| 101 | * |
| 102 | * This method calls the PrintForwardingTable() method of the |
Alexander Afanasyev | c74a602 | 2011-08-15 20:01:35 -0700 | [diff] [blame] | 103 | * CcnxForwardingStrategy stored in the Ccnx object, for the selected node |
Alexander Afanasyev | 45b92d4 | 2011-08-14 23:11:38 -0700 | [diff] [blame] | 104 | * at the specified interval; the output format is forwarding protocol-specific. |
| 105 | */ |
| 106 | void PrintForwardingTableEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const; |
| 107 | |
| 108 | private: |
| 109 | void Print (Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const; |
| 110 | void PrintEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const; |
| 111 | }; |
| 112 | |
| 113 | } // namespace ns3 |
| 114 | |
| 115 | |
| 116 | #endif /* CCNX_FORWARDING_HELPER_H */ |