author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Wed, 01 Aug 2007 10:29:22 +0200 | |
changeset 1192 | 4926d1f8b5d8 |
parent 1186 | 909e9eb2124e |
child 1229 | e4cfe4094c10 |
child 1266 | 6b27f6b349ba |
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 |
|
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
22 |
#ifndef CSMA_CD_NET_DEVICE_H |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
23 |
#define CSMA_CD_NET_DEVICE_H |
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" |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
32 |
#include "ns3/callback-trace-source.h" |
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" |
1167 | 37 |
#include "ns3/eui48-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; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
42 |
class CsmaCdChannel; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
43 |
|
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
44 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
45 |
* \class CsmaCdNetDevice |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
46 |
* \brief A Device for a CsmaCd Network Link. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
47 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
48 |
* The Csma/Cd net device class is analogous to layer 1 and 2 of the |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
49 |
* TCP stack. The NetDevice takes a raw packet of bytes and creates a |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
50 |
* protocol specific packet from them. The Csma/Cd net device class |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
51 |
* 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
|
52 |
* 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
|
53 |
* 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
|
54 |
* 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
|
55 |
* removes LLC snap headers. The raw packet type does not add or |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
56 |
* remove any headers. Each Csma/Cd net device will receive all |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
57 |
* packets written to the Csma/Cd link. The ProcessHeader function can |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
58 |
* 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
|
59 |
* 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
|
60 |
* devices |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
61 |
* |
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 |
class CsmaCdNetDevice : public NetDevice { |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
64 |
public: |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
65 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
66 |
* Enumeration of the types of traces supported in the class. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
67 |
* |
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 |
enum TraceType { |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
70 |
QUEUE, /**< Trace queue events on the attached queue */ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
71 |
RX, /**< Trace packet reception events (from the channel) */ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
72 |
DROP /**< Trace packet drop events (from the channel) */ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
73 |
}; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
74 |
|
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
75 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
76 |
* 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
|
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 |
enum CsmaCdEncapsulationMode { |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
80 |
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
|
81 |
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
|
82 |
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
|
83 |
LLC, /**< LLC packet encapsulation */ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
84 |
}; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
85 |
|
1192
4926d1f8b5d8
add an extra constructor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1186
diff
changeset
|
86 |
CsmaCdNetDevice (Ptr<Node> node); |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
87 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
88 |
* Construct a CsmaCdNetDevice |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
89 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
90 |
* This is the constructor for the CsmaCdNetDevice. It takes as a |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
91 |
* 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
|
92 |
* 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
|
93 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
94 |
* \param node the Node to which this device is connected. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
95 |
* \param addr The source MAC address of the net device. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
96 |
*/ |
1167 | 97 |
CsmaCdNetDevice (Ptr<Node> node, Eui48Address addr, CsmaCdEncapsulationMode pktType); |
98 |
CsmaCdNetDevice (Ptr<Node> node, Eui48Address addr, |
|
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
99 |
CsmaCdEncapsulationMode pktType, |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
100 |
bool sendEnable, bool receiveEnable); |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
101 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
102 |
* Destroy a CsmaCdNetDevice |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
103 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
104 |
* This is the destructor for the CsmaCdNetDevice. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
105 |
*/ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
106 |
virtual ~CsmaCdNetDevice(); |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
107 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
108 |
* 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
|
109 |
* 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
|
110 |
* 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
|
111 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
112 |
* @see Attach () |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
113 |
* \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
|
114 |
*/ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
115 |
void SetDataRate (DataRate bps); |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
116 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
117 |
* 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
|
118 |
* 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
|
119 |
* 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
|
120 |
* 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
|
121 |
* 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
|
122 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
123 |
* @see Attach () |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
124 |
* \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
|
125 |
*/ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
126 |
void SetInterframeGap (Time t); |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
127 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
128 |
* 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
|
129 |
* 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
|
130 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
131 |
* @see Attach () |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
132 |
* \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
|
133 |
* \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
|
134 |
* \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
|
135 |
* \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
|
136 |
* \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
|
137 |
*/ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
138 |
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
|
139 |
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
|
140 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
141 |
* 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
|
142 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
143 |
* The function Attach is used to add a CsmaCdNetDevice to a |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
144 |
* CsmaCdChannel. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
145 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
146 |
* @see SetDataRate () |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
147 |
* @see SetInterframeGap () |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
148 |
* \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
|
149 |
*/ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
150 |
bool Attach (Ptr<CsmaCdChannel> ch); |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
151 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
152 |
* Attach a queue to the CsmaCdNetDevice. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
153 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
154 |
* The CsmaCdNetDevice "owns" a queue. This queue is created by the |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
155 |
* CsmaCdTopology object and implements a queueing method such as |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
156 |
* DropTail or RED. The CsmaCdNetDevice assumes ownership of this |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
157 |
* 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
|
158 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
159 |
* @see CsmaCdTopology::AddCsmaCdLink () |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
160 |
* @see Queue |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
161 |
* @see DropTailQueue |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
162 |
* \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
|
163 |
* ownership. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
164 |
*/ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
165 |
void AddQueue (Ptr<Queue> queue); |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
166 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
167 |
* Receive a packet from a connected CsmaCdChannel. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
168 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
169 |
* The CsmaCdNetDevice receives packets from its connected channel |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
170 |
* 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
|
171 |
* 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
|
172 |
* arrived at the device. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
173 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
174 |
* @see CsmaCdChannel |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
175 |
* \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
|
176 |
*/ |
1186
909e9eb2124e
rework the NetDevice <-> Node interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1167
diff
changeset
|
177 |
void Receive (const Packet& p); |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
178 |
|
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
179 |
bool IsSendEnabled (void); |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
180 |
bool IsReceiveEnabled (void); |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
181 |
|
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
182 |
void SetSendEnable (bool); |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
183 |
void SetReceiveEnable (bool); |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
184 |
|
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
185 |
protected: |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
186 |
virtual bool DoNeedsArp (void) const; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
187 |
virtual void DoDispose (void); |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
188 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
189 |
* 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
|
190 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
191 |
* 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
|
192 |
* 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
|
193 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
194 |
* \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
|
195 |
*/ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
196 |
Ptr<Queue> GetQueue (void) const; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
197 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
198 |
* Get a copy of the attached Channel |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
199 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
200 |
* 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
|
201 |
* direct access to the connected channel |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
202 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
203 |
* \return a pointer to the channel |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
204 |
*/ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
205 |
virtual Ptr<Channel> DoGetChannel (void) const; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
206 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
207 |
* 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
|
208 |
* respect the packet type |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
209 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
210 |
* \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
|
211 |
* \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
|
212 |
* \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
|
213 |
* payload contained in this packet. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
214 |
*/ |
1167 | 215 |
void AddHeader (Packet& p, Eui48Address dest, |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
216 |
uint16_t protocolNumber); |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
217 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
218 |
* 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
|
219 |
* relate to the packet type |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
220 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
221 |
* \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
|
222 |
* \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
|
223 |
* 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
|
224 |
* \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
|
225 |
* protocol stack. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
226 |
*/ |
995
22821dd9152e
param is a 16 bit integer. implement proper llc encapsulation/decapsulation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
993
diff
changeset
|
227 |
bool ProcessHeader (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
|
228 |
|
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
229 |
private: |
992
37953a86a975
disable copy constructor and operator = for CsmaCdNetDevice
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
977
diff
changeset
|
230 |
// disable copy constructor and operator = |
37953a86a975
disable copy constructor and operator = for CsmaCdNetDevice
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
977
diff
changeset
|
231 |
CsmaCdNetDevice &operator = (const CsmaCdNetDevice &o); |
37953a86a975
disable copy constructor and operator = for CsmaCdNetDevice
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
977
diff
changeset
|
232 |
CsmaCdNetDevice (const CsmaCdNetDevice &o); |
977
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 |
* Initializes variablea when construction object. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
235 |
*/ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
236 |
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
|
237 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
238 |
* Send a Packet on the Csma/Cd network |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
239 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
240 |
* This method does not use a destination address since all packets |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
241 |
* are broadcast to all NetDevices attached to the channel. Packet |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
242 |
* should contain all needed headers at this time. |
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 |
* If the device is ready to transmit, the next packet is read off |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
245 |
* of the queue and stored locally until it has been transmitted. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
246 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
247 |
* \param p a reference to the packet to send |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
248 |
* \param dest destination address |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
249 |
* \param protocolNumber -- this parameter is not used here |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
250 |
* \return true if success, false on failure |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
251 |
*/ |
1167 | 252 |
virtual bool SendTo (Packet& p, const Address& dest, uint16_t protocolNumber); |
977
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
253 |
|
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 |
* 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
|
256 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
257 |
* The TransmitStart method is the method that is used internally in |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
258 |
* the CsmaCdNetDevice to begin the process of sending a packet |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
259 |
* 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
|
260 |
* 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
|
261 |
* 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
|
262 |
* 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
|
263 |
* 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
|
264 |
* 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
|
265 |
* the backoff period) |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
266 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
267 |
* @see CsmaCdChannel::TransmitStart () |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
268 |
* @see TransmitCompleteEvent () |
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 TransmitStart (); |
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 |
* 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
|
273 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
274 |
* 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
|
275 |
* 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
|
276 |
* 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
|
277 |
* 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
|
278 |
* 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
|
279 |
* 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
|
280 |
* 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
|
281 |
* 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
|
282 |
* 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
|
283 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
284 |
* @see CsmaCdChannel::TransmitEnd () |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
285 |
* @see TransmitReadyEvent () |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
286 |
*/ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
287 |
void TransmitCompleteEvent (void); |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
288 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
289 |
* 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
|
290 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
291 |
* 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
|
292 |
* 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
|
293 |
* 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
|
294 |
* 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
|
295 |
* 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
|
296 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
297 |
* 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
|
298 |
* 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
|
299 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
300 |
* @see TransmitStart () |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
301 |
*/ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
302 |
void TransmitReadyEvent (void); |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
303 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
304 |
* Create a Trace Resolver for events in the net device. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
305 |
* (NOT TESTED) |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
306 |
* @see class TraceResolver |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
307 |
*/ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
308 |
virtual TraceResolver *DoCreateTraceResolver (TraceContext const &context); |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
309 |
|
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
310 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
311 |
* 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
|
312 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
313 |
* 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
|
314 |
* 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
|
315 |
* then the packet is dropped. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
316 |
* |
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 |
void TransmitAbort (void); |
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 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
321 |
* 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
|
322 |
* 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
|
323 |
* 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
|
324 |
*/ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
325 |
uint32_t m_deviceId; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
326 |
|
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
327 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
328 |
* 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
|
329 |
*/ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
330 |
bool m_sendEnable; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
331 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
332 |
* 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
|
333 |
*/ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
334 |
bool m_receiveEnable; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
335 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
336 |
* 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
|
337 |
*/ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
338 |
enum TxMachineState |
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 |
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
|
341 |
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
|
342 |
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
|
343 |
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
|
344 |
}; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
345 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
346 |
* 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
|
347 |
* @see TxMachineState |
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 |
TxMachineState m_txMachineState; |
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 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
352 |
* 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
|
353 |
* 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
|
354 |
* function. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
355 |
*/ |
993
9f9d5048b710
pktType -> encapMode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
992
diff
changeset
|
356 |
CsmaCdEncapsulationMode m_encapMode; |
977
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 |
* 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
|
359 |
* timing. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
360 |
* @see class DataRate |
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 |
DataRate m_bps; |
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 |
* 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
|
365 |
* transmission |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
366 |
* @see class Time |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
367 |
*/ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
368 |
Time m_tInterframeGap; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
369 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
370 |
* 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
|
371 |
* 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
|
372 |
* is ready to transmit |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
373 |
*/ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
374 |
Backoff m_backoff; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
375 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
376 |
* 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
|
377 |
* 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
|
378 |
* transmitted. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
379 |
*/ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
380 |
Packet m_currentPkt; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
381 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
382 |
* The CsmaCdChannel to which this CsmaCdNetDevice has been |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
383 |
* attached. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
384 |
* @see class CsmaCdChannel |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
385 |
*/ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
386 |
Ptr<CsmaCdChannel> m_channel; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
387 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
388 |
* The Queue which this CsmaCdNetDevice uses as a packet source. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
389 |
* Management of this Queue has been delegated to the CsmaCdNetDevice |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
390 |
* 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
|
391 |
* @see class Queue |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
392 |
* @see class DropTailQueue |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
393 |
*/ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
394 |
Ptr<Queue> m_queue; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
395 |
/** |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
396 |
* NOT TESTED |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
397 |
* 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
|
398 |
* fire. |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
399 |
* |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
400 |
* @see class CallBackTraceSource |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
401 |
* @see class TraceResolver |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
402 |
*/ |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
403 |
CallbackTraceSource<Packet &> m_rxTrace; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
404 |
CallbackTraceSource<Packet &> m_dropTrace; |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
405 |
|
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 |
|
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
408 |
}; // namespace ns3 |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
409 |
|
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
410 |
#endif // CSMA_CD_NET_DEVICE_H |
09bf4e458015
a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff
changeset
|
411 |