src/devices/point-to-point/point-to-point-net-device.h
author craigdo@ns-test
Fri, 05 Sep 2008 15:18:20 -0700
changeset 3632 aa1fb0f43571
parent 3584 4eb48239b4dc
child 3682 cef8288d30ae
permissions -rw-r--r--
apply MTU/FrameSize treatment to point-to-point
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
368
1df1165d6a68 Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents: 345
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
1df1165d6a68 Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents: 345
diff changeset
     2
/*
3086
5370849d0b76 ppp model description
Craig Dowell <craigdo@ee.washington.edu>
parents: 3021
diff changeset
     3
 * Copyright (c) 2007, 2008 University of Washington
368
1df1165d6a68 Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents: 345
diff changeset
     4
 *
1df1165d6a68 Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents: 345
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
1df1165d6a68 Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents: 345
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
1df1165d6a68 Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents: 345
diff changeset
     7
 * published by the Free Software Foundation;
1df1165d6a68 Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents: 345
diff changeset
     8
 *
1df1165d6a68 Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents: 345
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
1df1165d6a68 Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents: 345
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
1df1165d6a68 Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents: 345
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1df1165d6a68 Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents: 345
diff changeset
    12
 * GNU General Public License for more details.
1df1165d6a68 Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents: 345
diff changeset
    13
 *
1df1165d6a68 Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents: 345
diff changeset
    14
 * You should have received a copy of the GNU General Public License
1df1165d6a68 Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents: 345
diff changeset
    15
 * along with this program; if not, write to the Free Software
1df1165d6a68 Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents: 345
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
1df1165d6a68 Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents: 345
diff changeset
    17
 */
245
28ba3a5cdff8 add p2p netdevice and channel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    18
369
29ea5d1a83c8 Rename classes from Serial to PointToPoint
Tom Henderson <tomh@tomh.org>
parents: 368
diff changeset
    19
#ifndef POINT_TO_POINT_NET_DEVICE_H
29ea5d1a83c8 Rename classes from Serial to PointToPoint
Tom Henderson <tomh@tomh.org>
parents: 368
diff changeset
    20
#define POINT_TO_POINT_NET_DEVICE_H
245
28ba3a5cdff8 add p2p netdevice and channel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    21
368
1df1165d6a68 Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents: 345
diff changeset
    22
#include <string.h>
1167
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 996
diff changeset
    23
#include "ns3/address.h"
729
b5e744285e92 rename i-node to node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 728
diff changeset
    24
#include "ns3/node.h"
331
d75ee9d8efa4 move p2p to new dir
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 252
diff changeset
    25
#include "ns3/net-device.h"
368
1df1165d6a68 Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents: 345
diff changeset
    26
#include "ns3/callback.h"
1df1165d6a68 Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents: 345
diff changeset
    27
#include "ns3/packet.h"
2502
50d0da37f02f introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2470
diff changeset
    28
#include "ns3/traced-callback.h"
378
32bd402ea5ea remove unused files, remove notion of PHY, make more realistic p2p-net-device and p2p-channel
Craig Dowell
parents: 369
diff changeset
    29
#include "ns3/nstime.h"
32bd402ea5ea remove unused files, remove notion of PHY, make more realistic p2p-net-device and p2p-channel
Craig Dowell
parents: 369
diff changeset
    30
#include "ns3/data-rate.h"
543
a730800a31d5 Node* -> Ptr<Node>
Raj Bhattacharjea <raj.b@gatech.edu>
parents: 517
diff changeset
    31
#include "ns3/ptr.h"
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
    32
#include "ns3/mac48-address.h"
245
28ba3a5cdff8 add p2p netdevice and channel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    33
28ba3a5cdff8 add p2p netdevice and channel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    34
namespace ns3 {
28ba3a5cdff8 add p2p netdevice and channel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    35
402
f47285751901 add NetDevice::GetChannel method and doxygen-document it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 379
diff changeset
    36
class Queue;
369
29ea5d1a83c8 Rename classes from Serial to PointToPoint
Tom Henderson <tomh@tomh.org>
parents: 368
diff changeset
    37
class PointToPointChannel;
1820
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1793
diff changeset
    38
class ErrorModel;
245
28ba3a5cdff8 add p2p netdevice and channel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    39
1403
0286b806eee1 add doxygen for each TraceSourceElement subclass
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1401
diff changeset
    40
/**
414
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
    41
 * \class PointToPointNetDevice
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
    42
 * \brief A Device for a Point to Point Network Link.
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
    43
 *
1793
20bd909c62b5 some cleanup of point-to-point-net-device.h
Tom Henderson <tomh@tomh.org>
parents: 1412
diff changeset
    44
 * This PointToPointNetDevice class specializes the NetDevice abstract
20bd909c62b5 some cleanup of point-to-point-net-device.h
Tom Henderson <tomh@tomh.org>
parents: 1412
diff changeset
    45
 * base class.  Together with a PointToPointChannel (and a peer 
20bd909c62b5 some cleanup of point-to-point-net-device.h
Tom Henderson <tomh@tomh.org>
parents: 1412
diff changeset
    46
 * PointToPointNetDevice), the class models, with some level of 
20bd909c62b5 some cleanup of point-to-point-net-device.h
Tom Henderson <tomh@tomh.org>
parents: 1412
diff changeset
    47
 * abstraction, a generic point-to-point or serial link.  
20bd909c62b5 some cleanup of point-to-point-net-device.h
Tom Henderson <tomh@tomh.org>
parents: 1412
diff changeset
    48
 * Key parameters or objects that can be specified for this device 
20bd909c62b5 some cleanup of point-to-point-net-device.h
Tom Henderson <tomh@tomh.org>
parents: 1412
diff changeset
    49
 * include a queue, data rate, and interframe transmission gap (the 
20bd909c62b5 some cleanup of point-to-point-net-device.h
Tom Henderson <tomh@tomh.org>
parents: 1412
diff changeset
    50
 * propagation delay is set in the PointToPointChannel).
409
1cbb9ed862d0 add empty template for doxygen doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 402
diff changeset
    51
 */
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
    52
class PointToPointNetDevice : public NetDevice 
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
    53
{
245
28ba3a5cdff8 add p2p netdevice and channel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    54
public:
2502
50d0da37f02f introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2470
diff changeset
    55
  static TypeId GetTypeId (void);
50d0da37f02f introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2470
diff changeset
    56
414
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
    57
  /**
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
    58
   * Construct a PointToPointNetDevice
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
    59
   *
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
    60
   * This is the constructor for the PointToPointNetDevice.  It takes as a
1793
20bd909c62b5 some cleanup of point-to-point-net-device.h
Tom Henderson <tomh@tomh.org>
parents: 1412
diff changeset
    61
   * parameter a pointer to the Node to which this device is connected, 
20bd909c62b5 some cleanup of point-to-point-net-device.h
Tom Henderson <tomh@tomh.org>
parents: 1412
diff changeset
    62
   * as well as an optional DataRate object.
414
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
    63
   */
2502
50d0da37f02f introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2470
diff changeset
    64
  PointToPointNetDevice ();
3181
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
    65
414
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
    66
  /**
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
    67
   * Destroy a PointToPointNetDevice
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
    68
   *
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
    69
   * This is the destructor for the PointToPointNetDevice.
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
    70
   */
1793
20bd909c62b5 some cleanup of point-to-point-net-device.h
Tom Henderson <tomh@tomh.org>
parents: 1412
diff changeset
    71
  virtual ~PointToPointNetDevice ();
3181
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
    72
414
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
    73
  /**
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
    74
   * Set the Data Rate used for transmission of packets.  The data rate is
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
    75
   * set in the Attach () method from the corresponding field in the channel
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
    76
   * to which the device is attached.  It can be overridden using this method.
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
    77
   *
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
    78
   * @see Attach ()
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
    79
   * @param bps the data rate at which this object operates
409
1cbb9ed862d0 add empty template for doxygen doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 402
diff changeset
    80
   */
3181
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
    81
  void SetDataRate (DataRate bps);
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
    82
414
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
    83
  /**
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
    84
   * Set the inteframe gap used to separate packets.  The interframe gap
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
    85
   * defines the minimum space required between packets sent by this device.
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
    86
   *
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
    87
   * @param t the interframe gap time
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
    88
   */
3181
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
    89
  void SetInterframeGap (Time t);
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
    90
414
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
    91
  /**
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
    92
   * Attach the device to a channel.
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
    93
   *
3181
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
    94
   * @param ch Ptr to the channel to which this object is being attached.
414
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
    95
   */
1793
20bd909c62b5 some cleanup of point-to-point-net-device.h
Tom Henderson <tomh@tomh.org>
parents: 1412
diff changeset
    96
  bool Attach (Ptr<PointToPointChannel> ch);
3181
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
    97
414
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
    98
  /**
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
    99
   * Attach a queue to the PointToPointNetDevice.
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   100
   *
3181
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
   101
   * The PointToPointNetDevice "owns" a queue that implements a queueing 
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
   102
   * method such as DropTail or RED.  
414
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   103
   *
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   104
   * @see Queue
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   105
   * @see DropTailQueue
3181
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
   106
   * @param queue Ptr to the new queue.
414
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   107
   */
3010
ad669f4f7e58 bug 153
Craig Dowell <craigdo@ee.washington.edu>
parents: 2655
diff changeset
   108
  void SetQueue (Ptr<Queue> queue);
3181
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
   109
414
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   110
  /**
1820
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1793
diff changeset
   111
   * Attach a receive ErrorModel to the PointToPointNetDevice.
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1793
diff changeset
   112
   *
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1793
diff changeset
   113
   * The PointToPointNetDevice may optionally include an ErrorModel in
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1793
diff changeset
   114
   * the packet receive chain.
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1793
diff changeset
   115
   *
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1793
diff changeset
   116
   * @see ErrorModel
3181
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
   117
   * @param em Ptr to the ErrorModel.
1820
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1793
diff changeset
   118
   */
3010
ad669f4f7e58 bug 153
Craig Dowell <craigdo@ee.washington.edu>
parents: 2655
diff changeset
   119
  void SetReceiveErrorModel(Ptr<ErrorModel> em);
3181
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
   120
1820
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1793
diff changeset
   121
  /**
414
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   122
   * Receive a packet from a connected PointToPointChannel.
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   123
   *
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   124
   * The PointToPointNetDevice receives packets from its connected channel
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   125
   * and forwards them up the protocol stack.  This is the public method
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   126
   * used by the channel to indicate that the last bit of a packet has 
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   127
   * arrived at the device.
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   128
   *
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   129
   * @see PointToPointChannel
3181
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
   130
   * @param p Ptr to the received packet.
414
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   131
   */
1866
e7dbcc4df546 do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1412
diff changeset
   132
  void Receive (Ptr<Packet> p);
1793
20bd909c62b5 some cleanup of point-to-point-net-device.h
Tom Henderson <tomh@tomh.org>
parents: 1412
diff changeset
   133
3181
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
   134
  /**
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
   135
   * Assign a MAC address to this device.
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
   136
   *
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
   137
   * @see Mac48Address
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
   138
   * @param addr The new address.
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
   139
   */
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
   140
  void SetAddress (Mac48Address addr);
2655
a71d888ca2e8 add SetAddress methods.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2600
diff changeset
   141
3632
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   142
  /**
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   143
   * Set The max frame size of packets sent over this device.
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   144
   *
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   145
   * Okay, that was easy to say, but the details are a bit thorny.  We have a MAC-level MTU that is the payload that higher 
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   146
   * level protocols see.  We have a PHY-level MTU which is the maximum number of bytes we can send over the link 
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   147
   * (cf. 1500 bytes for Ethernet).  We also have a frame size which is some total number of bytes in a packet which could
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   148
   * or could not include any framing and overhead.  There can be a lot of inconsistency in definitions of these terms.  For
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   149
   * example, RFC 1042 asserts that the terms maximum transmission unit and maximum packet size are equivalent.  RFC 791, 
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   150
   * however, defines MTU as the maximum sized IP datagram that can be sent.  Packet size and frame size are sometimes
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   151
   * used interchangeably.
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   152
   *
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   153
   * So, some careful definitions are in order to avoid confusion:
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   154
   *
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   155
   * In real serial channel (HDLC, for example), the wire idles (sends all ones) until the channel begins sending a packet.
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   156
   * A frame on the wire starts with a flag character (01111110).  This is followed by what is usually called the packet: 
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   157
   * address, control, payload, and a Frame Check Sequence (FCS).  This is followed by another flag character.  If the flag
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   158
   * characters are used, then bit stuffing must be used to prevent flag characters from appearing in the packet and confusing
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   159
   * the link.  Som to be strictly and pedantically correct the frame size is then necessarily larger than the packet size on 
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   160
   * a real link.  But, this isn't a real link, it's a simulation of a device similar to a point-to-point device, and we have
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   161
   * no good reason to add framing bits and therefore to do bit-stuffing.  So, in the case of the point-to-point device, the 
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   162
   * frame size is equal to the packet size.  Since these two values are defined to be equal, there is no danger in assuming
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   163
   * they are identical.  We define packet size to be equal to frame size and this excludes the flag characters.  We define a 
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   164
   * single (MAC-level) MTU that coresponds to the payload size of the packet, which is the IP-centric view of the term as
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   165
   * seen in RFC 791.
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   166
   *
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   167
   * To make this concrete, consider PPP framing on a synchronous link.  In this framing scheme, a real serial frame on the 
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   168
   * wire starts with a flag character, address and control characters, then a 16-bit PPP protocol ID (0x21 = IP).  Then we 
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   169
   * would see the actual payload we are supposed to send, presumably an IP datagram.  At then we see the FCS and finally 
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   170
   * another flag character to end the frame.  We ignore the flag bits on this device since it they are not needed.  We 
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   171
   * aren't really using HDLC to send frames across the link, so we don't need the address and control bits either.  In fact,
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   172
   * to encapsulate using unframed PPP all we need to do is prepend the two-byte protocol ID.
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   173
   *
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   174
   * Typically the limiting factor in frame size is due to hardware limitations in the underlying HDLC controller receive 
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   175
   * FIFO buffer size.  This number can vary widely.  For example, the Motorola MC92460 has a 64 KByte maximum frame size; 
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   176
   * the Intel IXP4XX series has a 16 KByte size.  Older USARTs have a maximum frame size around 2KBytes, and typical PPP
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   177
   * links on the Internet have their MTU set to 1500 bytes since this is what will typically be used on Ethernet segments
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   178
   * and will avoid path MTU issues.  We choose to make the default MTU 1500 bytes which then fixes the maximum frame size
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   179
   * as described below.
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   180
   *
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   181
   * So, there are really two related variables at work here.  There is the maximum frame size that can be sent over the
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   182
   * link and there is the MTU.
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   183
   *
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   184
   * So, what do we do since these values must always be consistent in the driver?  We want to actually allow a user to change 
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   185
   * these variables, but we want the results (even at intermediate stages of her ultimate change) to be consistent.  We 
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   186
   * certainly don't want to require that users must understand the details of PPP encapsulation in order to set these 
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   187
   * variables.
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   188
   *
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   189
   * Consider the following situation:  A user wants to set the maximum frame size to 16 KBytes.  This user shouldn't have to
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   190
   * concern herself that the PPP encapsulation will consume six bytes.  She should not have to figure out that the MTU needs
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   191
   * to be set to 16K - 2 bytes to make things consistent.
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   192
   *
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   193
   * Similarly, a user who is interested in setting the MTU to 1500 bytes should not be forced to understand that the frame 
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   194
   * size will need to be set to 1502 bytes. 
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   195
   *
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   196
   * We could play games trying to figure out what the user wants to do, but that is typically a bad plan and programmers
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   197
   * have a long and distinguished history of guessing wrong.  We'll avoid all of that and just define a flexible behavior
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   198
   * that can be worked to get what you want.  Here it is:
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   199
   *
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   200
   * - If the user is changing the MTU, she is interested in getting that part of the system set, so the frame size
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   201
   * will be changed to make it consistent;
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   202
   *
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   203
   * - If the user is changing the frame size, he is interested in getting that part of the system set, so the MTU
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   204
   * will be changed to make it consistent;
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   205
   *
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   206
   * - You cannot define the MTU and frame size separately -- they are always tied together by the overhead of the PPP 
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   207
   * encapsulation.  This is not a restriction.  Consider what this means.  Perhaps you want to set the frame size to some 
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   208
   * large number and the MTU to some small number.  The largest packet you can send is going to be limited by the MTU, so it
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   209
   * is not possible to send a frame larger than the MTU plus overhead.  Having the ability to set a  larger frame size is not
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   210
   * useful.
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   211
   * 
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   212
   * So, if a user calls SetFrameSize, we assume that the maximum frame size is the interesting thing for that user and
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   213
   * we just adjust the MTU to a new "correct value" based on the current encapsulation mode.  If a user calls SetMtu, we 
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   214
   * assume that the MTU is the interesting property for that user, and we adjust the frame size to a new "correct value" 
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   215
   * for the current encapsulation mode.  If a user calls SetEncapsulationMode, then we take the MTU as the free variable 
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   216
   * and set its value to match the current frame size.
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   217
   *
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   218
   * \param frameSize The max frame size of packets sent over this device.
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   219
   */
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   220
  void SetFrameSize (uint16_t frameSize);
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   221
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   222
  /**
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   223
   * Get The max frame size of packets sent over this device.
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   224
   *
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   225
   * \returns The max frame size of packets sent over this device.
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   226
   */
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   227
  uint16_t GetFrameSize (void) const;
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   228
3181
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
   229
//
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
   230
// Pure virtual methods inherited from NetDevice we must implement.
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
   231
//
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   232
  virtual void SetName(const std::string name);
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   233
  virtual std::string GetName(void) const;
3181
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
   234
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   235
  virtual void SetIfIndex(const uint32_t index);
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   236
  virtual uint32_t GetIfIndex(void) const;
3181
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
   237
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   238
  virtual Ptr<Channel> GetChannel (void) const;
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   239
  virtual Address GetAddress (void) const;
3181
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
   240
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   241
  virtual bool SetMtu (const uint16_t mtu);
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   242
  virtual uint16_t GetMtu (void) const;
3181
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
   243
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   244
  virtual bool IsLinkUp (void) const;
3181
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
   245
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   246
  virtual void SetLinkChangeCallback (Callback<void> callback);
3181
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
   247
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   248
  virtual bool IsBroadcast (void) const;
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   249
  virtual Address GetBroadcast (void) const;
3181
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
   250
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   251
  virtual bool IsMulticast (void) const;
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   252
  virtual Address GetMulticast (void) const;
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   253
  virtual Address MakeMulticastAddress (Ipv4Address multicastGroup) const;
3181
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
   254
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   255
  virtual bool IsPointToPoint (void) const;
3181
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
   256
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: 3435
diff changeset
   257
  virtual bool Send(Ptr<Packet> packet, const Address &dest, 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: 3435
diff changeset
   258
  virtual bool SendFrom(Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber);
3181
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
   259
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   260
  virtual Ptr<Node> GetNode (void) const;
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: 2502
diff changeset
   261
  virtual void SetNode (Ptr<Node> node);
3181
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
   262
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   263
  virtual bool NeedsArp (void) const;
3181
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
   264
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   265
  virtual void SetReceiveCallback (NetDevice::ReceiveCallback cb);
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   266
3480
a920df6b9f02 Make the new NetDevice APIs pure virtual methods, by Mathieu's insistence.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3448
diff changeset
   267
  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: 3480
diff changeset
   268
  virtual bool SupportsSendFrom (void) const;
3480
a920df6b9f02 Make the new NetDevice APIs pure virtual methods, by Mathieu's insistence.
Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
parents: 3448
diff changeset
   269
1793
20bd909c62b5 some cleanup of point-to-point-net-device.h
Tom Henderson <tomh@tomh.org>
parents: 1412
diff changeset
   270
private:
20bd909c62b5 some cleanup of point-to-point-net-device.h
Tom Henderson <tomh@tomh.org>
parents: 1412
diff changeset
   271
517
702e96b8960f finish Dispose -> DoDispose rework
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 465
diff changeset
   272
  virtual void DoDispose (void);
3181
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
   273
414
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   274
  /**
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   275
   * Get a copy of the attached Queue.
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   276
   *
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   277
   * This method is provided for any derived class that may need to get
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   278
   * direct access to the underlying queue.
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   279
   *
3181
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
   280
   * @returns Ptr to the queue.
414
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   281
   */
581
15240a33f517 make Queue derive from Interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 568
diff changeset
   282
  Ptr<Queue> GetQueue(void) const; 
1793
20bd909c62b5 some cleanup of point-to-point-net-device.h
Tom Henderson <tomh@tomh.org>
parents: 1412
diff changeset
   283
368
1df1165d6a68 Rename file names from serial to p2p
Tom Henderson <tomh@tomh.org>
parents: 345
diff changeset
   284
private:
975
98233c6c9c2e Move LLC encapsulation from NetDevice to subclasses.
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents: 973
diff changeset
   285
  /**
3632
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   286
   * Calculate the value for the MTU that would result from 
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   287
   * setting the frame size to the given value.
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   288
   */
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   289
  uint16_t MtuFromFrameSize (uint16_t frameSize);
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   290
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   291
  /**
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   292
   * Calculate the value for the frame size that would be required
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   293
   * to be able to set the MTU to the given value.
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   294
   */
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   295
  uint16_t FrameSizeFromMtu (uint16_t mtu);
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   296
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   297
  /**
3584
4eb48239b4dc bug 274: bridge must detect compatibility of devices with bridging mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3480
diff changeset
   298
   * \returns the address of the remote device connected to this device
4eb48239b4dc bug 274: bridge must detect compatibility of devices with bridging mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3480
diff changeset
   299
   * through the point to point channel.
4eb48239b4dc bug 274: bridge must detect compatibility of devices with bridging mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3480
diff changeset
   300
   */
4eb48239b4dc bug 274: bridge must detect compatibility of devices with bridging mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3480
diff changeset
   301
  Address GetRemote (void) const;
3632
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   302
3584
4eb48239b4dc bug 274: bridge must detect compatibility of devices with bridging mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3480
diff changeset
   303
  /**
975
98233c6c9c2e Move LLC encapsulation from NetDevice to subclasses.
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents: 973
diff changeset
   304
   * Adds the necessary headers and trailers to a packet of data in order to
98233c6c9c2e Move LLC encapsulation from NetDevice to subclasses.
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents: 973
diff changeset
   305
   * respect the protocol implemented by the agent.
98233c6c9c2e Move LLC encapsulation from NetDevice to subclasses.
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents: 973
diff changeset
   306
   */
1866
e7dbcc4df546 do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1412
diff changeset
   307
  void AddHeader(Ptr<Packet> p, uint16_t protocolNumber);
3181
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
   308
975
98233c6c9c2e Move LLC encapsulation from NetDevice to subclasses.
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents: 973
diff changeset
   309
  /**
98233c6c9c2e Move LLC encapsulation from NetDevice to subclasses.
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents: 973
diff changeset
   310
   * Removes, from a packet of data, all headers and trailers that
98233c6c9c2e Move LLC encapsulation from NetDevice to subclasses.
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents: 973
diff changeset
   311
   * relate to the protocol implemented by the agent
98233c6c9c2e Move LLC encapsulation from NetDevice to subclasses.
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents: 973
diff changeset
   312
   * \return Returns true if the packet should be forwarded up the
98233c6c9c2e Move LLC encapsulation from NetDevice to subclasses.
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents: 973
diff changeset
   313
   * protocol stack.
98233c6c9c2e Move LLC encapsulation from NetDevice to subclasses.
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents: 973
diff changeset
   314
   */
1866
e7dbcc4df546 do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1412
diff changeset
   315
  bool ProcessHeader(Ptr<Packet> p, uint16_t& param);
3181
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
   316
414
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   317
  /**
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   318
   * Start Sending a Packet Down the Wire.
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   319
   *
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   320
   * The TransmitStart method is the method that is used internally in the
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   321
   * PointToPointNetDevice to begin the process of sending a packet out on
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   322
   * the channel.  The corresponding method is called on the channel to let
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   323
   * it know that the physical device this class represents has virually
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   324
   * started sending signals.  An event is scheduled for the time at which
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   325
   * the bits have been completely transmitted.
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   326
   *
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   327
   * @see PointToPointChannel::TransmitStart ()
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   328
   * @see TransmitCompleteEvent ()
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   329
   * @param p a reference to the packet to send
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   330
   * @returns true if success, false on failure
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   331
   */
1866
e7dbcc4df546 do not use Packet objects directly. Use Ptr<Packet> instead
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1412
diff changeset
   332
  bool TransmitStart (Ptr<Packet> p);
3181
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
   333
414
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   334
  /**
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   335
   * Stop Sending a Packet Down the Wire and Begin the Interframe Gap.
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   336
   *
926
1fdec986d774 Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents: 773
diff changeset
   337
   * The TransmitComplete method is used internally to finish the process
1fdec986d774 Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents: 773
diff changeset
   338
   * of sending a packet out on the channel.
414
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   339
   */
926
1fdec986d774 Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents: 773
diff changeset
   340
  void TransmitComplete(void);
3181
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
   341
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   342
  void NotifyLinkUp (void);
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   343
414
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   344
  /**
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   345
   * Enumeration of the states of the transmit machine of the net device.
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   346
   */
378
32bd402ea5ea remove unused files, remove notion of PHY, make more realistic p2p-net-device and p2p-channel
Craig Dowell
parents: 369
diff changeset
   347
  enum TxMachineState
32bd402ea5ea remove unused files, remove notion of PHY, make more realistic p2p-net-device and p2p-channel
Craig Dowell
parents: 369
diff changeset
   348
    {
414
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   349
      READY, /**< The transmitter is ready to begin transmission of a packet */
926
1fdec986d774 Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents: 773
diff changeset
   350
      BUSY   /**< The transmitter is busy transmitting a packet */
378
32bd402ea5ea remove unused files, remove notion of PHY, make more realistic p2p-net-device and p2p-channel
Craig Dowell
parents: 369
diff changeset
   351
    };
414
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   352
  /**
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   353
   * The state of the Net Device transmit state machine.
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   354
   * @see TxMachineState
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   355
   */
378
32bd402ea5ea remove unused files, remove notion of PHY, make more realistic p2p-net-device and p2p-channel
Craig Dowell
parents: 369
diff changeset
   356
  TxMachineState m_txMachineState;
3181
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
   357
414
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   358
  /**
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   359
   * The data rate that the Net Device uses to simulate packet transmission
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   360
   * timing.
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   361
   * @see class DataRate
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   362
   */
378
32bd402ea5ea remove unused files, remove notion of PHY, make more realistic p2p-net-device and p2p-channel
Craig Dowell
parents: 369
diff changeset
   363
  DataRate       m_bps;
3181
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
   364
414
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   365
  /**
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   366
   * The interframe gap that the Net Device uses to throttle packet
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   367
   * transmission
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   368
   * @see class Time
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   369
   */
378
32bd402ea5ea remove unused files, remove notion of PHY, make more realistic p2p-net-device and p2p-channel
Craig Dowell
parents: 369
diff changeset
   370
  Time           m_tInterframeGap;
3181
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
   371
414
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   372
  /**
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   373
   * The PointToPointChannel to which this PointToPointNetDevice has been
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   374
   * attached.
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   375
   * @see class PointToPointChannel
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   376
   */
568
e1660959ecbb use Ptr<> everywhere Object or NsUnknown are used
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 543
diff changeset
   377
  Ptr<PointToPointChannel> m_channel;
3181
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
   378
414
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   379
  /**
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   380
   * The Queue which this PointToPointNetDevice uses as a packet source.
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   381
   * Management of this Queue has been delegated to the PointToPointNetDevice
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   382
   * and it has the responsibility for deletion.
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   383
   * @see class Queue
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   384
   * @see class DropTailQueue
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   385
   */
581
15240a33f517 make Queue derive from Interface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 568
diff changeset
   386
  Ptr<Queue> m_queue;
3181
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
   387
414
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   388
  /**
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   389
   * The trace source for the packet reception events that the device can
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   390
   * fire.
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   391
   *
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   392
   * @see class CallBackTraceSource
71babb829194 fix queue leak and add p2p net device dox
Craig Dowell
parents: 409
diff changeset
   393
   */
2502
50d0da37f02f introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2470
diff changeset
   394
  TracedCallback<Ptr<const Packet> > m_rxTrace;
3181
26e7f865c548 point-to-point cleanup
Craig Dowell <craigdo@ee.washington.edu>
parents: 3086
diff changeset
   395
1820
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1793
diff changeset
   396
  /**
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1793
diff changeset
   397
   * The trace source for the packet drop events that the device can
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1793
diff changeset
   398
   * fire.
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1793
diff changeset
   399
   *
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1793
diff changeset
   400
   * @see class CallBackTraceSource
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1793
diff changeset
   401
   */
2502
50d0da37f02f introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2470
diff changeset
   402
  TracedCallback<Ptr<const Packet> > m_dropTrace;
926
1fdec986d774 Simplifications to the point to point devices and channel
George F. Riley<riley@ece.gatech.edu>
parents: 773
diff changeset
   403
1820
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1793
diff changeset
   404
  /**
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1793
diff changeset
   405
   * Error model for receive packet events
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1793
diff changeset
   406
   */
736919bd4874 Add src/common/error-model implementation and example script, and add to NetDevices
Tom Henderson <tomh@tomh.org>
parents: 1793
diff changeset
   407
  Ptr<ErrorModel> m_receiveErrorModel;
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   408
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   409
  Ptr<Node> m_node;
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   410
  Mac48Address m_address;
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   411
  NetDevice::ReceiveCallback m_rxCallback;
3584
4eb48239b4dc bug 274: bridge must detect compatibility of devices with bridging mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3480
diff changeset
   412
  NetDevice::PromiscReceiveCallback m_promiscCallback;
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   413
  uint32_t m_ifIndex;
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   414
  std::string m_name;
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   415
  bool m_linkUp;
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1870
diff changeset
   416
  Callback<void> m_linkChangeCallback;
3632
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   417
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   418
  static const uint16_t DEFAULT_MTU = 1500;
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   419
  static const uint16_t PPP_OVERHEAD = 2;
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   420
  static const uint16_t DEFAULT_FRAME_SIZE = DEFAULT_MTU + PPP_OVERHEAD;
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   421
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   422
  /**
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   423
   * The frame size/packet size.  This corresponds to the maximum 
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   424
   * number of bytes that can be transmitted as a packet without framing.
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   425
   * This corresponds to the 1518 byte packet size often seen on Ethernet.
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   426
   */
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   427
  uint32_t m_frameSize;
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   428
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   429
  /**
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   430
   * The Maxmimum Transmission Unit.  This corresponds to the maximum 
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   431
   * number of bytes that can be transmitted as seen from higher layers.
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   432
   * This corresponds to the 1500 byte MTU size often seen on IP over 
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   433
   * Ethernet.
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   434
   */
aa1fb0f43571 apply MTU/FrameSize treatment to point-to-point
craigdo@ns-test
parents: 3584
diff changeset
   435
  uint32_t m_mtu;
245
28ba3a5cdff8 add p2p netdevice and channel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   436
};
28ba3a5cdff8 add p2p netdevice and channel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   437
2502
50d0da37f02f introduce the ns3::String class, get rid of the string -> Attribute implicit conversion, and get rid of MakeDataRate, port PointToPointNetDevice to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2470
diff changeset
   438
} // namespace ns3
245
28ba3a5cdff8 add p2p netdevice and channel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   439
369
29ea5d1a83c8 Rename classes from Serial to PointToPoint
Tom Henderson <tomh@tomh.org>
parents: 368
diff changeset
   440
#endif // POINT_TO_POINT_NET_DEVICE_H
245
28ba3a5cdff8 add p2p netdevice and channel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   441