LEFT | RIGHT |
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) 2007 Emmanuelle Laprise | 3 * Copyright (c) 2007 Emmanuelle Laprise |
4 * Copyright (c) 2011 University of Rijeka | |
5 * | 4 * |
6 * 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 |
7 * 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 |
8 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
9 * | 8 * |
10 * 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, |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
14 * | 13 * |
15 * 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 |
16 * along with this program; if not, write to the Free Software | 15 * along with this program; if not, write to the Free Software |
17 * 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 |
18 * | 17 * |
19 * Author: Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca> | 18 * Author: Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca> |
20 * Vedran Miletić <rivanvx@gmail.com> | 19 * Vedran Miletić <rivanvx@gmail.com> |
21 */ | 20 */ |
22 | 21 |
23 #include <cmath> | |
24 #include <cstring> | |
25 | |
26 #include "ns3/log.h" | 22 #include "ns3/log.h" |
27 #include "ns3/queue.h" | 23 #include "ns3/queue.h" |
28 #include "ns3/simulator.h" | 24 #include "ns3/simulator.h" |
29 #include "ns3/ethernet-header.h" | 25 #include "ns3/ethernet-header.h" |
30 #include "ns3/ethernet-trailer.h" | 26 #include "ns3/ethernet-trailer.h" |
31 #include "ns3/llc-snap-header.h" | 27 #include "ns3/llc-snap-header.h" |
32 #include "ns3/error-model.h" | 28 #include "ns3/error-model.h" |
33 #include "ns3/double.h" | |
34 #include "ns3/enum.h" | 29 #include "ns3/enum.h" |
35 #include "ns3/boolean.h" | 30 #include "ns3/boolean.h" |
36 #include "ns3/uinteger.h" | 31 #include "ns3/uinteger.h" |
37 #include "ns3/pointer.h" | 32 #include "ns3/pointer.h" |
38 #include "ns3/trace-source-accessor.h" | 33 #include "ns3/trace-source-accessor.h" |
39 | |
40 #include "csma-net-device.h" | 34 #include "csma-net-device.h" |
41 #include "csma-channel.h" | 35 #include "csma-channel.h" |
42 | 36 |
| 37 #include <cstring> |
| 38 #include <cmath> |
43 | 39 |
44 NS_LOG_COMPONENT_DEFINE ("CsmaNetDevice"); | 40 NS_LOG_COMPONENT_DEFINE ("CsmaNetDevice"); |
45 | 41 |
46 namespace ns3 { | 42 namespace ns3 { |
47 | 43 |
48 NS_OBJECT_ENSURE_REGISTERED (CsmaNetDevice); | 44 NS_OBJECT_ENSURE_REGISTERED (CsmaNetDevice); |
49 | 45 |
50 TypeId | 46 TypeId |
51 CsmaNetDevice::GetTypeId (void) | 47 CsmaNetDevice::GetTypeId (void) |
52 { | 48 { |
(...skipping 24 matching lines...) Expand all Loading... |
77 .AddAttribute ("ReceiveEnable", | 73 .AddAttribute ("ReceiveEnable", |
78 "Enable or disable the receiver section of the device.", | 74 "Enable or disable the receiver section of the device.", |
79 BooleanValue (true), | 75 BooleanValue (true), |
80 MakeBooleanAccessor (&CsmaNetDevice::m_receiveEnable), | 76 MakeBooleanAccessor (&CsmaNetDevice::m_receiveEnable), |
81 MakeBooleanChecker ()) | 77 MakeBooleanChecker ()) |
82 .AddAttribute ("ReceiveErrorModel",· | 78 .AddAttribute ("ReceiveErrorModel",· |
83 "The receiver error model used to simulate packet loss", | 79 "The receiver error model used to simulate packet loss", |
84 PointerValue (), | 80 PointerValue (), |
85 MakePointerAccessor (&CsmaNetDevice::m_receiveErrorModel), | 81 MakePointerAccessor (&CsmaNetDevice::m_receiveErrorModel), |
86 MakePointerChecker<ErrorModel> ()) | 82 MakePointerChecker<ErrorModel> ()) |
| 83 |
87 // | 84 // |
88 // Transmit queueing discipline for the device which includes its own set | 85 // Transmit queueing discipline for the device which includes its own set |
89 // of trace hooks. | 86 // of trace hooks. |
90 // | 87 // |
91 .AddAttribute ("TxQueue",· | 88 .AddAttribute ("TxQueue",· |
92 "A queue to use as the transmit queue in the device.", | 89 "A queue to use as the transmit queue in the device.", |
93 PointerValue (), | 90 PointerValue (), |
94 MakePointerAccessor (&CsmaNetDevice::m_queue), | 91 MakePointerAccessor (&CsmaNetDevice::m_queue), |
95 MakePointerChecker<Queue> ()) | 92 MakePointerChecker<Queue> ()) |
96 .AddAttribute ("Persistence", | 93 |
97 "Probability of sending after detecting collision", | |
98 DoubleValue (1.0), | |
99 MakeDoubleAccessor (&CsmaNetDevice::m_persistence), | |
100 MakeDoubleChecker<double> ()) | |
101 // | 94 // |
102 // Trace sources at the "top" of the net device, where packets transition | 95 // Trace sources at the "top" of the net device, where packets transition |
103 // to/from higher layers. | 96 // to/from higher layers. |
104 // | 97 // |
105 .AddTraceSource ("MacTx",· | 98 .AddTraceSource ("MacTx",· |
106 "Trace source indicating a packet has arrived for transmiss
ion by this device", | 99 "Trace source indicating a packet has arrived for transmiss
ion by this device", |
107 MakeTraceSourceAccessor (&CsmaNetDevice::m_macTxTrace)) | 100 MakeTraceSourceAccessor (&CsmaNetDevice::m_macTxTrace)) |
108 .AddTraceSource ("MacTxDrop",· | 101 .AddTraceSource ("MacTxDrop",· |
109 "Trace source indicating a packet has been dropped by the d
evice before transmission", | 102 "Trace source indicating a packet has been dropped by the d
evice before transmission", |
110 MakeTraceSourceAccessor (&CsmaNetDevice::m_macTxDropTrace)) | 103 MakeTraceSourceAccessor (&CsmaNetDevice::m_macTxDropTrace)) |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 "Trace source simulating a non-promiscuous packet sniffer a
ttached to the device", | 150 "Trace source simulating a non-promiscuous packet sniffer a
ttached to the device", |
158 MakeTraceSourceAccessor (&CsmaNetDevice::m_snifferTrace)) | 151 MakeTraceSourceAccessor (&CsmaNetDevice::m_snifferTrace)) |
159 .AddTraceSource ("PromiscSniffer",· | 152 .AddTraceSource ("PromiscSniffer",· |
160 "Trace source simulating a promiscuous packet sniffer attac
hed to the device", | 153 "Trace source simulating a promiscuous packet sniffer attac
hed to the device", |
161 MakeTraceSourceAccessor (&CsmaNetDevice::m_promiscSnifferTr
ace)) | 154 MakeTraceSourceAccessor (&CsmaNetDevice::m_promiscSnifferTr
ace)) |
162 ; | 155 ; |
163 return tid; | 156 return tid; |
164 } | 157 } |
165 | 158 |
166 CsmaNetDevice::CsmaNetDevice () | 159 CsmaNetDevice::CsmaNetDevice () |
167 : | 160 : m_linkUp (false) |
168 m_txMachineState (TX_READY), | |
169 m_carrierSenseCounter (0), | |
170 m_tInterframeGap (Seconds (0)), | |
171 m_channel (0), | |
172 m_linkUp (false) | |
173 { | 161 { |
174 NS_LOG_FUNCTION (this); | 162 NS_LOG_FUNCTION (this); |
| 163 m_txMachineState = READY; |
| 164 m_tInterframeGap = Seconds (0); |
| 165 m_channel = 0;· |
175 | 166 |
176 //· | 167 //· |
177 // We would like to let the attribute system take care of initializing the· | 168 // We would like to let the attribute system take care of initializing the· |
178 // packet encapsulation stuff, but we also don't want to get caught up in | 169 // packet encapsulation stuff, but we also don't want to get caught up in |
179 // initialization order changes. So we'll get the three problem variables | 170 // initialization order changes. So we'll get the three problem variables |
180 // into a consistent state here before the attribute calls, and then depend | 171 // into a consistent state here before the attribute calls, and then depend |
181 // on the semantics of the setters to preserve a consistent state. This· | 172 // on the semantics of the setters to preserve a consistent state. This· |
182 // really doesn't have to be the same set of values as the initial values· | 173 // really doesn't have to be the same set of values as the initial values· |
183 // set by the attributes, but it does have to be a consistent set. That is, | 174 // set by the attributes, but it does have to be a consistent set. That is, |
184 // you can just change the default encapsulation mode above without having· | 175 // you can just change the default encapsulation mode above without having· |
185 // to change it here. | 176 // to change it here. |
186 // | 177 // |
187 m_encapMode = DIX; | 178 m_encapMode = DIX; |
188 m_persistenceRandomVariable = UniformVariable (0.0, 1.0); | |
189 } | 179 } |
190 | 180 |
191 CsmaNetDevice::~CsmaNetDevice() | 181 CsmaNetDevice::~CsmaNetDevice() |
192 { | 182 { |
193 NS_LOG_FUNCTION_NOARGS (); | 183 NS_LOG_FUNCTION_NOARGS (); |
194 m_queue = 0; | 184 m_queue = 0; |
195 } | 185 } |
196 | 186 |
197 void | 187 void |
198 CsmaNetDevice::DoDispose () | 188 CsmaNetDevice::DoDispose () |
(...skipping 28 matching lines...) Expand all Loading... |
227 NS_LOG_FUNCTION (this << sense); | 217 NS_LOG_FUNCTION (this << sense); |
228 | 218 |
229 m_carrierSense = sense; | 219 m_carrierSense = sense; |
230 | 220 |
231 NS_LOG_LOGIC ("m_carrierSense = " << m_carrierSense); | 221 NS_LOG_LOGIC ("m_carrierSense = " << m_carrierSense); |
232 } | 222 } |
233 | 223 |
234 CsmaNetDevice::CarrierSense | 224 CsmaNetDevice::CarrierSense |
235 CsmaNetDevice::GetCarrierSense (void) | 225 CsmaNetDevice::GetCarrierSense (void) |
236 { | 226 { |
237 NS_LOG_FUNCTION_NOARGS (); | 227 NS_LOG_FUNCTION (this); |
238 return m_carrierSense; | 228 return m_carrierSense; |
239 } | 229 } |
240 | 230 |
241 bool | 231 bool |
242 CsmaNetDevice::SetMtu (uint16_t mtu) | 232 CsmaNetDevice::SetMtu (uint16_t mtu) |
243 { | 233 { |
244 NS_LOG_FUNCTION (this << mtu); | 234 NS_LOG_FUNCTION (this << mtu); |
245 m_mtu = mtu; | 235 m_mtu = mtu; |
246 | 236 |
247 NS_LOG_LOGIC ("m_encapMode = " << m_encapMode); | 237 NS_LOG_LOGIC ("m_encapMode = " << m_encapMode); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 { | 288 { |
299 NS_LOG_FUNCTION (slotTime << minSlots << maxSlots << ceiling << maxRetries); | 289 NS_LOG_FUNCTION (slotTime << minSlots << maxSlots << ceiling << maxRetries); |
300 m_backoff.m_slotTime = slotTime; | 290 m_backoff.m_slotTime = slotTime; |
301 m_backoff.m_minSlots = minSlots; | 291 m_backoff.m_minSlots = minSlots; |
302 m_backoff.m_maxSlots = maxSlots; | 292 m_backoff.m_maxSlots = maxSlots; |
303 m_backoff.m_ceiling = ceiling; | 293 m_backoff.m_ceiling = ceiling; |
304 m_backoff.m_maxRetries = maxRetries; | 294 m_backoff.m_maxRetries = maxRetries; |
305 } | 295 } |
306 | 296 |
307 void | 297 void |
308 CsmaNetDevice::AddHeader (Ptr<Packet> p, Mac48Address source, Mac48Address dest,
uint16_t protocolNumber) | 298 CsmaNetDevice::AddHeader (Ptr<Packet> p, Mac48Address source, Mac48Address de
st, uint16_t protocolNumber) |
309 { | 299 { |
310 NS_LOG_FUNCTION (p << source << dest << protocolNumber); | 300 NS_LOG_FUNCTION (p << source << dest << protocolNumber); |
311 | 301 |
312 EthernetHeader header (false); | 302 EthernetHeader header (false); |
313 header.SetSource (source); | 303 header.SetSource (source); |
314 header.SetDestination (dest); | 304 header.SetDestination (dest); |
315 | 305 |
316 EthernetTrailer trailer; | 306 EthernetTrailer trailer; |
317 | 307 |
318 NS_LOG_LOGIC ("p->GetSize () = " << p->GetSize ()); | 308 NS_LOG_LOGIC ("p->GetSize () = " << p->GetSize ()); |
(...skipping 13 matching lines...) Expand all Loading... |
332 | 322 |
333 // | 323 // |
334 // All Ethernet frames must carry a minimum payload of 46 bytes. We need | 324 // All Ethernet frames must carry a minimum payload of 46 bytes. We need |
335 // to pad out if we don't have enough bytes. These must be real bytes· | 325 // to pad out if we don't have enough bytes. These must be real bytes· |
336 // since they will be written to pcap files and compared in regression· | 326 // since they will be written to pcap files and compared in regression· |
337 // trace files. | 327 // trace files. |
338 // | 328 // |
339 if (p->GetSize () < 46) | 329 if (p->GetSize () < 46) |
340 { | 330 { |
341 uint8_t buffer[46]; | 331 uint8_t buffer[46]; |
342 std::memset (buffer, 0, 46); | 332 memset (buffer, 0, 46); |
343 Ptr<Packet> padd = Create<Packet> (buffer, 46 - p->GetSize ()); | 333 Ptr<Packet> padd = Create<Packet> (buffer, 46 - p->GetSize ()); |
344 p->AddAtEnd (padd); | 334 p->AddAtEnd (padd); |
345 } | 335 } |
346 break; | 336 break; |
347 case LLC:· | 337 case LLC:· |
348 { | 338 { |
349 NS_LOG_LOGIC ("Encapsulating packet as LLC (length interpretation)"); | 339 NS_LOG_LOGIC ("Encapsulating packet as LLC (length interpretation)"); |
350 | 340 |
351 LlcSnapHeader llc; | 341 LlcSnapHeader llc; |
352 llc.SetType (protocolNumber); | 342 llc.SetType (protocolNumber); |
353 p->AddHeader (llc); | 343 p->AddHeader (llc); |
354 | 344 |
355 // | 345 // |
356 // This corresponds to the length interpretation of the lengthType· | 346 // This corresponds to the length interpretation of the lengthType· |
357 // field but with an LLC/SNAP header added to the payload as in· | 347 // field but with an LLC/SNAP header added to the payload as in· |
358 // IEEE 802.2 | 348 // IEEE 802.2 |
359 // | 349 // |
360 lengthType = p->GetSize (); | 350 lengthType = p->GetSize (); |
361 | 351 |
362 // | 352 // |
363 // All Ethernet frames must carry a minimum payload of 46 bytes. The· | 353 // All Ethernet frames must carry a minimum payload of 46 bytes. The· |
364 // LLC SNAP header counts as part of this payload. We need to padd out | 354 // LLC SNAP header counts as part of this payload. We need to padd out |
365 // if we don't have enough bytes. These must be real bytes since they· | 355 // if we don't have enough bytes. These must be real bytes since they· |
366 // will be written to pcap files and compared in regression trace files. | 356 // will be written to pcap files and compared in regression trace files. |
367 // | 357 // |
368 if (p->GetSize () < 46) | 358 if (p->GetSize () < 46) |
369 { | 359 { |
370 uint8_t buffer[46]; | 360 uint8_t buffer[46]; |
371 std::memset (buffer, 0, 46); | 361 memset (buffer, 0, 46); |
372 Ptr<Packet> padd = Create<Packet> (buffer, 46 - p->GetSize ()); | 362 Ptr<Packet> padd = Create<Packet> (buffer, 46 - p->GetSize ()); |
373 p->AddAtEnd (padd); | 363 p->AddAtEnd (padd); |
374 } | 364 } |
375 | 365 |
376 NS_ASSERT_MSG (p->GetSize () <= GetMtu (), | 366 NS_ASSERT_MSG (p->GetSize () <= GetMtu (), |
377 "CsmaNetDevice::AddHeader(): 802.3 Length/Type field with
LLC/SNAP: " | 367 "CsmaNetDevice::AddHeader(): 802.3 Length/Type field with
LLC/SNAP: " |
378 "length interpretation must not exceed device frame size
minus overhead"); | 368 "length interpretation must not exceed device frame size
minus overhead"); |
379 } | 369 } |
380 break; | 370 break; |
381 case ILLEGAL: | 371 case ILLEGAL: |
(...skipping 30 matching lines...) Expand all Loading... |
412 (header.GetDestination () != GetAddress ())) | 402 (header.GetDestination () != GetAddress ())) |
413 { | 403 { |
414 return false; | 404 return false; |
415 } | 405 } |
416 | 406 |
417 switch (m_encapMode) | 407 switch (m_encapMode) |
418 { | 408 { |
419 case DIX: | 409 case DIX: |
420 param = header.GetLengthType (); | 410 param = header.GetLengthType (); |
421 break; | 411 break; |
422 case LLC: | 412 case LLC: |
423 { | 413 { |
424 LlcSnapHeader llc; | 414 LlcSnapHeader llc; |
425 p->RemoveHeader (llc); | 415 p->RemoveHeader (llc); |
426 param = llc.GetType (); | 416 param = llc.GetType (); |
427 }· | 417 }· |
428 break; | 418 break; |
429 case ILLEGAL: | 419 case ILLEGAL: |
430 default: | 420 default: |
431 NS_FATAL_ERROR ("CsmaNetDevice::ProcessHeader(): Unknown packet encapsulat
ion mode"); | 421 NS_FATAL_ERROR ("CsmaNetDevice::ProcessHeader(): Unknown packet encapsulat
ion mode"); |
432 break; | 422 break; |
433 } | 423 } |
434 return true; | 424 return true; |
435 } | 425 } |
436 #endif | 426 #endif |
437 | 427 |
438 void | 428 void |
439 CsmaNetDevice::TransmitStart (void) | 429 CsmaNetDevice::TransmitStart (void) |
440 { | 430 { |
441 NS_LOG_FUNCTION_NOARGS (); | 431 NS_LOG_FUNCTION_NOARGS (); |
442 | 432 |
443 // | 433 // |
444 // This function is called to start the process of transmitting a packet. We· | 434 // This function is called to start the process of transmitting a packet. We· |
445 // expect that the packet to transmit will be found in m_currentPkt. | 435 // expect that the packet to transmit will be found in m_currentPkt. |
446 // | 436 // |
447 NS_ASSERT_MSG (m_currentPkt != 0, "CsmaNetDevice::TransmitStart(): m_currentPk
t not set"); | 437 NS_ASSERT_MSG (m_currentPkt != 0, "CsmaNetDevice::TransmitStart(): m_currentPk
t not set"); |
448 | 438 |
449 NS_LOG_LOGIC ("m_currentPkt = " << m_currentPkt); | 439 NS_LOG_LOGIC ("m_currentPkt = " << m_currentPkt); |
450 NS_LOG_LOGIC ("m_currentPkt UID = " << m_currentPkt->GetUid ()); | 440 NS_LOG_LOGIC ("UID = " << m_currentPkt->GetUid ()); |
451 | 441 |
452 // | 442 // |
453 // Only transmit if the send side of net device is enabled | 443 // Only transmit if the send side of net device is enabled |
454 // | 444 // |
455 if (!IsSendEnabled ()) | 445 if (IsSendEnabled () == false) |
456 { | 446 { |
457 m_phyTxDropTrace (m_currentPkt); | 447 m_phyTxDropTrace (m_currentPkt); |
458 m_currentPkt = 0; | 448 m_currentPkt = 0; |
459 return; | 449 return; |
460 } | 450 } |
461 | 451 |
462 // | 452 // |
463 // Somebody has called here telling us to start transmitting a packet. They· | 453 // Somebody has called here telling us to start transmitting a packet. They· |
464 // can only do this if the state machine is in the TX_READY or TX_BACKOFF stat
e. | 454 // can only do this if the state machine is in the READY or BACKOFF state. |
465 // Specifically, if we are ready to start transmitting, we cannot already | 455 // Specifically, if we are ready to start transmitting, we cannot already |
466 // be transmitting (i.e., TX_BUSY) | 456 // be transmitting (i.e., BUSY) |
467 // | 457 // |
468 NS_ASSERT_MSG ((m_txMachineState == TX_READY) || (m_txMachineState == TX_BACKO
FF),· | 458 NS_ASSERT_MSG ((m_txMachineState == READY) || (m_txMachineState == BACKOFF),· |
469 "Must be TX_READY to transmit. Tx state is: " << m_txMachineSta
te); | 459 "Must be READY to transmit. Tx state is: " << m_txMachineState)
; |
470 | 460 |
| 461 NS_LOG_INFO ("CSMA device " << this << " carrier sense is (0 = idle, 1 = busy)
" << m_carrierSense); |
471 // | 462 // |
472 // Now we have to sense the state of the medium and either start transmitting | 463 // Now we have to sense the state of the medium and either start transmitting |
473 // if it is idle, or backoff our transmission if someone else is on the wire. | 464 // if it is idle, or backoff our transmission if someone else is on the wire. |
474 // | 465 // |
475 if (m_carrierSense != CS_IDLE) | 466 if (m_carrierSense != CARRIER_SENSE_IDLE) |
476 { | 467 { |
477 // | 468 // |
478 // The channel is busy; backoff and rechedule TransmitStart() unless | 469 // The channel is busy -- backoff and rechedule TransmitStart() unless |
479 // we have exhausted all of our retries. | 470 // we have exhausted all of our retries. |
480 // | 471 // |
481 NS_LOG_INFO ("VEDRANM device " << this << " m_carrierSense (0 = idle, 1 =
busy) " << m_carrierSense); | 472 m_txMachineState = BACKOFF; |
482 m_txMachineState = TX_BACKOFF; | |
483 | 473 |
484 if (m_backoff.MaxRetriesReached ()) | 474 if (m_backoff.MaxRetriesReached ()) |
485 { | 475 { |
486 // | 476 // |
487 // Too many retries, abort transmission of packet | 477 // Too many retries, abort transmission of packet |
488 // | 478 // |
489 TransmitAbort (); | 479 TransmitAbort (); |
490 }· | 480 }· |
491 else· | 481 else· |
492 { | 482 { |
493 m_macTxBackoffTrace (m_currentPkt); | 483 m_macTxBackoffTrace (m_currentPkt); |
494 | 484 |
495 m_backoff.IncrNumRetries (); | 485 m_backoff.IncrNumRetries (); |
496 Time backoffTime = m_backoff.GetBackoffTime (); | 486 Time backoffTime = m_backoff.GetBackoffTime (); |
497 | 487 |
498 NS_LOG_LOGIC ("Device " << this << " sensing channel busy, backing off
for " << backoffTime.GetSeconds () << " sec"); | 488 NS_LOG_LOGIC ("CSMA device " << this << " is sensing chanel busy, back
ing off for " << backoffTime.GetSeconds () << " s"); |
499 | 489 |
500 Simulator::Schedule (backoffTime, &CsmaNetDevice::TransmitStart, this)
; | 490 Simulator::Schedule (backoffTime, &CsmaNetDevice::TransmitStart, this)
; |
501 } | 491 } |
502 }· | 492 }· |
503 else· | 493 else· |
504 { | 494 { |
505 // | 495 // |
506 // The channel is free, if random variable gives right value, transmit the
packets | 496 // The channel is free, transmit the packet |
507 // m_persistence = 1 is like classic Ethernet, always sending the packet | |
508 // | 497 // |
509 if (m_persistenceRandomVariable.GetValue () < m_persistence) | 498 if (m_channel->TransmitStart (m_currentPkt, m_deviceId) == false) |
510 { | 499 { |
511 if (m_channel->Transmit (m_currentPkt, m_deviceId)) | 500 NS_LOG_WARN ("Channel TransmitStart returns an error"); |
512 { | 501 m_phyTxDropTrace (m_currentPkt); |
513 // | 502 m_currentPkt = 0; |
514 // Transmission succeeded, reset the backoff time parameters and | 503 m_txMachineState = READY; |
515 // schedule a transmit complete event. | 504 }· |
516 // | 505 else· |
517 m_backoff.ResetBackoffTime (); | 506 { |
518 m_txMachineState = TX_BUSY; | 507 // |
519 m_carrierSenseCounter++; | 508 // Transmission succeeded, reset the backoff time parameters and |
520 m_carrierSense = CS_BUSY; // VEDRANM, could be placed somewhere el
se | 509 // schedule a transmit complete event. |
521 m_phyTxBeginTrace (m_currentPkt); | 510 // |
522 | 511 m_backoff.ResetBackoffTime (); |
523 Time tEventTx = Seconds (m_bps.CalculateTxTime (m_currentPkt->GetS
ize ())); | 512 m_txMachineState = BUSY; |
524 | 513 m_phyTxBeginTrace (m_currentPkt); |
525 NS_LOG_LOGIC ("Schedule TransmitCompleteEvent in " << tEventTx.Get
Seconds () << " seconds on device " << this); | 514 |
526 NS_LOG_INFO ("VEDRAN device, csc, cs" << this << " " << m_carrierS
enseCounter << " " << m_carrierSense); | 515 Time tEvent = Seconds (m_bps.CalculateTxTime (m_currentPkt->GetSize ()
)); |
527 Simulator::Schedule (tEventTx, &CsmaNetDevice::TransmitCompleteEve
nt, this); | 516 NS_LOG_LOGIC ("Schedule TransmitCompleteEvent in " << tEvent.GetSecond
s () << "sec"); |
528 } | 517 Simulator::Schedule (tEvent, &CsmaNetDevice::TransmitCompleteEvent, th
is); |
529 else | |
530 { | |
531 NS_LOG_WARN ("Channel TransmitStart returns an error"); | |
532 m_phyTxDropTrace (m_currentPkt); | |
533 m_currentPkt = 0; | |
534 m_txMachineState = TX_READY; | |
535 } | |
536 } | 518 } |
537 } | 519 } |
538 } | 520 } |
539 | 521 |
540 void | 522 void |
541 CsmaNetDevice::TransmitAbort (void) | 523 CsmaNetDevice::TransmitAbort (void) |
542 { | 524 { |
543 NS_LOG_FUNCTION_NOARGS (); | 525 NS_LOG_FUNCTION_NOARGS (); |
544 | 526 |
545 // | 527 // |
546 // When we started the process of transmitting the current packet, it was· | 528 // When we started the process of transmitting the current packet, it was· |
547 // placed in m_currentPkt. So we had better find one there. | 529 // placed in m_currentPkt. So we had better find one there. |
548 // | 530 // |
549 NS_ASSERT_MSG (m_currentPkt != 0, "CsmaNetDevice::TransmitAbort(): m_currentPk
t zero"); | 531 NS_ASSERT_MSG (m_currentPkt != 0, "CsmaNetDevice::TransmitAbort(): m_currentPk
t zero"); |
550 NS_LOG_LOGIC ("m_currentPkt = " << m_currentPkt); | 532 NS_LOG_LOGIC ("m_currentPkt=" << m_currentPkt); |
551 NS_LOG_LOGIC ("m_currentPkt UID = " << m_currentPkt->GetUid ()); | 533 NS_LOG_LOGIC ("Pkt UID is " << m_currentPkt->GetUid () << ")"); |
552 | 534 |
553 m_phyTxDropTrace (m_currentPkt); | 535 m_phyTxDropTrace (m_currentPkt); |
554 m_currentPkt = 0; | 536 m_currentPkt = 0; |
555 | 537 |
556 NS_ASSERT_MSG (m_txMachineState == TX_BACKOFF, "Must be in TX_BACKOFF state to
abort. Tx state is: " << m_txMachineState); | 538 NS_ASSERT_MSG (m_txMachineState == BACKOFF, "Must be in BACKOFF state to abort
. Tx state is: " << m_txMachineState); |
557 | 539 |
558 //· | 540 //· |
559 // We're done with that one, so reset the backoff algorithm and ready the | 541 // We're done with that one, so reset the backoff algorithm and ready the |
560 // transmit state machine. | 542 // transmit state machine. |
561 // | 543 // |
562 m_backoff.ResetBackoffTime (); | 544 m_backoff.ResetBackoffTime (); |
563 m_txMachineState = TX_READY; | 545 m_txMachineState = READY; |
564 | 546 |
565 // | 547 // |
566 // If there is another packet on the input queue, we need to start trying to· | 548 // If there is another packet on the input queue, we need to start trying to· |
567 // get that out. If the queue is empty we just wait until someone puts one | 549 // get that out. If the queue is empty we just wait until someone puts one |
568 // in. | 550 // in. |
569 // | 551 // |
570 if (m_queue->IsEmpty ()) | 552 if (m_queue->IsEmpty ()) |
571 { | 553 { |
572 return; | 554 return; |
573 } | 555 } |
(...skipping 11 matching lines...) Expand all Loading... |
585 CsmaNetDevice::TransmitCompleteEvent (void) | 567 CsmaNetDevice::TransmitCompleteEvent (void) |
586 { | 568 { |
587 NS_LOG_FUNCTION_NOARGS (); | 569 NS_LOG_FUNCTION_NOARGS (); |
588 | 570 |
589 // | 571 // |
590 // This function is called to finish the process of transmitting a packet. | 572 // This function is called to finish the process of transmitting a packet. |
591 // We need to tell the channel that we've stopped wiggling the wire and | 573 // We need to tell the channel that we've stopped wiggling the wire and |
592 // schedule an event that will be executed when it's time to re-enable | 574 // schedule an event that will be executed when it's time to re-enable |
593 // the transmitter after the interframe gap. | 575 // the transmitter after the interframe gap. |
594 // | 576 // |
595 NS_ASSERT_MSG (m_txMachineState == TX_BUSY, "CsmaNetDevice::TransmitCompleteEv
ent(): Must be TX_BUSY if transmitting"); | 577 NS_ASSERT_MSG (m_txMachineState == BUSY, "CsmaNetDevice::transmitCompleteEvent
(): Must be BUSY if transmitting"); |
596 //NS_ASSERT (m_channel->GetState () == TRANSMITTING); | 578 NS_ASSERT (m_channel->GetState () == OCCUPIED); |
597 NS_ASSERT (m_carrierSense == CS_BUSY); | 579 m_txMachineState = GAP; |
598 m_txMachineState = TX_GAP; | |
599 | 580 |
600 // | 581 // |
601 // When we started transmitting the current packet, it was placed in· | 582 // When we started transmitting the current packet, it was placed in· |
602 // m_currentPkt. So we had better find one there. | 583 // m_currentPkt. So we had better find one there. |
603 // | 584 // |
604 NS_ASSERT_MSG (m_currentPkt != 0, "CsmaNetDevice::TransmitCompleteEvent(): m_c
urrentPkt zero"); | 585 NS_ASSERT_MSG (m_currentPkt != 0, "CsmaNetDevice::TransmitCompleteEvent(): m_c
urrentPkt zero"); |
605 NS_LOG_LOGIC ("m_currentPkt = " << m_currentPkt); | 586 NS_LOG_LOGIC ("m_currentPkt=" << m_currentPkt); |
606 NS_LOG_LOGIC ("m_currentPkt UID = " << m_currentPkt->GetUid ()); | 587 NS_LOG_LOGIC ("Pkt UID is " << m_currentPkt->GetUid () << ")"); |
607 | 588 |
608 /* m_channel->TransmitEnd (); */ | 589 m_channel->TransmitEnd ();· |
609 NS_ASSERT (m_carrierSenseCounter > 0); | |
610 m_carrierSenseCounter--; | |
611 NS_LOG_LOGIC ("VEDRANM device, csc " << this << " " << m_carrierSenseCounter); | |
612 | |
613 if (m_carrierSenseCounter == 0) | |
614 { | |
615 m_carrierSense = CS_IDLE; // VEDRANM, probably OK | |
616 NS_LOG_LOGIC ("VEDRANM " << this << " ifCarrierSenseCounter"); | |
617 } | |
618 m_phyTxEndTrace (m_currentPkt); | 590 m_phyTxEndTrace (m_currentPkt); |
619 m_currentPkt = 0; | 591 m_currentPkt = 0; |
620 | 592 |
621 NS_LOG_LOGIC ("Schedule TransmitReadyEvent in " << m_tInterframeGap.GetSeconds
() << "sec"); | 593 NS_LOG_LOGIC ("Schedule TransmitReadyEvent in " << m_tInterframeGap.GetSeconds
() << "sec"); |
622 | 594 |
623 Simulator::Schedule (m_tInterframeGap, &CsmaNetDevice::TransmitReadyEvent, thi
s); | 595 Simulator::Schedule (m_tInterframeGap, &CsmaNetDevice::TransmitReadyEvent, thi
s); |
624 } | 596 } |
625 | 597 |
626 void | 598 void |
627 CsmaNetDevice::TransmitReadyEvent (void) | 599 CsmaNetDevice::TransmitReadyEvent (void) |
628 { | 600 { |
629 NS_LOG_FUNCTION_NOARGS (); | 601 NS_LOG_FUNCTION_NOARGS (); |
630 | 602 |
631 // | 603 // |
632 // This function is called to enable the transmitter after the interframe | 604 // This function is called to enable the transmitter after the interframe |
633 // gap has passed. If there are pending transmissions, we use this opportunit
y | 605 // gap has passed. If there are pending transmissions, we use this opportunit
y |
634 // to start the next transmit. | 606 // to start the next transmit. |
635 // | 607 // |
636 NS_ASSERT_MSG (m_txMachineState == TX_GAP, "CsmaNetDevice::TransmitReadyEvent(
): Must be in interframe gap"); | 608 NS_ASSERT_MSG (m_txMachineState == GAP, "CsmaNetDevice::TransmitReadyEvent():
Must be in interframe gap"); |
637 m_txMachineState = TX_READY; | 609 m_txMachineState = READY; |
638 | 610 |
639 // | 611 // |
640 // We expect that the packet we had been transmitting was cleared when the· | 612 // We expect that the packet we had been transmitting was cleared when the· |
641 // TransmitCompleteEvent() was executed. | 613 // TransmitCompleteEvent() was executed. |
642 // | 614 // |
643 NS_ASSERT_MSG (m_currentPkt == 0, "CsmaNetDevice::TransmitReadyEvent(): m_curr
entPkt nonzero"); | 615 NS_ASSERT_MSG (m_currentPkt == 0, "CsmaNetDevice::TransmitReadyEvent(): m_curr
entPkt nonzero"); |
644 | 616 |
645 // | 617 // |
646 // Get the next packet from the queue for transmitting | 618 // Get the next packet from the queue for transmitting |
647 // | 619 // |
(...skipping 10 matching lines...) Expand all Loading... |
658 TransmitStart (); | 630 TransmitStart (); |
659 } | 631 } |
660 } | 632 } |
661 | 633 |
662 bool | 634 bool |
663 CsmaNetDevice::Attach (Ptr<CsmaChannel> ch, double distance) | 635 CsmaNetDevice::Attach (Ptr<CsmaChannel> ch, double distance) |
664 { | 636 { |
665 NS_LOG_FUNCTION (this << &ch); | 637 NS_LOG_FUNCTION (this << &ch); |
666 | 638 |
667 m_channel = ch; | 639 m_channel = ch; |
668 //m_deviceRecord->SetDistance (distance); VEDRANM vjerojatno nepotrebno | |
669 | 640 |
670 m_deviceId = m_channel->Attach (this, distance); | 641 m_deviceId = m_channel->Attach (this, distance); |
671 | 642 |
672 // | 643 // |
673 // The channel provides us with the transmitter data rate. | 644 // The channel provides us with the transmitter data rate. |
674 // | 645 // |
675 m_bps = m_channel->GetDataRate (); | 646 m_bps = m_channel->GetDataRate (); |
676 | 647 |
677 // | 648 // |
678 // We use the Ethernet interframe gap of 96 bit times. | 649 // We use the Ethernet interframe gap of 96 bit times. |
(...skipping 18 matching lines...) Expand all Loading... |
697 CsmaNetDevice::SetReceiveErrorModel (Ptr<ErrorModel> em) | 668 CsmaNetDevice::SetReceiveErrorModel (Ptr<ErrorModel> em) |
698 { | 669 { |
699 NS_LOG_FUNCTION (em); | 670 NS_LOG_FUNCTION (em); |
700 m_receiveErrorModel = em;· | 671 m_receiveErrorModel = em;· |
701 } | 672 } |
702 | 673 |
703 void | 674 void |
704 CsmaNetDevice::Receive (Ptr<Packet> packet, Ptr<CsmaNetDevice> senderDevice) | 675 CsmaNetDevice::Receive (Ptr<Packet> packet, Ptr<CsmaNetDevice> senderDevice) |
705 { | 676 { |
706 NS_LOG_FUNCTION (packet << senderDevice); | 677 NS_LOG_FUNCTION (packet << senderDevice); |
707 NS_LOG_LOGIC ("packet UID = " << packet->GetUid ()); | 678 NS_LOG_LOGIC ("UID is " << packet->GetUid ()); |
708 | 679 |
709 // | 680 // |
710 // We never forward up packets that we sent. Real devices don't do this since | 681 // We never forward up packets that we sent. Real devices don't do this since |
711 // their receivers are disabled during send, so we don't. | 682 // their receivers are disabled during send, so we don't. |
712 //· | 683 //· |
713 if (senderDevice == this) | 684 if (senderDevice == this) |
714 { | 685 { |
715 return; | 686 return; |
716 } | 687 } |
717 | 688 |
718 // | 689 // |
719 // Hit the trace hook. This trace will fire on all packets received from the | 690 // Hit the trace hook. This trace will fire on all packets received from the |
720 // channel except those originated by this device. | 691 // channel except those originated by this device. |
721 // | 692 // |
722 m_phyRxEndTrace (packet); | 693 m_phyRxEndTrace (packet); |
723 | 694 |
724 //· | 695 //· |
725 // Only receive if the send side of net device is enabled | 696 // Only receive if the send side of net device is enabled |
726 // | 697 // |
727 if (!IsReceiveEnabled ()) | 698 if (IsReceiveEnabled () == false) |
728 { | 699 { |
729 m_phyRxDropTrace (packet); | 700 m_phyRxDropTrace (packet); |
730 return; | 701 return; |
731 } | 702 } |
732 | 703 |
733 if (m_receiveErrorModel && m_receiveErrorModel->IsCorrupt (packet)) | 704 if (m_receiveErrorModel && m_receiveErrorModel->IsCorrupt (packet) ) |
734 { | 705 { |
735 NS_LOG_LOGIC ("Dropping pkt due to error model "); | 706 NS_LOG_LOGIC ("Dropping pkt due to error model "); |
736 m_phyRxDropTrace (packet); | 707 m_phyRxDropTrace (packet); |
737 return; | 708 return; |
738 } | 709 } |
739 | 710 |
740 // | 711 // |
741 // Trace sinks will expect complete packets, not packets without some of the | 712 // Trace sinks will expect complete packets, not packets without some of the |
742 // headers. | 713 // headers. |
743 // | 714 // |
744 Ptr<Packet> originalPacket = packet->Copy (); | 715 Ptr<Packet> originalPacket = packet->Copy (); |
745 | 716 |
746 EthernetTrailer trailer; | 717 EthernetTrailer trailer; |
747 packet->RemoveTrailer (trailer); | 718 packet->RemoveTrailer (trailer); |
748 if (Node::ChecksumEnabled ()) | 719 if (Node::ChecksumEnabled ()) |
749 { | 720 { |
750 trailer.EnableFcs (true); | 721 trailer.EnableFcs (true); |
751 } | 722 } |
752 | 723 |
753 trailer.CheckFcs (packet); | |
754 bool crcGood = trailer.CheckFcs (packet); | 724 bool crcGood = trailer.CheckFcs (packet); |
755 if (!crcGood) | 725 if (!crcGood) |
756 { | 726 { |
757 NS_LOG_INFO ("CRC error on Packet " << packet); | 727 NS_LOG_INFO ("CRC error on Packet " << packet); |
758 m_phyRxDropTrace (packet); | 728 m_phyRxDropTrace (packet); |
759 return; | 729 return; |
760 } | 730 } |
761 | 731 |
762 EthernetHeader header (false); | 732 EthernetHeader header (false); |
763 packet->RemoveHeader (header); | 733 packet->RemoveHeader (header); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 // packet received trace hook and forward the packet up the stack. | 801 // packet received trace hook and forward the packet up the stack. |
832 // | 802 // |
833 if (packetType != PACKET_OTHERHOST) | 803 if (packetType != PACKET_OTHERHOST) |
834 { | 804 { |
835 m_snifferTrace (originalPacket); | 805 m_snifferTrace (originalPacket); |
836 m_macRxTrace (originalPacket); | 806 m_macRxTrace (originalPacket); |
837 m_rxCallback (this, packet, protocol, header.GetSource ()); | 807 m_rxCallback (this, packet, protocol, header.GetSource ()); |
838 } | 808 } |
839 } | 809 } |
840 | 810 |
841 void | |
842 CsmaNetDevice::ReceiveStartEvent (void) | |
843 { | |
844 NS_LOG_FUNCTION_NOARGS (); | |
845 if (m_carrierSense == CS_BUSY) | |
846 { | |
847 // Collision detected | |
848 // FIXME: backoff code | |
849 } | |
850 else | |
851 { | |
852 m_carrierSenseCounter++; | |
853 m_carrierSense = CS_BUSY; | |
854 } | |
855 } | |
856 | |
857 void | |
858 CsmaNetDevice::ReceiveCompleteEvent (void) | |
859 { | |
860 NS_LOG_FUNCTION_NOARGS (); | |
861 NS_ASSERT (m_carrierSenseCounter > 0); | |
862 m_carrierSenseCounter--; | |
863 | |
864 if (m_carrierSenseCounter == 0) | |
865 { | |
866 m_carrierSense = CS_IDLE; // VEDRANM, probably OK | |
867 } | |
868 } | |
869 | |
870 void | |
871 CsmaNetDevice::ReceiveReadyEvent (void) | |
872 { | |
873 } | |
874 | |
875 Ptr<Queue> | 811 Ptr<Queue> |
876 CsmaNetDevice::GetQueue (void) const· | 812 CsmaNetDevice::GetQueue (void) const· |
877 {· | 813 {· |
878 NS_LOG_FUNCTION_NOARGS (); | 814 NS_LOG_FUNCTION_NOARGS (); |
879 return m_queue; | 815 return m_queue; |
880 } | 816 } |
881 | 817 |
882 void | 818 void |
883 CsmaNetDevice::NotifyLinkUp (void) | 819 CsmaNetDevice::NotifyLinkUp (void) |
884 { | 820 { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
982 } | 918 } |
983 | 919 |
984 bool | 920 bool |
985 CsmaNetDevice::IsBridge (void) const | 921 CsmaNetDevice::IsBridge (void) const |
986 { | 922 { |
987 NS_LOG_FUNCTION_NOARGS (); | 923 NS_LOG_FUNCTION_NOARGS (); |
988 return false; | 924 return false; |
989 } | 925 } |
990 | 926 |
991 bool | 927 bool |
992 CsmaNetDevice::Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolN
umber) | 928 CsmaNetDevice::Send (Ptr<Packet> packet,const Address& dest, uint16_t protocolNu
mber) |
993 { | 929 { |
994 NS_LOG_FUNCTION (packet << dest << protocolNumber); | 930 NS_LOG_FUNCTION (packet << dest << protocolNumber); |
995 return SendFrom (packet, m_address, dest, protocolNumber); | 931 return SendFrom (packet, m_address, dest, protocolNumber); |
996 } | 932 } |
997 | 933 |
998 bool | 934 bool |
999 CsmaNetDevice::SendFrom (Ptr<Packet> packet, const Address& src, const Address&
dest, uint16_t protocolNumber) | 935 CsmaNetDevice::SendFrom (Ptr<Packet> packet, const Address& src, const Address&
dest, uint16_t protocolNumber) |
1000 { | 936 { |
1001 NS_LOG_FUNCTION (packet << src << dest << protocolNumber); | 937 NS_LOG_FUNCTION (packet << src << dest << protocolNumber); |
1002 NS_LOG_LOGIC ("packet = " << packet); | 938 NS_LOG_LOGIC ("packet =" << packet); |
1003 NS_LOG_LOGIC ("packet UID = " << packet->GetUid ()); | 939 NS_LOG_LOGIC ("UID is " << packet->GetUid () << ")"); |
1004 | 940 |
1005 NS_ASSERT (IsLinkUp ()); | 941 NS_ASSERT (IsLinkUp ()); |
1006 | 942 |
1007 // | 943 // |
1008 // Only transmit if send side of net device is enabled | 944 // Only transmit if send side of net device is enabled |
1009 // | 945 // |
1010 if (IsSendEnabled () == false) | 946 if (IsSendEnabled () == false) |
1011 { | 947 { |
1012 m_macTxDropTrace (packet); | 948 m_macTxDropTrace (packet); |
1013 return false; | 949 return false; |
(...skipping 13 matching lines...) Expand all Loading... |
1027 { | 963 { |
1028 m_macTxDropTrace (packet); | 964 m_macTxDropTrace (packet); |
1029 return false; | 965 return false; |
1030 } | 966 } |
1031 | 967 |
1032 // | 968 // |
1033 // If the device is idle, we need to start a transmission. Otherwise, | 969 // If the device is idle, we need to start a transmission. Otherwise, |
1034 // the transmission will be started when the current packet finished | 970 // the transmission will be started when the current packet finished |
1035 // transmission (see TransmitCompleteEvent) | 971 // transmission (see TransmitCompleteEvent) |
1036 // | 972 // |
1037 if (m_txMachineState == TX_READY)· | 973 if (m_txMachineState == READY)· |
1038 { | 974 { |
1039 if (m_queue->IsEmpty () == false) | 975 if (m_queue->IsEmpty () == false) |
1040 { | 976 { |
1041 m_currentPkt = m_queue->Dequeue (); | 977 m_currentPkt = m_queue->Dequeue (); |
1042 NS_ASSERT_MSG (m_currentPkt != 0, "CsmaNetDevice::SendFrom(): IsEmpty
false but no Packet on queue?"); | 978 NS_ASSERT_MSG (m_currentPkt != 0, "CsmaNetDevice::SendFrom(): IsEmpty
false but no Packet on queue?"); |
1043 m_promiscSnifferTrace (m_currentPkt); | 979 m_promiscSnifferTrace (m_currentPkt); |
1044 m_snifferTrace (m_currentPkt); | 980 m_snifferTrace (m_currentPkt); |
1045 TransmitStart (); | 981 TransmitStart (); |
1046 } | 982 } |
1047 } | 983 } |
1048 return true; | 984 return true; |
1049 } | 985 } |
1050 | 986 |
1051 Ptr<CsmaNetDeviceRecord> | |
1052 CsmaNetDevice::GetDeviceRecord (void) const | |
1053 { | |
1054 NS_LOG_FUNCTION_NOARGS (); | |
1055 return m_deviceRecord; | |
1056 } | |
1057 | |
1058 void | |
1059 CsmaNetDevice::SetDeviceRecord (Ptr<CsmaNetDeviceRecord> deviceRecord) | |
1060 { | |
1061 NS_LOG_FUNCTION (deviceRecord); | |
1062 | |
1063 m_deviceRecord = deviceRecord; | |
1064 } | |
1065 | |
1066 Ptr<Node> | 987 Ptr<Node> |
1067 CsmaNetDevice::GetNode (void) const | 988 CsmaNetDevice::GetNode (void) const |
1068 { | 989 { |
1069 NS_LOG_FUNCTION_NOARGS (); | 990 NS_LOG_FUNCTION_NOARGS (); |
1070 return m_node; | 991 return m_node; |
1071 } | 992 } |
1072 | 993 |
1073 void | 994 void |
1074 CsmaNetDevice::SetNode (Ptr<Node> node) | 995 CsmaNetDevice::SetNode (Ptr<Node> node) |
1075 { | 996 { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1107 m_promiscRxCallback = cb; | 1028 m_promiscRxCallback = cb; |
1108 } | 1029 } |
1109 | 1030 |
1110 bool | 1031 bool |
1111 CsmaNetDevice::SupportsSendFrom () const | 1032 CsmaNetDevice::SupportsSendFrom () const |
1112 { | 1033 { |
1113 NS_LOG_FUNCTION_NOARGS (); | 1034 NS_LOG_FUNCTION_NOARGS (); |
1114 return true; | 1035 return true; |
1115 } | 1036 } |
1116 | 1037 |
| 1038 int64_t |
| 1039 CsmaNetDevice::AssignStreams (int64_t stream) |
| 1040 { |
| 1041 return m_backoff.AssignStreams (stream); |
| 1042 } |
| 1043 |
1117 } // namespace ns3 | 1044 } // namespace ns3 |
LEFT | RIGHT |