A Discrete-Event Network Simulator
API
csma-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 CSMA_HELPER_H
21#define CSMA_HELPER_H
22
23#include <string>
24
25#include "ns3/attribute.h"
26#include "ns3/object-factory.h"
27#include "ns3/net-device-container.h"
28#include "ns3/node-container.h"
29#include "ns3/csma-channel.h"
30#include "ns3/trace-helper.h"
31
32namespace ns3 {
33
34class Packet;
35
47{
48public:
52 CsmaHelper ();
53 virtual ~CsmaHelper () {}
54
69 void SetQueue (std::string type,
70 std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (),
71 std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (),
72 std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (),
73 std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue ());
74
82 void SetDeviceAttribute (std::string n1, const AttributeValue &v1);
83
91 void SetChannelAttribute (std::string n1, const AttributeValue &v1);
92
101 void DisableFlowControl (void);
102
113
123 NetDeviceContainer Install (std::string name) const;
124
135
145 NetDeviceContainer Install (Ptr<Node> node, std::string channelName) const;
146
156 NetDeviceContainer Install (std::string nodeName, Ptr<CsmaChannel> channel) const;
157
167 NetDeviceContainer Install (std::string nodeName, std::string channelName) const;
168
180
192
203 NetDeviceContainer Install (const NodeContainer &c, std::string channelName) const;
204
216 int64_t AssignStreams (NetDeviceContainer c, int64_t stream);
217
218private:
219
230
242 virtual void EnablePcapInternal (std::string prefix, Ptr<NetDevice> nd, bool promiscuous, bool explicitFilename);
243
255 virtual void EnableAsciiInternal (Ptr<OutputStreamWrapper> stream,
256 std::string prefix,
258 bool explicitFilename);
259
264};
265
266} // namespace ns3
267
268#endif /* CSMA_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
build a set of CsmaNetDevice objects
Definition: csma-helper.h:47
virtual ~CsmaHelper()
Definition: csma-helper.h:53
void DisableFlowControl(void)
Disable flow control only if you know what you are doing.
Definition: csma-helper.cc:79
virtual void EnablePcapInternal(std::string prefix, Ptr< NetDevice > nd, bool promiscuous, bool explicitFilename)
Enable pcap output on the indicated net device.
Definition: csma-helper.cc:85
ObjectFactory m_channelFactory
factory for the channel
Definition: csma-helper.h:262
void SetDeviceAttribute(std::string n1, const AttributeValue &v1)
Definition: csma-helper.cc:67
bool m_enableFlowControl
whether to enable flow control
Definition: csma-helper.h:263
Ptr< NetDevice > InstallPriv(Ptr< Node > node, Ptr< CsmaChannel > channel) const
This method creates an ns3::CsmaNetDevice with the attributes configured by CsmaHelper::SetDeviceAttr...
Definition: csma-helper.cc:312
void SetChannelAttribute(std::string n1, const AttributeValue &v1)
Definition: csma-helper.cc:73
CsmaHelper()
Construct a CsmaHelper.
Definition: csma-helper.cc:42
int64_t AssignStreams(NetDeviceContainer c, int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Definition: csma-helper.cc:295
NetDeviceContainer Install(Ptr< Node > node) const
This method creates an ns3::CsmaChannel with the attributes configured by CsmaHelper::SetChannelAttri...
Definition: csma-helper.cc:225
void SetQueue(std::string type, std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue())
Definition: csma-helper.cc:51
ObjectFactory m_queueFactory
factory for the queues
Definition: csma-helper.h:260
virtual void EnableAsciiInternal(Ptr< OutputStreamWrapper > stream, std::string prefix, Ptr< NetDevice > nd, bool explicitFilename)
Enable ascii trace output on the indicated net device.
Definition: csma-helper.cc:124
ObjectFactory m_deviceFactory
factory for the NetDevices
Definition: csma-helper.h:261
A class for an empty attribute value.
Definition: attribute.h:233
holds a vector of ns3::NetDevice pointers
keep track of a set of node pointers.
Instantiate subclasses of ns3::Object.
Base class providing common user-level pcap operations for helpers representing net devices.
Definition: trace-helper.h:554
Every class exported by the ns3 library is enclosed in the ns3 namespace.
channel
Definition: third.py:92