author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Mon, 01 Oct 2007 14:15:56 +0200 | |
changeset 1866 | e7dbcc4df546 |
parent 1412 | 9ce52d4f530b |
child 1867 | 16deaedc0380 |
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) 2007 University of Washington |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
4 |
* |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
5 |
* 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
|
6 |
* 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
|
7 |
* published by the Free Software Foundation; |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
8 |
* |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
9 |
* 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
|
10 |
* 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
|
11 |
* 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
|
12 |
* GNU General Public License for more details. |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
13 |
* |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
14 |
* 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
|
15 |
* 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
|
16 |
* 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
|
17 |
* |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
18 |
* Author: Craig Dowell <craigdo@ee.washington.edu> |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
19 |
*/ |
245
28ba3a5cdff8
add p2p netdevice and channel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
20 |
|
369
29ea5d1a83c8
Rename classes from Serial to PointToPoint
Tom Henderson <tomh@tomh.org>
parents:
368
diff
changeset
|
21 |
#ifndef POINT_TO_POINT_NET_DEVICE_H |
29ea5d1a83c8
Rename classes from Serial to PointToPoint
Tom Henderson <tomh@tomh.org>
parents:
368
diff
changeset
|
22 |
#define POINT_TO_POINT_NET_DEVICE_H |
245
28ba3a5cdff8
add p2p netdevice and channel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
23 |
|
368
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
24 |
#include <string.h> |
1167 | 25 |
#include "ns3/address.h" |
729
b5e744285e92
rename i-node to node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
728
diff
changeset
|
26 |
#include "ns3/node.h" |
331
d75ee9d8efa4
move p2p to new dir
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
252
diff
changeset
|
27 |
#include "ns3/net-device.h" |
368
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
28 |
#include "ns3/callback.h" |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
29 |
#include "ns3/packet.h" |
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
30 |
#include "ns3/callback-trace-source.h" |
378
32bd402ea5ea
remove unused files, remove notion of PHY, make more realistic p2p-net-device and p2p-channel
Craig Dowell
parents:
369
diff
changeset
|
31 |
#include "ns3/nstime.h" |
32bd402ea5ea
remove unused files, remove notion of PHY, make more realistic p2p-net-device and p2p-channel
Craig Dowell
parents:
369
diff
changeset
|
32 |
#include "ns3/data-rate.h" |
926
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
33 |
#include "ns3/default-value.h" |
543 | 34 |
#include "ns3/ptr.h" |
245
28ba3a5cdff8
add p2p netdevice and channel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
35 |
|
28ba3a5cdff8
add p2p netdevice and channel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
36 |
namespace ns3 { |
28ba3a5cdff8
add p2p netdevice and channel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
37 |
|
402
f47285751901
add NetDevice::GetChannel method and doxygen-document it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
379
diff
changeset
|
38 |
class Queue; |
369
29ea5d1a83c8
Rename classes from Serial to PointToPoint
Tom Henderson <tomh@tomh.org>
parents:
368
diff
changeset
|
39 |
class PointToPointChannel; |
245
28ba3a5cdff8
add p2p netdevice and channel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
40 |
|
1403
0286b806eee1
add doxygen for each TraceSourceElement subclass
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1401
diff
changeset
|
41 |
/** |
0286b806eee1
add doxygen for each TraceSourceElement subclass
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1401
diff
changeset
|
42 |
* \brief hold in a TraceContext the type of trace source from a PointToPointNetDevice |
0286b806eee1
add doxygen for each TraceSourceElement subclass
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1401
diff
changeset
|
43 |
*/ |
1229
e4cfe4094c10
build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1167
diff
changeset
|
44 |
class PointToPointTraceType : public TraceContextElement |
e4cfe4094c10
build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1167
diff
changeset
|
45 |
{ |
e4cfe4094c10
build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1167
diff
changeset
|
46 |
public: |
e4cfe4094c10
build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1167
diff
changeset
|
47 |
PointToPointTraceType (); |
e4cfe4094c10
build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1167
diff
changeset
|
48 |
void Print (std::ostream &os) const; |
e4cfe4094c10
build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1167
diff
changeset
|
49 |
static uint16_t GetUid (void); |
1401
96a21130865c
GetName -> GetTypeName
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1383
diff
changeset
|
50 |
std::string GetTypeName (void) const; |
1229
e4cfe4094c10
build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1167
diff
changeset
|
51 |
}; |
e4cfe4094c10
build with the new TraceContextElement API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1167
diff
changeset
|
52 |
|
409
1cbb9ed862d0
add empty template for doxygen doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
402
diff
changeset
|
53 |
/** |
414 | 54 |
* \class PointToPointNetDevice |
55 |
* \brief A Device for a Point to Point Network Link. |
|
56 |
* |
|
57 |
* Ns-3 takes a four-layer view of a protocol stack. This is the same model |
|
58 |
* that TCP uses. In this view, layers 5-7 of the OSI reference model are |
|
59 |
* grouped together into an application layer; layer four (transport / TCP) is |
|
60 |
* broken out; layer three (network / IP) is broken out; and layers 1-2 are |
|
61 |
* grouped together. We call this grouping of layers one and two a NetDevice |
|
62 |
* and represent it as a class in the system. |
|
409
1cbb9ed862d0
add empty template for doxygen doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
402
diff
changeset
|
63 |
* |
414 | 64 |
* The NetDevice class is specialized according to the needs of the specific |
65 |
* kind of network link. In this case, the link is a PointToPoint link. The |
|
66 |
* PointToPoint link is a family of classes that includes this class, the |
|
67 |
* PointToPointNetDevice, a PointToPointChannel class that represents the |
|
68 |
* actual medium across which bits are sent, a PointToPointIpv4Interface class |
|
69 |
* that provides the hook to tie a general purpose node to this specific |
|
70 |
* link, and finally, a PointToPointTopology object that is responsible for |
|
71 |
* putting all of the pieces together. |
|
72 |
* |
|
73 |
* This is the PointToPointNetDevice class that represents, essentially, the |
|
74 |
* PC card that is used to connect to the PointToPoint network. |
|
409
1cbb9ed862d0
add empty template for doxygen doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
402
diff
changeset
|
75 |
*/ |
369
29ea5d1a83c8
Rename classes from Serial to PointToPoint
Tom Henderson <tomh@tomh.org>
parents:
368
diff
changeset
|
76 |
class PointToPointNetDevice : public NetDevice { |
245
28ba3a5cdff8
add p2p netdevice and channel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
77 |
public: |
414 | 78 |
/** |
79 |
* Construct a PointToPointNetDevice |
|
80 |
* |
|
81 |
* This is the constructor for the PointToPointNetDevice. It takes as a |
|
728
95c426b1cb60
rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
607
diff
changeset
|
82 |
* parameter the Node to which this device is connected. Ownership of the |
95c426b1cb60
rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
607
diff
changeset
|
83 |
* Node pointer is not implied and the node must not be deleded. |
414 | 84 |
* |
85 |
* @see PointToPointTopology::AddPointToPointLink () |
|
728
95c426b1cb60
rename INode to Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
607
diff
changeset
|
86 |
* @param node the Node to which this device is connected. |
414 | 87 |
*/ |
926
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
88 |
PointToPointNetDevice (Ptr<Node> node, |
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
89 |
const DataRate& = g_defaultRate.GetValue()); |
414 | 90 |
/** |
91 |
* Destroy a PointToPointNetDevice |
|
92 |
* |
|
93 |
* This is the destructor for the PointToPointNetDevice. |
|
94 |
*/ |
|
369
29ea5d1a83c8
Rename classes from Serial to PointToPoint
Tom Henderson <tomh@tomh.org>
parents:
368
diff
changeset
|
95 |
virtual ~PointToPointNetDevice(); |
414 | 96 |
/** |
97 |
* Set the Data Rate used for transmission of packets. The data rate is |
|
98 |
* set in the Attach () method from the corresponding field in the channel |
|
99 |
* to which the device is attached. It can be overridden using this method. |
|
100 |
* |
|
101 |
* @see Attach () |
|
102 |
* @param bps the data rate at which this object operates |
|
409
1cbb9ed862d0
add empty template for doxygen doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
402
diff
changeset
|
103 |
*/ |
926
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
104 |
void SetDataRate(const DataRate& bps); |
414 | 105 |
/** |
106 |
* Set the inteframe gap used to separate packets. The interframe gap |
|
107 |
* defines the minimum space required between packets sent by this device. |
|
108 |
* It is usually set in the Attach () method based on the speed of light |
|
109 |
* delay of the channel to which the device is attached. It can be |
|
110 |
* overridden using this method if desired. |
|
111 |
* |
|
112 |
* @see Attach () |
|
113 |
* @param t the interframe gap time |
|
114 |
*/ |
|
926
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
115 |
void SetInterframeGap(const Time& t); |
414 | 116 |
/** |
117 |
* Attach the device to a channel. |
|
118 |
* |
|
119 |
* The PointToPointTopology object creates a PointToPointChannel and two |
|
120 |
* PointtoPointNetDevices. In order to introduce these components to each |
|
121 |
* other, the topology object calls Attach () on each PointToPointNetDevice. |
|
122 |
* Inside this method, the Net Device calls out to the PointToPointChannel |
|
123 |
* to introduce itself. |
|
124 |
* |
|
125 |
* @see PointToPointTopology::AddPointToPointLink () |
|
126 |
* @see SetDataRate () |
|
127 |
* @see SetInterframeGap () |
|
128 |
* @param ch a pointer to the channel to which this object is being attached. |
|
129 |
*/ |
|
568
e1660959ecbb
use Ptr<> everywhere Object or NsUnknown are used
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
543
diff
changeset
|
130 |
bool Attach(Ptr<PointToPointChannel> ch); |
414 | 131 |
/** |
132 |
* Attach a queue to the PointToPointNetDevice. |
|
133 |
* |
|
134 |
* The PointToPointNetDevice "owns" a queue. This queue is created by the |
|
135 |
* PointToPointTopology object and implements a queueing method such as |
|
136 |
* DropTail or RED. The PointToPointNetDevice assumes ownership of this |
|
137 |
* queue and must delete it when the device is destroyed. |
|
138 |
* |
|
139 |
* @see PointToPointTopology::AddPointToPointLink () |
|
140 |
* @see Queue |
|
141 |
* @see DropTailQueue |
|
142 |
* @param queue a pointer to the queue for which object is assuming |
|
143 |
* ownership. |
|
144 |
*/ |
|
581
15240a33f517
make Queue derive from Interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
568
diff
changeset
|
145 |
void AddQueue(Ptr<Queue> queue); |
414 | 146 |
/** |
147 |
* Receive a packet from a connected PointToPointChannel. |
|
148 |
* |
|
149 |
* The PointToPointNetDevice receives packets from its connected channel |
|
150 |
* and forwards them up the protocol stack. This is the public method |
|
151 |
* used by the channel to indicate that the last bit of a packet has |
|
152 |
* arrived at the device. |
|
153 |
* |
|
154 |
* @see PointToPointChannel |
|
155 |
* @param p a reference to the received packet |
|
156 |
*/ |
|
1866
e7dbcc4df546
do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1412
diff
changeset
|
157 |
void Receive (Ptr<Packet> p); |
368
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
158 |
protected: |
1341
f685d4bf320f
use the Object::GetTraceResolver tracing support rather than the old adhoc tracing code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1333
diff
changeset
|
159 |
/** |
f685d4bf320f
use the Object::GetTraceResolver tracing support rather than the old adhoc tracing code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1333
diff
changeset
|
160 |
* Create a Trace Resolver for events in the net device. |
f685d4bf320f
use the Object::GetTraceResolver tracing support rather than the old adhoc tracing code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1333
diff
changeset
|
161 |
* |
f685d4bf320f
use the Object::GetTraceResolver tracing support rather than the old adhoc tracing code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1333
diff
changeset
|
162 |
* @see class TraceResolver |
f685d4bf320f
use the Object::GetTraceResolver tracing support rather than the old adhoc tracing code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1333
diff
changeset
|
163 |
*/ |
1383 | 164 |
virtual Ptr<TraceResolver> GetTraceResolver (void) const; |
517
702e96b8960f
finish Dispose -> DoDispose rework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
465
diff
changeset
|
165 |
virtual void DoDispose (void); |
414 | 166 |
/** |
167 |
* Get a copy of the attached Queue. |
|
168 |
* |
|
169 |
* This method is provided for any derived class that may need to get |
|
170 |
* direct access to the underlying queue. |
|
171 |
* |
|
172 |
* @see PointToPointTopology |
|
173 |
* @returns a pointer to the queue. |
|
174 |
*/ |
|
581
15240a33f517
make Queue derive from Interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
568
diff
changeset
|
175 |
Ptr<Queue> GetQueue(void) const; |
414 | 176 |
/** |
177 |
* Get a copy of the attached Channel |
|
178 |
* |
|
179 |
* This method is provided for any derived class that may need to get |
|
180 |
* direct access to the connected channel |
|
181 |
* |
|
182 |
* @see PointToPointChannel |
|
183 |
* @returns a pointer to the channel |
|
184 |
*/ |
|
568
e1660959ecbb
use Ptr<> everywhere Object or NsUnknown are used
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
543
diff
changeset
|
185 |
virtual Ptr<Channel> DoGetChannel(void) const; |
926
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
186 |
/** |
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
187 |
* Set a new default data rate |
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
188 |
*/ |
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
189 |
static void SetDefaultRate(const DataRate&); |
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
190 |
|
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
191 |
/** |
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
192 |
* Get the current default rate. |
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
193 |
* @returns a const reference to current default |
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
194 |
*/ |
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
195 |
|
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
196 |
static const DataRate& GetDefaultRate(); |
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
197 |
|
368
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
198 |
private: |
975
98233c6c9c2e
Move LLC encapsulation from NetDevice to subclasses.
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
973
diff
changeset
|
199 |
/** |
98233c6c9c2e
Move LLC encapsulation from NetDevice to subclasses.
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
973
diff
changeset
|
200 |
* Adds the necessary headers and trailers to a packet of data in order to |
98233c6c9c2e
Move LLC encapsulation from NetDevice to subclasses.
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
973
diff
changeset
|
201 |
* respect the protocol implemented by the agent. |
98233c6c9c2e
Move LLC encapsulation from NetDevice to subclasses.
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
973
diff
changeset
|
202 |
*/ |
1866
e7dbcc4df546
do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1412
diff
changeset
|
203 |
void 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
|
204 |
/** |
98233c6c9c2e
Move LLC encapsulation from NetDevice to subclasses.
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
973
diff
changeset
|
205 |
* Removes, from a packet of data, all headers and trailers that |
98233c6c9c2e
Move LLC encapsulation from NetDevice to subclasses.
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
973
diff
changeset
|
206 |
* relate to the protocol implemented by the agent |
98233c6c9c2e
Move LLC encapsulation from NetDevice to subclasses.
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
973
diff
changeset
|
207 |
* \return Returns true if the packet should be forwarded up the |
98233c6c9c2e
Move LLC encapsulation from NetDevice to subclasses.
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
973
diff
changeset
|
208 |
* protocol stack. |
98233c6c9c2e
Move LLC encapsulation from NetDevice to subclasses.
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
973
diff
changeset
|
209 |
*/ |
1866
e7dbcc4df546
do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1412
diff
changeset
|
210 |
bool ProcessHeader(Ptr<Packet> p, uint16_t& param); |
414 | 211 |
/** |
212 |
* Send a Packet Down the Wire. |
|
213 |
* |
|
214 |
* The SendTo method is defined as the standard way that the level three |
|
215 |
* protocol uses to tell a NetDevice to send a packet. SendTo is declared |
|
216 |
* as abstract in the NetDevice class and we declare it here. |
|
217 |
* |
|
218 |
* @see NetDevice |
|
219 |
* @param p a reference to the packet to send |
|
1167 | 220 |
* @param dest a reference to the Address of the destination device |
975
98233c6c9c2e
Move LLC encapsulation from NetDevice to subclasses.
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
973
diff
changeset
|
221 |
* @param protocolNumber Protocol Number used to find protocol touse |
414 | 222 |
* @returns true if success, false on failure |
223 |
*/ |
|
1866
e7dbcc4df546
do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1412
diff
changeset
|
224 |
virtual bool SendTo (Ptr<Packet> p, const Address& dest, |
975
98233c6c9c2e
Move LLC encapsulation from NetDevice to subclasses.
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
973
diff
changeset
|
225 |
uint16_t protocolNumber); |
414 | 226 |
/** |
227 |
* Start Sending a Packet Down the Wire. |
|
228 |
* |
|
229 |
* The TransmitStart method is the method that is used internally in the |
|
230 |
* PointToPointNetDevice to begin the process of sending a packet out on |
|
231 |
* the channel. The corresponding method is called on the channel to let |
|
232 |
* it know that the physical device this class represents has virually |
|
233 |
* started sending signals. An event is scheduled for the time at which |
|
234 |
* the bits have been completely transmitted. |
|
235 |
* |
|
236 |
* @see PointToPointChannel::TransmitStart () |
|
237 |
* @see TransmitCompleteEvent () |
|
238 |
* @param p a reference to the packet to send |
|
239 |
* @returns true if success, false on failure |
|
240 |
*/ |
|
1866
e7dbcc4df546
do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1412
diff
changeset
|
241 |
bool TransmitStart (Ptr<Packet> p); |
414 | 242 |
/** |
243 |
* Stop Sending a Packet Down the Wire and Begin the Interframe Gap. |
|
244 |
* |
|
926
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
245 |
* The TransmitComplete method is used internally to finish the process |
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
246 |
* of sending a packet out on the channel. |
414 | 247 |
* |
248 |
*/ |
|
926
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
249 |
void TransmitComplete(void); |
445
10cd9049a0ad
add NetDevice::NeedsArp method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
419
diff
changeset
|
250 |
virtual bool DoNeedsArp (void) const; |
414 | 251 |
/** |
252 |
* Enumeration of the states of the transmit machine of the net device. |
|
253 |
*/ |
|
378
32bd402ea5ea
remove unused files, remove notion of PHY, make more realistic p2p-net-device and p2p-channel
Craig Dowell
parents:
369
diff
changeset
|
254 |
enum TxMachineState |
32bd402ea5ea
remove unused files, remove notion of PHY, make more realistic p2p-net-device and p2p-channel
Craig Dowell
parents:
369
diff
changeset
|
255 |
{ |
414 | 256 |
READY, /**< The transmitter is ready to begin transmission of a packet */ |
926
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
257 |
BUSY /**< The transmitter is busy transmitting a packet */ |
378
32bd402ea5ea
remove unused files, remove notion of PHY, make more realistic p2p-net-device and p2p-channel
Craig Dowell
parents:
369
diff
changeset
|
258 |
}; |
414 | 259 |
/** |
260 |
* The state of the Net Device transmit state machine. |
|
261 |
* @see TxMachineState |
|
262 |
*/ |
|
378
32bd402ea5ea
remove unused files, remove notion of PHY, make more realistic p2p-net-device and p2p-channel
Craig Dowell
parents:
369
diff
changeset
|
263 |
TxMachineState m_txMachineState; |
414 | 264 |
/** |
265 |
* The data rate that the Net Device uses to simulate packet transmission |
|
266 |
* timing. |
|
267 |
* @see class DataRate |
|
268 |
*/ |
|
378
32bd402ea5ea
remove unused files, remove notion of PHY, make more realistic p2p-net-device and p2p-channel
Craig Dowell
parents:
369
diff
changeset
|
269 |
DataRate m_bps; |
414 | 270 |
/** |
271 |
* The interframe gap that the Net Device uses to throttle packet |
|
272 |
* transmission |
|
273 |
* @see class Time |
|
274 |
*/ |
|
378
32bd402ea5ea
remove unused files, remove notion of PHY, make more realistic p2p-net-device and p2p-channel
Craig Dowell
parents:
369
diff
changeset
|
275 |
Time m_tInterframeGap; |
414 | 276 |
/** |
277 |
* The PointToPointChannel to which this PointToPointNetDevice has been |
|
278 |
* attached. |
|
279 |
* @see class PointToPointChannel |
|
280 |
*/ |
|
568
e1660959ecbb
use Ptr<> everywhere Object or NsUnknown are used
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
543
diff
changeset
|
281 |
Ptr<PointToPointChannel> m_channel; |
414 | 282 |
/** |
283 |
* The Queue which this PointToPointNetDevice uses as a packet source. |
|
284 |
* Management of this Queue has been delegated to the PointToPointNetDevice |
|
285 |
* and it has the responsibility for deletion. |
|
286 |
* @see class Queue |
|
287 |
* @see class DropTailQueue |
|
288 |
*/ |
|
581
15240a33f517
make Queue derive from Interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
568
diff
changeset
|
289 |
Ptr<Queue> m_queue; |
414 | 290 |
/** |
291 |
* The trace source for the packet reception events that the device can |
|
292 |
* fire. |
|
293 |
* |
|
294 |
* @see class CallBackTraceSource |
|
295 |
* @see class TraceResolver |
|
296 |
*/ |
|
1866
e7dbcc4df546
do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1412
diff
changeset
|
297 |
CallbackTraceSource<Ptr<const Packet> > m_rxTrace; |
926
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
298 |
/** |
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
299 |
* Default data rate. Used for all newly created p2p net devices |
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
300 |
*/ |
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
301 |
static DataRateDefaultValue g_defaultRate; |
1fdec986d774
Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents:
773
diff
changeset
|
302 |
|
245
28ba3a5cdff8
add p2p netdevice and channel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
303 |
}; |
28ba3a5cdff8
add p2p netdevice and channel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
304 |
|
368
1df1165d6a68
Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents:
345
diff
changeset
|
305 |
}; // namespace ns3 |
245
28ba3a5cdff8
add p2p netdevice and channel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
306 |
|
369
29ea5d1a83c8
Rename classes from Serial to PointToPoint
Tom Henderson <tomh@tomh.org>
parents:
368
diff
changeset
|
307 |
#endif // POINT_TO_POINT_NET_DEVICE_H |
245
28ba3a5cdff8
add p2p netdevice and channel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
308 |