1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
3 * Copyright (c) 2008 INRIA
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;
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.
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
18 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
20 #ifndef POINT_TO_POINT_HELPER_H
21 #define POINT_TO_POINT_HELPER_H
25 #include "ns3/object-factory.h"
26 #include "ns3/net-device-container.h"
27 #include "ns3/node-container.h"
28 #include "ns3/deprecated.h"
30 #include "ns3/trace-helper.h"
32 #include "ns3_interface.h"
41 * \brief Build a set of PointToPointNetDevice objects
43 * Normally we eschew multiple inheritance, however, the classes
44 * PcapUserHelperForDevice and AsciiTraceUserHelperForDevice are
47 class MyPointToPointHelper : public PcapHelperForDevice, public AsciiTraceHelperForDevice
51 * Create a MyPointToPointHelper to make life easier when creating point to
54 MyPointToPointHelper ();
55 virtual ~MyPointToPointHelper () {}
58 * Each point to point net device must have a queue to pass packets through.
59 * This method allows one to set the type of the queue that is automatically
60 * created when the device is created and attached to a node.
62 * \param type the type of queue
63 * \param n1 the name of the attribute to set on the queue
64 * \param v1 the value of the attribute to set on the queue
65 * \param n2 the name of the attribute to set on the queue
66 * \param v2 the value of the attribute to set on the queue
67 * \param n3 the name of the attribute to set on the queue
68 * \param v3 the value of the attribute to set on the queue
69 * \param n4 the name of the attribute to set on the queue
70 * \param v4 the value of the attribute to set on the queue
72 * Set the type of queue to create and associated to each
73 * PointToPointNetDevice created through MyPointToPointHelper::Install.
75 void SetQueue (std::string type,
76 std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
77 std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
78 std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
79 std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (),
80 std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (),
81 std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (),
82 std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue (),
83 std::string n8 = "", const AttributeValue &v8 = EmptyAttributeValue ());
86 * Set an attribute value to be propagated to each NetDevice created by the
89 * \param name the name of the attribute to set
90 * \param value the value of the attribute to set
92 * Set these attributes on each ns3::PointToPointNetDevice created
93 * by MyPointToPointHelper::Install
95 void SetDeviceAttribute (std::string name, const AttributeValue &value);
98 * Set an attribute value to be propagated to each Channel created by the
101 * \param name the name of the attribute to set
102 * \param value the value of the attribute to set
104 * Set these attribute on each ns3::PointToPointChannel created
105 * by MyPointToPointHelper::Install
107 void SetChannelAttribute (std::string name, const AttributeValue &value);
110 * \param c a set of nodes
112 * This method creates a ns3::PointToPointChannel with the
113 * attributes configured by MyPointToPointHelper::SetChannelAttribute,
114 * then, for each node in the input container, we create a
115 * ns3::PointToPointNetDevice with the requested attributes,
116 * a queue for this ns3::NetDevice, and associate the resulting
117 * ns3::NetDevice with the ns3::Node and ns3::PointToPointChannel.
119 NetDeviceContainer Install (NodeContainer c);
122 * \param a first node
123 * \param b second node
125 * Saves you from having to construct a temporary NodeContainer.
126 * Also, if MPI is enabled, for distributed simulations,
127 * appropriate remote point-to-point channels are created.
129 NetDeviceContainer Install (Ptr<Node> a, Ptr<Node> b);
132 * \param a first node
133 * \param b second node
135 * Saves you from having to construct a temporary NodeContainer.
136 * Also, if MPI is enabled, for distributed simulations,
137 * appropriate remote point-to-point channels are created.
139 NetDeviceContainer Install (Ptr<Node> a, e_ns3_network_element_type_t type_a, Ptr<Node> b, e_ns3_network_element_type_t type_b);
142 * \param a first node
143 * \param bName name of second node
145 * Saves you from having to construct a temporary NodeContainer.
147 NetDeviceContainer Install (Ptr<Node> a, std::string bName);
150 * \param aName Name of first node
151 * \param b second node
153 * Saves you from having to construct a temporary NodeContainer.
155 NetDeviceContainer Install (std::string aName, Ptr<Node> b);
158 * \param aNode Name of first node
159 * \param bNode Name of second node
161 * Saves you from having to construct a temporary NodeContainer.
163 NetDeviceContainer Install (std::string aNode, std::string bNode);
167 * \brief Enable pcap output the indicated net device.
169 * NetDevice-specific implementation mechanism for hooking the trace and
170 * writing to the trace file.
172 * \param prefix Filename prefix to use for pcap files.
173 * \param nd Net device for which you want to enable tracing.
174 * \param promiscuous If true capture all possible packets available at the device.
175 * \param explicitFilename Treat the prefix as an explicit filename if true
177 virtual void EnablePcapInternal (std::string prefix, Ptr<NetDevice> nd, bool promiscuous, bool explicitFilename);
180 * \brief Enable ascii trace output on the indicated net device.
183 * NetDevice-specific implementation mechanism for hooking the trace and
184 * writing to the trace file.
186 * \param stream The output stream object to use when logging ascii traces.
187 * \param prefix Filename prefix to use for ascii trace files.
188 * \param nd Net device for which you want to enable tracing.
190 virtual void EnableAsciiInternal (
191 Ptr<OutputStreamWrapper> stream,
194 bool explicitFilename);
196 ObjectFactory m_queueFactory;
197 ObjectFactory m_queueFactory_red;
198 ObjectFactory m_channelFactory;
199 ObjectFactory m_remoteChannelFactory;
200 ObjectFactory m_deviceFactory;
205 #endif /* POINT_TO_POINT_HELPER_H */