author | Tom Henderson <tomh@tomh.org> |
Mon, 28 Sep 2015 20:27:25 -0700 | |
changeset 11676 | 05ea1489e509 |
parent 11606 | 98fa74311b21 |
permissions | -rw-r--r-- |
9271 | 1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 |
/* |
|
3 |
* Copyright (c) 2012 INRIA, 2012 University of Washington |
|
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: Alina Quereilhac <alina.quereilhac@inria.fr> |
|
19 |
* Claudio Freire <klaussfreire@sourceforge.net> |
|
20 |
*/ |
|
21 |
||
22 |
#ifndef FD_NET_DEVICE_H |
|
23 |
#define FD_NET_DEVICE_H |
|
24 |
||
25 |
#include "ns3/address.h" |
|
26 |
#include "ns3/callback.h" |
|
27 |
#include "ns3/data-rate.h" |
|
28 |
#include "ns3/event-id.h" |
|
29 |
#include "ns3/mac48-address.h" |
|
30 |
#include "ns3/net-device.h" |
|
31 |
#include "ns3/node.h" |
|
32 |
#include "ns3/packet.h" |
|
33 |
#include "ns3/ptr.h" |
|
34 |
#include "ns3/system-condition.h" |
|
35 |
#include "ns3/traced-callback.h" |
|
36 |
#include "ns3/unix-fd-reader.h" |
|
37 |
#include "ns3/system-mutex.h" |
|
38 |
||
11547
941beab1b849
bug 2119: Fixing memory leaks in FdNetDevice test with DefaultSimulatorImpl due to non-executed events when simulation ends
Alina Quereilhac <alina.quereilhac@inria.fr>
parents:
11410
diff
changeset
|
39 |
#include <utility> |
941beab1b849
bug 2119: Fixing memory leaks in FdNetDevice test with DefaultSimulatorImpl due to non-executed events when simulation ends
Alina Quereilhac <alina.quereilhac@inria.fr>
parents:
11410
diff
changeset
|
40 |
#include <queue> |
9271 | 41 |
|
42 |
namespace ns3 { |
|
43 |
||
44 |
||
45 |
/** |
|
10407
ea97f1c81af5
Fix doxygen module references
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10401
diff
changeset
|
46 |
* \defgroup fd-net-device File Descriptor Network Device |
9271 | 47 |
* This section documents the API of the ns-3 fd-net-device module. |
48 |
* For a generic functional description, please refer to the ns-3 manual. |
|
49 |
*/ |
|
50 |
||
51 |
/** |
|
52 |
* \ingroup fd-net-device |
|
11407
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
53 |
* \brief This class performs the actual data reading from the sockets. |
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
54 |
*/ |
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
55 |
class FdNetDeviceFdReader : public FdReader |
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
56 |
{ |
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
57 |
public: |
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
58 |
FdNetDeviceFdReader (); |
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
59 |
|
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
60 |
/** |
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
61 |
* Set size of the read buffer. |
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
62 |
*/ |
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
63 |
void SetBufferSize (uint32_t bufferSize); |
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
64 |
|
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
65 |
private: |
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
66 |
FdReader::Data DoRead (void); |
11547
941beab1b849
bug 2119: Fixing memory leaks in FdNetDevice test with DefaultSimulatorImpl due to non-executed events when simulation ends
Alina Quereilhac <alina.quereilhac@inria.fr>
parents:
11410
diff
changeset
|
67 |
|
11407
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
68 |
uint32_t m_bufferSize; //!< size of the read buffer |
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
69 |
}; |
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
70 |
|
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
71 |
class Node; |
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
72 |
|
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
73 |
/** |
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
74 |
* \ingroup fd-net-device |
9271 | 75 |
* |
76 |
* \brief a NetDevice to read/write network traffic from/into a file descriptor. |
|
77 |
* |
|
78 |
* A FdNetDevice object will read and write frames/packets from/to a file descriptor. |
|
79 |
* This file descriptor might be associated to a Linux TAP/TUN device, to a socket |
|
80 |
* or to a user space process, allowing the simulation to exchange traffic with the |
|
81 |
* "outside-world" |
|
82 |
* |
|
83 |
*/ |
|
84 |
class FdNetDevice : public NetDevice |
|
85 |
{ |
|
86 |
public: |
|
11407
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
87 |
/** |
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
88 |
* \brief Get the type ID. |
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
89 |
* \return the object TypeId |
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
90 |
*/ |
9271 | 91 |
static TypeId GetTypeId (void); |
92 |
||
93 |
/** |
|
94 |
* Enumeration of the types of frames supported in the class. |
|
95 |
*/ |
|
96 |
enum EncapsulationMode |
|
97 |
{ |
|
98 |
DIX, /**< DIX II / Ethernet II packet */ |
|
99 |
LLC, /**< 802.2 LLC/SNAP Packet*/ |
|
100 |
DIXPI, /**< When using TAP devices, if flag |
|
101 |
IFF_NO_PI is not set on the device, |
|
102 |
IP packets will have an extra header: |
|
103 |
Flags [2 bytes] |
|
104 |
Proto [2 bytes] |
|
105 |
Raw protocol(IP, IPv6, etc) frame. */ |
|
106 |
}; |
|
107 |
||
108 |
/** |
|
109 |
* Constructor for the FdNetDevice. |
|
110 |
*/ |
|
111 |
FdNetDevice (); |
|
112 |
||
113 |
/** |
|
114 |
* Destructor for the FdNetDevice. |
|
115 |
*/ |
|
116 |
virtual ~FdNetDevice (); |
|
117 |
||
118 |
/** |
|
119 |
* Set the link layer encapsulation mode of this device. |
|
120 |
* |
|
121 |
* \param mode The link layer encapsulation mode of this device. |
|
122 |
* |
|
123 |
*/ |
|
124 |
void SetEncapsulationMode (FdNetDevice::EncapsulationMode mode); |
|
125 |
||
126 |
/** |
|
127 |
* Get the link layer encapsulation mode of this device. |
|
128 |
* |
|
129 |
* \returns The link layer encapsulation mode of this device. |
|
130 |
*/ |
|
131 |
FdNetDevice::EncapsulationMode GetEncapsulationMode (void) const; |
|
132 |
||
133 |
/** |
|
134 |
* Set the associated file descriptor. |
|
135 |
* |
|
136 |
*/ |
|
137 |
void SetFileDescriptor (int fd); |
|
138 |
||
139 |
/** |
|
140 |
* Set a start time for the device. |
|
141 |
* |
|
142 |
* @param tStart the start time |
|
143 |
*/ |
|
144 |
void Start (Time tStart); |
|
145 |
||
146 |
/** |
|
147 |
* Set a stop time for the device. |
|
148 |
* |
|
149 |
* @param tStop the stop time |
|
150 |
*/ |
|
151 |
void Stop (Time tStop); |
|
152 |
||
153 |
// inherited from NetDevice base class. |
|
154 |
virtual void SetIfIndex (const uint32_t index); |
|
155 |
virtual uint32_t GetIfIndex (void) const; |
|
156 |
virtual Ptr<Channel> GetChannel (void) const; |
|
157 |
virtual void SetAddress (Address address); |
|
158 |
virtual Address GetAddress (void) const; |
|
159 |
virtual bool SetMtu (const uint16_t mtu); |
|
160 |
virtual uint16_t GetMtu (void) const; |
|
161 |
virtual bool IsLinkUp (void) const; |
|
162 |
virtual void AddLinkChangeCallback (Callback<void> callback); |
|
163 |
virtual bool IsBroadcast (void) const; |
|
164 |
virtual Address GetBroadcast (void) const; |
|
165 |
virtual bool IsMulticast (void) const; |
|
166 |
virtual Address GetMulticast (Ipv4Address multicastGroup) const; |
|
167 |
virtual bool IsPointToPoint (void) const; |
|
168 |
virtual bool IsBridge (void) const; |
|
169 |
virtual bool Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber); |
|
170 |
virtual bool SendFrom (Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber); |
|
171 |
virtual Ptr<Node> GetNode (void) const; |
|
172 |
virtual void SetNode (Ptr<Node> node); |
|
173 |
virtual bool NeedsArp (void) const; |
|
174 |
virtual void SetReceiveCallback (NetDevice::ReceiveCallback cb); |
|
175 |
virtual void SetPromiscReceiveCallback (NetDevice::PromiscReceiveCallback cb); |
|
176 |
virtual bool SupportsSendFrom () const; |
|
177 |
virtual Address GetMulticast (Ipv6Address addr) const; |
|
178 |
||
11407
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
179 |
/** |
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
180 |
* Set if the NetDevice is able to send Broadcast messages |
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
181 |
* \param broadcast true if the NetDevice can send Broadcast |
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
182 |
*/ |
9271 | 183 |
virtual void SetIsBroadcast (bool broadcast); |
11407
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
184 |
/** |
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
185 |
* Set if the NetDevice is able to send Multicast messages |
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
186 |
* \param multicast true if the NetDevice can send Multicast |
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
187 |
*/ |
9271 | 188 |
virtual void SetIsMulticast (bool multicast); |
189 |
||
190 |
protected: |
|
191 |
virtual void DoDispose (void); |
|
192 |
||
193 |
private: |
|
11407
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
194 |
/** |
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
195 |
* \brief Copy constructor |
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
196 |
* |
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
197 |
* Defined and unimplemented to avoid misuse as suggested in |
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
198 |
* http://www.nsnam.org/wiki/NS-3_Python_Bindings#.22invalid_use_of_incomplete_type.22 |
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
199 |
*/ |
9271 | 200 |
FdNetDevice (FdNetDevice const &); |
201 |
||
202 |
/** |
|
203 |
* Spin up the device |
|
204 |
*/ |
|
205 |
void StartDevice (void); |
|
206 |
||
207 |
/** |
|
208 |
* Tear down the device |
|
209 |
*/ |
|
210 |
void StopDevice (void); |
|
211 |
||
212 |
/** |
|
213 |
* Callback to invoke when a new frame is received |
|
214 |
*/ |
|
215 |
void ReceiveCallback (uint8_t *buf, ssize_t len); |
|
216 |
||
217 |
/** |
|
218 |
* Forward the frame to the appropriate callback for processing |
|
219 |
*/ |
|
11547
941beab1b849
bug 2119: Fixing memory leaks in FdNetDevice test with DefaultSimulatorImpl due to non-executed events when simulation ends
Alina Quereilhac <alina.quereilhac@inria.fr>
parents:
11410
diff
changeset
|
220 |
void ForwardUp (void); |
9271 | 221 |
|
222 |
/** |
|
223 |
* Start Sending a Packet Down the Wire. |
|
224 |
* @param p packet to send |
|
225 |
* @returns true if success, false on failure |
|
226 |
*/ |
|
227 |
bool TransmitStart (Ptr<Packet> p); |
|
228 |
||
11407
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
229 |
/** |
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
230 |
* Notify that the link is up and ready |
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
231 |
*/ |
9271 | 232 |
void NotifyLinkUp (void); |
233 |
||
234 |
/** |
|
235 |
* The ns-3 node associated to the net device. |
|
236 |
*/ |
|
237 |
Ptr<Node> m_node; |
|
238 |
||
11407
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
239 |
/** |
9271 | 240 |
* a copy of the node id so the read thread doesn't have to GetNode() in |
241 |
* in order to find the node ID. Thread unsafe reference counting in |
|
242 |
* multithreaded apps is not a good thing. |
|
243 |
*/ |
|
244 |
uint32_t m_nodeId; |
|
245 |
||
246 |
/** |
|
247 |
* The ns-3 interface index (in the sense of net device index) that has been assigned to this network device. |
|
248 |
*/ |
|
249 |
uint32_t m_ifIndex; |
|
250 |
||
251 |
/** |
|
252 |
* The MTU associated to the file descriptor technology |
|
253 |
*/ |
|
254 |
uint16_t m_mtu; |
|
255 |
||
256 |
/** |
|
257 |
* The file descriptor used for receive/send network traffic. |
|
258 |
*/ |
|
259 |
int m_fd; |
|
260 |
||
261 |
/** |
|
262 |
* Reader for the file descriptor. |
|
263 |
*/ |
|
264 |
Ptr<FdNetDeviceFdReader> m_fdReader; |
|
265 |
||
266 |
/** |
|
267 |
* The net device mac address. |
|
268 |
*/ |
|
269 |
Mac48Address m_address; |
|
270 |
||
271 |
/** |
|
272 |
* The typ of encapsulation of the received/transmited frames. |
|
273 |
*/ |
|
274 |
EncapsulationMode m_encapMode; |
|
275 |
||
276 |
/** |
|
277 |
* Flag indicating whether or not the link is up. In this case, |
|
278 |
* whether or not the device is connected to a channel. |
|
279 |
*/ |
|
280 |
bool m_linkUp; |
|
281 |
||
282 |
/** |
|
283 |
* Callbacks to fire if the link changes state (up or down). |
|
284 |
*/ |
|
285 |
TracedCallback<> m_linkChangeCallbacks; |
|
286 |
||
287 |
/** |
|
288 |
* Flag indicating whether or not the underlying net device supports |
|
289 |
* broadcast. |
|
290 |
*/ |
|
291 |
bool m_isBroadcast; |
|
292 |
||
293 |
/** |
|
294 |
* Flag indicating whether or not the underlying net device supports |
|
295 |
* multicast. |
|
296 |
*/ |
|
297 |
bool m_isMulticast; |
|
298 |
||
299 |
/** |
|
300 |
* Number of packets that were received and scheduled for read but not yeat read. |
|
301 |
*/ |
|
11547
941beab1b849
bug 2119: Fixing memory leaks in FdNetDevice test with DefaultSimulatorImpl due to non-executed events when simulation ends
Alina Quereilhac <alina.quereilhac@inria.fr>
parents:
11410
diff
changeset
|
302 |
std::queue< std::pair<uint8_t *, ssize_t> > m_pendingQueue; |
941beab1b849
bug 2119: Fixing memory leaks in FdNetDevice test with DefaultSimulatorImpl due to non-executed events when simulation ends
Alina Quereilhac <alina.quereilhac@inria.fr>
parents:
11410
diff
changeset
|
303 |
|
9271 | 304 |
/** |
305 |
* Maximum number of packets that can be received and scheduled for read but not yeat read. |
|
306 |
*/ |
|
307 |
uint32_t m_maxPendingReads; |
|
11547
941beab1b849
bug 2119: Fixing memory leaks in FdNetDevice test with DefaultSimulatorImpl due to non-executed events when simulation ends
Alina Quereilhac <alina.quereilhac@inria.fr>
parents:
11410
diff
changeset
|
308 |
|
9271 | 309 |
/** |
310 |
* Mutex to increase pending read counter. |
|
311 |
*/ |
|
312 |
SystemMutex m_pendingReadMutex; |
|
313 |
||
314 |
/** |
|
315 |
* Time to start spinning up the device |
|
316 |
*/ |
|
317 |
Time m_tStart; |
|
318 |
||
319 |
/** |
|
320 |
* Time to start tearing down the device |
|
321 |
*/ |
|
322 |
Time m_tStop; |
|
323 |
||
11407
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
324 |
/** |
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
325 |
* NetDevice start event |
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
326 |
*/ |
9271 | 327 |
EventId m_startEvent; |
11407
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
328 |
/** |
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
329 |
* NetDevice stop event |
c175567f535a
[Doxygen] fd-net-device module fixes
Tommaso Pecorella <tommaso.pecorella@unifi.it>
parents:
11045
diff
changeset
|
330 |
*/ |
9271 | 331 |
EventId m_stopEvent; |
332 |
||
333 |
/** |
|
334 |
* The callback used to notify higher layers that a packet has been received. |
|
335 |
*/ |
|
336 |
NetDevice::ReceiveCallback m_rxCallback; |
|
337 |
||
338 |
/** |
|
339 |
* The callback used to notify higher layers that a packet has been received in promiscuous mode. |
|
340 |
*/ |
|
341 |
NetDevice::PromiscReceiveCallback m_promiscRxCallback; |
|
342 |
||
343 |
/** |
|
344 |
* The trace source fired when packets come into the "top" of the device |
|
345 |
* at the L3/L2 transition, before being queued for transmission. |
|
346 |
* |
|
347 |
* \see class CallBackTraceSource |
|
348 |
*/ |
|
349 |
TracedCallback<Ptr<const Packet> > m_macTxTrace; |
|
350 |
||
351 |
/** |
|
352 |
* The trace source fired when packets coming into the "top" of the device |
|
353 |
* at the L3/L2 transition are dropped before being queued for transmission. |
|
354 |
* |
|
355 |
* \see class CallBackTraceSource |
|
356 |
*/ |
|
357 |
TracedCallback<Ptr<const Packet> > m_macTxDropTrace; |
|
358 |
||
359 |
/** |
|
360 |
* The trace source fired for packets successfully received by the device |
|
361 |
* immediately before being forwarded up to higher layers (at the L2/L3 |
|
362 |
* transition). This is a promiscuous trace. |
|
363 |
* |
|
364 |
* \see class CallBackTraceSource |
|
365 |
*/ |
|
366 |
TracedCallback<Ptr<const Packet> > m_macPromiscRxTrace; |
|
367 |
||
368 |
/** |
|
369 |
* The trace source fired for packets successfully received by the device |
|
370 |
* immediately before being forwarded up to higher layers (at the L2/L3 |
|
371 |
* transition). This is a non-promiscuous trace. |
|
372 |
* |
|
373 |
* \see class CallBackTraceSource |
|
374 |
*/ |
|
375 |
TracedCallback<Ptr<const Packet> > m_macRxTrace; |
|
376 |
||
377 |
/** |
|
378 |
* The trace source fired for packets successfully received by the device |
|
379 |
* but which are dropped before being forwarded up to higher layers (at the |
|
380 |
* L2/L3 transition). |
|
381 |
* |
|
382 |
* \see class CallBackTraceSource |
|
383 |
*/ |
|
384 |
TracedCallback<Ptr<const Packet> > m_macRxDropTrace; |
|
385 |
||
386 |
/** |
|
387 |
* The trace source fired when the phy layer drops a packet as it tries |
|
388 |
* to transmit it. |
|
389 |
* |
|
11606
98fa74311b21
[doxygen] Revise TracedCallback function signatures for const.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11547
diff
changeset
|
390 |
* \todo Remove: this TracedCallback is never invoked. |
98fa74311b21
[doxygen] Revise TracedCallback function signatures for const.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
11547
diff
changeset
|
391 |
* |
9271 | 392 |
* \see class CallBackTraceSource |
393 |
*/ |
|
394 |
TracedCallback<Ptr<const Packet> > m_phyTxDropTrace; |
|
395 |
||
396 |
/** |
|
397 |
* The trace source fired when the phy layer drops a packet it has received. |
|
398 |
* |
|
399 |
* \see class CallBackTraceSource |
|
400 |
*/ |
|
401 |
TracedCallback<Ptr<const Packet> > m_phyRxDropTrace; |
|
402 |
||
403 |
/** |
|
404 |
* A trace source that emulates a non-promiscuous protocol sniffer connected |
|
405 |
* to the device. Unlike your average everyday sniffer, this trace source |
|
406 |
* will not fire on PACKET_OTHERHOST events. |
|
407 |
* |
|
408 |
* On the transmit size, this trace hook will fire after a packet is dequeued |
|
409 |
* from the device queue for transmission. In Linux, for example, this would |
|
410 |
* correspond to the point just before a device hard_start_xmit where |
|
411 |
* dev_queue_xmit_nit is called to dispatch the packet to the PF_PACKET |
|
412 |
* ETH_P_ALL handlers. |
|
413 |
* |
|
414 |
* On the receive side, this trace hook will fire when a packet is received, |
|
415 |
* just before the receive callback is executed. In Linux, for example, |
|
416 |
* this would correspond to the point at which the packet is dispatched to |
|
417 |
* packet sniffers in netif_receive_skb. |
|
418 |
* |
|
419 |
* \see class CallBackTraceSource |
|
420 |
*/ |
|
421 |
TracedCallback<Ptr<const Packet> > m_snifferTrace; |
|
422 |
||
423 |
/** |
|
424 |
* A trace source that emulates a promiscuous mode protocol sniffer connected |
|
425 |
* to the device. This trace source fire on packets destined for any host |
|
426 |
* just like your average everyday packet sniffer. |
|
427 |
* |
|
428 |
* On the transmit size, this trace hook will fire after a packet is dequeued |
|
429 |
* from the device queue for transmission. In Linux, for example, this would |
|
430 |
* correspond to the point just before a device hard_start_xmit where |
|
431 |
* dev_queue_xmit_nit is called to dispatch the packet to the PF_PACKET |
|
432 |
* ETH_P_ALL handlers. |
|
433 |
* |
|
434 |
* On the receive side, this trace hook will fire when a packet is received, |
|
435 |
* just before the receive callback is executed. In Linux, for example, |
|
436 |
* this would correspond to the point at which the packet is dispatched to |
|
437 |
* packet sniffers in netif_receive_skb. |
|
438 |
* |
|
439 |
* \see class CallBackTraceSource |
|
440 |
*/ |
|
441 |
TracedCallback<Ptr<const Packet> > m_promiscSnifferTrace; |
|
442 |
||
443 |
}; |
|
444 |
||
445 |
} // namespace ns3 |
|
446 |
||
447 |
#endif /* FD_NET_DEVICE_H */ |
|
448 |