src/devices/csma/csma.h
author Craig Dowell <craigdo@ee.washington.edu>
Fri, 12 Dec 2008 11:27:05 -0800
changeset 4017 4521a81f94b8
parent 4011 2fd3041c3c29
child 6234 392fc4a9d759
permissions -rw-r--r--
more documentation to address trace sources bugs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2867
d63b525e3f80 Some doxygen work
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     1
/**
d63b525e3f80 Some doxygen work
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
     2
 * \ingroup devices
3992
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
     3
 * \defgroup CsmaModel CSMA Model
3156
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
     4
 *
3992
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
     5
 * \section CsmaModelOverview CSMA Model Overview
3156
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
     6
 *
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
     7
 * The ns-3 CSMA device models a simple bus network in the spirit of Ethernet.
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
     8
 * Although it does not model any real physical network you could ever build 
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
     9
 * or buy, it does provide some very useful functionality.
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
    10
 *
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
    11
 * Typically when one thinks of a bus network Ethernet or IEEE 802.3 comes to
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
    12
 * mind.  Ethernet uses CSMA/CD (Carrier Sense Multiple Access with Collision
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
    13
 * Detection with exponentially increasing backoff to contend for the shared 
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
    14
 * transmission medium.  The ns-3 CSMA device models only a portion of this 
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
    15
 * process, using the nature of the globally available channel to provide 
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
    16
 * instantaneous (faster than light) carrier sense and priority-based 
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
    17
 * collision "avoidance."  Collisions in the sense of Ethernet never happen and
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
    18
 * so the ns-3 CSMA device does not model collision detection, nor will any
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
    19
 * transmission in progress be "jammed."
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
    20
 *
3992
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
    21
 * \section CsmaLayerModel CSMA Layer Model
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
    22
 *
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
    23
 * There are a number of conventions in use for describing layered 
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
    24
 * communications architectures in the literature and in textbooks.  The most
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
    25
 * common layering  model is the ISO seven layer reference model.  In this view
4011
2fd3041c3c29 some device trace source documentation
Craig Dowell <craigdo@ee.washington.edu>
parents: 4008
diff changeset
    26
 * the ns3::CsmaNetDevice and ns3::CsmaChannel pair occupies the lowest two 
3992
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
    27
 * layers -- at the physical (layer one), and data link (layer two) positions.
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
    28
 * Another important reference model is that specified by RFC 1122, 
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
    29
 * "Requirements for Internet Hosts -- Communication Layers."  In this view the
4008
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
    30
 * CsmaNetDevice and CsmaChannel pair occupies the lowest layer -- 
3992
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
    31
 * the link layer.  There is also a seemingly endless litany of alternative 
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
    32
 * descriptions found in textbooks and in the literature.  We adopt the naming
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
    33
 * conventions used in the IEEE 802 standards which speak of LLC, MAC, MII
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
    34
 * and PHY layering.  These acronyms are defined as:
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
    35
 *
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
    36
 * - LLC:  Logical Link Control;
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
    37
 * - MAC:  Media Access Control;
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
    38
 * - MII:  Media Independent Interface;
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
    39
 * - PHY:  Physical Layer.
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
    40
 * 
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
    41
 * In this case the LLC and MAC are sublayers of the OSI data link layer and the 
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
    42
 * MII and PHY are sublayers of the OSI physical layer.
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
    43
 *
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
    44
 * The "top" of the CSMA device defines the transition from the network layer
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
    45
 * to the data link layer.  This transition is performed by higher layers by 
4011
2fd3041c3c29 some device trace source documentation
Craig Dowell <craigdo@ee.washington.edu>
parents: 4008
diff changeset
    46
 * calling either ns3::CsmaNetDevice::Send or ns3::CsmaNetDevice::SendFrom.
3992
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
    47
 *
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
    48
 * In contrast to the IEEE 802.3 standards, there is no precisely specified
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
    49
 * PHY in the CSMA model in the sense of wire types, signals or pinouts.  The
4008
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
    50
 * "bottom" interface of the CsmaNetDevice can be thought of as as a kind
3992
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
    51
 * of Media Independent Interface (MII) as seen in the "Fast Ethernet" 
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
    52
 * (IEEE 802.3u) specifications.  This MII interface fits into a corresponding
4008
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
    53
 * media independent interface on the CsmaChannel.  You will not find the
3992
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
    54
 * equivalent of a 10BASE-T or a 1000BASE-LX PHY.
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
    55
 *
4008
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
    56
 * The CsmaNetDevice calls the CsmaChannel through a media independent
3992
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
    57
 * interface.  There is a method defined to tell the channel when to start 
4011
2fd3041c3c29 some device trace source documentation
Craig Dowell <craigdo@ee.washington.edu>
parents: 4008
diff changeset
    58
 * "wiggling the wires" using the method ns3::CsmaChannel::TransmitStart, and 
4008
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
    59
 * a method to tell the channel when the transmission process is done and
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
    60
 * the channel should begin propagating the last bit across the "wire":
4011
2fd3041c3c29 some device trace source documentation
Craig Dowell <craigdo@ee.washington.edu>
parents: 4008
diff changeset
    61
 * ns3::CsmaChannel::TransmitEnd.
3992
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
    62
 *
4008
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
    63
 * When the TransmitEnd method is executed, the channel will model a single 
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
    64
 * uniform signal propagation delay in the medium and deliver copes of the packet
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
    65
 * to each of the devices attached to the packet via the 
4011
2fd3041c3c29 some device trace source documentation
Craig Dowell <craigdo@ee.washington.edu>
parents: 4008
diff changeset
    66
 * ns3::CsmaNetDevice::Receive method.
3992
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
    67
 *
4008
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
    68
 * There is a "pin" in the device media independent interface corresponding to 
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
    69
 * "COL" (collision).  The state of the channel may be sensed by calling 
4011
2fd3041c3c29 some device trace source documentation
Craig Dowell <craigdo@ee.washington.edu>
parents: 4008
diff changeset
    70
 * ns3::CsmaChannel::GetState.  Each device will look at this "pin" before 
4008
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
    71
 * starting a send and will perform appropriate backoff operations if required.
3992
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
    72
 *
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
    73
 * Properly received packets are forwarded up to higher levels from the 
4008
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
    74
 * CsmaNetDevice via a callback mechanism.  The callback function is
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
    75
 * initialized by the higher layer (when the net device is attached) using
4011
2fd3041c3c29 some device trace source documentation
Craig Dowell <craigdo@ee.washington.edu>
parents: 4008
diff changeset
    76
 * ns3::CsmaNetDevice::SetReceiveCallback and is invoked upon "proper"
4008
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
    77
 *  reception of a packet by the net device in order to forward the packet up
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
    78
 * the protocol stack.
3992
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
    79
 *
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
    80
 * \section CsmaChannelModel CSMA Channel Model
3156
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
    81
 *
4008
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
    82
 * The class CsmaChannel models the actual transmission medium.
3156
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
    83
 * There is no fixed limit for the number of devices connected to the channel.
4008
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
    84
 * The CsmaChannel models a data rate and a speed-of-light delay which can
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3156
diff changeset
    85
 * be accessed via the attributes "DataRate" and "Delay" respectively.
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3156
diff changeset
    86
 * The data rate provided to the channel is used to set the data rates
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3156
diff changeset
    87
 * used by the transmitter sections of the CSMA devices connected to the 
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3156
diff changeset
    88
 * channel.  There is no way to independently set data rates in the
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3156
diff changeset
    89
 * devices.  Since the data rate is only used to calculate a delay time, there
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3156
diff changeset
    90
 * is no limitation (other than by the data type holding the value) on the 
3992
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
    91
 * speed at which CSMA channels and devices can operate; and no restriction
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
    92
 * based on any kind of PHY characteristics.
2867
d63b525e3f80 Some doxygen work
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
    93
 *
4008
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
    94
 * The CsmaChannel has three states, IDLE, TRANSMITTING and PROPAGATING.
3156
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
    95
 * These three states are "seen" instantaneously by all devices on the channel.
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
    96
 * By this we mean that if one device begins or ends a simulated transmission,
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
    97
 * all devices on the channel are immediately aware of the change in state.
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
    98
 * There is no time during which one device may see an IDLE channel while
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
    99
 * another device physically further away in the collision domain may have 
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   100
 * begun transmitting with the associated signals not propagated.  Thus there
4008
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
   101
 * is no need for collision detection in the CsmaChannel model and it is
3156
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   102
 * not implemented in any way.
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   103
 *
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   104
 * We do, as the name indicates, have a Carrier Sense aspect to the model.
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   105
 * Since the simulator is single threaded, access to the common channel will
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   106
 * be serialized by the simulator.  This provides a deterministic mechanism
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   107
 * for contending for the channel.  The channel is allocated (transitioned from
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   108
 * state IDLE to state TRANSMITTING) on a first-come first-served basis.  The
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   109
 * channel always goes through a three state process:
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   110
 *
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   111
 *  IDLE -> TRANSMITTING -> PROPAGATING -> IDLE
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   112
 *
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   113
 * The TRANSMITTING state models the time during which the source net device
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   114
 * is actually wiggling the signals on the wire.  The PROPAGATING state models
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   115
 * the time after the last bit was sent, when the signal is propagating down 
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   116
 * the wire to the "far end."  
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   117
 *
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   118
 * The transition to the TRANSMITTING state is  driven by a call to 
4011
2fd3041c3c29 some device trace source documentation
Craig Dowell <craigdo@ee.washington.edu>
parents: 4008
diff changeset
   119
 * ns3::CsmaChannel::TransmitStart which is called by the net device that 
3156
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   120
 * transmits the packet.  It is the responsibility of that device to end the
4011
2fd3041c3c29 some device trace source documentation
Craig Dowell <craigdo@ee.washington.edu>
parents: 4008
diff changeset
   121
 * transmission with a call to ns3::CsmaChannel::TransmitEnd at the appropriate
3156
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   122
 * simulation time that reflects the time elapsed to put all of the packet bits
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   123
 * on the wire.  When TransmitEnd is called, the channel schedules an event
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   124
 * corresponding to a single speed-of-light delay.  This delay applies to all
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   125
 * net devices on the channel identically.  You can think of a symmetrical hub
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   126
 * in which the packet bits propagate to a central location and then back out
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   127
 * equal length cables to the other devices on the channel.
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   128
 *
4008
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
   129
 * The CsmaChannel models a broadcast medium so the packet is delivered
3156
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   130
 * to all of the devices on the channel (including the source) at the end of 
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3156
diff changeset
   131
 * the propagation time.  It is the responsibility of the sending device to 
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3156
diff changeset
   132
 * determine whether or not it receives a packet broadcast over the channel.
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3156
diff changeset
   133
 *
4008
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
   134
 * The CsmaChannel provides following Attributes:
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3156
diff changeset
   135
 *
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3156
diff changeset
   136
 * - DataRate:      The bitrate for packet transmission on connected devices;
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3156
diff changeset
   137
 * - Delay:       The speed of light transmission delay for the channel.
3156
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   138
 *
3992
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   139
 * \section CsmaNetDeviceModel CSMA Net Device Model
2867
d63b525e3f80 Some doxygen work
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   140
 *
3156
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   141
 * The CSMA network device appears somewhat like an Ethernet device.  The
4008
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
   142
 * CsmaNetDevice provides following Attributes:
3156
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   143
 *
4008
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
   144
 * - Address:           The Mac48Address of the device;
3156
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   145
 * - SendEnable:        Enable packet transmission if true;
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   146
 * - ReceiveEnable:     Enable packet reception if true;
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   147
 * - EncapsulationMode: Type of link layer encapsulation to use;
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   148
 * - RxErrorModel:      The receive error model;
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   149
 * - TxQueue:           The trasmit queue used by the device;
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   150
 * - InterframeGap:     The optional time to wait between "frames";
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   151
 * - Rx:                A trace source for received packets;
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   152
 * - Drop:              A trace source for dropped packets.
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   153
 *
4008
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
   154
 * The CsmaNetDevice supports the assignment of a "receive error model."
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
   155
 * This is an ErrorModel object that is used to simulate data corruption
3156
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   156
 * on the link.
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   157
 *
4008
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
   158
 * Packets sent over the CsmaNetDevice are always routed through the 
3156
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   159
 * transmit queue to provide a trace hook for packets sent out over the 
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   160
 * network.  This transmit queue can be set (via attribute) to model different
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   161
 * queueing strategies.
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   162
 *
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   163
 * Also configurable by attribute is the encapsulation method used by the
4017
4521a81f94b8 more documentation to address trace sources bugs
Craig Dowell <craigdo@ee.washington.edu>
parents: 4011
diff changeset
   164
 * device.  By default, or by setting the "EncapsulationMode" attribute to 
4521a81f94b8 more documentation to address trace sources bugs
Craig Dowell <craigdo@ee.washington.edu>
parents: 4011
diff changeset
   165
 * "Dix", the encapsulation is according to the DEC, Intel, Xerox standard.
4521a81f94b8 more documentation to address trace sources bugs
Craig Dowell <craigdo@ee.washington.edu>
parents: 4011
diff changeset
   166
 * This is sometimes called EthernetII framing and is the familiar destination
4521a81f94b8 more documentation to address trace sources bugs
Craig Dowell <craigdo@ee.washington.edu>
parents: 4011
diff changeset
   167
 * MAC, source MAC, EtherType, Data, CRC format.
4521a81f94b8 more documentation to address trace sources bugs
Craig Dowell <craigdo@ee.washington.edu>
parents: 4011
diff changeset
   168
 *
4521a81f94b8 more documentation to address trace sources bugs
Craig Dowell <craigdo@ee.washington.edu>
parents: 4011
diff changeset
   169
 * If the "EncapsulationMode" attribute is set to "Llc", the encapsulation is by 
3156
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   170
 * LLC SNAP.  In this case, a SNAP header is added that contains the EtherType
4017
4521a81f94b8 more documentation to address trace sources bugs
Craig Dowell <craigdo@ee.washington.edu>
parents: 4011
diff changeset
   171
 * (IP or ARP).  
4521a81f94b8 more documentation to address trace sources bugs
Craig Dowell <craigdo@ee.washington.edu>
parents: 4011
diff changeset
   172
 *
4521a81f94b8 more documentation to address trace sources bugs
Craig Dowell <craigdo@ee.washington.edu>
parents: 4011
diff changeset
   173
 * The other implemented encapsulation modes are IP_ARP (set "EncapsulationMode"
4521a81f94b8 more documentation to address trace sources bugs
Craig Dowell <craigdo@ee.washington.edu>
parents: 4011
diff changeset
   174
 * to "IpArp") in which the length type of the Ethernet header receives the 
4521a81f94b8 more documentation to address trace sources bugs
Craig Dowell <craigdo@ee.washington.edu>
parents: 4011
diff changeset
   175
 * protocol number of the packet; or ETHERNET_V1 (set "EncapsulationMode" to 
4521a81f94b8 more documentation to address trace sources bugs
Craig Dowell <craigdo@ee.washington.edu>
parents: 4011
diff changeset
   176
 * "EthernetV1") in which the length type of the Ethernet header receives the 
4521a81f94b8 more documentation to address trace sources bugs
Craig Dowell <craigdo@ee.washington.edu>
parents: 4011
diff changeset
   177
 * length of the packet.  A "Raw" encapsulation mode is defined but not 
4521a81f94b8 more documentation to address trace sources bugs
Craig Dowell <craigdo@ee.washington.edu>
parents: 4011
diff changeset
   178
 * implemented -- use of the RAW mode results in an assertion.
3156
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   179
 *
4008
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
   180
 * The CsmaNetDevice implements a random exponential backoff algorithm 
3156
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   181
 * that is executed if the channel is determined to be busy (TRANSMITTING or
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   182
 * PROPAGATING) when the device wants to start propagating.  This results in a
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   183
 * random delay of up to pow (2, retries) - 1 microseconds before a retry is
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   184
 * attempted.  The default maximum number of retries is 1000.
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   185
 *
3992
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   186
 * \section CsmaTracingModel CSMA Tracing Model
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   187
 *
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   188
 * Like all ns-3 devices, the CSMA Model provides a number of trace sources.
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   189
 * These trace sources can be hooked using your own custom trace code, or you
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   190
 * can use our helper functions to arrange for tracing to be enabled on devices
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   191
 * you specify.
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   192
 *
4008
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
   193
 * \subsection CsmaTracingModelUpperHooks Upper-Level (MAC) Hooks
3992
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   194
 *
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   195
 * From the point of view of tracing in the net device, there are several 
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   196
 * interesting points to insert trace hooks.  A convention inherited from other
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   197
 * simulators is that packets destined for transmission onto attached networks
4008
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
   198
 * pass through a single "transmit queue" in the net device.  We provide trace 
3992
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   199
 * hooks at this point in packet flow, which corresponds (abstractly) only to a 
4008
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
   200
 * transition from the network to data link layer, and call them collectively
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
   201
 * the device MAC hooks.
3992
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   202
 *
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   203
 * When a packet is sent to the CSMA net device for transmission it always 
4011
2fd3041c3c29 some device trace source documentation
Craig Dowell <craigdo@ee.washington.edu>
parents: 4008
diff changeset
   204
 * passes through the transmit queue.  The transmit queue in the 
4008
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
   205
 * CsmaNetDevice inherits from Queue, and therefore inherits three 
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
   206
 * trace sources:
3992
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   207
 *
4008
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
   208
 * - An Enqueue operation source (see Queue::m_traceEnqueue);
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
   209
 * - A Dequeue operation source (see Queue::m_traceDequeue);
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
   210
 * - A Drop operation source (see Queue::m_traceDrop).
3992
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   211
 *
4008
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
   212
 * The upper-level (MAC) trace hooks for the CsmaNetDevice are, in fact, 
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
   213
 * exactly these three trace sources on the single transmit queue of the device.  
3992
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   214
 *
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   215
 * The m_traceEnqueue event is triggered when a packet is placed on the transmit
4011
2fd3041c3c29 some device trace source documentation
Craig Dowell <craigdo@ee.washington.edu>
parents: 4008
diff changeset
   216
 * queue.  This happens at the time that ns3::CsmaNetDevice::Send or 
2fd3041c3c29 some device trace source documentation
Craig Dowell <craigdo@ee.washington.edu>
parents: 4008
diff changeset
   217
 * ns3::CsmaNetDevice::SendFrom is called by a higher layer to queue a packet for 
4008
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
   218
 * transmission.
3992
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   219
 *
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   220
 * The m_traceDequeue event is triggered when a packet is removed from the
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   221
 * transmit queue.  Dequeues from the transmit queue can happen in three 
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   222
 * situations:  1) If the underlying channel is idle when the 
4008
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
   223
 * CsmaNetDevice::Send or CsmaNetDevice::SendFrom is called, a packet
3992
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   224
 * is dequeued from the transmit queue and immediately transmitted;  2) If the
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   225
 * underlying channel is idle, a packet may be dequeued and immediately 
4008
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
   226
 * transmitted in an internal TransmitCompleteEvent that functions much 
3992
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   227
 * like a transmit complete interrupt service routine; or 3) from
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   228
 * the random exponential backoff handler if a timeout is detected.
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   229
 *
4008
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
   230
 * Case (3) implies that a packet is dequeued from the transmit queue if it is 
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
   231
 * unable to be transmittted according to the backoff rules.  It is important 
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
   232
 * to understand that this will appear as a Dequeued packet and it is easy to 
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
   233
 * incorrectly assume that the packet was transmitted since it passed through
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
   234
 * the transmit queue.  In fact, a packet is actually dropped by the net device
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
   235
 * in this case.  The reason for this behavior is due to the definition of the 
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
   236
 * Queue Drop event.  The m_traceDrop event is, by defintion, fired when a 
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
   237
 * packet cannot be enqueued on the transmit queue becasue it is full.  This 
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
   238
 * event only fires if the queue is full and we do not overload this event
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
   239
 * to indicate that the CsmaChannel is "full."
3992
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   240
 *
4008
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
   241
 * \subsection CsmaTracingModelUpperHooks Lower-Level (PHY) Hooks
3992
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   242
 *
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   243
 * Similar to the upper level trace hooks, there are trace hooks available at
4008
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
   244
 * the lower levels of the net device.  We call these the PHY hooks.  These 
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
   245
 * events fire from the device methods that talk directly to the CsmaChannel.
4017
4521a81f94b8 more documentation to address trace sources bugs
Craig Dowell <craigdo@ee.washington.edu>
parents: 4011
diff changeset
   246
 *
4008
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
   247
 * The trace source m_dropTrace is called to indicate a packet that is dropped
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
   248
 * by the device.  This happens in two cases:  First, if the receive side of 
4011
2fd3041c3c29 some device trace source documentation
Craig Dowell <craigdo@ee.washington.edu>
parents: 4008
diff changeset
   249
 * the net device is not enabled (see ns3::CsmaNetDevice::m_receiveEnable and the 
4008
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
   250
 * associated attribute "ReceiveEnable").
3992
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   251
 *
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   252
 * The m_dropTrace is also used to indicate that a packet was discarded as 
4008
b8feac108e89 cleanup some trace dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3992
diff changeset
   253
 * corrupt if a receive error model is used (see 
4011
2fd3041c3c29 some device trace source documentation
Craig Dowell <craigdo@ee.washington.edu>
parents: 4008
diff changeset
   254
 * ns3::CsmaNetDevice::m_receiveErrorModel and the associated attribute 
3992
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   255
 * "ReceiveErrorModel").
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   256
 *
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   257
 * The other low-level trace source fires on reception of an accepted packet
4011
2fd3041c3c29 some device trace source documentation
Craig Dowell <craigdo@ee.washington.edu>
parents: 4008
diff changeset
   258
 * (see ns3::CsmaNetDevice::m_rxTrace).  A packet is accepted if it is destined
3992
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   259
 * for the broadcast address, a multicast address, or to the MAC address 
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   260
 * assigned to the net device.
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   261
 *
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   262
 * \section CsmaModelSummary CSMA Model Summary
3156
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   263
 *
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   264
 * The ns3 CSMA model is a simplistic model of an Ethernet-like network.  It
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   265
 * supports a Carrier-Sense function and allows for Multiple Access to a 
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   266
 * shared medium.  It is not physical in the sense that the state of the 
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   267
 * medium is instantaneously shared among all devices.  This means that there
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   268
 * is no collision detection required in this model and none is implemented.
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   269
 * There will never be a "jam" of a packet already on the medium.  Access to 
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   270
 * the shared channel is on a first-come first-served basis as determined by 
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   271
 * the simulator scheduler.  If the channel is determined to be busy by looking
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   272
 * at the global state, a random exponential backoff is performed and a retry
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   273
 * is attempted.
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   274
 *
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   275
 * Ns-3 Attributes provide a mechanism for setting various parameters in the 
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   276
 * device and channel such as addresses, encapsulation modes and error model
3992
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   277
 * selection.  Trace hooks are provided in the usual manner with a set of 
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   278
 * upper level hooks corresponding to a transmit queue and used in ASCII 
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   279
 * tracing; and also a set of lower level hooks used in pcap tracing.
3156
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   280
 *
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   281
 * Although the ns-3 CsmaChannel and CsmaNetDevice does not model any kind of
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   282
 * network you could build or buy, it does provide us with some useful 
fcc19abc0ace CSMA Model Description
Craig Dowell <craigdo@ee.washington.edu>
parents: 2867
diff changeset
   283
 * functionality.  You should, however, understand that it is explicitly not 
3992
cb912b415b7d add to CSMA dox for trace sources
Craig Dowell <craigdo@ee.washington.edu>
parents: 3257
diff changeset
   284
 * Ethernet or any flavor of IEEE 802.3 but an interesting subset.
2867
d63b525e3f80 Some doxygen work
Tom Henderson <tomh@tomh.org>
parents:
diff changeset
   285
 */