A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
fd-net-device-helper.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2012 INRIA
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Alina Quereilhac <alina.quereilhac@inria.fr>
7
*
8
*/
9
10
#ifndef FD_NET_DEVICE_HELPER_H
11
#define FD_NET_DEVICE_HELPER_H
12
13
#include "ns3/attribute.h"
14
#include "ns3/fd-net-device.h"
15
#include "ns3/net-device-container.h"
16
#include "ns3/node-container.h"
17
#include "ns3/object-factory.h"
18
#include "ns3/trace-helper.h"
19
20
#include <string>
21
22
namespace
ns3
23
{
24
25
/**
26
* \ingroup fd-net-device
27
* \brief build a set of FdNetDevice objects
28
* Normally we eschew multiple inheritance, however, the classes
29
* PcapUserHelperForDevice and AsciiTraceUserHelperForDevice are
30
* treated as "mixins". A mixin is a self-contained class that
31
* encapsulates a general attribute or a set of functionality that
32
* may be of interest to many other classes.
33
*/
34
class
FdNetDeviceHelper
:
public
PcapHelperForDevice
,
public
AsciiTraceHelperForDevice
35
{
36
public
:
37
/**
38
* Construct a FdNetDeviceHelper.
39
*/
40
FdNetDeviceHelper
();
41
42
~FdNetDeviceHelper
()
override
43
{
44
}
45
46
/**
47
* Set the TypeId of the Objects to be created by this helper.
48
*
49
* \param [in] type The TypeId of the object to instantiate.
50
*/
51
void
SetTypeId
(std::string type);
52
53
/**
54
* \param n1 the name of the attribute to set
55
* \param v1 the value of the attribute to set
56
*
57
* Set these attributes on each ns3::FdNetDevice created
58
* by FdNetDeviceHelper::Install
59
*/
60
void
SetAttribute
(std::string n1,
const
AttributeValue
& v1);
61
62
/**
63
* This method creates a FdNetDevice and associates it to a node
64
*
65
* \param node The node to install the device in
66
* \returns A container holding the added net device.
67
*/
68
virtual
NetDeviceContainer
Install
(
Ptr<Node>
node)
const
;
69
70
/**
71
* This method creates a FdNetDevice and associates it to a node
72
*
73
* \param name The name of the node to install the device in
74
* \returns A container holding the added net device.
75
*/
76
virtual
NetDeviceContainer
Install
(std::string name)
const
;
77
78
/**
79
* This method creates a FdNetDevice and associates it to a node.
80
* For each Ptr<node> in the provided container: it creates an ns3::FdNetDevice
81
* (with the attributes configured by FdNetDeviceHelper::SetDeviceAttribute);
82
* adds the device to the node; and attaches the channel to the device.
83
*
84
* \param c The NodeContainer holding the nodes to be changed.
85
* \returns A container holding the added net devices.
86
*/
87
virtual
NetDeviceContainer
Install
(
const
NodeContainer
& c)
const
;
88
89
protected
:
90
/**
91
* This method creates an ns3::FdNetDevice and associates it to a node
92
*
93
* \param node The node to install the device in
94
* \returns A container holding the added net device.
95
*/
96
virtual
Ptr<NetDevice>
InstallPriv
(
Ptr<Node>
node)
const
;
97
98
private
:
99
/**
100
* \brief Enable pcap output on the indicated net device.
101
*
102
* NetDevice-specific implementation mechanism for hooking the trace and
103
* writing to the trace file.
104
*
105
* \param prefix Filename prefix to use for pcap files.
106
* \param nd Net device for which you want to enable tracing.
107
* \param promiscuous If true capture all possible packets available at the device.
108
* \param explicitFilename Treat the prefix as an explicit filename if true
109
*/
110
void
EnablePcapInternal
(std::string prefix,
111
Ptr<NetDevice>
nd,
112
bool
promiscuous,
113
bool
explicitFilename)
override
;
114
115
/**
116
* \brief Enable ascii trace output on the indicated net device.
117
*
118
* NetDevice-specific implementation mechanism for hooking the trace and
119
* writing to the trace file.
120
*
121
* \param stream The output stream object to use when logging ascii traces.
122
* \param prefix Filename prefix to use for ascii trace files.
123
* \param nd Net device for which you want to enable tracing.
124
* \param explicitFilename Treat the prefix as an explicit filename if true
125
*/
126
void
EnableAsciiInternal
(
Ptr<OutputStreamWrapper>
stream,
127
std::string prefix,
128
Ptr<NetDevice>
nd,
129
bool
explicitFilename)
override
;
130
131
ObjectFactory
m_deviceFactory
;
//!< factory for the NetDevices
132
};
133
134
}
// namespace ns3
135
136
#endif
/* FD_NET_DEVICE_HELPER_H */
ns3::AsciiTraceHelperForDevice
Base class providing common user-level ascii trace operations for helpers representing net devices.
Definition
trace-helper.h:718
ns3::AttributeValue
Hold a value for an Attribute.
Definition
attribute.h:59
ns3::FdNetDeviceHelper
build a set of FdNetDevice objects Normally we eschew multiple inheritance, however,...
Definition
fd-net-device-helper.h:35
ns3::FdNetDeviceHelper::SetAttribute
void SetAttribute(std::string n1, const AttributeValue &v1)
Definition
fd-net-device-helper.cc:41
ns3::FdNetDeviceHelper::Install
virtual NetDeviceContainer Install(Ptr< Node > node) const
This method creates a FdNetDevice and associates it to a node.
Definition
fd-net-device-helper.cc:174
ns3::FdNetDeviceHelper::m_deviceFactory
ObjectFactory m_deviceFactory
factory for the NetDevices
Definition
fd-net-device-helper.h:131
ns3::FdNetDeviceHelper::InstallPriv
virtual Ptr< NetDevice > InstallPriv(Ptr< Node > node) const
This method creates an ns3::FdNetDevice and associates it to a node.
Definition
fd-net-device-helper.cc:200
ns3::FdNetDeviceHelper::EnablePcapInternal
void EnablePcapInternal(std::string prefix, Ptr< NetDevice > nd, bool promiscuous, bool explicitFilename) override
Enable pcap output on the indicated net device.
Definition
fd-net-device-helper.cc:48
ns3::FdNetDeviceHelper::FdNetDeviceHelper
FdNetDeviceHelper()
Construct a FdNetDeviceHelper.
Definition
fd-net-device-helper.cc:29
ns3::FdNetDeviceHelper::~FdNetDeviceHelper
~FdNetDeviceHelper() override
Definition
fd-net-device-helper.h:42
ns3::FdNetDeviceHelper::SetTypeId
void SetTypeId(std::string type)
Set the TypeId of the Objects to be created by this helper.
Definition
fd-net-device-helper.cc:35
ns3::FdNetDeviceHelper::EnableAsciiInternal
void EnableAsciiInternal(Ptr< OutputStreamWrapper > stream, std::string prefix, Ptr< NetDevice > nd, bool explicitFilename) override
Enable ascii trace output on the indicated net device.
Definition
fd-net-device-helper.cc:91
ns3::NetDeviceContainer
holds a vector of ns3::NetDevice pointers
Definition
net-device-container.h:32
ns3::NodeContainer
keep track of a set of node pointers.
Definition
node-container.h:29
ns3::ObjectFactory
Instantiate subclasses of ns3::Object.
Definition
object-factory.h:37
ns3::PcapHelperForDevice
Base class providing common user-level pcap operations for helpers representing net devices.
Definition
trace-helper.h:613
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
mpi-test-fixtures.h:37
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
fd-net-device
helper
fd-net-device-helper.h
Generated on Fri Nov 8 2024 13:59:00 for ns-3 by
1.11.0