author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Wed, 27 Feb 2008 20:23:57 +0100 | |
changeset 2500 | 1fb9430f642d |
parent 2470 | 254581fb9e9c |
child 2600 | 6c389d0c717d |
permissions | -rw-r--r-- |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
2 |
/* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
3 |
* Copyright (c) 2007 Emmanuelle Laprise |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
4 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
8 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
13 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
17 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
18 |
* Author: Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
19 |
* Derived from the p2p net device file |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
20 |
*/ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
21 |
|
1276
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
22 |
#ifndef CSMA_NET_DEVICE_H |
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
23 |
#define CSMA_NET_DEVICE_H |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
24 |
|
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
25 |
#include <string.h> |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
26 |
#include "ns3/node.h" |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
27 |
#include "ns3/backoff.h" |
1167 | 28 |
#include "ns3/address.h" |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
29 |
#include "ns3/net-device.h" |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
30 |
#include "ns3/callback.h" |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
31 |
#include "ns3/packet.h" |
2500
1fb9430f642d
convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
32 |
#include "ns3/traced-callback.h" |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
33 |
#include "ns3/nstime.h" |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
34 |
#include "ns3/data-rate.h" |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
35 |
#include "ns3/ptr.h" |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
36 |
#include "ns3/random-variable.h" |
1494
c2985e1cd091
rename Euixx to Macxx
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1451
diff
changeset
|
37 |
#include "ns3/mac48-address.h" |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
38 |
|
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
39 |
namespace ns3 { |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
40 |
|
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
41 |
class Queue; |
1276
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
42 |
class CsmaChannel; |
1820
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1494
diff
changeset
|
43 |
class ErrorModel; |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
44 |
|
1403
0286b806eee1
add doxygen for each TraceSourceElement subclass
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1401
diff
changeset
|
45 |
/** |
1276
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
46 |
* \class CsmaNetDevice |
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
47 |
* \brief A Device for a Csma Network Link. |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
48 |
* |
1276
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
49 |
* The Csma net device class is analogous to layer 1 and 2 of the |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
50 |
* TCP stack. The NetDevice takes a raw packet of bytes and creates a |
1276
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
51 |
* protocol specific packet from them. The Csma net device class |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
52 |
* takes this packet and adds and processes the headers/trailers that |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
53 |
* are associated with EthernetV1, EthernetV2, RAW or LLC |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
54 |
* protocols. The EthernetV1 packet type adds and removes Ethernet |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
55 |
* destination and source addresses. The LLC packet type adds and |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
56 |
* removes LLC snap headers. The raw packet type does not add or |
1276
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
57 |
* remove any headers. Each Csma net device will receive all |
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
58 |
* packets written to the Csma link. The ProcessHeader function can |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
59 |
* be used to filter out the packets such that higher level layers |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
60 |
* only receive packets that are addressed to their associated net |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
61 |
* devices |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
62 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
63 |
*/ |
2500
1fb9430f642d
convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
64 |
class CsmaNetDevice : public NetDevice |
1fb9430f642d
convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
65 |
{ |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
66 |
public: |
2500
1fb9430f642d
convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
67 |
static TypeId GetTypeId (void); |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
68 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
69 |
* Enumeration of the types of packets supported in the class. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
70 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
71 |
*/ |
1276
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
72 |
enum CsmaEncapsulationMode { |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
73 |
ETHERNET_V1, /**< Version one ethernet packet, length field */ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
74 |
IP_ARP, /**< Ethernet packet encapsulates IP/ARP packet */ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
75 |
RAW, /**< Packet that contains no headers */ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
76 |
LLC, /**< LLC packet encapsulation */ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
77 |
}; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
78 |
|
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
79 |
/** |
1276
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
80 |
* Construct a CsmaNetDevice |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
81 |
* |
1276
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
82 |
* This is the constructor for the CsmaNetDevice. It takes as a |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
83 |
* parameter the Node to which this device is connected. Ownership of the |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
84 |
* Node pointer is not implied and the node must not be deleted. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
85 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
86 |
*/ |
2500
1fb9430f642d
convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
87 |
CsmaNetDevice (); |
1280 | 88 |
|
89 |
/** |
|
1276
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
90 |
* Destroy a CsmaNetDevice |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
91 |
* |
1276
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
92 |
* This is the destructor for the CsmaNetDevice. |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
93 |
*/ |
1276
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
94 |
virtual ~CsmaNetDevice(); |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
95 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
96 |
* Set the Data Rate used for transmission of packets. The data rate is |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
97 |
* set in the Attach () method from the corresponding field in the channel |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
98 |
* to which the device is attached. It can be overridden using this method. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
99 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
100 |
* @see Attach () |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
101 |
* \param bps the data rate at which this object operates |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
102 |
*/ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
103 |
void SetDataRate (DataRate bps); |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
104 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
105 |
* Set the inteframe gap used to separate packets. The interframe gap |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
106 |
* defines the minimum space required between packets sent by this device. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
107 |
* It is usually set in the Attach () method based on the speed of light |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
108 |
* delay of the channel to which the device is attached. It can be |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
109 |
* overridden using this method if desired. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
110 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
111 |
* @see Attach () |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
112 |
* \param t the interframe gap time |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
113 |
*/ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
114 |
void SetInterframeGap (Time t); |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
115 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
116 |
* Set the backoff parameters used to determine the wait to retry |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
117 |
* transmitting a packet when the channel is busy. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
118 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
119 |
* @see Attach () |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
120 |
* \param slotTime Length of a packet slot (or average packet time) |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
121 |
* \param minSlots Minimum number of slots to wait |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
122 |
* \param maxSlots Maximum number of slots to wait |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
123 |
* \param maxRetries Maximum number of retries before packet is discard |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
124 |
* \param ceiling Cap on the exponential function when calculating max slots |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
125 |
*/ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
126 |
void SetBackoffParams (Time slotTime, uint32_t minSlots, uint32_t maxSlots, |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
127 |
uint32_t maxRetries, uint32_t ceiling); |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
128 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
129 |
* Attach the device to a channel. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
130 |
* |
1276
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
131 |
* The function Attach is used to add a CsmaNetDevice to a |
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
132 |
* CsmaChannel. |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
133 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
134 |
* @see SetDataRate () |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
135 |
* @see SetInterframeGap () |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
136 |
* \param ch a pointer to the channel to which this object is being attached. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
137 |
*/ |
1276
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
138 |
bool Attach (Ptr<CsmaChannel> ch); |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
139 |
/** |
1276
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
140 |
* Attach a queue to the CsmaNetDevice. |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
141 |
* |
1276
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
142 |
* The CsmaNetDevice "owns" a queue. This queue is created by the |
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
143 |
* CsmaTopology object and implements a queueing method such as |
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
144 |
* DropTail or RED. The CsmaNetDevice assumes ownership of this |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
145 |
* queue and must delete it when the device is destroyed. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
146 |
* |
1276
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
147 |
* @see CsmaTopology::AddCsmaLink () |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
148 |
* @see Queue |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
149 |
* @see DropTailQueue |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
150 |
* \param queue a pointer to the queue for which object is assuming |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
151 |
* ownership. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
152 |
*/ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
153 |
void AddQueue (Ptr<Queue> queue); |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
154 |
/** |
1820
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1494
diff
changeset
|
155 |
* Attach a receive ErrorModel to the CsmaNetDevice. |
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1494
diff
changeset
|
156 |
* |
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1494
diff
changeset
|
157 |
* The CsmaNetDevice may optionally include an ErrorModel in |
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1494
diff
changeset
|
158 |
* the packet receive chain. |
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1494
diff
changeset
|
159 |
* |
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1494
diff
changeset
|
160 |
* @see ErrorModel |
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1494
diff
changeset
|
161 |
* @param em a pointer to the ErrorModel |
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1494
diff
changeset
|
162 |
*/ |
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1494
diff
changeset
|
163 |
void AddReceiveErrorModel(Ptr<ErrorModel> em); |
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1494
diff
changeset
|
164 |
/** |
1276
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
165 |
* Receive a packet from a connected CsmaChannel. |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
166 |
* |
1276
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
167 |
* The CsmaNetDevice receives packets from its connected channel |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
168 |
* and forwards them up the protocol stack. This is the public method |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
169 |
* used by the channel to indicate that the last bit of a packet has |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
170 |
* arrived at the device. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
171 |
* |
1276
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
172 |
* @see CsmaChannel |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
173 |
* \param p a reference to the received packet |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
174 |
*/ |
1866
e7dbcc4df546
do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1494
diff
changeset
|
175 |
void Receive (Ptr<Packet> p); |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
176 |
|
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1870
diff
changeset
|
177 |
bool IsSendEnabled (void); |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1870
diff
changeset
|
178 |
bool IsReceiveEnabled (void); |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1870
diff
changeset
|
179 |
|
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1870
diff
changeset
|
180 |
void SetSendEnable (bool); |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1870
diff
changeset
|
181 |
void SetReceiveEnable (bool); |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1870
diff
changeset
|
182 |
|
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1870
diff
changeset
|
183 |
|
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1870
diff
changeset
|
184 |
// inherited from NetDevice base class. |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1870
diff
changeset
|
185 |
virtual void SetName(const std::string name); |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1870
diff
changeset
|
186 |
virtual std::string GetName(void) const; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1870
diff
changeset
|
187 |
virtual void SetIfIndex(const uint32_t index); |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1870
diff
changeset
|
188 |
virtual uint32_t GetIfIndex(void) const; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1870
diff
changeset
|
189 |
virtual Ptr<Channel> GetChannel (void) const; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1870
diff
changeset
|
190 |
virtual Address GetAddress (void) const; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1870
diff
changeset
|
191 |
virtual bool SetMtu (const uint16_t mtu); |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1870
diff
changeset
|
192 |
virtual uint16_t GetMtu (void) const; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1870
diff
changeset
|
193 |
virtual bool IsLinkUp (void) const; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1870
diff
changeset
|
194 |
virtual void SetLinkChangeCallback (Callback<void> callback); |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1870
diff
changeset
|
195 |
virtual bool IsBroadcast (void) const; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1870
diff
changeset
|
196 |
virtual Address GetBroadcast (void) const; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1870
diff
changeset
|
197 |
virtual bool IsMulticast (void) const; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1870
diff
changeset
|
198 |
virtual Address GetMulticast (void) const; |
1443
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1280
diff
changeset
|
199 |
/** |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1280
diff
changeset
|
200 |
* @brief Make and return a MAC multicast address using the provided |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1280
diff
changeset
|
201 |
* multicast group |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1280
diff
changeset
|
202 |
* |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1280
diff
changeset
|
203 |
* RFC 1112 says that an Ipv4 host group address is mapped to an Ethernet |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1280
diff
changeset
|
204 |
* multicast address by placing the low-order 23-bits of the IP address into |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1280
diff
changeset
|
205 |
* the low-order 23 bits of the Ethernet multicast address |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1280
diff
changeset
|
206 |
* 01-00-5E-00-00-00 (hex). |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1280
diff
changeset
|
207 |
* |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1280
diff
changeset
|
208 |
* This method performs the multicast address creation function appropriate |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1280
diff
changeset
|
209 |
* to an EUI-48-based CSMA device. This MAC address is encapsulated in an |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1280
diff
changeset
|
210 |
* abstract Address to avoid dependencies on the exact address format. |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1280
diff
changeset
|
211 |
* |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1280
diff
changeset
|
212 |
* @param multicastGroup The IP address for the multicast group destination |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1280
diff
changeset
|
213 |
* of the packet. |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1280
diff
changeset
|
214 |
* @return The MAC multicast Address used to send packets to the provided |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1280
diff
changeset
|
215 |
* multicast group. |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1280
diff
changeset
|
216 |
* |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1280
diff
changeset
|
217 |
* @see Ipv4Address |
1494
c2985e1cd091
rename Euixx to Macxx
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1451
diff
changeset
|
218 |
* @see Mac48Address |
1443
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1280
diff
changeset
|
219 |
* @see Address |
580ed7a4dd1e
Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents:
1280
diff
changeset
|
220 |
*/ |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1870
diff
changeset
|
221 |
virtual Address MakeMulticastAddress (Ipv4Address multicastGroup) const; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1870
diff
changeset
|
222 |
virtual bool IsPointToPoint (void) const; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1870
diff
changeset
|
223 |
virtual bool Send(Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber); |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1870
diff
changeset
|
224 |
virtual Ptr<Node> GetNode (void) const; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1870
diff
changeset
|
225 |
virtual bool NeedsArp (void) const; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1870
diff
changeset
|
226 |
virtual void SetReceiveCallback (NetDevice::ReceiveCallback cb); |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
227 |
|
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
228 |
protected: |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
229 |
virtual void DoDispose (void); |
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
|
230 |
|
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
|
231 |
/** |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
232 |
* Get a copy of the attached Queue. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
233 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
234 |
* This method is provided for any derived class that may need to get |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
235 |
* direct access to the underlying queue. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
236 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
237 |
* \return a pointer to the queue. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
238 |
*/ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
239 |
Ptr<Queue> GetQueue (void) const; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
240 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
241 |
* Adds the necessary headers and trailers to a packet of data in order to |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
242 |
* respect the packet type |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
243 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
244 |
* \param p Packet to which header should be added |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
245 |
* \param dest MAC destination address to which packet should be sent |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
246 |
* \param protocolNumber In some protocols, identifies the type of |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
247 |
* payload contained in this packet. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
248 |
*/ |
1866
e7dbcc4df546
do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1494
diff
changeset
|
249 |
void AddHeader (Ptr<Packet> p, Mac48Address dest, |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
250 |
uint16_t protocolNumber); |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
251 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
252 |
* Removes, from a packet of data, all headers and trailers that |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
253 |
* relate to the packet type |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
254 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
255 |
* \param p Packet whose headers need to be processed |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
256 |
* \param param An integer parameter that can be set by the function |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
257 |
* to return information gathered in the header |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
258 |
* \return Returns true if the packet should be forwarded up the |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
259 |
* protocol stack. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
260 |
*/ |
1866
e7dbcc4df546
do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1494
diff
changeset
|
261 |
bool ProcessHeader (Ptr<Packet> p, uint16_t & param); |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
262 |
|
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
263 |
private: |
992
37953a86a975
disable copy constructor and operator = for CsmaCdNetDevice
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
977
diff
changeset
|
264 |
// disable copy constructor and operator = |
1276
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
265 |
CsmaNetDevice &operator = (const CsmaNetDevice &o); |
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
266 |
CsmaNetDevice (const CsmaNetDevice &o); |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
267 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
268 |
* Initializes variablea when construction object. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
269 |
*/ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
270 |
void Init (bool sendEnable, bool receiveEnable); |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
271 |
|
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
272 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
273 |
* Start Sending a Packet Down the Wire. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
274 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
275 |
* The TransmitStart method is the method that is used internally in |
1276
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
276 |
* the CsmaNetDevice to begin the process of sending a packet |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
277 |
* out on the channel. The corresponding method is called on the |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
278 |
* channel to let it know that the physical device this class |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
279 |
* represents has virually started sending signals, this causes the |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
280 |
* channel to become busy. An event is scheduled for the time at |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
281 |
* which the bits have been completely transmitted. If the channel |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
282 |
* is busy, the method reschedules itself for a later time (within |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
283 |
* the backoff period) |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
284 |
* |
1276
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
285 |
* @see CsmaChannel::TransmitStart () |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
286 |
* @see TransmitCompleteEvent () |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
287 |
*/ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
288 |
void TransmitStart (); |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
289 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
290 |
* Stop Sending a Packet Down the Wire and Begin the Interframe Gap. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
291 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
292 |
* The TransmitCompleteEvent method is used internally to finish the process |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
293 |
* of sending a packet out on the channel. During execution of this method |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
294 |
* the TransmitEnd method is called on the channel to let it know that the |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
295 |
* physical device this class represents has virually finished sending |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
296 |
* signals. The channel uses this event to begin its speed of light delay |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
297 |
* timer after which it notifies the Net Device at the other end of the |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
298 |
* link that the bits have arrived. During this method, the net device |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
299 |
* also schedules the TransmitReadyEvent at which time the transmitter |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
300 |
* becomes ready to send the next packet. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
301 |
* |
1276
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
302 |
* @see CsmaChannel::TransmitEnd () |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
303 |
* @see TransmitReadyEvent () |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
304 |
*/ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
305 |
void TransmitCompleteEvent (void); |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
306 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
307 |
* Cause the Transmitter to Become Ready to Send Another Packet. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
308 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
309 |
* The TransmitReadyEvent method is used internally to re-enable the |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
310 |
* transmit machine of the net device. It is scheduled after a suitable |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
311 |
* interframe gap after the completion of the previous transmission. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
312 |
* The queue is checked at this time, and if there is a packet waiting on |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
313 |
* the queue, the transmission process is begun. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
314 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
315 |
* If a packet is in the queue, it is extracted for the queue as the |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
316 |
* next packet to be transmitted by the net device. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
317 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
318 |
* @see TransmitStart () |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
319 |
*/ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
320 |
void TransmitReadyEvent (void); |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
321 |
|
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
322 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
323 |
* Aborts the transmission of the current packet |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
324 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
325 |
* If the net device has tried to transmit a packet for more times |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
326 |
* than the maximum allowed number of retries (channel always busy) |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
327 |
* then the packet is dropped. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
328 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
329 |
*/ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
330 |
void TransmitAbort (void); |
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1870
diff
changeset
|
331 |
void NotifyLinkUp (void); |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
332 |
|
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
333 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
334 |
* Device ID returned by the attached functions. It is used by the |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
335 |
* mp-channel to identify each net device to make sure that only |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
336 |
* active net devices are writing to the channel |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
337 |
*/ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
338 |
uint32_t m_deviceId; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
339 |
|
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
340 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
341 |
* Enable net device to send packets. True by default |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
342 |
*/ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
343 |
bool m_sendEnable; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
344 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
345 |
* Enable net device to receive packets. True by default |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
346 |
*/ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
347 |
bool m_receiveEnable; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
348 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
349 |
* Enumeration of the states of the transmit machine of the net device. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
350 |
*/ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
351 |
enum TxMachineState |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
352 |
{ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
353 |
READY, /**< The transmitter is ready to begin transmission of a packet */ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
354 |
BUSY, /**< The transmitter is busy transmitting a packet */ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
355 |
GAP, /**< The transmitter is in the interframe gap time */ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
356 |
BACKOFF /**< The transmitter is waiting for the channel to be free */ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
357 |
}; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
358 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
359 |
* The state of the Net Device transmit state machine. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
360 |
* @see TxMachineState |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
361 |
*/ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
362 |
TxMachineState m_txMachineState; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
363 |
|
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
364 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
365 |
* The type of packet that should be created by the AddHeader |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
366 |
* function and that should be processed by the ProcessHeader |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
367 |
* function. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
368 |
*/ |
1276
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
369 |
CsmaEncapsulationMode m_encapMode; |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
370 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
371 |
* The data rate that the Net Device uses to simulate packet transmission |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
372 |
* timing. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
373 |
* @see class DataRate |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
374 |
*/ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
375 |
DataRate m_bps; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
376 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
377 |
* The interframe gap that the Net Device uses to throttle packet |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
378 |
* transmission |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
379 |
* @see class Time |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
380 |
*/ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
381 |
Time m_tInterframeGap; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
382 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
383 |
* Holds the backoff parameters and is used to calculate the next |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
384 |
* backoff time to use when the channel is busy and the net device |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
385 |
* is ready to transmit |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
386 |
*/ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
387 |
Backoff m_backoff; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
388 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
389 |
* Next packet that will be transmitted (if transmitter is not |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
390 |
* currently transmitting) or packet that is currently being |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
391 |
* transmitted. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
392 |
*/ |
1866
e7dbcc4df546
do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1494
diff
changeset
|
393 |
Ptr<Packet> m_currentPkt; |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
394 |
/** |
1276
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
395 |
* The CsmaChannel to which this CsmaNetDevice has been |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
396 |
* attached. |
1276
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
397 |
* @see class CsmaChannel |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
398 |
*/ |
1276
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
399 |
Ptr<CsmaChannel> m_channel; |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
400 |
/** |
1276
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
401 |
* The Queue which this CsmaNetDevice uses as a packet source. |
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
402 |
* Management of this Queue has been delegated to the CsmaNetDevice |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
403 |
* and it has the responsibility for deletion. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
404 |
* @see class Queue |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
405 |
* @see class DropTailQueue |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
406 |
*/ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
407 |
Ptr<Queue> m_queue; |
1820
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1494
diff
changeset
|
408 |
|
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1494
diff
changeset
|
409 |
/** |
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1494
diff
changeset
|
410 |
* Error model for receive packet events |
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1494
diff
changeset
|
411 |
*/ |
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1494
diff
changeset
|
412 |
Ptr<ErrorModel> m_receiveErrorModel; |
736919bd4874
Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents:
1494
diff
changeset
|
413 |
|
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
414 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
415 |
* NOT TESTED |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
416 |
* The trace source for the packet reception events that the device can |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
417 |
* fire. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
418 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
419 |
* @see class CallBackTraceSource |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
420 |
* @see class TraceResolver |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
421 |
*/ |
2500
1fb9430f642d
convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
422 |
TracedCallback<Ptr<const Packet> > m_rxTrace; |
1fb9430f642d
convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2470
diff
changeset
|
423 |
TracedCallback<Ptr<const Packet> > m_dropTrace; |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
424 |
|
2470
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1870
diff
changeset
|
425 |
Ptr<Node> m_node; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1870
diff
changeset
|
426 |
Mac48Address m_address; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1870
diff
changeset
|
427 |
NetDevice::ReceiveCallback m_rxCallback; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1870
diff
changeset
|
428 |
uint32_t m_ifIndex; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1870
diff
changeset
|
429 |
std::string m_name; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1870
diff
changeset
|
430 |
bool m_linkUp; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1870
diff
changeset
|
431 |
Callback<void> m_linkChangeCallback; |
254581fb9e9c
make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1870
diff
changeset
|
432 |
uint16_t m_mtu; |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
433 |
}; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
434 |
|
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
435 |
}; // namespace ns3 |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
436 |
|
1276
e0b88ec7a6be
merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents:
1270
diff
changeset
|
437 |
#endif // CSMA_NET_DEVICE_H |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
438 |