src/devices/csma/csma-net-device.h
author Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
Sat, 10 Apr 2010 13:45:09 -0700
changeset 6183 8a5e1f9db873
parent 6011 3fd7841b9c20
child 6273 8d70de29d514
permissions -rw-r--r--
[bug 822] Move Mtu attribute from NetDevice base class to subclasses
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
     2
/*
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
     3
 * Copyright (c) 2007 Emmanuelle Laprise
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
     4
 *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
     8
 *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    12
 * GNU General Public License for more details.
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    13
 *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    17
 *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    18
 * Author: Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    19
 */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    20
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
    21
#ifndef CSMA_NET_DEVICE_H
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
    22
#define CSMA_NET_DEVICE_H
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    23
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    24
#include <string.h>
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    25
#include "ns3/node.h"
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    26
#include "ns3/backoff.h"
1167
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 995
diff changeset
    27
#include "ns3/address.h"
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    28
#include "ns3/net-device.h"
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    29
#include "ns3/callback.h"
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    30
#include "ns3/packet.h"
2500
1fb9430f642d convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2470
diff changeset
    31
#include "ns3/traced-callback.h"
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    32
#include "ns3/nstime.h"
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    33
#include "ns3/data-rate.h"
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    34
#include "ns3/ptr.h"
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    35
#include "ns3/random-variable.h"
1494
c2985e1cd091 rename Euixx to Macxx
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1451
diff changeset
    36
#include "ns3/mac48-address.h"
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    37
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    38
namespace ns3 {
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    39
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    40
class Queue;
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
    41
class CsmaChannel;
1820
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1494
diff changeset
    42
class ErrorModel;
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    43
1403
0286b806eee1 add doxygen for each TraceSourceElement subclass
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1401
diff changeset
    44
/**
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
    45
 * \class CsmaNetDevice
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
    46
 * \brief A Device for a Csma Network Link.
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    47
 *
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
    48
 * The Csma net device class is analogous to layer 1 and 2 of the
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    49
 * TCP stack. The NetDevice takes a raw packet of bytes and creates a
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
    50
 * protocol specific packet from them. 
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    51
 */
2500
1fb9430f642d convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2470
diff changeset
    52
class CsmaNetDevice : public NetDevice 
1fb9430f642d convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2470
diff changeset
    53
{
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    54
public:
2500
1fb9430f642d convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2470
diff changeset
    55
  static TypeId GetTypeId (void);
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
    56
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    57
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    58
   * Enumeration of the types of packets supported in the class.
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    59
   */
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
    60
  enum EncapsulationMode {
3630
0aa446f659d9 MTU, encap mode cleanup for csma
craigdo@ee.washington.edu
parents: 3629
diff changeset
    61
    ILLEGAL,     /**< Encapsulation mode not set */
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
    62
    DIX,         /**< DIX II / Ethernet II packet */
3630
0aa446f659d9 MTU, encap mode cleanup for csma
craigdo@ee.washington.edu
parents: 3629
diff changeset
    63
    LLC,         /**< 802.2 LLC/SNAP Packet*/  
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
    64
  };
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    65
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    66
  /**
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
    67
   * Construct a CsmaNetDevice
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    68
   *
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
    69
   * This is the default constructor for a CsmaNetDevice.
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    70
   */
2500
1fb9430f642d convert CsmaNetDevice to Attributes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2470
diff changeset
    71
  CsmaNetDevice ();
1280
8c51afddffcb Doxygen cleanup
Tom Henderson <tomh@tomh.org>
parents: 1276
diff changeset
    72
8c51afddffcb Doxygen cleanup
Tom Henderson <tomh@tomh.org>
parents: 1276
diff changeset
    73
  /**
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
    74
   * Destroy a CsmaNetDevice
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    75
   *
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
    76
   * This is the destructor for a CsmaNetDevice.
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    77
   */
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
    78
  virtual ~CsmaNetDevice ();
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
    79
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    80
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    81
   * Set the inteframe gap used to separate packets.  The interframe gap
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    82
   * defines the minimum space required between packets sent by this device.
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
    83
   * As in Ethernet, it defaults to 96 bit times.
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    84
   *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    85
   * \param t the interframe gap time
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    86
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    87
  void SetInterframeGap (Time t);
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
    88
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    89
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    90
   * Set the backoff parameters used to determine the wait to retry
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    91
   * transmitting a packet when the channel is busy.
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    92
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
    93
   * \see Attach ()
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    94
   * \param slotTime Length of a packet slot (or average packet time)
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    95
   * \param minSlots Minimum number of slots to wait
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    96
   * \param maxSlots Maximum number of slots to wait
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    97
   * \param maxRetries Maximum number of retries before packet is discard
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    98
   * \param ceiling Cap on the exponential function when calculating max slots
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
    99
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   100
  void SetBackoffParams (Time slotTime, uint32_t minSlots, uint32_t maxSlots, 
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   101
    uint32_t maxRetries, uint32_t ceiling);
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   102
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   103
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   104
   * Attach the device to a channel.
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   105
   *
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   106
   * The function Attach is used to add a CsmaNetDevice to a CsmaChannel.
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   107
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   108
   * \see SetDataRate ()
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   109
   * \see SetInterframeGap ()
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   110
   * \param ch a pointer to the channel to which this object is being attached.
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   111
   */
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
   112
  bool Attach (Ptr<CsmaChannel> ch);
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   113
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   114
  /**
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
   115
   * Attach a queue to the CsmaNetDevice.
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   116
   *
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   117
   * The CsmaNetDevice "owns" a queue.  This queue may be set by higher
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   118
   * level topology objects to implement a particular queueing method such as
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   119
   * DropTail or RED.  
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   120
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   121
   * \see Queue
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   122
   * \see DropTailQueue
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   123
   * \param queue a Ptr to the queue for being assigned to the device.
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   124
   */
3011
2d507430219e bug 153 applied to CSMA
Craig Dowell <craigdo@ee.washington.edu>
parents: 2655
diff changeset
   125
  void SetQueue (Ptr<Queue> queue);
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   126
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   127
  /**
6011
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents: 5832
diff changeset
   128
   * Get a copy of the attached Queue.
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents: 5832
diff changeset
   129
   *
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents: 5832
diff changeset
   130
   * \return a pointer to the queue.
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents: 5832
diff changeset
   131
   */
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents: 5832
diff changeset
   132
  Ptr<Queue> GetQueue (void) const; 
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents: 5832
diff changeset
   133
3fd7841b9c20 ascii trace additions
Craig Dowell <craigdo@ee.washington.edu>
parents: 5832
diff changeset
   134
  /**
1820
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1494
diff changeset
   135
   * 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
   136
   *
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1494
diff changeset
   137
   * 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
   138
   * 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
   139
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   140
   * \see ErrorModel
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   141
   * \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
   142
   */
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
   143
  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
   144
1820
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1494
diff changeset
   145
  /**
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
   146
   * 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
   147
   *
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
   148
   * 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
   149
   * 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
   150
   * 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
   151
   * arrived at the device.
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   152
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   153
   * \see CsmaChannel
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   154
   * \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
   155
   * \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
   156
   */
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
   157
  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
   158
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
   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
   * 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
   161
   *
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   162
   * \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
   163
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   164
  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
   165
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   166
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   167
   * 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
   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
   * \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
   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
  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
   172
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   173
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   174
   * 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
   175
   *
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   176
   * \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
   177
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   178
  bool IsReceiveEnabled (void);
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   179
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   180
  /**
ba198dad54a2 CSMA 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
   * 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
   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
   * \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
   184
   */
ba198dad54a2 CSMA 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
  void SetReceiveEnable (bool enable);
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   186
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   187
  /**
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   188
   * Set the encapsulation mode of this device.
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   189
   *
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   190
   * \param mode The encapsulation mode of this device.
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   191
   *
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   192
   */
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   193
  void SetEncapsulationMode (CsmaNetDevice::EncapsulationMode mode);
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   194
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   195
  /**
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   196
   * Get the encapsulation mode of this device.
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   197
   *
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   198
   * \returns The encapsulation mode of this device.
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   199
   */
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   200
  CsmaNetDevice::EncapsulationMode  GetEncapsulationMode (void);
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   201
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   202
  //
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   203
  // 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
   204
  //
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
   205
  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
   206
  virtual uint32_t GetIfIndex (void) const;
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   207
  virtual Ptr<Channel> GetChannel (void) const;
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   208
  virtual bool SetMtu (const uint16_t mtu);
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   209
  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
   210
  virtual void SetAddress (Address address);
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   211
  virtual Address GetAddress (void) const;
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   212
  virtual bool IsLinkUp (void) const;
4764
e90e1ef585b0 [Bug 653] NetDevice link change callback (SetLinkChangeCallback -> AddLinkChangeCallback).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4578
diff changeset
   213
  virtual void AddLinkChangeCallback (Callback<void> callback);
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   214
  virtual bool IsBroadcast (void) const;
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   215
  virtual Address GetBroadcast (void) const;
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   216
  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
   217
1443
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   218
  /**
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   219
   * \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
   220
   *        multicast group
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   221
   *
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   222
   * 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
   223
   * 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
   224
   * 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
   225
   * 01-00-5E-00-00-00 (hex).
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   226
   *
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   227
   * This method performs the multicast address creation function appropriate
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   228
   * 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
   229
   *  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
   230
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   231
   * \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
   232
   * of the packet.
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   233
   * \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
   234
   * multicast group.
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   235
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   236
   * \see Ipv4Address
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   237
   * \see Mac48Address
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   238
   * \see Address
1443
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1280
diff changeset
   239
   */
3841
1e7abf5fca79 Apply Patch to address bug 294 -- due to vincent
Craig Dowell <craigdo@ee.washington.edu>
parents: 3698
diff changeset
   240
  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
   241
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   242
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   243
   * 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
   244
   * \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
   245
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   246
  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
   247
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   248
  /**
3936
e525995ce5dc implement IsBridged for net devices
Craig Dowell <craigdo@ee.washington.edu>
parents: 3852
diff changeset
   249
   * Is this a bridge?
e525995ce5dc implement IsBridged for net devices
Craig Dowell <craigdo@ee.washington.edu>
parents: 3852
diff changeset
   250
   * \returns false.
e525995ce5dc implement IsBridged for net devices
Craig Dowell <craigdo@ee.washington.edu>
parents: 3852
diff changeset
   251
   */
e525995ce5dc implement IsBridged for net devices
Craig Dowell <craigdo@ee.washington.edu>
parents: 3852
diff changeset
   252
  virtual bool IsBridge (void) const;
e525995ce5dc implement IsBridged for net devices
Craig Dowell <craigdo@ee.washington.edu>
parents: 3852
diff changeset
   253
e525995ce5dc implement IsBridged for net devices
Craig Dowell <craigdo@ee.washington.edu>
parents: 3852
diff changeset
   254
  /**
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
   255
   * Start sending a packet down the channel.
5227
ecb08c1fc273 Fix some doxygen warnings revealed by WARN_NO_PARAMDOC=YES in doc/doxygen.conf.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4764
diff changeset
   256
   * \param packet packet to send
ecb08c1fc273 Fix some doxygen warnings revealed by WARN_NO_PARAMDOC=YES in doc/doxygen.conf.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4764
diff changeset
   257
   * \param dest layer 2 destination address
ecb08c1fc273 Fix some doxygen warnings revealed by WARN_NO_PARAMDOC=YES in doc/doxygen.conf.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4764
diff changeset
   258
   * \param protocolNumber protocol number
ecb08c1fc273 Fix some doxygen warnings revealed by WARN_NO_PARAMDOC=YES in doc/doxygen.conf.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4764
diff changeset
   259
   * \return true if successfull, false otherwise (drop, ...)
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   260
   */
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   261
  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
   262
    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
   263
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   264
  /**
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
   265
   * Start sending a packet down the channel, with MAC spoofing
5227
ecb08c1fc273 Fix some doxygen warnings revealed by WARN_NO_PARAMDOC=YES in doc/doxygen.conf.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4764
diff changeset
   266
   * \param packet packet to send
ecb08c1fc273 Fix some doxygen warnings revealed by WARN_NO_PARAMDOC=YES in doc/doxygen.conf.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4764
diff changeset
   267
   * \param source layer 2 source address
ecb08c1fc273 Fix some doxygen warnings revealed by WARN_NO_PARAMDOC=YES in doc/doxygen.conf.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4764
diff changeset
   268
   * \param dest layer 2 destination address
ecb08c1fc273 Fix some doxygen warnings revealed by WARN_NO_PARAMDOC=YES in doc/doxygen.conf.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4764
diff changeset
   269
   * \param protocolNumber protocol number
ecb08c1fc273 Fix some doxygen warnings revealed by WARN_NO_PARAMDOC=YES in doc/doxygen.conf.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4764
diff changeset
   270
   * \return true if successfull, false otherwise (drop, ...)
3442
8eef02250bc9 Add a NetDevice::SendFrom API, for sending packets with a custom source MAC address (a.k.a. MAC spoofing). Only implemented for CsmaNetDevice for now.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3438
diff changeset
   271
   */
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
   272
  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
   273
                         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
   274
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
   275
  /**
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
   276
   * 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
   277
   *
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   278
   * \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
   279
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   280
  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
   281
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   282
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   283
   * 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
   284
   *
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   285
   * \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
   286
   */
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
   287
  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
   288
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   289
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   290
   * 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
   291
   *
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   292
   * \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
   293
   * 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
   294
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   295
  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
   296
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   297
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   298
   * 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
   299
   * 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
   300
   *
ba198dad54a2 CSMA 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
   * \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
   302
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   303
  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
   304
3852
9cf7ad0cac85 Initial IPv6 capability
vincent@clarinet.u-strasbg.fr
parents: 3841
diff changeset
   305
  /**
9cf7ad0cac85 Initial IPv6 capability
vincent@clarinet.u-strasbg.fr
parents: 3841
diff changeset
   306
   * \brief Get the MAC multicast address corresponding
9cf7ad0cac85 Initial IPv6 capability
vincent@clarinet.u-strasbg.fr
parents: 3841
diff changeset
   307
   * to the IPv6 address provided.
9cf7ad0cac85 Initial IPv6 capability
vincent@clarinet.u-strasbg.fr
parents: 3841
diff changeset
   308
   * \param addr IPv6 address
9cf7ad0cac85 Initial IPv6 capability
vincent@clarinet.u-strasbg.fr
parents: 3841
diff changeset
   309
   * \return the MAC multicast address
9cf7ad0cac85 Initial IPv6 capability
vincent@clarinet.u-strasbg.fr
parents: 3841
diff changeset
   310
   * \warning Calling this method is invalid if IsMulticast returns not true.
9cf7ad0cac85 Initial IPv6 capability
vincent@clarinet.u-strasbg.fr
parents: 3841
diff changeset
   311
   */
9cf7ad0cac85 Initial IPv6 capability
vincent@clarinet.u-strasbg.fr
parents: 3841
diff changeset
   312
  virtual Address GetMulticast (Ipv6Address addr) const;
9cf7ad0cac85 Initial IPv6 capability
vincent@clarinet.u-strasbg.fr
parents: 3841
diff changeset
   313
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
   314
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
   315
  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
   316
  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
   317
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   318
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
   319
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   320
   * 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
   321
   * 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
   322
   */
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   323
  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
   324
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
   325
  /**
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   326
   * 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
   327
   * respect the packet type
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   328
   *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   329
   * \param p Packet to which header should be added
3698
3251aa0de5c8 fix some Doxygen warnings
Tom Henderson <tomh@tomh.org>
parents: 3682
diff changeset
   330
   * \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
   331
   * \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
   332
   * \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
   333
   * payload contained in this packet.
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   334
   */
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
   335
  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
   336
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   337
private:
3476
b834a9204124 begin sorting out mtu woes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3460
diff changeset
   338
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
   339
  /**
ba198dad54a2 CSMA 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
   * 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
   341
   * operator for CsmaNetDevice objects.
5227
ecb08c1fc273 Fix some doxygen warnings revealed by WARN_NO_PARAMDOC=YES in doc/doxygen.conf.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4764
diff changeset
   342
   * \param o object to copy
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   343
   */
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
   344
  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
   345
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   346
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   347
   * 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
   348
   * copy constructor for CsmaNetDevice objects.
5227
ecb08c1fc273 Fix some doxygen warnings revealed by WARN_NO_PARAMDOC=YES in doc/doxygen.conf.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4764
diff changeset
   349
   * \param o object to copy
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   350
   */
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
   351
  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
   352
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   353
  /**
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
   354
   * Initialization function used during object construction.
5227
ecb08c1fc273 Fix some doxygen warnings revealed by WARN_NO_PARAMDOC=YES in doc/doxygen.conf.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4764
diff changeset
   355
   * \param sendEnable if device will be allowed to send
ecb08c1fc273 Fix some doxygen warnings revealed by WARN_NO_PARAMDOC=YES in doc/doxygen.conf.
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4764
diff changeset
   356
   * \param receiveEnable if device will be allowed to receive
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   357
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   358
  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
   359
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   360
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   361
   * 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
   362
   *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   363
   * 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
   364
   * 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
   365
   * 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
   366
   * 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
   367
   * 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
   368
   * 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
   369
   * 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
   370
   *
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   371
   * 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
   372
   * 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
   373
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   374
   * \see CsmaChannel::TransmitStart ()
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   375
   * \see TransmitCompleteEvent ()
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   376
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   377
  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
   378
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   379
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   380
   * 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
   381
   *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   382
   * 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
   383
   * 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
   384
   * 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
   385
   * 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
   386
   * 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
   387
   * 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
   388
   * 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
   389
   * 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
   390
   * 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
   391
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   392
   * \see CsmaChannel::TransmitEnd ()
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   393
   * \see TransmitReadyEvent ()
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   394
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   395
  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
   396
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   397
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   398
   * 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
   399
   *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   400
   * 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
   401
   * 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
   402
   * 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
   403
   * 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
   404
   * 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
   405
   *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   406
   * 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
   407
   * 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
   408
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   409
   * \see TransmitStart ()
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   410
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   411
  void TransmitReadyEvent (void);
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   412
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   413
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   414
   * 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
   415
   *
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   416
   * 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
   417
   * 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
   418
   * then the packet is dropped.
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
  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
   421
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   422
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   423
   * 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
   424
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   425
  void NotifyLinkUp (void);
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   426
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   427
  /** 
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   428
   * 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
   429
   * 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
   430
   * 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
   431
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   432
  uint32_t m_deviceId; 
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   433
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
   * 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
   436
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   437
  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
   438
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   439
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   440
   * 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
   441
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   442
  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
   443
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   444
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   445
   * 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
   446
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   447
  enum TxMachineState
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   448
    {
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   449
      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
   450
      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
   451
      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
   452
      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
   453
    };
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
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   455
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   456
   * The state of the Net Device transmit state machine.
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   457
   * \see TxMachineState
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   458
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   459
  TxMachineState m_txMachineState;
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   460
  
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   461
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   462
   * 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
   463
   * 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
   464
   * function.
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   465
   */
3506
cba7b2b80fe8 sort out various MTU options
Craig Dowell <craigdo@ee.washington.edu>
parents: 3504
diff changeset
   466
  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
   467
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   468
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   469
   * 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
   470
   * timing.
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   471
   * \see class DataRate
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   472
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   473
  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
   474
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   475
  /**
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
   476
   * 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
   477
   * transmission
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   478
   * \see class Time
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   479
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   480
  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
   481
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   482
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   483
   * 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
   484
   * 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
   485
   * is ready to transmit
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   486
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   487
  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
   488
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   489
  /**
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   490
   * 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
   491
   * 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
   492
   * transmitted.
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   493
   */
1866
e7dbcc4df546 do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1494
diff changeset
   494
  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
   495
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   496
  /**
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
   497
   * 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
   498
   * attached.
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   499
   * \see class CsmaChannel
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   500
   */
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
   501
  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
   502
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   503
  /**
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
   504
   * 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
   505
   * 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
   506
   * and it has the responsibility for deletion.
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   507
   * \see class Queue
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   508
   * \see class DropTailQueue
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   509
   */
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   510
  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
   511
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1494
diff changeset
   512
  /**
4263
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   513
   * 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
   514
   * 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
   515
   * 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
   516
   */
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1494
diff changeset
   517
  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
   518
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   519
  /**
4263
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   520
   * 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
   521
   * at the L3/L2 transition, before being queued for transmission.
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   522
   *
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   523
   * \see class CallBackTraceSource
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   524
   */
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   525
  TracedCallback<Ptr<const Packet> > m_macTxTrace;
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   526
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   527
  /**
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   528
   * 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
   529
   * 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
   530
   *
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   531
   * \see class CallBackTraceSource
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   532
   */
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   533
  TracedCallback<Ptr<const Packet> > m_macTxDropTrace;
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   534
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   535
  /**
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   536
   * 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
   537
   * 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
   538
   * transition).  This is a promiscuous trace.
b40ce56e0247 Add MacPromiscRx, make MacRx non-promisc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4264
diff changeset
   539
   *
b40ce56e0247 Add MacPromiscRx, make MacRx non-promisc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4264
diff changeset
   540
   * \see class CallBackTraceSource
b40ce56e0247 Add MacPromiscRx, make MacRx non-promisc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4264
diff changeset
   541
   */
b40ce56e0247 Add MacPromiscRx, make MacRx non-promisc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4264
diff changeset
   542
  TracedCallback<Ptr<const Packet> > m_macPromiscRxTrace;
b40ce56e0247 Add MacPromiscRx, make MacRx non-promisc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4264
diff changeset
   543
b40ce56e0247 Add MacPromiscRx, make MacRx non-promisc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4264
diff changeset
   544
  /**
b40ce56e0247 Add MacPromiscRx, make MacRx non-promisc
Craig Dowell <craigdo@ee.washington.edu>
parents: 4264
diff changeset
   545
   * 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
   546
   * 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
   547
   * transition).  This is a non-promiscuous trace.
4263
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   548
   *
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   549
   * \see class CallBackTraceSource
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   550
   */
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   551
  TracedCallback<Ptr<const Packet> > m_macRxTrace;
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   552
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   553
  /**
4264
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   554
   * 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
   555
   * 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
   556
   * transition).
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   557
   *
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   558
   * \see class CallBackTraceSource
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   559
   */
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   560
  TracedCallback<Ptr<const Packet> > m_macRxDropTrace;
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   561
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   562
  /**
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   563
   * 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
   564
   * 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
   565
   * sequence is repeated with increasing delays.
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   566
   *
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   567
   * \see class CallBackTraceSource
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   568
   */
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   569
  TracedCallback<Ptr<const Packet> > m_macTxBackoffTrace;
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   570
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   571
  /**
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   572
   * 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
   573
   * the medium.
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   574
   *
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   575
   * \see class CallBackTraceSource
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   576
   */
4264
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   577
  TracedCallback<Ptr<const Packet> > m_phyTxBeginTrace;
4263
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   578
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   579
  /**
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   580
   * 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
   581
   * the medium.
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   582
   *
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   583
   * \see class CallBackTraceSource
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   584
   */
4264
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   585
  TracedCallback<Ptr<const Packet> > m_phyTxEndTrace;
4263
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   586
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   587
  /**
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   588
   * 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
   589
   * to transmit it.
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   590
   *
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   591
   * \see class CallBackTraceSource
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   592
   */
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   593
  TracedCallback<Ptr<const Packet> > m_phyTxDropTrace;
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   594
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   595
  /**
4264
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   596
   * 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
   597
   * the medium.
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   598
   *
3504
0261c789e17e 128 column pages
Craig Dowell <craigdo@ee.washington.edu>
parents: 3476
diff changeset
   599
   * \see class CallBackTraceSource
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   600
   */
4264
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   601
  TracedCallback<Ptr<const Packet> > m_phyRxBeginTrace;
4263
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   602
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   603
  /**
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   604
   * 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
   605
   * the medium.
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   606
   *
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   607
   * \see class CallBackTraceSource
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   608
   */
4264
9d2e96c4e6e4 Piles of changes for tracing rework
Craig Dowell <craigdo@ee.washington.edu>
parents: 4263
diff changeset
   609
  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
   610
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   611
  /**
4263
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   612
   * 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
   613
   *
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   614
   * \see class CallBackTraceSource
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   615
   */
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   616
  TracedCallback<Ptr<const Packet> > m_phyRxDropTrace;
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   617
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   618
  /**
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   619
   * 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
   620
   * 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
   621
   * will not fire on PACKET_OTHERHOST events.
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   622
   *
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   623
   * 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
   624
   * 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
   625
   * 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
   626
   * 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
   627
   * ETH_P_ALL handlers.
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   628
   *
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   629
   * 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
   630
   * 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
   631
   * 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
   632
   * packet sniffers in netif_receive_skb.
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   633
   *
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   634
   * \see class CallBackTraceSource
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   635
   */
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   636
  TracedCallback<Ptr<const Packet> > m_snifferTrace;
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   637
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   638
  /**
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   639
   * 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
   640
   * 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
   641
   * just like your average everyday packet sniffer.
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
   * 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
   644
   * 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
   645
   * 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
   646
   * 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
   647
   * ETH_P_ALL handlers.
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
   * 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
   650
   * 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
   651
   * 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
   652
   * packet sniffers in netif_receive_skb.
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
   * \see class CallBackTraceSource
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   655
   */
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   656
  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
   657
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
   658
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   659
   * 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
   660
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   661
  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
   662
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   663
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   664
   * 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
   665
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   666
  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
   667
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   668
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   669
   * 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
   670
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   671
  NetDevice::ReceiveCallback m_rxCallback;
4263
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3936
diff changeset
   672
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
   673
  /**
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
   674
   * 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
   675
   */
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
   676
  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
   677
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   678
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   679
   * 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
   680
   * 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
   681
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   682
  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
   683
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   684
  /**
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   685
   * 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
   686
   * 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
   687
   */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   688
  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
   689
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   690
  /**
4764
e90e1ef585b0 [Bug 653] NetDevice link change callback (SetLinkChangeCallback -> AddLinkChangeCallback).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4578
diff changeset
   691
   * List of callbacks to fire if the link changes state (up or down).
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   692
   */
4764
e90e1ef585b0 [Bug 653] NetDevice link change callback (SetLinkChangeCallback -> AddLinkChangeCallback).
Sebastien Vincent <vincent@clarinet.u-strasbg.fr>
parents: 4578
diff changeset
   693
  TracedCallback<> m_linkChangeCallbacks;
3257
ba198dad54a2 CSMA Cleanup, XXX in echo apps, clarification of point-to-point data rates in dox
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
   694
6183
8a5e1f9db873 [bug 822] Move Mtu attribute from NetDevice base class to subclasses
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 6011
diff changeset
   695
  static const uint16_t DEFAULT_MTU = 1500;
3476
b834a9204124 begin sorting out mtu woes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3460
diff changeset
   696
b834a9204124 begin sorting out mtu woes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3460
diff changeset
   697
  /**
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   698
   * The Maxmimum Transmission Unit.  This corresponds to the maximum 
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   699
   * 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
   700
   * 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
   701
   * Ethernet.
3476
b834a9204124 begin sorting out mtu woes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3460
diff changeset
   702
   */
3629
367ae1cba60f further cleanup of MTU in CSMA
craigdo@ee.washington.edu
parents: 3584
diff changeset
   703
  uint32_t m_mtu;
977
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   704
};
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   705
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   706
}; // namespace ns3
09bf4e458015 a csma/cd NetDevice subclass and a test script
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents:
diff changeset
   707
1276
e0b88ec7a6be merge ns-3-csma with tip
Craig Dowell <craigdo@ee.washington.edu>
parents: 1270
diff changeset
   708
#endif // CSMA_NET_DEVICE_H