author | Craig Dowell <craigdo@ee.washington.edu> |
Sat, 07 Jun 2008 10:38:39 -0700 | |
changeset 3257 | ba198dad54a2 |
parent 3011 | 2d507430219e |
child 3326 | 239c4bc21ebf |
permissions | -rw-r--r-- |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
2 |
/* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
3 |
* Copyright (c) 2007 Emmanuelle Laprise |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
4 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
8 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
13 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
17 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
18 |
* Author: Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca> |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
19 |
*/ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
20 |
|
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1494
diff
changeset
|
21 |
#include "ns3/log.h" |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
22 |
#include "ns3/queue.h" |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
23 |
#include "ns3/simulator.h" |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
24 |
#include "ns3/ethernet-header.h" |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
25 |
#include "ns3/ethernet-trailer.h" |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
26 |
#include "ns3/llc-snap-header.h" |
1820
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
27 |
#include "ns3/error-model.h" |
2500
1fb9430f642d
convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
28 |
#include "ns3/enum.h" |
1fb9430f642d
convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
29 |
#include "ns3/boolean.h" |
2927
73b47ce1d805
get rid of implicit conversion of Attribute to/from Ptr<>. Replace this with an explicit Pointer class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2834
diff
changeset
|
30 |
#include "ns3/pointer.h" |
2500
1fb9430f642d
convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
31 |
#include "ns3/trace-source-accessor.h" |
1fb9430f642d
convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
32 |
#include "csma-net-device.h" |
1fb9430f642d
convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
33 |
#include "csma-channel.h" |
1fb9430f642d
convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
34 |
|
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1494
diff
changeset
|
35 |
NS_LOG_COMPONENT_DEFINE ("CsmaNetDevice"); |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
36 |
|
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
37 |
namespace ns3 { |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
38 |
|
2501
3eaeac1dd5ed
add missing NS_OBJECT_ENSURE_REGISTERED calls.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2500
diff
changeset
|
39 |
NS_OBJECT_ENSURE_REGISTERED (CsmaNetDevice); |
3eaeac1dd5ed
add missing NS_OBJECT_ENSURE_REGISTERED calls.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2500
diff
changeset
|
40 |
|
2500
1fb9430f642d
convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
41 |
TypeId |
1fb9430f642d
convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
42 |
CsmaNetDevice::GetTypeId (void) |
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1494
diff
changeset
|
43 |
{ |
2602
d9262bff6df2
add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2600
diff
changeset
|
44 |
static TypeId tid = TypeId ("ns3::CsmaNetDevice") |
2500
1fb9430f642d
convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
45 |
.SetParent<NetDevice> () |
1fb9430f642d
convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
46 |
.AddConstructor<CsmaNetDevice> () |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
47 |
.AddAttribute ("Address", |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
48 |
"The address of this device.", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
49 |
Mac48AddressValue (Mac48Address ("ff:ff:ff:ff:ff:ff")), |
2500
1fb9430f642d
convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
50 |
MakeMac48AddressAccessor (&CsmaNetDevice::m_address), |
1fb9430f642d
convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
51 |
MakeMac48AddressChecker ()) |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
52 |
.AddAttribute ("EncapsulationMode", |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
53 |
"The link-layer encapsulation type to use.", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
54 |
EnumValue (LLC), |
2500
1fb9430f642d
convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
55 |
MakeEnumAccessor (&CsmaNetDevice::m_encapMode), |
1fb9430f642d
convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
56 |
MakeEnumChecker (ETHERNET_V1, "EthernetV1", |
1fb9430f642d
convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
57 |
IP_ARP, "IpArp", |
1fb9430f642d
convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
58 |
RAW, "Raw", |
1fb9430f642d
convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
59 |
LLC, "Llc")) |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
60 |
.AddAttribute ("SendEnable", |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
61 |
"Enable or disable the transmitter section of the device.", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
62 |
BooleanValue (true), |
2500
1fb9430f642d
convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
63 |
MakeBooleanAccessor (&CsmaNetDevice::m_sendEnable), |
1fb9430f642d
convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
64 |
MakeBooleanChecker ()) |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
65 |
.AddAttribute ("ReceiveEnable", |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
66 |
"Enable or disable the receiver section of the device.", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
67 |
BooleanValue (true), |
2500
1fb9430f642d
convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
68 |
MakeBooleanAccessor (&CsmaNetDevice::m_receiveEnable), |
1fb9430f642d
convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
69 |
MakeBooleanChecker ()) |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
70 |
.AddAttribute ("RxErrorModel", |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
71 |
"The receiver error model used to simulate packet loss", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
72 |
PointerValue (), |
2927
73b47ce1d805
get rid of implicit conversion of Attribute to/from Ptr<>. Replace this with an explicit Pointer class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2834
diff
changeset
|
73 |
MakePointerAccessor (&CsmaNetDevice::m_receiveErrorModel), |
73b47ce1d805
get rid of implicit conversion of Attribute to/from Ptr<>. Replace this with an explicit Pointer class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2834
diff
changeset
|
74 |
MakePointerChecker<ErrorModel> ()) |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
75 |
.AddAttribute ("TxQueue", |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
76 |
"A queue to use as the transmit queue in the device.", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2927
diff
changeset
|
77 |
PointerValue (), |
2927
73b47ce1d805
get rid of implicit conversion of Attribute to/from Ptr<>. Replace this with an explicit Pointer class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2834
diff
changeset
|
78 |
MakePointerAccessor (&CsmaNetDevice::m_queue), |
73b47ce1d805
get rid of implicit conversion of Attribute to/from Ptr<>. Replace this with an explicit Pointer class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2834
diff
changeset
|
79 |
MakePointerChecker<Queue> ()) |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
80 |
.AddTraceSource ("Rx", |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
81 |
"Trace source to fire on reception of a MAC packet.", |
2500
1fb9430f642d
convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
82 |
MakeTraceSourceAccessor (&CsmaNetDevice::m_rxTrace)) |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
83 |
.AddTraceSource ("Drop", |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
84 |
"Trace source to fire on when a MAC packet is dropped.", |
2500
1fb9430f642d
convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
85 |
MakeTraceSourceAccessor (&CsmaNetDevice::m_dropTrace)) |
1fb9430f642d
convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
86 |
; |
1fb9430f642d
convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
87 |
return tid; |
1229
e4cfe4094c10
build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1209
diff
changeset
|
88 |
} |
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1494
diff
changeset
|
89 |
|
2500
1fb9430f642d
convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
90 |
CsmaNetDevice::CsmaNetDevice () |
1fb9430f642d
convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
91 |
: m_name (""), |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
92 |
m_linkUp (false), |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
93 |
m_mtu (0xffff) |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
94 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2975
diff
changeset
|
95 |
NS_LOG_FUNCTION (this); |
2500
1fb9430f642d
convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
96 |
m_txMachineState = READY; |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
97 |
m_tInterframeGap = Seconds (0); |
2500
1fb9430f642d
convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
98 |
m_channel = 0; |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
99 |
} |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
100 |
|
1276
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
101 |
CsmaNetDevice::~CsmaNetDevice() |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
102 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2975
diff
changeset
|
103 |
NS_LOG_FUNCTION_NOARGS (); |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
104 |
m_queue = 0; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
105 |
} |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
106 |
|
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
107 |
void |
1276
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
108 |
CsmaNetDevice::DoDispose () |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
109 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2975
diff
changeset
|
110 |
NS_LOG_FUNCTION_NOARGS (); |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
111 |
m_channel = 0; |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
112 |
m_node = 0; |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
113 |
NetDevice::DoDispose (); |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
114 |
} |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
115 |
|
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
116 |
void |
2655
a71d888ca2e8
add SetAddress methods.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2602
diff
changeset
|
117 |
CsmaNetDevice::SetAddress (Mac48Address self) |
a71d888ca2e8
add SetAddress methods.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2602
diff
changeset
|
118 |
{ |
a71d888ca2e8
add SetAddress methods.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2602
diff
changeset
|
119 |
m_address = self; |
a71d888ca2e8
add SetAddress methods.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2602
diff
changeset
|
120 |
} |
a71d888ca2e8
add SetAddress methods.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2602
diff
changeset
|
121 |
|
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
122 |
void |
1276
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
123 |
CsmaNetDevice::SetSendEnable (bool sendEnable) |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
124 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2975
diff
changeset
|
125 |
NS_LOG_FUNCTION_NOARGS (); |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
126 |
m_sendEnable = sendEnable; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
127 |
} |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
128 |
|
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
129 |
void |
1276
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
130 |
CsmaNetDevice::SetReceiveEnable (bool receiveEnable) |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
131 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2975
diff
changeset
|
132 |
NS_LOG_FUNCTION_NOARGS (); |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
133 |
m_receiveEnable = receiveEnable; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
134 |
} |
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1494
diff
changeset
|
135 |
|
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
136 |
bool |
1276
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
137 |
CsmaNetDevice::IsSendEnabled (void) |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
138 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2975
diff
changeset
|
139 |
NS_LOG_FUNCTION_NOARGS (); |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
140 |
return (m_sendEnable); |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
141 |
} |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
142 |
|
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
143 |
bool |
1276
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
144 |
CsmaNetDevice::IsReceiveEnabled (void) |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
145 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2975
diff
changeset
|
146 |
NS_LOG_FUNCTION_NOARGS (); |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
147 |
return (m_receiveEnable); |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
148 |
} |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
149 |
|
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
150 |
void |
1276
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
151 |
CsmaNetDevice::SetInterframeGap (Time t) |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
152 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2975
diff
changeset
|
153 |
NS_LOG_FUNCTION_NOARGS (); |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
154 |
m_tInterframeGap = t; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
155 |
} |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
156 |
|
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
157 |
void |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
158 |
CsmaNetDevice::SetBackoffParams ( |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
159 |
Time slotTime, |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
160 |
uint32_t minSlots, |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
161 |
uint32_t maxSlots, |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
162 |
uint32_t ceiling, |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
163 |
uint32_t maxRetries) |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
164 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2975
diff
changeset
|
165 |
NS_LOG_FUNCTION_NOARGS (); |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
166 |
m_backoff.m_slotTime = slotTime; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
167 |
m_backoff.m_minSlots = minSlots; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
168 |
m_backoff.m_maxSlots = maxSlots; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
169 |
m_backoff.m_ceiling = ceiling; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
170 |
m_backoff.m_maxRetries = maxRetries; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
171 |
} |
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1494
diff
changeset
|
172 |
|
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
173 |
void |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
174 |
CsmaNetDevice::AddHeader ( |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
175 |
Ptr<Packet> p, |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
176 |
Mac48Address dest, |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
177 |
uint16_t protocolNumber) |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
178 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2975
diff
changeset
|
179 |
NS_LOG_FUNCTION_NOARGS (); |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
180 |
|
995
22821dd9152e
param is a 16 bit integer. implement proper llc encapsulation/decapsulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
993
diff
changeset
|
181 |
if (m_encapMode == RAW) |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
182 |
{ |
995
22821dd9152e
param is a 16 bit integer. implement proper llc encapsulation/decapsulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
993
diff
changeset
|
183 |
return; |
22821dd9152e
param is a 16 bit integer. implement proper llc encapsulation/decapsulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
993
diff
changeset
|
184 |
} |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
185 |
|
1494
c2985e1cd091
rename Euixx to Macxx
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1451
diff
changeset
|
186 |
Mac48Address source = Mac48Address::ConvertFrom (GetAddress ()); |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
187 |
EthernetHeader header (false); |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
188 |
header.SetSource (source); |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
189 |
header.SetDestination (dest); |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
190 |
|
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
191 |
EthernetTrailer trailer; |
995
22821dd9152e
param is a 16 bit integer. implement proper llc encapsulation/decapsulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
993
diff
changeset
|
192 |
|
1001
33cf9c56e3cd
Fix lengthType initialization for optimized build
Tom Henderson <tomh@tomh.org>
parents:
997
diff
changeset
|
193 |
uint16_t lengthType = 0; |
995
22821dd9152e
param is a 16 bit integer. implement proper llc encapsulation/decapsulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
993
diff
changeset
|
194 |
switch (m_encapMode) |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
195 |
{ |
995
22821dd9152e
param is a 16 bit integer. implement proper llc encapsulation/decapsulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
993
diff
changeset
|
196 |
case ETHERNET_V1: |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
197 |
lengthType = p->GetSize () + header.GetSerializedSize () + |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
198 |
trailer.GetSerializedSize (); |
995
22821dd9152e
param is a 16 bit integer. implement proper llc encapsulation/decapsulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
993
diff
changeset
|
199 |
break; |
22821dd9152e
param is a 16 bit integer. implement proper llc encapsulation/decapsulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
993
diff
changeset
|
200 |
case IP_ARP: |
22821dd9152e
param is a 16 bit integer. implement proper llc encapsulation/decapsulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
993
diff
changeset
|
201 |
lengthType = protocolNumber; |
22821dd9152e
param is a 16 bit integer. implement proper llc encapsulation/decapsulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
993
diff
changeset
|
202 |
break; |
22821dd9152e
param is a 16 bit integer. implement proper llc encapsulation/decapsulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
993
diff
changeset
|
203 |
case LLC: { |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
204 |
lengthType = p->GetSize () + header.GetSerializedSize () + |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
205 |
trailer.GetSerializedSize (); |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
206 |
LlcSnapHeader llc; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
207 |
llc.SetType (protocolNumber); |
1866
e7dbcc4df546
do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1504
diff
changeset
|
208 |
p->AddHeader (llc); |
995
22821dd9152e
param is a 16 bit integer. implement proper llc encapsulation/decapsulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
993
diff
changeset
|
209 |
} break; |
22821dd9152e
param is a 16 bit integer. implement proper llc encapsulation/decapsulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
993
diff
changeset
|
210 |
case RAW: |
22821dd9152e
param is a 16 bit integer. implement proper llc encapsulation/decapsulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
993
diff
changeset
|
211 |
NS_ASSERT (false); |
22821dd9152e
param is a 16 bit integer. implement proper llc encapsulation/decapsulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
993
diff
changeset
|
212 |
break; |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
213 |
} |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
214 |
|
995
22821dd9152e
param is a 16 bit integer. implement proper llc encapsulation/decapsulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
993
diff
changeset
|
215 |
header.SetLengthType (lengthType); |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
216 |
p->AddHeader (header); |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
217 |
|
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
218 |
trailer.CalcFcs (p); |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
219 |
p->AddTrailer (trailer); |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
220 |
} |
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1494
diff
changeset
|
221 |
|
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
222 |
bool |
1866
e7dbcc4df546
do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1504
diff
changeset
|
223 |
CsmaNetDevice::ProcessHeader (Ptr<Packet> p, uint16_t & param) |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
224 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2975
diff
changeset
|
225 |
NS_LOG_FUNCTION_NOARGS (); |
995
22821dd9152e
param is a 16 bit integer. implement proper llc encapsulation/decapsulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
993
diff
changeset
|
226 |
if (m_encapMode == RAW) |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
227 |
{ |
995
22821dd9152e
param is a 16 bit integer. implement proper llc encapsulation/decapsulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
993
diff
changeset
|
228 |
return true; |
22821dd9152e
param is a 16 bit integer. implement proper llc encapsulation/decapsulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
993
diff
changeset
|
229 |
} |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
230 |
|
995
22821dd9152e
param is a 16 bit integer. implement proper llc encapsulation/decapsulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
993
diff
changeset
|
231 |
EthernetTrailer trailer; |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
232 |
|
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
233 |
p->RemoveTrailer (trailer); |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
234 |
trailer.CheckFcs (p); |
995
22821dd9152e
param is a 16 bit integer. implement proper llc encapsulation/decapsulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
993
diff
changeset
|
235 |
|
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
236 |
EthernetHeader header (false); |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
237 |
p->RemoveHeader (header); |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
238 |
|
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
239 |
if ((header.GetDestination () != GetBroadcast ()) && |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
240 |
(header.GetDestination () != GetAddress ())) |
995
22821dd9152e
param is a 16 bit integer. implement proper llc encapsulation/decapsulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
993
diff
changeset
|
241 |
{ |
22821dd9152e
param is a 16 bit integer. implement proper llc encapsulation/decapsulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
993
diff
changeset
|
242 |
return false; |
22821dd9152e
param is a 16 bit integer. implement proper llc encapsulation/decapsulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
993
diff
changeset
|
243 |
} |
22821dd9152e
param is a 16 bit integer. implement proper llc encapsulation/decapsulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
993
diff
changeset
|
244 |
|
22821dd9152e
param is a 16 bit integer. implement proper llc encapsulation/decapsulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
993
diff
changeset
|
245 |
switch (m_encapMode) |
22821dd9152e
param is a 16 bit integer. implement proper llc encapsulation/decapsulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
993
diff
changeset
|
246 |
{ |
22821dd9152e
param is a 16 bit integer. implement proper llc encapsulation/decapsulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
993
diff
changeset
|
247 |
case ETHERNET_V1: |
22821dd9152e
param is a 16 bit integer. implement proper llc encapsulation/decapsulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
993
diff
changeset
|
248 |
case IP_ARP: |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
249 |
param = header.GetLengthType (); |
995
22821dd9152e
param is a 16 bit integer. implement proper llc encapsulation/decapsulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
993
diff
changeset
|
250 |
break; |
22821dd9152e
param is a 16 bit integer. implement proper llc encapsulation/decapsulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
993
diff
changeset
|
251 |
case LLC: { |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
252 |
LlcSnapHeader llc; |
1866
e7dbcc4df546
do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1504
diff
changeset
|
253 |
p->RemoveHeader (llc); |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
254 |
param = llc.GetType (); |
995
22821dd9152e
param is a 16 bit integer. implement proper llc encapsulation/decapsulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
993
diff
changeset
|
255 |
} break; |
22821dd9152e
param is a 16 bit integer. implement proper llc encapsulation/decapsulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
993
diff
changeset
|
256 |
case RAW: |
22821dd9152e
param is a 16 bit integer. implement proper llc encapsulation/decapsulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
993
diff
changeset
|
257 |
NS_ASSERT (false); |
22821dd9152e
param is a 16 bit integer. implement proper llc encapsulation/decapsulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
993
diff
changeset
|
258 |
break; |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
259 |
} |
995
22821dd9152e
param is a 16 bit integer. implement proper llc encapsulation/decapsulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
993
diff
changeset
|
260 |
return true; |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
261 |
} |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
262 |
|
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
263 |
void |
1276
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
264 |
CsmaNetDevice::TransmitStart () |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
265 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2975
diff
changeset
|
266 |
NS_LOG_FUNCTION_NOARGS (); |
1866
e7dbcc4df546
do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1504
diff
changeset
|
267 |
NS_LOG_LOGIC ("m_currentPkt=" << m_currentPkt); |
e7dbcc4df546
do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1504
diff
changeset
|
268 |
NS_LOG_LOGIC ("UID is " << m_currentPkt->GetUid ()); |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
269 |
// |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
270 |
// This function is called to start the process of transmitting a packet. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
271 |
// We need to tell the channel that we've started wiggling the wire and |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
272 |
// schedule an event that will be executed when it's time to tell the |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
273 |
// channel that we're done wiggling the wire. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
274 |
// |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
275 |
NS_ASSERT_MSG ((m_txMachineState == READY) || (m_txMachineState == BACKOFF), |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
276 |
"Must be READY to transmit. Tx state is: " << m_txMachineState); |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
277 |
|
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
278 |
// |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
279 |
// Only transmit if send side of net device is enabled |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
280 |
// |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
281 |
if (IsSendEnabled () == false) |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
282 |
{ |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
283 |
return; |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
284 |
} |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
285 |
|
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
286 |
if (m_channel->GetState () != IDLE) |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
287 |
{ |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
288 |
// |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
289 |
// The channel is busy -- backoff and rechedule TransmitStart () |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
290 |
// |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
291 |
m_txMachineState = BACKOFF; |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
292 |
|
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
293 |
if (m_backoff.MaxRetriesReached ()) |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
294 |
{ |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
295 |
// |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
296 |
// Too many retries, abort transmission of packet |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
297 |
// |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
298 |
TransmitAbort (); |
997
d95ffcec6523
fix indent, basic coding style issues
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
995
diff
changeset
|
299 |
} |
d95ffcec6523
fix indent, basic coding style issues
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
995
diff
changeset
|
300 |
else |
d95ffcec6523
fix indent, basic coding style issues
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
995
diff
changeset
|
301 |
{ |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
302 |
m_backoff.IncrNumRetries (); |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
303 |
Time backoffTime = m_backoff.GetBackoffTime (); |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
304 |
|
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1494
diff
changeset
|
305 |
NS_LOG_LOGIC ("Channel busy, backing off for " << |
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1494
diff
changeset
|
306 |
backoffTime.GetSeconds () << " sec"); |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
307 |
|
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
308 |
Simulator::Schedule (backoffTime, &CsmaNetDevice::TransmitStart, |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
309 |
this); |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
310 |
} |
997
d95ffcec6523
fix indent, basic coding style issues
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
995
diff
changeset
|
311 |
} |
d95ffcec6523
fix indent, basic coding style issues
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
995
diff
changeset
|
312 |
else |
d95ffcec6523
fix indent, basic coding style issues
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
995
diff
changeset
|
313 |
{ |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
314 |
// |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
315 |
// The channel is free, transmit the packet |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
316 |
// |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
317 |
m_txMachineState = BUSY; |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
318 |
Time tEvent = Seconds (m_bps.CalculateTxTime (m_currentPkt->GetSize ())); |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
319 |
|
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1494
diff
changeset
|
320 |
NS_LOG_LOGIC ("Schedule TransmitCompleteEvent in " << |
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1494
diff
changeset
|
321 |
tEvent.GetSeconds () << "sec"); |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
322 |
|
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
323 |
Simulator::Schedule (tEvent, &CsmaNetDevice::TransmitCompleteEvent, |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
324 |
this); |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
325 |
|
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
326 |
if (m_channel->TransmitStart (m_currentPkt, m_deviceId) == false) |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
327 |
{ |
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1494
diff
changeset
|
328 |
NS_LOG_WARN ("Channel transmit start did not work at " << |
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1494
diff
changeset
|
329 |
tEvent.GetSeconds () << "sec"); |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
330 |
m_txMachineState = READY; |
997
d95ffcec6523
fix indent, basic coding style issues
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
995
diff
changeset
|
331 |
} |
d95ffcec6523
fix indent, basic coding style issues
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
995
diff
changeset
|
332 |
else |
d95ffcec6523
fix indent, basic coding style issues
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
995
diff
changeset
|
333 |
{ |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
334 |
// |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
335 |
// Transmission succeeded, reset the backoff time parameters. |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
336 |
// |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
337 |
m_backoff.ResetBackoffTime (); |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
338 |
} |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
339 |
} |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
340 |
} |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
341 |
|
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
342 |
|
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
343 |
void |
1276
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
344 |
CsmaNetDevice::TransmitAbort (void) |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
345 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2975
diff
changeset
|
346 |
NS_LOG_FUNCTION_NOARGS (); |
1866
e7dbcc4df546
do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1504
diff
changeset
|
347 |
NS_LOG_LOGIC ("Pkt UID is " << m_currentPkt->GetUid () << ")"); |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
348 |
|
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
349 |
// |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
350 |
// Since we were transmitting a packet, that packet had better be on the |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
351 |
// transmit queue. |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
352 |
// |
1866
e7dbcc4df546
do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1504
diff
changeset
|
353 |
m_currentPkt = m_queue->Dequeue (); |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
354 |
NS_ASSERT_MSG (m_currentPkt != 0, "No Packet on queue during" |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
355 |
"CsmaNetDevice::TransmitAbort()"); |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
356 |
|
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
357 |
// |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
358 |
// The last one failed. Let's try to transmit the next one (if there) |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
359 |
// |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
360 |
m_backoff.ResetBackoffTime (); |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
361 |
m_txMachineState = READY; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
362 |
TransmitStart (); |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
363 |
} |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
364 |
|
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
365 |
void |
1276
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
366 |
CsmaNetDevice::TransmitCompleteEvent (void) |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
367 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2975
diff
changeset
|
368 |
NS_LOG_FUNCTION_NOARGS (); |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
369 |
// |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
370 |
// This function is called to finish the process of transmitting a packet. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
371 |
// We need to tell the channel that we've stopped wiggling the wire and |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
372 |
// schedule an event that will be executed when it's time to re-enable |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
373 |
// the transmitter after the interframe gap. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
374 |
// |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
375 |
NS_ASSERT_MSG (m_txMachineState == BUSY, "Must be BUSY if transmitting"); |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
376 |
NS_ASSERT (m_channel->GetState () == TRANSMITTING); |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
377 |
m_txMachineState = GAP; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
378 |
|
1866
e7dbcc4df546
do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1504
diff
changeset
|
379 |
NS_LOG_LOGIC ("Pkt UID is " << m_currentPkt->GetUid () << ")"); |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
380 |
m_channel->TransmitEnd (); |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
381 |
|
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1494
diff
changeset
|
382 |
NS_LOG_LOGIC ("Schedule TransmitReadyEvent in " |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
383 |
<< m_tInterframeGap.GetSeconds () << "sec"); |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
384 |
|
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
385 |
Simulator::Schedule (m_tInterframeGap, &CsmaNetDevice::TransmitReadyEvent, |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
386 |
this); |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
387 |
} |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
388 |
|
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
389 |
void |
1276
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
390 |
CsmaNetDevice::TransmitReadyEvent (void) |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
391 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2975
diff
changeset
|
392 |
NS_LOG_FUNCTION_NOARGS (); |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
393 |
// |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
394 |
// This function is called to enable the transmitter after the interframe |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
395 |
// gap has passed. If there are pending transmissions, we use this opportunity |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
396 |
// to start the next transmit. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
397 |
// |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
398 |
NS_ASSERT_MSG (m_txMachineState == GAP, "Must be in interframe gap"); |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
399 |
m_txMachineState = READY; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
400 |
|
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
401 |
// Get the next packet from the queue for transmitting |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
402 |
if (m_queue->IsEmpty ()) |
1308
5c5937a4150d
backout 9856d1175cbb:642d6798feaa:27dd3e15308a
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1303
diff
changeset
|
403 |
{ |
5c5937a4150d
backout 9856d1175cbb:642d6798feaa:27dd3e15308a
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1303
diff
changeset
|
404 |
return; |
5c5937a4150d
backout 9856d1175cbb:642d6798feaa:27dd3e15308a
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1303
diff
changeset
|
405 |
} |
5c5937a4150d
backout 9856d1175cbb:642d6798feaa:27dd3e15308a
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1303
diff
changeset
|
406 |
else |
5c5937a4150d
backout 9856d1175cbb:642d6798feaa:27dd3e15308a
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1303
diff
changeset
|
407 |
{ |
1866
e7dbcc4df546
do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1504
diff
changeset
|
408 |
m_currentPkt = m_queue->Dequeue (); |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
409 |
NS_ASSERT_MSG (m_currentPkt != 0, "CsmaNetDevice::TransmitReadyEvent():" |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
410 |
" IsEmpty false but no Packet on queue?"); |
1308
5c5937a4150d
backout 9856d1175cbb:642d6798feaa:27dd3e15308a
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1303
diff
changeset
|
411 |
TransmitStart (); |
5c5937a4150d
backout 9856d1175cbb:642d6798feaa:27dd3e15308a
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1303
diff
changeset
|
412 |
} |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
413 |
} |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
414 |
|
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
415 |
bool |
1276
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
416 |
CsmaNetDevice::Attach (Ptr<CsmaChannel> ch) |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
417 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2975
diff
changeset
|
418 |
NS_LOG_FUNCTION (this << &ch); |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
419 |
|
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
420 |
m_channel = ch; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
421 |
|
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
422 |
m_deviceId = m_channel->Attach (this); |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
423 |
|
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
424 |
// |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
425 |
// The channel provides us with the transmitter data rate. |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
426 |
// |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
427 |
m_bps = m_channel->GetDataRate (); |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
428 |
|
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
429 |
// |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
430 |
// We use the Ethernet interframe gap of 96 bit times. |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
431 |
// |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
432 |
m_tInterframeGap = Seconds (m_bps.CalculateTxTime (96/8)); |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
433 |
|
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
434 |
// |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
435 |
// This device is up whenever a channel is attached to it. |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
436 |
// |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
437 |
NotifyLinkUp (); |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
438 |
return true; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
439 |
} |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
440 |
|
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
441 |
void |
3011
2d507430219e
bug 153 applied to CSMA
Craig Dowell <craigdo@ee.washington.edu>
parents:
2989
diff
changeset
|
442 |
CsmaNetDevice::SetQueue (Ptr<Queue> q) |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
443 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2975
diff
changeset
|
444 |
NS_LOG_FUNCTION (this << q); |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
445 |
m_queue = q; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
446 |
} |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
447 |
|
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
448 |
void |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
449 |
CsmaNetDevice::SetReceiveErrorModel (Ptr<ErrorModel> em) |
1820
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
450 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2975
diff
changeset
|
451 |
NS_LOG_FUNCTION (em); |
1820
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
452 |
m_receiveErrorModel = em; |
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
453 |
} |
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
454 |
|
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
455 |
void |
1866
e7dbcc4df546
do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1504
diff
changeset
|
456 |
CsmaNetDevice::Receive (Ptr<Packet> packet) |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
457 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2975
diff
changeset
|
458 |
NS_LOG_FUNCTION_NOARGS (); |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
459 |
NS_LOG_LOGIC ("UID is " << packet->GetUid ()); |
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1494
diff
changeset
|
460 |
|
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
461 |
// |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
462 |
// Only receive if the send side of net device is enabled |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
463 |
// |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
464 |
if (IsReceiveEnabled () == false) |
1186
909e9eb2124e
rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1167
diff
changeset
|
465 |
{ |
1866
e7dbcc4df546
do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1504
diff
changeset
|
466 |
m_dropTrace (packet); |
1210
599a311daef6
fix opt warnings, let compiler do tail call optimization in csma nd, remove protected access from router iface
Craig Dowell <craigdo@ee.washington.edu>
parents:
1209
diff
changeset
|
467 |
return; |
1186
909e9eb2124e
rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1167
diff
changeset
|
468 |
} |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
469 |
|
2777
a2de8a45eae3
Rx traces report the full packet and make sure we set the length field correctly in case of LLC encapsulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2655
diff
changeset
|
470 |
m_rxTrace (packet); |
a2de8a45eae3
Rx traces report the full packet and make sure we set the length field correctly in case of LLC encapsulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2655
diff
changeset
|
471 |
|
1186
909e9eb2124e
rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1167
diff
changeset
|
472 |
if (m_encapMode == RAW) |
909e9eb2124e
rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1167
diff
changeset
|
473 |
{ |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
474 |
m_rxCallback (this, packet, 0, GetBroadcast ()); |
1210
599a311daef6
fix opt warnings, let compiler do tail call optimization in csma nd, remove protected access from router iface
Craig Dowell <craigdo@ee.washington.edu>
parents:
1209
diff
changeset
|
475 |
return; |
1186
909e9eb2124e
rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1167
diff
changeset
|
476 |
} |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
477 |
|
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
478 |
EthernetTrailer trailer; |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
479 |
packet->RemoveTrailer (trailer); |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
480 |
trailer.CheckFcs (packet); |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
481 |
|
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
482 |
EthernetHeader header (false); |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
483 |
packet->RemoveHeader (header); |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
484 |
|
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
485 |
NS_LOG_LOGIC ("Pkt source is " << header.GetSource ()); |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
486 |
NS_LOG_LOGIC ("Pkt destination is " << header.GetDestination ()); |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
487 |
|
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
488 |
// |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
489 |
// We never forward up packets that we sent. Real devices don't do this since |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
490 |
// their receivers are disabled during send, so we don't. Drop the packet |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
491 |
// silently (no tracing) since it would really never get here in a real device. |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
492 |
// |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
493 |
if (header.GetSource () == GetAddress ()) |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
494 |
{ |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
495 |
NS_LOG_LOGIC ("Dropping packet sourced by this device"); |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
496 |
return; |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
497 |
} |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
498 |
|
1441
d6f8a7546e7f
semi-real multicast hardware addresses
Craig Dowell <craigdo@ee.washington.edu>
parents:
1278
diff
changeset
|
499 |
// |
d6f8a7546e7f
semi-real multicast hardware addresses
Craig Dowell <craigdo@ee.washington.edu>
parents:
1278
diff
changeset
|
500 |
// An IP host group address is mapped to an Ethernet multicast address |
d6f8a7546e7f
semi-real multicast hardware addresses
Craig Dowell <craigdo@ee.washington.edu>
parents:
1278
diff
changeset
|
501 |
// by placing the low-order 23-bits of the IP address into the low-order |
d6f8a7546e7f
semi-real multicast hardware addresses
Craig Dowell <craigdo@ee.washington.edu>
parents:
1278
diff
changeset
|
502 |
// 23 bits of the Ethernet multicast address 01-00-5E-00-00-00 (hex). |
d6f8a7546e7f
semi-real multicast hardware addresses
Craig Dowell <craigdo@ee.washington.edu>
parents:
1278
diff
changeset
|
503 |
// |
1442
bb5cf98c0c64
real multicast enet addr, more source routes, default multicast route
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
504 |
// We are going to receive all packets destined to any multicast address, |
bb5cf98c0c64
real multicast enet addr, more source routes, default multicast route
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
505 |
// which means clearing the low-order 23 bits the header destination |
1441
d6f8a7546e7f
semi-real multicast hardware addresses
Craig Dowell <craigdo@ee.washington.edu>
parents:
1278
diff
changeset
|
506 |
// |
1494
c2985e1cd091
rename Euixx to Macxx
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1451
diff
changeset
|
507 |
Mac48Address mcDest; |
1442
bb5cf98c0c64
real multicast enet addr, more source routes, default multicast route
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
508 |
uint8_t mcBuf[6]; |
bb5cf98c0c64
real multicast enet addr, more source routes, default multicast route
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
509 |
|
bb5cf98c0c64
real multicast enet addr, more source routes, default multicast route
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
510 |
header.GetDestination ().CopyTo (mcBuf); |
bb5cf98c0c64
real multicast enet addr, more source routes, default multicast route
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
511 |
mcBuf[3] &= 0x80; |
bb5cf98c0c64
real multicast enet addr, more source routes, default multicast route
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
512 |
mcBuf[4] = 0; |
bb5cf98c0c64
real multicast enet addr, more source routes, default multicast route
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
513 |
mcBuf[5] = 0; |
bb5cf98c0c64
real multicast enet addr, more source routes, default multicast route
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
514 |
mcDest.CopyFrom (mcBuf); |
bb5cf98c0c64
real multicast enet addr, more source routes, default multicast route
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
515 |
|
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
516 |
Mac48Address multicast = Mac48Address::ConvertFrom (GetMulticast ()); |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
517 |
Mac48Address broadcast = Mac48Address::ConvertFrom (GetBroadcast ()); |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
518 |
Mac48Address destination = Mac48Address::ConvertFrom (GetAddress ()); |
1442
bb5cf98c0c64
real multicast enet addr, more source routes, default multicast route
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
519 |
|
bb5cf98c0c64
real multicast enet addr, more source routes, default multicast route
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
520 |
if ((header.GetDestination () != broadcast) && |
bb5cf98c0c64
real multicast enet addr, more source routes, default multicast route
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
521 |
(mcDest != multicast) && |
bb5cf98c0c64
real multicast enet addr, more source routes, default multicast route
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
522 |
(header.GetDestination () != destination)) |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
523 |
{ |
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1494
diff
changeset
|
524 |
NS_LOG_LOGIC ("Dropping pkt "); |
1866
e7dbcc4df546
do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1504
diff
changeset
|
525 |
m_dropTrace (packet); |
1210
599a311daef6
fix opt warnings, let compiler do tail call optimization in csma nd, remove protected access from router iface
Craig Dowell <craigdo@ee.washington.edu>
parents:
1209
diff
changeset
|
526 |
return; |
1186
909e9eb2124e
rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1167
diff
changeset
|
527 |
} |
1276
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
528 |
|
1870 | 529 |
if (m_receiveErrorModel && m_receiveErrorModel->IsCorrupt (packet) ) |
1820
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
530 |
{ |
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
531 |
NS_LOG_LOGIC ("Dropping pkt due to error model "); |
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
532 |
m_dropTrace (packet); |
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
533 |
} |
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
534 |
else |
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
535 |
{ |
1210
599a311daef6
fix opt warnings, let compiler do tail call optimization in csma nd, remove protected access from router iface
Craig Dowell <craigdo@ee.washington.edu>
parents:
1209
diff
changeset
|
536 |
// |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
537 |
// variable <protocol> must be initialized to avoid a compiler warning in the |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
538 |
// RAW case that breaks the optimized build. |
1210
599a311daef6
fix opt warnings, let compiler do tail call optimization in csma nd, remove protected access from router iface
Craig Dowell <craigdo@ee.washington.edu>
parents:
1209
diff
changeset
|
539 |
// |
1820
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
540 |
uint16_t protocol = 0; |
1186
909e9eb2124e
rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1167
diff
changeset
|
541 |
|
1820
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
542 |
switch (m_encapMode) |
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
543 |
{ |
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
544 |
case ETHERNET_V1: |
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
545 |
case IP_ARP: |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
546 |
protocol = header.GetLengthType (); |
1820
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
547 |
break; |
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
548 |
case LLC: |
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
549 |
{ |
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
550 |
LlcSnapHeader llc; |
1870 | 551 |
packet->RemoveHeader (llc); |
1820
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
552 |
protocol = llc.GetType (); |
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
553 |
} |
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
554 |
break; |
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
555 |
case RAW: |
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
556 |
NS_ASSERT (false); |
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
557 |
break; |
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1504
diff
changeset
|
558 |
} |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
559 |
m_rxCallback (this, packet, protocol, header.GetSource ()); |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
560 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
561 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
562 |
|
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
563 |
Ptr<Queue> |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
564 |
CsmaNetDevice::GetQueue (void) const |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
565 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2975
diff
changeset
|
566 |
NS_LOG_FUNCTION_NOARGS (); |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
567 |
return m_queue; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
568 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
569 |
|
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
570 |
void |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
571 |
CsmaNetDevice::NotifyLinkUp (void) |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
572 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
573 |
m_linkUp = true; |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
574 |
if (m_linkChangeCallback.IsNull () == false) |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
575 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
576 |
m_linkChangeCallback (); |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
577 |
} |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
578 |
} |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
579 |
|
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
580 |
void |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
581 |
CsmaNetDevice::SetName (const std::string name) |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
582 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
583 |
m_name = name; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
584 |
} |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
585 |
|
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
586 |
std::string |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
587 |
CsmaNetDevice::GetName (void) const |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
588 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
589 |
return m_name; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
590 |
} |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
591 |
|
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
592 |
void |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
593 |
CsmaNetDevice::SetIfIndex (const uint32_t index) |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
594 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
595 |
m_ifIndex = index; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
596 |
} |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
597 |
|
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
598 |
uint32_t |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
599 |
CsmaNetDevice::GetIfIndex (void) const |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
600 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
601 |
return m_ifIndex; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
602 |
} |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
603 |
|
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
604 |
Ptr<Channel> |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
605 |
CsmaNetDevice::GetChannel (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
606 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
607 |
return m_channel; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
608 |
} |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
609 |
|
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
610 |
Address |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
611 |
CsmaNetDevice::GetAddress (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
612 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
613 |
return m_address; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
614 |
} |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
615 |
|
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
616 |
bool |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
617 |
CsmaNetDevice::SetMtu (const uint16_t mtu) |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
618 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
619 |
m_mtu = mtu; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
620 |
return true; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
621 |
} |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
622 |
|
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
623 |
uint16_t |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
624 |
CsmaNetDevice::GetMtu (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
625 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
626 |
return m_mtu; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
627 |
} |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
628 |
|
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
629 |
bool |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
630 |
CsmaNetDevice::IsLinkUp (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
631 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
632 |
return m_linkUp; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
633 |
} |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
634 |
|
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
635 |
void |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
636 |
CsmaNetDevice::SetLinkChangeCallback (Callback<void> callback) |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
637 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
638 |
m_linkChangeCallback = callback; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
639 |
} |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
640 |
|
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
641 |
bool |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
642 |
CsmaNetDevice::IsBroadcast (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
643 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
644 |
return true; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
645 |
} |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
646 |
|
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
647 |
Address |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
648 |
CsmaNetDevice::GetBroadcast (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
649 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
650 |
return Mac48Address ("ff:ff:ff:ff:ff:ff"); |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
651 |
} |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
652 |
|
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
653 |
bool |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
654 |
CsmaNetDevice::IsMulticast (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
655 |
{ |
2795 | 656 |
return true; |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
657 |
} |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
658 |
|
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
659 |
Address |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
660 |
CsmaNetDevice::GetMulticast (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
661 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
662 |
return Mac48Address ("01:00:5e:00:00:00"); |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
663 |
} |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
664 |
|
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
665 |
Address |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
666 |
CsmaNetDevice::MakeMulticastAddress (Ipv4Address multicastGroup) const |
1443
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
667 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2975
diff
changeset
|
668 |
NS_LOG_FUNCTION (this << multicastGroup); |
1443
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
669 |
// |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
670 |
// First, get the generic multicast address. |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
671 |
// |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
672 |
Address hardwareDestination = GetMulticast (); |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
673 |
|
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1494
diff
changeset
|
674 |
NS_LOG_LOGIC ("Device multicast address: " << hardwareDestination); |
1443
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
675 |
// |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
676 |
// It's our address, and we know we're playing with an EUI-48 address here |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
677 |
// primarily since we know that by construction, but also since the parameter |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
678 |
// is an Ipv4Address. |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
679 |
// |
1494
c2985e1cd091
rename Euixx to Macxx
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1451
diff
changeset
|
680 |
Mac48Address etherAddr = Mac48Address::ConvertFrom (hardwareDestination); |
1443
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
681 |
// |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
682 |
// We now have the multicast address in an abstract 48-bit container. We |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
683 |
// need to pull it out so we can play with it. When we're done, we have the |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
684 |
// high order bits in etherBuffer[0], etc. |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
685 |
// |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
686 |
uint8_t etherBuffer[6]; |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
687 |
etherAddr.CopyTo (etherBuffer); |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
688 |
// |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
689 |
// Now we need to pull the raw bits out of the Ipv4 destination address. |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
690 |
// |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
691 |
uint8_t ipBuffer[4]; |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
692 |
multicastGroup.Serialize (ipBuffer); |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
693 |
// |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
694 |
// RFC 1112 says that an Ipv4 host group address is mapped to an EUI-48 |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
695 |
// multicast address by placing the low-order 23-bits of the IP address into |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
696 |
// the low-order 23 bits of the Ethernet multicast address |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
697 |
// 01-00-5E-00-00-00 (hex). |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
698 |
// |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
699 |
etherBuffer[3] |= ipBuffer[1] & 0x7f; |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
700 |
etherBuffer[4] = ipBuffer[2]; |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
701 |
etherBuffer[5] = ipBuffer[3]; |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
702 |
// |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
703 |
// Now, etherBuffer has the desired ethernet multicast address. We have to |
1494
c2985e1cd091
rename Euixx to Macxx
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1451
diff
changeset
|
704 |
// suck these bits back into the Mac48Address, |
1443
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
705 |
// |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
706 |
etherAddr.CopyFrom (etherBuffer); |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
707 |
// |
1494
c2985e1cd091
rename Euixx to Macxx
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1451
diff
changeset
|
708 |
// Implicit conversion (operator Address ()) is defined for Mac48Address, so |
1443
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
709 |
// use it by just returning the EUI-48 address which is automagically converted |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
710 |
// to an Address. |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
711 |
// |
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1494
diff
changeset
|
712 |
NS_LOG_LOGIC ("multicast address is " << etherAddr); |
1443
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
713 |
|
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
714 |
return etherAddr; |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
715 |
} |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
716 |
|
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
717 |
bool |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
718 |
CsmaNetDevice::IsPointToPoint (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
719 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
720 |
return false; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
721 |
} |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
722 |
|
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
723 |
bool |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
724 |
CsmaNetDevice::Send( |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
725 |
Ptr<Packet> packet, |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
726 |
const Address& dest, |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
727 |
uint16_t protocolNumber) |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
728 |
{ |
2983
e3a416fe9dd5
NS_LOG_FUNCTION -> NS_LOG_FUNCTION_NOARGS and NS_LOG_PARAMS -> NS_LOG_FUNCTION
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2975
diff
changeset
|
729 |
NS_LOG_FUNCTION_NOARGS (); |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
730 |
NS_LOG_LOGIC ("p=" << packet); |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
731 |
NS_LOG_LOGIC ("UID is " << packet->GetUid () << ")"); |
1443
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1442
diff
changeset
|
732 |
|
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
733 |
NS_ASSERT (IsLinkUp ()); |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
734 |
|
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
735 |
// |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
736 |
// Only transmit if send side of net device is enabled |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
737 |
// |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
738 |
if (IsSendEnabled () == false) |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
739 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
740 |
return false; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
741 |
} |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
742 |
|
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
743 |
Mac48Address destination = Mac48Address::ConvertFrom (dest); |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
744 |
AddHeader (packet, destination, protocolNumber); |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
745 |
|
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
746 |
// |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
747 |
// Place the packet to be sent on the send queue |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
748 |
// |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
749 |
if (m_queue->Enqueue(packet) == false) |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
750 |
{ |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
751 |
return false; |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
752 |
} |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
753 |
// |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
754 |
// If the device is idle, we need to start a transmission. Otherwise, |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
755 |
// the transmission will be started when the current packet finished |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
756 |
// transmission (see TransmitCompleteEvent) |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
757 |
// |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
758 |
if (m_txMachineState == READY) |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
759 |
{ |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
760 |
// |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
761 |
// The next packet to be transmitted goes in m_currentPkt |
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
762 |
// |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
763 |
m_currentPkt = m_queue->Dequeue (); |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
764 |
if (m_currentPkt != 0) |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
765 |
{ |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
766 |
TransmitStart (); |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
767 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
768 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
769 |
return true; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
770 |
} |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
771 |
|
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
772 |
Ptr<Node> |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
773 |
CsmaNetDevice::GetNode (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
774 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
775 |
return m_node; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
776 |
} |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
777 |
|
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
778 |
void |
2600
6c389d0c717d
add Application::SetNode and NetDevice::SetNode, use them from Node::AddApplication and Node::AddDevice. kill useless "Node" attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2501
diff
changeset
|
779 |
CsmaNetDevice::SetNode (Ptr<Node> node) |
6c389d0c717d
add Application::SetNode and NetDevice::SetNode, use them from Node::AddApplication and Node::AddDevice. kill useless "Node" attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2501
diff
changeset
|
780 |
{ |
6c389d0c717d
add Application::SetNode and NetDevice::SetNode, use them from Node::AddApplication and Node::AddDevice. kill useless "Node" attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2501
diff
changeset
|
781 |
m_node = node; |
6c389d0c717d
add Application::SetNode and NetDevice::SetNode, use them from Node::AddApplication and Node::AddDevice. kill useless "Node" attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2501
diff
changeset
|
782 |
} |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
783 |
|
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
784 |
bool |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
785 |
CsmaNetDevice::NeedsArp (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
786 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
787 |
if ((m_encapMode == IP_ARP) || (m_encapMode == LLC)) |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
788 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
789 |
return true; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
790 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
791 |
else |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
792 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
793 |
return false; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
794 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
795 |
} |
3257
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
796 |
|
ba198dad54a2
CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents:
3011
diff
changeset
|
797 |
void |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
798 |
CsmaNetDevice::SetReceiveCallback (NetDevice::ReceiveCallback cb) |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
799 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2258
diff
changeset
|
800 |
m_rxCallback = cb; |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
801 |
} |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
802 |
|
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
803 |
} // namespace ns3 |