blob: c40bc129ee518645c2645858ea052f13fe0359d0 [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"
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070029
30namespace ns3 {
31
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070032class Node;
33
34/**
Alexander Afanasyev0ab833e2011-08-18 15:49:13 -070035 * \ingroup ccnx-helpers
36 *
Alexander Afanasyevc74a6022011-08-15 20:01:35 -070037 * \brief a factory to create ns3::CcnxForwardingStrategy objects
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070038 *
Alexander Afanasyev0ab833e2011-08-18 15:49:13 -070039 * \todo Document this class
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070040 */
41class CcnxForwardingHelper
42{
43public:
Ilya Moiseenko25f7d4d2011-09-29 18:41:06 -070044
45 /*
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);
54
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070055 /*
56 * Destroy an instance of an CcnxForwardingHelper
57 */
Ilya Moiseenko25f7d4d2011-09-29 18:41:06 -070058 ~CcnxForwardingHelper ();
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070059
Ilya Moiseenko25f7d4d2011-09-29 18:41:06 -070060 /*
61 * \brief creates a specified ForwardingStrategy object and binds it to Ccnx
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070062 */
Ilya Moiseenko25f7d4d2011-09-29 18:41:06 -070063 void SetForwarding(Ptr<Ccnx> ccnx) const;
64
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070065 /**
66 * \brief prints the forwarding tables of all nodes at a particular time.
67 * \param printTime the time at which the forwarding table is supposed to be printed.
68 * \param stream The output stream object to use
69 *
70 * This method calls the PrintForwardingTable() method of the
Alexander Afanasyevc74a6022011-08-15 20:01:35 -070071 * CcnxForwardingStrategy stored in the Ccnx object, for all nodes at the
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070072 * specified time; the output format is forwarding protocol-specific.
73 */
74 void PrintForwardingTableAllAt (Time printTime, Ptr<OutputStreamWrapper> stream) const;
75
76 /**
77 * \brief prints the forwarding tables of all nodes at regular intervals specified by user.
78 * \param printInterval the time interval for which the forwarding table is supposed to be printed.
79 * \param stream The output stream object to use
80 *
81 * This method calls the PrintForwardingTable() method of the
Alexander Afanasyevc74a6022011-08-15 20:01:35 -070082 * CcnxForwardingStrategy stored in the Ccnx object, for all nodes at the
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070083 * specified time interval; the output format is forwarding protocol-specific.
84 */
85 void PrintForwardingTableAllEvery (Time printInterval, Ptr<OutputStreamWrapper> stream) const;
86
87 /**
88 * \brief prints the forwarding tables of a node at a particular time.
89 * \param printTime the time at which the forwarding table is supposed to be printed.
90 * \param node The node ptr for which we need the forwarding table to be printed
91 * \param stream The output stream object to use
92 *
93 * This method calls the PrintForwardingTable() method of the
Alexander Afanasyevc74a6022011-08-15 20:01:35 -070094 * CcnxForwardingStrategy stored in the Ccnx object, for the selected node
Alexander Afanasyev45b92d42011-08-14 23:11:38 -070095 * at the specified time; the output format is forwarding protocol-specific.
96 */
97 void PrintForwardingTableAt (Time printTime, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
98
99 /**
100 * \brief prints the forwarding tables of a node at regular intervals specified by user.
101 * \param printInterval the time interval for which the forwarding table is supposed to be printed.
102 * \param node The node ptr for which we need the forwarding table to be printed
103 * \param stream The output stream object to use
104 *
105 * This method calls the PrintForwardingTable() method of the
Alexander Afanasyevc74a6022011-08-15 20:01:35 -0700106 * CcnxForwardingStrategy stored in the Ccnx object, for the selected node
Alexander Afanasyev45b92d42011-08-14 23:11:38 -0700107 * at the specified interval; the output format is forwarding protocol-specific.
108 */
109 void PrintForwardingTableEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
110
111private:
Ilya Moiseenko25f7d4d2011-09-29 18:41:06 -0700112 Ccnx::ForwardingStrategy m_strategy;
Alexander Afanasyev45b92d42011-08-14 23:11:38 -0700113 void Print (Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
114 void PrintEvery (Time printInterval, Ptr<Node> node, Ptr<OutputStreamWrapper> stream) const;
115};
116
117} // namespace ns3
118
119
120#endif /* CCNX_FORWARDING_HELPER_H */