Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
kill more dead code in NS3
[simgrid.git] / src / surf / ns3 / my-point-to-point-helper.h
1 /* Copyright (c) 2011, 2014. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 /*
8  * Copyright (c) 2008 INRIA
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License version 2 as
12  * published by the Free Software Foundation;
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22  *
23  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
24  */
25 #ifndef POINT_TO_POINT_HELPER_H
26 #define POINT_TO_POINT_HELPER_H
27
28 #include <string>
29
30 #include "ns3/object-factory.h"
31 #include "ns3/net-device-container.h"
32 #include "ns3/node-container.h"
33 #include "ns3/deprecated.h"
34
35 #include "ns3/trace-helper.h"
36
37 #include "ns3_interface.h"
38
39 namespace ns3 {
40
41 class Queue;
42 class NetDevice;
43 class Node;
44
45 /**
46  * \brief Build a set of PointToPointNetDevice objects
47  *
48  * Normally we eschew multiple inheritance, however, the classes 
49  * PcapUserHelperForDevice and AsciiTraceUserHelperForDevice are
50  * "mixins".
51  */
52 class MyPointToPointHelper : public PcapHelperForDevice, public AsciiTraceHelperForDevice
53 {
54 public:
55   /**
56    * Create a MyPointToPointHelper to make life easier when creating point to
57    * point networks.
58    */
59   MyPointToPointHelper ();
60   virtual ~MyPointToPointHelper () {}
61
62   /**
63    * Each point to point net device must have a queue to pass packets through.
64    * This method allows one to set the type of the queue that is automatically
65    * created when the device is created and attached to a node.
66    *
67    * \param type the type of queue
68    * \param n1 the name of the attribute to set on the queue
69    * \param v1 the value of the attribute to set on the queue
70    * \param n2 the name of the attribute to set on the queue
71    * \param v2 the value of the attribute to set on the queue
72    * \param n3 the name of the attribute to set on the queue
73    * \param v3 the value of the attribute to set on the queue
74    * \param n4 the name of the attribute to set on the queue
75    * \param v4 the value of the attribute to set on the queue
76    *
77    * Set the type of queue to create and associated to each
78    * PointToPointNetDevice created through MyPointToPointHelper::Install.
79    */
80   void SetQueue (std::string type,
81                  std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
82                  std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
83                  std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
84                  std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
85                  std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
86                  std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
87                  std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue (),
88                  std::string n8 = "", const AttributeValue &v8 = EmptyAttributeValue ());
89
90   /**
91    * Set an attribute value to be propagated to each NetDevice created by the
92    * helper.
93    *
94    * \param name the name of the attribute to set
95    * \param value the value of the attribute to set
96    *
97    * Set these attributes on each ns3::PointToPointNetDevice created
98    * by MyPointToPointHelper::Install
99    */
100   void SetDeviceAttribute (std::string name, const AttributeValue &value);
101
102   /**
103    * Set an attribute value to be propagated to each Channel created by the
104    * helper.
105    *
106    * \param name the name of the attribute to set
107    * \param value the value of the attribute to set
108    *
109    * Set these attribute on each ns3::PointToPointChannel created
110    * by MyPointToPointHelper::Install
111    */
112   void SetChannelAttribute (std::string name, const AttributeValue &value);
113
114   /**
115    * \param c a set of nodes
116    *
117    * This method creates a ns3::PointToPointChannel with the
118    * attributes configured by MyPointToPointHelper::SetChannelAttribute,
119    * then, for each node in the input container, we create a 
120    * ns3::PointToPointNetDevice with the requested attributes, 
121    * a queue for this ns3::NetDevice, and associate the resulting 
122    * ns3::NetDevice with the ns3::Node and ns3::PointToPointChannel.
123    */
124   NetDeviceContainer Install (NodeContainer c);
125
126   /**
127    * \param a first node
128    * \param b second node
129    *
130    * Saves you from having to construct a temporary NodeContainer. 
131    * Also, if MPI is enabled, for distributed simulations, 
132    * appropriate remote point-to-point channels are created.
133    */
134   NetDeviceContainer Install (Ptr<Node> a, Ptr<Node> b);
135
136   /**
137    * \param a first node
138    * \param bName name of second node
139    *
140    * Saves you from having to construct a temporary NodeContainer.
141    */
142   NetDeviceContainer Install (Ptr<Node> a, std::string bName);
143
144   /**
145    * \param aName Name of first node
146    * \param b second node
147    *
148    * Saves you from having to construct a temporary NodeContainer.
149    */
150   NetDeviceContainer Install (std::string aName, Ptr<Node> b);
151
152   /**
153    * \param aNode Name of first node
154    * \param bNode Name of second node
155    *
156    * Saves you from having to construct a temporary NodeContainer.
157    */
158   NetDeviceContainer Install (std::string aNode, std::string bNode);
159
160 private:
161   /**
162    * \brief Enable pcap output the indicated net device.
163    *
164    * NetDevice-specific implementation mechanism for hooking the trace and
165    * writing to the trace file.
166    *
167    * \param prefix Filename prefix to use for pcap files.
168    * \param nd Net device for which you want to enable tracing.
169    * \param promiscuous If true capture all possible packets available at the device.
170    * \param explicitFilename Treat the prefix as an explicit filename if true
171    */
172   virtual void EnablePcapInternal (std::string prefix, Ptr<NetDevice> nd, bool promiscuous, bool explicitFilename);
173
174   /**
175    * \brief Enable ascii trace output on the indicated net device.
176    * \internal
177    *
178    * NetDevice-specific implementation mechanism for hooking the trace and
179    * writing to the trace file.
180    *
181    * \param stream The output stream object to use when logging ascii traces.
182    * \param prefix Filename prefix to use for ascii trace files.
183    * \param nd Net device for which you want to enable tracing.
184    */
185   virtual void EnableAsciiInternal (
186     Ptr<OutputStreamWrapper> stream,
187     std::string prefix,
188     Ptr<NetDevice> nd,
189     bool explicitFilename);
190
191   ObjectFactory m_queueFactory;
192   ObjectFactory m_queueFactory_red;
193   ObjectFactory m_channelFactory;
194   ObjectFactory m_remoteChannelFactory;
195   ObjectFactory m_deviceFactory;
196 };
197
198 } // namespace ns3
199
200 #endif /* POINT_TO_POINT_HELPER_H */