src/devices/csma/csma-net-device.h
author Craig Dowell <craigdo@ee.washington.edu>
Tue, 05 Aug 2008 10:34:26 -0700
changeset 3510 c7f569b69dd9
parent 3506 cba7b2b80fe8
child 3584 4eb48239b4dc
permissions -rw-r--r--
Comment to clarify MTU policy was insufficiently clear
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
 */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    20
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
    21
#ifndef CSMA_NET_DEVICE_H
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
    22
#define CSMA_NET_DEVICE_H
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    23
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    24
#include <string.h>
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    25
#include "ns3/node.h"
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    26
#include "ns3/backoff.h"
1167
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 995
diff changeset
    27
#include "ns3/address.h"
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    28
#include "ns3/net-device.h"
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    29
#include "ns3/callback.h"
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    30
#include "ns3/packet.h"
2500
1fb9430f642d convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2470
diff changeset
    31
#include "ns3/traced-callback.h"
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    32
#include "ns3/nstime.h"
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    33
#include "ns3/data-rate.h"
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    34
#include "ns3/ptr.h"
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    35
#include "ns3/random-variable.h"
1494
c2985e1cd091 rename Euixx to Macxx
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1451
diff changeset
    36
#include "ns3/mac48-address.h"
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    37
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    38
namespace ns3 {
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    39
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    40
class Queue;
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
    41
class CsmaChannel;
1820
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1494
diff changeset
    42
class ErrorModel;
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    43
1403
0286b806eee1 add doxygen for each TraceSourceElement subclass
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1401
diff changeset
    44
/**
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
    45
 * \class CsmaNetDevice
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
    46
 * \brief A Device for a Csma Network Link.
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    47
 *
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
    48
 * The Csma net device class is analogous to layer 1 and 2 of the
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    49
 * TCP stack. The NetDevice takes a raw packet of bytes and creates a
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
    50
 * protocol specific packet from them. 
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
    51
 *
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
    52
 * The Csma net device class takes a packet and adds (or removes) the 
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
    53
 * headers/trailers that are associated with EthernetV1, EthernetV2, RAW
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
    54
 * or LLC protocols. The EthernetV1 packet type adds and removes Ethernet
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    55
 * destination and source addresses. The LLC packet type adds and
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    56
 * removes LLC snap headers. The raw packet type does not add or
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
    57
 * remove any headers.  
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    58
 *
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
    59
 * Each Csma net device will receive all packets written to the Csma link. 
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
    60
 * The ProcessHeader function can be used to filter out the packets such that
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
    61
 * higher level layers only receive packets that are addressed to their
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
    62
 * associated net devices
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    63
 */
2500
1fb9430f642d convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2470
diff changeset
    64
class CsmaNetDevice : public NetDevice 
1fb9430f642d convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2470
diff changeset
    65
{
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    66
public:
2500
1fb9430f642d convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2470
diff changeset
    67
  static TypeId GetTypeId (void);
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
    68
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    69
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    70
   * 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
    71
   *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    72
   */
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
    73
  enum EncapsulationMode {
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
    74
    ETHERNET_V1, /**< Version one ethernet packet, length field */
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
    75
    IP_ARP,      /**< Ethernet packet encapsulates IP/ARP packet */
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
    76
    RAW,         /**< Packet that contains no headers */
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
    77
    LLC,         /**< LLC packet encapsulation */  
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
    78
  };
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    79
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    80
  /**
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
    81
   * Construct a CsmaNetDevice
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    82
   *
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
    83
   * This is the default constructor for a CsmaNetDevice.
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    84
   */
2500
1fb9430f642d convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2470
diff changeset
    85
  CsmaNetDevice ();
1280
8c51afddffcb Doxygen cleanup
Tom Henderson <tomh@tomh.org>
parents: 1276
diff changeset
    86
8c51afddffcb Doxygen cleanup
Tom Henderson <tomh@tomh.org>
parents: 1276
diff changeset
    87
  /**
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
    88
   * Destroy a CsmaNetDevice
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    89
   *
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
    90
   * This is the destructor for a CsmaNetDevice.
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    91
   */
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
    92
  virtual ~CsmaNetDevice ();
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
    93
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    94
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    95
   * 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
    96
   * defines the minimum space required between packets sent by this device.
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
    97
   * As in Ethernet, it defaults to 96 bit times.
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    98
   *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    99
   * \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
   100
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   101
  void SetInterframeGap (Time t);
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   102
977
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
   * 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
   105
   * 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
   106
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   107
   * \see Attach ()
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   108
   * \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
   109
   * \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
   110
   * \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
   111
   * \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
   112
   * \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
   113
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   114
  void SetBackoffParams (Time slotTime, uint32_t minSlots, uint32_t maxSlots, 
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   115
    uint32_t maxRetries, uint32_t ceiling);
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   116
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   117
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   118
   * 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
   119
   *
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   120
   * The function Attach is used to add a CsmaNetDevice to a CsmaChannel.
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   121
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   122
   * \see SetDataRate ()
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   123
   * \see SetInterframeGap ()
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   124
   * \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
   125
   */
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
   126
  bool Attach (Ptr<CsmaChannel> ch);
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   127
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   128
  /**
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
   129
   * Attach a queue to the CsmaNetDevice.
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   130
   *
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   131
   * The CsmaNetDevice "owns" a queue.  This queue may be set by higher
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   132
   * level topology objects to implement a particular queueing method such as
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   133
   * DropTail or RED.  
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   134
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   135
   * \see Queue
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   136
   * \see DropTailQueue
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   137
   * \param queue a Ptr to the queue for being assigned to the device.
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   138
   */
3011
2d507430219e bug 153 applied to CSMA
Craig Dowell <craigdo@ee.washington.edu>
parents: 2655
diff changeset
   139
  void SetQueue (Ptr<Queue> queue);
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   140
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   141
  /**
1820
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1494
diff changeset
   142
   * Attach a receive ErrorModel to the CsmaNetDevice.
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1494
diff changeset
   143
   *
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1494
diff changeset
   144
   * The CsmaNetDevice may optionally include an ErrorModel in
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   145
   * the packet receive chain to simulate data errors in during transmission.
1820
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1494
diff changeset
   146
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   147
   * \see ErrorModel
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   148
   * \param em a pointer to the ErrorModel 
1820
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1494
diff changeset
   149
   */
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   150
  void SetReceiveErrorModel (Ptr<ErrorModel> em);
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   151
1820
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1494
diff changeset
   152
  /**
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
   153
   * Receive a packet from a connected CsmaChannel.
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   154
   *
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
   155
   * The CsmaNetDevice receives packets from its connected channel
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   156
   * 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
   157
   * 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
   158
   * arrived at the device.
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   159
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   160
   * \see CsmaChannel
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   161
   * \param p a reference to the received packet
3447
48f371a8ae8e Move the csma packet-from-self receive filtering away from the CsmaChannel into the CsmaNetDevice, with the help of an extra Ptr<CsmaNetDevice> parameter in Receive(). As discussed in the mailing list.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3446
diff changeset
   162
   * \param sender the CsmaNetDevice that transmitted the packet in the first place
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   163
   */
3447
48f371a8ae8e Move the csma packet-from-self receive filtering away from the CsmaChannel into the CsmaNetDevice, with the help of an extra Ptr<CsmaNetDevice> parameter in Receive(). As discussed in the mailing list.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3446
diff changeset
   164
  void Receive (Ptr<Packet> p, Ptr<CsmaNetDevice> sender);
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   165
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   166
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   167
   * Is the send side of the network device enabled?
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   168
   *
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   169
   * \returns True if the send side is enabled, otherwise false.
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   170
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   171
  bool IsSendEnabled (void);
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   172
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   173
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   174
   * Enable or disable the send side of the network device.
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   175
   *
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   176
   * \param enable Enable the send side if true, otherwise disable.
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   177
   */
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   178
  void SetSendEnable (bool enable);
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   179
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   180
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   181
   * Is the receive side of the network device enabled?
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   182
   *
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   183
   * \returns True if the receiver side is enabled, otherwise false.
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   184
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   185
  bool IsReceiveEnabled (void);
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   186
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   187
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   188
   * Enable or disable the receive side of the network device.
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   189
   *
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   190
   * \param enable Enable the receive side if true, otherwise disable.
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   191
   */
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   192
  void SetReceiveEnable (bool enable);
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   193
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   194
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   195
   * Set the MAC address of the the network device.
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   196
   *
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   197
   * \param addr The Mac48Address to use as the address of the device.
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   198
   */
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   199
  void SetAddress (Mac48Address addr);
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   200
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   201
  /**
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   202
   * Set The max PHY-level payload length of packets sent over this device.
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   203
   *
3510
c7f569b69dd9 Comment to clarify MTU policy was insufficiently clear
Craig Dowell <craigdo@ee.washington.edu>
parents: 3506
diff changeset
   204
   * Okay, that was easy to say, but the details are a bit thorny.  We have a MAC-level MTU that is the payload that higher 
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   205
   * level protocols see.  We have a PHY-level MTU which is the maximum number of bytes we can send over the link 
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   206
   * (cf. 1500 bytes for Ethernet).  The value that determines the relationship between these two values is the link
3510
c7f569b69dd9 Comment to clarify MTU policy was insufficiently clear
Craig Dowell <craigdo@ee.washington.edu>
parents: 3506
diff changeset
   207
   * encapsulation mode.  The link encapsulation method dictates the number of bytes of overhead that are required for the 
c7f569b69dd9 Comment to clarify MTU policy was insufficiently clear
Craig Dowell <craigdo@ee.washington.edu>
parents: 3506
diff changeset
   208
   * particular MAC protocol used.  For example, if the LLC/SNAP encapsulation is used, eight bytes of LLC/SNAP header are 
c7f569b69dd9 Comment to clarify MTU policy was insufficiently clear
Craig Dowell <craigdo@ee.washington.edu>
parents: 3506
diff changeset
   209
   * consumed and therefore the MAC-level MTU must be set and reported as eight bytes less than the PHY-level MTU (which we 
c7f569b69dd9 Comment to clarify MTU policy was insufficiently clear
Craig Dowell <craigdo@ee.washington.edu>
parents: 3506
diff changeset
   210
   * call the payload length to try and avoid confusion).
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   211
   *
3510
c7f569b69dd9 Comment to clarify MTU policy was insufficiently clear
Craig Dowell <craigdo@ee.washington.edu>
parents: 3506
diff changeset
   212
   * So, what do we do since there are be three values which must always be consistent in the driver?  Which values to we
c7f569b69dd9 Comment to clarify MTU policy was insufficiently clear
Craig Dowell <craigdo@ee.washington.edu>
parents: 3506
diff changeset
   213
   * allow to be changed and how do we ensure the other two are consistent?  We want to actually allowe a user to change 
c7f569b69dd9 Comment to clarify MTU policy was insufficiently clear
Craig Dowell <craigdo@ee.washington.edu>
parents: 3506
diff changeset
   214
   * these three variables in flexible ways, but we want the results (even at intermediate stages of her ultimate change) to 
c7f569b69dd9 Comment to clarify MTU policy was insufficiently clear
Craig Dowell <craigdo@ee.washington.edu>
parents: 3506
diff changeset
   215
   * be consistent.  We certainly don't want to require that users must understand the various requirements of an enapsulation
c7f569b69dd9 Comment to clarify MTU policy was insufficiently clear
Craig Dowell <craigdo@ee.washington.edu>
parents: 3506
diff changeset
   216
   * mode in order to set these variables.
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   217
   *
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   218
   * Consider the following situation:  A user wants to set the physical layer MTU to 1400 bytes instead of 1500.  This
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   219
   * user shouldn't have to concern herself that the current encapuslation mode is LLC and this will consume eight bytes.
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   220
   * She should not have to also set the MAC MTU to 1392 bytes, and she should certainly not have to do this before setting
3510
c7f569b69dd9 Comment to clarify MTU policy was insufficiently clear
Craig Dowell <craigdo@ee.washington.edu>
parents: 3506
diff changeset
   221
   * the PHY MTU to make the eventual result consistent.  
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   222
   *
3510
c7f569b69dd9 Comment to clarify MTU policy was insufficiently clear
Craig Dowell <craigdo@ee.washington.edu>
parents: 3506
diff changeset
   223
   * Similarly, a user who is interested in setting the MAC-level MTU to 1400 bytes should not be forced to understand that 
c7f569b69dd9 Comment to clarify MTU policy was insufficiently clear
Craig Dowell <craigdo@ee.washington.edu>
parents: 3506
diff changeset
   224
   * (based on encapsulation mode) the PHY-level MTU may need to be set to eight bytes more than what he wants in certain 
c7f569b69dd9 Comment to clarify MTU policy was insufficiently clear
Craig Dowell <craigdo@ee.washington.edu>
parents: 3506
diff changeset
   225
   * cases and zero bytes in others.
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   226
   *
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   227
   * Now, consider a user who is only interested in changing the encapsulation mode from LLC/SNAP to ETHERNET_V1.  This 
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   228
   * is going to change the relationship between the MAC MTU and the PHY MTU.  We've may have to come up with a new value 
3510
c7f569b69dd9 Comment to clarify MTU policy was insufficiently clear
Craig Dowell <craigdo@ee.washington.edu>
parents: 3506
diff changeset
   229
   * for at least one of the MTUs?  Which one?  There are too many free variables.
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   230
   *
3510
c7f569b69dd9 Comment to clarify MTU policy was insufficiently clear
Craig Dowell <craigdo@ee.washington.edu>
parents: 3506
diff changeset
   231
   * We could play games trying to figure out what the user wants to do, but that is typically a bad plan and programmers
c7f569b69dd9 Comment to clarify MTU policy was insufficiently clear
Craig Dowell <craigdo@ee.washington.edu>
parents: 3506
diff changeset
   232
   * have a long and distinguished history of guessing wrong.  We'll avoid all of that and just define a flexible behavior
c7f569b69dd9 Comment to clarify MTU policy was insufficiently clear
Craig Dowell <craigdo@ee.washington.edu>
parents: 3506
diff changeset
   233
   * that can be worked to get what you want.  Here it is:
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   234
   *
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   235
   * - If the user is changing the encapsulation mode, the PHY MTU will remain fixed and the MAC MTU will change, if required,
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   236
   * to make the three values consistent;
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   237
   *
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   238
   * - If the user is changing the MAC MTU, she is interested in getting that part of the system set, so the PHY MTU
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   239
   * will be changed to make the three values consistent;
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   240
   *
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   241
   * - If the user is changing the PHY MTU, he is interested in getting that part of the system set, so the MAC MTU
3510
c7f569b69dd9 Comment to clarify MTU policy was insufficiently clear
Craig Dowell <craigdo@ee.washington.edu>
parents: 3506
diff changeset
   242
   * will be changed to make the three values consistent;
c7f569b69dd9 Comment to clarify MTU policy was insufficiently clear
Craig Dowell <craigdo@ee.washington.edu>
parents: 3506
diff changeset
   243
   *
c7f569b69dd9 Comment to clarify MTU policy was insufficiently clear
Craig Dowell <craigdo@ee.washington.edu>
parents: 3506
diff changeset
   244
   * - You cannot define the MAC MTU and PHY MTU separately -- they are always tied together by the emulation mode.
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   245
   * 
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   246
   * So, if a user calls SetMaxPayloadLength, we assume that the PHY-level MTU is the interesting thing for that user and
3510
c7f569b69dd9 Comment to clarify MTU policy was insufficiently clear
Craig Dowell <craigdo@ee.washington.edu>
parents: 3506
diff changeset
   247
   * we just adjust the MAC-level MTU to a new "correct value" based on the current encapsulation mode.  If a user calls 
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   248
   * SetMacMtu, we assume that the MAC-level MTU is the interesting property for that user, and we adjust the PHY-level MTU 
3510
c7f569b69dd9 Comment to clarify MTU policy was insufficiently clear
Craig Dowell <craigdo@ee.washington.edu>
parents: 3506
diff changeset
   249
   * to a new "correct value" for the current encapsulation mode.  If a user calls SetEncapsulationMode, then we take the
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   250
   * MAC-level MTU as the free variable and set its value to match the current PHY-level MTU.
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   251
   *
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   252
   * \param mayPayloadLength The max PHY-level payload length of packets sent over this device.
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   253
   */
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   254
  void SetMaxPayloadLength (uint16_t maxPayloadLength);
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   255
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   256
  /**
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   257
   * Get The max PHY-level payload length of packets sent over this device.
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   258
   *
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   259
   * \returns The max PHY-level payload length of packets sent over this device.
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   260
   */
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   261
  uint16_t GetMaxPayloadLength (void) const;
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   262
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   263
  /**
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   264
   * Set The MAC-level MTU (client payload) of packets sent over this device.
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   265
   *
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   266
   * \param mtu The MAC-level MTU (client payload) of packets sent over this device.
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   267
   *
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   268
   * \see SetMaxPayloadLength
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   269
   */
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   270
  void SetMacMtu (uint16_t mtu);
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   271
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   272
  /**
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   273
   * Get The MAC-level MTU (client payload) of packets sent over this device.
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   274
   *
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   275
   * \returns The MAC-level MTU (client payload) of packets sent over this device.
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   276
   */
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   277
  uint16_t GetMacMtu (void) const;
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   278
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   279
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   280
  /**
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   281
   * Set the encapsulation mode of this device.
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   282
   *
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   283
   * \param mode The encapsulation mode of this device.
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   284
   *
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   285
   * \see SetMaxPayloadLength
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   286
   */
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   287
  void SetEncapsulationMode (CsmaNetDevice::EncapsulationMode mode);
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   288
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   289
  /**
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   290
   * Get the encapsulation mode of this device.
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   291
   *
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   292
   * \returns The encapsulation mode of this device.
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   293
   */
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   294
  CsmaNetDevice::EncapsulationMode  GetEncapsulationMode (void);
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   295
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   296
  //
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   297
  // The following methods are inherited from NetDevice base class.
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   298
  //
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   299
  virtual void SetName (const std::string name);
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   300
  virtual std::string GetName (void) const;
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   301
  virtual void SetIfIndex (const uint32_t index);
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   302
  virtual uint32_t GetIfIndex (void) const;
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   303
  virtual Ptr<Channel> GetChannel (void) const;
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   304
  virtual bool SetMtu (const uint16_t mtu);
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   305
  virtual uint16_t GetMtu (void) const;
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   306
  virtual Address GetAddress (void) const;
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   307
  virtual bool IsLinkUp (void) const;
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   308
  virtual void SetLinkChangeCallback (Callback<void> callback);
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   309
  virtual bool IsBroadcast (void) const;
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   310
  virtual Address GetBroadcast (void) const;
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   311
  virtual bool IsMulticast (void) const;
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   312
  virtual Address GetMulticast (void) const;
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   313
1443
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   314
  /**
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   315
   * \brief Make and return a MAC multicast address using the provided
1443
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   316
   *        multicast group
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   317
   *
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   318
   * RFC 1112 says that an Ipv4 host group address is mapped to an Ethernet 
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   319
   * multicast address by placing the low-order 23-bits of the IP address into 
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   320
   * the low-order 23 bits of the Ethernet multicast address 
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   321
   * 01-00-5E-00-00-00 (hex).
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   322
   *
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   323
   * This method performs the multicast address creation function appropriate
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   324
   * to an EUI-48-based CSMA device.  This MAC address is encapsulated in an
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   325
   *  abstract Address to avoid dependencies on the exact address format.
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   326
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   327
   * \param multicastGroup The IP address for the multicast group destination
1443
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   328
   * of the packet.
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   329
   * \return The MAC multicast Address used to send packets to the provided
1443
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   330
   * multicast group.
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   331
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   332
   * \see Ipv4Address
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   333
   * \see Mac48Address
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   334
   * \see Address
1443
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   335
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   336
  virtual Address MakeMulticastAddress (Ipv4Address multicastGroup) const;
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   337
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   338
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   339
   * Is this a point to point link?
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   340
   * \returns false.
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   341
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   342
  virtual bool IsPointToPoint (void) const;
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   343
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   344
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   345
   * Start sending a packet down 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: 3021
diff changeset
   346
   */
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   347
  virtual bool Send (Ptr<Packet> packet, const Address& dest, 
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   348
    uint16_t protocolNumber);
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   349
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   350
  /**
3442
8eef02250bc9 Add a NetDevice::SendFrom API, for sending packets with a custom source MAC address (a.k.a. MAC spoofing). Only implemented for CsmaNetDevice for now.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3438
diff changeset
   351
   * Start sending a packet down the channel, with MAC spoofing
8eef02250bc9 Add a NetDevice::SendFrom API, for sending packets with a custom source MAC address (a.k.a. MAC spoofing). Only implemented for CsmaNetDevice for now.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3438
diff changeset
   352
   */
8eef02250bc9 Add a NetDevice::SendFrom API, for sending packets with a custom source MAC address (a.k.a. MAC spoofing). Only implemented for CsmaNetDevice for now.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3438
diff changeset
   353
  virtual bool SendFrom (Ptr<Packet> packet, const Address& source, const Address& dest, 
8eef02250bc9 Add a NetDevice::SendFrom API, for sending packets with a custom source MAC address (a.k.a. MAC spoofing). Only implemented for CsmaNetDevice for now.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3438
diff changeset
   354
                         uint16_t protocolNumber);
8eef02250bc9 Add a NetDevice::SendFrom API, for sending packets with a custom source MAC address (a.k.a. MAC spoofing). Only implemented for CsmaNetDevice for now.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3438
diff changeset
   355
8eef02250bc9 Add a NetDevice::SendFrom API, for sending packets with a custom source MAC address (a.k.a. MAC spoofing). Only implemented for CsmaNetDevice for now.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3438
diff changeset
   356
  /**
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   357
   * Get the node to which this device is attached.
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   358
   *
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   359
   * \returns Ptr to the Node to which the device is attached.
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   360
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   361
  virtual Ptr<Node> GetNode (void) const;
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   362
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   363
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   364
   * Set the node to which this device is being attached.
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   365
   *
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   366
   * \param node Ptr to the Node to which the device is being attached.
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   367
   */
2600
6c389d0c717d add Application::SetNode and NetDevice::SetNode, use them from Node::AddApplication and Node::AddDevice. kill useless "Node" attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2500
diff changeset
   368
  virtual void SetNode (Ptr<Node> node);
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   369
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   370
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   371
   * Does this device need to use the address resolution protocol?
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   372
   *
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   373
   * \returns True if the encapsulation mode is set to a value that requires
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   374
   * ARP (IP_ARP or LLC).
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   375
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   376
  virtual bool NeedsArp (void) const;
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   377
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   378
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   379
   * Set the callback to be used to notify higher layers when a packet has been
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   380
   * received.
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   381
   *
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   382
   * \param cb The callback.
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   383
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   384
  virtual void SetReceiveCallback (NetDevice::ReceiveCallback cb);
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   385
3460
99698bc858e8 New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3448
diff changeset
   386
99698bc858e8 New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3448
diff changeset
   387
  virtual void SetPromiscReceiveCallback (PromiscReceiveCallback cb);
99698bc858e8 New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3448
diff changeset
   388
  virtual bool SupportsPromiscuous (void) const;
99698bc858e8 New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3448
diff changeset
   389
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   390
protected:
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   391
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   392
   * Perform any object release functionality required to break reference 
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   393
   * cycles in reference counted objects held by the device.
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   394
   */
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   395
  virtual void DoDispose (void);
1341
f685d4bf320f use the Object::GetTraceResolver tracing support rather than the old adhoc tracing code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1333
diff changeset
   396
f685d4bf320f use the Object::GetTraceResolver tracing support rather than the old adhoc tracing code
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1333
diff changeset
   397
  /**
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   398
   * 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
   399
   *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   400
   * 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
   401
   * 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
   402
   *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   403
   * \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
   404
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   405
  Ptr<Queue> GetQueue (void) const; 
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   406
977
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
   * 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
   409
   * respect the packet type
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   410
   *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   411
   * \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
   412
   * \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
   413
   * \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
   414
   * payload contained in this packet.
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   415
   */
3442
8eef02250bc9 Add a NetDevice::SendFrom API, for sending packets with a custom source MAC address (a.k.a. MAC spoofing). Only implemented for CsmaNetDevice for now.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3438
diff changeset
   416
  void AddHeader (Ptr<Packet> p, Mac48Address source, Mac48Address dest, uint16_t protocolNumber);
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   417
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   418
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   419
   * 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
   420
   * relate to the packet type
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   421
   *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   422
   * \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
   423
   * \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
   424
   * 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
   425
   * \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
   426
   * protocol stack.
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   427
   */
1866
e7dbcc4df546 do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1494
diff changeset
   428
  bool ProcessHeader (Ptr<Packet> p, uint16_t & param);
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   429
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   430
private:
3476
b834a9204124 begin sorting out mtu woes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3460
diff changeset
   431
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   432
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   433
   * Operator = is declared but not implemented.  This disables the assigment
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   434
   * operator for CsmaNetDevice objects.
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   435
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   436
   */
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
   437
  CsmaNetDevice &operator = (const CsmaNetDevice &o);
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   438
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   439
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   440
   * Copy constructor is declared but not implemented.  This disables the
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   441
   * copy constructor for CsmaNetDevice objects.
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   442
   */
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
   443
  CsmaNetDevice (const CsmaNetDevice &o);
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   444
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   445
  /**
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   446
   * Initialization function used during object construction.
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   447
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   448
  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
   449
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   450
  /**
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   451
   * Calculate the value for the MAC-level MTU that would result from 
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   452
   * setting the PHY-level MTU to the given value.
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   453
   */
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   454
  uint16_t MacMtuFromPayload (uint16_t payloadLength);
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   455
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   456
  /**
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   457
   * Calculate the value for the PHY-level MTU that would be required
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   458
   * to be able to set the MAC-level MTU to the given value.
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   459
   */
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   460
  uint16_t PayloadFromMacMtu (uint16_t mtu);
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   461
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   462
  /**
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   463
   * 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
   464
   *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   465
   * The TransmitStart method is the method that is used internally in
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
   466
   * the CsmaNetDevice to begin the process of sending a packet
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   467
   * out on the channel.  A corresponding method is called on the
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   468
   * channel to let it know that the physical device this class
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   469
   * represents has actually started sending signals, this causes the
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   470
   * channel to enter the BUSY state.  An event is scheduled for the time at
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   471
   * which the bits have been completely transmitted. 
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   472
   *
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   473
   * If the channel is found to be BUSY, this method reschedules itself for
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   474
   * execution at a later time (within the backoff period).
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   475
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   476
   * \see CsmaChannel::TransmitStart ()
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   477
   * \see TransmitCompleteEvent ()
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   478
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   479
  void TransmitStart ();
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   480
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   481
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   482
   * 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
   483
   *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   484
   * 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
   485
   * 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
   486
   * the TransmitEnd method is called on the channel to let it know that the
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   487
   * physical device this class represents has finished sending simulated
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   488
   * signals.  The channel uses this event to begin its speed of light delay
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   489
   * timer after which it notifies the Net Device(s) at the other end of the 
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   490
   * link that new bits have arrived (it delivers the Packet).  During this 
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   491
   * method, the net device also schedules the TransmitReadyEvent at which
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   492
   * time the transmitter becomes ready to send the next packet.
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   493
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   494
   * \see CsmaChannel::TransmitEnd ()
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   495
   * \see TransmitReadyEvent ()
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   496
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   497
  void TransmitCompleteEvent (void);
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   498
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   499
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   500
   * 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
   501
   *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   502
   * 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
   503
   * 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
   504
   * 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
   505
   * 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
   506
   * 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
   507
   *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   508
   * 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
   509
   * 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
   510
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   511
   * \see TransmitStart ()
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   512
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   513
  void TransmitReadyEvent (void);
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   514
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   515
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   516
   * 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
   517
   *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   518
   * 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
   519
   * 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
   520
   * then the packet is dropped.
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   521
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   522
  void TransmitAbort (void);
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   523
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   524
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   525
   * Notify any interested parties that the link has come up.
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   526
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   527
  void NotifyLinkUp (void);
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   528
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   529
  /** 
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   530
   * 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
   531
   * 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
   532
   * 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
   533
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   534
  uint32_t m_deviceId; 
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   535
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   536
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   537
   * 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
   538
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   539
  bool m_sendEnable;
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   540
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   541
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   542
   * 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
   543
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   544
  bool m_receiveEnable;
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   545
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   546
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   547
   * 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
   548
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   549
  enum TxMachineState
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   550
    {
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   551
      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
   552
      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
   553
      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
   554
      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
   555
    };
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   556
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   557
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   558
   * The state of the Net Device transmit state machine.
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   559
   * \see TxMachineState
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   560
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   561
  TxMachineState m_txMachineState;
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   562
  
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   563
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   564
   * 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
   565
   * 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
   566
   * function.
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   567
   */
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   568
  EncapsulationMode m_encapMode;
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   569
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   570
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   571
   * 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
   572
   * timing.
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   573
   * \see class DataRate
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   574
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   575
  DataRate m_bps;
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   576
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   577
  /**
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   578
   * The interframe gap that the Net Device uses insert time between packet
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   579
   * transmission
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   580
   * \see class Time
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   581
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   582
  Time m_tInterframeGap;
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   583
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   584
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   585
   * 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
   586
   * 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
   587
   * is ready to transmit
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   588
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   589
  Backoff m_backoff;
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   590
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   591
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   592
   * 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
   593
   * 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
   594
   * transmitted.
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   595
   */
1866
e7dbcc4df546 do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1494
diff changeset
   596
  Ptr<Packet> m_currentPkt;
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   597
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   598
  /**
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
   599
   * The CsmaChannel to which this CsmaNetDevice has been
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   600
   * attached.
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   601
   * \see class CsmaChannel
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   602
   */
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
   603
  Ptr<CsmaChannel> m_channel;
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   604
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   605
  /**
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
   606
   * The Queue which this CsmaNetDevice uses as a packet source.
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
   607
   * Management of this Queue has been delegated to the CsmaNetDevice
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   608
   * and it has the responsibility for deletion.
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   609
   * \see class Queue
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   610
   * \see class DropTailQueue
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   611
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   612
  Ptr<Queue> m_queue;
1820
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1494
diff changeset
   613
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1494
diff changeset
   614
  /**
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1494
diff changeset
   615
   * Error model for receive packet events
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1494
diff changeset
   616
   */
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1494
diff changeset
   617
  Ptr<ErrorModel> m_receiveErrorModel;
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1494
diff changeset
   618
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   619
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   620
   * 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
   621
   * fire.
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   622
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   623
   * \see class CallBackTraceSource
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   624
   */
2500
1fb9430f642d convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2470
diff changeset
   625
  TracedCallback<Ptr<const Packet> > m_rxTrace;
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   626
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   627
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   628
   * The trace source for the packet drop events that the device can
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   629
   * fire.
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   630
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   631
   * \see class CallBackTraceSource
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   632
   */
2500
1fb9430f642d convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2470
diff changeset
   633
  TracedCallback<Ptr<const Packet> > m_dropTrace;
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   634
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   635
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   636
   * The Node to which this device is attached.
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   637
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   638
  Ptr<Node> m_node;
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   639
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   640
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   641
   * The MAC address which has been assigned to this device.
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   642
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   643
  Mac48Address m_address;
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   644
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   645
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   646
   * The callback used to notify higher layers that a packet has been received.
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   647
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   648
  NetDevice::ReceiveCallback m_rxCallback;
3460
99698bc858e8 New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3448
diff changeset
   649
  /**
99698bc858e8 New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3448
diff changeset
   650
   * The callback used to notify higher layers that a packet has been received in promiscuous mode.
99698bc858e8 New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3448
diff changeset
   651
   */
99698bc858e8 New API considering comments from Craig: NetDevice->Node uses two callbacks; Node->ProtocolHandlers uses a single API with a promiscuous flag.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3448
diff changeset
   652
  NetDevice::PromiscReceiveCallback m_promiscRxCallback;
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   653
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   654
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   655
   * The interface index (really net evice index) that has been assigned to 
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   656
   * this network device.
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   657
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   658
  uint32_t m_ifIndex;
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   659
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   660
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   661
   * The human readable name of this device.
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   662
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   663
  std::string m_name;
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   664
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   665
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   666
   * Flag indicating whether or not the link is up.  In this case,
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   667
   * whether or not the device is connected to a channel.
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   668
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   669
  bool m_linkUp;
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   670
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   671
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   672
   * Callback to fire if the link changes state (up or down).
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   673
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   674
  Callback<void> m_linkChangeCallback;
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   675
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   676
  static const uint16_t DEFAULT_PAYLOAD_LENGTH = 1500;
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   677
  static const uint16_t DEFAULT_MTU = 1492;
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   678
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   679
  /**
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   680
   * There are two MTU types that are used in this driver.  The MAC-level 
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   681
   * MTU corresponds to the amount of data (payload) an upper layer can 
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   682
   * send across the link.  The PHY-level MTU corresponds to the Type/Length
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   683
   * field in the 802.3 header and corresponds to the maximum amount of data
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   684
   * the underlying packet can accept.  These are not the same thing.  For 
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   685
   * example, if you choose "Llc" as your encapsulation mode, the MAC-level
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   686
   * MTU will be reduced by the eight bytes with respect to the PHY-level
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   687
   * MTU which are consumed by the LLC/SNAP header.
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   688
   *
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   689
   * This method checks the current enacpuslation mode (and any other 
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   690
   * relevent information) and determines if the provided payloadLength 
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   691
   * (PHY-level MTU) and mtu (MAC-level MTU) are consistent.
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   692
   *
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   693
   * \param payloadLength The proposed PHY-level MTU
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   694
   * \param mtu The proposed MAC-level MTU
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   695
   */
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   696
  bool CheckMtuConsistency (uint16_t payloadLength, uint16_t mtu);
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   697
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   698
  /**
3476
b834a9204124 begin sorting out mtu woes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3460
diff changeset
   699
   * The MAC-level maximum transmission unit allowed to be sent or received by
b834a9204124 begin sorting out mtu woes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3460
diff changeset
   700
   * this network device.  This corresponds to the maximum payload the device
b834a9204124 begin sorting out mtu woes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3460
diff changeset
   701
   * can accept for transmission.  This is distinct from the PHY-level maximum
b834a9204124 begin sorting out mtu woes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3460
diff changeset
   702
   * as found in the 802.3 header Type/Length field.  For example, if you 
b834a9204124 begin sorting out mtu woes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3460
diff changeset
   703
   * choose "Llc" as your encapsulation mode, this will be reduced by the eight
b834a9204124 begin sorting out mtu woes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3460
diff changeset
   704
   * bytes consumed by the LLC/SNAP header.
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   705
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   706
  uint16_t m_mtu;
3476
b834a9204124 begin sorting out mtu woes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3460
diff changeset
   707
b834a9204124 begin sorting out mtu woes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3460
diff changeset
   708
  /**
b834a9204124 begin sorting out mtu woes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3460
diff changeset
   709
   * The PHY-level maximum payload size.  This corresponds to the maximum 
b834a9204124 begin sorting out mtu woes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3460
diff changeset
   710
   * number of bytes that can be transmitted as a payload over a channel.
b834a9204124 begin sorting out mtu woes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3460
diff changeset
   711
   * This corresponds to the 1500 byte limit often seen on Ethernet in the
b834a9204124 begin sorting out mtu woes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3460
diff changeset
   712
   * length interpretation of the Type/Length field of the 802.3 header.
b834a9204124 begin sorting out mtu woes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3460
diff changeset
   713
   */
b834a9204124 begin sorting out mtu woes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3460
diff changeset
   714
  uint32_t m_maxPayloadLength;
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   715
};
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   716
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   717
}; // namespace ns3
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   718
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
   719
#endif // CSMA_NET_DEVICE_H