src/node/net-device.cc
author Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
Mon, 01 Feb 2010 08:09:11 +0100
changeset 5937 aa754f49d2f3
parent 5421 612dd4189fa7
child 6183 8a5e1f9db873
permissions -rw-r--r--
merge with HEAD
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
234
6124bda39cb3 code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
6124bda39cb3 code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     2
/*
6124bda39cb3 code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     3
 * Copyright (c) 2005,2006 INRIA
6124bda39cb3 code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     4
 *
6124bda39cb3 code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
6124bda39cb3 code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
6124bda39cb3 code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
6124bda39cb3 code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     8
 *
6124bda39cb3 code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
6124bda39cb3 code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
6124bda39cb3 code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
6124bda39cb3 code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    12
 * GNU General Public License for more details.
6124bda39cb3 code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    13
 *
6124bda39cb3 code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
6124bda39cb3 code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
6124bda39cb3 code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
6124bda39cb3 code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    17
 *
6124bda39cb3 code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    18
 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
6124bda39cb3 code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    19
 */
6124bda39cb3 code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    20
710
2a9c061219a7 port code from Interface to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 607
diff changeset
    21
#include "ns3/object.h"
1505
286ec92f4113 debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents: 1451
diff changeset
    22
#include "ns3/log.h"
3547
e60083af704c bug 285: NetDevice base class should define an attribute Mtu.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3480
diff changeset
    23
#include "ns3/uinteger.h"
234
6124bda39cb3 code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    24
#include "net-device.h"
6124bda39cb3 code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    25
1505
286ec92f4113 debug to log
Craig Dowell <craigdo@ee.washington.edu>
parents: 1451
diff changeset
    26
NS_LOG_COMPONENT_DEFINE ("NetDevice");
975
98233c6c9c2e Move LLC encapsulation from NetDevice to subclasses.
Emmanuelle Laprise <emmanuelle.laprise@bluekazoo.ca>
parents: 729
diff changeset
    27
234
6124bda39cb3 code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    28
namespace ns3 {
6124bda39cb3 code from all trees.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    29
2249
3a1da26d61dc replace ComponentManager::Create and ClassId with InterfaceId::CreateObjest and InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2238
diff changeset
    30
NS_OBJECT_ENSURE_REGISTERED (NetDevice);
3a1da26d61dc replace ComponentManager::Create and ClassId with InterfaceId::CreateObjest and InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2238
diff changeset
    31
2251
04963d8cca51 iid (void) -> GetTypeId (void)
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2250
diff changeset
    32
TypeId NetDevice::GetTypeId (void)
2232
9abd038ee588 replace static const Interface iid; with static InterfaceId iid (void);
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2230
diff changeset
    33
{
2602
d9262bff6df2 add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2470
diff changeset
    34
  static TypeId tid = TypeId ("ns3::NetDevice")
3547
e60083af704c bug 285: NetDevice base class should define an attribute Mtu.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3480
diff changeset
    35
    .SetParent<Object> ()
e60083af704c bug 285: NetDevice base class should define an attribute Mtu.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3480
diff changeset
    36
    .AddAttribute ("Mtu", "The MAC-level Maximum Transmission Unit",
e60083af704c bug 285: NetDevice base class should define an attribute Mtu.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3480
diff changeset
    37
                   TypeId::ATTR_SET | TypeId::ATTR_GET,
e60083af704c bug 285: NetDevice base class should define an attribute Mtu.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3480
diff changeset
    38
                   UintegerValue (0xffff),
e60083af704c bug 285: NetDevice base class should define an attribute Mtu.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3480
diff changeset
    39
                   MakeUintegerAccessor (&NetDevice::SetMtu,
e60083af704c bug 285: NetDevice base class should define an attribute Mtu.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3480
diff changeset
    40
                                         &NetDevice::GetMtu),
e60083af704c bug 285: NetDevice base class should define an attribute Mtu.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3480
diff changeset
    41
                   MakeUintegerChecker<uint16_t> ())
e60083af704c bug 285: NetDevice base class should define an attribute Mtu.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3480
diff changeset
    42
                   
e60083af704c bug 285: NetDevice base class should define an attribute Mtu.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3480
diff changeset
    43
    ;
2252
80595448707a iid -> tid
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2251
diff changeset
    44
  return tid;
2232
9abd038ee588 replace static const Interface iid; with static InterfaceId iid (void);
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2230
diff changeset
    45
}
582
b10ef84683a5 NetDevice and Channel now derive from Interface rather than Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 568
diff changeset
    46
487
04c5878c0a61 apply ref/unref rules consistently for Node
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 470
diff changeset
    47
NetDevice::~NetDevice ()
5421
612dd4189fa7 add NS_LOG_FUNCTION to several constructors/destructors/DoDisposes
Andrey Mazo <mazo@iitp.ru>
parents: 3547
diff changeset
    48
{
612dd4189fa7 add NS_LOG_FUNCTION to several constructors/destructors/DoDisposes
Andrey Mazo <mazo@iitp.ru>
parents: 3547
diff changeset
    49
  NS_LOG_FUNCTION_NOARGS ();
612dd4189fa7 add NS_LOG_FUNCTION to several constructors/destructors/DoDisposes
Andrey Mazo <mazo@iitp.ru>
parents: 3547
diff changeset
    50
}
1443
580ed7a4dd1e Move MakeMulticastAddress to NetDevice
Craig Dowell <craigdo@ee.washington.edu>
parents: 1441
diff changeset
    51
2470
254581fb9e9c make NetDevice fully virtual.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2252
diff changeset
    52
} // namespace ns3