src/uan/model/uan-net-device.cc
author Andrea Sacco
Tue, 16 Aug 2011 20:22:40 +0200
changeset 7433 b29227c0eee0
parent 7385 10beb0e53130
child 9870 6543f3876ff5
permissions -rw-r--r--
Bug 1010 - Uan model Sleep patch
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7385
10beb0e53130 standardize emacs c++ mode comments
Vedran Miletić <rivanvx@gmail.com>
parents: 6852
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
6478
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
     2
/*
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
     3
 * Copyright (c) 2009 University of Washington
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
     4
 *
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
     8
 *
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    12
 * GNU General Public License for more details.
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    13
 *
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    17
 *
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    18
 * Author: Leonard Tracy <lentracy@gmail.com>
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    19
 */
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    20
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    21
#include "ns3/trace-source-accessor.h"
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    22
#include "ns3/traced-callback.h"
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    23
#include "ns3/pointer.h"
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    24
#include "ns3/node.h"
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    25
#include "ns3/assert.h"
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    26
#include "uan-net-device.h"
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    27
#include "uan-phy.h"
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    28
#include "uan-mac.h"
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    29
#include "uan-channel.h"
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    30
#include "uan-transducer.h"
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    31
#include "ns3/log.h"
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    32
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    33
NS_LOG_COMPONENT_DEFINE ("UanNetDevice");
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    34
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    35
namespace ns3 {
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    36
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    37
NS_OBJECT_ENSURE_REGISTERED (UanNetDevice);
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    38
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    39
UanNetDevice::UanNetDevice ()
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    40
  : NetDevice (),
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    41
    m_mtu (64000),
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    42
    m_cleared (false)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    43
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    44
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    45
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    46
UanNetDevice::~UanNetDevice ()
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    47
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    48
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    49
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    50
void
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    51
UanNetDevice::Clear ()
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    52
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    53
  if (m_cleared)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    54
    {
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    55
      return;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    56
    }
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    57
  m_cleared = true;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    58
  m_node = 0;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    59
  if (m_channel)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    60
    {
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    61
      m_channel->Clear ();
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    62
      m_channel = 0;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    63
    }
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    64
  if (m_mac)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    65
    {
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    66
      m_mac->Clear ();
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    67
      m_mac = 0;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    68
    }
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    69
  if (m_phy)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    70
    {
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    71
      m_phy->Clear ();
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    72
      m_phy = 0;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    73
    }
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    74
  if (m_trans)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    75
    {
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    76
      m_trans->Clear ();
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    77
      m_trans = 0;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    78
    }
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    79
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    80
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    81
void
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    82
UanNetDevice::DoDispose ()
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    83
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    84
  Clear ();
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    85
  NetDevice::DoDispose ();
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    86
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    87
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    88
TypeId
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    89
UanNetDevice::GetTypeId ()
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    90
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    91
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    92
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    93
  static TypeId tid = TypeId ("ns3::UanNetDevice")
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    94
    .SetParent<NetDevice> ()
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    95
    .AddAttribute ("Channel", "The channel attached to this device",
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    96
                   PointerValue (),
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    97
                   MakePointerAccessor (&UanNetDevice::DoGetChannel, &UanNetDevice::SetChannel),
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    98
                   MakePointerChecker<UanChannel> ())
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    99
    .AddAttribute ("Phy", "The PHY layer attached to this device.",
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   100
                   PointerValue (),
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   101
                   MakePointerAccessor (&UanNetDevice::GetPhy, &UanNetDevice::SetPhy),
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   102
                   MakePointerChecker<UanPhy> ())
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   103
    .AddAttribute ("Mac", "The MAC layer attached to this device.",
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   104
                   PointerValue (),
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   105
                   MakePointerAccessor (&UanNetDevice::GetMac, &UanNetDevice::SetMac),
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   106
                   MakePointerChecker<UanMac> ())
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   107
    .AddAttribute ("Transducer", "The Transducer attached to this device.",
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   108
                   PointerValue (),
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   109
                   MakePointerAccessor (&UanNetDevice::GetTransducer,
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   110
                                        &UanNetDevice::SetTransducer),
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   111
                   MakePointerChecker<UanTransducer> ())
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   112
    .AddTraceSource ("Rx", "Received payload from the MAC layer.",
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   113
                     MakeTraceSourceAccessor (&UanNetDevice::m_rxLogger))
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   114
    .AddTraceSource ("Tx", "Send payload to the MAC layer.",
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   115
                     MakeTraceSourceAccessor (&UanNetDevice::m_txLogger))
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   116
  ;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   117
  return tid;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   118
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   119
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   120
void
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   121
UanNetDevice::SetMac (Ptr<UanMac> mac)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   122
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   123
  if (mac != 0)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   124
    {
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   125
      m_mac = mac;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   126
      NS_LOG_DEBUG ("Set MAC");
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   127
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   128
      if (m_phy != 0)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   129
        {
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   130
          m_phy->SetMac (mac);
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   131
          m_mac->AttachPhy (m_phy);
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   132
          NS_LOG_DEBUG ("Attached MAC to PHY");
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   133
        }
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   134
      m_mac->SetForwardUpCb (MakeCallback (&UanNetDevice::ForwardUp, this));
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   135
    }
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   136
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   137
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   138
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   139
void
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   140
UanNetDevice::SetPhy (Ptr<UanPhy> phy)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   141
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   142
  if (phy != 0)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   143
    {
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   144
      m_phy = phy;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   145
      m_phy->SetDevice (Ptr<UanNetDevice> (this));
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   146
      NS_LOG_DEBUG ("Set PHY");
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   147
      if (m_mac != 0)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   148
        {
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   149
          m_mac->AttachPhy (phy);
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   150
          m_phy->SetMac (m_mac);
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   151
          NS_LOG_DEBUG ("Attached PHY to MAC");
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   152
        }
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   153
      if (m_trans != 0)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   154
        {
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   155
          m_phy->SetTransducer (m_trans);
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   156
          NS_LOG_DEBUG ("Added PHY to trans");
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   157
        }
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   158
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   159
    }
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   160
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   161
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   162
void
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   163
UanNetDevice::SetChannel (Ptr<UanChannel> channel)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   164
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   165
  if (channel != 0)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   166
    {
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   167
      m_channel = channel;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   168
      NS_LOG_DEBUG ("Set CHANNEL");
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   169
      if (m_trans != 0)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   170
        {
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   171
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   172
          m_channel->AddDevice (this, m_trans);
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   173
          NS_LOG_DEBUG ("Added self to channel device list");
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   174
          m_trans->SetChannel (m_channel);
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   175
          NS_LOG_DEBUG ("Set Transducer channel");
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   176
        }
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   177
      if (m_phy != 0 )
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   178
        {
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   179
          m_phy->SetChannel (channel);
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   180
        }
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   181
    }
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   182
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   183
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   184
Ptr<UanChannel>
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   185
UanNetDevice::DoGetChannel (void) const
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   186
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   187
  return m_channel;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   188
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   189
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   190
Ptr<UanMac>
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   191
UanNetDevice::GetMac () const
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   192
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   193
  return m_mac;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   194
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   195
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   196
Ptr<UanPhy>
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   197
UanNetDevice::GetPhy () const
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   198
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   199
  return m_phy;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   200
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   201
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   202
void
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   203
UanNetDevice::SetIfIndex (uint32_t index)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   204
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   205
  m_ifIndex = index;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   206
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   207
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   208
uint32_t
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   209
UanNetDevice::GetIfIndex () const
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   210
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   211
  return m_ifIndex;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   212
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   213
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   214
Ptr<Channel>
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   215
UanNetDevice::GetChannel () const
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   216
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   217
  return m_channel;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   218
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   219
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   220
Address
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   221
UanNetDevice::GetAddress () const
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   222
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   223
  return m_mac->GetAddress ();
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   224
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   225
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   226
bool
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   227
UanNetDevice::SetMtu (uint16_t mtu)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   228
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   229
  // TODO:  Check this in MAC
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   230
  NS_LOG_WARN ("UanNetDevice:  MTU is not implemented");
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   231
  m_mtu = mtu;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   232
  return true;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   233
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   234
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   235
uint16_t
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   236
UanNetDevice::GetMtu () const
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   237
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   238
  return m_mtu;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   239
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   240
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   241
bool
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   242
UanNetDevice::IsLinkUp () const
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   243
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   244
  return  (m_linkup && (m_phy != 0));
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   245
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   246
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   247
bool
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   248
UanNetDevice::IsBroadcast () const
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   249
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   250
  return true;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   251
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   252
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   253
Address
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   254
UanNetDevice::GetBroadcast () const
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   255
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   256
  return m_mac->GetBroadcast ();
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   257
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   258
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   259
bool
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   260
UanNetDevice::IsMulticast () const
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   261
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   262
  return false;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   263
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   264
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   265
Address
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   266
UanNetDevice::GetMulticast (Ipv4Address multicastGroup) const
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   267
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   268
  NS_FATAL_ERROR ("UanNetDevice does not support multicast");
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   269
  return m_mac->GetBroadcast ();
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   270
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   271
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   272
Address
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   273
UanNetDevice::GetMulticast (Ipv6Address addr) const
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   274
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   275
  NS_FATAL_ERROR ("UanNetDevice does not support multicast");
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   276
  return m_mac->GetBroadcast ();
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   277
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   278
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   279
bool
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   280
UanNetDevice::IsBridge (void) const
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   281
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   282
  return false;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   283
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   284
bool
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   285
UanNetDevice::IsPointToPoint () const
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   286
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   287
  return false;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   288
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   289
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   290
bool
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   291
UanNetDevice::Send (Ptr<Packet> packet, const Address &dest, uint16_t protocolNumber)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   292
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   293
  return m_mac->Enqueue (packet, dest, protocolNumber);
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   294
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   295
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   296
bool
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   297
UanNetDevice::SendFrom (Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   298
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   299
  // Not yet implemented
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   300
  NS_ASSERT_MSG (0, "Not yet implemented");
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   301
  return false;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   302
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   303
Ptr<Node>
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   304
UanNetDevice::GetNode () const
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   305
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   306
  return m_node;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   307
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   308
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   309
void
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   310
UanNetDevice::SetNode (Ptr<Node> node)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   311
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   312
  m_node = node;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   313
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   314
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   315
bool
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   316
UanNetDevice::NeedsArp () const
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   317
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   318
  return false;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   319
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   320
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   321
void
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   322
UanNetDevice::SetReceiveCallback (NetDevice::ReceiveCallback cb)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   323
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   324
  m_forwardUp = cb;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   325
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   326
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   327
void
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   328
UanNetDevice::ForwardUp (Ptr<Packet> pkt, const UanAddress &src)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   329
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   330
  NS_LOG_DEBUG ("Forwarding packet up to application");
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   331
  m_rxLogger (pkt, src);
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   332
  m_forwardUp (this, pkt, 0, src);
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   333
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   334
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   335
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   336
Ptr<UanTransducer>
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   337
UanNetDevice::GetTransducer (void) const
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   338
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   339
  return m_trans;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   340
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   341
void
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   342
UanNetDevice::SetTransducer (Ptr<UanTransducer> trans)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   343
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   344
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   345
  if (trans != 0)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   346
    {
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   347
      m_trans = trans;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   348
      NS_LOG_DEBUG ("Set Transducer");
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   349
      if (m_phy != 0)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   350
        {
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   351
          m_phy->SetTransducer (m_trans);
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   352
          NS_LOG_DEBUG ("Attached Phy to transducer");
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   353
        }
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   354
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   355
      if (m_channel != 0)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   356
        {
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   357
          m_channel->AddDevice (this, m_trans);
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   358
          m_trans->SetChannel (m_channel);
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   359
          NS_LOG_DEBUG ("Added self to channel device list");
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   360
        }
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   361
    }
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   362
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   363
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   364
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   365
void
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   366
UanNetDevice::AddLinkChangeCallback (Callback<void> callback)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   367
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   368
  m_linkChanges.ConnectWithoutContext (callback);
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   369
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   370
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   371
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   372
void
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   373
UanNetDevice::SetPromiscReceiveCallback (PromiscReceiveCallback cb)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   374
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   375
  // Not implemented yet
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   376
  NS_ASSERT_MSG (0, "Not yet implemented");
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   377
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   378
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   379
bool
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   380
UanNetDevice::SupportsSendFrom (void) const
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   381
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   382
  return false;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   383
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   384
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   385
void
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   386
UanNetDevice::SetAddress (Address address)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   387
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   388
  NS_ASSERT_MSG (0, "Tried to set MAC address with no MAC");
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   389
  m_mac->SetAddress (UanAddress::ConvertFrom (address));
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   390
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   391
7433
b29227c0eee0 Bug 1010 - Uan model Sleep patch
Andrea Sacco
parents: 7385
diff changeset
   392
void
b29227c0eee0 Bug 1010 - Uan model Sleep patch
Andrea Sacco
parents: 7385
diff changeset
   393
UanNetDevice::SetSleepMode (bool sleep)
b29227c0eee0 Bug 1010 - Uan model Sleep patch
Andrea Sacco
parents: 7385
diff changeset
   394
{
b29227c0eee0 Bug 1010 - Uan model Sleep patch
Andrea Sacco
parents: 7385
diff changeset
   395
  m_phy->SetSleepMode (sleep);
b29227c0eee0 Bug 1010 - Uan model Sleep patch
Andrea Sacco
parents: 7385
diff changeset
   396
}
b29227c0eee0 Bug 1010 - Uan model Sleep patch
Andrea Sacco
parents: 7385
diff changeset
   397
6478
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   398
} // namespace ns3
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   399