blob: fe9f9d4575b4e46d645a4cce3a8e04aae2e26d81 [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 /*
47 * \brief Default constructor, which sets NDN_FLOODING forwarding strategy
48 */
49 CcnxForwardingHelper();
50
51 /*
52 * \brief This constructor sets a specified forwarding strategy
53 */
54 CcnxForwardingHelper(Ccnx::ForwardingStrategy strategy);
55
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070056 /*
57 * Destroy an instance of an CcnxForwardingHelper
58 */
Ilya Moiseenko25f7d4d2011-09-29 18:41:06 -070059 ~CcnxForwardingHelper ();
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070060
Ilya Moiseenko25f7d4d2011-09-29 18:41:06 -070061 /*
Ilya Moiseenko9181afd2011-10-28 13:06:14 -070062 * \brief creates a specified ForwardingStrategy object and binds it to Pit
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070063 */
Ilya Moiseenko9181afd2011-10-28 13:06:14 -070064 void SetForwarding(Ptr<Ccnx> ccnx, Ptr<CcnxPit> pit) const;
Ilya Moiseenko25f7d4d2011-09-29 18:41:06 -070065
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070066 /**
67 * \brief prints the forwarding tables of all nodes at a particular time.
68 * \param printTime the time at which the forwarding table is supposed to be printed.
69 * \param stream The output stream object to use
70 *
71 * This method calls the PrintForwardingTable() method of the
Alexander Afanasyevc74a6022011-08-15 20:01:35 -070072 * CcnxForwardingStrategy stored in the Ccnx object, for all nodes at the
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070073 * specified time; the output format is forwarding protocol-specific.
74 */
75 void PrintForwardingTableAllAt (Time printTime, Ptr<OutputStreamWrapper> stream) const;
76
77 /**
78 * \brief prints the forwarding tables of all nodes at regular intervals specified by user.
79 * \param printInterval the time interval for which the forwarding table is supposed to be printed.
80 * \param stream The output stream object to use
81 *
82 * This method calls the PrintForwardingTable() method of the
Alexander Afanasyevc74a6022011-08-15 20:01:35 -070083 * CcnxForwardingStrategy stored in the Ccnx object, for all nodes at the
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070084 * specified time interval; the output format is forwarding protocol-specific.
85 */
86 void PrintForwardingTableAllEvery (Time printInterval, Ptr<OutputStreamWrapper> stream) const;
87
88 /**
89 * \brief prints the forwarding tables of a node at a particular time.
90 * \param printTime the time at which the forwarding table is supposed to be printed.
91 * \param node The node ptr for which we need the forwarding table to be printed
92 * \param stream The output stream object to use
93 *
94 * This method calls the PrintForwardingTable() method of the
Alexander Afanasyevc74a6022011-08-15 20:01:35 -070095 * CcnxForwardingStrategy stored in the Ccnx object, for the selected node
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070096 * at the specified time; the output format is forwarding protocol-specific.
97 */
98 void PrintForwardingTableAt (Time printTime, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
99
100 /**
101 * \brief prints the forwarding tables of a node at regular intervals specified by user.
102 * \param printInterval the time interval for which the forwarding table is supposed to be printed.
103 * \param node The node ptr for which we need the forwarding table to be printed
104 * \param stream The output stream object to use
105 *
106 * This method calls the PrintForwardingTable() method of the
Alexander Afanasyevc74a6022011-08-15 20:01:35 -0700107 * CcnxForwardingStrategy stored in the Ccnx object, for the selected node
Alexander Afanasyev45b92d42011-08-14 23:11:38 -0700108 * at the specified interval; the output format is forwarding protocol-specific.
109 */
110 void PrintForwardingTableEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
111
112private:
Ilya Moiseenko25f7d4d2011-09-29 18:41:06 -0700113 Ccnx::ForwardingStrategy m_strategy;
Alexander Afanasyev45b92d42011-08-14 23:11:38 -0700114 void Print (Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
115 void PrintEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
116};
117
118} // namespace ns3
119
120
121#endif /* CCNX_FORWARDING_HELPER_H */