src/devices/csma/csma-net-device.h
author Craig Dowell <craigdo@ee.washington.edu>
Tue, 23 Jun 2009 22:12:35 -0700
changeset 4578 88434ff8f0a5
parent 4322 bad9eed19283
child 4764 e90e1ef585b0
permissions -rw-r--r--
Finally make tap bridge work with VMs (bug 569)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
     2
/*
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
     3
 * Copyright (c) 2007 Emmanuelle Laprise
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
     4
 *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
     8
 *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    12
 * GNU General Public License for more details.
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    13
 *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    17
 *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    18
 * Author: Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    19
 */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    20
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
    21
#ifndef CSMA_NET_DEVICE_H
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
    22
#define CSMA_NET_DEVICE_H
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    23
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    24
#include <string.h>
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    25
#include "ns3/node.h"
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    26
#include "ns3/backoff.h"
1167
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 995
diff changeset
    27
#include "ns3/address.h"
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    28
#include "ns3/net-device.h"
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    29
#include "ns3/callback.h"
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    30
#include "ns3/packet.h"
2500
1fb9430f642d convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2470
diff changeset
    31
#include "ns3/traced-callback.h"
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    32
#include "ns3/nstime.h"
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    33
#include "ns3/data-rate.h"
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    34
#include "ns3/ptr.h"
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    35
#include "ns3/random-variable.h"
1494
c2985e1cd091 rename Euixx to Macxx
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1451
diff changeset
    36
#include "ns3/mac48-address.h"
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    37
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    38
namespace ns3 {
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    39
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    40
class Queue;
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
    41
class CsmaChannel;
1820
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1494
diff changeset
    42
class ErrorModel;
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    43
1403
0286b806eee1 add doxygen for each TraceSourceElement subclass
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1401
diff changeset
    44
/**
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
    45
 * \class CsmaNetDevice
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
    46
 * \brief A Device for a Csma Network Link.
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    47
 *
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
    48
 * The Csma net device class is analogous to layer 1 and 2 of the
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    49
 * TCP stack. The NetDevice takes a raw packet of bytes and creates a
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
    50
 * protocol specific packet from them. 
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
    51
 *
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
    52
 * Each Csma net device will receive all packets written to the Csma link. 
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
    53
 * The ProcessHeader function can be used to filter out the packets such that
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
    54
 * higher level layers only receive packets that are addressed to their
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
    55
 * associated net devices
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    56
 */
2500
1fb9430f642d convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2470
diff changeset
    57
class CsmaNetDevice : public NetDevice 
1fb9430f642d convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2470
diff changeset
    58
{
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    59
public:
2500
1fb9430f642d convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2470
diff changeset
    60
  static TypeId GetTypeId (void);
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
    61
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    62
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    63
   * 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
    64
   */
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
    65
  enum EncapsulationMode {
3630
0aa446f659d9 MTU, encap mode cleanup for csma
craigdo@ee.washington.edu
parents: 3629
diff changeset
    66
    ILLEGAL,     /**< Encapsulation mode not set */
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
    67
    DIX,         /**< DIX II / Ethernet II packet */
3630
0aa446f659d9 MTU, encap mode cleanup for csma
craigdo@ee.washington.edu
parents: 3629
diff changeset
    68
    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
    69
  };
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    70
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    71
  /**
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
    72
   * Construct a CsmaNetDevice
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    73
   *
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
    74
   * 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
    75
   */
2500
1fb9430f642d convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2470
diff changeset
    76
  CsmaNetDevice ();
1280
8c51afddffcb Doxygen cleanup
Tom Henderson <tomh@tomh.org>
parents: 1276
diff changeset
    77
8c51afddffcb Doxygen cleanup
Tom Henderson <tomh@tomh.org>
parents: 1276
diff changeset
    78
  /**
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
    79
   * Destroy a CsmaNetDevice
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    80
   *
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
    81
   * 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
    82
   */
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
    83
  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
    84
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    85
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    86
   * 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
    87
   * 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
    88
   * 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
    89
   *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    90
   * \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
    91
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    92
  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
    93
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    94
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    95
   * Set the 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
    96
   * 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
    97
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
    98
   * \see Attach ()
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    99
   * \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
   100
   * \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
   101
   * \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
   102
   * \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
   103
   * \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
   104
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   105
  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
   106
    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
   107
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   108
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   109
   * 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
   110
   *
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
   111
   * 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
   112
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   113
   * \see SetDataRate ()
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   114
   * \see SetInterframeGap ()
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   115
   * \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
   116
   */
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
   117
  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
   118
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   119
  /**
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
   120
   * 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
   121
   *
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
   122
   * 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
   123
   * 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
   124
   * DropTail or RED.  
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   125
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   126
   * \see Queue
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   127
   * \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
   128
   * \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
   129
   */
3011
2d507430219e bug 153 applied to CSMA
Craig Dowell <craigdo@ee.washington.edu>
parents: 2655
diff changeset
   130
  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
   131
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   132
  /**
1820
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1494
diff changeset
   133
   * 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
   134
   *
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1494
diff changeset
   135
   * 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
   136
   * 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
   137
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   138
   * \see ErrorModel
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   139
   * \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
   140
   */
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
   141
  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
   142
1820
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1494
diff changeset
   143
  /**
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
   144
   * 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
   145
   *
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
   146
   * 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
   147
   * 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
   148
   * 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
   149
   * arrived at the device.
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   150
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   151
   * \see CsmaChannel
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   152
   * \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
   153
   * \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
   154
   */
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
   155
  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
   156
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
   157
  /**
ba198dad54a2 CSMA 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
   * 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
   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
   * \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
   161
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   162
  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
   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
  /**
ba198dad54a2 CSMA 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
   * 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
   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
   * \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
   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
  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
   170
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   171
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   172
   * 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
   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
   * \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
   175
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   176
  bool IsReceiveEnabled (void);
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   177
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
   178
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   179
   * 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
   180
   *
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   181
   * \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
   182
   */
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   183
  void SetReceiveEnable (bool enable);
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   184
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
   185
  /**
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   186
   * 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
   187
   *
3510
c7f569b69dd9 Comment to clarify MTU policy was insufficiently clear
Craig Dowell <craigdo@ee.washington.edu>
parents: 3506
diff changeset
   188
   * 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
   189
   * 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
   190
   * (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
   191
   * 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
   192
   * 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
   193
   * 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
   194
   * used interchangeably.
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   195
   *
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   196
   * 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
   197
   *
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   198
   * 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
   199
   * 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
   200
   * 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
   201
   * 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
   202
   * 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
   203
   * 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
   204
   * 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
   205
   * 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
   206
   * 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
   207
   * seen in RFC 791.
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   208
   *
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   209
   * 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
   210
   * 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
   211
   * 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
   212
   * 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
   213
   * 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
   214
   * 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
   215
   * 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
   216
   * networks.
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   217
   *
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   218
   * 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
   219
   * 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
   220
   * 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
   221
   * 
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   222
   * 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
   223
   * 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
   224
   *
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   225
   * 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
   226
   * 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
   227
   *
3510
c7f569b69dd9 Comment to clarify MTU policy was insufficiently clear
Craig Dowell <craigdo@ee.washington.edu>
parents: 3506
diff changeset
   228
   * 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
   229
   * 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
   230
   * 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
   231
   * 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
   232
   * mode in order to set these variables.
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
   * 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
   235
   * 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
   236
   * 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
   237
   * 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
   238
   *
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   239
   * 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
   240
   * (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
   241
   * 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
   242
   *
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   243
   * 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
   244
   * 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
   245
   * 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
   246
   *
3510
c7f569b69dd9 Comment to clarify MTU policy was insufficiently clear
Craig Dowell <craigdo@ee.washington.edu>
parents: 3506
diff changeset
   247
   * 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
   248
   * 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
   249
   * 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
   250
   *
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   251
   * - 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
   252
   * to make the three values consistent;
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   253
   *
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   254
   * - 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
   255
   * 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
   256
   *
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   257
   * - 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
   258
   * 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
   259
   *
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   260
   * - 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
   261
   * 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
   262
   * 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
   263
   * 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
   264
   * 
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   265
   * 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
   266
   * 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
   267
   * 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
   268
   * 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
   269
   * 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
   270
   *
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   271
   * \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
   272
   */
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   273
  void SetFrameSize (uint16_t frameSize);
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   274
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   275
  /**
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   276
   * 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
   277
   *
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   278
   * \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
   279
   */
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   280
  uint16_t GetFrameSize (void) const;
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   281
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   282
  /**
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   283
   * Set the encapsulation mode of this device.
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   284
   *
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   285
   * \param mode The encapsulation mode of this device.
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   286
   *
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   287
   * \see SetFrameSize
3506
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
  void SetEncapsulationMode (CsmaNetDevice::EncapsulationMode mode);
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
  /**
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   292
   * Get the encapsulation mode of this device.
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   293
   *
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   294
   * \returns The encapsulation mode of this device.
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   295
   */
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   296
  CsmaNetDevice::EncapsulationMode  GetEncapsulationMode (void);
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   297
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   298
  //
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   299
  // 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
   300
  //
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
   301
  virtual void SetIfIndex (const uint32_t index);
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   302
  virtual uint32_t GetIfIndex (void) const;
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   303
  virtual Ptr<Channel> GetChannel (void) const;
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   304
  virtual bool SetMtu (const uint16_t mtu);
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   305
  virtual uint16_t GetMtu (void) const;
4578
88434ff8f0a5 Finally make tap bridge work with VMs (bug 569)
Craig Dowell <craigdo@ee.washington.edu>
parents: 4322
diff changeset
   306
  virtual void SetAddress (Address address);
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   307
  virtual Address GetAddress (void) const;
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   308
  virtual bool IsLinkUp (void) const;
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   309
  virtual void SetLinkChangeCallback (Callback<void> callback);
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   310
  virtual bool IsBroadcast (void) const;
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   311
  virtual Address GetBroadcast (void) const;
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   312
  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
   313
1443
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   314
  /**
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   315
   * \brief Make and return a MAC multicast address using the provided
1443
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   316
   *        multicast group
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   317
   *
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   318
   * RFC 1112 says that an Ipv4 host group address is mapped to an Ethernet 
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   319
   * multicast address by placing the low-order 23-bits of the IP address into 
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   320
   * the low-order 23 bits of the Ethernet multicast address 
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   321
   * 01-00-5E-00-00-00 (hex).
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   322
   *
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   323
   * This method performs the multicast address creation function appropriate
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   324
   * to an EUI-48-based CSMA device.  This MAC address is encapsulated in an
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   325
   *  abstract Address to avoid dependencies on the exact address format.
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   326
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   327
   * \param multicastGroup The IP address for the multicast group destination
1443
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   328
   * of the packet.
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   329
   * \return The MAC multicast Address used to send packets to the provided
1443
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   330
   * multicast group.
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   331
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   332
   * \see Ipv4Address
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   333
   * \see Mac48Address
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   334
   * \see Address
1443
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   335
   */
3841
1e7abf5fca79 Apply Patch to address bug 294 -- due to vincent
Craig Dowell <craigdo@ee.washington.edu>
parents: 3698
diff changeset
   336
  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
   337
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   338
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   339
   * Is this a point to point link?
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   340
   * \returns false.
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   341
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   342
  virtual bool IsPointToPoint (void) const;
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   343
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   344
  /**
3936
e525995ce5dc implement IsBridged for net devices
Craig Dowell <craigdo@ee.washington.edu>
parents: 3852
diff changeset
   345
   * Is this a bridge?
e525995ce5dc implement IsBridged for net devices
Craig Dowell <craigdo@ee.washington.edu>
parents: 3852
diff changeset
   346
   * \returns false.
e525995ce5dc implement IsBridged for net devices
Craig Dowell <craigdo@ee.washington.edu>
parents: 3852
diff changeset
   347
   */
e525995ce5dc implement IsBridged for net devices
Craig Dowell <craigdo@ee.washington.edu>
parents: 3852
diff changeset
   348
  virtual bool IsBridge (void) const;
e525995ce5dc implement IsBridged for net devices
Craig Dowell <craigdo@ee.washington.edu>
parents: 3852
diff changeset
   349
e525995ce5dc implement IsBridged for net devices
Craig Dowell <craigdo@ee.washington.edu>
parents: 3852
diff changeset
   350
  /**
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
   * Start sending a packet down the channel.
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   352
   */
ba198dad54a2 CSMA 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
  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
   354
    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
   355
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   356
  /**
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
   357
   * Start sending a packet down the channel, with MAC spoofing
8eef02250bc9 Add a NetDevice::SendFrom API, for sending packets with a custom source MAC address (a.k.a. MAC spoofing). Only implemented for CsmaNetDevice for now.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3438
diff changeset
   358
   */
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
   359
  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
   360
                         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
   361
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
  /**
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
   363
   * 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
   364
   *
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   365
   * \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
   366
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   367
  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
   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
  /**
ba198dad54a2 CSMA 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
   * 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
   371
   *
ba198dad54a2 CSMA 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
   * \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
   373
   */
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
   374
  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
   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
  /**
ba198dad54a2 CSMA 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
   * 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
   378
   *
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   379
   * \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
   380
   * 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
   381
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   382
  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
   383
ba198dad54a2 CSMA 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
  /**
ba198dad54a2 CSMA 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
   * 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
   386
   * 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
   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
   * \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
   389
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   390
  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
   391
3852
9cf7ad0cac85 Initial IPv6 capability
vincent@clarinet.u-strasbg.fr
parents: 3841
diff changeset
   392
  /**
9cf7ad0cac85 Initial IPv6 capability
vincent@clarinet.u-strasbg.fr
parents: 3841
diff changeset
   393
   * \brief Get the MAC multicast address corresponding
9cf7ad0cac85 Initial IPv6 capability
vincent@clarinet.u-strasbg.fr
parents: 3841
diff changeset
   394
   * to the IPv6 address provided.
9cf7ad0cac85 Initial IPv6 capability
vincent@clarinet.u-strasbg.fr
parents: 3841
diff changeset
   395
   * \param addr IPv6 address
9cf7ad0cac85 Initial IPv6 capability
vincent@clarinet.u-strasbg.fr
parents: 3841
diff changeset
   396
   * \return the MAC multicast address
9cf7ad0cac85 Initial IPv6 capability
vincent@clarinet.u-strasbg.fr
parents: 3841
diff changeset
   397
   * \warning Calling this method is invalid if IsMulticast returns not true.
9cf7ad0cac85 Initial IPv6 capability
vincent@clarinet.u-strasbg.fr
parents: 3841
diff changeset
   398
   */
9cf7ad0cac85 Initial IPv6 capability
vincent@clarinet.u-strasbg.fr
parents: 3841
diff changeset
   399
  virtual Address GetMulticast (Ipv6Address addr) const;
9cf7ad0cac85 Initial IPv6 capability
vincent@clarinet.u-strasbg.fr
parents: 3841
diff changeset
   400
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
   401
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
   402
  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
   403
  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
   404
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   405
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
   406
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   407
   * 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
   408
   * 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
   409
   */
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   410
  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
   411
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
   412
  /**
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   413
   * 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
   414
   *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   415
   * 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
   416
   * 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
   417
   *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   418
   * \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
   419
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   420
  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
   421
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   422
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   423
   * 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
   424
   * respect the packet type
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   425
   *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   426
   * \param p Packet to which header should be added
3698
3251aa0de5c8 fix some Doxygen warnings
Tom Henderson <tomh@tomh.org>
parents: 3682
diff changeset
   427
   * \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
   428
   * \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
   429
   * \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
   430
   * payload contained in this packet.
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   431
   */
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
   432
  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
   433
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   434
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   435
   * Removes, from a packet of data, all headers and trailers that
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   436
   * relate to the packet type
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   437
   *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   438
   * \param p Packet whose headers need to be processed
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   439
   * \param param An integer parameter that can be set by the function
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   440
   * to return information gathered in the header
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   441
   * \return Returns true if the packet should be forwarded up the
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   442
   * protocol stack.
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   443
   */
1866
e7dbcc4df546 do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1494
diff changeset
   444
  bool ProcessHeader (Ptr<Packet> p, uint16_t & param);
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   445
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   446
private:
3476
b834a9204124 begin sorting out mtu woes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3460
diff changeset
   447
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
   448
  /**
ba198dad54a2 CSMA 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
   * 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
   450
   * operator for CsmaNetDevice objects.
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   451
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   452
   */
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
   453
  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
   454
ba198dad54a2 CSMA 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
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   456
   * 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
   457
   * copy constructor for CsmaNetDevice objects.
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   458
   */
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
   459
  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
   460
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   461
  /**
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
   462
   * Initialization function used during object construction.
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   463
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   464
  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
   465
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   466
  /**
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   467
   * 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
   468
   * setting the frame size to the given value.
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   469
   */
3682
cef8288d30ae fix bug 338, MTU overflows frameSize
Craig Dowell <craigdo@ee.washington.edu>
parents: 3632
diff changeset
   470
  uint32_t MtuFromFrameSize (uint32_t frameSize);
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   471
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   472
  /**
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   473
   * 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
   474
   * to be able to set the MTU to the given value.
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   475
   */
3682
cef8288d30ae fix bug 338, MTU overflows frameSize
Craig Dowell <craigdo@ee.washington.edu>
parents: 3632
diff changeset
   476
  uint32_t FrameSizeFromMtu (uint32_t mtu);
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   477
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   478
  /**
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   479
   * 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
   480
   *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   481
   * 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
   482
   * 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
   483
   * 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
   484
   * 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
   485
   * 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
   486
   * 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
   487
   * 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
   488
   *
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   489
   * 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
   490
   * 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
   491
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   492
   * \see CsmaChannel::TransmitStart ()
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   493
   * \see TransmitCompleteEvent ()
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
  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
   496
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   497
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   498
   * 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
   499
   *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   500
   * 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
   501
   * 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
   502
   * 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
   503
   * 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
   504
   * 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
   505
   * 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
   506
   * 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
   507
   * 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
   508
   * 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
   509
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   510
   * \see CsmaChannel::TransmitEnd ()
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   511
   * \see TransmitReadyEvent ()
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   512
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   513
  void 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
   514
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   515
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   516
   * 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
   517
   *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   518
   * 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
   519
   * 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
   520
   * 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
   521
   * 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
   522
   * 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
   523
   *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   524
   * 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
   525
   * 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
   526
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   527
   * \see TransmitStart ()
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   528
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   529
  void TransmitReadyEvent (void);
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
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   532
   * 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
   533
   *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   534
   * 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
   535
   * 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
   536
   * then the packet is dropped.
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   537
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   538
  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
   539
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   540
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   541
   * 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
   542
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   543
  void NotifyLinkUp (void);
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   544
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   545
  /** 
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   546
   * 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
   547
   * 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
   548
   * 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
   549
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   550
  uint32_t m_deviceId; 
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
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   553
   * 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
   554
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   555
  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
   556
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   557
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   558
   * 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
   559
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   560
  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
   561
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   562
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   563
   * 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
   564
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   565
  enum TxMachineState
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   566
    {
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   567
      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
   568
      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
   569
      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
   570
      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
   571
    };
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
   572
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
   * The state of the Net Device transmit state machine.
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   575
   * \see TxMachineState
977
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
  TxMachineState m_txMachineState;
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   578
  
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   579
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   580
   * 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
   581
   * 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
   582
   * function.
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   583
   */
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   584
  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
   585
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   586
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   587
   * 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
   588
   * timing.
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   589
   * \see class DataRate
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   590
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   591
  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
   592
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   593
  /**
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
   594
   * 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
   595
   * transmission
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   596
   * \see class Time
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
  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
   599
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   600
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   601
   * 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
   602
   * 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
   603
   * is ready to transmit
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
  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
   606
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   607
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   608
   * 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
   609
   * 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
   610
   * transmitted.
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   611
   */
1866
e7dbcc4df546 do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1494
diff changeset
   612
  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
   613
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   614
  /**
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
   615
   * 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
   616
   * attached.
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   617
   * \see class CsmaChannel
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
  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
   620
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   621
  /**
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
   622
   * 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
   623
   * 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
   624
   * and it has the responsibility for deletion.
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   625
   * \see class Queue
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   626
   * \see class DropTailQueue
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   627
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   628
  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
   629
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1494
diff changeset
   630
  /**
4263
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   631
   * 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
   632
   * 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
   633
   * 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
   634
   */
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1494
diff changeset
   635
  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
   636
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   637
  /**
4263
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   638
   * 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
   639
   * at the L3/L2 transition, before being queued for transmission.
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   640
   *
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   641
   * \see class CallBackTraceSource
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
  TracedCallback<Ptr<const Packet> > m_macTxTrace;
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   644
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
   * 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
   647
   * 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
   648
   *
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   649
   * \see class CallBackTraceSource
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
  TracedCallback<Ptr<const Packet> > m_macTxDropTrace;
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   652
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   653
  /**
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   654
   * 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
   655
   * 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
   656
   * transition).  This is a promiscuous trace.
b40ce56e0247 Add MacPromiscRx, make MacRx non-promisc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4264
diff changeset
   657
   *
b40ce56e0247 Add MacPromiscRx, make MacRx non-promisc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4264
diff changeset
   658
   * \see class CallBackTraceSource
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
  TracedCallback<Ptr<const Packet> > m_macPromiscRxTrace;
b40ce56e0247 Add MacPromiscRx, make MacRx non-promisc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4264
diff changeset
   661
b40ce56e0247 Add MacPromiscRx, make MacRx non-promisc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4264
diff changeset
   662
  /**
b40ce56e0247 Add MacPromiscRx, make MacRx non-promisc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4264
diff changeset
   663
   * 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
   664
   * 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
   665
   * transition).  This is a non-promiscuous trace.
4263
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   666
   *
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   667
   * \see class CallBackTraceSource
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   668
   */
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   669
  TracedCallback<Ptr<const Packet> > m_macRxTrace;
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   670
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   671
  /**
4264
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   672
   * 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
   673
   * 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
   674
   * transition).
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   675
   *
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   676
   * \see class CallBackTraceSource
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
  TracedCallback<Ptr<const Packet> > m_macRxDropTrace;
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   679
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   680
  /**
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   681
   * 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
   682
   * 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
   683
   * sequence is repeated with increasing delays.
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   684
   *
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   685
   * \see class CallBackTraceSource
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
  TracedCallback<Ptr<const Packet> > m_macTxBackoffTrace;
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   688
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   689
  /**
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   690
   * 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
   691
   * the medium.
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   692
   *
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   693
   * \see class CallBackTraceSource
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   694
   */
4264
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   695
  TracedCallback<Ptr<const Packet> > m_phyTxBeginTrace;
4263
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   696
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
   * 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
   699
   * the medium.
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   700
   *
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   701
   * \see class CallBackTraceSource
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   702
   */
4264
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   703
  TracedCallback<Ptr<const Packet> > m_phyTxEndTrace;
4263
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   704
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
   * 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
   707
   * to transmit it.
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   708
   *
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   709
   * \see class CallBackTraceSource
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   710
   */
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   711
  TracedCallback<Ptr<const Packet> > m_phyTxDropTrace;
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   712
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   713
  /**
4264
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   714
   * 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
   715
   * the medium.
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   716
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   717
   * \see class CallBackTraceSource
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   718
   */
4264
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   719
  TracedCallback<Ptr<const Packet> > m_phyRxBeginTrace;
4263
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   720
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
   * 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
   723
   * the medium.
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   724
   *
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   725
   * \see class CallBackTraceSource
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   726
   */
4264
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   727
  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
   728
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   729
  /**
4263
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   730
   * 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
   731
   *
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   732
   * \see class CallBackTraceSource
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
  TracedCallback<Ptr<const Packet> > m_phyRxDropTrace;
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   735
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   736
  /**
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   737
   * 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
   738
   * 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
   739
   * will not fire on PACKET_OTHERHOST events.
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   740
   *
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   741
   * 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
   742
   * 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
   743
   * 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
   744
   * 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
   745
   * ETH_P_ALL handlers.
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   746
   *
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   747
   * 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
   748
   * 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
   749
   * 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
   750
   * packet sniffers in netif_receive_skb.
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   751
   *
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   752
   * \see class CallBackTraceSource
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
  TracedCallback<Ptr<const Packet> > m_snifferTrace;
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   755
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   756
  /**
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   757
   * 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
   758
   * 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
   759
   * just like your average everyday packet sniffer.
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   760
   *
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   761
   * 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
   762
   * 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
   763
   * 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
   764
   * 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
   765
   * ETH_P_ALL handlers.
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   766
   *
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   767
   * 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
   768
   * 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
   769
   * 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
   770
   * packet sniffers in netif_receive_skb.
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   771
   *
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   772
   * \see class CallBackTraceSource
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   773
   */
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   774
  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
   775
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
   776
  /**
ba198dad54a2 CSMA 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
   * 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
   778
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   779
  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
   780
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   781
  /**
ba198dad54a2 CSMA 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
   * 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
   783
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   784
  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
   785
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   786
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   787
   * 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
   788
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   789
  NetDevice::ReceiveCallback m_rxCallback;
4263
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   790
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
   791
  /**
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
   792
   * 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
   793
   */
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
   794
  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
   795
ba198dad54a2 CSMA 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
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   797
   * 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
   798
   * 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
   799
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   800
  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
   801
ba198dad54a2 CSMA 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
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   803
   * 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
   804
   * 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
   805
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   806
  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
   807
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   808
  /**
ba198dad54a2 CSMA 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
   * Callback to fire if the link changes state (up or down).
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   810
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   811
  Callback<void> m_linkChangeCallback;
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   812
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   813
  static const uint16_t DEFAULT_FRAME_SIZE = 1518;
3630
0aa446f659d9 MTU, encap mode cleanup for csma
craigdo@ee.washington.edu
parents: 3629
diff changeset
   814
  static const uint16_t ETHERNET_OVERHEAD = 18;
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   815
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
   816
  /**
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   817
   * 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
   818
   * 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
   819
   * 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
   820
   */
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   821
  uint32_t m_frameSize;
3476
b834a9204124 begin sorting out mtu woes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3460
diff changeset
   822
b834a9204124 begin sorting out mtu woes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3460
diff changeset
   823
  /**
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   824
   * The Maxmimum Transmission Unit.  This corresponds to the maximum 
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   825
   * 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
   826
   * 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
   827
   * Ethernet.
3476
b834a9204124 begin sorting out mtu woes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3460
diff changeset
   828
   */
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   829
  uint32_t m_mtu;
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   830
};
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   831
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   832
}; // namespace ns3
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   833
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
   834
#endif // CSMA_NET_DEVICE_H