A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
epc-ue-nas.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2012 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Nicola Baldo <nbaldo@cttc.es>
18 */
19
20#ifndef EPC_UE_NAS_H
21#define EPC_UE_NAS_H
22
23#include "epc-tft-classifier.h"
24#include "eps-bearer.h"
25#include "lte-as-sap.h"
26
27#include <ns3/object.h>
28#include <ns3/traced-callback.h>
29
30namespace ns3
31{
32
33class EpcHelper;
34class NetDevice;
35
36class EpcUeNas : public Object
37{
38 /// allow MemberLteAsSapUser<EpcUeNas> class friend access
39 friend class MemberLteAsSapUser<EpcUeNas>;
40
41 public:
42 /**
43 * Constructor
44 */
45 EpcUeNas();
46
47 /**
48 * Destructor
49 */
50 ~EpcUeNas() override;
51
52 // inherited from Object
53 void DoDispose() override;
54 /**
55 * \brief Get the type ID.
56 * \return the object TypeId
57 */
58 static TypeId GetTypeId();
59
60 /**
61 *
62 * \param dev the UE NetDevice
63 */
64 void SetDevice(Ptr<NetDevice> dev);
65
66 /**
67 *
68 *
69 * \param imsi the unique UE identifier
70 */
71 void SetImsi(uint64_t imsi);
72
73 /**
74 *
75 * \param csgId Closed Subscriber Group identity
76 */
77 void SetCsgId(uint32_t csgId);
78
79 /**
80 *
81 * \return csgId Closed Subscriber Group identity
82 */
83 uint32_t GetCsgId() const;
84
85 /**
86 * Set the AS SAP provider to interact with the NAS entity
87 *
88 * \param s the AS SAP provider
89 */
91
92 /**
93 *
94 *
95 * \return the AS SAP user exported by this RRC
96 */
98
99 /**
100 * set the callback used to forward data packets up the stack
101 *
102 * \param cb the callback
103 */
105
106 /**
107 * \brief Causes NAS to tell AS to find a suitable cell and camp to it.
108 *
109 * \param dlEarfcn the DL frequency of the eNB
110 */
111 void StartCellSelection(uint32_t dlEarfcn);
112
113 /**
114 * \brief Causes NAS to tell AS to go to ACTIVE state.
115 *
116 * The end result is equivalent with EMM Registered + ECM Connected states.
117 */
118 void Connect();
119
120 /**
121 * \brief Causes NAS to tell AS to camp to a specific cell and go to ACTIVE
122 * state.
123 * \param cellId the id of the eNB to camp on
124 * \param dlEarfcn the DL frequency of the eNB
125 *
126 * The end result is equivalent with EMM Registered + ECM Connected states.
127 * Since RRC Idle Mode cell selection is not supported yet, we force the UE
128 * RRC to be camped on a specific eNB.
129 */
130 void Connect(uint16_t cellId, uint32_t dlEarfcn);
131
132 /**
133 * instruct the NAS to disconnect
134 *
135 */
136 void Disconnect();
137
138 /**
139 * Activate an EPS bearer
140 *
141 * \param bearer the characteristics of the bearer to be created
142 * \param tft the TFT identifying the traffic that will go on this bearer
143 */
144 void ActivateEpsBearer(EpsBearer bearer, Ptr<EpcTft> tft);
145
146 /**
147 * Enqueue an IP packet on the proper bearer for uplink transmission
148 *
149 * \param p the packet
150 * \param protocolNumber the protocol number of the packet
151 *
152 * \return true if successful, false if an error occurred
153 */
154 bool Send(Ptr<Packet> p, uint16_t protocolNumber);
155
156 /**
157 * Definition of NAS states as per "LTE - From theory to practice",
158 * Section 3.2.3.2 "Connection Establishment and Release"
159 *
160 */
161 enum State
162 {
163 OFF = 0,
169 };
170
171 /**
172 * \return The current state
173 */
174 State GetState() const;
175
176 /**
177 * TracedCallback signature for state change events.
178 *
179 * \param [in] oldState The old State.
180 * \param [in] newState the new State.
181 */
182 typedef void (*StateTracedCallback)(const State oldState, const State newState);
183
184 private:
185 // LTE AS SAP methods
186 /// Notify successful connection
188 /// Notify connection failed
190 /// Notify connection released
192 /**
193 * Receive data
194 * \param packet the packet
195 */
196 void DoRecvData(Ptr<Packet> packet);
197
198 // internal methods
199 /**
200 * Activate EPS Bearer
201 * \param bearer the EPS bearer
202 * \param tft the EPC TFT
203 */
204 void DoActivateEpsBearer(EpsBearer bearer, Ptr<EpcTft> tft);
205 /**
206 * Switch the UE RRC to the given state.
207 * \param s the destination state
208 */
209 void SwitchToState(State s);
210
211 /// The current UE NAS state.
213
214 /**
215 * The `StateTransition` trace source. Fired upon every UE NAS state
216 * transition. Exporting old state and new state.
217 * \todo This should be a TracedValue
218 */
220
221 /// The UE NetDevice.
223
224 /// The unique UE identifier.
225 uint64_t m_imsi;
226
227 /// Closed Subscriber Group identity.
229
230 /// LTE SAP provider
232 /// LTE SAP user
234
235 uint8_t m_bidCounter; ///< bid counter
237
239
240 /// BearerToBeActivated structure
242 {
243 EpsBearer bearer; ///< EPS bearer
244 Ptr<EpcTft> tft; ///< TFT
245 };
246
247 std::list<BearerToBeActivated> m_bearersToBeActivatedList; ///< bearers to be activated list
248
249 /**
250 * bearers to be activated list maintained and to be used for reconnecting
251 * an out-of-sync UE
252 *
253 */
254 std::list<BearerToBeActivated> m_bearersToBeActivatedListForReconnection;
255};
256
257} // namespace ns3
258
259#endif // EPC_UE_NAS_H
Callback template class.
Definition: callback.h:438
Base helper class to handle the creation of the EPC entities.
Definition: epc-helper.h:51
classifies IP packets according to Traffic Flow Templates (TFTs)
void SwitchToState(State s)
Switch the UE RRC to the given state.
Definition: epc-ue-nas.cc:285
uint64_t m_imsi
The unique UE identifier.
Definition: epc-ue-nas.h:225
State m_state
The current UE NAS state.
Definition: epc-ue-nas.h:212
~EpcUeNas() override
Destructor.
Definition: epc-ue-nas.cc:65
void DoNotifyConnectionSuccessful()
Notify successful connection.
Definition: epc-ue-nas.cc:229
Callback< void, Ptr< Packet > > m_forwardUpCallback
upward callback
Definition: epc-ue-nas.h:238
LteAsSapUser * m_asSapUser
LTE SAP user.
Definition: epc-ue-nas.h:233
void SetDevice(Ptr< NetDevice > dev)
Definition: epc-ue-nas.cc:93
uint8_t m_bidCounter
bid counter
Definition: epc-ue-nas.h:235
std::list< BearerToBeActivated > m_bearersToBeActivatedListForReconnection
bearers to be activated list maintained and to be used for reconnecting an out-of-sync UE
Definition: epc-ue-nas.h:254
TracedCallback< State, State > m_stateTransitionCallback
The StateTransition trace source.
Definition: epc-ue-nas.h:219
void StartCellSelection(uint32_t dlEarfcn)
Causes NAS to tell AS to find a suitable cell and camp to it.
Definition: epc-ue-nas.cc:143
State GetState() const
Definition: epc-ue-nas.cc:278
uint32_t m_csgId
Closed Subscriber Group identity.
Definition: epc-ue-nas.h:228
EpcUeNas()
Constructor.
Definition: epc-ue-nas.cc:55
LteAsSapUser * GetAsSapUser()
Definition: epc-ue-nas.cc:129
void DoActivateEpsBearer(EpsBearer bearer, Ptr< EpcTft > tft)
Activate EPS Bearer.
Definition: epc-ue-nas.cc:269
State
Definition of NAS states as per "LTE - From theory to practice", Section 3.2.3.2 "Connection Establis...
Definition: epc-ue-nas.h:162
void DoNotifyConnectionFailed()
Notify connection failed.
Definition: epc-ue-nas.cc:237
LteAsSapProvider * m_asSapProvider
LTE SAP provider.
Definition: epc-ue-nas.h:231
static TypeId GetTypeId()
Get the type ID.
Definition: epc-ue-nas.cc:78
void Disconnect()
instruct the NAS to disconnect
Definition: epc-ue-nas.cc:171
EpcTftClassifier m_tftClassifier
tft classifier
Definition: epc-ue-nas.h:236
void DoDispose() override
Destructor implementation.
Definition: epc-ue-nas.cc:71
void DoNotifyConnectionReleased()
Notify connection released.
Definition: epc-ue-nas.cc:253
void Connect()
Causes NAS to tell AS to go to ACTIVE state.
Definition: epc-ue-nas.cc:150
void SetImsi(uint64_t imsi)
Definition: epc-ue-nas.cc:100
Ptr< NetDevice > m_device
The UE NetDevice.
Definition: epc-ue-nas.h:222
void SetAsSapProvider(LteAsSapProvider *s)
Set the AS SAP provider to interact with the NAS entity.
Definition: epc-ue-nas.cc:122
void SetCsgId(uint32_t csgId)
Definition: epc-ue-nas.cc:107
void ActivateEpsBearer(EpsBearer bearer, Ptr< EpcTft > tft)
Activate an EPS bearer.
Definition: epc-ue-nas.cc:179
void(* StateTracedCallback)(const State oldState, const State newState)
TracedCallback signature for state change events.
Definition: epc-ue-nas.h:182
void SetForwardUpCallback(Callback< void, Ptr< Packet > > cb)
set the callback used to forward data packets up the stack
Definition: epc-ue-nas.cc:136
std::list< BearerToBeActivated > m_bearersToBeActivatedList
bearers to be activated list
Definition: epc-ue-nas.h:247
void DoRecvData(Ptr< Packet > packet)
Receive data.
Definition: epc-ue-nas.cc:246
bool Send(Ptr< Packet > p, uint16_t protocolNumber)
Enqueue an IP packet on the proper bearer for uplink transmission.
Definition: epc-ue-nas.cc:200
uint32_t GetCsgId() const
Definition: epc-ue-nas.cc:115
This class contains the specification of EPS Bearers.
Definition: eps-bearer.h:91
This class implements the Access Stratum (AS) Service Access Point (SAP), i.e., the interface between...
Definition: lte-as-sap.h:39
This class implements the Access Stratum (AS) Service Access Point (SAP), i.e., the interface between...
Definition: lte-as-sap.h:98
Template for the implementation of the LteAsSapUser as a member of an owner class of type C to which ...
Definition: lte-as-sap.h:209
Network layer to device interface.
Definition: net-device.h:98
A base class which provides memory management and object aggregation.
Definition: object.h:89
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.
BearerToBeActivated structure.
Definition: epc-ue-nas.h:242
EpsBearer bearer
EPS bearer.
Definition: epc-ue-nas.h:243