blob: d75a35a173cc03e7a79d570a5a5223c581c0000a [file] [log] [blame]
Ilya Moiseenko25f7d4d2011-09-29 18:41:06 -07001/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
Alexander Afanasyev45b92d42011-08-14 23:11:38 -07002/*
Ilya Moiseenko25f7d4d2011-09-29 18:41:06 -07003 * Copyright (c) 2011 University of California, Los Angeles
Alexander Afanasyev45b92d42011-08-14 23:11:38 -07004 *
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 Moiseenko25f7d4d2011-09-29 18:41:06 -070018 * Author: Ilya Moiseenko <iliamo@cs.ucla.edu>
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070019 */
Ilya Moiseenko25f7d4d2011-09-29 18:41:06 -070020
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070021#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 Moiseenko25f7d4d2011-09-29 18:41:06 -070027#include "ns3/ccnx.h"
28#include "ns3/ccnx-flooding-strategy.h"
Ilya Moiseenko9181afd2011-10-28 13:06:14 -070029#include "ns3/ccnx-pit.h"
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070030
31namespace ns3 {
32
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070033class Node;
34
35/**
Alexander Afanasyev0ab833e2011-08-18 15:49:13 -070036 * \ingroup ccnx-helpers
37 *
Alexander Afanasyevc74a6022011-08-15 20:01:35 -070038 * \brief a factory to create ns3::CcnxForwardingStrategy objects
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070039 *
Alexander Afanasyev0ab833e2011-08-18 15:49:13 -070040 * \todo Document this class
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070041 */
42class CcnxForwardingHelper
43{
44public:
Ilya Moiseenko25f7d4d2011-09-29 18:41:06 -070045 /*
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);
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070054
Ilya Moiseenko25f7d4d2011-09-29 18:41:06 -070055 /*
Alexander Afanasyev19426ef2011-11-23 20:55:28 -080056 * \brief creates a specified ForwardingStrategy object
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070057 */
Alexander Afanasyev19426ef2011-11-23 20:55:28 -080058 void SetForwarding(Ptr<Ccnx> ccnx) const;
Ilya Moiseenko25f7d4d2011-09-29 18:41:06 -070059
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070060 /**
61 * \brief prints the forwarding tables of all nodes at a particular time.
62 * \param printTime the time at which the forwarding table is supposed to be printed.
63 * \param stream The output stream object to use
64 *
65 * This method calls the PrintForwardingTable() method of the
Alexander Afanasyevc74a6022011-08-15 20:01:35 -070066 * CcnxForwardingStrategy stored in the Ccnx object, for all nodes at the
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070067 * specified time; the output format is forwarding protocol-specific.
68 */
69 void PrintForwardingTableAllAt (Time printTime, Ptr<OutputStreamWrapper> stream) const;
70
71 /**
72 * \brief prints the forwarding tables of all nodes at regular intervals specified by user.
73 * \param printInterval the time interval for which the forwarding table is supposed to be printed.
74 * \param stream The output stream object to use
75 *
76 * This method calls the PrintForwardingTable() method of the
Alexander Afanasyevc74a6022011-08-15 20:01:35 -070077 * CcnxForwardingStrategy stored in the Ccnx object, for all nodes at the
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070078 * specified time interval; the output format is forwarding protocol-specific.
79 */
80 void PrintForwardingTableAllEvery (Time printInterval, Ptr<OutputStreamWrapper> stream) const;
81
82 /**
83 * \brief prints the forwarding tables of a node at a particular time.
84 * \param printTime the time at which the forwarding table is supposed to be printed.
85 * \param node The node ptr for which we need the forwarding table to be printed
86 * \param stream The output stream object to use
87 *
88 * This method calls the PrintForwardingTable() method of the
Alexander Afanasyevc74a6022011-08-15 20:01:35 -070089 * CcnxForwardingStrategy stored in the Ccnx object, for the selected node
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070090 * at the specified time; the output format is forwarding protocol-specific.
91 */
92 void PrintForwardingTableAt (Time printTime, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
93
94 /**
95 * \brief prints the forwarding tables of a node at regular intervals specified by user.
96 * \param printInterval the time interval for which the forwarding table is supposed to be printed.
97 * \param node The node ptr for which we need the forwarding table to be printed
98 * \param stream The output stream object to use
99 *
100 * This method calls the PrintForwardingTable() method of the
Alexander Afanasyevc74a6022011-08-15 20:01:35 -0700101 * CcnxForwardingStrategy stored in the Ccnx object, for the selected node
Alexander Afanasyev45b92d42011-08-14 23:11:38 -0700102 * at the specified interval; the output format is forwarding protocol-specific.
103 */
104 void PrintForwardingTableEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
105
106private:
Ilya Moiseenko25f7d4d2011-09-29 18:41:06 -0700107 Ccnx::ForwardingStrategy m_strategy;
Alexander Afanasyev45b92d42011-08-14 23:11:38 -0700108 void Print (Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
109 void PrintEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
110};
111
112} // namespace ns3
113
114
115#endif /* CCNX_FORWARDING_HELPER_H */