OLD | NEW |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2008 INRIA | 3 * Copyright (c) 2008 INRIA |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 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 | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 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 | 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 | 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
17 * | 17 * |
18 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> | 18 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
| 19 * Vedran Miletić <rivanvx@gmail.com> |
19 */ | 20 */ |
20 #ifndef CSMA_HELPER_H | 21 #ifndef CSMA_HELPER_H |
21 #define CSMA_HELPER_H | 22 #define CSMA_HELPER_H |
22 | 23 |
23 #include <string> | 24 #include <string> |
24 | 25 |
25 #include "ns3/attribute.h" | 26 #include "ns3/attribute.h" |
26 #include "ns3/object-factory.h" | 27 #include "ns3/object-factory.h" |
27 #include "ns3/net-device-container.h" | 28 #include "ns3/net-device-container.h" |
28 #include "ns3/node-container.h" | 29 #include "ns3/node-container.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 void SetChannelAttribute (std::string n1, const AttributeValue &v1); | 92 void SetChannelAttribute (std::string n1, const AttributeValue &v1); |
92 | 93 |
93 /** | 94 /** |
94 * This method creates an ns3::CsmaChannel with the attributes configured by | 95 * This method creates an ns3::CsmaChannel with the attributes configured by |
95 * CsmaHelper::SetChannelAttribute, an ns3::CsmaNetDevice with the attributes | 96 * CsmaHelper::SetChannelAttribute, an ns3::CsmaNetDevice with the attributes |
96 * configured by CsmaHelper::SetDeviceAttribute and then adds the device | 97 * configured by CsmaHelper::SetDeviceAttribute and then adds the device |
97 * to the node and attaches the channel to the device. | 98 * to the node and attaches the channel to the device. |
98 * | 99 * |
99 * \param node The node to install the device in | 100 * \param node The node to install the device in |
100 * \returns A container holding the added net device. | 101 * \returns A container holding the added net device. |
| 102 * \param distance Distance in metres from one end of the wire. |
101 */ | 103 */ |
102 NetDeviceContainer Install (Ptr<Node> node) const; | 104 NetDeviceContainer Install (Ptr<Node> node, double distance) const; |
103 | 105 |
104 /** | 106 /** |
105 * This method creates an ns3::CsmaChannel with the attributes configured by | 107 * This method creates an ns3::CsmaChannel with the attributes configured by |
106 * CsmaHelper::SetChannelAttribute, an ns3::CsmaNetDevice with the attributes | 108 * CsmaHelper::SetChannelAttribute, an ns3::CsmaNetDevice with the attributes |
107 * configured by CsmaHelper::SetDeviceAttribute and then adds the device | 109 * configured by CsmaHelper::SetDeviceAttribute and then adds the device |
108 * to the node and attaches the channel to the device. | 110 * to the node and attaches the channel to the device. |
109 * | 111 * |
110 * \param name The name of the node to install the device in | 112 * \param name The name of the node to install the device in |
| 113 * \param distance Distance in metres from one end of the wire. |
111 * \returns A container holding the added net device. | 114 * \returns A container holding the added net device. |
112 */ | 115 */ |
113 NetDeviceContainer Install (std::string name) const; | 116 NetDeviceContainer Install (std::string name, double distance) const; |
114 | 117 |
115 /** | 118 /** |
116 * This method creates an ns3::CsmaNetDevice with the attributes configured by | 119 * This method creates an ns3::CsmaNetDevice with the attributes configured by |
117 * CsmaHelper::SetDeviceAttribute and then adds the device to the node and· | 120 * CsmaHelper::SetDeviceAttribute and then adds the device to the node and· |
118 * attaches the provided channel to the device. | 121 * attaches the provided channel to the device. |
119 * | 122 * |
120 * \param node The node to install the device in | 123 * \param node The node to install the device in |
121 * \param channel The channel to attach to the device. | 124 * \param channel The channel to attach to the device. |
| 125 * \param distance Distance in metres from one end of the wire. |
122 * \returns A container holding the added net device. | 126 * \returns A container holding the added net device. |
123 */ | 127 */ |
124 NetDeviceContainer Install (Ptr<Node> node, Ptr<CsmaChannel> channel) const; | 128 NetDeviceContainer Install (Ptr<Node> node, Ptr<CsmaChannel> channel, double d
istance) const; |
125 | 129 |
126 /** | 130 /** |
127 * This method creates an ns3::CsmaNetDevice with the attributes configured by | 131 * This method creates an ns3::CsmaNetDevice with the attributes configured by |
128 * CsmaHelper::SetDeviceAttribute and then adds the device to the node and· | 132 * CsmaHelper::SetDeviceAttribute and then adds the device to the node and· |
129 * attaches the provided channel to the device. | 133 * attaches the provided channel to the device. |
130 * | 134 * |
131 * \param node The node to install the device in | 135 * \param node The node to install the device in |
132 * \param channelName The name of the channel to attach to the device. | 136 * \param channelName The name of the channel to attach to the device. |
| 137 * \param distance Distance in metres from one end of the wire. |
133 * \returns A container holding the added net device. | 138 * \returns A container holding the added net device. |
134 */ | 139 */ |
135 NetDeviceContainer Install (Ptr<Node> node, std::string channelName) const; | 140 NetDeviceContainer Install (Ptr<Node> node, std::string channelName, double di
stance) const; |
136 | 141 |
137 /** | 142 /** |
138 * This method creates an ns3::CsmaNetDevice with the attributes configured by | 143 * This method creates an ns3::CsmaNetDevice with the attributes configured by |
139 * CsmaHelper::SetDeviceAttribute and then adds the device to the node and· | 144 * CsmaHelper::SetDeviceAttribute and then adds the device to the node and· |
140 * attaches the provided channel to the device. | 145 * attaches the provided channel to the device. |
141 * | 146 * |
142 * \param nodeName The name of the node to install the device in | 147 * \param nodeName The name of the node to install the device in |
143 * \param channel The channel to attach to the device. | 148 * \param channel The channel to attach to the device. |
| 149 * \param distance Distance in metres from one end of the wire. |
144 * \returns A container holding the added net device. | 150 * \returns A container holding the added net device. |
145 */ | 151 */ |
146 NetDeviceContainer Install (std::string nodeName, Ptr<CsmaChannel> channel) co
nst; | 152 NetDeviceContainer Install (std::string nodeName, Ptr<CsmaChannel> channel, do
uble distance) const; |
147 | 153 |
148 /** | 154 /** |
149 * This method creates an ns3::CsmaNetDevice with the attributes configured by | 155 * This method creates an ns3::CsmaNetDevice with the attributes configured by |
150 * CsmaHelper::SetDeviceAttribute and then adds the device to the node and· | 156 * CsmaHelper::SetDeviceAttribute and then adds the device to the node and· |
151 * attaches the provided channel to the device. | 157 * attaches the provided channel to the device. |
152 * | 158 * |
153 * \param nodeName The name of the node to install the device in | 159 * \param nodeName The name of the node to install the device in |
154 * \param channelName The name of the channel to attach to the device. | 160 * \param channelName The name of the channel to attach to the device. |
| 161 * \param distance Distance in metres from one end of the wire. |
155 * \returns A container holding the added net device. | 162 * \returns A container holding the added net device. |
156 */ | 163 */ |
157 NetDeviceContainer Install (std::string nodeName, std::string channelName) con
st; | 164 NetDeviceContainer Install (std::string nodeName, std::string channelName, dou
ble distance) const; |
158 | 165 |
159 /** | 166 /** |
160 * This method creates an ns3::CsmaChannel with the attributes configured by | 167 * This method creates an ns3::CsmaChannel with the attributes configured by |
161 * CsmaHelper::SetChannelAttribute. For each Ptr<node> in the provided | 168 * CsmaHelper::SetChannelAttribute. For each Ptr<node> in the provided |
162 * container: it creates an ns3::CsmaNetDevice (with the attributes· | 169 * container: it creates an ns3::CsmaNetDevice (with the attributes· |
163 * configured by CsmaHelper::SetDeviceAttribute); adds the device to the· | 170 * configured by CsmaHelper::SetDeviceAttribute); adds the device to the· |
164 * node; and attaches the channel to the device. | 171 * node; and attaches the channel to the device. |
165 * | 172 * |
166 * \param c The NodeContainer holding the nodes to be changed. | 173 * \param c The NodeContainer holding the nodes to be changed. |
167 * \returns A container holding the added net devices. | 174 * \returns A container holding the added net devices. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 * CsmaNetDevice should be modified to use a fixed stream | 209 * CsmaNetDevice should be modified to use a fixed stream |
203 * \param stream first stream index to use | 210 * \param stream first stream index to use |
204 * \return the number of stream indices assigned by this helper | 211 * \return the number of stream indices assigned by this helper |
205 */ | 212 */ |
206 int64_t AssignStreams (NetDeviceContainer c, int64_t stream); | 213 int64_t AssignStreams (NetDeviceContainer c, int64_t stream); |
207 | 214 |
208 private: | 215 private: |
209 /* | 216 /* |
210 * \internal | 217 * \internal |
211 */ | 218 */ |
212 Ptr<NetDevice> InstallPriv (Ptr<Node> node, Ptr<CsmaChannel> channel) const; | 219 Ptr<NetDevice> InstallPriv (Ptr<Node> node, Ptr<CsmaChannel> channel, double d
istance) const; |
213 | 220 |
214 /** | 221 /** |
215 * \brief Enable pcap output on the indicated net device. | 222 * \brief Enable pcap output on the indicated net device. |
216 * \internal | 223 * \internal |
217 * | 224 * |
218 * NetDevice-specific implementation mechanism for hooking the trace and | 225 * NetDevice-specific implementation mechanism for hooking the trace and |
219 * writing to the trace file. | 226 * writing to the trace file. |
220 * | 227 * |
221 * \param prefix Filename prefix to use for pcap files. | 228 * \param prefix Filename prefix to use for pcap files. |
222 * \param nd Net device for which you want to enable tracing. | 229 * \param nd Net device for which you want to enable tracing. |
(...skipping 20 matching lines...) Expand all Loading... |
243 bool explicitFilename); | 250 bool explicitFilename); |
244 | 251 |
245 ObjectFactory m_queueFactory; | 252 ObjectFactory m_queueFactory; |
246 ObjectFactory m_deviceFactory; | 253 ObjectFactory m_deviceFactory; |
247 ObjectFactory m_channelFactory; | 254 ObjectFactory m_channelFactory; |
248 }; | 255 }; |
249 | 256 |
250 } // namespace ns3 | 257 } // namespace ns3 |
251 | 258 |
252 #endif /* CSMA_HELPER_H */ | 259 #endif /* CSMA_HELPER_H */ |
OLD | NEW |