src/devices/csma/csma-net-device.h
author Craig Dowell <craigdo@ee.washington.edu>
Wed, 02 Dec 2009 15:11:49 -0800
changeset 5832 2812b92d4888
parent 5227 ecb08c1fc273
child 6011 3fd7841b9c20
permissions -rw-r--r--
Drop CSMA packets with CRC errors, rescan, dox tweaks
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. 
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    51
 */
2500
1fb9430f642d convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2470
diff changeset
    52
class CsmaNetDevice : public NetDevice 
1fb9430f642d convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2470
diff changeset
    53
{
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    54
public:
2500
1fb9430f642d convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2470
diff changeset
    55
  static TypeId GetTypeId (void);
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
    56
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    57
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    58
   * 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
    59
   */
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
    60
  enum EncapsulationMode {
3630
0aa446f659d9 MTU, encap mode cleanup for csma
craigdo@ee.washington.edu
parents: 3629
diff changeset
    61
    ILLEGAL,     /**< Encapsulation mode not set */
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
    62
    DIX,         /**< DIX II / Ethernet II packet */
3630
0aa446f659d9 MTU, encap mode cleanup for csma
craigdo@ee.washington.edu
parents: 3629
diff changeset
    63
    LLC,         /**< 802.2 LLC/SNAP 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
    64
  };
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    65
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    66
  /**
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
    67
   * Construct a CsmaNetDevice
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    68
   *
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
    69
   * 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
    70
   */
2500
1fb9430f642d convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2470
diff changeset
    71
  CsmaNetDevice ();
1280
8c51afddffcb Doxygen cleanup
Tom Henderson <tomh@tomh.org>
parents: 1276
diff changeset
    72
8c51afddffcb Doxygen cleanup
Tom Henderson <tomh@tomh.org>
parents: 1276
diff changeset
    73
  /**
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
    74
   * Destroy a CsmaNetDevice
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    75
   *
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
    76
   * 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
    77
   */
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
    78
  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
    79
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    80
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    81
   * 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
    82
   * 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
    83
   * 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
    84
   *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    85
   * \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
    86
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    87
  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
    88
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    89
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    90
   * 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
    91
   * 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
    92
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
    93
   * \see Attach ()
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    94
   * \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
    95
   * \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
    96
   * \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
    97
   * \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
    98
   * \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
    99
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   100
  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
   101
    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
   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
   * 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
   105
   *
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
   106
   * 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
   107
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   108
   * \see SetDataRate ()
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   109
   * \see SetInterframeGap ()
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   110
   * \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
   111
   */
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
   112
  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
   113
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   114
  /**
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
   115
   * 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
   116
   *
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
   117
   * 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
   118
   * 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
   119
   * DropTail or RED.  
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   120
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   121
   * \see Queue
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   122
   * \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
   123
   * \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
   124
   */
3011
2d507430219e bug 153 applied to CSMA
Craig Dowell <craigdo@ee.washington.edu>
parents: 2655
diff changeset
   125
  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
   126
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   127
  /**
1820
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1494
diff changeset
   128
   * 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
   129
   *
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1494
diff changeset
   130
   * 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
   131
   * 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
   132
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   133
   * \see ErrorModel
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   134
   * \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
   135
   */
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
   136
  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
   137
1820
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1494
diff changeset
   138
  /**
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
   139
   * 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
   140
   *
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
   141
   * 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
   142
   * 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
   143
   * 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
   144
   * arrived at the device.
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   145
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   146
   * \see CsmaChannel
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   147
   * \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
   148
   * \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
   149
   */
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
   150
  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
   151
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
   152
  /**
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
   153
   * 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
   154
   *
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
   155
   * \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
   156
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   157
  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
   158
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
   159
  /**
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
   160
   * 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
   161
   *
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
   162
   * \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
   163
   */
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
   164
  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
   165
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 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
   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 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
   170
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   171
  bool IsReceiveEnabled (void);
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   172
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
   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 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
   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 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
   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 SetReceiveEnable (bool enable);
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   179
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
   180
  /**
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   181
   * Set The max frame size of packets sent over this device.
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   182
   *
3510
c7f569b69dd9 Comment to clarify MTU policy was insufficiently clear
Craig Dowell <craigdo@ee.washington.edu>
parents: 3506
diff changeset
   183
   * 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
   184
   * level protocols see.  We have a PHY-level MTU which is the maximum number of bytes we can send over the link 
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   185
   * (cf. 1500 bytes for Ethernet).  We also have a frame size which is some total number of bytes in a packet which could
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   186
   * or could not include any framing and overhead.  There can be a lot of inconsistency in definitions of these terms.  For
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   187
   * example, RFC 1042 asserts that the terms maximum transmission unit and maximum packet size are equivalent.  RFC 791, 
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   188
   * however, defines MTU as the maximum sized IP datagram that can be sent.  Packet size and frame size are sometimes
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   189
   * used interchangeably.
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   190
   *
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   191
   * So, some careful definitions are in order to avoid confusion:
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   192
   *
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   193
   * In real Ethernet, a packet on the wire starts with a preamble of seven bytes of alternating ones and zeroes followed by
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   194
   * a Start-of-Frame-Delimeter (10101011).  This is followed by what is usually called the packet: a MAC destination and 
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   195
   * source, a type field, payload, a possible padding field and a CRC.  To be strictly and pedantically correct the frame 
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   196
   * size is necessarily larger than the packet size on a real Ethernet.  But, this isn't a real Ethernet, it's a simulation
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   197
   * of a device similar to Ethernet, and we have no good reason to add framing bits.  So, in the case of the CSMA device, 
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   198
   * the frame size is equal to the packet size.  Since these two values are equal, there is no danger in assuming they are 
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   199
   * identical.  We do not implement any padding out to a minimum frame size, so padding is a non-issue.  We define packet 
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   200
   * size to be equal to frame size and this excludes the preamble and SFD bytes of a real Ethernet frame.  We define a 
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   201
   * single (MAC-level) MTU that coresponds to the payload size of the packet, which is the IP-centric view of the term as
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   202
   * seen in RFC 791.
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   203
   *
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   204
   * To make this concrete, consider DIX II (Digital Equipment, Intel, Xerox type II) framing, which is used in most TCP/IP 
3630
0aa446f659d9 MTU, encap mode cleanup for csma
craigdo@ee.washington.edu
parents: 3629
diff changeset
   205
   * stacks.  NetWare and Wireshark call this framing Ethernet II, by the way.  In this framing scheme, a real packet on the 
0aa446f659d9 MTU, encap mode cleanup for csma
craigdo@ee.washington.edu
parents: 3629
diff changeset
   206
   * wire starts with the preamble and Start-of-Frame-Delimeter (10101011).  We ignore these bits on this device since it they 
0aa446f659d9 MTU, encap mode cleanup for csma
craigdo@ee.washington.edu
parents: 3629
diff changeset
   207
   * are not  needed.  In DIX II, the SFD is followed by the MAC (48) destination address (6 bytes), source address (6 bytes), 
0aa446f659d9 MTU, encap mode cleanup for csma
craigdo@ee.washington.edu
parents: 3629
diff changeset
   208
   * the EtherType field (2 bytes), payload (0-1500 bytes) and a CRC (4 bytes) -- this corresponds to our entire frame.  The
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   209
   * payload of the packet/frame in DIX can be from 0 to 1500 bytes.  It is the maxmimum value of this payload that we call
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   210
   * the MTU.  Typically, one sees the MTU set to 1500 bytes and the maximum frame size set to 1518 bytes in Ethernet-based
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   211
   * networks.
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   212
   *
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   213
   * Different framing schemes can make for different MTU and frame size relationships.  For example, we support LLC/SNAP
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   214
   * encapsulation which adds eight bytes of header overhead to the usual DIX framing.  In this case, if the maximum frame
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   215
   * size is left at 1518 bytes, we need to export an MTU that reflects the loss of eight bytes for a total of 1492.
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   216
   * 
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   217
   * Another complication is that IEEE 802.1Q adds four bytes to the maximum frame size for VLAN tagging.  In order to 
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   218
   * provide an MTU of 1500 bytes, the frame size would need to increased to 1522 bytes to absorb the additional overhead.
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   219
   *
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   220
   * So, there are really three variables that are not entirely free at work here.  There is the maximum frame size, the
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   221
   * MTU and the framing scheme which we call the encapsulation mode.
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
   * So, what do we do since there are be three values which must always be consistent in the driver?  Which values to we
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   224
   * allow to be changed and how do we ensure the other two are consistent?  We want to actually allow a user to change 
3510
c7f569b69dd9 Comment to clarify MTU policy was insufficiently clear
Craig Dowell <craigdo@ee.washington.edu>
parents: 3506
diff changeset
   225
   * 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
   226
   * 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
   227
   * mode in order to set these variables.
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   228
   *
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   229
   * Consider the following situation:  A user wants to set the maximum frame size to 1418 bytes instead of 1518.  This
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   230
   * user shouldn't have to concern herself that the current encapuslation mode is LLC/SNAP and this will consume eight bytes.
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   231
   * She should not have to also figure out that the MTU needs to be set to 1392 bytes, and she should certainly not have to 
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   232
   * do this in some special order to keep intermediate steps consistent.
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   233
   *
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   234
   * Similarly, a user who is interested in setting the MTU to 1400 bytes should not be forced to understand that 
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   235
   * (based on encapsulation mode) the frame size may need to be set to eighteen + eight bytes more than what he wants 
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   236
   * in certain cases (802,3 + LLC/SNAP), twenty-two + zero bytes in others (802.1Q) and other inscrutable combinations
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   237
   *
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   238
   * Now, consider a user who is only interested in changing the encapsulation mode from LLC/SNAP to DIX.  This 
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   239
   * is going to change the relationship between the MTU and the frame size.  We've may have to come up with a new value 
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   240
   * for at least one of the these?  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
   241
   *
3510
c7f569b69dd9 Comment to clarify MTU policy was insufficiently clear
Craig Dowell <craigdo@ee.washington.edu>
parents: 3506
diff changeset
   242
   * 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
   243
   * 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
   244
   * 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
   245
   *
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   246
   * - 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
   247
   * to make the three values consistent;
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   248
   *
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   249
   * - If the user is changing the MTU, she is interested in getting that part of the system set, so the frame size
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   250
   * 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
   251
   *
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   252
   * - If the user is changing the frame size, he is interested in getting that part of the system set, so the MTU
3510
c7f569b69dd9 Comment to clarify MTU policy was insufficiently clear
Craig Dowell <craigdo@ee.washington.edu>
parents: 3506
diff changeset
   253
   * 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
   254
   *
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   255
   * - You cannot define the MTU and frame size separately -- they are always tied together by the emulation mode.  This
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   256
   * is not a restriction.  Consider what this means.  Perhaps you want to set the frame size to some large number and the
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   257
   * MTU to some small number.  The largest packet you can send is going to be limited by the MTU, so it is not possible to
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   258
   * send a frame larger than the MTU plus overhead.  The larger frame size is not useful.
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   259
   * 
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   260
   * So, if a user calls SetFrameSize, we assume that the maximum frame size is the interesting thing for that user and
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   261
   * we just adjust the MTU to a new "correct value" based on the current encapsulation mode.  If a user calls SetMtu, we 
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   262
   * assume that the MTU is the interesting property for that user, and we adjust the frame size to a new "correct value" 
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   263
   * for the current encapsulation mode.  If a user calls SetEncapsulationMode, then we take the MTU as the free variable 
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   264
   * and set its value to match the current frame size.
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   265
   *
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   266
   * \param frameSize The max frame size of packets sent over this device.
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   267
   */
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   268
  void SetFrameSize (uint16_t frameSize);
3506
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
  /**
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   271
   * Get The max frame size of packets sent over this device.
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   272
   *
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   273
   * \returns The max frame size of packets sent over this device.
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   274
   */
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   275
  uint16_t GetFrameSize (void) const;
3506
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
  /**
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   278
   * Set the encapsulation mode of this device.
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
   * \param mode The encapsulation mode of this device.
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   281
   *
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   282
   * \see SetFrameSize
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   283
   */
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   284
  void SetEncapsulationMode (CsmaNetDevice::EncapsulationMode mode);
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   285
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
   * Get the encapsulation mode of this device.
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
   * \returns The encapsulation mode of this device.
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   290
   */
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   291
  CsmaNetDevice::EncapsulationMode  GetEncapsulationMode (void);
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   292
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
  // 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
   295
  //
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
   296
  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
   297
  virtual uint32_t GetIfIndex (void) const;
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   298
  virtual Ptr<Channel> GetChannel (void) const;
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   299
  virtual bool SetMtu (const uint16_t mtu);
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   300
  virtual uint16_t GetMtu (void) const;
4578
88434ff8f0a5 Finally make tap bridge work with VMs (bug 569)
Craig Dowell <craigdo@ee.washington.edu>
parents: 4322
diff changeset
   301
  virtual void SetAddress (Address address);
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   302
  virtual Address GetAddress (void) const;
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   303
  virtual bool IsLinkUp (void) const;
4764
e90e1ef585b0 [Bug 653] NetDevice link change callback (SetLinkChangeCallback -> AddLinkChangeCallback).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4578
diff changeset
   304
  virtual void AddLinkChangeCallback (Callback<void> callback);
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   305
  virtual bool IsBroadcast (void) const;
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   306
  virtual Address GetBroadcast (void) const;
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   307
  virtual bool IsMulticast (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
   308
1443
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   309
  /**
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   310
   * \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
   311
   *        multicast group
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   312
   *
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   313
   * 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
   314
   * 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
   315
   * 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
   316
   * 01-00-5E-00-00-00 (hex).
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
   * This method performs the multicast address creation function appropriate
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   319
   * 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
   320
   *  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
   321
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   322
   * \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
   323
   * of the packet.
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   324
   * \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
   325
   * multicast group.
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
   * \see Ipv4Address
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   328
   * \see Mac48Address
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   329
   * \see Address
1443
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   330
   */
3841
1e7abf5fca79 Apply Patch to address bug 294 -- due to vincent
Craig Dowell <craigdo@ee.washington.edu>
parents: 3698
diff changeset
   331
  virtual Address GetMulticast (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
   332
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
   333
  /**
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
   334
   * 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
   335
   * \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
   336
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   337
  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
   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
  /**
3936
e525995ce5dc implement IsBridged for net devices
Craig Dowell <craigdo@ee.washington.edu>
parents: 3852
diff changeset
   340
   * Is this a bridge?
e525995ce5dc implement IsBridged for net devices
Craig Dowell <craigdo@ee.washington.edu>
parents: 3852
diff changeset
   341
   * \returns false.
e525995ce5dc implement IsBridged for net devices
Craig Dowell <craigdo@ee.washington.edu>
parents: 3852
diff changeset
   342
   */
e525995ce5dc implement IsBridged for net devices
Craig Dowell <craigdo@ee.washington.edu>
parents: 3852
diff changeset
   343
  virtual bool IsBridge (void) const;
e525995ce5dc implement IsBridged for net devices
Craig Dowell <craigdo@ee.washington.edu>
parents: 3852
diff changeset
   344
e525995ce5dc implement IsBridged for net devices
Craig Dowell <craigdo@ee.washington.edu>
parents: 3852
diff changeset
   345
  /**
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
   346
   * Start sending a packet down the channel.
5227
ecb08c1fc273 Fix some doxygen warnings revealed by WARN_NO_PARAMDOC=YES in doc/doxygen.conf.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4764
diff changeset
   347
   * \param packet packet to send
ecb08c1fc273 Fix some doxygen warnings revealed by WARN_NO_PARAMDOC=YES in doc/doxygen.conf.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4764
diff changeset
   348
   * \param dest layer 2 destination address
ecb08c1fc273 Fix some doxygen warnings revealed by WARN_NO_PARAMDOC=YES in doc/doxygen.conf.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4764
diff changeset
   349
   * \param protocolNumber protocol number
ecb08c1fc273 Fix some doxygen warnings revealed by WARN_NO_PARAMDOC=YES in doc/doxygen.conf.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4764
diff changeset
   350
   * \return true if successfull, false otherwise (drop, ...)
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
   351
   */
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
   352
  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
   353
    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
   354
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
   355
  /**
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
   356
   * Start sending a packet down the channel, with MAC spoofing
5227
ecb08c1fc273 Fix some doxygen warnings revealed by WARN_NO_PARAMDOC=YES in doc/doxygen.conf.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4764
diff changeset
   357
   * \param packet packet to send
ecb08c1fc273 Fix some doxygen warnings revealed by WARN_NO_PARAMDOC=YES in doc/doxygen.conf.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4764
diff changeset
   358
   * \param source layer 2 source address
ecb08c1fc273 Fix some doxygen warnings revealed by WARN_NO_PARAMDOC=YES in doc/doxygen.conf.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4764
diff changeset
   359
   * \param dest layer 2 destination address
ecb08c1fc273 Fix some doxygen warnings revealed by WARN_NO_PARAMDOC=YES in doc/doxygen.conf.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4764
diff changeset
   360
   * \param protocolNumber protocol number
ecb08c1fc273 Fix some doxygen warnings revealed by WARN_NO_PARAMDOC=YES in doc/doxygen.conf.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4764
diff changeset
   361
   * \return true if successfull, false otherwise (drop, ...)
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
   362
   */
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
   363
  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
   364
                         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
   365
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
   366
  /**
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
   367
   * 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
   368
   *
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
   * \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
   370
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   371
  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
   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
  /**
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
   * 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
   375
   *
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
   376
   * \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
   377
   */
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
   378
  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
   379
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
  /**
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
   * 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
   382
   *
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
   * \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
   384
   * 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
   385
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   386
  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
   387
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
   388
  /**
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
   389
   * 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
   390
   * 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
   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
   * \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
   393
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   394
  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
   395
3852
9cf7ad0cac85 Initial IPv6 capability
vincent@clarinet.u-strasbg.fr
parents: 3841
diff changeset
   396
  /**
9cf7ad0cac85 Initial IPv6 capability
vincent@clarinet.u-strasbg.fr
parents: 3841
diff changeset
   397
   * \brief Get the MAC multicast address corresponding
9cf7ad0cac85 Initial IPv6 capability
vincent@clarinet.u-strasbg.fr
parents: 3841
diff changeset
   398
   * to the IPv6 address provided.
9cf7ad0cac85 Initial IPv6 capability
vincent@clarinet.u-strasbg.fr
parents: 3841
diff changeset
   399
   * \param addr IPv6 address
9cf7ad0cac85 Initial IPv6 capability
vincent@clarinet.u-strasbg.fr
parents: 3841
diff changeset
   400
   * \return the MAC multicast address
9cf7ad0cac85 Initial IPv6 capability
vincent@clarinet.u-strasbg.fr
parents: 3841
diff changeset
   401
   * \warning Calling this method is invalid if IsMulticast returns not true.
9cf7ad0cac85 Initial IPv6 capability
vincent@clarinet.u-strasbg.fr
parents: 3841
diff changeset
   402
   */
9cf7ad0cac85 Initial IPv6 capability
vincent@clarinet.u-strasbg.fr
parents: 3841
diff changeset
   403
  virtual Address GetMulticast (Ipv6Address addr) const;
9cf7ad0cac85 Initial IPv6 capability
vincent@clarinet.u-strasbg.fr
parents: 3841
diff changeset
   404
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
   405
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
   406
  virtual void SetPromiscReceiveCallback (PromiscReceiveCallback cb);
3584
4eb48239b4dc bug 274: bridge must detect compatibility of devices with bridging mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3510
diff changeset
   407
  virtual bool SupportsSendFrom (void) const;
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
   408
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   409
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
   410
  /**
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
   411
   * 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
   412
   * 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
   413
   */
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   414
  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
   415
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
   416
  /**
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   417
   * 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
   418
   *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   419
   * 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
   420
   * 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
   421
   *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   422
   * \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
   423
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   424
  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
   425
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   426
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   427
   * 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
   428
   * respect the packet type
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
   * \param p Packet to which header should be added
3698
3251aa0de5c8 fix some Doxygen warnings
Tom Henderson <tomh@tomh.org>
parents: 3682
diff changeset
   431
   * \param source MAC source address from which packet should be sent
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   432
   * \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
   433
   * \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
   434
   * payload contained in this packet.
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   435
   */
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
   436
  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
   437
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   438
private:
3476
b834a9204124 begin sorting out mtu woes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3460
diff changeset
   439
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
   440
  /**
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
   * 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
   442
   * operator for CsmaNetDevice objects.
5227
ecb08c1fc273 Fix some doxygen warnings revealed by WARN_NO_PARAMDOC=YES in doc/doxygen.conf.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4764
diff changeset
   443
   * \param o object to copy
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
   */
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
   445
  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
   446
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
   447
  /**
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
   448
   * 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
   449
   * copy constructor for CsmaNetDevice objects.
5227
ecb08c1fc273 Fix some doxygen warnings revealed by WARN_NO_PARAMDOC=YES in doc/doxygen.conf.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4764
diff changeset
   450
   * \param o object to copy
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
   451
   */
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
   452
  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
   453
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   454
  /**
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
   455
   * Initialization function used during object construction.
5227
ecb08c1fc273 Fix some doxygen warnings revealed by WARN_NO_PARAMDOC=YES in doc/doxygen.conf.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4764
diff changeset
   456
   * \param sendEnable if device will be allowed to send
ecb08c1fc273 Fix some doxygen warnings revealed by WARN_NO_PARAMDOC=YES in doc/doxygen.conf.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4764
diff changeset
   457
   * \param receiveEnable if device will be allowed to receive
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   458
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   459
  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
   460
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   461
  /**
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   462
   * Calculate the value for the MTU that would result from 
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   463
   * setting the frame size to the given value.
5227
ecb08c1fc273 Fix some doxygen warnings revealed by WARN_NO_PARAMDOC=YES in doc/doxygen.conf.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4764
diff changeset
   464
   * \param frameSize size of frame
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   465
   */
3682
cef8288d30ae fix bug 338, MTU overflows frameSize
Craig Dowell <craigdo@ee.washington.edu>
parents: 3632
diff changeset
   466
  uint32_t MtuFromFrameSize (uint32_t frameSize);
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   467
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   468
  /**
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   469
   * Calculate the value for the frame size that would be required
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   470
   * to be able to set the MTU to the given value.
5227
ecb08c1fc273 Fix some doxygen warnings revealed by WARN_NO_PARAMDOC=YES in doc/doxygen.conf.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4764
diff changeset
   471
   * \param mtu MTU
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   472
   */
3682
cef8288d30ae fix bug 338, MTU overflows frameSize
Craig Dowell <craigdo@ee.washington.edu>
parents: 3632
diff changeset
   473
  uint32_t FrameSizeFromMtu (uint32_t mtu);
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   474
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   475
  /**
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   476
   * 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
   477
   *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   478
   * 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
   479
   * 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
   480
   * 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
   481
   * 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
   482
   * 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
   483
   * 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
   484
   * 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
   485
   *
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
   486
   * 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
   487
   * 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
   488
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   489
   * \see CsmaChannel::TransmitStart ()
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   490
   * \see TransmitCompleteEvent ()
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   491
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   492
  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
   493
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   494
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   495
   * 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
   496
   *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   497
   * 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
   498
   * 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
   499
   * 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
   500
   * 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
   501
   * 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
   502
   * 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
   503
   * 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
   504
   * 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
   505
   * 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
   506
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   507
   * \see CsmaChannel::TransmitEnd ()
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   508
   * \see TransmitReadyEvent ()
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   509
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   510
  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
   511
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
   * 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
   514
   *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   515
   * 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
   516
   * 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
   517
   * 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
   518
   * 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
   519
   * 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
   520
   *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   521
   * 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
   522
   * 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
   523
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   524
   * \see TransmitStart ()
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   525
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   526
  void TransmitReadyEvent (void);
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   527
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
   * 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
   530
   *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   531
   * 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
   532
   * 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
   533
   * then the packet is dropped.
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   534
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   535
  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
   536
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
   537
  /**
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
   538
   * 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
   539
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   540
  void NotifyLinkUp (void);
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
  /** 
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   543
   * 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
   544
   * 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
   545
   * 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
   546
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   547
  uint32_t m_deviceId; 
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
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   550
   * 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
   551
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   552
  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
   553
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   554
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   555
   * 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
   556
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   557
  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
   558
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   559
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   560
   * 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
   561
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   562
  enum TxMachineState
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
      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
   565
      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
   566
      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
   567
      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
   568
    };
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 state of the Net Device transmit state machine.
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   572
   * \see TxMachineState
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   573
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   574
  TxMachineState m_txMachineState;
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   575
  
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   576
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   577
   * 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
   578
   * 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
   579
   * function.
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   580
   */
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   581
  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
   582
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   583
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   584
   * 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
   585
   * timing.
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   586
   * \see class DataRate
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   587
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   588
  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
   589
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   590
  /**
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
   591
   * 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
   592
   * transmission
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   593
   * \see class Time
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   594
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   595
  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
   596
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   597
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   598
   * 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
   599
   * 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
   600
   * is ready to transmit
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   601
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   602
  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
   603
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   604
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   605
   * 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
   606
   * 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
   607
   * transmitted.
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   608
   */
1866
e7dbcc4df546 do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1494
diff changeset
   609
  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
   610
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   611
  /**
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
   612
   * 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
   613
   * attached.
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   614
   * \see class CsmaChannel
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   615
   */
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
   616
  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
   617
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   618
  /**
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
   619
   * 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
   620
   * 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
   621
   * and it has the responsibility for deletion.
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   622
   * \see class Queue
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   623
   * \see class DropTailQueue
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   624
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   625
  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
   626
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1494
diff changeset
   627
  /**
4263
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   628
   * Error model for receive packet events.  When active this model will be
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   629
   * used to model transmission errors by marking some of the packets 
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   630
   * received as corrupt.
1820
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1494
diff changeset
   631
   */
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1494
diff changeset
   632
  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
   633
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   634
  /**
4263
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   635
   * The trace source fired when packets come into the "top" of the device
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   636
   * at the L3/L2 transition, before being queued for transmission.
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   637
   *
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   638
   * \see class CallBackTraceSource
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   639
   */
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   640
  TracedCallback<Ptr<const Packet> > m_macTxTrace;
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   641
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   642
  /**
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   643
   * The trace source fired when packets coming into the "top" of the device
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   644
   * at the L3/L2 transition are dropped before being queued for transmission.
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   645
   *
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   646
   * \see class CallBackTraceSource
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   647
   */
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   648
  TracedCallback<Ptr<const Packet> > m_macTxDropTrace;
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   649
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   650
  /**
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   651
   * The trace source fired for packets successfully received by the device
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   652
   * immediately before being forwarded up to higher layers (at the L2/L3 
4272
b40ce56e0247 Add MacPromiscRx, make MacRx non-promisc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4264
diff changeset
   653
   * transition).  This is a promiscuous trace.
b40ce56e0247 Add MacPromiscRx, make MacRx non-promisc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4264
diff changeset
   654
   *
b40ce56e0247 Add MacPromiscRx, make MacRx non-promisc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4264
diff changeset
   655
   * \see class CallBackTraceSource
b40ce56e0247 Add MacPromiscRx, make MacRx non-promisc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4264
diff changeset
   656
   */
b40ce56e0247 Add MacPromiscRx, make MacRx non-promisc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4264
diff changeset
   657
  TracedCallback<Ptr<const Packet> > m_macPromiscRxTrace;
b40ce56e0247 Add MacPromiscRx, make MacRx non-promisc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4264
diff changeset
   658
b40ce56e0247 Add MacPromiscRx, make MacRx non-promisc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4264
diff changeset
   659
  /**
b40ce56e0247 Add MacPromiscRx, make MacRx non-promisc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4264
diff changeset
   660
   * The trace source fired for packets successfully received by the device
b40ce56e0247 Add MacPromiscRx, make MacRx non-promisc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4264
diff changeset
   661
   * immediately before being forwarded up to higher layers (at the L2/L3 
b40ce56e0247 Add MacPromiscRx, make MacRx non-promisc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4264
diff changeset
   662
   * transition).  This is a non-promiscuous trace.
4263
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   663
   *
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   664
   * \see class CallBackTraceSource
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   665
   */
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   666
  TracedCallback<Ptr<const Packet> > m_macRxTrace;
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   667
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   668
  /**
4264
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   669
   * The trace source fired for packets successfully received by the device
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   670
   * but dropped before being forwarded up to higher layers (at the L2/L3 
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   671
   * transition).
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   672
   *
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   673
   * \see class CallBackTraceSource
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   674
   */
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   675
  TracedCallback<Ptr<const Packet> > m_macRxDropTrace;
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   676
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   677
  /**
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   678
   * The trace source fired when the mac layer is forced to begin the backoff
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   679
   * process for a packet.  This can happen a number of times as the backoff
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   680
   * sequence is repeated with increasing delays.
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   681
   *
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   682
   * \see class CallBackTraceSource
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   683
   */
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   684
  TracedCallback<Ptr<const Packet> > m_macTxBackoffTrace;
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   685
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   686
  /**
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   687
   * The trace source fired when a packet begins the transmission process on
4263
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   688
   * the medium.
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   689
   *
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   690
   * \see class CallBackTraceSource
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   691
   */
4264
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   692
  TracedCallback<Ptr<const Packet> > m_phyTxBeginTrace;
4263
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   693
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   694
  /**
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   695
   * The trace source fired when a packet ends the transmission process on
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   696
   * the medium.
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   697
   *
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   698
   * \see class CallBackTraceSource
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   699
   */
4264
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   700
  TracedCallback<Ptr<const Packet> > m_phyTxEndTrace;
4263
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   701
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   702
  /**
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   703
   * The trace source fired when the phy layer drops a packet as it tries
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   704
   * to transmit it.
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   705
   *
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   706
   * \see class CallBackTraceSource
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   707
   */
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   708
  TracedCallback<Ptr<const Packet> > m_phyTxDropTrace;
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   709
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   710
  /**
4264
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   711
   * The trace source fired when a packet begins the reception process from
4263
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   712
   * the medium.
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   713
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   714
   * \see class CallBackTraceSource
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   715
   */
4264
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   716
  TracedCallback<Ptr<const Packet> > m_phyRxBeginTrace;
4263
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   717
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   718
  /**
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   719
   * The trace source fired when a packet ends the reception process from
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   720
   * the medium.
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   721
   *
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   722
   * \see class CallBackTraceSource
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   723
   */
4264
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   724
  TracedCallback<Ptr<const Packet> > m_phyRxEndTrace;
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
   725
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
   726
  /**
4263
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   727
   * The trace source fired when the phy layer drops a packet it has received.
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   728
   *
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   729
   * \see class CallBackTraceSource
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   730
   */
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   731
  TracedCallback<Ptr<const Packet> > m_phyRxDropTrace;
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   732
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   733
  /**
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   734
   * A trace source that emulates a non-promiscuous protocol sniffer connected 
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   735
   * to the device.  Unlike your average everyday sniffer, this trace source 
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   736
   * will not fire on PACKET_OTHERHOST events.
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   737
   *
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   738
   * On the transmit size, this trace hook will fire after a packet is dequeued
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   739
   * from the device queue for transmission.  In Linux, for example, this would
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   740
   * correspond to the point just before a device hard_start_xmit where 
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   741
   * dev_queue_xmit_nit is called to dispatch the packet to the PF_PACKET 
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   742
   * ETH_P_ALL handlers.
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   743
   *
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   744
   * On the receive side, this trace hook will fire when a packet is received,
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   745
   * just before the receive callback is executed.  In Linux, for example, 
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   746
   * this would correspond to the point at which the packet is dispatched to 
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   747
   * packet sniffers in netif_receive_skb.
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   748
   *
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   749
   * \see class CallBackTraceSource
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   750
   */
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   751
  TracedCallback<Ptr<const Packet> > m_snifferTrace;
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   752
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   753
  /**
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   754
   * A trace source that emulates a promiscuous mode protocol sniffer connected
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   755
   * to the device.  This trace source fire on packets destined for any host
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   756
   * just like your average everyday packet sniffer.
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   757
   *
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   758
   * On the transmit size, this trace hook will fire after a packet is dequeued
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   759
   * from the device queue for transmission.  In Linux, for example, this would
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   760
   * correspond to the point just before a device hard_start_xmit where 
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   761
   * dev_queue_xmit_nit is called to dispatch the packet to the PF_PACKET 
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   762
   * ETH_P_ALL handlers.
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   763
   *
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   764
   * On the receive side, this trace hook will fire when a packet is received,
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   765
   * just before the receive callback is executed.  In Linux, for example, 
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   766
   * this would correspond to the point at which the packet is dispatched to 
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   767
   * packet sniffers in netif_receive_skb.
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   768
   *
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   769
   * \see class CallBackTraceSource
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   770
   */
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   771
  TracedCallback<Ptr<const Packet> > m_promiscSnifferTrace;
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   772
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
   773
  /**
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
   774
   * 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
   775
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   776
  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
   777
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
   778
  /**
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
   779
   * 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
   780
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   781
  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
   782
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
   783
  /**
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
   784
   * 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
   785
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   786
  NetDevice::ReceiveCallback m_rxCallback;
4263
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   787
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
   788
  /**
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
   789
   * 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
   790
   */
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
   791
  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
   792
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
   793
  /**
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
   794
   * 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
   795
   * 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
   796
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   797
  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
   798
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
   799
  /**
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
   800
   * 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
   801
   * 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
   802
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   803
  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
   804
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
   805
  /**
4764
e90e1ef585b0 [Bug 653] NetDevice link change callback (SetLinkChangeCallback -> AddLinkChangeCallback).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4578
diff changeset
   806
   * List of callbacks to fire if the link changes state (up or down).
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
   807
   */
4764
e90e1ef585b0 [Bug 653] NetDevice link change callback (SetLinkChangeCallback -> AddLinkChangeCallback).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4578
diff changeset
   808
  TracedCallback<> m_linkChangeCallbacks;
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
   809
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   810
  static const uint16_t DEFAULT_FRAME_SIZE = 1518;
3630
0aa446f659d9 MTU, encap mode cleanup for csma
craigdo@ee.washington.edu
parents: 3629
diff changeset
   811
  static const uint16_t ETHERNET_OVERHEAD = 18;
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   812
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
   813
  /**
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   814
   * The frame size/packet size.  This corresponds to the maximum 
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   815
   * number of bytes that can be transmitted as a packet without framing.
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   816
   * This corresponds to the 1518 byte packet size often seen on Ethernet.
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
   817
   */
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   818
  uint32_t m_frameSize;
3476
b834a9204124 begin sorting out mtu woes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3460
diff changeset
   819
b834a9204124 begin sorting out mtu woes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3460
diff changeset
   820
  /**
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   821
   * The Maxmimum Transmission Unit.  This corresponds to the maximum 
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   822
   * number of bytes that can be transmitted as seen from higher layers.
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   823
   * This corresponds to the 1500 byte MTU size often seen on IP over 
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   824
   * Ethernet.
3476
b834a9204124 begin sorting out mtu woes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3460
diff changeset
   825
   */
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   826
  uint32_t m_mtu;
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   827
};
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   828
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   829
}; // namespace ns3
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   830
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
   831
#endif // CSMA_NET_DEVICE_H