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 
32 namespace ns3 {
33 
34 class Packet;
35 
47 {
48 public:
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 
102  NetDeviceContainer Install (Ptr<Node> node) const;
103 
113  NetDeviceContainer Install (std::string name) const;
114 
125 
135  NetDeviceContainer Install (Ptr<Node> node, std::string channelName) const;
136 
146  NetDeviceContainer Install (std::string nodeName, Ptr<CsmaChannel> channel) const;
147 
157  NetDeviceContainer Install (std::string nodeName, std::string channelName) const;
158 
169  NetDeviceContainer Install (const NodeContainer &c) const;
170 
182 
193  NetDeviceContainer Install (const NodeContainer &c, std::string channelName) const;
194 
206  int64_t AssignStreams (NetDeviceContainer c, int64_t stream);
207 
208 private:
209 
220 
232  virtual void EnablePcapInternal (std::string prefix, Ptr<NetDevice> nd, bool promiscuous, bool explicitFilename);
233 
245  virtual void EnableAsciiInternal (Ptr<OutputStreamWrapper> stream,
246  std::string prefix,
247  Ptr<NetDevice> nd,
248  bool explicitFilename);
249 
253 };
254 
255 } // namespace ns3
256 
257 #endif /* CSMA_HELPER_H */
Base class providing common user-level ascii trace operations for helpers representing net devices...
Definition: trace-helper.h:641
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:304
void SetChannelAttribute(std::string n1, const AttributeValue &v1)
Definition: csma-helper.cc:71
Hold a value for an Attribute.
Definition: attribute.h:68
Base class providing common user-level pcap operations for helpers representing net devices...
Definition: trace-helper.h:552
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:77
channel
Definition: third.py:85
CsmaHelper()
Construct a CsmaHelper.
Definition: csma-helper.cc:41
A class for an empty attribute value.
Definition: attribute.h:232
ObjectFactory m_deviceFactory
factory for the NetDevices
Definition: csma-helper.h:251
holds a vector of ns3::NetDevice pointers
ObjectFactory m_channelFactory
factory for the channel
Definition: csma-helper.h:252
Every class exported by the ns3 library is enclosed in the ns3 namespace.
keep track of a set of node pointers.
build a set of CsmaNetDevice objects
Definition: csma-helper.h:46
ObjectFactory m_queueFactory
factory for the queues
Definition: csma-helper.h:250
void SetDeviceAttribute(std::string n1, const AttributeValue &v1)
Definition: csma-helper.cc:65
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:116
NetDeviceContainer Install(Ptr< Node > node) const
This method creates an ns3::CsmaChannel with the attributes configured by CsmaHelper::SetChannelAttri...
Definition: csma-helper.cc:217
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:287
Instantiate subclasses of ns3::Object.
virtual ~CsmaHelper()
Definition: csma-helper.h:53
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:49