A Discrete-Event Network Simulator
API
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 
30 namespace ns3
31 {
32 
33 class EpcHelper;
34 class NetDevice;
35 
36 class EpcUeNas : public Object
37 {
39  friend class MemberLteAsSapUser<EpcUeNas>;
40 
41  public:
45  EpcUeNas();
46 
50  ~EpcUeNas() override;
51 
52  // inherited from Object
53  void DoDispose() override;
58  static TypeId GetTypeId();
59 
64  void SetDevice(Ptr<NetDevice> dev);
65 
71  void SetImsi(uint64_t imsi);
72 
77  void SetCsgId(uint32_t csgId);
78 
83  uint32_t GetCsgId() const;
84 
91 
98 
104  void SetForwardUpCallback(Callback<void, Ptr<Packet>> cb);
105 
111  void StartCellSelection(uint32_t dlEarfcn);
112 
118  void Connect();
119 
130  void Connect(uint16_t cellId, uint32_t dlEarfcn);
131 
136  void Disconnect();
137 
144  void ActivateEpsBearer(EpsBearer bearer, Ptr<EpcTft> tft);
145 
154  bool Send(Ptr<Packet> p, uint16_t protocolNumber);
155 
161  enum State
162  {
163  OFF = 0,
168  NUM_STATES
169  };
170 
174  State GetState() const;
175 
182  typedef void (*StateTracedCallback)(const State oldState, const State newState);
183 
184  private:
185  // LTE AS SAP methods
196  void DoRecvData(Ptr<Packet> packet);
197 
198  // internal methods
204  void DoActivateEpsBearer(EpsBearer bearer, Ptr<EpcTft> tft);
209  void SwitchToState(State s);
210 
213 
220 
223 
225  uint64_t m_imsi;
226 
228  uint32_t m_csgId;
229 
234 
235  uint8_t m_bidCounter;
237 
239 
242  {
245  };
246 
247  std::list<BearerToBeActivated> m_bearersToBeActivatedList;
248 
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
void SetForwardUpCallback(Callback< void, Ptr< Packet >> cb)
set the callback used to forward data packets up the stack
Definition: epc-ue-nas.cc:136
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
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
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