src/lte/model/lte-ue-net-device.cc
author Peter D. Barnes, Jr. <barnes26@llnl.gov>
Fri, 26 Sep 2014 15:51:00 -0700
changeset 10968 2d29fee2b7b8
parent 10652 dc18deba4502
permissions -rw-r--r--
[Bug 1551] Redux: NS_LOG_COMPONENT_DEFINE inside or outside of ns3 namespace?
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
     1
/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
     2
/*
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
     3
 * Copyright (c) 2010 TELEMATICS LAB, DEE - Politecnico di Bari
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
     4
 *
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
     8
 *
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    12
 * GNU General Public License for more details.
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    13
 *
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    17
 *
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    18
 * Author: Giuseppe Piro  <g.piro@poliba.it>
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    19
 *         Nicola Baldo <nbaldo@cttc.es>
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    20
 *         Marco Miozzo <mmiozzo@cttc.es>
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    21
 */
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    22
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    23
#include "ns3/llc-snap-header.h"
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    24
#include "ns3/simulator.h"
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    25
#include "ns3/callback.h"
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    26
#include "ns3/node.h"
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    27
#include "ns3/packet.h"
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    28
#include "lte-net-device.h"
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    29
#include "ns3/packet-burst.h"
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    30
#include "ns3/uinteger.h"
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    31
#include "ns3/trace-source-accessor.h"
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    32
#include "ns3/pointer.h"
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    33
#include "ns3/enum.h"
9327
6f8d10f0fb94 Add CellId info to X2 SAP
Manuel Requena <manuel.requena@cttc.es>
parents: 8395
diff changeset
    34
#include "ns3/lte-enb-net-device.h"
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
    35
#include "lte-ue-net-device.h"
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    36
#include "lte-ue-mac.h"
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
    37
#include "lte-ue-rrc.h"
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    38
#include "ns3/ipv4-header.h"
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    39
#include "ns3/ipv4.h"
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
    40
#include "lte-amc.h"
9337
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8395
diff changeset
    41
#include "lte-ue-phy.h"
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8395
diff changeset
    42
#include "epc-ue-nas.h"
8389
cb215987eb77 LTE-EPC end-to-end data plane imlemented and partially working
Nicola Baldo <nbaldo@cttc.es>
parents: 8167
diff changeset
    43
#include <ns3/ipv4-l3-protocol.h>
8256
629982ba48a8 removed some useless inclusions of log.h
Nicola Baldo <nbaldo@cttc.es>
parents: 8253
diff changeset
    44
#include <ns3/log.h>
9337
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8395
diff changeset
    45
#include "epc-tft.h"
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    46
10968
2d29fee2b7b8 [Bug 1551] Redux: NS_LOG_COMPONENT_DEFINE inside or outside of ns3 namespace?
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 10652
diff changeset
    47
namespace ns3 {
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    48
10968
2d29fee2b7b8 [Bug 1551] Redux: NS_LOG_COMPONENT_DEFINE inside or outside of ns3 namespace?
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 10652
diff changeset
    49
NS_LOG_COMPONENT_DEFINE ("LteUeNetDevice");
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    50
10652
dc18deba4502 [doxygen] Revert r10410, r10411, r10412
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 10410
diff changeset
    51
NS_OBJECT_ENSURE_REGISTERED ( LteUeNetDevice);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    52
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    53
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
    54
TypeId LteUeNetDevice::GetTypeId (void)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    55
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
    56
  static TypeId
7252
c8200621e252 rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents: 6852
diff changeset
    57
    tid =
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
    58
    TypeId ("ns3::LteUeNetDevice")
7954
80e46addfeee Added DL and UL RLC performance
jnin
parents: 7945
diff changeset
    59
    .SetParent<LteNetDevice> ()
10297
83fa90a74a4a Using ObjectFactory in LteHelper for LteUeNetDevice
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10289
diff changeset
    60
    .AddConstructor<LteUeNetDevice> ()
83fa90a74a4a Using ObjectFactory in LteHelper for LteUeNetDevice
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10289
diff changeset
    61
    .AddAttribute ("EpcUeNas",
83fa90a74a4a Using ObjectFactory in LteHelper for LteUeNetDevice
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10289
diff changeset
    62
                   "The NAS associated to this UeNetDevice",
83fa90a74a4a Using ObjectFactory in LteHelper for LteUeNetDevice
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10289
diff changeset
    63
                   PointerValue (),
83fa90a74a4a Using ObjectFactory in LteHelper for LteUeNetDevice
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10289
diff changeset
    64
                   MakePointerAccessor (&LteUeNetDevice::m_nas),
83fa90a74a4a Using ObjectFactory in LteHelper for LteUeNetDevice
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10289
diff changeset
    65
                   MakePointerChecker <EpcUeNas> ())
7954
80e46addfeee Added DL and UL RLC performance
jnin
parents: 7945
diff changeset
    66
    .AddAttribute ("LteUeRrc",
80e46addfeee Added DL and UL RLC performance
jnin
parents: 7945
diff changeset
    67
                   "The RRC associated to this UeNetDevice",
80e46addfeee Added DL and UL RLC performance
jnin
parents: 7945
diff changeset
    68
                   PointerValue (),
80e46addfeee Added DL and UL RLC performance
jnin
parents: 7945
diff changeset
    69
                   MakePointerAccessor (&LteUeNetDevice::m_rrc),
80e46addfeee Added DL and UL RLC performance
jnin
parents: 7945
diff changeset
    70
                   MakePointerChecker <LteUeRrc> ())
8329
e6f85f34928a Fixed bug in IMSI retrieval for MacStats
Jaume Nin
parents: 8256
diff changeset
    71
    .AddAttribute ("LteUeMac",
e6f85f34928a Fixed bug in IMSI retrieval for MacStats
Jaume Nin
parents: 8256
diff changeset
    72
                   "The MAC associated to this UeNetDevice",
e6f85f34928a Fixed bug in IMSI retrieval for MacStats
Jaume Nin
parents: 8256
diff changeset
    73
                   PointerValue (),
e6f85f34928a Fixed bug in IMSI retrieval for MacStats
Jaume Nin
parents: 8256
diff changeset
    74
                   MakePointerAccessor (&LteUeNetDevice::m_mac),
e6f85f34928a Fixed bug in IMSI retrieval for MacStats
Jaume Nin
parents: 8256
diff changeset
    75
                   MakePointerChecker <LteUeMac> ())
e6f85f34928a Fixed bug in IMSI retrieval for MacStats
Jaume Nin
parents: 8256
diff changeset
    76
    .AddAttribute ("LteUePhy",
e6f85f34928a Fixed bug in IMSI retrieval for MacStats
Jaume Nin
parents: 8256
diff changeset
    77
                   "The PHY associated to this UeNetDevice",
e6f85f34928a Fixed bug in IMSI retrieval for MacStats
Jaume Nin
parents: 8256
diff changeset
    78
                   PointerValue (),
e6f85f34928a Fixed bug in IMSI retrieval for MacStats
Jaume Nin
parents: 8256
diff changeset
    79
                   MakePointerAccessor (&LteUeNetDevice::m_phy),
e6f85f34928a Fixed bug in IMSI retrieval for MacStats
Jaume Nin
parents: 8256
diff changeset
    80
                   MakePointerChecker <LteUePhy> ())
9172
2d6235af7a36 uncommented LteUeNetDevice::Imsi attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 8395
diff changeset
    81
    .AddAttribute ("Imsi",
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8032
diff changeset
    82
                   "International Mobile Subscriber Identity assigned to this UE",
10297
83fa90a74a4a Using ObjectFactory in LteHelper for LteUeNetDevice
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10289
diff changeset
    83
                   UintegerValue (0),
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8032
diff changeset
    84
                   MakeUintegerAccessor (&LteUeNetDevice::m_imsi),
9172
2d6235af7a36 uncommented LteUeNetDevice::Imsi attribute
Nicola Baldo <nbaldo@cttc.es>
parents: 8395
diff changeset
    85
                   MakeUintegerChecker<uint64_t> ())
10289
c2a694b5598c DL EARFCN attribute for UE
Budiarto Herman <budiarto.herman@magister.fi>
parents: 9703
diff changeset
    86
    .AddAttribute ("DlEarfcn",
c2a694b5598c DL EARFCN attribute for UE
Budiarto Herman <budiarto.herman@magister.fi>
parents: 9703
diff changeset
    87
                   "Downlink E-UTRA Absolute Radio Frequency Channel Number (EARFCN) "
c2a694b5598c DL EARFCN attribute for UE
Budiarto Herman <budiarto.herman@magister.fi>
parents: 9703
diff changeset
    88
                   "as per 3GPP 36.101 Section 5.7.3. ",
c2a694b5598c DL EARFCN attribute for UE
Budiarto Herman <budiarto.herman@magister.fi>
parents: 9703
diff changeset
    89
                   UintegerValue (100),
c2a694b5598c DL EARFCN attribute for UE
Budiarto Herman <budiarto.herman@magister.fi>
parents: 9703
diff changeset
    90
                   MakeUintegerAccessor (&LteUeNetDevice::SetDlEarfcn,
c2a694b5598c DL EARFCN attribute for UE
Budiarto Herman <budiarto.herman@magister.fi>
parents: 9703
diff changeset
    91
                                         &LteUeNetDevice::GetDlEarfcn),
c2a694b5598c DL EARFCN attribute for UE
Budiarto Herman <budiarto.herman@magister.fi>
parents: 9703
diff changeset
    92
                   MakeUintegerChecker<uint16_t> (0, 6149))
10382
0b19dd1e94f7 Converted CSG ID and CSG indication as attributes to LTE devices
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10372
diff changeset
    93
    .AddAttribute ("CsgId",
0b19dd1e94f7 Converted CSG ID and CSG indication as attributes to LTE devices
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10372
diff changeset
    94
                   "The Closed Subscriber Group (CSG) identity that this UE is associated with, "
0b19dd1e94f7 Converted CSG ID and CSG indication as attributes to LTE devices
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10372
diff changeset
    95
                   "i.e., giving the UE access to cells which belong to this particular CSG. "
0b19dd1e94f7 Converted CSG ID and CSG indication as attributes to LTE devices
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10372
diff changeset
    96
                   "This restriction only applies to initial cell selection and EPC-enabled simulation. "
0b19dd1e94f7 Converted CSG ID and CSG indication as attributes to LTE devices
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10372
diff changeset
    97
                   "This does not revoke the UE's access to non-CSG cells. ",
0b19dd1e94f7 Converted CSG ID and CSG indication as attributes to LTE devices
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10372
diff changeset
    98
                   UintegerValue (0),
0b19dd1e94f7 Converted CSG ID and CSG indication as attributes to LTE devices
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10372
diff changeset
    99
                   MakeUintegerAccessor (&LteUeNetDevice::SetCsgId,
0b19dd1e94f7 Converted CSG ID and CSG indication as attributes to LTE devices
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10372
diff changeset
   100
                                         &LteUeNetDevice::GetCsgId),
0b19dd1e94f7 Converted CSG ID and CSG indication as attributes to LTE devices
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10372
diff changeset
   101
                   MakeUintegerChecker<uint32_t> ())
8148
09e2d03022a2 run check-style on src/lte/model
Nicola Baldo <nbaldo@cttc.es>
parents: 8032
diff changeset
   102
  ;
7954
80e46addfeee Added DL and UL RLC performance
jnin
parents: 7945
diff changeset
   103
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   104
  return tid;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   105
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   106
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   107
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   108
LteUeNetDevice::LteUeNetDevice (void)
10382
0b19dd1e94f7 Converted CSG ID and CSG indication as attributes to LTE devices
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10372
diff changeset
   109
  : m_isConstructed (false)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   110
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   111
  NS_LOG_FUNCTION (this);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   112
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   113
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   114
LteUeNetDevice::~LteUeNetDevice (void)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   115
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   116
  NS_LOG_FUNCTION (this);
6710
3cd651349cb6 lte examples now passing valgrind tests
Nicola Baldo <nbaldo@cttc.es>
parents: 6709
diff changeset
   117
}
3cd651349cb6 lte examples now passing valgrind tests
Nicola Baldo <nbaldo@cttc.es>
parents: 6709
diff changeset
   118
3cd651349cb6 lte examples now passing valgrind tests
Nicola Baldo <nbaldo@cttc.es>
parents: 6709
diff changeset
   119
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   120
LteUeNetDevice::DoDispose (void)
6710
3cd651349cb6 lte examples now passing valgrind tests
Nicola Baldo <nbaldo@cttc.es>
parents: 6709
diff changeset
   121
{
3cd651349cb6 lte examples now passing valgrind tests
Nicola Baldo <nbaldo@cttc.es>
parents: 6709
diff changeset
   122
  NS_LOG_FUNCTION (this);
3cd651349cb6 lte examples now passing valgrind tests
Nicola Baldo <nbaldo@cttc.es>
parents: 6709
diff changeset
   123
  m_targetEnb = 0;
7921
0a504caf445d added more disposal stuff
Nicola Baldo <nbaldo@cttc.es>
parents: 7907
diff changeset
   124
  m_mac->Dispose ();
0a504caf445d added more disposal stuff
Nicola Baldo <nbaldo@cttc.es>
parents: 7907
diff changeset
   125
  m_mac = 0;
0a504caf445d added more disposal stuff
Nicola Baldo <nbaldo@cttc.es>
parents: 7907
diff changeset
   126
  m_rrc->Dispose ();
0a504caf445d added more disposal stuff
Nicola Baldo <nbaldo@cttc.es>
parents: 7907
diff changeset
   127
  m_rrc = 0;
0a504caf445d added more disposal stuff
Nicola Baldo <nbaldo@cttc.es>
parents: 7907
diff changeset
   128
  m_phy->Dispose ();
0a504caf445d added more disposal stuff
Nicola Baldo <nbaldo@cttc.es>
parents: 7907
diff changeset
   129
  m_phy = 0;
9370
3d5962a58440 Dispose EpcUeNas within LteUeNetDevice
Nicola Baldo <nbaldo@cttc.es>
parents: 9338
diff changeset
   130
  m_nas->Dispose ();
3d5962a58440 Dispose EpcUeNas within LteUeNetDevice
Nicola Baldo <nbaldo@cttc.es>
parents: 9338
diff changeset
   131
  m_nas = 0;
6709
4f3100141560 fixed some valgrind errors
Giuseppe Piro <g.piro@poliba.it>
parents: 6705
diff changeset
   132
  LteNetDevice::DoDispose ();
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   133
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   134
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   135
void
7945
dbab335f9eea connection of SAPs moved from UeNetDevice to LenaHelper
Nicola Baldo <nbaldo@cttc.es>
parents: 7924
diff changeset
   136
LteUeNetDevice::UpdateConfig (void)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   137
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   138
  NS_LOG_FUNCTION (this);
10382
0b19dd1e94f7 Converted CSG ID and CSG indication as attributes to LTE devices
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10372
diff changeset
   139
0b19dd1e94f7 Converted CSG ID and CSG indication as attributes to LTE devices
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10372
diff changeset
   140
  if (m_isConstructed)
0b19dd1e94f7 Converted CSG ID and CSG indication as attributes to LTE devices
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10372
diff changeset
   141
    {
0b19dd1e94f7 Converted CSG ID and CSG indication as attributes to LTE devices
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10372
diff changeset
   142
      NS_LOG_LOGIC (this << " Updating configuration: IMSI " << m_imsi
0b19dd1e94f7 Converted CSG ID and CSG indication as attributes to LTE devices
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10372
diff changeset
   143
                         << " CSG ID " << m_csgId);
0b19dd1e94f7 Converted CSG ID and CSG indication as attributes to LTE devices
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10372
diff changeset
   144
      m_nas->SetImsi (m_imsi);
0b19dd1e94f7 Converted CSG ID and CSG indication as attributes to LTE devices
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10372
diff changeset
   145
      m_rrc->SetImsi (m_imsi);
0b19dd1e94f7 Converted CSG ID and CSG indication as attributes to LTE devices
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10372
diff changeset
   146
      m_nas->SetCsgId (m_csgId); // this also handles propagation to RRC
0b19dd1e94f7 Converted CSG ID and CSG indication as attributes to LTE devices
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10372
diff changeset
   147
    }
0b19dd1e94f7 Converted CSG ID and CSG indication as attributes to LTE devices
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10372
diff changeset
   148
  else
0b19dd1e94f7 Converted CSG ID and CSG indication as attributes to LTE devices
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10372
diff changeset
   149
    {
0b19dd1e94f7 Converted CSG ID and CSG indication as attributes to LTE devices
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10372
diff changeset
   150
      /*
0b19dd1e94f7 Converted CSG ID and CSG indication as attributes to LTE devices
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10372
diff changeset
   151
       * NAS and RRC instances are not be ready yet, so do nothing now and
0b19dd1e94f7 Converted CSG ID and CSG indication as attributes to LTE devices
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10372
diff changeset
   152
       * expect ``DoInitialize`` to re-invoke this function.
0b19dd1e94f7 Converted CSG ID and CSG indication as attributes to LTE devices
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10372
diff changeset
   153
       */
0b19dd1e94f7 Converted CSG ID and CSG indication as attributes to LTE devices
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10372
diff changeset
   154
    }
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   155
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   156
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   157
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   158
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   159
Ptr<LteUeMac>
9337
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8395
diff changeset
   160
LteUeNetDevice::GetMac (void) const
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   161
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   162
  NS_LOG_FUNCTION (this);
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   163
  return m_mac;
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   164
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   165
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   166
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   167
Ptr<LteUeRrc>
9337
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8395
diff changeset
   168
LteUeNetDevice::GetRrc (void) const
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   169
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   170
  NS_LOG_FUNCTION (this);
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   171
  return m_rrc;
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   172
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   173
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   174
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   175
Ptr<LteUePhy>
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   176
LteUeNetDevice::GetPhy (void) const
7886
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   177
{
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   178
  NS_LOG_FUNCTION (this);
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   179
  return m_phy;
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   180
}
b65c16d4da83 LENA project first public release
CTTC
parents: 6852
diff changeset
   181
9337
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8395
diff changeset
   182
Ptr<EpcUeNas>
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8395
diff changeset
   183
LteUeNetDevice::GetNas (void) const
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8395
diff changeset
   184
{
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8395
diff changeset
   185
  NS_LOG_FUNCTION (this);
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8395
diff changeset
   186
  return m_nas;
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8395
diff changeset
   187
}
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8395
diff changeset
   188
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8395
diff changeset
   189
uint64_t
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8395
diff changeset
   190
LteUeNetDevice::GetImsi () const
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8395
diff changeset
   191
{
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8395
diff changeset
   192
  NS_LOG_FUNCTION (this);
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8395
diff changeset
   193
  return m_imsi;
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8395
diff changeset
   194
}
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8395
diff changeset
   195
10289
c2a694b5598c DL EARFCN attribute for UE
Budiarto Herman <budiarto.herman@magister.fi>
parents: 9703
diff changeset
   196
uint16_t
c2a694b5598c DL EARFCN attribute for UE
Budiarto Herman <budiarto.herman@magister.fi>
parents: 9703
diff changeset
   197
LteUeNetDevice::GetDlEarfcn () const
c2a694b5598c DL EARFCN attribute for UE
Budiarto Herman <budiarto.herman@magister.fi>
parents: 9703
diff changeset
   198
{
10372
c334a429efaa Added missing NS_LOG_FUNCTION to some LTE module files
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10312
diff changeset
   199
  NS_LOG_FUNCTION (this);
10289
c2a694b5598c DL EARFCN attribute for UE
Budiarto Herman <budiarto.herman@magister.fi>
parents: 9703
diff changeset
   200
  return m_dlEarfcn;
c2a694b5598c DL EARFCN attribute for UE
Budiarto Herman <budiarto.herman@magister.fi>
parents: 9703
diff changeset
   201
}
c2a694b5598c DL EARFCN attribute for UE
Budiarto Herman <budiarto.herman@magister.fi>
parents: 9703
diff changeset
   202
c2a694b5598c DL EARFCN attribute for UE
Budiarto Herman <budiarto.herman@magister.fi>
parents: 9703
diff changeset
   203
void
c2a694b5598c DL EARFCN attribute for UE
Budiarto Herman <budiarto.herman@magister.fi>
parents: 9703
diff changeset
   204
LteUeNetDevice::SetDlEarfcn (uint16_t earfcn)
c2a694b5598c DL EARFCN attribute for UE
Budiarto Herman <budiarto.herman@magister.fi>
parents: 9703
diff changeset
   205
{
10372
c334a429efaa Added missing NS_LOG_FUNCTION to some LTE module files
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10312
diff changeset
   206
  NS_LOG_FUNCTION (this << earfcn);
10289
c2a694b5598c DL EARFCN attribute for UE
Budiarto Herman <budiarto.herman@magister.fi>
parents: 9703
diff changeset
   207
  m_dlEarfcn = earfcn;
c2a694b5598c DL EARFCN attribute for UE
Budiarto Herman <budiarto.herman@magister.fi>
parents: 9703
diff changeset
   208
}
c2a694b5598c DL EARFCN attribute for UE
Budiarto Herman <budiarto.herman@magister.fi>
parents: 9703
diff changeset
   209
10382
0b19dd1e94f7 Converted CSG ID and CSG indication as attributes to LTE devices
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10372
diff changeset
   210
uint32_t
0b19dd1e94f7 Converted CSG ID and CSG indication as attributes to LTE devices
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10372
diff changeset
   211
LteUeNetDevice::GetCsgId () const
0b19dd1e94f7 Converted CSG ID and CSG indication as attributes to LTE devices
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10372
diff changeset
   212
{
0b19dd1e94f7 Converted CSG ID and CSG indication as attributes to LTE devices
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10372
diff changeset
   213
  NS_LOG_FUNCTION (this);
0b19dd1e94f7 Converted CSG ID and CSG indication as attributes to LTE devices
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10372
diff changeset
   214
  return m_csgId;
0b19dd1e94f7 Converted CSG ID and CSG indication as attributes to LTE devices
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10372
diff changeset
   215
}
0b19dd1e94f7 Converted CSG ID and CSG indication as attributes to LTE devices
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10372
diff changeset
   216
0b19dd1e94f7 Converted CSG ID and CSG indication as attributes to LTE devices
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10372
diff changeset
   217
void
0b19dd1e94f7 Converted CSG ID and CSG indication as attributes to LTE devices
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10372
diff changeset
   218
LteUeNetDevice::SetCsgId (uint32_t csgId)
0b19dd1e94f7 Converted CSG ID and CSG indication as attributes to LTE devices
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10372
diff changeset
   219
{
0b19dd1e94f7 Converted CSG ID and CSG indication as attributes to LTE devices
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10372
diff changeset
   220
  NS_LOG_FUNCTION (this << csgId);
0b19dd1e94f7 Converted CSG ID and CSG indication as attributes to LTE devices
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10372
diff changeset
   221
  m_csgId = csgId;
0b19dd1e94f7 Converted CSG ID and CSG indication as attributes to LTE devices
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10372
diff changeset
   222
  UpdateConfig (); // propagate the change down to NAS and RRC
0b19dd1e94f7 Converted CSG ID and CSG indication as attributes to LTE devices
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10372
diff changeset
   223
}
0b19dd1e94f7 Converted CSG ID and CSG indication as attributes to LTE devices
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10372
diff changeset
   224
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   225
void
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   226
LteUeNetDevice::SetTargetEnb (Ptr<LteEnbNetDevice> enb)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   227
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   228
  NS_LOG_FUNCTION (this << enb);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   229
  m_targetEnb = enb;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   230
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   231
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   232
7887
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   233
Ptr<LteEnbNetDevice>
78911c978517 renamed several LTE files and classes
CTTC
parents: 7886
diff changeset
   234
LteUeNetDevice::GetTargetEnb (void)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   235
{
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   236
  NS_LOG_FUNCTION (this);
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   237
  return m_targetEnb;
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   238
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   239
7976
541eee38ac12 fixed LENA-78 m_dlBandwidth not initialized
Nicola Baldo <nbaldo@cttc.es>
parents: 7955
diff changeset
   240
void 
9703
681f35b212ff Rename Start and DoStart methods to Initialize and DoInitialize
Vedran Miletić <rivanvx@gmail.com>
parents: 9653
diff changeset
   241
LteUeNetDevice::DoInitialize (void)
7976
541eee38ac12 fixed LENA-78 m_dlBandwidth not initialized
Nicola Baldo <nbaldo@cttc.es>
parents: 7955
diff changeset
   242
{
8032
ecc5171f1f96 fixed IMSI initialization
Nicola Baldo <nbaldo@cttc.es>
parents: 8015
diff changeset
   243
  NS_LOG_FUNCTION (this);
10382
0b19dd1e94f7 Converted CSG ID and CSG indication as attributes to LTE devices
Budiarto Herman <budiarto.herman@magister.fi>
parents: 10372
diff changeset
   244
  m_isConstructed = true;
7976
541eee38ac12 fixed LENA-78 m_dlBandwidth not initialized
Nicola Baldo <nbaldo@cttc.es>
parents: 7955
diff changeset
   245
  UpdateConfig ();
9703
681f35b212ff Rename Start and DoStart methods to Initialize and DoInitialize
Vedran Miletić <rivanvx@gmail.com>
parents: 9653
diff changeset
   246
  m_phy->Initialize ();
681f35b212ff Rename Start and DoStart methods to Initialize and DoInitialize
Vedran Miletić <rivanvx@gmail.com>
parents: 9653
diff changeset
   247
  m_mac->Initialize ();
681f35b212ff Rename Start and DoStart methods to Initialize and DoInitialize
Vedran Miletić <rivanvx@gmail.com>
parents: 9653
diff changeset
   248
  m_rrc->Initialize ();
7976
541eee38ac12 fixed LENA-78 m_dlBandwidth not initialized
Nicola Baldo <nbaldo@cttc.es>
parents: 7955
diff changeset
   249
}
541eee38ac12 fixed LENA-78 m_dlBandwidth not initialized
Nicola Baldo <nbaldo@cttc.es>
parents: 7955
diff changeset
   250
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   251
bool
8389
cb215987eb77 LTE-EPC end-to-end data plane imlemented and partially working
Nicola Baldo <nbaldo@cttc.es>
parents: 8167
diff changeset
   252
LteUeNetDevice::Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber)
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   253
{
8389
cb215987eb77 LTE-EPC end-to-end data plane imlemented and partially working
Nicola Baldo <nbaldo@cttc.es>
parents: 8167
diff changeset
   254
  NS_LOG_FUNCTION (this << dest << protocolNumber);
9888
ba0cc8987365 log msg instead of fail when non-IPv4 pkt is sent over LteUeNetDevice
Hajime Tazaki <tazaki@sfc.wide.ad.jp>
parents: 9703
diff changeset
   255
  if (protocolNumber != Ipv4L3Protocol::PROT_NUMBER)
ba0cc8987365 log msg instead of fail when non-IPv4 pkt is sent over LteUeNetDevice
Hajime Tazaki <tazaki@sfc.wide.ad.jp>
parents: 9703
diff changeset
   256
    {
ba0cc8987365 log msg instead of fail when non-IPv4 pkt is sent over LteUeNetDevice
Hajime Tazaki <tazaki@sfc.wide.ad.jp>
parents: 9703
diff changeset
   257
      NS_LOG_INFO("unsupported protocol " << protocolNumber << ", only IPv4 is supported");
ba0cc8987365 log msg instead of fail when non-IPv4 pkt is sent over LteUeNetDevice
Hajime Tazaki <tazaki@sfc.wide.ad.jp>
parents: 9703
diff changeset
   258
      return true;
ba0cc8987365 log msg instead of fail when non-IPv4 pkt is sent over LteUeNetDevice
Hajime Tazaki <tazaki@sfc.wide.ad.jp>
parents: 9703
diff changeset
   259
    }  
9337
ae7126b266ce revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents: 8395
diff changeset
   260
  return m_nas->Send (packet);
6705
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   261
}
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   262
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   263
422c67049471 LTE module form GSoC project
Giuseppe Piro <g.piro@poliba.it>
parents:
diff changeset
   264
} // namespace ns3