author | Budiarto Herman <budiarto.herman@magister.fi> |
Mon, 06 Oct 2014 16:05:46 -0700 | |
changeset 10983 | 087597a150da |
parent 10968 | 2d29fee2b7b8 |
child 11086 | 65914b1ed5b3 |
permissions | -rw-r--r-- |
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
1 |
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
2 |
/* |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
3 |
* Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
4 |
* |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
8 |
* |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
13 |
* |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
17 |
* |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
18 |
* Author: Nicola Baldo <nbaldo@cttc.es> |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
19 |
*/ |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
20 |
|
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
21 |
#include <ns3/fatal-error.h> |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
22 |
#include <ns3/log.h> |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
23 |
|
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
24 |
#include <ns3/epc-helper.h> |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
25 |
|
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
26 |
#include "lte-enb-net-device.h" |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
27 |
#include "epc-ue-nas.h" |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
28 |
#include "lte-as-sap.h" |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
29 |
|
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
30 |
namespace ns3 { |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
31 |
|
10968
2d29fee2b7b8
[Bug 1551] Redux: NS_LOG_COMPONENT_DEFINE inside or outside of ns3 namespace?
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10850
diff
changeset
|
32 |
NS_LOG_COMPONENT_DEFINE ("EpcUeNas"); |
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
33 |
|
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
34 |
|
9406 | 35 |
|
10983
087597a150da
LTE doxygen additions
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10968
diff
changeset
|
36 |
/// Map each of UE NAS states to its string representation. |
10680
ace43d9baa17
make various implementation-specific tables static const.
Andrey Mazo <ahippo@yandex.com>
parents:
10652
diff
changeset
|
37 |
static const std::string g_ueNasStateName[EpcUeNas::NUM_STATES] = |
10301
d527fc67106d
Removed PLMN from LTE cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10300
diff
changeset
|
38 |
{ |
d527fc67106d
Removed PLMN from LTE cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10300
diff
changeset
|
39 |
"OFF", |
d527fc67106d
Removed PLMN from LTE cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10300
diff
changeset
|
40 |
"ATTACHING", |
d527fc67106d
Removed PLMN from LTE cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10300
diff
changeset
|
41 |
"IDLE_REGISTERED", |
d527fc67106d
Removed PLMN from LTE cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10300
diff
changeset
|
42 |
"CONNECTING_TO_EPC", |
d527fc67106d
Removed PLMN from LTE cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10300
diff
changeset
|
43 |
"ACTIVE" |
d527fc67106d
Removed PLMN from LTE cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10300
diff
changeset
|
44 |
}; |
9406 | 45 |
|
10983
087597a150da
LTE doxygen additions
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10968
diff
changeset
|
46 |
/** |
087597a150da
LTE doxygen additions
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10968
diff
changeset
|
47 |
* \param s The UE NAS state. |
087597a150da
LTE doxygen additions
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10968
diff
changeset
|
48 |
* \return The string representation of the given state. |
087597a150da
LTE doxygen additions
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10968
diff
changeset
|
49 |
*/ |
10680
ace43d9baa17
make various implementation-specific tables static const.
Andrey Mazo <ahippo@yandex.com>
parents:
10652
diff
changeset
|
50 |
static inline const std::string & ToString (EpcUeNas::State s) |
9406 | 51 |
{ |
10680
ace43d9baa17
make various implementation-specific tables static const.
Andrey Mazo <ahippo@yandex.com>
parents:
10652
diff
changeset
|
52 |
return g_ueNasStateName[s]; |
9406 | 53 |
} |
54 |
||
55 |
||
56 |
||
57 |
||
10652
dc18deba4502
[doxygen] Revert r10410, r10411, r10412
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents:
10410
diff
changeset
|
58 |
NS_OBJECT_ENSURE_REGISTERED (EpcUeNas); |
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
59 |
|
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
60 |
EpcUeNas::EpcUeNas () |
9406 | 61 |
: m_state (OFF), |
10300
792cecb6cf2d
Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10296
diff
changeset
|
62 |
m_csgId (0), |
9406 | 63 |
m_asSapProvider (0), |
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
64 |
m_bidCounter (0) |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
65 |
{ |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
66 |
NS_LOG_FUNCTION (this); |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
67 |
m_asSapUser = new MemberLteAsSapUser<EpcUeNas> (this); |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
68 |
} |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
69 |
|
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
70 |
|
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
71 |
EpcUeNas::~EpcUeNas () |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
72 |
{ |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
73 |
NS_LOG_FUNCTION (this); |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
74 |
} |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
75 |
|
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
76 |
void |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
77 |
EpcUeNas::DoDispose () |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
78 |
{ |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
79 |
NS_LOG_FUNCTION (this); |
10300
792cecb6cf2d
Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10296
diff
changeset
|
80 |
delete m_asSapUser; |
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
81 |
} |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
82 |
|
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
83 |
TypeId |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
84 |
EpcUeNas::GetTypeId (void) |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
85 |
{ |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
86 |
static TypeId tid = TypeId ("ns3::EpcUeNas") |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
87 |
.SetParent<Object> () |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
88 |
.AddConstructor<EpcUeNas> () |
9406 | 89 |
.AddTraceSource ("StateTransition", |
90 |
"fired upon every UE NAS state transition", |
|
91 |
MakeTraceSourceAccessor (&EpcUeNas::m_stateTransitionCallback)) |
|
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
92 |
; |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
93 |
return tid; |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
94 |
} |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
95 |
|
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
96 |
void |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
97 |
EpcUeNas::SetDevice (Ptr<NetDevice> dev) |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
98 |
{ |
10372
c334a429efaa
Added missing NS_LOG_FUNCTION to some LTE module files
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10368
diff
changeset
|
99 |
NS_LOG_FUNCTION (this << dev); |
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
100 |
m_device = dev; |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
101 |
} |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
102 |
|
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
103 |
void |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
104 |
EpcUeNas::SetImsi (uint64_t imsi) |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
105 |
{ |
10372
c334a429efaa
Added missing NS_LOG_FUNCTION to some LTE module files
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10368
diff
changeset
|
106 |
NS_LOG_FUNCTION (this << imsi); |
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
107 |
m_imsi = imsi; |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
108 |
} |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
109 |
|
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
110 |
void |
10300
792cecb6cf2d
Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10296
diff
changeset
|
111 |
EpcUeNas::SetCsgId (uint32_t csgId) |
792cecb6cf2d
Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10296
diff
changeset
|
112 |
{ |
10372
c334a429efaa
Added missing NS_LOG_FUNCTION to some LTE module files
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10368
diff
changeset
|
113 |
NS_LOG_FUNCTION (this << csgId); |
10300
792cecb6cf2d
Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10296
diff
changeset
|
114 |
m_csgId = csgId; |
792cecb6cf2d
Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10296
diff
changeset
|
115 |
m_asSapProvider->SetCsgWhiteList (csgId); |
792cecb6cf2d
Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10296
diff
changeset
|
116 |
} |
792cecb6cf2d
Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10296
diff
changeset
|
117 |
|
792cecb6cf2d
Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10296
diff
changeset
|
118 |
uint32_t |
792cecb6cf2d
Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10296
diff
changeset
|
119 |
EpcUeNas::GetCsgId () const |
792cecb6cf2d
Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10296
diff
changeset
|
120 |
{ |
10372
c334a429efaa
Added missing NS_LOG_FUNCTION to some LTE module files
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10368
diff
changeset
|
121 |
NS_LOG_FUNCTION (this); |
10300
792cecb6cf2d
Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10296
diff
changeset
|
122 |
return m_csgId; |
792cecb6cf2d
Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10296
diff
changeset
|
123 |
} |
792cecb6cf2d
Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10296
diff
changeset
|
124 |
|
792cecb6cf2d
Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10296
diff
changeset
|
125 |
void |
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
126 |
EpcUeNas::SetAsSapProvider (LteAsSapProvider* s) |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
127 |
{ |
10372
c334a429efaa
Added missing NS_LOG_FUNCTION to some LTE module files
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10368
diff
changeset
|
128 |
NS_LOG_FUNCTION (this << s); |
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
129 |
m_asSapProvider = s; |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
130 |
} |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
131 |
|
10300
792cecb6cf2d
Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10296
diff
changeset
|
132 |
LteAsSapUser* |
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
133 |
EpcUeNas::GetAsSapUser () |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
134 |
{ |
10372
c334a429efaa
Added missing NS_LOG_FUNCTION to some LTE module files
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10368
diff
changeset
|
135 |
NS_LOG_FUNCTION (this); |
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
136 |
return m_asSapUser; |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
137 |
} |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
138 |
|
10300
792cecb6cf2d
Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10296
diff
changeset
|
139 |
void |
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
140 |
EpcUeNas::SetForwardUpCallback (Callback <void, Ptr<Packet> > cb) |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
141 |
{ |
10372
c334a429efaa
Added missing NS_LOG_FUNCTION to some LTE module files
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10368
diff
changeset
|
142 |
NS_LOG_FUNCTION (this); |
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
143 |
m_forwardUpCallback = cb; |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
144 |
} |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
145 |
|
10312
d37b9d88c6f1
Restructured the initiation of cell selection, so that UeNetDevice does not directly interact with PHY
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10301
diff
changeset
|
146 |
void |
d37b9d88c6f1
Restructured the initiation of cell selection, so that UeNetDevice does not directly interact with PHY
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10301
diff
changeset
|
147 |
EpcUeNas::StartCellSelection (uint16_t dlEarfcn) |
d37b9d88c6f1
Restructured the initiation of cell selection, so that UeNetDevice does not directly interact with PHY
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10301
diff
changeset
|
148 |
{ |
10372
c334a429efaa
Added missing NS_LOG_FUNCTION to some LTE module files
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10368
diff
changeset
|
149 |
NS_LOG_FUNCTION (this << dlEarfcn); |
10312
d37b9d88c6f1
Restructured the initiation of cell selection, so that UeNetDevice does not directly interact with PHY
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10301
diff
changeset
|
150 |
m_asSapProvider->StartCellSelection (dlEarfcn); |
d37b9d88c6f1
Restructured the initiation of cell selection, so that UeNetDevice does not directly interact with PHY
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10301
diff
changeset
|
151 |
} |
d37b9d88c6f1
Restructured the initiation of cell selection, so that UeNetDevice does not directly interact with PHY
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10301
diff
changeset
|
152 |
|
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
153 |
void |
10296
13ff285523bf
Generic (not eNodeB-specific) helper functions Attach and Connect
Budiarto Herman <budiarto.herman@magister.fi>
parents:
9539
diff
changeset
|
154 |
EpcUeNas::Connect () |
13ff285523bf
Generic (not eNodeB-specific) helper functions Attach and Connect
Budiarto Herman <budiarto.herman@magister.fi>
parents:
9539
diff
changeset
|
155 |
{ |
13ff285523bf
Generic (not eNodeB-specific) helper functions Attach and Connect
Budiarto Herman <budiarto.herman@magister.fi>
parents:
9539
diff
changeset
|
156 |
NS_LOG_FUNCTION (this); |
13ff285523bf
Generic (not eNodeB-specific) helper functions Attach and Connect
Budiarto Herman <budiarto.herman@magister.fi>
parents:
9539
diff
changeset
|
157 |
|
13ff285523bf
Generic (not eNodeB-specific) helper functions Attach and Connect
Budiarto Herman <budiarto.herman@magister.fi>
parents:
9539
diff
changeset
|
158 |
// tell RRC to go into connected mode |
13ff285523bf
Generic (not eNodeB-specific) helper functions Attach and Connect
Budiarto Herman <budiarto.herman@magister.fi>
parents:
9539
diff
changeset
|
159 |
m_asSapProvider->Connect (); |
13ff285523bf
Generic (not eNodeB-specific) helper functions Attach and Connect
Budiarto Herman <budiarto.herman@magister.fi>
parents:
9539
diff
changeset
|
160 |
} |
13ff285523bf
Generic (not eNodeB-specific) helper functions Attach and Connect
Budiarto Herman <budiarto.herman@magister.fi>
parents:
9539
diff
changeset
|
161 |
|
13ff285523bf
Generic (not eNodeB-specific) helper functions Attach and Connect
Budiarto Herman <budiarto.herman@magister.fi>
parents:
9539
diff
changeset
|
162 |
void |
10312
d37b9d88c6f1
Restructured the initiation of cell selection, so that UeNetDevice does not directly interact with PHY
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10301
diff
changeset
|
163 |
EpcUeNas::Connect (uint16_t cellId, uint16_t dlEarfcn) |
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
164 |
{ |
10372
c334a429efaa
Added missing NS_LOG_FUNCTION to some LTE module files
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10368
diff
changeset
|
165 |
NS_LOG_FUNCTION (this << cellId << dlEarfcn); |
9406 | 166 |
|
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
167 |
// force the UE RRC to be camped on a specific eNB |
10312
d37b9d88c6f1
Restructured the initiation of cell selection, so that UeNetDevice does not directly interact with PHY
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10301
diff
changeset
|
168 |
m_asSapProvider->ForceCampedOnEnb (cellId, dlEarfcn); |
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
169 |
|
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
170 |
// tell RRC to go into connected mode |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
171 |
m_asSapProvider->Connect (); |
9406 | 172 |
} |
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
173 |
|
9406 | 174 |
|
175 |
void |
|
176 |
EpcUeNas::Disconnect () |
|
177 |
{ |
|
178 |
NS_LOG_FUNCTION (this); |
|
179 |
m_asSapProvider->Disconnect (); |
|
180 |
SwitchToState (OFF); |
|
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
181 |
} |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
182 |
|
9406 | 183 |
|
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
184 |
void |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
185 |
EpcUeNas::ActivateEpsBearer (EpsBearer bearer, Ptr<EpcTft> tft) |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
186 |
{ |
9406 | 187 |
NS_LOG_FUNCTION (this); |
188 |
switch (m_state) |
|
189 |
{ |
|
190 |
case ACTIVE: |
|
9430
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9406
diff
changeset
|
191 |
NS_FATAL_ERROR ("the necessary NAS signaling to activate a bearer after the initial context has already been setup is not implemented"); |
9406 | 192 |
break; |
193 |
||
194 |
default: |
|
195 |
BearerToBeActivated btba; |
|
196 |
btba.bearer = bearer; |
|
197 |
btba.tft = tft; |
|
198 |
m_bearersToBeActivatedList.push_back (btba); |
|
199 |
break; |
|
200 |
} |
|
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
201 |
} |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
202 |
|
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
203 |
bool |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
204 |
EpcUeNas::Send (Ptr<Packet> packet) |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
205 |
{ |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
206 |
NS_LOG_FUNCTION (this << packet); |
10296
13ff285523bf
Generic (not eNodeB-specific) helper functions Attach and Connect
Budiarto Herman <budiarto.herman@magister.fi>
parents:
9539
diff
changeset
|
207 |
|
9406 | 208 |
switch (m_state) |
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
209 |
{ |
9406 | 210 |
case ACTIVE: |
211 |
{ |
|
212 |
uint32_t id = m_tftClassifier.Classify (packet, EpcTft::UPLINK); |
|
213 |
NS_ASSERT ((id & 0xFFFFFF00) == 0); |
|
214 |
uint8_t bid = (uint8_t) (id & 0x000000FF); |
|
215 |
if (bid == 0) |
|
216 |
{ |
|
217 |
return false; |
|
218 |
} |
|
219 |
else |
|
220 |
{ |
|
221 |
m_asSapProvider->SendData (packet, bid); |
|
222 |
return true; |
|
10296
13ff285523bf
Generic (not eNodeB-specific) helper functions Attach and Connect
Budiarto Herman <budiarto.herman@magister.fi>
parents:
9539
diff
changeset
|
223 |
} |
9406 | 224 |
} |
225 |
break; |
|
226 |
||
10296
13ff285523bf
Generic (not eNodeB-specific) helper functions Attach and Connect
Budiarto Herman <budiarto.herman@magister.fi>
parents:
9539
diff
changeset
|
227 |
default: |
9406 | 228 |
NS_LOG_WARN (this << " NAS OFF, discarding packet"); |
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
229 |
return false; |
9406 | 230 |
break; |
10296
13ff285523bf
Generic (not eNodeB-specific) helper functions Attach and Connect
Budiarto Herman <budiarto.herman@magister.fi>
parents:
9539
diff
changeset
|
231 |
} |
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
232 |
} |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
233 |
|
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
234 |
void |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
235 |
EpcUeNas::DoNotifyConnectionSuccessful () |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
236 |
{ |
9406 | 237 |
NS_LOG_FUNCTION (this); |
9430
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9406
diff
changeset
|
238 |
|
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9406
diff
changeset
|
239 |
SwitchToState (ACTIVE); // will eventually activate dedicated bearers |
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
240 |
} |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
241 |
|
10850
310b021e4598
fix Bug 1762 - UE stuck in IDLE_CONNECTING because RRC CONN REQ is not transmitted
Budiarto Herman <buherman@gmx.com>
parents:
10680
diff
changeset
|
242 |
void |
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
243 |
EpcUeNas::DoNotifyConnectionFailed () |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
244 |
{ |
10337
fefe62359afd
Extended UE RRC state model, e.g. with Idle mode cell selection and RRC Connection Re-establishment
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10312
diff
changeset
|
245 |
NS_LOG_FUNCTION (this); |
fefe62359afd
Extended UE RRC state model, e.g. with Idle mode cell selection and RRC Connection Re-establishment
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10312
diff
changeset
|
246 |
|
10850
310b021e4598
fix Bug 1762 - UE stuck in IDLE_CONNECTING because RRC CONN REQ is not transmitted
Budiarto Herman <buherman@gmx.com>
parents:
10680
diff
changeset
|
247 |
// immediately retry the connection |
310b021e4598
fix Bug 1762 - UE stuck in IDLE_CONNECTING because RRC CONN REQ is not transmitted
Budiarto Herman <buherman@gmx.com>
parents:
10680
diff
changeset
|
248 |
Simulator::ScheduleNow (&LteAsSapProvider::Connect, m_asSapProvider); |
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
249 |
} |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
250 |
|
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
251 |
void |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
252 |
EpcUeNas::DoRecvData (Ptr<Packet> packet) |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
253 |
{ |
10372
c334a429efaa
Added missing NS_LOG_FUNCTION to some LTE module files
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10368
diff
changeset
|
254 |
NS_LOG_FUNCTION (this << packet); |
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
255 |
m_forwardUpCallback (packet); |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
256 |
} |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
257 |
|
9406 | 258 |
void |
259 |
EpcUeNas::DoNotifyConnectionReleased () |
|
260 |
{ |
|
9529
830b74366f06
Add OFF state for Ue (switched to this state upon connection reject). Remove assert against connection failed.
Lluis Parcerisa <parcerisa@gmail.com>
parents:
9430
diff
changeset
|
261 |
NS_LOG_FUNCTION (this); |
9539
8ae380bcb768
Switch to OFF state in NAS, not in RRC.
Lluis Parcerisa <parcerisa@gmail.com>
parents:
9529
diff
changeset
|
262 |
SwitchToState (OFF); |
9406 | 263 |
} |
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
264 |
|
9406 | 265 |
void |
266 |
EpcUeNas::DoActivateEpsBearer (EpsBearer bearer, Ptr<EpcTft> tft) |
|
267 |
{ |
|
268 |
NS_LOG_FUNCTION (this); |
|
269 |
NS_ASSERT_MSG (m_bidCounter < 11, "cannot have more than 11 EPS bearers"); |
|
270 |
uint8_t bid = ++m_bidCounter; |
|
271 |
m_tftClassifier.Add (tft, bid); |
|
272 |
} |
|
273 |
||
10374
bad9fbe96995
Added const to some Get functions in LTE module
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10372
diff
changeset
|
274 |
EpcUeNas::State |
bad9fbe96995
Added const to some Get functions in LTE module
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10372
diff
changeset
|
275 |
EpcUeNas::GetState () const |
bad9fbe96995
Added const to some Get functions in LTE module
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10372
diff
changeset
|
276 |
{ |
bad9fbe96995
Added const to some Get functions in LTE module
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10372
diff
changeset
|
277 |
NS_LOG_FUNCTION (this); |
bad9fbe96995
Added const to some Get functions in LTE module
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10372
diff
changeset
|
278 |
return m_state; |
bad9fbe96995
Added const to some Get functions in LTE module
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10372
diff
changeset
|
279 |
} |
bad9fbe96995
Added const to some Get functions in LTE module
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10372
diff
changeset
|
280 |
|
9406 | 281 |
void |
282 |
EpcUeNas::SwitchToState (State newState) |
|
283 |
{ |
|
10372
c334a429efaa
Added missing NS_LOG_FUNCTION to some LTE module files
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10368
diff
changeset
|
284 |
NS_LOG_FUNCTION (this << ToString (newState)); |
9406 | 285 |
State oldState = m_state; |
286 |
m_state = newState; |
|
287 |
NS_LOG_INFO ("IMSI " << m_imsi << " NAS " << ToString (oldState) << " --> " << ToString (newState)); |
|
288 |
m_stateTransitionCallback (oldState, newState); |
|
289 |
||
290 |
// actions to be done when entering a new state: |
|
291 |
switch (m_state) |
|
292 |
{ |
|
293 |
case ACTIVE: |
|
294 |
for (std::list<BearerToBeActivated>::iterator it = m_bearersToBeActivatedList.begin (); |
|
295 |
it != m_bearersToBeActivatedList.end (); |
|
296 |
m_bearersToBeActivatedList.erase (it++)) |
|
297 |
{ |
|
298 |
DoActivateEpsBearer (it->bearer, it->tft); |
|
299 |
} |
|
300 |
break; |
|
301 |
||
302 |
default: |
|
303 |
break; |
|
304 |
} |
|
305 |
||
306 |
} |
|
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
307 |
|
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
308 |
|
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
309 |
} // namespace ns3 |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
310 |