src/node/simple-net-device.cc
author Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
Fri, 11 Jul 2008 18:39:19 +0100
changeset 3416 926ccb845111
parent 2834 1aab57845b07
child 3435 1d704c128f1f
permissions -rw-r--r--
Rescan APIs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2833
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2831
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2831
diff changeset
     2
/*
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2831
diff changeset
     3
 * Copyright (c) 2008 INRIA
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2831
diff changeset
     4
 *
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2831
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2831
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2831
diff changeset
     7
 * published by the Free Software Foundation;
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2831
diff changeset
     8
 *
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2831
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2831
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2831
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2831
diff changeset
    12
 * GNU General Public License for more details.
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2831
diff changeset
    13
 *
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2831
diff changeset
    14
 * You should have received a copy of the GNU General Public License
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2831
diff changeset
    15
 * along with this program; if not, write to the Free Software
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2831
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2831
diff changeset
    17
 *
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2831
diff changeset
    18
 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
f3474fd850b2 add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2831
diff changeset
    19
 */
2673
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    20
#include "simple-net-device.h"
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    21
#include "simple-channel.h"
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    22
#include "node.h"
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    23
#include "ns3/packet.h"
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    24
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    25
namespace ns3 {
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    26
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    27
TypeId 
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    28
SimpleNetDevice::GetTypeId (void)
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    29
{
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    30
  static TypeId tid = TypeId ("ns3::SimpleNetDevice")
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    31
    .SetParent<NetDevice> ()
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    32
    .AddConstructor<SimpleNetDevice> ()
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    33
    ;
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    34
  return tid;
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    35
}
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    36
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    37
SimpleNetDevice::SimpleNetDevice ()
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    38
  : m_channel (0),
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    39
    m_node (0),
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    40
    m_mtu (0xffff),
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    41
    m_name (""),
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    42
    m_ifIndex (0)
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    43
{}
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    44
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    45
void 
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    46
SimpleNetDevice::Receive (Ptr<Packet> packet, uint16_t protocol, 
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    47
			  Mac48Address to, Mac48Address from)
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    48
{
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    49
  if (to == m_address || to == Mac48Address::GetBroadcast ())
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    50
    {
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    51
      m_rxCallback (this, packet, protocol, from);
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    52
    }
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    53
}
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    54
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    55
void 
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    56
SimpleNetDevice::SetChannel (Ptr<SimpleChannel> channel)
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    57
{
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    58
  m_channel = channel;
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    59
  m_channel->Add (this);
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    60
}
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    61
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    62
void 
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    63
SimpleNetDevice::SetAddress (Mac48Address address)
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    64
{
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    65
  m_address = address;
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    66
}
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    67
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    68
void 
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    69
SimpleNetDevice::SetName(const std::string name)
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    70
{
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    71
  m_name = name;
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    72
}
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    73
std::string 
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    74
SimpleNetDevice::GetName(void) const
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    75
{
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    76
  return m_name;
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    77
}
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    78
void 
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    79
SimpleNetDevice::SetIfIndex(const uint32_t index)
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    80
{
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    81
  m_ifIndex = index;
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    82
}
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    83
uint32_t 
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    84
SimpleNetDevice::GetIfIndex(void) const
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    85
{
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    86
  return m_ifIndex;
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    87
}
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    88
Ptr<Channel> 
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    89
SimpleNetDevice::GetChannel (void) const
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    90
{
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    91
  return m_channel;
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    92
}
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    93
Address 
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    94
SimpleNetDevice::GetAddress (void) const
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    95
{
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    96
  return m_address;
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    97
}
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    98
bool 
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    99
SimpleNetDevice::SetMtu (const uint16_t mtu)
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   100
{
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   101
  m_mtu = mtu;
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   102
  return true;
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   103
}
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   104
uint16_t 
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   105
SimpleNetDevice::GetMtu (void) const
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   106
{
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   107
  return m_mtu;
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   108
}
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   109
bool 
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   110
SimpleNetDevice::IsLinkUp (void) const
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   111
{
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   112
  return true;
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   113
}
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   114
void 
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   115
SimpleNetDevice::SetLinkChangeCallback (Callback<void> callback)
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   116
{}
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   117
bool 
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   118
SimpleNetDevice::IsBroadcast (void) const
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   119
{
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   120
  return true;
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   121
}
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   122
Address
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   123
SimpleNetDevice::GetBroadcast (void) const
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   124
{
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   125
  return Mac48Address ("ff:ff:ff:ff:ff:ff");
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   126
}
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   127
bool 
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   128
SimpleNetDevice::IsMulticast (void) const
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   129
{
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   130
  return false;
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   131
}
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   132
Address 
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   133
SimpleNetDevice::GetMulticast (void) const
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   134
{
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   135
  return Mac48Address ("01:00:5e:00:00:00");
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   136
}
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   137
Address 
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   138
SimpleNetDevice::MakeMulticastAddress (Ipv4Address multicastGroup) const
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   139
{
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   140
  return Mac48Address ("01:00:5e:00:00:00");
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   141
}
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   142
bool 
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   143
SimpleNetDevice::IsPointToPoint (void) const
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   144
{
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   145
  return false;
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   146
}
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   147
bool 
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   148
SimpleNetDevice::Send(Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber)
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   149
{
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   150
  Mac48Address to = Mac48Address::ConvertFrom (dest);
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   151
  m_channel->Send (packet, protocolNumber, to, m_address, this);
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   152
  return true;
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   153
}
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   154
Ptr<Node> 
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   155
SimpleNetDevice::GetNode (void) const
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   156
{
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   157
  return m_node;
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   158
}
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   159
void 
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   160
SimpleNetDevice::SetNode (Ptr<Node> node)
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   161
{
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   162
  m_node = node;
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   163
}
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   164
bool 
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   165
SimpleNetDevice::NeedsArp (void) const
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   166
{
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   167
  return false;
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   168
}
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   169
void 
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   170
SimpleNetDevice::SetReceiveCallback (NetDevice::ReceiveCallback cb)
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   171
{
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   172
  m_rxCallback = cb;
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   173
}
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   174
2831
8bb0479b0949 get rid of channel during dispose
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2673
diff changeset
   175
void
8bb0479b0949 get rid of channel during dispose
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2673
diff changeset
   176
SimpleNetDevice::DoDispose (void)
8bb0479b0949 get rid of channel during dispose
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2673
diff changeset
   177
{
8bb0479b0949 get rid of channel during dispose
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2673
diff changeset
   178
  m_channel = 0;
8bb0479b0949 get rid of channel during dispose
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2673
diff changeset
   179
  m_node = 0;
8bb0479b0949 get rid of channel during dispose
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2673
diff changeset
   180
  NetDevice::DoDispose ();
8bb0479b0949 get rid of channel during dispose
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2673
diff changeset
   181
}
8bb0479b0949 get rid of channel during dispose
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2673
diff changeset
   182
2673
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   183
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   184
a70e0c7aaf56 SimpleChannel/SimpleNetDevice. Use them where needed.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   185
} // namespace ns3