blob: a7d0bf873bc9bd6c231bd86f3cb9f5962d1d1a11 [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 Afanasyevc74a6022011-08-15 20:01:35 -070033 * \brief a factory to create ns3::CcnxForwardingStrategy objects
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070034 *
35 * For each new forwarding protocol created as a subclass of
Alexander Afanasyevc74a6022011-08-15 20:01:35 -070036 * ns3::CcnxForwardingStrategy, you need to create a subclass of
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070037 * ns3::CcnxForwardingHelper which can be used by
38 * ns3::InternetStackHelper::SetForwardingHelper and
39 * ns3::InternetStackHelper::Install.
40 */
41class CcnxForwardingHelper
42{
43public:
44 /*
45 * Destroy an instance of an CcnxForwardingHelper
46 */
47 virtual ~CcnxForwardingHelper ();
48
49 /**
50 * \brief virtual constructor
51 * \returns pointer to clone of this CcnxForwardingHelper
52 *
53 * This method is mainly for internal use by the other helpers;
54 * clients are expected to free the dynamic memory allocated by this method
55 */
56 virtual CcnxForwardingHelper* Copy (void) const = 0;
57
58 /**
59 * \param node the node within which the new forwarding protocol will run
60 * \returns a newly-created forwarding protocol
61 */
Alexander Afanasyevc74a6022011-08-15 20:01:35 -070062 virtual Ptr<CcnxForwardingStrategy> Create (Ptr<Node> node) const = 0;
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070063
64 /**
65 * \brief prints the forwarding tables of all nodes at a particular time.
66 * \param printTime the time at which the forwarding table is supposed to be printed.
67 * \param stream The output stream object to use
68 *
69 * This method calls the PrintForwardingTable() method of the
Alexander Afanasyevc74a6022011-08-15 20:01:35 -070070 * CcnxForwardingStrategy stored in the Ccnx object, for all nodes at the
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070071 * specified time; the output format is forwarding protocol-specific.
72 */
73 void PrintForwardingTableAllAt (Time printTime, Ptr<OutputStreamWrapper> stream) const;
74
75 /**
76 * \brief prints the forwarding tables of all nodes at regular intervals specified by user.
77 * \param printInterval the time interval for which the forwarding table is supposed to be printed.
78 * \param stream The output stream object to use
79 *
80 * This method calls the PrintForwardingTable() method of the
Alexander Afanasyevc74a6022011-08-15 20:01:35 -070081 * CcnxForwardingStrategy stored in the Ccnx object, for all nodes at the
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070082 * specified time interval; the output format is forwarding protocol-specific.
83 */
84 void PrintForwardingTableAllEvery (Time printInterval, Ptr<OutputStreamWrapper> stream) const;
85
86 /**
87 * \brief prints the forwarding tables of a node at a particular time.
88 * \param printTime the time at which the forwarding table is supposed to be printed.
89 * \param node The node ptr for which we need the forwarding table to be printed
90 * \param stream The output stream object to use
91 *
92 * This method calls the PrintForwardingTable() method of the
Alexander Afanasyevc74a6022011-08-15 20:01:35 -070093 * CcnxForwardingStrategy stored in the Ccnx object, for the selected node
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070094 * at the specified time; the output format is forwarding protocol-specific.
95 */
96 void PrintForwardingTableAt (Time printTime, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
97
98 /**
99 * \brief prints the forwarding tables of a node at regular intervals specified by user.
100 * \param printInterval the time interval for which the forwarding table is supposed to be printed.
101 * \param node The node ptr for which we need the forwarding table to be printed
102 * \param stream The output stream object to use
103 *
104 * This method calls the PrintForwardingTable() method of the
Alexander Afanasyevc74a6022011-08-15 20:01:35 -0700105 * CcnxForwardingStrategy stored in the Ccnx object, for the selected node
Alexander Afanasyev45b92d42011-08-14 23:11:38 -0700106 * at the specified interval; the output format is forwarding protocol-specific.
107 */
108 void PrintForwardingTableEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
109
110private:
111 void Print (Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
112 void PrintEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
113};
114
115} // namespace ns3
116
117
118#endif /* CCNX_FORWARDING_HELPER_H */