author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Thu, 13 Mar 2008 11:10:38 -0700 | |
changeset 2600 | 6c389d0c717d |
parent 2502 | 50d0da37f02f |
child 2602 | d9262bff6df2 |
permissions | -rw-r--r-- |
368
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
2 |
/* |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
3 |
* Copyright (c) 2005,2006 INRIA |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
4 |
* All rights reserved. |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
5 |
* |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
6 |
* This program is free software; you can redistribute it and/or modify |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
7 |
* it under the terms of the GNU General Public License version 2 as |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
8 |
* published by the Free Software Foundation; |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
9 |
* |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
10 |
* This program is distributed in the hope that it will be useful, |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
13 |
* GNU General Public License for more details. |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
14 |
* |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
16 |
* along with this program; if not, write to the Free Software |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
17 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
18 |
* |
926
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
19 |
* Author: Craig Dowell <craigdo@ee.washington.edu> |
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
20 |
* Revised: George Riley <riley@ece.gatech.edu> |
368
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
21 |
*/ |
245
28ba3a5cdff8
add p2p netdevice and channel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
22 |
|
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1494
diff
changeset
|
23 |
#include "ns3/log.h" |
368
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
24 |
#include "ns3/queue.h" |
378
32bd402ea5ea
remove unused files, remove notion of PHY, make more realistic p2p-net-device and p2p-channel
Craig Dowell
parents:
371
diff
changeset
|
25 |
#include "ns3/simulator.h" |
1494
c2985e1cd091
rename Euixx to Macxx
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1451
diff
changeset
|
26 |
#include "ns3/mac48-address.h" |
1167 | 27 |
#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:
1508
diff
changeset
|
28 |
#include "ns3/error-model.h" |
2502
50d0da37f02f
introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
29 |
#include "ns3/trace-source-accessor.h" |
973
2aea9e9f698c
src/devices/point-to-point/p2p-* -> src/devices/point-to-point/point-to-point-*
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
972
diff
changeset
|
30 |
#include "point-to-point-net-device.h" |
2aea9e9f698c
src/devices/point-to-point/p2p-* -> src/devices/point-to-point/point-to-point-*
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
972
diff
changeset
|
31 |
#include "point-to-point-channel.h" |
368
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
32 |
|
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1494
diff
changeset
|
33 |
NS_LOG_COMPONENT_DEFINE ("PointToPointNetDevice"); |
245
28ba3a5cdff8
add p2p netdevice and channel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
34 |
|
28ba3a5cdff8
add p2p netdevice and channel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
35 |
namespace ns3 { |
28ba3a5cdff8
add p2p netdevice and channel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
36 |
|
2502
50d0da37f02f
introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
37 |
NS_OBJECT_ENSURE_REGISTERED (PointToPointNetDevice); |
926
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
38 |
|
2502
50d0da37f02f
introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
39 |
TypeId |
50d0da37f02f
introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
40 |
PointToPointNetDevice::GetTypeId (void) |
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1494
diff
changeset
|
41 |
{ |
2502
50d0da37f02f
introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
42 |
static TypeId tid = TypeId ("PointToPointNetDevice") |
50d0da37f02f
introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
43 |
.SetParent<NetDevice> () |
50d0da37f02f
introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
44 |
.AddConstructor<PointToPointNetDevice> () |
50d0da37f02f
introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
45 |
.AddAttribute ("Address", "The address of this device.", |
50d0da37f02f
introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
46 |
Mac48Address ("ff:ff:ff:ff:ff:ff"), |
50d0da37f02f
introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
47 |
MakeMac48AddressAccessor (&PointToPointNetDevice::m_address), |
50d0da37f02f
introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
48 |
MakeMac48AddressChecker ()) |
50d0da37f02f
introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
49 |
.AddAttribute ("DataRate", "The default data rate for point to point links", |
50d0da37f02f
introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
50 |
DataRate ("10Mb/s"), |
50d0da37f02f
introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
51 |
MakeDataRateAccessor (&PointToPointNetDevice::m_bps), |
50d0da37f02f
introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
52 |
MakeDataRateChecker ()) |
50d0da37f02f
introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
53 |
.AddAttribute ("RxErrorModel", "XXX", |
50d0da37f02f
introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
54 |
Ptr<ErrorModel> (0), |
50d0da37f02f
introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
55 |
MakePtrAccessor (&PointToPointNetDevice::m_receiveErrorModel), |
50d0da37f02f
introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
56 |
MakePtrChecker<ErrorModel> ()) |
50d0da37f02f
introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
57 |
.AddAttribute ("TxQueue", "XXX", |
50d0da37f02f
introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
58 |
Ptr<Queue> (0), |
50d0da37f02f
introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
59 |
MakePtrAccessor (&PointToPointNetDevice::m_queue), |
50d0da37f02f
introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
60 |
MakePtrChecker<Queue> ()) |
50d0da37f02f
introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
61 |
.AddAttribute ("InterframeGap", "XXX", |
50d0da37f02f
introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
62 |
Seconds (0.0), |
50d0da37f02f
introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
63 |
MakeTimeAccessor (&PointToPointNetDevice::m_tInterframeGap), |
50d0da37f02f
introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
64 |
MakeTimeChecker ()) |
50d0da37f02f
introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
65 |
.AddTraceSource ("Rx", "Receive MAC packet.", |
50d0da37f02f
introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
66 |
MakeTraceSourceAccessor (&PointToPointNetDevice::m_rxTrace)) |
50d0da37f02f
introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
67 |
.AddTraceSource ("Drop", "Drop MAC packet.", |
50d0da37f02f
introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
68 |
MakeTraceSourceAccessor (&PointToPointNetDevice::m_dropTrace)) |
1820
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1508
diff
changeset
|
69 |
|
2502
50d0da37f02f
introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
70 |
; |
50d0da37f02f
introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
71 |
return tid; |
1229
e4cfe4094c10
build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1208
diff
changeset
|
72 |
} |
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1494
diff
changeset
|
73 |
|
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1494
diff
changeset
|
74 |
|
2502
50d0da37f02f
introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
75 |
PointToPointNetDevice::PointToPointNetDevice () |
378
32bd402ea5ea
remove unused files, remove notion of PHY, make more realistic p2p-net-device and p2p-channel
Craig Dowell
parents:
371
diff
changeset
|
76 |
: |
379
ae74e8a7bb44
net device copy and assignment, reference counted channel.
Craig Dowell
parents:
378
diff
changeset
|
77 |
m_txMachineState (READY), |
ae74e8a7bb44
net device copy and assignment, reference counted channel.
Craig Dowell
parents:
378
diff
changeset
|
78 |
m_channel (0), |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
79 |
m_name (""), |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
80 |
m_linkUp (false), |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
81 |
m_mtu (0xffff) |
257
60d6d9bb4f9a
make sure the MTU is correcrtly setup and the link is up.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
247
diff
changeset
|
82 |
{ |
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1494
diff
changeset
|
83 |
NS_LOG_FUNCTION; |
2502
50d0da37f02f
introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
84 |
NS_LOG_PARAMS (this); |
257
60d6d9bb4f9a
make sure the MTU is correcrtly setup and the link is up.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
247
diff
changeset
|
85 |
} |
245
28ba3a5cdff8
add p2p netdevice and channel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
86 |
|
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
87 |
PointToPointNetDevice::~PointToPointNetDevice () |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
88 |
{} |
379
ae74e8a7bb44
net device copy and assignment, reference counted channel.
Craig Dowell
parents:
378
diff
changeset
|
89 |
|
1167 | 90 |
void |
1866
e7dbcc4df546
do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1508
diff
changeset
|
91 |
PointToPointNetDevice::AddHeader(Ptr<Packet> p, uint16_t protocolNumber) |
975
98233c6c9c2e
Move LLC encapsulation from NetDevice to subclasses.
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
973
diff
changeset
|
92 |
{ |
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1494
diff
changeset
|
93 |
NS_LOG_FUNCTION; |
975
98233c6c9c2e
Move LLC encapsulation from NetDevice to subclasses.
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
973
diff
changeset
|
94 |
LlcSnapHeader llc; |
98233c6c9c2e
Move LLC encapsulation from NetDevice to subclasses.
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
973
diff
changeset
|
95 |
llc.SetType (protocolNumber); |
1866
e7dbcc4df546
do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1508
diff
changeset
|
96 |
p->AddHeader (llc); |
975
98233c6c9c2e
Move LLC encapsulation from NetDevice to subclasses.
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
973
diff
changeset
|
97 |
} |
98233c6c9c2e
Move LLC encapsulation from NetDevice to subclasses.
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
973
diff
changeset
|
98 |
|
1167 | 99 |
bool |
1866
e7dbcc4df546
do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1508
diff
changeset
|
100 |
PointToPointNetDevice::ProcessHeader(Ptr<Packet> p, uint16_t& param) |
975
98233c6c9c2e
Move LLC encapsulation from NetDevice to subclasses.
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
973
diff
changeset
|
101 |
{ |
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1494
diff
changeset
|
102 |
NS_LOG_FUNCTION; |
975
98233c6c9c2e
Move LLC encapsulation from NetDevice to subclasses.
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
973
diff
changeset
|
103 |
LlcSnapHeader llc; |
1866
e7dbcc4df546
do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1508
diff
changeset
|
104 |
p->RemoveHeader (llc); |
975
98233c6c9c2e
Move LLC encapsulation from NetDevice to subclasses.
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
973
diff
changeset
|
105 |
|
98233c6c9c2e
Move LLC encapsulation from NetDevice to subclasses.
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
973
diff
changeset
|
106 |
param = llc.GetType (); |
98233c6c9c2e
Move LLC encapsulation from NetDevice to subclasses.
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
973
diff
changeset
|
107 |
|
98233c6c9c2e
Move LLC encapsulation from NetDevice to subclasses.
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
973
diff
changeset
|
108 |
return true; |
98233c6c9c2e
Move LLC encapsulation from NetDevice to subclasses.
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
973
diff
changeset
|
109 |
} |
98233c6c9c2e
Move LLC encapsulation from NetDevice to subclasses.
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
973
diff
changeset
|
110 |
|
517
702e96b8960f
finish Dispose -> DoDispose rework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
471
diff
changeset
|
111 |
void PointToPointNetDevice::DoDispose() |
465
7f620ea278f4
merge in raj's dispose early work
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
445
diff
changeset
|
112 |
{ |
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1494
diff
changeset
|
113 |
NS_LOG_FUNCTION; |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
114 |
m_node = 0; |
568
e1660959ecbb
use Ptr<> everywhere Object or NsUnknown are used
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
543
diff
changeset
|
115 |
m_channel = 0; |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
116 |
m_receiveErrorModel = 0; |
568
e1660959ecbb
use Ptr<> everywhere Object or NsUnknown are used
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
543
diff
changeset
|
117 |
NetDevice::DoDispose (); |
465
7f620ea278f4
merge in raj's dispose early work
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
445
diff
changeset
|
118 |
} |
7f620ea278f4
merge in raj's dispose early work
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
445
diff
changeset
|
119 |
|
926
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
120 |
void PointToPointNetDevice::SetDataRate(const DataRate& bps) |
378
32bd402ea5ea
remove unused files, remove notion of PHY, make more realistic p2p-net-device and p2p-channel
Craig Dowell
parents:
371
diff
changeset
|
121 |
{ |
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1494
diff
changeset
|
122 |
NS_LOG_FUNCTION; |
1825
1544b7c8aa18
minor fix for bug95; also const operators for DataRate
Tom Henderson <tomh@tomh.org>
parents:
1820
diff
changeset
|
123 |
if (!m_channel || bps <= m_channel->GetDataRate ()) |
1544b7c8aa18
minor fix for bug95; also const operators for DataRate
Tom Henderson <tomh@tomh.org>
parents:
1820
diff
changeset
|
124 |
{ |
1544b7c8aa18
minor fix for bug95; also const operators for DataRate
Tom Henderson <tomh@tomh.org>
parents:
1820
diff
changeset
|
125 |
m_bps = bps; |
1544b7c8aa18
minor fix for bug95; also const operators for DataRate
Tom Henderson <tomh@tomh.org>
parents:
1820
diff
changeset
|
126 |
} |
245
28ba3a5cdff8
add p2p netdevice and channel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
127 |
} |
28ba3a5cdff8
add p2p netdevice and channel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
128 |
|
926
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
129 |
void PointToPointNetDevice::SetInterframeGap(const Time& t) |
378
32bd402ea5ea
remove unused files, remove notion of PHY, make more realistic p2p-net-device and p2p-channel
Craig Dowell
parents:
371
diff
changeset
|
130 |
{ |
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1494
diff
changeset
|
131 |
NS_LOG_FUNCTION; |
378
32bd402ea5ea
remove unused files, remove notion of PHY, make more realistic p2p-net-device and p2p-channel
Craig Dowell
parents:
371
diff
changeset
|
132 |
m_tInterframeGap = t; |
32bd402ea5ea
remove unused files, remove notion of PHY, make more realistic p2p-net-device and p2p-channel
Craig Dowell
parents:
371
diff
changeset
|
133 |
} |
368
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
134 |
|
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
135 |
bool |
1866
e7dbcc4df546
do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1508
diff
changeset
|
136 |
PointToPointNetDevice::TransmitStart (Ptr<Packet> p) |
378
32bd402ea5ea
remove unused files, remove notion of PHY, make more realistic p2p-net-device and p2p-channel
Craig Dowell
parents:
371
diff
changeset
|
137 |
{ |
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1494
diff
changeset
|
138 |
NS_LOG_FUNCTION; |
1870 | 139 |
NS_LOG_PARAMS (this << p); |
1866
e7dbcc4df546
do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1508
diff
changeset
|
140 |
NS_LOG_LOGIC ("UID is " << p->GetUid () << ")"); |
378
32bd402ea5ea
remove unused files, remove notion of PHY, make more realistic p2p-net-device and p2p-channel
Craig Dowell
parents:
371
diff
changeset
|
141 |
// |
32bd402ea5ea
remove unused files, remove notion of PHY, make more realistic p2p-net-device and p2p-channel
Craig Dowell
parents:
371
diff
changeset
|
142 |
// This function is called to start the process of transmitting a packet. |
32bd402ea5ea
remove unused files, remove notion of PHY, make more realistic p2p-net-device and p2p-channel
Craig Dowell
parents:
371
diff
changeset
|
143 |
// We need to tell the channel that we've started wiggling the wire and |
926
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
144 |
// schedule an event that will be executed when the transmission is complete. |
378
32bd402ea5ea
remove unused files, remove notion of PHY, make more realistic p2p-net-device and p2p-channel
Craig Dowell
parents:
371
diff
changeset
|
145 |
// |
414 | 146 |
NS_ASSERT_MSG(m_txMachineState == READY, "Must be READY to transmit"); |
378
32bd402ea5ea
remove unused files, remove notion of PHY, make more realistic p2p-net-device and p2p-channel
Craig Dowell
parents:
371
diff
changeset
|
147 |
m_txMachineState = BUSY; |
1866
e7dbcc4df546
do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1508
diff
changeset
|
148 |
Time txTime = Seconds (m_bps.CalculateTxTime(p->GetSize())); |
926
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
149 |
Time txCompleteTime = txTime + m_tInterframeGap; |
378
32bd402ea5ea
remove unused files, remove notion of PHY, make more realistic p2p-net-device and p2p-channel
Craig Dowell
parents:
371
diff
changeset
|
150 |
|
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1494
diff
changeset
|
151 |
NS_LOG_LOGIC ("Schedule TransmitCompleteEvent in " << |
926
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
152 |
txCompleteTime.GetSeconds () << "sec"); |
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
153 |
// Schedule the tx complete event |
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
154 |
Simulator::Schedule (txCompleteTime, |
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
155 |
&PointToPointNetDevice::TransmitComplete, |
378
32bd402ea5ea
remove unused files, remove notion of PHY, make more realistic p2p-net-device and p2p-channel
Craig Dowell
parents:
371
diff
changeset
|
156 |
this); |
926
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
157 |
return m_channel->TransmitStart(p, this, txTime); |
378
32bd402ea5ea
remove unused files, remove notion of PHY, make more realistic p2p-net-device and p2p-channel
Craig Dowell
parents:
371
diff
changeset
|
158 |
} |
32bd402ea5ea
remove unused files, remove notion of PHY, make more realistic p2p-net-device and p2p-channel
Craig Dowell
parents:
371
diff
changeset
|
159 |
|
926
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
160 |
void PointToPointNetDevice::TransmitComplete (void) |
378
32bd402ea5ea
remove unused files, remove notion of PHY, make more realistic p2p-net-device and p2p-channel
Craig Dowell
parents:
371
diff
changeset
|
161 |
{ |
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1494
diff
changeset
|
162 |
NS_LOG_FUNCTION; |
378
32bd402ea5ea
remove unused files, remove notion of PHY, make more realistic p2p-net-device and p2p-channel
Craig Dowell
parents:
371
diff
changeset
|
163 |
// |
32bd402ea5ea
remove unused files, remove notion of PHY, make more realistic p2p-net-device and p2p-channel
Craig Dowell
parents:
371
diff
changeset
|
164 |
// This function is called to finish the process of transmitting a packet. |
32bd402ea5ea
remove unused files, remove notion of PHY, make more realistic p2p-net-device and p2p-channel
Craig Dowell
parents:
371
diff
changeset
|
165 |
// We need to tell the channel that we've stopped wiggling the wire and |
926
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
166 |
// get the next packet from the queue. If the queue is empty, we are |
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
167 |
// done, otherwise transmit the next packet. |
378
32bd402ea5ea
remove unused files, remove notion of PHY, make more realistic p2p-net-device and p2p-channel
Craig Dowell
parents:
371
diff
changeset
|
168 |
// |
414 | 169 |
NS_ASSERT_MSG(m_txMachineState == BUSY, "Must be BUSY if transmitting"); |
926
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
170 |
m_txMachineState = READY; |
1866
e7dbcc4df546
do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1508
diff
changeset
|
171 |
Ptr<Packet> p = m_queue->Dequeue (); |
e7dbcc4df546
do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1508
diff
changeset
|
172 |
if (p == 0) |
e7dbcc4df546
do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1508
diff
changeset
|
173 |
{ |
e7dbcc4df546
do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1508
diff
changeset
|
174 |
return; // Nothing to do at this point |
e7dbcc4df546
do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1508
diff
changeset
|
175 |
} |
926
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
176 |
TransmitStart(p); |
773
18ad0b94e2ae
back out unfinished p2p changes
Tom Henderson <tomh@tomh.org>
parents:
767
diff
changeset
|
177 |
} |
18ad0b94e2ae
back out unfinished p2p changes
Tom Henderson <tomh@tomh.org>
parents:
767
diff
changeset
|
178 |
|
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1494
diff
changeset
|
179 |
bool |
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1494
diff
changeset
|
180 |
PointToPointNetDevice::Attach (Ptr<PointToPointChannel> ch) |
245
28ba3a5cdff8
add p2p netdevice and channel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
181 |
{ |
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1494
diff
changeset
|
182 |
NS_LOG_FUNCTION; |
1828
6ab68edddf45
nicer logging of parameters (bug 79 patch from Gustavo)
Tom Henderson <tomh@tomh.org>
parents:
1825
diff
changeset
|
183 |
NS_LOG_PARAMS (this << &ch); |
368
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
184 |
|
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
185 |
m_channel = ch; |
378
32bd402ea5ea
remove unused files, remove notion of PHY, make more realistic p2p-net-device and p2p-channel
Craig Dowell
parents:
371
diff
changeset
|
186 |
|
32bd402ea5ea
remove unused files, remove notion of PHY, make more realistic p2p-net-device and p2p-channel
Craig Dowell
parents:
371
diff
changeset
|
187 |
m_channel->Attach(this); |
32bd402ea5ea
remove unused files, remove notion of PHY, make more realistic p2p-net-device and p2p-channel
Craig Dowell
parents:
371
diff
changeset
|
188 |
m_bps = m_channel->GetDataRate (); |
926
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
189 |
// GFR Comment. Below is definitely wrong. Interframe gap |
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
190 |
// is unrelated to channel delay. |
1443
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
191 |
// -- unlesss you want to introduce a default gap which is there to avoid |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1441
diff
changeset
|
192 |
// parts of multiple packets flowing on the "wire" at the same time. |
926
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
193 |
//m_tInterframeGap = m_channel->GetDelay (); |
378
32bd402ea5ea
remove unused files, remove notion of PHY, make more realistic p2p-net-device and p2p-channel
Craig Dowell
parents:
371
diff
changeset
|
194 |
|
368
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
195 |
/* |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
196 |
* For now, this device is up whenever a channel is attached to it. |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
197 |
* In fact, it should become up only when the second device |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
198 |
* is attached to the channel. So, there should be a way for |
369
29ea5d1a83c8
Rename classes from Serial to PointToPoint
Tom Henderson <tomh@tomh.org>
parents:
368
diff
changeset
|
199 |
* a PointToPointChannel to notify both of its attached devices |
368
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
200 |
* that the channel is 'complete', hence that the devices are |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
201 |
* up, hence that they can call NotifyLinkUp. |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
202 |
*/ |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
203 |
NotifyLinkUp (); |
245
28ba3a5cdff8
add p2p netdevice and channel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
204 |
return true; |
28ba3a5cdff8
add p2p netdevice and channel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
205 |
} |
28ba3a5cdff8
add p2p netdevice and channel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
206 |
|
926
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
207 |
void PointToPointNetDevice::AddQueue (Ptr<Queue> q) |
345
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
331
diff
changeset
|
208 |
{ |
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1494
diff
changeset
|
209 |
NS_LOG_FUNCTION; |
1828
6ab68edddf45
nicer logging of parameters (bug 79 patch from Gustavo)
Tom Henderson <tomh@tomh.org>
parents:
1825
diff
changeset
|
210 |
NS_LOG_PARAMS (this << q); |
368
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
211 |
|
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
212 |
m_queue = q; |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
213 |
} |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
214 |
|
1820
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1508
diff
changeset
|
215 |
void PointToPointNetDevice::AddReceiveErrorModel (Ptr<ErrorModel> em) |
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1508
diff
changeset
|
216 |
{ |
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1508
diff
changeset
|
217 |
NS_LOG_FUNCTION; |
2203 | 218 |
NS_LOG_PARAMS ("(" << em << ")"); |
1820
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1508
diff
changeset
|
219 |
|
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1508
diff
changeset
|
220 |
m_receiveErrorModel = em; |
2258
666099a753e0
AddInterface -> AggregateObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2203
diff
changeset
|
221 |
AggregateObject (em); |
1820
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1508
diff
changeset
|
222 |
} |
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1508
diff
changeset
|
223 |
|
1866
e7dbcc4df546
do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1508
diff
changeset
|
224 |
void PointToPointNetDevice::Receive (Ptr<Packet> packet) |
368
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
225 |
{ |
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1494
diff
changeset
|
226 |
NS_LOG_FUNCTION; |
1870 | 227 |
NS_LOG_PARAMS (this << packet); |
1186
909e9eb2124e
rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1167
diff
changeset
|
228 |
uint16_t protocol = 0; |
1308
5c5937a4150d
backout 9856d1175cbb:642d6798feaa:27dd3e15308a
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1303
diff
changeset
|
229 |
|
1870 | 230 |
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:
1508
diff
changeset
|
231 |
{ |
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1508
diff
changeset
|
232 |
m_dropTrace (packet); |
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1508
diff
changeset
|
233 |
// Do not forward up; let this packet go |
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1508
diff
changeset
|
234 |
} |
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1508
diff
changeset
|
235 |
else |
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1508
diff
changeset
|
236 |
{ |
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1508
diff
changeset
|
237 |
m_rxTrace (packet); |
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1508
diff
changeset
|
238 |
ProcessHeader(packet, protocol); |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
239 |
m_rxCallback (this, packet, protocol, GetBroadcast ()); |
1820
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1508
diff
changeset
|
240 |
} |
345
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
331
diff
changeset
|
241 |
} |
47b41507a45a
move channel.cc channel.h to node directory; merge ns-3-tracing from mathieu
Tom Henderson <tomh@tomh.org>
parents:
331
diff
changeset
|
242 |
|
926
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
243 |
Ptr<Queue> PointToPointNetDevice::GetQueue(void) const |
368
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
244 |
{ |
1504
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1494
diff
changeset
|
245 |
NS_LOG_FUNCTION; |
36ecc970ba96
checkpoint debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents:
1494
diff
changeset
|
246 |
return m_queue; |
368
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
247 |
} |
245
28ba3a5cdff8
add p2p netdevice and channel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
248 |
|
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
249 |
void |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
250 |
PointToPointNetDevice::NotifyLinkUp (void) |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
251 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
252 |
m_linkUp = true; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
253 |
if (!m_linkChangeCallback.IsNull ()) |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
254 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
255 |
m_linkChangeCallback (); |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
256 |
} |
368
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
257 |
} |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
258 |
|
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
259 |
void |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
260 |
PointToPointNetDevice::SetName(const std::string name) |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
261 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
262 |
m_name = name; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
263 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
264 |
std::string |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
265 |
PointToPointNetDevice::GetName(void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
266 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
267 |
return m_name; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
268 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
269 |
void |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
270 |
PointToPointNetDevice::SetIfIndex(const uint32_t index) |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
271 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
272 |
m_ifIndex = index; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
273 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
274 |
uint32_t |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
275 |
PointToPointNetDevice::GetIfIndex(void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
276 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
277 |
return m_ifIndex; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
278 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
279 |
Ptr<Channel> |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
280 |
PointToPointNetDevice::GetChannel (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
281 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
282 |
return m_channel; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
283 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
284 |
Address |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
285 |
PointToPointNetDevice::GetAddress (void) const |
445
10cd9049a0ad
add NetDevice::NeedsArp method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
414
diff
changeset
|
286 |
{ |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
287 |
return m_address; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
288 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
289 |
bool |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
290 |
PointToPointNetDevice::SetMtu (const uint16_t mtu) |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
291 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
292 |
m_mtu = mtu; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
293 |
return true; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
294 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
295 |
uint16_t |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
296 |
PointToPointNetDevice::GetMtu (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
297 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
298 |
return m_mtu; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
299 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
300 |
bool |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
301 |
PointToPointNetDevice::IsLinkUp (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
302 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
303 |
return m_linkUp; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
304 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
305 |
void |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
306 |
PointToPointNetDevice::SetLinkChangeCallback (Callback<void> callback) |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
307 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
308 |
m_linkChangeCallback = callback; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
309 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
310 |
bool |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
311 |
PointToPointNetDevice::IsBroadcast (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
312 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
313 |
return true; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
314 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
315 |
Address |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
316 |
PointToPointNetDevice::GetBroadcast (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
317 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
318 |
return Mac48Address ("ff:ff:ff:ff:ff:ff"); |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
319 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
320 |
bool |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
321 |
PointToPointNetDevice::IsMulticast (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
322 |
{ |
445
10cd9049a0ad
add NetDevice::NeedsArp method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
414
diff
changeset
|
323 |
return false; |
10cd9049a0ad
add NetDevice::NeedsArp method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
414
diff
changeset
|
324 |
} |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
325 |
Address |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
326 |
PointToPointNetDevice::GetMulticast (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
327 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
328 |
return Mac48Address ("01:00:5e:00:00:00"); |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
329 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
330 |
Address |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
331 |
PointToPointNetDevice::MakeMulticastAddress (Ipv4Address multicastGroup) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
332 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
333 |
return Mac48Address ("01:00:5e:00:00:00"); |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
334 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
335 |
bool |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
336 |
PointToPointNetDevice::IsPointToPoint (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
337 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
338 |
return true; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
339 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
340 |
bool |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
341 |
PointToPointNetDevice::Send(Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber) |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
342 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
343 |
NS_LOG_FUNCTION; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
344 |
NS_LOG_LOGIC ("p=" << packet << ", dest=" << &dest); |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
345 |
NS_LOG_LOGIC ("UID is " << packet->GetUid ()); |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
346 |
|
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
347 |
// GFR Comment. Why is this an assertion? Can't a link legitimately |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
348 |
// "go down" during the simulation? Shouldn't we just wait for it |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
349 |
// to come back up? |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
350 |
NS_ASSERT (IsLinkUp ()); |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
351 |
AddHeader(packet, protocolNumber); |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
352 |
|
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
353 |
// |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
354 |
// This class simulates a point to point device. In the case of a serial |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
355 |
// link, this means that we're simulating something like a UART. |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
356 |
// |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
357 |
// |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
358 |
// If there's a transmission in progress, we enque the packet for later |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
359 |
// transmission; otherwise we send it now. |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
360 |
if (m_txMachineState == READY) |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
361 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
362 |
// We still enqueue and dequeue it to hit the tracing hooks |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
363 |
m_queue->Enqueue (packet); |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
364 |
packet = m_queue->Dequeue (); |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
365 |
return TransmitStart (packet); |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
366 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
367 |
else |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
368 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
369 |
return m_queue->Enqueue(packet); |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
370 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
371 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
372 |
Ptr<Node> |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
373 |
PointToPointNetDevice::GetNode (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
374 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
375 |
return m_node; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
376 |
} |
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:
2502
diff
changeset
|
377 |
void |
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:
2502
diff
changeset
|
378 |
PointToPointNetDevice::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:
2502
diff
changeset
|
379 |
{ |
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:
2502
diff
changeset
|
380 |
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:
2502
diff
changeset
|
381 |
} |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
382 |
bool |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
383 |
PointToPointNetDevice::NeedsArp (void) const |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
384 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
385 |
return false; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
386 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
387 |
void |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
388 |
PointToPointNetDevice::SetReceiveCallback (NetDevice::ReceiveCallback cb) |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
389 |
{ |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
390 |
m_rxCallback = cb; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
391 |
} |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2424
diff
changeset
|
392 |
|
445
10cd9049a0ad
add NetDevice::NeedsArp method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
414
diff
changeset
|
393 |
|
368
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
394 |
} // namespace ns3 |