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