A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
point-to-point-helper.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2008 INRIA
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18 */
19#ifndef POINT_TO_POINT_HELPER_H
20#define POINT_TO_POINT_HELPER_H
21
22#include "ns3/net-device-container.h"
23#include "ns3/node-container.h"
24#include "ns3/object-factory.h"
25#include "ns3/queue.h"
26#include "ns3/trace-helper.h"
27
28#include <string>
29
30namespace ns3
31{
32
33class NetDevice;
34class Node;
35
44{
45 public:
51
53 {
54 }
55
68 template <typename... Ts>
69 void SetQueue(std::string type, Ts&&... args);
70
81 void SetDeviceAttribute(std::string name, const AttributeValue& value);
82
93 void SetChannelAttribute(std::string name, const AttributeValue& value);
94
103 void DisableFlowControl();
104
117
128
136 NetDeviceContainer Install(Ptr<Node> a, std::string bName);
137
145 NetDeviceContainer Install(std::string aName, Ptr<Node> b);
146
154 NetDeviceContainer Install(std::string aNode, std::string bNode);
155
156 private:
168 void EnablePcapInternal(std::string prefix,
170 bool promiscuous,
171 bool explicitFilename) override;
172
185 std::string prefix,
187 bool explicitFilename) override;
188
193};
194
195/***************************************************************
196 * Implementation of the templates declared above.
197 ***************************************************************/
198
199template <typename... Ts>
200void
201PointToPointHelper::SetQueue(std::string type, Ts&&... args)
202{
204
206 m_queueFactory.Set(std::forward<Ts>(args)...);
207}
208
209} // namespace ns3
210
211#endif /* POINT_TO_POINT_HELPER_H */
Base class providing common user-level ascii trace operations for helpers representing net devices.
Definition: trace-helper.h:728
Hold a value for an Attribute.
Definition: attribute.h:70
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
Instantiate subclasses of ns3::Object.
void Set(const std::string &name, const AttributeValue &value, Args &&... args)
Set an attribute to be set during construction.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
Base class providing common user-level pcap operations for helpers representing net devices.
Definition: trace-helper.h:623
Build a set of PointToPointNetDevice objects.
ObjectFactory m_channelFactory
Channel Factory.
PointToPointHelper()
Create a PointToPointHelper to make life easier when creating point to point networks.
bool m_enableFlowControl
whether to enable flow control
void SetDeviceAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each NetDevice created by the helper.
void DisableFlowControl()
Disable flow control only if you know what you are doing.
void EnablePcapInternal(std::string prefix, Ptr< NetDevice > nd, bool promiscuous, bool explicitFilename) override
Enable pcap output the indicated net device.
void SetChannelAttribute(std::string name, const AttributeValue &value)
Set an attribute value to be propagated to each Channel created by the helper.
ObjectFactory m_queueFactory
Queue Factory.
void SetQueue(std::string type, Ts &&... args)
Each point to point net device must have a queue to pass packets through.
ObjectFactory m_deviceFactory
Device Factory.
NetDeviceContainer Install(NodeContainer c)
void EnableAsciiInternal(Ptr< OutputStreamWrapper > stream, std::string prefix, Ptr< NetDevice > nd, bool explicitFilename) override
Enable ascii trace output on the indicated net device.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
static void AppendItemTypeIfNotPresent(std::string &typeId, const std::string &itemType)
Append the item type to the provided type ID if the latter does not end with '>'.
Definition: queue.cc:73
Every class exported by the ns3 library is enclosed in the ns3 namespace.