blob: 8ac041e242ad5fbc2b8d6f8742131ba3c854130f [file] [log] [blame]
Alexander Afanasyev45b92d42011-08-14 23:11:38 -07001/* -*- 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
27namespace ns3 {
28
Alexander Afanasyevc74a6022011-08-15 20:01:35 -070029class CcnxForwardingStrategy;
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070030class Node;
31
32/**
Alexander Afanasyev0ab833e2011-08-18 15:49:13 -070033 * \ingroup ccnx-helpers
34 *
Alexander Afanasyevc74a6022011-08-15 20:01:35 -070035 * \brief a factory to create ns3::CcnxForwardingStrategy objects
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070036 *
Alexander Afanasyev0ab833e2011-08-18 15:49:13 -070037 * \todo Document this class
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070038 */
39class CcnxForwardingHelper
40{
41public:
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 Afanasyev0ab833e2011-08-18 15:49:13 -070054 virtual CcnxForwardingHelper* Copy () const = 0;
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070055
56 /**
57 * \param node the node within which the new forwarding protocol will run
58 * \returns a newly-created forwarding protocol
59 */
Alexander Afanasyevc74a6022011-08-15 20:01:35 -070060 virtual Ptr<CcnxForwardingStrategy> Create (Ptr<Node> node) const = 0;
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070061
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 Afanasyevc74a6022011-08-15 20:01:35 -070068 * CcnxForwardingStrategy stored in the Ccnx object, for all nodes at the
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070069 * 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 Afanasyevc74a6022011-08-15 20:01:35 -070079 * CcnxForwardingStrategy stored in the Ccnx object, for all nodes at the
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070080 * 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 Afanasyevc74a6022011-08-15 20:01:35 -070091 * CcnxForwardingStrategy stored in the Ccnx object, for the selected node
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070092 * 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 Afanasyevc74a6022011-08-15 20:01:35 -0700103 * CcnxForwardingStrategy stored in the Ccnx object, for the selected node
Alexander Afanasyev45b92d42011-08-14 23:11:38 -0700104 * 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
108private:
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 */