|
39 |
|
39 |
|
40 |
/** |
40 |
/** |
41 |
* \defgroup point-to-point Point-To-Point Network Device |
41 |
* \defgroup point-to-point Point-To-Point Network Device |
42 |
* This section documents the API of the ns-3 point-to-point module. For a generic functional description, please refer to the ns-3 manual. |
42 |
* This section documents the API of the ns-3 point-to-point module. For a |
|
|
43 |
* functional description, please refer to the ns-3 manual here: |
44 |
* http://www.nsnam.org/docs/models/html/point-to-point.html |
45 |
* |
46 |
* Be sure to read the manual BEFORE going down to the API. |
43 |
*/ |
47 |
*/ |
44 |
|
48 |
|
45 |
/** |
49 |
/** |
|
54 |
* Key parameters or objects that can be specified for this device |
58 |
* Key parameters or objects that can be specified for this device |
55 |
* include a queue, data rate, and interframe transmission gap (the |
59 |
* include a queue, data rate, and interframe transmission gap (the |
56 |
* propagation delay is set in the PointToPointChannel). |
60 |
* propagation delay is set in the PointToPointChannel). |
|
|
61 |
* |
62 |
* \see SetDataRate |
63 |
* \see SetInterframeGap |
64 |
* \see SetReceiveErrorModel |
65 |
* |
57 |
*/ |
66 |
*/ |
58 |
class PointToPointNetDevice : public NetDevice |
67 |
class PointToPointNetDevice : public NetDevice |
59 |
{ |
68 |
{ |
60 |
public: |
69 |
public: |
|
|
70 |
/** |
71 |
* \brief Get the TypeId |
72 |
* |
73 |
* \return The TypeId for this class |
74 |
*/ |
61 |
static TypeId GetTypeId (void); |
75 |
static TypeId GetTypeId (void); |
62 |
|
76 |
|
63 |
/** |
77 |
/** |
|
81 |
* set in the Attach () method from the corresponding field in the channel |
95 |
* set in the Attach () method from the corresponding field in the channel |
82 |
* to which the device is attached. It can be overridden using this method. |
96 |
* to which the device is attached. It can be overridden using this method. |
83 |
* |
97 |
* |
84 |
* @see Attach () |
98 |
* \see Attach () |
85 |
* @param bps the data rate at which this object operates |
99 |
* \param bps the data rate at which this object operates |
86 |
*/ |
100 |
*/ |
87 |
void SetDataRate (DataRate bps); |
101 |
void SetDataRate (DataRate bps); |
88 |
|
102 |
|
|
90 |
* Set the interframe gap used to separate packets. The interframe gap |
104 |
* Set the interframe gap used to separate packets. The interframe gap |
91 |
* defines the minimum space required between packets sent by this device. |
105 |
* defines the minimum space required between packets sent by this device. |
92 |
* |
106 |
* |
93 |
* @param t the interframe gap time |
107 |
* \param t the interframe gap time |
94 |
*/ |
108 |
*/ |
95 |
void SetInterframeGap (Time t); |
109 |
void SetInterframeGap (Time t); |
96 |
|
110 |
|
97 |
/** |
111 |
/** |
98 |
* Attach the device to a channel. |
112 |
* Attach the device to a channel. |
99 |
* |
113 |
* |
100 |
* @param ch Ptr to the channel to which this object is being attached. |
114 |
* \param ch Ptr to the channel to which this object is being attached. |
|
|
115 |
* \return true if the operation was successfull (always true actually) |
101 |
*/ |
116 |
*/ |
102 |
bool Attach (Ptr<PointToPointChannel> ch); |
117 |
bool Attach (Ptr<PointToPointChannel> ch); |
103 |
|
118 |
|
|
107 |
* The PointToPointNetDevice "owns" a queue that implements a queueing |
122 |
* The PointToPointNetDevice "owns" a queue that implements a queueing |
108 |
* method such as DropTail or RED. |
123 |
* method such as DropTail or RED. |
109 |
* |
124 |
* |
110 |
* @see Queue |
125 |
* \see Queue |
111 |
* @see DropTailQueue |
126 |
* \see DropTailQueue |
112 |
* @param queue Ptr to the new queue. |
127 |
* \param queue Ptr to the new queue. |
113 |
*/ |
128 |
*/ |
114 |
void SetQueue (Ptr<Queue> queue); |
129 |
void SetQueue (Ptr<Queue> queue); |
115 |
|
130 |
|
116 |
/** |
131 |
/** |
117 |
* Get a copy of the attached Queue. |
132 |
* Get a copy of the attached Queue. |
118 |
* |
133 |
* |
119 |
* @returns Ptr to the queue. |
134 |
* \returns Ptr to the queue. |
120 |
*/ |
135 |
*/ |
121 |
Ptr<Queue> GetQueue (void) const; |
136 |
Ptr<Queue> GetQueue (void) const; |
122 |
|
137 |
|
|
126 |
* The PointToPointNetDevice may optionally include an ErrorModel in |
141 |
* The PointToPointNetDevice may optionally include an ErrorModel in |
127 |
* the packet receive chain. |
142 |
* the packet receive chain. |
128 |
* |
143 |
* |
129 |
* @see ErrorModel |
144 |
* \see ErrorModel |
130 |
* @param em Ptr to the ErrorModel. |
145 |
* \param em Ptr to the ErrorModel. |
131 |
*/ |
146 |
*/ |
132 |
void SetReceiveErrorModel (Ptr<ErrorModel> em); |
147 |
void SetReceiveErrorModel (Ptr<ErrorModel> em); |
133 |
|
148 |
|
|
139 |
* used by the channel to indicate that the last bit of a packet has |
154 |
* used by the channel to indicate that the last bit of a packet has |
140 |
* arrived at the device. |
155 |
* arrived at the device. |
141 |
* |
156 |
* |
142 |
* @see PointToPointChannel |
157 |
* \see PointToPointChannel |
143 |
* @param p Ptr to the received packet. |
158 |
* \param p Ptr to the received packet. |
144 |
*/ |
159 |
*/ |
145 |
void Receive (Ptr<Packet> p); |
160 |
void Receive (Ptr<Packet> p); |
146 |
|
161 |
|
|
186 |
virtual bool SupportsSendFrom (void) const; |
201 |
virtual bool SupportsSendFrom (void) const; |
187 |
|
202 |
|
188 |
protected: |
203 |
protected: |
|
|
204 |
/** |
205 |
* \brief Handler for MPI receive event |
206 |
* |
207 |
* \param p Packet received |
208 |
*/ |
189 |
void DoMpiReceive (Ptr<Packet> p); |
209 |
void DoMpiReceive (Ptr<Packet> p); |
190 |
|
210 |
|
191 |
private: |
211 |
private: |
192 |
|
212 |
|
193 |
PointToPointNetDevice& operator = (const PointToPointNetDevice &); |
213 |
/** |
194 |
PointToPointNetDevice (const PointToPointNetDevice &); |
214 |
* \brief Assign operator |
|
|
215 |
* |
216 |
* The method is private, so it is DISABLED. |
217 |
* |
218 |
* \param o Other NetDevice |
219 |
* \return New instance of the NetDevice |
220 |
*/ |
221 |
PointToPointNetDevice& operator = (const PointToPointNetDevice &o); |
195 |
|
222 |
|
|
|
223 |
/** |
224 |
* \brief Copy constructor |
225 |
* |
226 |
* The method is private, so it is DISABLED. |
227 |
|
228 |
* \param o Other NetDevice |
229 |
*/ |
230 |
PointToPointNetDevice (const PointToPointNetDevice &o); |
231 |
|
232 |
/** |
233 |
* \brief Dispose of the object |
234 |
*/ |
196 |
virtual void DoDispose (void); |
235 |
virtual void DoDispose (void); |
197 |
|
236 |
|
198 |
private: |
237 |
private: |
|
231 |
* started sending signals. An event is scheduled for the time at which |
270 |
* started sending signals. An event is scheduled for the time at which |
232 |
* the bits have been completely transmitted. |
271 |
* the bits have been completely transmitted. |
233 |
* |
272 |
* |
234 |
* @see PointToPointChannel::TransmitStart () |
273 |
* \see PointToPointChannel::TransmitStart () |
235 |
* @see TransmitCompleteEvent () |
274 |
* \see TransmitCompleteEvent () |
236 |
* @param p a reference to the packet to send |
275 |
* \param p a reference to the packet to send |
237 |
* @returns true if success, false on failure |
276 |
* \returns true if success, false on failure |
238 |
*/ |
277 |
*/ |
239 |
bool TransmitStart (Ptr<Packet> p); |
278 |
bool TransmitStart (Ptr<Packet> p); |
240 |
|
279 |
|
|
246 |
*/ |
285 |
*/ |
247 |
void TransmitComplete (void); |
286 |
void TransmitComplete (void); |
248 |
|
287 |
|
|
|
288 |
/** |
289 |
* \brief Make the link up and running |
290 |
* |
291 |
* It calls also the linkChange callback. |
292 |
*/ |
249 |
void NotifyLinkUp (void); |
293 |
void NotifyLinkUp (void); |
250 |
|
294 |
|
251 |
/** |
295 |
/** |
|
258 |
}; |
302 |
}; |
259 |
/** |
303 |
/** |
260 |
* The state of the Net Device transmit state machine. |
304 |
* The state of the Net Device transmit state machine. |
261 |
* @see TxMachineState |
305 |
* \see TxMachineState |
262 |
*/ |
306 |
*/ |
263 |
TxMachineState m_txMachineState; |
307 |
TxMachineState m_txMachineState; |
264 |
|
308 |
|
265 |
/** |
309 |
/** |
266 |
* The data rate that the Net Device uses to simulate packet transmission |
310 |
* The data rate that the Net Device uses to simulate packet transmission |
267 |
* timing. |
311 |
* timing. |
268 |
* @see class DataRate |
312 |
* \see class DataRate |
269 |
*/ |
313 |
*/ |
270 |
DataRate m_bps; |
314 |
DataRate m_bps; |
271 |
|
315 |
|
272 |
/** |
316 |
/** |
273 |
* The interframe gap that the Net Device uses to throttle packet |
317 |
* The interframe gap that the Net Device uses to throttle packet |
274 |
* transmission |
318 |
* transmission |
275 |
* @see class Time |
319 |
* \see class Time |
276 |
*/ |
320 |
*/ |
277 |
Time m_tInterframeGap; |
321 |
Time m_tInterframeGap; |
278 |
|
322 |
|
279 |
/** |
323 |
/** |
280 |
* The PointToPointChannel to which this PointToPointNetDevice has been |
324 |
* The PointToPointChannel to which this PointToPointNetDevice has been |
281 |
* attached. |
325 |
* attached. |
282 |
* @see class PointToPointChannel |
326 |
* \see class PointToPointChannel |
283 |
*/ |
327 |
*/ |
284 |
Ptr<PointToPointChannel> m_channel; |
328 |
Ptr<PointToPointChannel> m_channel; |
285 |
|
329 |
|
|
287 |
* The Queue which this PointToPointNetDevice uses as a packet source. |
331 |
* The Queue which this PointToPointNetDevice uses as a packet source. |
288 |
* Management of this Queue has been delegated to the PointToPointNetDevice |
332 |
* Management of this Queue has been delegated to the PointToPointNetDevice |
289 |
* and it has the responsibility for deletion. |
333 |
* and it has the responsibility for deletion. |
290 |
* @see class Queue |
334 |
* \see class Queue |
291 |
* @see class DropTailQueue |
335 |
* \see class DropTailQueue |
292 |
*/ |
336 |
*/ |
293 |
Ptr<Queue> m_queue; |
337 |
Ptr<Queue> m_queue; |
294 |
|
338 |
|
|
431 |
*/ |
475 |
*/ |
432 |
TracedCallback<Ptr<const Packet> > m_promiscSnifferTrace; |
476 |
TracedCallback<Ptr<const Packet> > m_promiscSnifferTrace; |
433 |
|
477 |
|
434 |
Ptr<Node> m_node; |
478 |
Ptr<Node> m_node; //!< Node owning this NetDevice |
435 |
Mac48Address m_address; |
479 |
Mac48Address m_address; //!< Address of this NetDevice |
436 |
NetDevice::ReceiveCallback m_rxCallback; |
480 |
NetDevice::ReceiveCallback m_rxCallback; //!< Receive callback |
437 |
NetDevice::PromiscReceiveCallback m_promiscCallback; |
481 |
NetDevice::PromiscReceiveCallback m_promiscCallback; //!< Receive callback |
438 |
uint32_t m_ifIndex; |
482 |
// (promisc data) |
439 |
bool m_linkUp; |
483 |
uint32_t m_ifIndex; //!< Index of the interface |
440 |
TracedCallback<> m_linkChangeCallbacks; |
484 |
bool m_linkUp; //!< Identify if the link is up or not |
|
|
485 |
TracedCallback<> m_linkChangeCallbacks; //!< Callback for the link change event |
441 |
|
486 |
|
442 |
static const uint16_t DEFAULT_MTU = 1500; |
487 |
static const uint16_t DEFAULT_MTU = 1500; //!< Default MTU |
443 |
|
488 |
|
444 |
/** |
489 |
/** |
445 |
* The Maximum Transmission Unit. This corresponds to the maximum |
490 |
* \brief The Maximum Transmission Unit |
|
|
491 |
* |
492 |
* This corresponds to the maximum |
446 |
* number of bytes that can be transmitted as seen from higher layers. |
493 |
* number of bytes that can be transmitted as seen from higher layers. |
447 |
* This corresponds to the 1500 byte MTU size often seen on IP over |
494 |
* This corresponds to the 1500 byte MTU size often seen on IP over |
448 |
* Ethernet. |
495 |
* Ethernet. |
449 |
*/ |
496 |
*/ |
450 |
uint32_t m_mtu; |
497 |
uint32_t m_mtu; |
451 |
|
498 |
|
452 |
Ptr<Packet> m_currentPkt; |
499 |
Ptr<Packet> m_currentPkt; //!< Current packet processed |
453 |
|
500 |
|
454 |
/** |
501 |
/** |
455 |
* \brief PPP to Ethernet protocol number mapping |
502 |
* \brief PPP to Ethernet protocol number mapping |