A Discrete-Event Network Simulator
API
point-to-point-helper.h
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2008 INRIA
4 *
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 *
18 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19 */
20#ifndef POINT_TO_POINT_HELPER_H
21#define POINT_TO_POINT_HELPER_H
22
23#include <string>
24
25#include "ns3/object-factory.h"
26#include "ns3/net-device-container.h"
27#include "ns3/node-container.h"
28#include "ns3/queue.h"
29
30#include "ns3/trace-helper.h"
31
32namespace ns3 {
33
34class NetDevice;
35class Node;
36
46{
47public:
53 virtual ~PointToPointHelper () {}
54
67 template <typename... Ts>
68 void SetQueue (std::string type, Ts&&... args);
69
80 void SetDeviceAttribute (std::string name, const AttributeValue &value);
81
92 void SetChannelAttribute (std::string name, const AttributeValue &value);
93
102 void DisableFlowControl (void);
103
116
127
135 NetDeviceContainer Install (Ptr<Node> a, std::string bName);
136
144 NetDeviceContainer Install (std::string aName, Ptr<Node> b);
145
153 NetDeviceContainer Install (std::string aNode, std::string bNode);
154
155private:
167 virtual void EnablePcapInternal (std::string prefix, Ptr<NetDevice> nd, bool promiscuous, bool explicitFilename);
168
180 virtual void EnableAsciiInternal (
182 std::string prefix,
184 bool explicitFilename);
185
190};
191
192
193/***************************************************************
194 * Implementation of the templates declared above.
195 ***************************************************************/
196
197template <typename... Ts>
198void PointToPointHelper::SetQueue (std::string type, Ts&&... args)
199{
201
203 m_queueFactory.Set (std::forward<Ts> (args)...);
204}
205
206} // namespace ns3
207
208#endif /* POINT_TO_POINT_HELPER_H */
Base class providing common user-level ascii trace operations for helpers representing net devices.
Definition: trace-helper.h:643
Hold a value for an Attribute.
Definition: attribute.h:69
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:554
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.
virtual void EnableAsciiInternal(Ptr< OutputStreamWrapper > stream, std::string prefix, Ptr< NetDevice > nd, bool explicitFilename)
Enable ascii trace output on 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)
virtual void EnablePcapInternal(std::string prefix, Ptr< NetDevice > nd, bool promiscuous, bool explicitFilename)
Enable pcap output the indicated net device.
void DisableFlowControl(void)
Disable flow control only if you know what you are doing.
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.