author | Budiarto Herman <budiarto.herman@magister.fi> |
Fri, 02 Aug 2013 19:03:01 +0300 | |
changeset 10312 | d37b9d88c6f1 |
parent 10301 | d527fc67106d |
child 10337 | fefe62359afd |
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 |
NS_LOG_COMPONENT_DEFINE ("EpcUeNas"); |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
31 |
|
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
32 |
namespace ns3 { |
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 |
|
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
35 |
|
9406 | 36 |
|
37 |
||
10301
d527fc67106d
Removed PLMN from LTE cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10300
diff
changeset
|
38 |
const char* g_ueNasStateName[EpcUeNas::NUM_STATES] = |
d527fc67106d
Removed PLMN from LTE cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10300
diff
changeset
|
39 |
{ |
d527fc67106d
Removed PLMN from LTE cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10300
diff
changeset
|
40 |
"OFF", |
d527fc67106d
Removed PLMN from LTE cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10300
diff
changeset
|
41 |
"ATTACHING", |
d527fc67106d
Removed PLMN from LTE cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10300
diff
changeset
|
42 |
"IDLE_REGISTERED", |
d527fc67106d
Removed PLMN from LTE cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10300
diff
changeset
|
43 |
"CONNECTING_TO_EPC", |
d527fc67106d
Removed PLMN from LTE cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10300
diff
changeset
|
44 |
"ACTIVE" |
d527fc67106d
Removed PLMN from LTE cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10300
diff
changeset
|
45 |
}; |
9406 | 46 |
|
47 |
std::string ToString (EpcUeNas::State s) |
|
48 |
{ |
|
49 |
return std::string (g_ueNasStateName[s]); |
|
50 |
} |
|
51 |
||
52 |
||
53 |
||
54 |
||
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
55 |
NS_OBJECT_ENSURE_REGISTERED (EpcUeNas); |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
56 |
|
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
57 |
EpcUeNas::EpcUeNas () |
9406 | 58 |
: m_state (OFF), |
10300
792cecb6cf2d
Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10296
diff
changeset
|
59 |
m_csgId (0), |
9406 | 60 |
m_asSapProvider (0), |
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
61 |
m_bidCounter (0) |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
62 |
{ |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
63 |
NS_LOG_FUNCTION (this); |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
64 |
m_asSapUser = new MemberLteAsSapUser<EpcUeNas> (this); |
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 |
|
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
67 |
|
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
68 |
EpcUeNas::~EpcUeNas () |
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 |
NS_LOG_FUNCTION (this); |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
71 |
} |
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 |
void |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
74 |
EpcUeNas::DoDispose () |
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 |
NS_LOG_FUNCTION (this); |
10300
792cecb6cf2d
Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10296
diff
changeset
|
77 |
delete m_asSapUser; |
9337
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 |
|
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
80 |
TypeId |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
81 |
EpcUeNas::GetTypeId (void) |
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 |
static TypeId tid = TypeId ("ns3::EpcUeNas") |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
84 |
.SetParent<Object> () |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
85 |
.AddConstructor<EpcUeNas> () |
9406 | 86 |
.AddTraceSource ("StateTransition", |
87 |
"fired upon every UE NAS state transition", |
|
88 |
MakeTraceSourceAccessor (&EpcUeNas::m_stateTransitionCallback)) |
|
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
89 |
; |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
90 |
return tid; |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
91 |
} |
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 |
void |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
94 |
EpcUeNas::SetDevice (Ptr<NetDevice> dev) |
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 |
m_device = dev; |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
97 |
} |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
98 |
|
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
99 |
void |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
100 |
EpcUeNas::SetImsi (uint64_t imsi) |
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 |
m_imsi = imsi; |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
103 |
} |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
104 |
|
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
105 |
void |
10300
792cecb6cf2d
Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10296
diff
changeset
|
106 |
EpcUeNas::SetCsgId (uint32_t csgId) |
792cecb6cf2d
Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10296
diff
changeset
|
107 |
{ |
792cecb6cf2d
Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10296
diff
changeset
|
108 |
m_csgId = csgId; |
792cecb6cf2d
Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10296
diff
changeset
|
109 |
m_asSapProvider->SetCsgWhiteList (csgId); |
792cecb6cf2d
Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10296
diff
changeset
|
110 |
} |
792cecb6cf2d
Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10296
diff
changeset
|
111 |
|
792cecb6cf2d
Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10296
diff
changeset
|
112 |
uint32_t |
792cecb6cf2d
Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10296
diff
changeset
|
113 |
EpcUeNas::GetCsgId () const |
792cecb6cf2d
Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10296
diff
changeset
|
114 |
{ |
792cecb6cf2d
Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10296
diff
changeset
|
115 |
return m_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 |
void |
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
119 |
EpcUeNas::SetAsSapProvider (LteAsSapProvider* s) |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
120 |
{ |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
121 |
m_asSapProvider = s; |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
122 |
} |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
123 |
|
10300
792cecb6cf2d
Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10296
diff
changeset
|
124 |
LteAsSapUser* |
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
125 |
EpcUeNas::GetAsSapUser () |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
126 |
{ |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
127 |
return m_asSapUser; |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
128 |
} |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
129 |
|
10300
792cecb6cf2d
Evaluation of cell selection criteria
Budiarto Herman <budiarto.herman@magister.fi>
parents:
10296
diff
changeset
|
130 |
void |
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
131 |
EpcUeNas::SetForwardUpCallback (Callback <void, Ptr<Packet> > cb) |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
132 |
{ |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
133 |
m_forwardUpCallback = cb; |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
134 |
} |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
135 |
|
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
|
136 |
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
|
137 |
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
|
138 |
{ |
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
|
139 |
NS_LOG_FUNCTION (this); |
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
|
140 |
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
|
141 |
} |
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
|
142 |
|
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
143 |
void |
10296
13ff285523bf
Generic (not eNodeB-specific) helper functions Attach and Connect
Budiarto Herman <budiarto.herman@magister.fi>
parents:
9539
diff
changeset
|
144 |
EpcUeNas::Connect () |
13ff285523bf
Generic (not eNodeB-specific) helper functions Attach and Connect
Budiarto Herman <budiarto.herman@magister.fi>
parents:
9539
diff
changeset
|
145 |
{ |
13ff285523bf
Generic (not eNodeB-specific) helper functions Attach and Connect
Budiarto Herman <budiarto.herman@magister.fi>
parents:
9539
diff
changeset
|
146 |
NS_LOG_FUNCTION (this); |
13ff285523bf
Generic (not eNodeB-specific) helper functions Attach and Connect
Budiarto Herman <budiarto.herman@magister.fi>
parents:
9539
diff
changeset
|
147 |
|
13ff285523bf
Generic (not eNodeB-specific) helper functions Attach and Connect
Budiarto Herman <budiarto.herman@magister.fi>
parents:
9539
diff
changeset
|
148 |
// 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
|
149 |
m_asSapProvider->Connect (); |
13ff285523bf
Generic (not eNodeB-specific) helper functions Attach and Connect
Budiarto Herman <budiarto.herman@magister.fi>
parents:
9539
diff
changeset
|
150 |
} |
13ff285523bf
Generic (not eNodeB-specific) helper functions Attach and Connect
Budiarto Herman <budiarto.herman@magister.fi>
parents:
9539
diff
changeset
|
151 |
|
13ff285523bf
Generic (not eNodeB-specific) helper functions Attach and Connect
Budiarto Herman <budiarto.herman@magister.fi>
parents:
9539
diff
changeset
|
152 |
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
|
153 |
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
|
154 |
{ |
9406 | 155 |
NS_LOG_FUNCTION (this); |
156 |
||
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
157 |
// 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
|
158 |
m_asSapProvider->ForceCampedOnEnb (cellId, dlEarfcn); |
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
159 |
|
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
160 |
// tell RRC to go into connected mode |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
161 |
m_asSapProvider->Connect (); |
9406 | 162 |
} |
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
163 |
|
9406 | 164 |
|
165 |
void |
|
166 |
EpcUeNas::Disconnect () |
|
167 |
{ |
|
168 |
NS_LOG_FUNCTION (this); |
|
169 |
m_asSapProvider->Disconnect (); |
|
170 |
SwitchToState (OFF); |
|
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
171 |
} |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
172 |
|
9406 | 173 |
|
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
174 |
void |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
175 |
EpcUeNas::ActivateEpsBearer (EpsBearer bearer, Ptr<EpcTft> tft) |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
176 |
{ |
9406 | 177 |
NS_LOG_FUNCTION (this); |
178 |
switch (m_state) |
|
179 |
{ |
|
180 |
case ACTIVE: |
|
9430
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9406
diff
changeset
|
181 |
NS_FATAL_ERROR ("the necessary NAS signaling to activate a bearer after the initial context has already been setup is not implemented"); |
9406 | 182 |
break; |
183 |
||
184 |
default: |
|
185 |
BearerToBeActivated btba; |
|
186 |
btba.bearer = bearer; |
|
187 |
btba.tft = tft; |
|
188 |
m_bearersToBeActivatedList.push_back (btba); |
|
189 |
break; |
|
190 |
} |
|
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
191 |
} |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
192 |
|
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
193 |
bool |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
194 |
EpcUeNas::Send (Ptr<Packet> packet) |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
195 |
{ |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
196 |
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
|
197 |
|
9406 | 198 |
switch (m_state) |
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
199 |
{ |
9406 | 200 |
case ACTIVE: |
201 |
{ |
|
202 |
uint32_t id = m_tftClassifier.Classify (packet, EpcTft::UPLINK); |
|
203 |
NS_ASSERT ((id & 0xFFFFFF00) == 0); |
|
204 |
uint8_t bid = (uint8_t) (id & 0x000000FF); |
|
205 |
if (bid == 0) |
|
206 |
{ |
|
207 |
return false; |
|
208 |
} |
|
209 |
else |
|
210 |
{ |
|
211 |
m_asSapProvider->SendData (packet, bid); |
|
212 |
return true; |
|
10296
13ff285523bf
Generic (not eNodeB-specific) helper functions Attach and Connect
Budiarto Herman <budiarto.herman@magister.fi>
parents:
9539
diff
changeset
|
213 |
} |
9406 | 214 |
} |
215 |
break; |
|
216 |
||
10296
13ff285523bf
Generic (not eNodeB-specific) helper functions Attach and Connect
Budiarto Herman <budiarto.herman@magister.fi>
parents:
9539
diff
changeset
|
217 |
default: |
9406 | 218 |
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
|
219 |
return false; |
9406 | 220 |
break; |
10296
13ff285523bf
Generic (not eNodeB-specific) helper functions Attach and Connect
Budiarto Herman <budiarto.herman@magister.fi>
parents:
9539
diff
changeset
|
221 |
} |
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
222 |
} |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
223 |
|
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
224 |
void |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
225 |
EpcUeNas::DoNotifyConnectionSuccessful () |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
226 |
{ |
9406 | 227 |
NS_LOG_FUNCTION (this); |
9430
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9406
diff
changeset
|
228 |
|
e8b87593ee5b
added MME with simulated S1AP and S11 interfaces
Nicola Baldo <nbaldo@cttc.es>
parents:
9406
diff
changeset
|
229 |
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
|
230 |
} |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
231 |
|
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
232 |
void |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
233 |
EpcUeNas::DoNotifyConnectionFailed () |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
234 |
{ |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
235 |
NS_FATAL_ERROR ("connection failed, it should not happen with the current model"); |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
236 |
} |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
237 |
|
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
238 |
void |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
239 |
EpcUeNas::DoRecvData (Ptr<Packet> packet) |
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 |
NS_LOG_FUNCTION (this); |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
242 |
m_forwardUpCallback (packet); |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
243 |
} |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
244 |
|
9406 | 245 |
void |
246 |
EpcUeNas::DoNotifyConnectionReleased () |
|
247 |
{ |
|
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
|
248 |
NS_LOG_FUNCTION (this); |
9539
8ae380bcb768
Switch to OFF state in NAS, not in RRC.
Lluis Parcerisa <parcerisa@gmail.com>
parents:
9529
diff
changeset
|
249 |
SwitchToState (OFF); |
9406 | 250 |
} |
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
251 |
|
9406 | 252 |
void |
253 |
EpcUeNas::DoActivateEpsBearer (EpsBearer bearer, Ptr<EpcTft> tft) |
|
254 |
{ |
|
255 |
NS_LOG_FUNCTION (this); |
|
256 |
NS_ASSERT_MSG (m_bidCounter < 11, "cannot have more than 11 EPS bearers"); |
|
257 |
uint8_t bid = ++m_bidCounter; |
|
258 |
m_tftClassifier.Add (tft, bid); |
|
259 |
} |
|
260 |
||
261 |
void |
|
262 |
EpcUeNas::SwitchToState (State newState) |
|
263 |
{ |
|
264 |
NS_LOG_FUNCTION (this << newState); |
|
265 |
State oldState = m_state; |
|
266 |
m_state = newState; |
|
267 |
NS_LOG_INFO ("IMSI " << m_imsi << " NAS " << ToString (oldState) << " --> " << ToString (newState)); |
|
268 |
m_stateTransitionCallback (oldState, newState); |
|
269 |
||
270 |
// actions to be done when entering a new state: |
|
271 |
switch (m_state) |
|
272 |
{ |
|
273 |
case ACTIVE: |
|
274 |
for (std::list<BearerToBeActivated>::iterator it = m_bearersToBeActivatedList.begin (); |
|
275 |
it != m_bearersToBeActivatedList.end (); |
|
276 |
m_bearersToBeActivatedList.erase (it++)) |
|
277 |
{ |
|
278 |
DoActivateEpsBearer (it->bearer, it->tft); |
|
279 |
} |
|
280 |
break; |
|
281 |
||
282 |
default: |
|
283 |
break; |
|
284 |
} |
|
285 |
||
286 |
} |
|
9337
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
287 |
|
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
288 |
|
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
289 |
} // namespace ns3 |
ae7126b266ce
revised LTE protocol stack for new RRC model
Nicola Baldo <nbaldo@cttc.es>
parents:
diff
changeset
|
290 |